Documentation
¶
Index ¶
- Constants
- Variables
- func FormatPlanUpdateForDisplay(update PlanUpdateInfo) string
- func HookActiveTrust(entry HookListEntry) bool
- func HookNeedsReview(entry HookListEntry) bool
- func KnownHookEvent(event HookEvent) bool
- func WorkflowAuthoringSystemBlock() string
- type Agent
- func (a *Agent) CompactSession(ctx context.Context, sessionID string) (CompactInfo, error)
- func (a *Agent) InjectTurnInput(ctx context.Context, sessionID string, newMessages []core.Message) (bool, error)
- func (a *Agent) RunSession(ctx context.Context, sessionID, input string) (core.Message, error)
- func (a *Agent) RunSideQuestion(ctx context.Context, sessionID, question string) (<-chan SideQuestionEvent, error)
- func (a *Agent) RunSideQuestionWithOptions(ctx context.Context, sessionID, question string, opts RunOptions) (<-chan SideQuestionEvent, error)
- func (a *Agent) RunStream(ctx context.Context, sessionID, input string) (<-chan AgentEvent, error)
- func (a *Agent) RunStreamWithContentOptions(ctx context.Context, sessionID string, parts []core.MessagePart, ...) (<-chan AgentEvent, error)
- func (a *Agent) RunStreamWithInjectedContentOptions(ctx context.Context, sessionID string, visibleParts []core.MessagePart, ...) (<-chan AgentEvent, error)
- func (a *Agent) RunStreamWithInjectedInput(ctx context.Context, sessionID, visibleInput, hiddenInput string) (<-chan AgentEvent, error)
- func (a *Agent) RunStreamWithInjectedInputOptions(ctx context.Context, sessionID, visibleInput, hiddenInput string, ...) (<-chan AgentEvent, error)
- func (a *Agent) RunStreamWithOptions(ctx context.Context, sessionID, input string, hiddenInput bool) (<-chan AgentEvent, error)
- func (a *Agent) RunStreamWithTurnOptions(ctx context.Context, sessionID, input string, opts RunOptions) (<-chan AgentEvent, error)
- type AgentEvent
- type AgentEventType
- type AgentOption
- func WithApprovalFunc(fn policy.ApprovalFunc) AgentOption
- func WithAutoCompact(enabled bool, threshold float64, contextWindow int) AgentOption
- func WithBudgetWarningUSD(capUSD float64) AgentOption
- func WithDisabledSkills(names []string) AgentOption
- func WithDynamicSystemBlocks(blocks ...func() string) AgentOption
- func WithDynamicSystemBlocksForTurn(blocks ...func(RunOptions) string) AgentOption
- func WithExtraSkills(extra []*skills.Skill) AgentOption
- func WithExtraSystemBlocks(blocks ...string) AgentOption
- func WithHookExecutors(promptExecutor, agentExecutor HookExecutor) AgentOption
- func WithHookHandlers(handlers ...HookHandler) AgentOption
- func WithHookRunner(runner *HookRunner) AgentOption
- func WithHooks(hooks []ResolvedHook, workspaceRoot string) AgentOption
- func WithMaxParallelSubagents(maxParallel int) AgentOption
- func WithMaxToolCalls(maxCalls int) AgentOption
- func WithMaxToolIters(maxIters int) AgentOption
- func WithMaxTurns(maxTurns int) AgentOption
- func WithProjectMemory(enabled bool, maxChars int, fileOrder []string, workspaceRoot string) AgentOption
- func WithRecoveryPolicy(r RecoveryPolicy) AgentOption
- func WithSessionMode(mode session.Mode) AgentOption
- func WithSessionsDir(sessionsDir string) AgentOption
- func WithToolPolicy(policy policy.ToolPolicy) AgentOption
- func WithToolRefresh(fn func(context.Context) error) AgentOption
- func WithUsageLogPath(path string) AgentOption
- func WithUserInputFunc(fn UserInputFunc) AgentOption
- func WithWorktreeContext(worktreeRoot, originalWorkspace string) AgentOption
- type BudgetWarningInfo
- type CompactInfo
- type FailureClass
- type HookConfig
- type HookDecision
- type HookEvent
- type HookEventInfo
- type HookExecutor
- type HookHandler
- type HookLifecycleEventInfo
- type HookListEntry
- type HookOutcome
- type HookPayload
- func NewPermissionRequestPayload(sessionID, cwd string, call core.ToolCall, reason, code string) HookPayload
- func NewPostCompactPayload(sessionID, cwd, summary string, messagesBefore, messagesAfter int) HookPayload
- func NewPostToolUsePayload(sessionID string, call core.ToolCall, toolArgs any, res core.ToolResult) HookPayload
- func NewPreCompactPayload(sessionID, cwd string, messagesBefore int) HookPayload
- func NewPreToolUsePayload(sessionID string, call core.ToolCall, toolArgs any) HookPayload
- func NewSessionStartPayload(sessionID, cwd string) HookPayload
- func NewStopPayload(sessionID, cwd, lastAssistantText string, turn int) HookPayload
- func NewSubagentHookPayload(event HookEvent, sessionID, cwd, role, model, summary string) HookPayload
- func NewUserPromptSubmitPayload(sessionID, cwd, prompt string) HookPayload
- type HookReport
- type HookResult
- type HookRunObserver
- type HookRunStage
- type HookRunner
- func (r *HookRunner) AddHandlers(handlers ...HookHandler)
- func (r *HookRunner) Empty() bool
- func (r *HookRunner) ListHooks() []HookListEntry
- func (r *HookRunner) RunHook(ctx context.Context, payload HookPayload) HookReport
- func (r *HookRunner) RunHookWithObserver(ctx context.Context, payload HookPayload, observer HookRunObserver) HookReport
- func (r *HookRunner) SetExecutors(promptExecutor, agentExecutor HookExecutor)
- type HookSettings
- type HookSpawnInput
- type HookSpawnResult
- type HookSpawner
- type HookState
- type HookStates
- type HookTrustStatus
- type PlanUpdateInfo
- type PlanUpdateStep
- type PrefixCacheMetricsInfo
- type PrefixDriftInfo
- type RecoveryAction
- type RecoveryPolicy
- type RecoveryRule
- type ResolvedHook
- type RunOptions
- type SideQuestionEvent
- type SideQuestionEventType
- type TaskActivityInfo
- type ToolApprovalGranted
- type ToolApprovalRequired
- type ToolArgsProgress
- type ToolArgsRepair
- type ToolCallBlocked
- type ToolCallScavenged
- type ToolPolicyDecision
- type ToolRecoveryInfo
- type UsageInfo
- type UserInputFunc
- type UserInputRequest
Constants ¶
View Source
const ( DefaultHookOutputCapBytes = 256 * 1024 DefaultHookTimeout = 600 * time.Second MinimumHookTimeout = time.Second )
Variables ¶
View Source
var ErrBudgetExceeded = errors.New("session budget exhausted")
View Source
var ErrSessionBusy = errors.New("session is currently processing another request")
Functions ¶
func FormatPlanUpdateForDisplay ¶ added in v0.1.15
func FormatPlanUpdateForDisplay(update PlanUpdateInfo) string
func HookActiveTrust ¶ added in v0.1.32
func HookActiveTrust(entry HookListEntry) bool
func HookNeedsReview ¶ added in v0.1.32
func HookNeedsReview(entry HookListEntry) bool
func KnownHookEvent ¶ added in v0.1.32
func WorkflowAuthoringSystemBlock ¶ added in v0.1.43
func WorkflowAuthoringSystemBlock() string
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func NewAgentWithRegistry ¶
func NewAgentWithRegistry(provider llm.Provider, store store.MessageStore, tools *core.ToolRegistry, opts ...AgentOption) *Agent
func (*Agent) CompactSession ¶
func (*Agent) InjectTurnInput ¶ added in v0.1.35
func (*Agent) RunSession ¶ added in v0.1.24
func (*Agent) RunSideQuestion ¶ added in v0.1.17
func (*Agent) RunSideQuestionWithOptions ¶ added in v0.1.21
func (a *Agent) RunSideQuestionWithOptions(ctx context.Context, sessionID, question string, opts RunOptions) (<-chan SideQuestionEvent, error)
func (*Agent) RunStreamWithContentOptions ¶ added in v0.1.39
func (a *Agent) RunStreamWithContentOptions(ctx context.Context, sessionID string, parts []core.MessagePart, opts RunOptions) (<-chan AgentEvent, error)
func (*Agent) RunStreamWithInjectedContentOptions ¶ added in v0.1.39
func (a *Agent) RunStreamWithInjectedContentOptions(ctx context.Context, sessionID string, visibleParts []core.MessagePart, hiddenInput string, opts RunOptions) (<-chan AgentEvent, error)
func (*Agent) RunStreamWithInjectedInput ¶ added in v0.1.4
func (*Agent) RunStreamWithInjectedInputOptions ¶ added in v0.1.17
func (a *Agent) RunStreamWithInjectedInputOptions(ctx context.Context, sessionID, visibleInput, hiddenInput string, opts RunOptions) (<-chan AgentEvent, error)
func (*Agent) RunStreamWithOptions ¶
func (*Agent) RunStreamWithTurnOptions ¶ added in v0.1.17
func (a *Agent) RunStreamWithTurnOptions(ctx context.Context, sessionID, input string, opts RunOptions) (<-chan AgentEvent, error)
type AgentEvent ¶
type AgentEvent struct {
Type AgentEventType
Content string
ReasoningDelta string
ToolArgs *ToolArgsProgress
ToolArgsRepair *ToolArgsRepair
ToolBlocked *ToolCallBlocked
Approval *ToolApprovalRequired
ApprovalGrant *ToolApprovalGranted
Scavenged *ToolCallScavenged
Policy *ToolPolicyDecision
Recovery *ToolRecoveryInfo
ProviderRetry *llmretry.Info
Compact *CompactInfo
PrefixDrift *PrefixDriftInfo
CacheMetrics *PrefixCacheMetricsInfo
Usage *UsageInfo
Budget *BudgetWarningInfo
Hook *HookEventInfo
Task *TaskActivityInfo
PlanUpdate *PlanUpdateInfo
ToolCall *core.ToolCall
UserInputReq *core.UserInputRequest
UserInputResp *core.UserInputResponse
Result *core.ToolResult
Message *core.Message
Err error
}
type AgentEventType ¶
type AgentEventType string
const ( AgentEventTypeAssistantDelta AgentEventType = "assistant_delta" AgentEventTypeReasoningDelta AgentEventType = "reasoning_delta" AgentEventTypeToolArgsDelta AgentEventType = "tool_args_delta" AgentEventTypeToolArgsRepaired AgentEventType = "tool_args_repaired" AgentEventTypeToolCallBlocked AgentEventType = "tool_call_blocked" AgentEventTypeToolModeBlocked AgentEventType = "tool_mode_blocked" AgentEventTypeToolApprovalRequired AgentEventType = "tool_approval_required" AgentEventTypeToolApprovalGranted AgentEventType = "tool_approval_granted" AgentEventTypeToolCallScavenged AgentEventType = "tool_call_scavenged" AgentEventTypeToolPolicyDecision AgentEventType = "tool_policy_decision" AgentEventTypeToolCall AgentEventType = "tool_call" AgentEventTypeToolResult AgentEventType = "tool_result" AgentEventTypeUserInputRequired AgentEventType = "user_input_required" AgentEventTypeUserInputSubmitted AgentEventType = "user_input_submitted" AgentEventTypeUserInputCancelled AgentEventType = "user_input_cancelled" AgentEventTypePlanDelta AgentEventType = "plan_delta" AgentEventTypePlanCompleted AgentEventType = "plan_completed" AgentEventTypePlanUpdate AgentEventType = "plan_update" AgentEventTypePlanStepBlocked AgentEventType = "plan_step_blocked" AgentEventTypeProviderRetryScheduled AgentEventType = "provider_retry_scheduled" AgentEventTypeResponseReset AgentEventType = "response_reset" AgentEventTypeLeakedToolCallScrubbed AgentEventType = "leaked_tool_call_scrubbed" AgentEventTypeToolRecoveryScheduled AgentEventType = "tool_recovery_scheduled" AgentEventTypeToolRecoveryAttempt AgentEventType = "tool_recovery_attempt" AgentEventTypeToolRecoveryExhausted AgentEventType = "tool_recovery_exhausted" AgentEventTypeReplanRequiredSet AgentEventType = "replan_required_set" AgentEventTypeContextCompacted AgentEventType = "context_compacted" AgentEventTypePrefixDrift AgentEventType = "prefix_drift" AgentEventTypePrefixCacheMetrics AgentEventType = "prefix_cache_metrics" AgentEventTypeUsage AgentEventType = "usage" AgentEventTypeBudgetWarning AgentEventType = "budget_warning" AgentEventTypeTurnCancelled AgentEventType = "turn_cancelled" AgentEventTypeForcedSummaryStarted AgentEventType = "forced_summary_started" AgentEventTypeForcedSummaryDone AgentEventType = "forced_summary_done" AgentEventTypeForcedSummaryFailed AgentEventType = "forced_summary_failed" AgentEventTypeHookStarted AgentEventType = "hook_started" AgentEventTypeHookBlocked AgentEventType = "hook_blocked" AgentEventTypeHookWarned AgentEventType = "hook_warned" AgentEventTypeHookFailed AgentEventType = "hook_failed" AgentEventTypeHookCompleted AgentEventType = "hook_completed" AgentEventTypeParallelReasonStarted AgentEventType = "parallel_reason_started" AgentEventTypeParallelReasonDone AgentEventType = "parallel_reason_completed" AgentEventTypeSubagentStarted AgentEventType = "subagent_started" AgentEventTypeTaskProgress AgentEventType = "task_progress" AgentEventTypeSubagentDone AgentEventType = "subagent_completed" AgentEventTypeDone AgentEventType = "done" AgentEventTypeError AgentEventType = "error" )
type AgentOption ¶
type AgentOption func(*Agent)
func WithApprovalFunc ¶
func WithApprovalFunc(fn policy.ApprovalFunc) AgentOption
func WithAutoCompact ¶
func WithAutoCompact(enabled bool, threshold float64, contextWindow int) AgentOption
func WithBudgetWarningUSD ¶
func WithBudgetWarningUSD(capUSD float64) AgentOption
func WithDisabledSkills ¶ added in v0.1.11
func WithDisabledSkills(names []string) AgentOption
func WithDynamicSystemBlocks ¶ added in v0.1.30
func WithDynamicSystemBlocks(blocks ...func() string) AgentOption
func WithDynamicSystemBlocksForTurn ¶ added in v0.1.43
func WithDynamicSystemBlocksForTurn(blocks ...func(RunOptions) string) AgentOption
func WithExtraSkills ¶ added in v0.1.15
func WithExtraSkills(extra []*skills.Skill) AgentOption
func WithExtraSystemBlocks ¶ added in v0.1.5
func WithExtraSystemBlocks(blocks ...string) AgentOption
func WithHookExecutors ¶ added in v0.1.34
func WithHookExecutors(promptExecutor, agentExecutor HookExecutor) AgentOption
func WithHookHandlers ¶ added in v0.1.15
func WithHookHandlers(handlers ...HookHandler) AgentOption
func WithHookRunner ¶ added in v0.1.15
func WithHookRunner(runner *HookRunner) AgentOption
func WithHooks ¶
func WithHooks(hooks []ResolvedHook, workspaceRoot string) AgentOption
func WithMaxParallelSubagents ¶ added in v0.1.22
func WithMaxParallelSubagents(maxParallel int) AgentOption
func WithMaxToolCalls ¶ added in v0.1.30
func WithMaxToolCalls(maxCalls int) AgentOption
func WithMaxToolIters ¶ added in v0.1.5
func WithMaxToolIters(maxIters int) AgentOption
func WithMaxTurns ¶ added in v0.1.34
func WithMaxTurns(maxTurns int) AgentOption
func WithProjectMemory ¶
func WithProjectMemory(enabled bool, maxChars int, fileOrder []string, workspaceRoot string) AgentOption
func WithRecoveryPolicy ¶
func WithRecoveryPolicy(r RecoveryPolicy) AgentOption
func WithSessionMode ¶
func WithSessionMode(mode session.Mode) AgentOption
func WithSessionsDir ¶
func WithSessionsDir(sessionsDir string) AgentOption
func WithToolPolicy ¶
func WithToolPolicy(policy policy.ToolPolicy) AgentOption
func WithToolRefresh ¶ added in v0.1.23
func WithToolRefresh(fn func(context.Context) error) AgentOption
func WithUsageLogPath ¶
func WithUsageLogPath(path string) AgentOption
func WithUserInputFunc ¶
func WithUserInputFunc(fn UserInputFunc) AgentOption
func WithWorktreeContext ¶ added in v0.1.20
func WithWorktreeContext(worktreeRoot, originalWorkspace string) AgentOption
type BudgetWarningInfo ¶
type CompactInfo ¶
type FailureClass ¶
type FailureClass string
const ( FailureClassTimeout FailureClass = "timeout" FailureClassExecFailed FailureClass = "exec_failed" FailureClassParseFailed FailureClass = "parse_failed" FailureClassEmptyOutput FailureClass = "empty_output" FailureClassPolicyDenied FailureClass = "policy_denied" FailureClassApprovalDenied FailureClass = "approval_denied" FailureClassPlanRequired FailureClass = "plan_required" FailureClassPermissionDenied FailureClass = "permission_denied" FailureClassMCPToolError FailureClass = "mcp_tool_error" FailureClassUnknown FailureClass = "unknown" )
type HookConfig ¶
type HookConfig struct {
Type string `json:"type,omitempty" toml:"type,omitempty"`
Match string `json:"match,omitempty" toml:"match,omitempty"`
If string `json:"if,omitempty" toml:"if,omitempty"`
Command string `json:"command" toml:"command,omitempty"`
Prompt string `json:"prompt,omitempty" toml:"prompt,omitempty"`
URL string `json:"url,omitempty" toml:"url,omitempty"`
Model string `json:"model,omitempty" toml:"model,omitempty"`
Description string `json:"description,omitempty" toml:"description,omitempty"`
TimeoutSec int `json:"timeout,omitempty" toml:"timeout,omitempty"`
CWD string `json:"cwd,omitempty" toml:"cwd,omitempty"`
Shell string `json:"shell,omitempty" toml:"shell,omitempty"`
Once bool `json:"once,omitempty" toml:"once,omitempty"`
Async bool `json:"async,omitempty" toml:"async,omitempty"`
AsyncRewake bool `json:"asyncRewake,omitempty" toml:"asyncRewake,omitempty"`
Headers map[string]string `json:"headers,omitempty" toml:"headers,omitempty"`
AllowedEnvVars []string `json:"allowedEnvVars,omitempty" toml:"allowedEnvVars,omitempty"`
}
type HookDecision ¶
type HookDecision string
const ( HookDecisionPass HookDecision = "pass" HookDecisionBlock HookDecision = "block" HookDecisionHalt HookDecision = "halt" HookDecisionWarn HookDecision = "warn" HookDecisionTimeout HookDecision = "timeout" HookDecisionError HookDecision = "error" )
type HookEvent ¶
type HookEvent string
const ( HookEventPreToolUse HookEvent = "PreToolUse" HookEventPermissionRequest HookEvent = "PermissionRequest" HookEventPostToolUse HookEvent = "PostToolUse" HookEventPreCompact HookEvent = "PreCompact" HookEventPostCompact HookEvent = "PostCompact" HookEventSessionStart HookEvent = "SessionStart" HookEventUserPromptSubmit HookEvent = "UserPromptSubmit" HookEventSubagentStart HookEvent = "SubagentStart" HookEventSubagentStop HookEvent = "SubagentStop" HookEventStop HookEvent = "Stop" )
type HookEventInfo ¶
type HookExecutor ¶ added in v0.1.34
type HookExecutor func(ctx context.Context, cfg HookConfig, payload HookPayload) HookResult
type HookHandler ¶ added in v0.1.15
type HookHandler struct {
Event HookEvent
Match string
Name string
Source string
Description string
TimeoutSec int
Run func(context.Context, HookPayload) HookResult
}
type HookLifecycleEventInfo ¶ added in v0.1.32
func HookEvents ¶ added in v0.1.32
func HookEvents() []HookLifecycleEventInfo
type HookListEntry ¶ added in v0.1.32
type HookListEntry struct {
Key string `json:"key"`
Event HookEvent `json:"event"`
Type string `json:"type"`
Name string `json:"name,omitempty"`
Source string `json:"source,omitempty"`
Match string `json:"match,omitempty"`
If string `json:"if,omitempty"`
Command string `json:"command,omitempty"`
Prompt string `json:"prompt,omitempty"`
URL string `json:"url,omitempty"`
Model string `json:"model,omitempty"`
Description string `json:"description,omitempty"`
TimeoutSec int `json:"timeout_sec,omitempty"`
CWD string `json:"cwd,omitempty"`
Shell string `json:"shell,omitempty"`
Once bool `json:"once,omitempty"`
Async bool `json:"async,omitempty"`
AsyncRewake bool `json:"asyncRewake,omitempty"`
Headers map[string]string `json:"-"`
AllowedEnvVars []string `json:"allowedEnvVars,omitempty"`
Hash string `json:"hash,omitempty"`
Enabled bool `json:"enabled"`
Managed bool `json:"managed"`
DefaultTrusted bool `json:"-"`
Active bool `json:"active"`
Trust HookTrustStatus `json:"trust"`
}
type HookOutcome ¶
type HookPayload ¶
type HookPayload struct {
Event HookEvent `json:"event"`
CWD string `json:"cwd"`
SessionID string `json:"session_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ToolArgs any `json:"tool_args,omitempty"`
ToolResult string `json:"tool_result,omitempty"`
ToolOutcome string `json:"tool_outcome,omitempty"`
ToolErrorCode string `json:"tool_error_code,omitempty"`
Prompt string `json:"prompt,omitempty"`
LastAssistantText string `json:"last_assistant_text,omitempty"`
Turn int `json:"turn,omitempty"`
ToolCall *core.ToolCall `json:"tool_call,omitempty"`
ApprovalReason string `json:"approval_reason,omitempty"`
ApprovalCode string `json:"approval_code,omitempty"`
CompactSummary string `json:"compact_summary,omitempty"`
MessagesBefore int `json:"messages_before,omitempty"`
MessagesAfter int `json:"messages_after,omitempty"`
SubagentRole string `json:"subagent_role,omitempty"`
SubagentModel string `json:"subagent_model,omitempty"`
SubagentSummary string `json:"subagent_summary,omitempty"`
}
func NewPermissionRequestPayload ¶ added in v0.1.32
func NewPermissionRequestPayload(sessionID, cwd string, call core.ToolCall, reason, code string) HookPayload
func NewPostCompactPayload ¶ added in v0.1.32
func NewPostCompactPayload(sessionID, cwd, summary string, messagesBefore, messagesAfter int) HookPayload
func NewPostToolUsePayload ¶
func NewPostToolUsePayload(sessionID string, call core.ToolCall, toolArgs any, res core.ToolResult) HookPayload
func NewPreCompactPayload ¶ added in v0.1.32
func NewPreCompactPayload(sessionID, cwd string, messagesBefore int) HookPayload
func NewPreToolUsePayload ¶
func NewPreToolUsePayload(sessionID string, call core.ToolCall, toolArgs any) HookPayload
func NewSessionStartPayload ¶ added in v0.1.32
func NewSessionStartPayload(sessionID, cwd string) HookPayload
func NewStopPayload ¶
func NewStopPayload(sessionID, cwd, lastAssistantText string, turn int) HookPayload
func NewSubagentHookPayload ¶ added in v0.1.32
func NewSubagentHookPayload(event HookEvent, sessionID, cwd, role, model, summary string) HookPayload
func NewUserPromptSubmitPayload ¶
func NewUserPromptSubmitPayload(sessionID, cwd, prompt string) HookPayload
type HookReport ¶
type HookResult ¶ added in v0.1.15
type HookRunObserver ¶ added in v0.1.32
type HookRunObserver func(HookRunStage, HookEventInfo)
type HookRunStage ¶ added in v0.1.32
type HookRunStage string
const ( HookRunStarted HookRunStage = "started" HookRunCompleted HookRunStage = "completed" HookRunBlocked HookRunStage = "blocked" HookRunWarned HookRunStage = "warned" HookRunFailed HookRunStage = "failed" )
type HookRunner ¶
type HookRunner struct {
// contains filtered or unexported fields
}
func NewHookRunner ¶
func NewHookRunner(hooks []ResolvedHook, workspace string) *HookRunner
func NewHookRunnerWithState ¶ added in v0.1.32
func NewHookRunnerWithState(hooks []ResolvedHook, workspace string, states HookStates) *HookRunner
func (*HookRunner) AddHandlers ¶ added in v0.1.15
func (r *HookRunner) AddHandlers(handlers ...HookHandler)
func (*HookRunner) Empty ¶
func (r *HookRunner) Empty() bool
func (*HookRunner) ListHooks ¶ added in v0.1.32
func (r *HookRunner) ListHooks() []HookListEntry
func (*HookRunner) RunHook ¶ added in v0.1.24
func (r *HookRunner) RunHook(ctx context.Context, payload HookPayload) HookReport
func (*HookRunner) RunHookWithObserver ¶ added in v0.1.32
func (r *HookRunner) RunHookWithObserver(ctx context.Context, payload HookPayload, observer HookRunObserver) HookReport
func (*HookRunner) SetExecutors ¶ added in v0.1.34
func (r *HookRunner) SetExecutors(promptExecutor, agentExecutor HookExecutor)
type HookSettings ¶
type HookSettings struct {
Hooks map[HookEvent][]HookConfig `json:"hooks"`
}
type HookSpawnInput ¶
type HookSpawnResult ¶
type HookSpawner ¶
type HookSpawner func(ctx context.Context, in HookSpawnInput) HookSpawnResult
type HookStates ¶ added in v0.1.32
func SetHookEnabledStates ¶ added in v0.1.32
func SetHookEnabledStates(entries []HookListEntry, states HookStates, keys []string, enabled bool) HookStates
func TrustHookStates ¶ added in v0.1.32
func TrustHookStates(entries []HookListEntry, states HookStates, keys []string) HookStates
type HookTrustStatus ¶ added in v0.1.32
type HookTrustStatus string
const ( HookTrustManaged HookTrustStatus = "Managed" HookTrustUntrusted HookTrustStatus = "Untrusted" HookTrustTrusted HookTrustStatus = "Trusted" HookTrustModified HookTrustStatus = "Modified" )
type PlanUpdateInfo ¶ added in v0.1.15
type PlanUpdateInfo struct {
Explanation string `json:"explanation,omitempty"`
Plan []PlanUpdateStep `json:"plan"`
}
type PlanUpdateStep ¶ added in v0.1.15
type PrefixCacheMetricsInfo ¶
type PrefixDriftInfo ¶
type RecoveryAction ¶
type RecoveryAction string
const ( RecoveryActionRetrySame RecoveryAction = "retry_same" RecoveryActionRetryWithBackoff RecoveryAction = "retry_with_backoff" RecoveryActionFallbackReadOnly RecoveryAction = "fallback_readonly" RecoveryActionRequestReplan RecoveryAction = "request_replan" RecoveryActionHardBlock RecoveryAction = "hard_block" RecoveryActionPassThrough RecoveryAction = "pass_through" )
type RecoveryPolicy ¶
type RecoveryPolicy struct {
Enabled bool
Rules map[FailureClass]RecoveryRule
}
func DefaultRecoveryPolicy ¶
func DefaultRecoveryPolicy() RecoveryPolicy
type RecoveryRule ¶
type RecoveryRule struct {
Action RecoveryAction
MaxAttempts int
BackoffMS int
}
type ResolvedHook ¶
type ResolvedHook struct {
HookConfig
Event HookEvent
Source string
Managed bool
DefaultTrusted bool
}
func LoadProjectHooks ¶
func LoadProjectHooks(workspaceRoot string) ([]ResolvedHook, error)
func ResolveHooks ¶ added in v0.1.9
func ResolveHooks(st HookSettings, source string) []ResolvedHook
type RunOptions ¶ added in v0.1.17
type RunOptions struct {
HiddenInput bool
ReadOnly bool
GoalContinuation bool
ShellAllowPrefixes []string
ViewMode string
AssistantPrefix string
PrefixCompletion bool
WorkflowAuthoring bool
// SuppressTools forces the turn to be sent without any tools. Prefix
// completion requests also require no current tool schemas.
SuppressTools bool
}
type SideQuestionEvent ¶ added in v0.1.17
type SideQuestionEvent struct {
Type SideQuestionEventType
Content string
Err error
}
type SideQuestionEventType ¶ added in v0.1.17
type SideQuestionEventType string
const ( SideQuestionEventDelta SideQuestionEventType = "delta" SideQuestionEventDone SideQuestionEventType = "done" SideQuestionEventError SideQuestionEventType = "error" )
type TaskActivityInfo ¶ added in v0.1.5
type ToolApprovalGranted ¶ added in v0.1.15
type ToolApprovalRequired ¶
type ToolArgsProgress ¶
type ToolArgsRepair ¶
type ToolCallBlocked ¶
type ToolCallScavenged ¶
type ToolCallScavenged struct {
Count int
}
type ToolPolicyDecision ¶
type ToolRecoveryInfo ¶
type UserInputFunc ¶
type UserInputFunc func(req UserInputRequest) (core.UserInputResponse, bool)
type UserInputRequest ¶
type UserInputRequest struct {
SessionID string
ToolCall core.ToolCall
Questions []core.UserInputQuestion
}
Source Files
¶
- agent.go
- approval_telemetry.go
- approvals.go
- cache_shape.go
- compact.go
- event_send.go
- force_summary.go
- hook_events.go
- hooks.go
- interrupt_marker.go
- leaked_tool_call.go
- parallel_subagent.go
- plan_mode.go
- plan_update.go
- progress_guard.go
- recovery.go
- recovery_dispatch.go
- side_question.go
- stream.go
- stream_dispatch.go
- stream_ingest.go
- system_prompt.go
- task_activity.go
- todo_tools.go
- tool_input_telemetry.go
- tool_preview.go
- tool_repair.go
- tool_snapshot.go
- turn_loop.go
- usage_budget.go
- user_input.go
Click to show internal directories.
Click to hide internal directories.