Versions in this module Expand all Collapse all v0 v0.8.0 Aug 3, 2026 Changes in this version + const ClaudeContentBlockTypeText + const ClaudeContentBlockTypeThinking + const ClaudeContentBlockTypeToolUse + const ClaudeContentBlockTypeUnsupportedContent + const ConversationStateVersion + const DefaultAsyncTimeout + const DefaultFinalResponseDirective + const DefaultMaxTurns + const NonClaudeMessageRoleDeveloper + const NonClaudeMessageRoleSystem + const SharedContextKey + var ErrHITLPause = errors.New("hitl tool paused awaiting human response") + var ErrManualTool = errors.New("manual tool is not executable") + var ErrReservedToolName = errors.New("tool name 'shared' is reserved") + func ApplyNextTurnParamsToRequest(request components.ResponsesRequest, params map[string]any) components.ResponsesRequest + func ConvertToolToAPI(t Tool) components.ResponsesRequestToolUnion + func ExecuteNextTurnParamsFunctions(ctx context.Context, funcs NextTurnParamsFunctions, ...) (map[string]any, error) + func ExtractReasoningDeltas(events []components.StreamEvents) []string + func ExtractTextDeltas(events []components.StreamEvents) []string + func ExtractTextFromResponse(resp components.OpenResponsesResult) string + func ExtractToolDeltas(events []components.StreamEvents) []string + func FormatToolOutput(result ToolExecutionResult) components.FunctionCallOutputItem + func FormatToolOutputWithError(result ToolExecutionResult) (components.FunctionCallOutputItem, error) + func FromChatMessages(messages []ChatMessage) ([]components.InputsUnion1, error) + func FromClaudeMessages(messages []ClaudeMessage) ([]components.InputsUnion1, error) + func GenerateConversationID() string + func GetToolExecutionErrors(results []ToolExecutionResult) []error + func GetUnsupportedContentSummary(msg ClaudeMessage) map[string]int + func HasApprovalRequiredTools(tools []Tool) bool + func HasAsyncFunctions(input CallModelInput) bool + func HasExecuteFunction(t Tool) bool + func HasToolExecutionErrors(results []ToolExecutionResult) bool + func HasUnsupportedContent(msg ClaudeMessage) bool + func IsAutoResolvableTool(t Tool) bool + func IsBuiltInHookName(name string) bool + func IsClaudeStyleMessages(v any) bool + func IsClientTool(t Tool) bool + func IsFunctionCallArgsDeltaEvent(e components.StreamEvents) bool + func IsGeneratorTool(t Tool) bool + func IsHITLTool(t Tool) bool + func IsManualTool(t Tool) bool + func IsMcpTool(t Tool) bool + func IsReasoningDeltaEvent(e components.StreamEvents) bool + func IsRegularExecuteTool(t Tool) bool + func IsResponseCompletedEvent(e components.StreamEvents) bool + func IsServerTool(t Tool) bool + func IsStopConditionMet(ctx context.Context, conditions []StopCondition, steps []StepResult) (bool, error) + func IsTextDeltaEvent(e components.StreamEvents) bool + func IsToolCallOutputEvent(e ToolStreamEvent) bool + func IsToolPreliminaryResultEvent(e ToolStreamEvent) bool + func IsToolResultEvent(e ToolStreamEvent) bool + func IsTurnEndEvent(e ResponseStreamEvent) bool + func IsTurnStartEvent(e ResponseStreamEvent) bool + func MatchesTool(matcher ToolMatcher, toolName string) bool + func NormalizeInputToArray(input components.InputsUnion) []components.InputsUnion1 + func Off[P, R any](m *HooksManager, hookName string, handler HookHandler[P, R]) bool + func On[P, R any](m *HooksManager, hookName string, entry HookEntry[P, R]) func() + func ParseToolArguments(raw string) (json.RawMessage, any, error) + func PartitionToolCalls(ctx context.Context, tools []Tool, calls []ParsedToolCall, turn TurnContext, ...) (approved []ParsedToolCall, pending []ParsedToolCall, err error) + func SanitizeSchema(schema map[string]any) map[string]any + func SerializeConversationState(state ConversationState) (string, error) + func SummarizeToolExecutions(results []ToolExecutionResult) []string + func ToolHasApprovalConfigured(t Tool) bool + func ToolRequiresApproval(ctx context.Context, t Tool, call ParsedToolCall, turn TurnContext, ...) (bool, error) + func ToolResultsToMap(results []ToolExecutionResult) map[string]ToolExecutionResult + func UnsentResultsToAPIFormat(results []UnsentToolResult) []components.InputsUnion1 + func UnsentResultsToAPIFormatWithError(results []UnsentToolResult) ([]components.InputsUnion1, error) + func ValidateAgainstSchema(raw json.RawMessage, schema map[string]any) error + type AssistantMessageItem = components.OutputMessageItem + type AsyncOutput struct + AsyncTimeout int64 + Work <-chan error + type BaseInputsUnion = components.InputsUnion + type CallFileSearchItem = components.OutputFileSearchCallItem + type CallFunctionToolItem = components.OutputFunctionCallItem + type CallImageGenerationItem = components.OutputImageGenerationCallItem + type CallModelInput struct + AdditionalInstructions string + AfterTurn func(context.Context, TurnContext, StepResult) error + AllowFinalResponse any + Approval ToolApprovalCheck + ApproveToolCalls []string + BeforeTurn func(context.Context, TurnContext) error + Context ContextInput + Hooks any + Input any + InstructionsFunc DynamicValue[string] + MaxTurns int + MetadataLevel *components.MetadataLevel + Model string + ModelFunc DynamicValue[string] + RejectToolCalls []string + Request components.ResponsesRequest + State *ConversationState + StateAccessor StateAccessor + StopWhen []StopCondition + StrictFinalResponse bool + Tools []Tool + type CallModelInputWithState = CallModelInput + type CallWebSearchItem = components.OutputWebSearchCallItem + type ChatAssistantMessage = components.ChatAssistantMessage + type ChatMessage struct + Content any + Metadata map[string]any + Role string + ToolCallID string + ToolCalls []ParsedToolCall + func ToChatMessage(resp components.OpenResponsesResult) ChatMessage + type ChatMessages = components.ChatMessages + type ChatStreamEvent = ResponseStreamEvent + type ClaudeContentBlock struct + Content any + Data any + ID string + Input any + IsError bool + Name string + Signature string + Source *ClaudeImageSource + Text string + Thinking string + ToolUseID string + Type string + Unsupported *UnsupportedContent + type ClaudeContentBlockType string + type ClaudeImageSource struct + Data string + MediaType string + Type string + URL string + type ClaudeMessage struct + Content []ClaudeContentBlock + ID string + Metadata map[string]any + Model string + Role string + StopReason string + StopSequence *string + Type string + UnsupportedContent []UnsupportedContent + Usage ClaudeUsage + func ToClaudeMessage(resp components.OpenResponsesResult) (ClaudeMessage, error) + type ClaudeUsage struct + CacheCreationInputTokens int64 + CacheReadInputTokens int64 + InputTokens int64 + OutputTokens int64 + type ClientTool interface + type ContextInput map[string]map[string]any + type ConversationState struct + CreatedAt int64 + ID string + InterruptedBy *string + Messages []components.InputsUnion1 + PartialResponse *PartialResponse + PendingToolCalls []ParsedToolCall + PreviousResponseID *string + Status ConversationStatus + UnsentToolResults []UnsentToolResult + UpdatedAt int64 + Version int + func AppendToMessages(state ConversationState, items ...components.InputsUnion1) ConversationState + func CreateInitialState() ConversationState + func DeserializeConversationState(data string) (ConversationState, error) + func UpdateState(state ConversationState, mutate func(*ConversationState)) ConversationState + type ConversationStatus string + const ConversationStatusAwaitingApproval + const ConversationStatusAwaitingClientTools + const ConversationStatusAwaitingHITL + const ConversationStatusComplete + const ConversationStatusInProgress + const ConversationStatusInterrupted + type DeveloperMessageItem = components.EasyInputMessage + type DynamicValue func(context.Context, TurnContext) (T, error) + type EasyInputMessage = components.EasyInputMessage + type EasyInputMessageContentInputImage = components.EasyInputMessageContentInputImage + type EasyInputMessageContentUnion1 = components.EasyInputMessageContentUnion1 + type EasyInputMessageRoleUnion = components.EasyInputMessageRoleUnion + type EmitOptions struct + SessionID string + ToolName string + type EmitResult struct + BlockReason string + Blocked bool + FinalPayload P + Mutated bool + Pending []<-chan struct{} + Results []R + func Emit[P, R any](m *HooksManager, hookName string, payload P, opts EmitOptions) (EmitResult[R, P], error) + type EmptyHookResult struct + type EnhancedResponseStreamEvent = ResponseStreamEvent + type ErrorEvent = components.ErrorEvent + type ErrorItem = components.ErrorEvent + type ErrorMiddleware func(context.Context, *http.Request, error) error + type FunctionCallItem = components.FunctionCallItem + type FunctionCallOutputItem = components.FunctionCallOutputItem + type FunctionProgressItem = ToolPreliminaryResultEvent + type FunctionResultItem = ToolResultEvent + type GetResponseOptions struct + Refresh bool + type HITLTool interface + type HasApprovalTools interface + type Hook = RequestMiddleware + type HookDefinition struct + PayloadType string + ResultType string + type HookEntry struct + Filter func(P) bool + Handler HookHandler[P, R] + Matcher ToolMatcher + type HookHandler func(payload P, hctx LifecycleHookContext) (HookHandlerResult[R], error) + type HookHandlerResult struct + Async *AsyncOutput + HasResult bool + Result R + func AsyncResult[R any](async AsyncOutput) HookHandlerResult[R] + func SyncResult[R any](result R) HookHandlerResult[R] + func VoidResult[R any]() HookHandlerResult[R] + type HookName string + const HookNamePermissionRequest + const HookNamePostModelCall + const HookNamePostToolUse + const HookNamePostToolUseFailure + const HookNamePreToolUse + const HookNameSessionEnd + const HookNameSessionStart + const HookNameStop + const HookNameUserPromptSubmit + type HookRegistry = map[string]HookDefinition + type HooksManager struct + func NewHooksManager(opts ...HooksManagerOptions) *HooksManager + func ResolveHooks(hooks any) *HooksManager + func (m *HooksManager) AbortInflight() + func (m *HooksManager) Drain() + func (m *HooksManager) EmitPermissionRequest(payload PermissionRequestPayload, opts EmitOptions) (EmitResult[PermissionRequestResult, PermissionRequestPayload], error) + func (m *HooksManager) EmitPostModelCall(payload PostModelCallPayload, opts EmitOptions) (EmitResult[EmptyHookResult, PostModelCallPayload], error) + func (m *HooksManager) EmitPostToolUse(payload PostToolUsePayload, opts EmitOptions) (EmitResult[EmptyHookResult, PostToolUsePayload], error) + func (m *HooksManager) EmitPostToolUseFailure(payload PostToolUseFailurePayload, opts EmitOptions) (EmitResult[EmptyHookResult, PostToolUseFailurePayload], error) + func (m *HooksManager) EmitPreToolUse(payload PreToolUsePayload, opts EmitOptions) (EmitResult[PreToolUseResult, PreToolUsePayload], error) + func (m *HooksManager) EmitSessionEnd(payload SessionEndPayload, opts EmitOptions) (EmitResult[EmptyHookResult, SessionEndPayload], error) + func (m *HooksManager) EmitSessionStart(payload SessionStartPayload, opts EmitOptions) (EmitResult[EmptyHookResult, SessionStartPayload], error) + func (m *HooksManager) EmitStop(payload StopPayload, opts EmitOptions) (EmitResult[StopResult, StopPayload], error) + func (m *HooksManager) EmitUserPromptSubmit(payload UserPromptSubmitPayload, opts EmitOptions) (EmitResult[UserPromptSubmitResult, UserPromptSubmitPayload], error) + func (m *HooksManager) HasHandlers(hookName string) bool + func (m *HooksManager) OnPermissionRequest(entry HookEntry[PermissionRequestPayload, PermissionRequestResult]) func() + func (m *HooksManager) OnPostModelCall(entry HookEntry[PostModelCallPayload, EmptyHookResult]) func() + func (m *HooksManager) OnPostToolUse(entry HookEntry[PostToolUsePayload, EmptyHookResult]) func() + func (m *HooksManager) OnPostToolUseFailure(entry HookEntry[PostToolUseFailurePayload, EmptyHookResult]) func() + func (m *HooksManager) OnPreToolUse(entry HookEntry[PreToolUsePayload, PreToolUseResult]) func() + func (m *HooksManager) OnSessionEnd(entry HookEntry[SessionEndPayload, EmptyHookResult]) func() + func (m *HooksManager) OnSessionStart(entry HookEntry[SessionStartPayload, EmptyHookResult]) func() + func (m *HooksManager) OnStop(entry HookEntry[StopPayload, StopResult]) func() + func (m *HooksManager) OnUserPromptSubmit(entry HookEntry[UserPromptSubmitPayload, UserPromptSubmitResult]) func() + func (m *HooksManager) RemoveAll(hookName string) + func (m *HooksManager) RemoveAllHooks() + func (m *HooksManager) SetSessionID(sessionID string) + type HooksManagerOptions struct + ThrowOnHandlerError bool + type InferToolEvent = any + type InferToolEventsUnion = any + type InferToolInput = any + type InferToolOutput = any + type InferToolOutputsUnion = any + type InlineHookConfig struct + PermissionRequest []HookEntry[PermissionRequestPayload, PermissionRequestResult] + PostModelCall []HookEntry[PostModelCallPayload, EmptyHookResult] + PostToolUse []HookEntry[PostToolUsePayload, EmptyHookResult] + PostToolUseFailure []HookEntry[PostToolUseFailurePayload, EmptyHookResult] + PreToolUse []HookEntry[PreToolUsePayload, PreToolUseResult] + SessionEnd []HookEntry[SessionEndPayload, EmptyHookResult] + SessionStart []HookEntry[SessionStartPayload, EmptyHookResult] + Stop []HookEntry[StopPayload, StopResult] + UserPromptSubmit []HookEntry[UserPromptSubmitPayload, UserPromptSubmitResult] + type InputAudio = components.InputAudio + type InputFile = components.InputFile + type InputImage = components.InputImage + type InputMessageItem = components.InputMessageItem + type InputText = components.InputText + type InputVideo = components.InputVideo + type InputsUnion = components.InputsUnion + type InvalidStateError struct + Message string + func (e *InvalidStateError) Error() string + type Item = components.OutputItems + type LifecycleHookContext struct + Ctx context.Context + HookName string + SessionID string + type ManualTool interface + type ModelCallTurnType string + const ModelCallTurnTypeFinal + const ModelCallTurnTypeInitial + const ModelCallTurnTypeResume + const ModelCallTurnTypeRetry + const ModelCallTurnTypeToolRound + type ModelCallUsage struct + CachedTokens int64 + Cost *float64 + InputTokens int64 + OutputTokens int64 + ReasoningTokens int64 + TotalTokens int64 + type ModelResult struct + func CallModel(ctx context.Context, client ResponseSender, input CallModelInput) (*ModelResult, error) + func NewModelResultFromResponse(resp components.OpenResponsesResult) *ModelResult + func (m *ModelResult) Cancel() + func (m *ModelResult) ContextUpdates(ctx context.Context) (<-chan map[string]map[string]any, func() error) + func (m *ModelResult) FullResponsesStream(ctx context.Context) (<-chan ResponseStreamEvent, func() error) + func (m *ModelResult) ItemsStream(ctx context.Context) (<-chan components.OutputItems, func() error) + func (m *ModelResult) NewMessagesStream(ctx context.Context) (<-chan components.InputsUnion1, func() error) + func (m *ModelResult) PendingToolCalls(ctx context.Context) ([]ParsedToolCall, error) + func (m *ModelResult) ReasoningStream(ctx context.Context) (<-chan string, func() error) + func (m *ModelResult) RequiresApproval(ctx context.Context) (bool, error) + func (m *ModelResult) Response(ctx context.Context, opts ...GetResponseOptions) (components.OpenResponsesResult, error) + func (m *ModelResult) State(ctx context.Context) (ConversationState, error) + func (m *ModelResult) String() string + func (m *ModelResult) Text(ctx context.Context) (string, error) + func (m *ModelResult) TextStream(ctx context.Context) (<-chan string, func() error) + func (m *ModelResult) ToolCalls(ctx context.Context) ([]ParsedToolCall, error) + func (m *ModelResult) ToolCallsStream(ctx context.Context) (<-chan ParsedToolCall, func() error) + func (m *ModelResult) ToolStream(ctx context.Context) (<-chan ToolStreamEvent, func() error) + type NewUserMessageItem = components.EasyInputMessage + type NextTurnParamsContext struct + Request components.ResponsesRequest + Result ToolExecutionResult + ToolCall ParsedToolCall + func BuildNextTurnParamsContext(call ParsedToolCall, result ToolExecutionResult, ...) NextTurnParamsContext + type NextTurnParamsFunctions map[string]func(context.Context, NextTurnParamsContext) (any, error) + type NonClaudeMessageRole string + type OpenAIResponsesToolChoiceUnion = components.OpenAIResponsesToolChoiceUnion + type OpenResponsesResult = components.OpenResponsesResult + type OpenRouter struct + func NewOpenRouter(opts OpenRouterOptions) *OpenRouter + func (o *OpenRouter) CallModel(ctx context.Context, input CallModelInput) (*ModelResult, error) + func (o *OpenRouter) SDK() *openrouter.OpenRouter + func (o *OpenRouter) SendResponse(ctx context.Context, request components.ResponsesRequest, ...) (*operations.CreateResponsesResponse, error) + type OpenRouterOptions struct + AfterError []ErrorMiddleware + AfterResponse []ResponseMiddleware + BeforeRequest []RequestMiddleware + RequestHooks []Hook + SDK SDKOptions + type OutputFileSearchCallItem = components.OutputFileSearchCallItem + type OutputFunctionCallItem = components.OutputFunctionCallItem + type OutputImage = components.OutputImage + type OutputImageGenerationCallItem = components.OutputImageGenerationCallItem + type OutputItems = components.OutputItems + type OutputMessage = components.OutputMessageItem + type OutputReasoningItem = components.OutputReasoningItem + type OutputWebSearchCallItem = components.OutputWebSearchCallItem + type ParsedToolCall struct + Arguments any + CallID string + ID string + Name string + RawArgs string + func ExtractToolCallsFromResponse(resp components.OpenResponsesResult) []ParsedToolCall + type PartialResponse struct + Response components.OpenResponsesResult + type PermissionDecision string + const PermissionDecisionAllow + const PermissionDecisionAskUser + const PermissionDecisionDeny + type PermissionRequestPayload struct + RiskLevel RiskLevel + ToolInput map[string]any + ToolName string + type PermissionRequestResult struct + Decision PermissionDecision + Reason string + type PostModelCallPayload struct + DurationMs float64 + Model string + ResponseID string + SessionID string + TurnNumber int + TurnType ModelCallTurnType + Usage *ModelCallUsage + type PostToolUseFailurePayload struct + Error error + ToolInput map[string]any + ToolName string + type PostToolUsePayload struct + DurationMs float64 + ToolInput map[string]any + ToolName string + ToolOutput any + type PreToolUsePayload struct + ToolInput map[string]any + ToolName string + type PreToolUseResult struct + Block bool + BlockReason string + MutatedInput map[string]any + func (r PreToolUseResult) Blocked() bool + type ReasoningItem = components.OutputReasoningItem + type RequestMiddleware func(context.Context, *http.Request) error + type ResolvedCallModelInput = CallModelInput + func ResolveAsyncFunctions(ctx context.Context, input CallModelInput, turn TurnContext) (ResolvedCallModelInput, error) + type ResponseMiddleware func(context.Context, *http.Response) error + type ResponseOutputText = components.ResponseOutputText + type ResponseSender interface + SendResponse func(ctx context.Context, request components.ResponsesRequest, ...) (*operations.CreateResponsesResponse, error) + type ResponseStreamEvent struct + Event *components.StreamEvents + Response *components.OpenResponsesResult + Text string + Turn int + Type string + type ResponsesRequest = components.ResponsesRequest + type ResponsesRequestToolUnion = components.ResponsesRequestToolUnion + type ReusableStream struct + func NewReusableStream[T any]() *ReusableStream[T] + func (r *ReusableStream[T]) Complete(err error) + func (r *ReusableStream[T]) Err() error + func (r *ReusableStream[T]) IsComplete() bool + func (r *ReusableStream[T]) Push(v T) + func (r *ReusableStream[T]) Snapshot() []T + func (r *ReusableStream[T]) Subscribe(buffer int) (<-chan T, func() error) + type RiskLevel string + const RiskLevelHigh + const RiskLevelLow + const RiskLevelMedium + type SDKClient struct + Client *openrouter.OpenRouter + func (s SDKClient) SendResponse(ctx context.Context, request components.ResponsesRequest, ...) (*operations.CreateResponsesResponse, error) + type SDKOptions struct + APIKey string + HTTPClient openrouter.HTTPClient + HTTPReferer string + Timeout time.Duration + XTitle string + type ServerTool interface + type ServerToolConfig struct + Config components.ResponsesRequestToolUnion + Name string + type ServerToolResultItem = components.OutputItems + type SessionEndPayload struct + Reason SessionEndReason + TotalUsage *SessionUsageTotals + type SessionEndReason string + const SessionEndReasonComplete + const SessionEndReasonError + const SessionEndReasonMaxTurns + const SessionEndReasonUser + type SessionStartPayload struct + Config map[string]any + type SessionUsageTotals struct + ModelCalls int + type StateAccessor interface + Load func(context.Context) (*ConversationState, error) + Save func(context.Context, ConversationState) error + type StepResult struct + ClientToolResults []ToolExecutionResult + FinishReason string + Response components.OpenResponsesResult + ServerToolResults []ServerToolResultItem + Text string + ToolCalls []ParsedToolCall + Usage *components.Usage + type StopCondition func(context.Context, []StepResult) (bool, error) + func FinishReasonIs(reason string) StopCondition + func HasToolCall(name string) StopCondition + func MaxCost(limit float64) StopCondition + func MaxTokensUsed(limit int64) StopCondition + func StepCountIs(limit int) StopCondition + type StopPayload struct + Reason StopReason + type StopReason string + const StopReasonMaxTurns + type StopResult struct + AppendPrompt string + ForceResume bool + type StopWhen []StopCondition + type StreamEvents = components.StreamEvents + type StreamableOutputItem = components.OutputItems + type SystemMessageItem = components.EasyInputMessage + type ToModelOutputFunction func(any) (any, error) + type ToModelOutputResult struct + Output any + type Tool interface + EventSchema func() map[string]any + HandleResponseReceived func(context.Context, any, ToolExecuteContext) (any, error) + InputSchema func() map[string]any + OutputSchema func() map[string]any + RequiresApproval func(context.Context, ParsedToolCall, TurnContext) (bool, error) + ToAPITool func() components.ResponsesRequestToolUnion + ToolDescription func() string + ToolName func() string + ToolType func() ToolType + func FindToolByName(tools []Tool, name string) Tool + func MarkMcp(t Tool) Tool + func NewServerTool(config ServerToolConfig) Tool + type ToolApprovalCheck func(context.Context, ParsedToolCall, TurnContext) (bool, error) + type ToolCallOutputEvent struct + CallID string + Error string + Name string + Output any + Type string + type ToolConfig struct + Approval ToolApprovalCheck + Description string + EventSchema map[string]any + Execute func(context.Context, In, ToolExecuteContext) (any, error) + Generate func(context.Context, In, ToolExecuteContext, func(any) error) (any, error) + InputSchema map[string]any + Manual bool + Name string + OnResponseReceived func(context.Context, any, ToolExecuteContext) (any, error) + OnToolCalled func(context.Context, In, ToolExecuteContext) (any, bool, error) + OutputSchema map[string]any + RequireApproval bool + type ToolContextStore struct + func NewToolContextStore(initial ContextInput) *ToolContextStore + func (s *ToolContextStore) Get(name string) map[string]any + func (s *ToolContextStore) Merge(name string, value map[string]any) + func (s *ToolContextStore) Set(name string, value map[string]any) + func (s *ToolContextStore) Snapshot() map[string]map[string]any + func (s *ToolContextStore) Subscribe(listener func(string, map[string]any)) + type ToolEventBroadcaster struct + func NewToolEventBroadcaster() *ToolEventBroadcaster + func (b *ToolEventBroadcaster) Complete() + func (b *ToolEventBroadcaster) Error(err error) + func (b *ToolEventBroadcaster) Push(event ToolStreamEvent) + func (b *ToolEventBroadcaster) Snapshot() []ToolStreamEvent + func (b *ToolEventBroadcaster) Subscribe() (<-chan ToolStreamEvent, func() error) + type ToolExecuteContext struct + Context map[string]any + Emit func(any) + Shared map[string]any + Store *ToolContextStore + ToolCall ParsedToolCall + Turn TurnContext + func BuildToolExecuteContext(call ParsedToolCall, turn TurnContext, store *ToolContextStore, emit func(any)) ToolExecuteContext + func (tc ToolExecuteContext) LocalContext() map[string]any + func (tc ToolExecuteContext) MergeContext(value map[string]any) + func (tc ToolExecuteContext) MergeSharedContext(value map[string]any) + func (tc ToolExecuteContext) SetContext(value map[string]any) + func (tc ToolExecuteContext) SetSharedContext(value map[string]any) + func (tc ToolExecuteContext) SharedContext() map[string]any + type ToolExecutionResult struct + CallID string + Error error + Events []any + Name string + Output any + Source ToolSource + func ExecuteTool(ctx context.Context, t Tool, call ParsedToolCall, execCtx ToolExecuteContext) (ToolExecutionResult, error) + func ExecuteToolLoop(ctx context.Context, tools []Tool, calls []ParsedToolCall, ...) ([]ToolExecutionResult, error) + type ToolExecutionResultUnion = ToolExecutionResult + type ToolHasApproval interface + type ToolMatcher = any + type ToolOutputContentItem = components.FunctionCallOutputItemOutputUnion1 + type ToolPreliminaryResultEvent struct + CallID string + Event any + Name string + Type string + type ToolResultEvent struct + CallID string + Error string + Name string + Result any + Source ToolSource + Type string + type ToolResultItem = components.FunctionCallOutputItem + type ToolSource string + const ToolSourceClient + const ToolSourceMCP + type ToolStreamEvent struct + CallID string + Error string + Event any + Name string + Output any + Result any + Source ToolSource + Turn int + Type string + type ToolType string + const ToolTypeGenerator + const ToolTypeHITL + const ToolTypeManual + const ToolTypeRegular + const ToolTypeServer + type ToolWithExecute interface + Execute func(context.Context, json.RawMessage, ToolExecuteContext) (ToolExecutionResult, error) + type ToolWithGenerator interface + type TurnContext struct + NumberOfTurns int + ToolCall *components.OutputFunctionCallItem + TurnRequest *components.ResponsesRequest + func BuildTurnContext(call *components.OutputFunctionCallItem, turns int, ...) TurnContext + type TurnEndEvent struct + Turn int + Type string + type TurnStartEvent struct + Turn int + Type string + type TypedTool struct + func MustNewTool[In any](config ToolConfig[In]) *TypedTool[In] + func NewTool[In any](config ToolConfig[In]) (*TypedTool[In], error) + func (t *TypedTool[In]) EventSchema() map[string]any + func (t *TypedTool[In]) Execute(ctx context.Context, raw json.RawMessage, execCtx ToolExecuteContext) (ToolExecutionResult, error) + func (t *TypedTool[In]) HandleResponseReceived(ctx context.Context, output any, execCtx ToolExecuteContext) (any, error) + func (t *TypedTool[In]) InputSchema() map[string]any + func (t *TypedTool[In]) OutputSchema() map[string]any + func (t *TypedTool[In]) RequiresApproval(ctx context.Context, call ParsedToolCall, turn TurnContext) (bool, error) + func (t *TypedTool[In]) ToAPITool() components.ResponsesRequestToolUnion + func (t *TypedTool[In]) ToolDescription() string + func (t *TypedTool[In]) ToolName() string + func (t *TypedTool[In]) ToolType() ToolType + type TypedToolCall = ParsedToolCall + type TypedToolCallUnion = ParsedToolCall + type UnsentToolResult struct + CallID string + Error string + Name string + Output any + func CreateRejectedResult(call ParsedToolCall, reason string) UnsentToolResult + func CreateUnsentResult(call ParsedToolCall, output any) UnsentToolResult + type UnsupportedContent struct + Data any + OriginalType string + Reason string + func ExtractUnsupportedContent(msg ClaudeMessage, originalType string) []UnsupportedContent + func ScanUnsupportedContent(v any) []UnsupportedContent + type UnsupportedStateVersionError struct + Found int + Supported []int + func (e *UnsupportedStateVersionError) Error() string + type Usage = components.Usage + type UserMessageItem = components.EasyInputMessage + type UserPromptSubmitPayload struct + Prompt string + type UserPromptSubmitResult struct + MutatedPrompt *string + Reject bool + RejectReason string + func (r UserPromptSubmitResult) Rejected() bool + type Warning struct + Message string