Documentation
¶
Overview ¶
Package situation assembles the bounded runtime context agents need to act.
Index ¶
- Constants
- func RenderPrompt(payload *contract.AgentContextPayload) (string, error)
- type AgentResolver
- type CoordinatorConfigResolver
- type Deps
- type NetworkReader
- type Service
- func (s *Service) Augment(ctx context.Context, sess *session.Session, message string) (string, error)
- func (s *Service) BundleForActiveLease(ctx context.Context, req taskpkg.ContextRequest) (taskpkg.ContextBundle, error)
- func (s *Service) BundleForOperatorTask(ctx context.Context, req taskpkg.OperatorTaskContextRequest) (taskpkg.ContextBundle, error)
- func (s *Service) ContextForSession(ctx context.Context, info *session.Info) (contract.AgentContextPayload, error)
- func (s *Service) ContextForStartup(ctx context.Context, startup session.StartupPromptContext, ...) (contract.AgentContextPayload, error)
- func (s *Service) PromptSection(ctx context.Context, workspace *workspacepkg.ResolvedWorkspace) (string, error)
- func (s *Service) PromptStartupSection(ctx context.Context, startup session.StartupPromptContext, ...) (string, error)
- func (s *Service) TaskRunPromptOverlay(ctx context.Context, taskRecord taskpkg.Task, run taskpkg.Run, ...) (string, error)
- func (s *Service) TaskRunPromptOverlayByID(ctx context.Context, taskID string, runID string) (string, error)
- type SkillRegistry
- type SoulSnapshotStore
- type TaskStore
- type WorkspaceResolver
Constants ¶
const ( // DefaultSectionLimit is the MVP bound for list sections inside agent context. DefaultSectionLimit = 8 // ProvenanceSource identifies the local daemon context assembler. ProvenanceSource = "daemon.situation" )
Variables ¶
This section is empty.
Functions ¶
func RenderPrompt ¶
func RenderPrompt(payload *contract.AgentContextPayload) (string, error)
RenderPrompt renders a deterministic JSON context block in the required `/agent/context` section order, omitting unavailable sections.
Types ¶
type AgentResolver ¶
type AgentResolver interface {
ResolveAgent(name string, resolved *workspacepkg.ResolvedWorkspace) (aghconfig.AgentDef, error)
}
AgentResolver resolves one agent definition for a workspace.
type CoordinatorConfigResolver ¶
type CoordinatorConfigResolver interface {
ResolveCoordinatorConfig(ctx context.Context, workspaceID string) (aghconfig.CoordinatorConfig, error)
}
CoordinatorConfigResolver reads the safe coordinator limits for a workspace.
type Deps ¶
type Deps struct {
Now func() time.Time
SectionLimit int
WorkspaceResolver WorkspaceResolver
WorkspaceResolverFunc func() WorkspaceResolver
AgentResolver AgentResolver
AgentResolverFunc func() AgentResolver
SkillRegistry SkillRegistry
SkillRegistryFunc func() SkillRegistry
TaskStore TaskStore
TaskStoreFunc func() TaskStore
Network NetworkReader
NetworkFunc func() NetworkReader
CoordinatorConfig CoordinatorConfigResolver
CoordinatorConfigFunc func() CoordinatorConfigResolver
SoulSnapshots SoulSnapshotStore
SoulSnapshotsFunc func() SoulSnapshotStore
}
Deps wires situation context to daemon-owned services. Function fields are evaluated at render time so daemon boot can install the provider before late runtime services are available.
type NetworkReader ¶
type NetworkReader interface {
ListPeers(ctx context.Context, workspaceID string, channel string) ([]network.PeerInfo, error)
Inbox(ctx context.Context, sessionID string) ([]network.Envelope, error)
}
NetworkReader is the narrowed network read surface required by agent context.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service assembles contract.AgentContextPayload and renders prompt sections.
func NewService ¶
NewService constructs a deterministic situation context assembler.
func (*Service) Augment ¶
func (s *Service) Augment( ctx context.Context, sess *session.Session, message string, ) (string, error)
Augment prefixes a live prompt with fresh situation context.
func (*Service) BundleForActiveLease ¶
func (s *Service) BundleForActiveLease( ctx context.Context, req taskpkg.ContextRequest, ) (taskpkg.ContextBundle, error)
func (*Service) BundleForOperatorTask ¶
func (s *Service) BundleForOperatorTask( ctx context.Context, req taskpkg.OperatorTaskContextRequest, ) (taskpkg.ContextBundle, error)
func (*Service) ContextForSession ¶
func (s *Service) ContextForSession( ctx context.Context, info *session.Info, ) (contract.AgentContextPayload, error)
ContextForSession assembles the bounded context for an active session.
func (*Service) ContextForStartup ¶
func (s *Service) ContextForStartup( ctx context.Context, startup session.StartupPromptContext, agent aghconfig.AgentDef, resolvedWorkspace *workspacepkg.ResolvedWorkspace, ) (contract.AgentContextPayload, error)
ContextForStartup assembles the bounded context available before the agent driver starts.
func (*Service) PromptSection ¶
func (s *Service) PromptSection( ctx context.Context, workspace *workspacepkg.ResolvedWorkspace, ) (string, error)
PromptSection implements the legacy workspace-scoped prompt provider seam.
func (*Service) PromptStartupSection ¶
func (s *Service) PromptStartupSection( ctx context.Context, startup session.StartupPromptContext, agent aghconfig.AgentDef, workspace *workspacepkg.ResolvedWorkspace, ) (string, error)
PromptStartupSection renders the startup prompt section with full startup metadata.
func (*Service) TaskRunPromptOverlay ¶
type SkillRegistry ¶
type SkillRegistry interface {
ForWorkspace(ctx context.Context, resolved *workspacepkg.ResolvedWorkspace) ([]*skillspkg.Skill, error)
ForAgent(
ctx context.Context,
resolved *workspacepkg.ResolvedWorkspace,
agentName string,
) ([]*skillspkg.Skill, error)
}
SkillRegistry resolves the active skill set for a workspace.
type SoulSnapshotStore ¶
type SoulSnapshotStore interface {
GetSoulSnapshot(ctx context.Context, id string) (soul.Snapshot, error)
}
SoulSnapshotStore loads immutable Soul snapshots for compact context projection.
type TaskStore ¶
type TaskStore interface {
GetTask(ctx context.Context, id string) (taskpkg.Task, error)
GetTaskRun(ctx context.Context, id string) (taskpkg.Run, error)
ListTaskRuns(ctx context.Context, query taskpkg.RunQuery) ([]taskpkg.Run, error)
ListTaskEvents(ctx context.Context, query taskpkg.EventQuery) ([]taskpkg.Event, error)
ListTaskEventRecords(ctx context.Context, query taskpkg.EventRecordQuery) ([]taskpkg.EventRecord, error)
GetExecutionProfile(ctx context.Context, taskID string) (taskpkg.ExecutionProfile, error)
GetRunReview(ctx context.Context, reviewID string) (taskpkg.RunReview, error)
LookupRunReviewBySession(ctx context.Context, sessionID string) (taskpkg.RunReview, error)
ListRunReviews(ctx context.Context, query taskpkg.RunReviewQuery) ([]taskpkg.RunReview, error)
}
TaskStore is the narrowed task read surface required by agent context.
type WorkspaceResolver ¶
type WorkspaceResolver interface {
Resolve(ctx context.Context, idOrPath string) (workspacepkg.ResolvedWorkspace, error)
}
WorkspaceResolver resolves persisted workspaces into runtime snapshots.