contextadapter

package
v0.2.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiagnosticCodeContextDocumentTruncated = "workspace.context.document-truncated"
	DiagnosticCodeContextDocumentExcluded  = "workspace.context.document-excluded"
	DiagnosticCodeContextBudgetExceeded    = "workspace.context.budget-exceeded"
)

Variables

This section is empty.

Functions

func ArtifactSupport

func ArtifactSupport() engine.ArtifactSupport

func DiscoveryProfile

func DiscoveryProfile() engine.DiscoveryProfile

func ValidateContextDefinition added in v0.2.11

func ValidateContextDefinition(
	value definition.Definition,
) error

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

func NewAdapter

func NewAdapter(
	query *engine.QueryService,
	runtimePolicy engine.SourceUsePolicy,
	compositionPolicy CompositionPolicy,
) (*Adapter, error)

func (*Adapter) Compose

func (p *Adapter) Compose(
	ctx context.Context,
	rootID artifactstore.RootID,
	recordIDs []artifactstore.RecordID,
) (ContextLoadPlan, error)

func (*Adapter) List

func (p *Adapter) List(
	ctx context.Context,
	rootID artifactstore.RootID,
) ([]ContextDocument, error)

func (*Adapter) Load added in v0.2.11

func (p *Adapter) Load(
	ctx context.Context,
	rootID artifactstore.RootID,
	recordIDs []artifactstore.RecordID,
) (ContextInspection, error)

type CompositionDecision added in v0.2.11

type CompositionDecision struct {
	RecordID      artifactstore.RecordID `json:"recordID"`
	Status        CompositionStatus      `json:"status"`
	Code          string                 `json:"code,omitempty"`
	OriginalBytes int                    `json:"originalBytes"`
	IncludedBytes int                    `json:"includedBytes"`
}

type CompositionPolicy added in v0.2.11

type CompositionPolicy struct {
	MaxPromptBytes   int              `json:"maxPromptBytes"`
	MaxDocumentBytes int              `json:"maxDocumentBytes"`
	Overflow         OverflowBehavior `json:"overflow"`
}

func DefaultCompositionPolicy added in v0.2.11

func DefaultCompositionPolicy() CompositionPolicy

func (CompositionPolicy) Normalized added in v0.2.11

func (p CompositionPolicy) Normalized() CompositionPolicy

func (CompositionPolicy) Validate added in v0.2.11

func (p CompositionPolicy) Validate() error

type CompositionStatus added in v0.2.11

type CompositionStatus string
const (
	CompositionIncluded    CompositionStatus = "included"
	CompositionTruncated   CompositionStatus = "truncated"
	CompositionExcluded    CompositionStatus = "excluded"
	CompositionDenied      CompositionStatus = "denied"
	CompositionUnavailable CompositionStatus = "unavailable"
)

type ContextContribution

type ContextContribution struct {
	RecordID         artifactstore.RecordID `json:"recordID"`
	DefinitionDigest artifactstore.Digest   `json:"definitionDigest"`
	SourceID         artifactstore.SourceID `json:"sourceID"`
	Locator          artifactstore.Locator  `json:"locator"`
	Name             string                 `json:"name"`
	Role             string                 `json:"role"`
	MediaType        string                 `json:"mediaType"`
	Content          string                 `json:"content"`
	ConventionOrder  int                    `json:"conventionOrder"`
	OriginalBytes    int                    `json:"originalBytes"`
	IncludedBytes    int                    `json:"includedBytes"`
	Truncated        bool                   `json:"truncated"`
}

type ContextDecoder

type ContextDecoder struct{}

func NewContextDecoder

func NewContextDecoder() *ContextDecoder

func (*ContextDecoder) Decode

func (*ContextDecoder) ID

func (*ContextDecoder) Recognize

type ContextDocument added in v0.2.11

type ContextDocument struct {
	RecordID         artifactstore.RecordID     `json:"recordID"`
	RecordRevision   uint64                     `json:"recordRevision"`
	DefinitionDigest artifactstore.Digest       `json:"definitionDigest"`
	SourceID         artifactstore.SourceID     `json:"sourceID"`
	Locator          artifactstore.Locator      `json:"locator"`
	Name             string                     `json:"name"`
	Role             string                     `json:"role"`
	MediaType        string                     `json:"mediaType"`
	Enabled          bool                       `json:"enabled"`
	State            record.State               `json:"state"`
	CatalogCurrent   bool                       `json:"catalogCurrent"`
	ProjectionValid  bool                       `json:"projectionValid"`
	RuntimeDisabled  bool                       `json:"runtimeDisabled"`
	Diagnostics      []artifactstore.Diagnostic `json:"diagnostics,omitempty"`
}

type ContextInspection added in v0.2.11

type ContextInspection struct {
	RootID          artifactstore.RootID       `json:"rootID"`
	CatalogRevision uint64                     `json:"catalogRevision"`
	Contributions   []ContextContribution      `json:"contributions"`
	Diagnostics     []artifactstore.Diagnostic `json:"diagnostics,omitempty"`
}

type ContextLoadPlan

type ContextLoadPlan struct {
	RootID          artifactstore.RootID       `json:"rootID"`
	CatalogRevision uint64                     `json:"catalogRevision"`
	Contributions   []ContextContribution      `json:"contributions"`
	Prompt          string                     `json:"prompt"`
	Diagnostics     []artifactstore.Diagnostic `json:"diagnostics,omitempty"`
	Decisions       []CompositionDecision      `json:"decisions"`
	PromptBytes     int                        `json:"promptBytes"`
}

type OverflowBehavior added in v0.2.11

type OverflowBehavior string
const (
	OverflowTruncate OverflowBehavior = "truncate"
	OverflowExclude  OverflowBehavior = "exclude"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL