Documentation
¶
Index ¶
- func ErrFromToolError(toolErr *ToolError) error
- func InvocationRiskInfo(toolName string, args map[string]any) (string, string)
- func InvocationRiskLabel(toolName string, args map[string]any) string
- func IsDangerousInvocation(toolName string, args map[string]any) bool
- func IsMutating(toolName string) bool
- func IsMutatingForInvocation(toolName string, args map[string]any) bool
- func MergeNormalizedArgs(args map[string]any, normalized map[string]any) map[string]any
- func NormalizeTerminalCommand(command string) string
- func RequiresApproval(toolName string) bool
- func RequiresApprovalForInvocation(toolName string, args map[string]any) bool
- func ShouldRetryWithNormalizedArgs(toolErr *ToolError) bool
- type Definition
- type ErrorCode
- type Event
- type EventKind
- type Invocation
- type ResultStatus
- type TerminalCommandProfile
- type TerminalCommandRisk
- type ToolError
- type ToolResultEnvelope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrFromToolError ¶
func InvocationRiskInfo ¶
func IsMutating ¶
func IsMutatingForInvocation ¶
func MergeNormalizedArgs ¶
func RequiresApproval ¶
func ShouldRetryWithNormalizedArgs ¶
ShouldRetryWithNormalizedArgs returns true when the caller should perform one deterministic retry.
Types ¶
type Definition ¶
Definition describes built-in tool properties used by policies.
func LookupDefinition ¶
func LookupDefinition(toolName string) (Definition, bool)
type ErrorCode ¶
type ErrorCode string
ErrorCode is a stable, machine-readable tool error code.
const ( ErrorCodeNotFound ErrorCode = "NOT_FOUND" ErrorCodeInvalidPath ErrorCode = "INVALID_PATH" ErrorCodeInvalidArguments ErrorCode = "INVALID_ARGUMENTS" ErrorCodePermissionDenied ErrorCode = "PERMISSION_DENIED" ErrorCodeTimeout ErrorCode = "TIMEOUT" ErrorCodeCanceled ErrorCode = "CANCELED" ErrorCodeUnknown ErrorCode = "UNKNOWN" )
type Event ¶
type Event struct {
Kind EventKind `json:"kind"`
RunID string `json:"run_id"`
ToolID string `json:"tool_id"`
ToolName string `json:"tool_name"`
AtUnixMs int64 `json:"at_unix_ms"`
Payload map[string]any `json:"payload,omitempty"`
}
Event is emitted by the orchestrator and can be forwarded to runtime streams / storage.
type Invocation ¶
type Invocation struct {
ToolName string
Args map[string]any
WorkingDir string
AgentHomeDir string
}
Invocation carries the minimum context required for error classification and retry hints.
type ResultStatus ¶
type ResultStatus string
ResultStatus is the normalized status returned by the Go tool runtime.
const ( ResultStatusSuccess ResultStatus = "success" ResultStatusError ResultStatus = "error" ResultStatusRecovering ResultStatus = "recovering" )
type TerminalCommandProfile ¶
type TerminalCommandProfile struct {
Risk TerminalCommandRisk
NormalizedCommand string
Effects []string
Reason string
}
func InvocationCommandProfile ¶
func InvocationCommandProfile(toolName string, args map[string]any) TerminalCommandProfile
func ProfileTerminalCommand ¶
func ProfileTerminalCommand(command string) TerminalCommandProfile
type TerminalCommandRisk ¶
type TerminalCommandRisk string
const ( TerminalCommandRiskReadonly TerminalCommandRisk = "readonly" TerminalCommandRiskMutating TerminalCommandRisk = "mutating" TerminalCommandRiskDangerous TerminalCommandRisk = "dangerous" )
func ClassifyTerminalCommandRisk ¶
func ClassifyTerminalCommandRisk(command string) TerminalCommandRisk
type ToolError ¶
type ToolError struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Retryable bool `json:"retryable,omitempty"`
SuggestedFixes []string `json:"suggested_fixes,omitempty"`
NormalizedArgs map[string]any `json:"normalized_args,omitempty"`
Meta map[string]any `json:"meta,omitempty"`
}
ToolError carries structured tool failure metadata.
func ClassifyError ¶
func ClassifyError(inv Invocation, err error) *ToolError
type ToolResultEnvelope ¶
type ToolResultEnvelope struct {
RunID string `json:"run_id"`
ToolID string `json:"tool_id"`
Status ResultStatus `json:"status"`
Result any `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
ToolResultEnvelope is the normalized payload for tool call completion.
func (*ToolResultEnvelope) Normalize ¶
func (e *ToolResultEnvelope) Normalize()
Click to show internal directories.
Click to hide internal directories.