Documentation
¶
Overview ¶
Package contextresolver discovers and assembles session-scoped coding-agent instructions without depending on an agent framework.
Index ¶
- func ExtensionPolicy(allowed, denied []extensions.ToolPattern, restricted bool) syntax.ToolPolicy
- type Expansion
- type HostSelection
- type InstructionProvenance
- type InstructionRecord
- type Options
- type Resolver
- func (r *Resolver) ActiveScopes() int
- func (r *Resolver) Allows(sessionID, invocationID, toolName string, args map[string]any) bool
- func (r *Resolver) Close()
- func (r *Resolver) Closed() bool
- func (r *Resolver) DropSession(sessionID string)
- func (r *Resolver) Expand(ctx context.Context, value Expansion) (string, error)
- func (r *Resolver) InstructionRecords(sessionID string) []InstructionRecord
- func (r *Resolver) Instructions(ctx context.Context, sessionID, invocationID string) (string, error)
- func (r *Resolver) IntersectPolicy(sessionID, invocationID string, policy syntax.ToolPolicy) error
- func (r *Resolver) ObserveTouch(_ context.Context, touch workspace.Touch)
- func (r *Resolver) ReleaseRun(sessionID string)
- func (r *Resolver) SetRunPolicy(sessionID string, policy syntax.ToolPolicy) error
- func (r *Resolver) StartSession(ctx context.Context, sessionID string) error
- func (r *Resolver) Visible(sessionID, invocationID, toolName string) bool
- type TrustLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtensionPolicy ¶
func ExtensionPolicy(allowed, denied []extensions.ToolPattern, restricted bool) syntax.ToolPolicy
ExtensionPolicy projects a normalized extension tool declaration into the single turn-scope policy representation.
Types ¶
type Expansion ¶
type Expansion struct {
Source string
Path string
Trust TrustLevel
Arguments string
Declared []string
SessionID string
SkillDir string
ProjectDir string
PluginRoot string
PluginData string
Effort string
}
Expansion supplies the supported deterministic extension substitutions.
type HostSelection ¶
HostSelection enables instruction inputs owned by each compatible host.
type InstructionProvenance ¶
type InstructionProvenance struct {
Host string `json:"host"`
Scope string `json:"scope"`
SourcePath string `json:"source_path"`
Enabled bool `json:"enabled"`
Trusted bool `json:"trusted"`
Classification string `json:"classification"`
}
InstructionProvenance identifies one retained instruction source.
type InstructionRecord ¶
type InstructionRecord struct {
Name string `json:"name"`
Provenance []InstructionProvenance `json:"provenance"`
}
InstructionRecord is secret-free metadata for one normalized instruction declaration retained by a session snapshot.
type Options ¶
type Options struct {
Root *workspace.Root
HomeDir string
ImportRoots []string
TrustedRoots []string
MaxFileBytes int
MaxBytes int
MaxImportDepth int
MaxImportDepthSet bool
MaxDiscoveryEntries int
PromptCommands config.PromptCommandMode
CommandTimeout time.Duration
DocumentTimeout time.Duration
CommandOutputBytes int
DocumentOutputBytes int
Executor *shellexec.Executor
Hosts *HostSelection
WarningSink warning.Warner
}
Options configures one resolver owned by a Harness.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver owns immutable session snapshots, lazy activation, and turn scope.
func (*Resolver) ActiveScopes ¶
ActiveScopes reports the current scope count for conformance tests.
func (*Resolver) Close ¶
func (r *Resolver) Close()
Close releases all session snapshots. It is idempotent.
func (*Resolver) DropSession ¶
DropSession releases one snapshot after transactional session-start failure.
func (*Resolver) Expand ¶
Expand applies argument and Harness substitutions once, then runs prompt commands through the resolver's single bounded executor and trust gate.
func (*Resolver) InstructionRecords ¶
func (r *Resolver) InstructionRecords(sessionID string) []InstructionRecord
InstructionRecords returns a defensive copy of normalized metadata from a started session snapshot.
func (*Resolver) Instructions ¶
func (r *Resolver) Instructions(ctx context.Context, sessionID, invocationID string) (string, error)
Instructions returns assembled instructions and records the exact invocation policy used by the native before-tool callback.
func (*Resolver) IntersectPolicy ¶
func (r *Resolver) IntersectPolicy(sessionID, invocationID string, policy syntax.ToolPolicy) error
IntersectPolicy atomically narrows the active invocation scope. It cannot create a scope or widen any existing instruction or skill policy.
func (*Resolver) ObserveTouch ¶
ObserveTouch activates nested and path-scoped documents once per session.
func (*Resolver) ReleaseRun ¶
ReleaseRun removes every invocation scope belonging to a completed or aborted session run.
func (*Resolver) SetRunPolicy ¶
func (r *Resolver) SetRunPolicy(sessionID string, policy syntax.ToolPolicy) error
SetRunPolicy installs one additional deny-wins layer for the next active run in a session. The Harness serializes runs per session.
func (*Resolver) StartSession ¶
StartSession captures a stable catalog snapshot for a session.
type TrustLevel ¶
type TrustLevel uint8
TrustLevel classifies command authority without changing instruction visibility.
const ( TrustUntrusted TrustLevel = iota TrustRepository TrustUser )
func ExtensionTrust ¶
func ExtensionTrust(source extensions.Provenance) TrustLevel
ExtensionTrust projects normalized extension provenance into the single prompt-execution trust model.
func (TrustLevel) String ¶
func (t TrustLevel) String() string