contextadapter

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MPL-2.0 Imports: 19 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() spec.ArtifactSupport

func DiscoveryProfile

func DiscoveryProfile() spec.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 *artifactadapter.QueryService,
	runtimePolicy artifactadapter.SourceUsePolicy,
	compositionPolicy CompositionPolicy,
) (*Adapter, error)

func (*Adapter) Compose

func (p *Adapter) Compose(
	ctx context.Context,
	workspace collection.CollectionRef,
	artifactRefs []artifact.ArtifactRef,
) (ContextLoadPlan, error)

func (*Adapter) List

func (p *Adapter) List(
	ctx context.Context,
	workspace collection.CollectionRef,
) ([]ContextDocument, error)

func (*Adapter) Load added in v0.2.11

func (p *Adapter) Load(
	ctx context.Context,
	workspace collection.CollectionRef,
	artifactRefs []artifact.ArtifactRef,
) (ContextInspection, error)

type CompositionDecision added in v0.2.11

type CompositionDecision struct {
	Artifact      artifact.ArtifactRef `json:"artifact"`
	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 {
	Artifact         artifact.ArtifactRef                      `json:"artifact"`
	ArtifactRevision uint64                                    `json:"artifactRevision"`
	DefinitionDigest cryptoutil.Digest                         `json:"definitionDigest"`
	SourceID         basespec.SourceID                         `json:"sourceID"`
	Locator          basespec.Locator                          `json:"locator"`
	Name             string                                    `json:"name"`
	Role             artifactbuiltin.WorkspaceContextRole      `json:"role"`
	MediaType        artifactbuiltin.WorkspaceContextMediaType `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

func (*ContextDecoder) Revision added in v0.2.13

func (*ContextDecoder) Revision() string

type ContextDocument added in v0.2.11

type ContextDocument struct {
	Artifact         artifact.ArtifactRef                      `json:"artifact"`
	ArtifactRevision uint64                                    `json:"artifactRevision"`
	DefinitionDigest cryptoutil.Digest                         `json:"definitionDigest"`
	SourceID         basespec.SourceID                         `json:"sourceID"`
	Locator          basespec.Locator                          `json:"locator"`
	Name             string                                    `json:"name"`
	Role             artifactbuiltin.WorkspaceContextRole      `json:"role"`
	MediaType        artifactbuiltin.WorkspaceContextMediaType `json:"mediaType"`
	Enabled          bool                                      `json:"enabled"`
	State            artifact.State                            `json:"state"`
	CatalogCurrent   bool                                      `json:"catalogCurrent"`
	ProjectionValid  bool                                      `json:"projectionValid"`
	RuntimeDisabled  bool                                      `json:"runtimeDisabled"`
	Diagnostics      []diagnostic.Diagnostic                   `json:"diagnostics,omitempty"`
}

type ContextInspection added in v0.2.11

type ContextInspection struct {
	Workspace       collection.CollectionRef `json:"workspace"`
	CatalogRevision uint64                   `json:"catalogRevision"`
	Contributions   []ContextContribution    `json:"contributions"`
	Diagnostics     []diagnostic.Diagnostic  `json:"diagnostics,omitempty"`
}

type ContextLoadPlan

type ContextLoadPlan struct {
	Workspace       collection.CollectionRef `json:"workspace"`
	CatalogRevision uint64                   `json:"catalogRevision"`
	Contributions   []ContextContribution    `json:"contributions"`
	Prompt          string                   `json:"prompt"`
	Diagnostics     []diagnostic.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