Documentation
¶
Index ¶
- Constants
- Variables
- func BashPermissionSubjects(command string) []string
- func CallKey(turnID, callID string) string
- func CheckNestedPermission(ctx context.Context, toolName, permission, subject string, args map[string]any) error
- func CheckNestedToolCall(ctx context.Context, toolName string, tool *looperTool, args json.RawMessage) error
- func CompactionCheckpointText(compaction *responses.ResponseCompactionItemParam) string
- func EasyRoot(shell *CustomShell, name string) (root *os.Root, rel string, err error)
- func InterpolatePermissions(agent *Agent, env []string)
- func ParseModelRef(ref string) (model, effort string)
- func PromptInputMessage(input *PromptInput) responses.ResponseInputItemUnionParam
- func RemapReplayAttribution(ranges []ReplayAttribution, boundaries []int)
- func ReplayInputFromParams(items []responses.ResponseInputItemUnionParam) ([]json.RawMessage, error)
- func ReplayInputRawKind(raw json.RawMessage) string
- func ReplayInputToParams(raw []json.RawMessage) ([]responses.ResponseInputItemUnionParam, error)
- func ReviewKey(turnID, callID string) string
- func ReviewTurn(callKey string) string
- func SweepRetainedResults(root *os.Root, dir string)
- func TaskResult(answer string) string
- func ToolCallKey(ctx context.Context) string
- type Agent
- type AgentLoadConfig
- type AgentLoadResult
- type AgentMaxRecursionError
- type AgentMode
- type AgentRoutine
- type AgentSetting
- type AgentSettingControl
- type AgentSticky
- type Agents
- type ApproverDecision
- type Attachment
- type BackgroundJob
- type BackgroundJobs
- type BackgroundKind
- type BackgroundResult
- type BackgroundWork
- type BashResult
- type ChatResponse
- type ChildKey
- type ChildSessions
- type CodeModeCall
- type Config
- type ContinueMode
- type CustomShell
- type Decider
- type DecisionAnswer
- type DecisionImage
- type DecisionOption
- type DecisionQuestion
- type DecisionQuestionType
- type DecisionRequest
- type DecisionUsage
- type DefaultShellCommand
- type InertBackgroundJobs
- type InertChildSessions
- type InertJournal
- func (InertJournal) CodeModeCalls(context.Context, string) ([]json.RawMessage, error)
- func (InertJournal) Items(context.Context, string, TurnList) ([]json.RawMessage, error)
- func (InertJournal) Load(context.Context, string) (value json.RawMessage, found bool, err error)
- func (InertJournal) Save(context.Context, string, json.RawMessage) error
- func (InertJournal) SaveCodeModeCall(context.Context, string, string, json.RawMessage) error
- func (InertJournal) SaveTrace(context.Context, string, []json.RawMessage) error
- func (InertJournal) SaveTurn(context.Context, string, json.RawMessage, []TurnItems) error
- type InertSteerDrain
- type Journal
- type ModelResolver
- type ObservabilityConfig
- type OpenAIDecider
- type PermissionAction
- type PermissionBucket
- type PermissionReview
- type PermissionRule
- type PermissionSet
- func (ps *PermissionSet) Allow(permission, pattern string) error
- func (ps *PermissionSet) Deny(permission, pattern string) error
- func (ps PermissionSet) Enabled(permission, subject string) bool
- func (ps PermissionSet) Evaluate(permission, subject string) (action PermissionAction, matched bool)
- func (ps *PermissionSet) Set(permission, pattern string, action PermissionAction) error
- type PromptInput
- type PromptInputDirectSkill
- type PromptInputRole
- type PromptShellCommandExpansion
- type ProviderDiagnostic
- type ProviderOrigin
- type PublicProgress
- type PublicProgressKind
- type PublicProgressState
- type ReplayAttribution
- type ReplayDecodeError
- type Runtime
- type SessionEntry
- type Skill
- type SkillLoadResult
- type Skills
- type SteerDrain
- type SubagentWrite
- type TokenUsage
- type Tool
- type ToolResult
- type TurnItems
- type TurnList
- type TurnPhase
- type TypeSafeDecider
Constants ¶
View Source
const ( ChatResponseAssistantMessage = "assistant_message" ChatResponseAssistantCommentary = "assistant_commentary" ChatResponseReasoningSummary = "reasoning_summary" )
View Source
const (
AllowBackgroundSubject = "allow_background"
)
View Source
const (
MaxCodeModeCalls = 200
)
View Source
const (
TurnBoundRefused = "" /* 288-byte string literal not displayed */
)
Variables ¶
View Source
var AgentFrontmatterPattern = regexp.MustCompile(`\A---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|\z)`)
View Source
var ErrBackgroundKilled = errors.New("background job killed")
View Source
var ErrShutdown = errors.New("shutdown")
Functions ¶
func BashPermissionSubjects ¶
func CheckNestedPermission ¶
func CheckNestedToolCall ¶
func CompactionCheckpointText ¶
func CompactionCheckpointText(compaction *responses.ResponseCompactionItemParam) string
func InterpolatePermissions ¶
func ParseModelRef ¶ added in v0.2.20
func PromptInputMessage ¶ added in v0.2.40
func PromptInputMessage(input *PromptInput) responses.ResponseInputItemUnionParam
func RemapReplayAttribution ¶
func RemapReplayAttribution(ranges []ReplayAttribution, boundaries []int)
func ReplayInputFromParams ¶
func ReplayInputFromParams(items []responses.ResponseInputItemUnionParam) ([]json.RawMessage, error)
func ReplayInputRawKind ¶
func ReplayInputRawKind(raw json.RawMessage) string
func ReplayInputToParams ¶
func ReplayInputToParams(raw []json.RawMessage) ([]responses.ResponseInputItemUnionParam, error)
func ReviewTurn ¶
func SweepRetainedResults ¶
func TaskResult ¶
func ToolCallKey ¶
Types ¶
type Agent ¶
type Agent struct {
Name string
Description string
Model string
ReasoningEffort string
Verbosity string
MaxRecursion *int
CustomShell CustomShell
Space string
Prompt string
Location string
Permission PermissionSet
OutputSchema map[string]any
ApproverDecision ApproverDecision
Frontmatter map[string]any
FrontmatterNode *yaml.Node
FileMode fs.FileMode
Mode AgentMode
Sticky AgentSticky
WorkingDirectory string
Commands map[string]string
SecretsARN []string
Subagents []string
ApproverModel string
ApproverPrompt string
Routines []AgentRoutine
TagGroups [][]string
DelegatedFrom []string
NetworkTargets []string
Tools []string
}
type AgentLoadConfig ¶ added in v0.2.20
type AgentLoadResult ¶
func LoadAgents ¶
func LoadAgents(fsys fs.FS, cfg AgentLoadConfig) AgentLoadResult
type AgentMaxRecursionError ¶
func (*AgentMaxRecursionError) Error ¶
func (e *AgentMaxRecursionError) Error() string
func (*AgentMaxRecursionError) Unwrap ¶
func (e *AgentMaxRecursionError) Unwrap() error
type AgentRoutine ¶ added in v0.2.20
type AgentSetting ¶ added in v0.2.41
type AgentSetting struct {
Key string
Modes []AgentMode
Group string
Label string
Explanation string
Default string
Allowed string
Control AgentSettingControl
Choices []string
Required bool
Common bool
}
func AgentSettings ¶ added in v0.2.41
func AgentSettings() []AgentSetting
func AgentSettingsFor ¶ added in v0.2.41
func AgentSettingsFor(mode AgentMode) []AgentSetting
type AgentSettingControl ¶ added in v0.2.41
type AgentSettingControl string
const ( AgentSettingText AgentSettingControl = "text" AgentSettingSwitch AgentSettingControl = "switch" AgentSettingChoice AgentSettingControl = "choice" AgentSettingList AgentSettingControl = "list" AgentSettingModel AgentSettingControl = "model" AgentSettingFile AgentSettingControl = "file" )
type AgentSticky ¶ added in v0.2.30
type AgentSticky string
const ( AgentStickyOff AgentSticky = "" AgentStickyUser AgentSticky = "user" AgentStickyGlobal AgentSticky = "global" )
type ApproverDecision ¶ added in v0.2.31
type Attachment ¶
type BackgroundJob ¶
type BackgroundJobs ¶
type BackgroundJobs interface {
Enabled() bool
Run(ctx context.Context, job *BackgroundJob, work BackgroundWork) (BackgroundResult, error)
}
type BackgroundKind ¶
type BackgroundKind string
const ( BackgroundKindExecute BackgroundKind = "execute" BackgroundKindTask BackgroundKind = "task" )
type BackgroundResult ¶
type BackgroundWork ¶
type BashResult ¶
func (BashResult) String ¶
func (r BashResult) String() string
type ChatResponse ¶
type ChildSessions ¶
type CodeModeCall ¶
type CodeModeCall struct {
Type string `json:"type"`
ParentCallID string `json:"parent_call_id"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
Arguments string `json:"arguments,omitempty"`
Status codeModeCallStatus `json:"status,omitempty"`
Summary string `json:"summary,omitempty"`
Outcome permissionReviewOutcome `json:"outcome,omitempty"`
Reason string `json:"reason,omitempty"`
}
func CodeModeCallsFromTrace ¶
func CodeModeCallsFromTrace(traces []json.RawMessage) []CodeModeCall
func (*CodeModeCall) String ¶
func (r *CodeModeCall) String() string
type Config ¶
type Config struct {
AutoApproverModel shared.ResponsesModel
AutoApproverDecisionModel string
AutoApproverMinConfidence float64
Deciders map[string]Decider
ExpandPromptShellCommands PromptShellCommandExpansion
ParallelToolCalls int
ShellTempDir string
SpillDir string
RetainedResultDir string
Observability ObservabilityConfig
ChildSessions ChildSessions
Journal Journal
BackgroundJobs BackgroundJobs
CustomTools []Tool
ShellEnv map[string]string
ChildContext []SessionEntry
OriginHeader string
ShellCommand shellCommander
Sandbox sandbox.Runtime
MCPServers map[string]mcpclient.ServerConfig
MCPWorkspace string
}
type ContinueMode ¶
type ContinueMode string
const ( ContinueStop ContinueMode = "stop" ContinueSteer ContinueMode = "steer" ContinueEnqueue ContinueMode = "enqueue" )
type CustomShell ¶
type Decider ¶ added in v0.2.31
type Decider interface {
Decide(ctx context.Context, request *DecisionRequest) ([]DecisionAnswer, DecisionUsage, error)
}
type DecisionAnswer ¶ added in v0.2.31
type DecisionImage ¶ added in v0.2.31
type DecisionOption ¶ added in v0.2.31
type DecisionQuestion ¶ added in v0.2.31
type DecisionQuestion struct {
Name string
Type DecisionQuestionType
Instructions string
Options []DecisionOption
}
type DecisionQuestionType ¶ added in v0.2.31
type DecisionQuestionType string
const ( DecisionPredicate DecisionQuestionType = "predicate" DecisionChoice DecisionQuestionType = "choice" DecisionScore DecisionQuestionType = "score" )
type DecisionRequest ¶ added in v0.2.31
type DecisionRequest struct {
Model string
Instructions string
Input any
Images []DecisionImage
Questions []DecisionQuestion
}
type DecisionUsage ¶ added in v0.2.31
type DefaultShellCommand ¶
type DefaultShellCommand struct{}
type InertBackgroundJobs ¶
type InertBackgroundJobs struct{}
func (InertBackgroundJobs) Enabled ¶
func (InertBackgroundJobs) Enabled() bool
func (InertBackgroundJobs) Run ¶
func (InertBackgroundJobs) Run(ctx context.Context, _ *BackgroundJob, work BackgroundWork) (BackgroundResult, error)
type InertChildSessions ¶
type InertChildSessions struct{}
func (InertChildSessions) AppendChildEntry ¶
func (InertChildSessions) AppendChildEntry(context.Context, ChildKey, *SessionEntry) error
func (InertChildSessions) AwaitSubagent ¶
func (InertChildSessions) AwaitSubagent(context.Context, string, string) (string, ReplayAttribution, error)
func (InertChildSessions) WriteSubagent ¶
func (InertChildSessions) WriteSubagent(context.Context, *SubagentWrite) (bool, error)
type InertJournal ¶
type InertJournal struct{}
func (InertJournal) CodeModeCalls ¶
func (InertJournal) CodeModeCalls(context.Context, string) ([]json.RawMessage, error)
func (InertJournal) Items ¶
func (InertJournal) Items(context.Context, string, TurnList) ([]json.RawMessage, error)
func (InertJournal) Load ¶
func (InertJournal) Load(context.Context, string) (value json.RawMessage, found bool, err error)
func (InertJournal) Save ¶
func (InertJournal) Save(context.Context, string, json.RawMessage) error
func (InertJournal) SaveCodeModeCall ¶
func (InertJournal) SaveCodeModeCall(context.Context, string, string, json.RawMessage) error
func (InertJournal) SaveTrace ¶
func (InertJournal) SaveTrace(context.Context, string, []json.RawMessage) error
func (InertJournal) SaveTurn ¶
func (InertJournal) SaveTurn(context.Context, string, json.RawMessage, []TurnItems) error
type InertSteerDrain ¶
type InertSteerDrain struct{}
func (InertSteerDrain) Drain ¶
func (InertSteerDrain) Drain(context.Context, string, TurnPhase, []string) ([]PromptInput, error)
type Journal ¶
type Journal interface {
Load(ctx context.Context, key string) (json.RawMessage, bool, error)
Save(ctx context.Context, key string, value json.RawMessage) error
SaveTurn(ctx context.Context, turnID string, step json.RawMessage, lists []TurnItems) error
Items(ctx context.Context, turnID string, list TurnList) ([]json.RawMessage, error)
SaveTrace(ctx context.Context, turnID string, trace []json.RawMessage) error
SaveCodeModeCall(ctx context.Context, turnID, key string, record json.RawMessage) error
CodeModeCalls(ctx context.Context, turnID string) ([]json.RawMessage, error)
}
type ModelResolver ¶
type ModelResolver interface {
Resolve(model string) (*openai.Client, ProviderOrigin, error)
}
type ObservabilityConfig ¶
type OpenAIDecider ¶ added in v0.2.31
func (OpenAIDecider) Decide ¶ added in v0.2.31
func (d OpenAIDecider) Decide(ctx context.Context, request *DecisionRequest) ([]DecisionAnswer, DecisionUsage, error)
type PermissionAction ¶
type PermissionAction string
const ( PermissionAllow PermissionAction = "allow" PermissionDeny PermissionAction = "deny" PermissionAuto PermissionAction = "auto" )
type PermissionBucket ¶
type PermissionBucket struct {
Name string
Rules []PermissionRule
}
type PermissionReview ¶
type PermissionReview struct {
Outcome permissionReviewOutcome
Rationale string
}
func (PermissionReview) CodeModeCall ¶
func (r PermissionReview) CodeModeCall(e *SessionEntry) (CodeModeCall, bool)
type PermissionRule ¶
type PermissionRule struct {
Pattern string
Action PermissionAction
Reviewer string
// contains filtered or unexported fields
}
type PermissionSet ¶
type PermissionSet struct {
Buckets []PermissionBucket
Sudo bool
Easy bool
// contains filtered or unexported fields
}
func (*PermissionSet) Allow ¶
func (ps *PermissionSet) Allow(permission, pattern string) error
func (*PermissionSet) Deny ¶
func (ps *PermissionSet) Deny(permission, pattern string) error
func (PermissionSet) Enabled ¶
func (ps PermissionSet) Enabled(permission, subject string) bool
func (PermissionSet) Evaluate ¶
func (ps PermissionSet) Evaluate(permission, subject string) (action PermissionAction, matched bool)
func (*PermissionSet) Set ¶
func (ps *PermissionSet) Set(permission, pattern string, action PermissionAction) error
type PromptInput ¶
type PromptInput struct {
ID string
TurnID string
Role PromptInputRole
Texts []string
ExpandShellCommands bool `json:",omitempty"`
Header string
Attachments []Attachment
DirectSkill *PromptInputDirectSkill
Agent string
Responses chan<- ChatResponse `json:"-"`
}
type PromptInputDirectSkill ¶
type PromptInputRole ¶
type PromptInputRole string
const ( PromptInputRoleUser PromptInputRole = "user" PromptInputRoleDeveloper PromptInputRole = "developer" )
type ProviderDiagnostic ¶
type ProviderDiagnostic struct {
Provider string `json:"provider"`
Model string `json:"model"`
Phase string `json:"phase"`
HTTPStatus int `json:"http_status,omitempty"`
ResponseStatus string `json:"response_status,omitempty"`
Code string `json:"code,omitempty"`
Type string `json:"type,omitempty"`
Message string `json:"message,omitempty"`
Attempt int `json:"attempt,omitempty"`
RetryAfter string `json:"retry_after,omitempty"`
ResponseID string `json:"response_id,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
type ProviderOrigin ¶
type PublicProgress ¶
type PublicProgress struct {
ID string `json:"id"`
ParentID string `json:"parent_id,omitempty"`
Kind PublicProgressKind `json:"kind"`
State PublicProgressState `json:"state"`
Text string `json:"text,omitempty"`
Agent string `json:"agent,omitempty"`
Model string `json:"model,omitempty"`
SubagentKey string `json:"subagent_key,omitempty"`
}
func PublicProgressFromTrace ¶
func PublicProgressFromTrace(traces []json.RawMessage) []PublicProgress
type PublicProgressKind ¶
type PublicProgressKind string
const ( PublicProgressText PublicProgressKind = "text" PublicProgressThinking PublicProgressKind = "thinking" PublicProgressTool PublicProgressKind = "tool" PublicProgressDelegation PublicProgressKind = "delegation" )
type PublicProgressState ¶
type PublicProgressState string
const ( PublicProgressWorking PublicProgressState = "working" PublicProgressReview PublicProgressState = "review" PublicProgressCompleted PublicProgressState = "completed" PublicProgressBlocked PublicProgressState = "blocked" PublicProgressFailed PublicProgressState = "failed" PublicProgressStopped PublicProgressState = "stopped" PublicProgressBackground PublicProgressState = "background" )
type ReplayAttribution ¶
type ReplayDecodeError ¶
func (*ReplayDecodeError) Error ¶
func (e *ReplayDecodeError) Error() string
func (*ReplayDecodeError) Unwrap ¶
func (e *ReplayDecodeError) Unwrap() error
type SessionEntry ¶
type SessionEntry struct {
Version int `json:"version"`
Type string `json:"type"`
Timestamp time.Time `json:"timestamp"`
TurnID string `json:"turn_id,omitempty"`
ResponseID string `json:"response_id,omitempty"`
Model string `json:"model,omitempty"`
Agent string `json:"agent,omitempty"`
ReasoningEffort *string `json:"reasoning_effort,omitempty"`
ReplayAttribution []ReplayAttribution `json:"replay_attribution,omitempty"`
TokenUsage *TokenUsage `json:"token_usage,omitempty"`
ReplayInput []json.RawMessage `json:"replay_input,omitempty"`
OutputTrace []json.RawMessage `json:"output_trace,omitempty"`
}
func (*SessionEntry) AttributionAt ¶
func (e *SessionEntry) AttributionAt(index int) ReplayAttribution
func (*SessionEntry) PermissionReviewDecision ¶
func (e *SessionEntry) PermissionReviewDecision() PermissionReview
type SkillLoadResult ¶
func LoadSkills ¶
func LoadSkills(fsys fs.FS, root string) SkillLoadResult
type Skills ¶
type SteerDrain ¶
type SubagentWrite ¶
type TokenUsage ¶
type TokenUsage struct {
PromptTokens int64 `json:"prompt_tokens,omitempty"`
CompletionTokens int64 `json:"completion_tokens,omitempty"`
TotalTokens int64 `json:"total_tokens,omitempty"`
PromptCacheReadTokens int64 `json:"prompt_cache_read_tokens,omitempty"`
PromptCacheWriteTokens int64 `json:"prompt_cache_write_tokens,omitempty"`
CompletionReasoningTokens int64 `json:"completion_reasoning_tokens,omitempty"`
}
type Tool ¶
type Tool struct {
Name string
Description string
Parameters map[string]any
Permission string
VisibilitySubjects []string
Subjects func(json.RawMessage) ([]string, error)
Call func(context.Context, json.RawMessage, chan<- ChatResponse) (ToolResult, error)
Resumable bool
TurnBound bool
}
type ToolResult ¶
type ToolResult struct {
Output string
Attachments []Attachment
Data any
}
func TextToolResult ¶
func TextToolResult(output string) ToolResult
type TypeSafeDecider ¶ added in v0.2.31
func (TypeSafeDecider) Decide ¶ added in v0.2.31
func (d TypeSafeDecider) Decide(ctx context.Context, request *DecisionRequest) ([]DecisionAnswer, DecisionUsage, error)
Source Files
¶
- active_turn.go
- agent_settings.go
- agents.go
- attachments.go
- background.go
- bash_starlark.go
- checkpoint.go
- custom_tools.go
- decision.go
- easy.go
- easy_files.go
- emulated.go
- emulated_curl.go
- execute_results.go
- filesystem.go
- guardian.go
- looper.go
- mcp_tools.go
- models.go
- observability.go
- permission.go
- permission_gate.go
- permission_review.go
- prompts.go
- provider_replay.go
- public_progress.go
- replay.go
- responses_websocket.go
- rocketcode.go
- shell.go
- skills.go
- tasks.go
- tools.go
- webfetch.go
Click to show internal directories.
Click to hide internal directories.