Documentation
¶
Overview ¶
Package scope carries session-, turn-, and tool-scoped metadata through context.Context so that subsystems (journal, metrics, sandbox, and others) can attribute their work without explicit parameter passing.
Scope ¶
A Scope identifies the active execution context:
- Scope.SessionID / Scope.ParentSessionID: the session and its parent (for subagents).
- Scope.TurnID: the user message ID that initiated the current turn.
- Scope.MessageID: the assistant message ID that emitted the active tool call.
- Scope.ToolCallID / Scope.ToolName: the active tool call's identity.
- Scope.WorkspaceRoot: the canonical workspace root path.
- Scope.Agent: the session's agent name.
- Scope.Purpose: the LLM call purpose (chat, compaction, or title).
Context Propagation ¶
With returns a new context with the non-empty fields of the given Scope merged onto any existing scope in the context. From extracts the current scope. Callers nest scopes by calling With at each level (session, turn, tool call), and inner scopes inherit outer fields automatically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Scope ¶
type Scope struct {
SessionID string
TurnID string // User message ID that initiated the turn
MessageID string // Assistant message ID that emitted the tool call
ToolCallID string // Active ToolCall.ID
ToolName string // Active ToolCall.Name
WorkspaceRoot string // Canonical workspace root path
Agent string // The session's agent
Purpose string // LLM call purpose: chat, compaction or title
ParentSessionID string // Parent session for subagents; empty otherwise
}
Scope carries session-, turn-, and tool-scoped metadata across execution.