intelligence

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package intelligence provides snapshot-bound, source-grounded Go context.

Index

Constants

View Source
const (
	// RefactorRecoveryClean means no recovery journal exists.
	RefactorRecoveryClean = "clean"
	// RefactorRecoveryRequired means an interrupted apply must be resolved.
	RefactorRecoveryRequired = "recovery_required"
	// RefactorRecoveryRecovered means guarded preimages were restored.
	RefactorRecoveryRecovered = "recovered"
)
View Source
const (

	// RefactorRename identifies a guarded symbol rename.
	RefactorRename = "rename"
	// RefactorFormat identifies guarded document formatting.
	RefactorFormat = "format"
	// RefactorOrganizeImports identifies a guarded import organization action.
	RefactorOrganizeImports = "organize_imports"
	// RefactorFixAll identifies guarded source.fixAll actions.
	RefactorFixAll = "fix_all"
)
View Source
const (
	// ContextSchemaVersion identifies the frozen Context Pack contract.
	ContextSchemaVersion = "agentic.context/v1"
	// ChangeSchemaVersion identifies the frozen Change Contract contract.
	ChangeSchemaVersion = "agentic.change/v1"

	// DefaultBriefBytes is the compact workspace-brief response budget.
	DefaultBriefBytes = 8 << 10
	// DefaultSymbolBytes is the compact symbol-context response budget.
	DefaultSymbolBytes = 16 << 10
	// DefaultSearchLimit is the ordinary workspace-symbol result count.
	DefaultSearchLimit = 20
	// MaximumSearchLimit bounds one workspace-symbol response.
	MaximumSearchLimit = 100
)
View Source
const (
	// MaxArtifactChunkBytes bounds one resource response. The limit is applied
	// to UTF-8 bytes, while never splitting a code point.
	MaxArtifactChunkBytes int64 = 64 << 10
)

Variables

View Source
var (
	// ErrArtifactNotFound means a cursor references no retained artifact.
	ErrArtifactNotFound = errors.New("artifact not found")
	// ErrArtifactMismatch means an artifact belongs to another snapshot or operation.
	ErrArtifactMismatch = errors.New("artifact binding mismatch")
	// ErrArtifactCorrupt means persisted artifact metadata failed validation.
	ErrArtifactCorrupt = errors.New("artifact corrupt")
	// ErrCursorInvalid means a continuation cursor is malformed or mismatched.
	ErrCursorInvalid = errors.New("invalid artifact cursor")
)
View Source
var (
	// ErrArtifactOffset means a resource cursor is outside a UTF-8 boundary.
	ErrArtifactOffset = errors.New("artifact offset out of range")
	// ErrArtifactLimit means a requested resource chunk is empty or too large.
	ErrArtifactLimit = errors.New("invalid artifact chunk limit")
)
View Source
var (
	// ErrContractNotFound means no contained private contract matches the ID.
	ErrContractNotFound = errors.New("change contract not found")
	// ErrContractCorrupt means persisted contract state violates its schema.
	ErrContractCorrupt = errors.New("change contract is corrupt")
)
View Source
var (
	// ErrVerificationNotFound means no private report exists for the repository.
	ErrVerificationNotFound = errors.New("verification report not found")
	// ErrVerificationCorrupt means private report state violates its identity.
	ErrVerificationCorrupt = errors.New("verification report is corrupt")
)
View Source
var ErrSnapshotChanged = errors.New("workspace snapshot changed")

ErrSnapshotChanged means the caller's reference no longer identifies the workspace observed by the current operation.

Functions

func EncodeArtifactCursor

func EncodeArtifactCursor(id string, offset int64) (string, error)

EncodeArtifactCursor creates an opaque cursor for one artifact offset.

Types

type Artifact

type Artifact struct {
	ID         string `json:"id"`
	SnapshotID string `json:"snapshot_id"`
	Key        string `json:"key"`
	Payload    []byte `json:"payload"`
}

Artifact is one normalized payload bound to a snapshot and operation key.

type ArtifactChunk

type ArtifactChunk struct {
	ID         string `json:"id"`
	SnapshotID string `json:"snapshot_id"`
	Offset     int64  `json:"offset"`
	TotalBytes int64  `json:"total_bytes"`
	Text       string `json:"text"`
	NextCursor string `json:"next_cursor,omitempty"`
	Complete   bool   `json:"complete"`
}

ArtifactChunk is a deterministic, snapshot-bound slice of an artifact. Offset and TotalBytes are byte offsets, not rune or model-token counts.

type ArtifactCursor

type ArtifactCursor struct {
	ID     string
	Offset int64
}

ArtifactCursor is the decoded position within one stored artifact.

func DecodeArtifactCursor

func DecodeArtifactCursor(cursor, expectedID string) (ArtifactCursor, error)

DecodeArtifactCursor validates an opaque cursor and optional artifact ID.

type ArtifactStore

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

ArtifactStore persists private, content-addressed context details.

func NewArtifactStore

func NewArtifactStore(root string) (*ArtifactStore, error)

NewArtifactStore opens an explicit root or the default private user cache.

func (*ArtifactStore) Get

func (s *ArtifactStore) Get(id, expectedSnapshotID, expectedKey string) (Artifact, error)

Get loads an artifact only when its snapshot and operation key match.

func (*ArtifactStore) Put

func (s *ArtifactStore) Put(snapshotID, key string, payload []byte) (Artifact, error)

Put atomically persists one snapshot-bound normalized payload.

func (*ArtifactStore) ReadChunk

func (s *ArtifactStore) ReadChunk(ctx context.Context, id, cursor string, offset, limit int64) (ArtifactChunk, error)

ReadChunk reads a bounded UTF-8-safe portion of an artifact. The artifact is content-addressed and its persisted snapshot binding is revalidated before bytes are exposed. A cursor determines the offset when supplied.

type BeginRequest

type BeginRequest struct {
	Base            string
	Goal            string
	Scope           string
	FocusedPaths    []string
	FocusedPackages []string
	FocusedSymbols  []SymbolRef
	AllowedPaths    []string
	Policies        StructuralPolicies
}

BeginRequest creates one persistent Change Contract.

type BriefRequest

type BriefRequest struct {
	Base               string
	Scope              string
	ExpectedSnapshotID string
	MaxBytes           int
}

BriefRequest selects one compact workspace overview.

type BuildConfig

type BuildConfig struct {
	GOOS       string   `json:"goos"`
	GOARCH     string   `json:"goarch"`
	CGOEnabled bool     `json:"cgo_enabled"`
	GOFLAGS    string   `json:"goflags"`
	Tags       []string `json:"tags"`
	Workspace  string   `json:"workspace"`
}

BuildConfig records source-selection inputs that affect Go semantics.

type CallEdge

type CallEdge struct {
	Direction string      `json:"direction"`
	Symbol    SymbolMatch `json:"symbol"`
}

CallEdge is one bounded static call-hierarchy relationship.

type CallSet

type CallSet struct {
	Items     []CallEdge `json:"items"`
	Total     int        `json:"total"`
	Truncated bool       `json:"truncated"`
}

CallSet retains complete counts for a bounded call-hierarchy facet.

type Capabilities

type Capabilities struct {
	Provider        Provider           `json:"provider"`
	Semantic        CapabilityManifest `json:"semantic"`
	ContextSchema   string             `json:"context_schema"`
	BriefBytes      int                `json:"brief_bytes"`
	SymbolBytes     int                `json:"symbol_bytes"`
	SearchDefault   int                `json:"search_default"`
	SearchMaximum   int                `json:"search_maximum"`
	ArtifactMaximum int64              `json:"artifact_maximum_bytes"`
}

Capabilities describes the effective semantic and compact-context contract.

type CapabilityManifest

type CapabilityManifest struct {
	WorkspaceSymbol bool `json:"workspace_symbol"`
	Hover           bool `json:"hover"`
	Definition      bool `json:"definition"`
	TypeDefinition  bool `json:"type_definition"`
	References      bool `json:"references"`
	Implementation  bool `json:"implementation"`
	DocumentSymbol  bool `json:"document_symbol"`
	CallHierarchy   bool `json:"call_hierarchy"`
	Diagnostics     bool `json:"diagnostics"`
	Rename          bool `json:"rename"`
	Formatting      bool `json:"formatting"`
	CodeAction      bool `json:"code_action"`
}

CapabilityManifest is the normalized semantic-provider feature set.

type ChangeContext

type ChangeContext struct {
	Files                  []string `json:"files"`
	FilesTotal             int      `json:"files_total"`
	Declarations           []string `json:"declarations"`
	DeclarationsTotal      int      `json:"declarations_total"`
	DirectUnits            []string `json:"direct_units"`
	DirectUnitsTotal       int      `json:"direct_units_total"`
	ReverseDependents      []string `json:"reverse_dependents"`
	ReverseDependentsTotal int      `json:"reverse_dependents_total"`
	ObservedUnits          int      `json:"observed_units"`
	Truncated              bool     `json:"truncated"`
	Complete               bool     `json:"complete"`
}

ChangeContext is a compact, language-neutral view of local change impact.

type ChangeContract

type ChangeContract struct {
	SchemaVersion       string             `json:"schema_version"`
	ID                  string             `json:"id"`
	RepositoryID        string             `json:"repository_id"`
	Goal                string             `json:"goal"`
	Base                string             `json:"base"`
	Scope               string             `json:"scope"`
	InitialSnapshot     SnapshotRef        `json:"initial_snapshot"`
	LatestSnapshot      SnapshotRef        `json:"latest_snapshot"`
	FocusedPaths        []string           `json:"focused_paths"`
	FocusedPackages     []string           `json:"focused_packages"`
	FocusedSymbols      []SymbolRef        `json:"focused_symbols"`
	AllowedPaths        []string           `json:"allowed_paths"`
	Policies            StructuralPolicies `json:"policies"`
	Decisions           []Decision         `json:"decisions"`
	UnresolvedQuestions []string           `json:"unresolved_questions"`
	Checkpoints         []CheckpointRef    `json:"checkpoints"`
	LatestVerification  string             `json:"latest_verification,omitempty"`
	Active              bool               `json:"active"`
	CreatedAt           time.Time          `json:"created_at"`
	UpdatedAt           time.Time          `json:"updated_at"`
}

ChangeContract is one persistent structural continuity record.

type Checkpoint

type Checkpoint struct {
	ID                string            `json:"id"`
	ContractID        string            `json:"contract_id"`
	Previous          SnapshotRef       `json:"previous"`
	Current           SnapshotRef       `json:"current"`
	AffectedPackages  []string          `json:"affected_packages"`
	AffectedTotal     int               `json:"affected_packages_total"`
	AffectedTruncated bool              `json:"affected_packages_truncated"`
	Diagnostics       []Diagnostic      `json:"diagnostics"`
	Violations        []PolicyViolation `json:"violations"`
	Uncertainties     []Uncertainty     `json:"uncertainties"`
	Complete          bool              `json:"complete"`
	RecordedAt        time.Time         `json:"recorded_at"`
}

Checkpoint is one snapshot transition and its structural evidence.

type CheckpointRef

type CheckpointRef struct {
	ID                 string    `json:"id"`
	PreviousSnapshotID string    `json:"previous_snapshot_id"`
	CurrentSnapshotID  string    `json:"current_snapshot_id"`
	RecordedAt         time.Time `json:"recorded_at"`
}

CheckpointRef is one immutable snapshot transition in a Change Contract.

type CheckpointRequest

type CheckpointRequest struct {
	ContractID          string
	ExpectedSnapshot    string
	Decisions           []string
	UnresolvedQuestions []string
}

CheckpointRequest records structural drift and caller-authored handoff state.

type ContextPack

type ContextPack struct {
	SchemaVersion string           `json:"schema_version"`
	Provider      Provider         `json:"provider"`
	Snapshot      SnapshotRef      `json:"snapshot"`
	Modules       []ModuleSummary  `json:"modules"`
	Packages      []PackageSummary `json:"packages"`
	Symbols       []SymbolMatch    `json:"symbols"`
	Diagnostics   []Diagnostic     `json:"diagnostics"`
	Guidance      []GuidanceRef    `json:"guidance"`
	Change        *ChangeContext   `json:"change,omitempty"`
	Risks         []RiskArea       `json:"risks"`
	Uncertainties []Uncertainty    `json:"uncertainties"`
	Totals        ContextTotals    `json:"totals"`
	Truncated     bool             `json:"truncated"`
	NextCursor    string           `json:"next_cursor,omitempty"`
}

ContextPack is the durable, compact workspace-or-symbol context boundary.

type ContextTotals

type ContextTotals struct {
	Modules       int `json:"modules"`
	Packages      int `json:"packages"`
	Symbols       int `json:"symbols"`
	Diagnostics   int `json:"diagnostics"`
	Guidance      int `json:"guidance"`
	Risks         int `json:"risks"`
	Uncertainties int `json:"uncertainties"`
}

ContextTotals retains complete counts before response-budget truncation.

type ContractExport

type ContractExport struct {
	ContractID string `json:"contract_id"`
	SnapshotID string `json:"snapshot_id"`
	Path       string `json:"path"`
	Digest     string `json:"digest"`
}

ContractExport identifies an explicit handoff without exposing an absolute workspace or private cache path.

func ExportChangeContract

func ExportChangeContract(
	ctx context.Context,
	ws *workspace.Workspace,
	runner *execution.Runner,
	store *ContractStore,
	request ContractExportRequest,
) (ContractExport, error)

ExportChangeContract writes a caller-requested, private copy into an existing contained workspace directory. It never overwrites an existing path.

type ContractExportRequest

type ContractExportRequest struct {
	ContractID  string
	Destination string
}

ContractExportRequest selects one explicit workspace-contained handoff copy. An empty contract ID selects the current active contract for the repository.

type ContractStore

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

ContractStore persists private Change Contracts outside target worktrees.

func NewContractStore

func NewContractStore(root string) (*ContractStore, error)

NewContractStore creates a private contract store. An empty root uses the platform user cache directory.

func (*ContractStore) Current

func (s *ContractStore) Current(ctx context.Context, repositoryID string) (ChangeContract, error)

Current returns the most recently updated active contract for a repository.

func (*ContractStore) Load

func (s *ContractStore) Load(ctx context.Context, repositoryID, contractID string) (ChangeContract, error)

Load reads one repository-bound contract without exposing its cache path.

func (*ContractStore) Save

func (s *ContractStore) Save(ctx context.Context, contract ChangeContract) error

Save atomically writes one validated contract with private permissions.

type Core

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

Core is safe for concurrent read-only use. It assembles adapter-independent intelligence from snapshot, semantic, change-discovery, artifact, and verification infrastructure. Change Contract mutation is serialized within one process; callers must not mutate the same contract from separate Core processes concurrently.

func NewCore

func NewCore(
	ws *workspace.Workspace,
	runner *execution.Runner,
	manager *gopls.Manager,
	changes verification.ChangeAnalyzer,
	verify *verification.Engine,
) (*Core, error)

NewCore constructs the supported pinned-gopls intelligence service. The sidecar manager remains infrastructure and no LSP type crosses this seam.

func (*Core) Begin

func (c *Core) Begin(ctx context.Context, request BeginRequest) (ChangeContract, error)

Begin creates one private, snapshot-bound Change Contract. Goal text is retained exactly and never interpreted as a policy.

func (*Core) Brief

func (c *Core) Brief(ctx context.Context, request BriefRequest) (ContextPack, error)

Brief assembles a compact workspace/package overview with optional change impact when a local base is supplied.

func (*Core) Capabilities

func (c *Core) Capabilities() Capabilities

Capabilities returns the effective negotiated semantic manifest and compact response defaults without exposing the sidecar path or LSP wire types.

func (*Core) Checkpoint

func (c *Core) Checkpoint(ctx context.Context, request CheckpointRequest) (Checkpoint, error)

Checkpoint records intentional worktree drift from the contract's latest snapshot and rejects callers that do not name that exact lineage point.

func (*Core) CurrentChangeContract

func (c *Core) CurrentChangeContract(ctx context.Context) (ChangeContract, error)

CurrentChangeContract returns the repository's latest active private contract without exposing its cache location.

func (*Core) CurrentVerification

func (c *Core) CurrentVerification(ctx context.Context) (verification.Report, error)

CurrentVerification returns the repository's latest private finalized report without exposing its cache path.

func (*Core) ReadArtifact

func (c *Core) ReadArtifact(ctx context.Context, cursor string, limit int64) (ArtifactChunk, error)

ReadArtifact resolves an opaque Context Pack continuation cursor into one bounded resource chunk.

func (*Core) Refactor

func (c *Core) Refactor(ctx context.Context, request RefactorRequest) (RefactorResult, error)

Refactor previews or applies one deterministic, snapshot-bound source edit plan. It never invokes Git or mutates files not named by the stored plan.

func (*Core) Search

func (c *Core) Search(ctx context.Context, request SearchRequest) (SearchResult, error)

Search returns one deterministic page of snapshot-bound workspace symbols.

func (*Core) Symbol

func (c *Core) Symbol(ctx context.Context, request SymbolRequest) (SymbolContext, error)

Symbol returns default semantic facets for a stable ref or compatibility source position, rejecting any stale snapshot identity.

func (*Core) Verify

func (c *Core) Verify(ctx context.Context, request verification.Request) (verification.Report, error)

Verify brackets the existing executed-evidence collector with one immutable semantic snapshot, then adds neutral diagnostics, optional Change Contract compliance, provider capabilities, and operation provenance before policy evaluation.

type Decision

type Decision struct {
	Text      string    `json:"text"`
	CreatedAt time.Time `json:"created_at"`
}

Decision is caller-authored handoff context and is never semantically enforced.

type Diagnostic

type Diagnostic struct {
	Source   string   `json:"source"`
	Code     string   `json:"code,omitempty"`
	Severity string   `json:"severity"`
	Message  string   `json:"message"`
	Location Location `json:"location"`
}

Diagnostic is one normalized compiler or semantic-provider observation.

type GuidanceRef

type GuidanceRef struct {
	File   string `json:"file"`
	Digest string `json:"digest"`
}

GuidanceRef identifies applicable repository guidance by location and hash.

type Location

type Location struct {
	File      string `json:"file"`
	Line      int    `json:"line"`
	Column    int    `json:"column"`
	EndLine   int    `json:"end_line,omitempty"`
	EndColumn int    `json:"end_column,omitempty"`
}

Location is a workspace-relative, one-based UTF-8 byte source range.

type LocationSet

type LocationSet struct {
	Items     []Location `json:"items"`
	Total     int        `json:"total"`
	Truncated bool       `json:"truncated"`
}

LocationSet retains complete counts for a bounded location facet.

type ModuleSummary

type ModuleSummary struct {
	Path      string `json:"path"`
	GoVersion string `json:"go_version"`
	Workspace string `json:"workspace"`
}

ModuleSummary describes one active Go module without an absolute path.

type PackageSummary

type PackageSummary struct {
	Kind        string   `json:"kind"`
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Directory   string   `json:"directory"`
	Module      string   `json:"module"`
	Imports     int      `json:"imports"`
	Tests       int      `json:"tests"`
	Exported    []string `json:"exported"`
	Cgo         bool     `json:"cgo"`
	Generated   bool     `json:"generated"`
	Constrained bool     `json:"constrained"`
}

PackageSummary describes one workspace package and compact API facts.

type PolicyMode

type PolicyMode string

PolicyMode is the structural response to one machine-checkable change.

const (
	// PolicyAllow records a structural condition without a violation.
	PolicyAllow PolicyMode = "allow"
	// PolicyWarn records a non-blocking structural violation.
	PolicyWarn PolicyMode = "warn"
	// PolicyForbid records a blocking structural violation.
	PolicyForbid PolicyMode = "forbid"
)

type PolicyViolation

type PolicyViolation struct {
	Code      string     `json:"code"`
	Policy    PolicyMode `json:"policy"`
	Message   string     `json:"message"`
	Locations []Location `json:"locations"`
}

PolicyViolation is one machine-checkable Change Contract deviation.

type Position

type Position struct {
	Line      int `json:"line"`
	Character int `json:"character"`
}

Position is a zero-based UTF-16 LSP position.

type Provider

type Provider struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Provider identifies the implementation that produced intelligence.

type RefactorPreimage

type RefactorPreimage struct {
	Path   string `json:"path"`
	Digest string `json:"digest"`
}

RefactorPreimage binds one preview target to the content that may be replaced by an explicitly approved apply.

type RefactorRecoveryResult

type RefactorRecoveryResult struct {
	Status         string
	RecoveredFiles int
}

RefactorRecoveryResult reports private journal state without exposing cache paths or source contents.

func RecoverGuardedRefactor

func RecoverGuardedRefactor(
	ctx context.Context,
	ws *workspace.Workspace,
	runner *execution.Runner,
	store *RefactorStore,
	recoverState bool,
) (RefactorRecoveryResult, error)

RecoverGuardedRefactor inspects or safely restores the current repository's interrupted apply journal. Restore occurs only when every target still matches a recorded preimage or postimage.

type RefactorRequest

type RefactorRequest struct {
	Operation          string
	Ref                SymbolRef
	NewName            string
	Files              []string
	PlanID             string
	ExpectedSnapshotID string
	Apply              bool
}

RefactorRequest previews or applies one deterministic semantic operation.

type RefactorResult

type RefactorResult struct {
	PlanID        string             `json:"plan_id"`
	Operation     string             `json:"operation"`
	Snapshot      SnapshotRef        `json:"snapshot"`
	Applied       bool               `json:"applied"`
	Diff          string             `json:"diff"`
	AffectedFiles []string           `json:"affected_files"`
	Preimages     []RefactorPreimage `json:"preimages"`
	Risks         []RiskArea         `json:"risks"`
	Uncertainties []Uncertainty      `json:"uncertainties"`
}

RefactorResult is one content-addressed preview or guarded apply outcome.

type RefactorStore

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

RefactorStore persists private immutable plans and one recovery journal per repository outside target worktrees.

func NewRefactorStore

func NewRefactorStore(root string) (*RefactorStore, error)

NewRefactorStore creates private plan and recovery storage. An empty root uses the platform user cache directory.

type RiskArea

type RiskArea struct {
	Code      string     `json:"code"`
	Summary   string     `json:"summary"`
	Guidance  string     `json:"guidance"`
	Locations []Location `json:"locations"`
}

RiskArea identifies a source-grounded review lens, not a diagnosed defect.

type SearchRequest

type SearchRequest struct {
	Query              string
	Scope              string
	ExpectedSnapshotID string
	Limit              int
	Cursor             string
}

SearchRequest selects a deterministic page of workspace symbols.

type SearchResult

type SearchResult struct {
	SchemaVersion string        `json:"schema_version"`
	Provider      Provider      `json:"provider"`
	Snapshot      SnapshotRef   `json:"snapshot"`
	Matches       []SymbolMatch `json:"matches"`
	Total         int           `json:"total"`
	Truncated     bool          `json:"truncated"`
	NextCursor    string        `json:"next_cursor,omitempty"`
	Uncertainties []Uncertainty `json:"uncertainties"`
}

SearchResult is one snapshot-bound, deterministically ordered search page.

type SemanticIdentity

type SemanticIdentity struct {
	Version      string             `json:"version"`
	Capabilities CapabilityManifest `json:"capabilities"`
}

SemanticIdentity records the exact provider used to interpret a snapshot.

type Service

Service is the sole semantic product seam. Its domain types are independent of MCP, LSP, gopls, Git, and subprocess protocols.

type SnapshotRef

type SnapshotRef struct {
	ID              string             `json:"id"`
	RepositoryID    string             `json:"repository_id"`
	Workspace       string             `json:"workspace"`
	RequestedBase   string             `json:"requested_base,omitempty"`
	BaseCommit      string             `json:"base_commit,omitempty"`
	MergeBaseCommit string             `json:"merge_base_commit,omitempty"`
	HeadCommit      string             `json:"head_commit"`
	ContentDigest   string             `json:"content_digest"`
	GoVersion       string             `json:"go_version"`
	GoplsVersion    string             `json:"gopls_version"`
	Capabilities    CapabilityManifest `json:"capabilities"`
	Build           BuildConfig        `json:"build"`
	Scope           string             `json:"scope"`
}

SnapshotRef is an immutable, portable reference to one observed workspace. It contains identities and versions, never absolute repository paths.

type SnapshotRequest

type SnapshotRequest struct {
	Base     string
	Scope    string
	Semantic SemanticIdentity
}

SnapshotRequest selects the local base, package scope, and semantic provider whose inputs must be bound into the snapshot.

type Snapshotter

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

Snapshotter captures and validates immutable workspace identities.

func NewSnapshotter

func NewSnapshotter(ws *workspace.Workspace, runner *execution.Runner) (*Snapshotter, error)

NewSnapshotter constructs a snapshot source over shared contained execution.

func (*Snapshotter) Capture

func (s *Snapshotter) Capture(ctx context.Context, request SnapshotRequest) (SnapshotRef, error)

Capture observes the final worktree twice and rejects concurrent drift.

func (*Snapshotter) Validate

func (s *Snapshotter) Validate(ctx context.Context, expected SnapshotRef) (SnapshotRef, error)

Validate recaptures the supplied scope and rejects stale references.

type SourcePosition

type SourcePosition struct {
	File   string `json:"file"`
	Line   int    `json:"line"`
	Column int    `json:"column"`
}

SourcePosition is a workspace-relative one-based UTF-8 byte position.

type StructuralPolicies

type StructuralPolicies struct {
	OutsideAllowedPaths PolicyMode `json:"outside_allowed_paths"`
	OutsideFocus        PolicyMode `json:"outside_focus"`
	ExportedAPI         PolicyMode `json:"exported_api"`
	Dependency          PolicyMode `json:"dependency"`
	CrossModule         PolicyMode `json:"cross_module"`
	GeneratedFile       PolicyMode `json:"generated_file"`
	TestDeletion        PolicyMode `json:"test_deletion"`
}

StructuralPolicies configures machine-checkable Change Contract boundaries.

func DefaultStructuralPolicies

func DefaultStructuralPolicies() StructuralPolicies

DefaultStructuralPolicies returns the v0.5 machine-checkable defaults.

type SymbolContext

type SymbolContext struct {
	SchemaVersion    string        `json:"schema_version"`
	Provider         Provider      `json:"provider"`
	Snapshot         SnapshotRef   `json:"snapshot"`
	Symbol           SymbolMatch   `json:"symbol"`
	Hover            string        `json:"hover"`
	Definitions      LocationSet   `json:"definitions"`
	TypeDefinitions  LocationSet   `json:"type_definitions"`
	References       LocationSet   `json:"references"`
	Implementations  SymbolSet     `json:"implementations"`
	RelatedTests     LocationSet   `json:"related_tests"`
	Diagnostics      []Diagnostic  `json:"diagnostics"`
	DiagnosticsTotal int           `json:"diagnostics_total"`
	Calls            CallSet       `json:"calls"`
	Uncertainties    []Uncertainty `json:"uncertainties"`
	Truncated        bool          `json:"truncated"`
	NextCursor       string        `json:"next_cursor,omitempty"`
}

SymbolContext contains default source-grounded facets for one Go symbol.

type SymbolFacets

type SymbolFacets struct {
	CallHierarchy  bool `json:"call_hierarchy"`
	TypeDefinition bool `json:"type_definition"`
}

SymbolFacets selects optional expensive symbol relationships.

type SymbolMatch

type SymbolMatch struct {
	Ref       SymbolRef `json:"ref"`
	Kind      string    `json:"kind"`
	Name      string    `json:"name"`
	Qualified string    `json:"qualified"`
	Package   string    `json:"package"`
	Location  Location  `json:"location"`
}

SymbolMatch is one normalized workspace symbol with source provenance.

type SymbolRef

type SymbolRef string

SymbolRef is an opaque snapshot-bound Go symbol identity.

type SymbolRequest

type SymbolRequest struct {
	Ref                SymbolRef
	Position           *SourcePosition
	ExpectedSnapshotID string
	Facets             SymbolFacets
	MaxBytes           int
}

SymbolRequest resolves a stable ref or a compatibility source position.

type SymbolSet

type SymbolSet struct {
	Items     []SymbolMatch `json:"items"`
	Total     int           `json:"total"`
	Truncated bool          `json:"truncated"`
}

SymbolSet retains complete counts for a bounded symbol facet.

type Uncertainty

type Uncertainty struct {
	Code      string     `json:"code"`
	Message   string     `json:"message"`
	Locations []Location `json:"locations"`
}

Uncertainty states an analytical limit without inferring safety.

type VerificationStore

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

VerificationStore persists content-addressed reports privately outside the target worktree.

func NewVerificationStore

func NewVerificationStore(root string) (*VerificationStore, error)

NewVerificationStore creates private report storage. An empty root uses the platform user cache directory.

func (*VerificationStore) Current

func (s *VerificationStore) Current(ctx context.Context, repositoryID string) (verification.Report, error)

Current returns the latest validated private report for a repository.

func (*VerificationStore) Save

func (s *VerificationStore) Save(ctx context.Context, repositoryID string, report verification.Report) error

Save atomically persists a finalized report and advances the repository's private latest pointer.

Jump to

Keyboard shortcuts

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