@openrouter/agent 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +732 -7
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/esm/index.d.ts +20 -5
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +10 -3
- package/esm/index.js.map +1 -1
- package/esm/inner-loop/call-model.d.ts.map +1 -1
- package/esm/inner-loop/call-model.js +63 -46
- package/esm/inner-loop/call-model.js.map +1 -1
- package/esm/inner-loop/resume-tool-results.d.ts +128 -0
- package/esm/inner-loop/resume-tool-results.d.ts.map +1 -0
- package/esm/inner-loop/resume-tool-results.js +244 -0
- package/esm/inner-loop/resume-tool-results.js.map +1 -0
- package/esm/lib/agent-tool.d.ts +92 -0
- package/esm/lib/agent-tool.d.ts.map +1 -0
- package/esm/lib/agent-tool.js +211 -0
- package/esm/lib/agent-tool.js.map +1 -0
- package/esm/lib/async-params.d.ts +96 -0
- package/esm/lib/async-params.d.ts.map +1 -1
- package/esm/lib/async-params.js +30 -1
- package/esm/lib/async-params.js.map +1 -1
- package/esm/lib/async-tool-registry.d.ts +134 -0
- package/esm/lib/async-tool-registry.d.ts.map +1 -0
- package/esm/lib/async-tool-registry.js +352 -0
- package/esm/lib/async-tool-registry.js.map +1 -0
- package/esm/lib/async-tools.d.ts +23 -0
- package/esm/lib/async-tools.d.ts.map +1 -0
- package/esm/lib/async-tools.js +19 -0
- package/esm/lib/async-tools.js.map +1 -0
- package/esm/lib/conversation-state.d.ts +1 -0
- package/esm/lib/conversation-state.d.ts.map +1 -1
- package/esm/lib/conversation-state.js +8 -0
- package/esm/lib/conversation-state.js.map +1 -1
- package/esm/lib/doom-loop.d.ts +533 -0
- package/esm/lib/doom-loop.d.ts.map +1 -0
- package/esm/lib/doom-loop.js +1221 -0
- package/esm/lib/doom-loop.js.map +1 -0
- package/esm/lib/hooks-schemas.d.ts +33 -0
- package/esm/lib/hooks-schemas.d.ts.map +1 -1
- package/esm/lib/hooks-schemas.js +54 -0
- package/esm/lib/hooks-schemas.js.map +1 -1
- package/esm/lib/hooks-types.d.ts +6 -2
- package/esm/lib/hooks-types.d.ts.map +1 -1
- package/esm/lib/hooks-types.js.map +1 -1
- package/esm/lib/model-result.d.ts +648 -12
- package/esm/lib/model-result.d.ts.map +1 -1
- package/esm/lib/model-result.js +2784 -164
- package/esm/lib/model-result.js.map +1 -1
- package/esm/lib/next-turn-params.d.ts.map +1 -1
- package/esm/lib/next-turn-params.js +3 -1
- package/esm/lib/next-turn-params.js.map +1 -1
- package/esm/lib/next-turn-params.test.js +72 -0
- package/esm/lib/next-turn-params.test.js.map +1 -1
- package/esm/lib/reusable-stream.d.ts +9 -0
- package/esm/lib/reusable-stream.d.ts.map +1 -1
- package/esm/lib/reusable-stream.js +17 -0
- package/esm/lib/reusable-stream.js.map +1 -1
- package/esm/lib/stream-transformers.d.ts +21 -1
- package/esm/lib/stream-transformers.d.ts.map +1 -1
- package/esm/lib/stream-transformers.js +45 -0
- package/esm/lib/stream-transformers.js.map +1 -1
- package/esm/lib/tool-check.d.ts +76 -0
- package/esm/lib/tool-check.d.ts.map +1 -0
- package/esm/lib/tool-check.js +241 -0
- package/esm/lib/tool-check.js.map +1 -0
- package/esm/lib/tool-concurrency.d.ts +42 -0
- package/esm/lib/tool-concurrency.d.ts.map +1 -0
- package/esm/lib/tool-concurrency.js +80 -0
- package/esm/lib/tool-concurrency.js.map +1 -0
- package/esm/lib/tool-context.d.ts +45 -1
- package/esm/lib/tool-context.d.ts.map +1 -1
- package/esm/lib/tool-context.js +60 -1
- package/esm/lib/tool-context.js.map +1 -1
- package/esm/lib/tool-executor.d.ts +52 -9
- package/esm/lib/tool-executor.d.ts.map +1 -1
- package/esm/lib/tool-executor.js +253 -21
- package/esm/lib/tool-executor.js.map +1 -1
- package/esm/lib/tool-orchestrator.d.ts.map +1 -1
- package/esm/lib/tool-orchestrator.js +87 -50
- package/esm/lib/tool-orchestrator.js.map +1 -1
- package/esm/lib/tool-set-types.d.ts +298 -0
- package/esm/lib/tool-set-types.d.ts.map +1 -0
- package/esm/lib/tool-set-types.js +2 -0
- package/esm/lib/tool-set-types.js.map +1 -0
- package/esm/lib/tool-set.d.ts +157 -0
- package/esm/lib/tool-set.d.ts.map +1 -0
- package/esm/lib/tool-set.js +473 -0
- package/esm/lib/tool-set.js.map +1 -0
- package/esm/lib/tool-task.d.ts +157 -0
- package/esm/lib/tool-task.d.ts.map +1 -0
- package/esm/lib/tool-task.js +206 -0
- package/esm/lib/tool-task.js.map +1 -0
- package/esm/lib/tool-types.d.ts +667 -38
- package/esm/lib/tool-types.d.ts.map +1 -1
- package/esm/lib/tool-types.js +59 -10
- package/esm/lib/tool-types.js.map +1 -1
- package/esm/lib/tool.d.ts +227 -19
- package/esm/lib/tool.d.ts.map +1 -1
- package/esm/lib/tool.js +206 -6
- package/esm/lib/tool.js.map +1 -1
- package/esm/mcp/auth/auth-resolver.d.ts +14 -0
- package/esm/mcp/auth/auth-resolver.d.ts.map +1 -0
- package/esm/mcp/auth/auth-resolver.js +27 -0
- package/esm/mcp/auth/auth-resolver.js.map +1 -0
- package/esm/mcp/auth/auth-types.d.ts +33 -0
- package/esm/mcp/auth/auth-types.d.ts.map +1 -0
- package/esm/mcp/auth/auth-types.js +4 -0
- package/esm/mcp/auth/auth-types.js.map +1 -0
- package/esm/mcp/build-tools.d.ts +29 -0
- package/esm/mcp/build-tools.d.ts.map +1 -0
- package/esm/mcp/build-tools.js +80 -0
- package/esm/mcp/build-tools.js.map +1 -0
- package/esm/mcp/cache/cache-store.d.ts +24 -0
- package/esm/mcp/cache/cache-store.d.ts.map +1 -0
- package/esm/mcp/cache/cache-store.js +20 -0
- package/esm/mcp/cache/cache-store.js.map +1 -0
- package/esm/mcp/cache/cache-types.d.ts +71 -0
- package/esm/mcp/cache/cache-types.d.ts.map +1 -0
- package/esm/mcp/cache/cache-types.js +49 -0
- package/esm/mcp/cache/cache-types.js.map +1 -0
- package/esm/mcp/cache/serialize.d.ts +25 -0
- package/esm/mcp/cache/serialize.d.ts.map +1 -0
- package/esm/mcp/cache/serialize.js +96 -0
- package/esm/mcp/cache/serialize.js.map +1 -0
- package/esm/mcp/close-quietly.d.ts +24 -0
- package/esm/mcp/close-quietly.d.ts.map +1 -0
- package/esm/mcp/close-quietly.js +30 -0
- package/esm/mcp/close-quietly.js.map +1 -0
- package/esm/mcp/create-mcp-tools.d.ts +13 -0
- package/esm/mcp/create-mcp-tools.d.ts.map +1 -0
- package/esm/mcp/create-mcp-tools.js +87 -0
- package/esm/mcp/create-mcp-tools.js.map +1 -0
- package/esm/mcp/elicitation.d.ts +11 -0
- package/esm/mcp/elicitation.d.ts.map +1 -0
- package/esm/mcp/elicitation.js +51 -0
- package/esm/mcp/elicitation.js.map +1 -0
- package/esm/mcp/errors.d.ts +91 -0
- package/esm/mcp/errors.d.ts.map +1 -0
- package/esm/mcp/errors.js +91 -0
- package/esm/mcp/errors.js.map +1 -0
- package/esm/mcp/handle.d.ts +66 -0
- package/esm/mcp/handle.d.ts.map +1 -0
- package/esm/mcp/handle.js +323 -0
- package/esm/mcp/handle.js.map +1 -0
- package/esm/mcp/index.d.ts +13 -0
- package/esm/mcp/index.d.ts.map +1 -0
- package/esm/mcp/index.js +11 -0
- package/esm/mcp/index.js.map +1 -0
- package/esm/mcp/mcp-connection.d.ts +150 -0
- package/esm/mcp/mcp-connection.d.ts.map +1 -0
- package/esm/mcp/mcp-connection.js +478 -0
- package/esm/mcp/mcp-connection.js.map +1 -0
- package/esm/mcp/mcp-sdk.d.ts +10 -0
- package/esm/mcp/mcp-sdk.d.ts.map +1 -0
- package/esm/mcp/mcp-sdk.js +37 -0
- package/esm/mcp/mcp-sdk.js.map +1 -0
- package/esm/mcp/rehydrate.d.ts +76 -0
- package/esm/mcp/rehydrate.d.ts.map +1 -0
- package/esm/mcp/rehydrate.js +505 -0
- package/esm/mcp/rehydrate.js.map +1 -0
- package/esm/mcp/resource-tools.d.ts +17 -0
- package/esm/mcp/resource-tools.d.ts.map +1 -0
- package/esm/mcp/resource-tools.js +155 -0
- package/esm/mcp/resource-tools.js.map +1 -0
- package/esm/mcp/result-mapper.d.ts +19 -0
- package/esm/mcp/result-mapper.d.ts.map +1 -0
- package/esm/mcp/result-mapper.js +40 -0
- package/esm/mcp/result-mapper.js.map +1 -0
- package/esm/mcp/schema/json-schema-guards.d.ts +14 -0
- package/esm/mcp/schema/json-schema-guards.d.ts.map +1 -0
- package/esm/mcp/schema/json-schema-guards.js +19 -0
- package/esm/mcp/schema/json-schema-guards.js.map +1 -0
- package/esm/mcp/schema/json-schema-to-zod.d.ts +20 -0
- package/esm/mcp/schema/json-schema-to-zod.d.ts.map +1 -0
- package/esm/mcp/schema/json-schema-to-zod.js +72 -0
- package/esm/mcp/schema/json-schema-to-zod.js.map +1 -0
- package/esm/mcp/tool-wrapper.d.ts +41 -0
- package/esm/mcp/tool-wrapper.d.ts.map +1 -0
- package/esm/mcp/tool-wrapper.js +131 -0
- package/esm/mcp/tool-wrapper.js.map +1 -0
- package/esm/mcp/transport-types.d.ts +45 -0
- package/esm/mcp/transport-types.d.ts.map +1 -0
- package/esm/mcp/transport-types.js +2 -0
- package/esm/mcp/transport-types.js.map +1 -0
- package/esm/mcp/types.d.ts +119 -0
- package/esm/mcp/types.d.ts.map +1 -0
- package/esm/mcp/types.js +2 -0
- package/esm/mcp/types.js.map +1 -0
- package/esm/mcp/version.d.ts +3 -0
- package/esm/mcp/version.d.ts.map +1 -0
- package/esm/mcp/version.js +5 -0
- package/esm/mcp/version.js.map +1 -0
- package/package.json +70 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
`@openrouter/agent/tool-set` is adapted from [`ai-tool-set` v1.0.0](https://github.com/zirkelc/ai-tool-set/tree/v1.0.0), which is licensed under the MIT License:
|
|
4
|
+
|
|
5
|
+
> MIT License
|
|
6
|
+
>
|
|
7
|
+
> Copyright (c) 2024 Chris
|
|
8
|
+
>
|
|
9
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
> in the Software without restriction, including without limitation the rights
|
|
12
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
> furnished to do so, subject to the following conditions:
|
|
15
|
+
>
|
|
16
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
> copies or substantial portions of the Software.
|
|
18
|
+
>
|
|
19
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
> SOFTWARE.
|
package/esm/index.d.ts
CHANGED
|
@@ -4,15 +4,23 @@ export type { RequestOptions } from '@openrouter/sdk/lib/sdks';
|
|
|
4
4
|
export type { BaseInputsUnion, ChatAssistantMessage, ChatMessages, EasyInputMessage, EasyInputMessageContentInputImage, EasyInputMessageContentUnion1, EasyInputMessageRoleUnion, ErrorEvent, FunctionCallItem, FunctionCallOutputItem, InputAudio, InputFile, InputImage, InputMessageItem, InputsUnion, InputText, InputVideo, OpenAIResponsesToolChoiceUnion, OpenResponsesResult, OutputFileSearchCallItem, OutputFunctionCallItem, OutputImage, OutputImage as OutputInputImage, OutputImageGenerationCallItem, OutputItems, OutputMessage, OutputReasoningItem, OutputWebSearchCallItem, ResponseOutputText, ResponsesRequest, ResponsesRequestToolUnion, StreamEvents, Usage, } from '@openrouter/sdk/models';
|
|
5
5
|
export type { AssistantMessageItem, CallFileSearchItem, CallFunctionToolItem, CallImageGenerationItem, CallWebSearchItem, DeveloperMessageItem, ErrorItem, FunctionProgressItem, FunctionResultItem, Item, NewUserMessageItem, ReasoningItem, SystemMessageItem, UserMessageItem, } from './lib/item-types.js';
|
|
6
6
|
export { callModel } from './inner-loop/call-model.js';
|
|
7
|
+
export type { ResumeRunConfig, ResumeToolResultEntry, ToolTaskResultEnvelope, } from './inner-loop/resume-tool-results.js';
|
|
8
|
+
export { resumeToolResults, ToolTaskAlreadySettledError, } from './inner-loop/resume-tool-results.js';
|
|
9
|
+
export type { AgentRunSpec, AgentToolConfig } from './lib/agent-tool.js';
|
|
10
|
+
export { AgentTranscriptSource } from './lib/agent-tool.js';
|
|
7
11
|
export { fromClaudeMessages, toClaudeMessage } from './lib/anthropic-compat.js';
|
|
8
12
|
export type { CallModelInput, CallModelInputWithState, ResolvedCallModelInput, } from './lib/async-params.js';
|
|
9
|
-
export { hasAsyncFunctions, resolveAsyncFunctions } from './lib/async-params.js';
|
|
13
|
+
export { hasAsyncFunctions, resolveAsyncFunctions, TOOL_SET_SNAPSHOT, } from './lib/async-params.js';
|
|
14
|
+
export type { SettledToolTask } from './lib/async-tool-registry.js';
|
|
15
|
+
export { AsyncToolRegistry } from './lib/async-tool-registry.js';
|
|
10
16
|
export { fromChatMessages, toChatMessage } from './lib/chat-compat.js';
|
|
11
17
|
export { ClaudeContentBlockType, NonClaudeMessageRole } from './lib/claude-constants.js';
|
|
12
18
|
export { isClaudeStyleMessages } from './lib/claude-type-guards.js';
|
|
13
19
|
export { appendToMessages, CONVERSATION_STATE_VERSION, createInitialState, createRejectedResult, createUnsentResult, deserializeConversationState, generateConversationId, InvalidStateError, partitionToolCalls, serializeConversationState, toolRequiresApproval, UnsupportedStateVersionError, updateState, } from './lib/conversation-state.js';
|
|
20
|
+
export type { DoomLoopAction, DoomLoopCallRecord, DoomLoopConfig, DoomLoopDetectorKind, DoomLoopEscalationConfig, DoomLoopLadder, DoomLoopOption, DoomLoopSerializedState, DoomLoopStreak, DoomLoopTextOptions, DoomLoopVerdict, LoopKeyResolution, ResolvedDoomLoopConfig, ResolvedEscalationConfig, TextRepetitionResult, } from './lib/doom-loop.js';
|
|
21
|
+
export { canonicalizeKeyMaterial, DEFAULT_DOOM_LOOP_LADDER, DEFAULT_MAX_ESCALATIONS, DoomLoopMonitor, detectTextRepetition, fingerprintKeyMaterial, fingerprintToolCall, MAX_CANONICALIZE_DEPTH, resolveDoomLoopOption, resolveLoopKeyMaterial, } from './lib/doom-loop.js';
|
|
14
22
|
export { HooksManager } from './lib/hooks-manager.js';
|
|
15
|
-
export type { AsyncOutput, BuiltInHookDefinitions, EmitResult, HookDefinition, HookEntry, HookHandler, HookRegistry, HookReturn, HooksManagerOptions, InlineHookConfig, LifecycleHookContext, ModelCallUsage, PermissionRequestPayload, PermissionRequestResult, PostModelCallPayload, PostToolUseFailurePayload, PostToolUsePayload, PreToolUsePayload, PreToolUseResult, SessionEndPayload, SessionStartPayload, SessionUsageTotals, StopPayload, StopResult, ToolMatcher, UserPromptSubmitPayload, UserPromptSubmitResult, } from './lib/hooks-types.js';
|
|
23
|
+
export type { AsyncOutput, BuiltInHookDefinitions, DoomLoopDetectedPayload, DoomLoopDetectedResult, EmitResult, HookDefinition, HookEntry, HookHandler, HookRegistry, HookReturn, HooksManagerOptions, InlineHookConfig, LifecycleHookContext, ModelCallUsage, PermissionRequestPayload, PermissionRequestResult, PostModelCallPayload, PostToolUseFailurePayload, PostToolUsePayload, PreToolUsePayload, PreToolUseResult, SessionEndPayload, SessionStartPayload, SessionUsageTotals, StopPayload, StopResult, ToolMatcher, UserPromptSubmitPayload, UserPromptSubmitResult, } from './lib/hooks-types.js';
|
|
16
24
|
export { HookName, isAsyncOutput } from './lib/hooks-types.js';
|
|
17
25
|
export type { GetResponseOptions } from './lib/model-result.js';
|
|
18
26
|
export { DEFAULT_FINAL_RESPONSE_DIRECTIVE, ModelResult } from './lib/model-result.js';
|
|
@@ -20,12 +28,19 @@ export { applyNextTurnParamsToRequest, buildNextTurnParamsContext, executeNextTu
|
|
|
20
28
|
export { finishReasonIs, hasToolCall, isStopConditionMet, maxCost, maxTokensUsed, stepCountIs, } from './lib/stop-conditions.js';
|
|
21
29
|
export type { StreamableOutputItem } from './lib/stream-transformers.js';
|
|
22
30
|
export { extractUnsupportedContent, getUnsupportedContentSummary, hasUnsupportedContent, } from './lib/stream-transformers.js';
|
|
31
|
+
export type { BuiltDeferredTool, DeferredToolMethods, ServerToolOptions, } from './lib/tool.js';
|
|
23
32
|
export { markMcp, serverTool, tool } from './lib/tool.js';
|
|
24
|
-
export type {
|
|
33
|
+
export type { TaskToolInput } from './lib/tool-check.js';
|
|
34
|
+
export { TASK_TOOL_NAME, TaskToolInputSchema } from './lib/tool-check.js';
|
|
35
|
+
export type { SemaphoreRelease } from './lib/tool-concurrency.js';
|
|
36
|
+
export { acquireAll, Semaphore } from './lib/tool-concurrency.js';
|
|
37
|
+
export type { ContextInput, ToolExecutionExtras } from './lib/tool-context.js';
|
|
25
38
|
export { buildToolExecuteContext, ToolContextStore } from './lib/tool-context.js';
|
|
26
39
|
export { ToolEventBroadcaster } from './lib/tool-event-broadcaster.js';
|
|
27
|
-
export type {
|
|
28
|
-
export {
|
|
40
|
+
export type { TaskLogEntry, TaskLogLimits, TaskTranscriptSource, ToolTaskMode, ToolTaskStatusView, } from './lib/tool-task.js';
|
|
41
|
+
export { DEFAULT_TASK_LOG_LIMITS, ToolTask } from './lib/tool-task.js';
|
|
42
|
+
export type { AsyncToolAck, BuiltinTaskToolEvent, ChatStreamEvent, ClientTool, ConversationState, ConversationStatus, CorrelatedResponseStreamEvent, CorrelatedToolEventUnion, CorrelatedToolPreliminaryResultEvent, CorrelatedToolResultEvent, CorrelatedToolStreamEvent, CorrelatedToolStreamPreliminaryUnion, DeferOptions, DeferredHandle, HasApprovalTools, HITLTool, HITLToolFunction, InferToolEvent, InferToolEventsUnion, InferToolInput, InferToolName, InferToolOutput, InferToolOutputsUnion, ManualTool, McpBranded, NextTurnParamsContext, NextTurnParamsFunctions, ParsedToolCall, PartialResponse, PendingAsyncTool, ResponseStreamEvent, ResponseStreamEvent as EnhancedResponseStreamEvent, ServerTool, ServerToolBase, ServerToolConfig, ServerToolResultItem, ServerToolType, StateAccessor, StepResult, StopCondition, StopWhen, ToModelOutputFunction, ToModelOutputResult, Tool, ToolApprovalCheck, ToolAsyncSettledEvent, ToolAsyncStartedEvent, ToolCallOutputEvent, ToolCheckConfig, ToolExecutionResult, ToolExecutionResultUnion, ToolHasApproval, ToolLifecycle, ToolLoopKey, ToolLoopKeyFn, ToolOutputContentItem, ToolPreliminaryResultEvent, ToolResultEvent, ToolResultItem, ToolRunContext, ToolStreamEvent, ToolTaskHandle, ToolTaskStatus, ToolWithExecute, ToolWithGenerator, TurnContext, TurnEndEvent, TurnStartEvent, TypedToolCall, TypedToolCallUnion, UnifiedTool, UnifiedToolFunction, UnsentToolResult, Warning, } from './lib/tool-types.js';
|
|
43
|
+
export { hasApprovalRequiredTools, hasExecuteFunction, isAgentTool, isAutoResolvableTool, isClientTool, isDeferredHandle, isGeneratorTool, isHITLTool, isLongRunningTool, isManualTool, isMcpTool, isRegularExecuteTool, isServerTool, isToolAsyncSettledEvent, isToolAsyncStartedEvent, isToolCallOutputEvent, isToolPreliminaryResultEvent, isToolResultEvent, isTurnEndEvent, isTurnStartEvent, isUnifiedTool, ToolType, toolHasApprovalConfigured, } from './lib/tool-types.js';
|
|
29
44
|
export { buildTurnContext, normalizeInputToArray } from './lib/turn-context.js';
|
|
30
45
|
export type { Hook, OpenRouterOptions, SDKOptions } from './openrouter.js';
|
|
31
46
|
export { OpenRouter } from './openrouter.js';
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,YAAY,EAEV,eAAe,EAEf,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,iCAAiC,EACjC,6BAA6B,EAC7B,yBAAyB,EAEzB,UAAU,EACV,gBAAgB,EAChB,sBAAsB,EAEtB,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,UAAU,EACV,8BAA8B,EAC9B,mBAAmB,EAEnB,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EACX,WAAW,IAAI,gBAAgB,EAC/B,6BAA6B,EAC7B,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EAEvB,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,EACZ,KAAK,GACN,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;A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,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,OAAO,GACR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAChF,YAAY,EAAE,IAAI,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -5,14 +5,18 @@ export { SDKHooks } from '@openrouter/sdk/hooks/hooks';
|
|
|
5
5
|
// Message format compatibility helpers
|
|
6
6
|
// High-level model calling
|
|
7
7
|
export { callModel } from './inner-loop/call-model.js';
|
|
8
|
+
export { resumeToolResults, ToolTaskAlreadySettledError, } from './inner-loop/resume-tool-results.js';
|
|
9
|
+
export { AgentTranscriptSource } from './lib/agent-tool.js';
|
|
8
10
|
export { fromClaudeMessages, toClaudeMessage } from './lib/anthropic-compat.js';
|
|
9
|
-
export { hasAsyncFunctions, resolveAsyncFunctions } from './lib/async-params.js';
|
|
11
|
+
export { hasAsyncFunctions, resolveAsyncFunctions, TOOL_SET_SNAPSHOT, } from './lib/async-params.js';
|
|
12
|
+
export { AsyncToolRegistry } from './lib/async-tool-registry.js';
|
|
10
13
|
export { fromChatMessages, toChatMessage } from './lib/chat-compat.js';
|
|
11
14
|
// Claude constants and type guards
|
|
12
15
|
export { ClaudeContentBlockType, NonClaudeMessageRole } from './lib/claude-constants.js';
|
|
13
16
|
export { isClaudeStyleMessages } from './lib/claude-type-guards.js';
|
|
14
17
|
// Conversation state helpers
|
|
15
18
|
export { appendToMessages, CONVERSATION_STATE_VERSION, createInitialState, createRejectedResult, createUnsentResult, deserializeConversationState, generateConversationId, InvalidStateError, partitionToolCalls, serializeConversationState, toolRequiresApproval, UnsupportedStateVersionError, updateState, } from './lib/conversation-state.js';
|
|
19
|
+
export { canonicalizeKeyMaterial, DEFAULT_DOOM_LOOP_LADDER, DEFAULT_MAX_ESCALATIONS, DoomLoopMonitor, detectTextRepetition, fingerprintKeyMaterial, fingerprintToolCall, MAX_CANONICALIZE_DEPTH, resolveDoomLoopOption, resolveLoopKeyMaterial, } from './lib/doom-loop.js';
|
|
16
20
|
// Lifecycle hooks system (PreToolUse, PostToolUse, Stop, SessionStart, ...).
|
|
17
21
|
// Distinct from the SDK transport hooks re-exported above (SDKHooks,
|
|
18
22
|
// BeforeRequestHook, HookContext, ...), which intercept HTTP requests.
|
|
@@ -27,13 +31,16 @@ export { applyNextTurnParamsToRequest, buildNextTurnParamsContext, executeNextTu
|
|
|
27
31
|
// Stop condition helpers
|
|
28
32
|
export { finishReasonIs, hasToolCall, isStopConditionMet, maxCost, maxTokensUsed, stepCountIs, } from './lib/stop-conditions.js';
|
|
29
33
|
export { extractUnsupportedContent, getUnsupportedContentSummary, hasUnsupportedContent, } from './lib/stream-transformers.js';
|
|
30
|
-
// Tool creation helpers
|
|
34
|
+
// Tool creation helpers (tool also carries tool.background / tool.deferred)
|
|
31
35
|
export { markMcp, serverTool, tool } from './lib/tool.js';
|
|
36
|
+
export { TASK_TOOL_NAME, TaskToolInputSchema } from './lib/tool-check.js';
|
|
37
|
+
export { acquireAll, Semaphore } from './lib/tool-concurrency.js';
|
|
32
38
|
// Tool context helpers
|
|
33
39
|
export { buildToolExecuteContext, ToolContextStore } from './lib/tool-context.js';
|
|
34
40
|
// Real-time tool event broadcasting
|
|
35
41
|
export { ToolEventBroadcaster } from './lib/tool-event-broadcaster.js';
|
|
36
|
-
export {
|
|
42
|
+
export { DEFAULT_TASK_LOG_LIMITS, ToolTask } from './lib/tool-task.js';
|
|
43
|
+
export { hasApprovalRequiredTools, hasExecuteFunction, isAgentTool, isAutoResolvableTool, isClientTool, isDeferredHandle, isGeneratorTool, isHITLTool, isLongRunningTool, isManualTool, isMcpTool, isRegularExecuteTool, isServerTool, isToolAsyncSettledEvent, isToolAsyncStartedEvent, isToolCallOutputEvent, isToolPreliminaryResultEvent, isToolResultEvent, isTurnEndEvent, isTurnStartEvent, isUnifiedTool, ToolType, toolHasApprovalConfigured, } from './lib/tool-types.js';
|
|
37
44
|
// Turn context helpers
|
|
38
45
|
export { buildTurnContext, normalizeInputToArray } from './lib/turn-context.js';
|
|
39
46
|
export { OpenRouter } from './openrouter.js';
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,iEAAiE;AAEjE,yDAAyD;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AA2EvD,uCAAuC;AAEvC,2BAA2B;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,iEAAiE;AAEjE,yDAAyD;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AA2EvD,uCAAuC;AAEvC,2BAA2B;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAOvD,OAAO,EACL,iBAAiB,EACjB,2BAA2B,GAC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sources":["../../src/inner-loop/call-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"call-model.d.ts","sourceRoot":"","sources":["../../src/inner-loop/call-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAIjD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,wBAAgB,SAAS,CACvB,MAAM,SAAS,SAAS,IAAI,EAAE,EAC9B,aAAa,SAAS,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,SAAS,EACnE,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,SAAS,UAAU,CAAC,SAAS,CAAC,GACjF,QAAQ,CAAC,aAAa,CAAC,GACvB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEzB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACzC,mBAAmB,CAAC,EAAE,aAAa,CAAC;CACrC,EACD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAiH9B"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { stripToolSetSnapshotMetadata } from '../lib/async-params.js';
|
|
1
2
|
import { resolveHooks } from '../lib/hooks-resolve.js';
|
|
2
3
|
import { ModelResult } from '../lib/model-result.js';
|
|
3
|
-
import {
|
|
4
|
+
import { buildTaskToolApiDefinition, needsTaskTool } from '../lib/tool-check.js';
|
|
5
|
+
import { convertToolsToAPIFormat, convertZodToJsonSchema } from '../lib/tool-executor.js';
|
|
6
|
+
import { isServerTool } from '../lib/tool-types.js';
|
|
4
7
|
/**
|
|
5
8
|
* Get a response with multiple consumption patterns
|
|
6
9
|
*
|
|
@@ -71,15 +74,40 @@ import { convertToolsToAPIFormat } from '../lib/tool-executor.js';
|
|
|
71
74
|
*/
|
|
72
75
|
export function callModel(client, request, options) {
|
|
73
76
|
// Destructure state management options along with tools and stopWhen
|
|
74
|
-
const { tools, stopWhen, state, requireApproval, approveToolCalls, rejectToolCalls, context, sharedContextSchema, onTurnStart, onTurnEnd, allowFinalResponse, strictFinalResponse, hooks, ...apiRequest } = request;
|
|
77
|
+
const { tools, activeTools, stopWhen, state, requireApproval, approveToolCalls, rejectToolCalls, context, sharedContextSchema, onTurnStart, onTurnEnd, allowFinalResponse, strictFinalResponse, hooks, doomLoop, signal, toolTimeoutMs, toolConcurrency, asyncTools, ...apiRequest } = request;
|
|
78
|
+
// Narrow tools to the active subset (if provided) before API conversion and
|
|
79
|
+
// before they are registered for execution, so the model cannot call filtered
|
|
80
|
+
// tools and the executor does not carry orphaned definitions.
|
|
81
|
+
const activeSet = activeTools ? new Set(activeTools) : undefined;
|
|
82
|
+
const activeFilteredTools = activeSet
|
|
83
|
+
? tools?.filter((t) => isServerTool(t) || activeSet.has(t.function.name))
|
|
84
|
+
: tools;
|
|
85
|
+
// Collapse a filtered-to-empty (or explicitly empty) tools list to
|
|
86
|
+
// `undefined` so a fully-deactivated tool set (a first-class output of
|
|
87
|
+
// `inferTools()`/`.resolve()`) omits the outbound `tools` key entirely
|
|
88
|
+
// instead of sending `tools: []` — several providers reject an empty
|
|
89
|
+
// array outright. `ModelResult` treats `undefined` as its no-tools state
|
|
90
|
+
// (see the `?.length` / truthiness checks throughout), so this also keeps
|
|
91
|
+
// the engine's tool-execution machinery correctly disabled.
|
|
92
|
+
const filteredTools = activeFilteredTools?.length ? activeFilteredTools : undefined;
|
|
75
93
|
// Convert tools to API format - no cast needed now that convertToolsToAPIFormat accepts readonly
|
|
76
|
-
const apiTools =
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
94
|
+
const apiTools = filteredTools ? convertToolsToAPIFormat(filteredTools) : undefined;
|
|
95
|
+
// Append the single universal `task` tool when any long-running tool is
|
|
96
|
+
// registered (and check-ins aren't disabled): ONE static wire definition
|
|
97
|
+
// for check/steer/result/cancel across every async tool — per-tool
|
|
98
|
+
// context cost stays constant regardless of the tool count. Appended
|
|
99
|
+
// here (not per-request in ModelResult) so `resolvedRequest.tools` stays
|
|
100
|
+
// stable across turns. Calls to it are engine-intercepted.
|
|
101
|
+
if (apiTools && filteredTools && asyncTools?.checkins !== false && needsTaskTool(filteredTools)) {
|
|
102
|
+
apiTools.push(buildTaskToolApiDefinition(convertZodToJsonSchema));
|
|
103
|
+
}
|
|
104
|
+
// Build the request with converted tools. Tool-set snapshots carry a symbol
|
|
105
|
+
// marker that survives object spread, allowing their metadata to be removed
|
|
106
|
+
// without reserving otherwise legitimate API field names.
|
|
80
107
|
const finalRequest = {
|
|
81
108
|
...apiRequest,
|
|
82
109
|
};
|
|
110
|
+
stripToolSetSnapshotMetadata(finalRequest);
|
|
83
111
|
if (apiTools !== undefined) {
|
|
84
112
|
finalRequest['tools'] = apiTools;
|
|
85
113
|
}
|
|
@@ -91,48 +119,37 @@ export function callModel(client, request, options) {
|
|
|
91
119
|
'x-openrouter-callmodel': 'true',
|
|
92
120
|
},
|
|
93
121
|
};
|
|
94
|
-
|
|
122
|
+
// Assemble engine options, then drop undefined entries so optional keys
|
|
123
|
+
// are ABSENT (not present-as-undefined) — same semantics as the previous
|
|
124
|
+
// per-key conditional spreads without a branch per option.
|
|
125
|
+
const engineOptions = {
|
|
95
126
|
client,
|
|
96
127
|
request: finalRequest,
|
|
97
128
|
options: callModelOptions,
|
|
98
|
-
tools,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}),
|
|
124
|
-
...(onTurnEnd !== undefined && {
|
|
125
|
-
onTurnEnd,
|
|
126
|
-
}),
|
|
127
|
-
...(allowFinalResponse !== undefined && {
|
|
128
|
-
allowFinalResponse,
|
|
129
|
-
}),
|
|
130
|
-
...(strictFinalResponse !== undefined && {
|
|
131
|
-
strictFinalResponse,
|
|
132
|
-
}),
|
|
133
|
-
...(hooks !== undefined && {
|
|
134
|
-
hooks: resolveHooks(hooks),
|
|
135
|
-
}),
|
|
136
|
-
});
|
|
129
|
+
tools: filteredTools,
|
|
130
|
+
stopWhen,
|
|
131
|
+
state,
|
|
132
|
+
requireApproval,
|
|
133
|
+
approveToolCalls,
|
|
134
|
+
rejectToolCalls,
|
|
135
|
+
context,
|
|
136
|
+
sharedContextSchema,
|
|
137
|
+
onTurnStart,
|
|
138
|
+
onTurnEnd,
|
|
139
|
+
allowFinalResponse,
|
|
140
|
+
strictFinalResponse,
|
|
141
|
+
hooks: hooks !== undefined ? resolveHooks(hooks) : undefined,
|
|
142
|
+
doomLoop,
|
|
143
|
+
signal,
|
|
144
|
+
toolTimeoutMs,
|
|
145
|
+
toolConcurrency,
|
|
146
|
+
asyncTools,
|
|
147
|
+
};
|
|
148
|
+
for (const key of Object.keys(engineOptions)) {
|
|
149
|
+
if (engineOptions[key] === undefined) {
|
|
150
|
+
delete engineOptions[key];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return new ModelResult(engineOptions);
|
|
137
154
|
}
|
|
138
155
|
//# sourceMappingURL=call-model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-model.js","sourceRoot":"","sources":["../../src/inner-loop/call-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"call-model.js","sourceRoot":"","sources":["../../src/inner-loop/call-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAE1F,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,MAAM,UAAU,SAAS,CAOvB,MAAsB,EACtB,OAEC,EACD,OAAwB;IAExB,qEAAqE;IACrE,MAAM,EACJ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AC;AACJ,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { OpenRouterCore } from '@openrouter/sdk/core';
|
|
2
|
+
import type { RequestOptions } from '@openrouter/sdk/lib/sdks';
|
|
3
|
+
import type * as models from '@openrouter/sdk/models';
|
|
4
|
+
import type { CallModelInput } from '../lib/async-params.js';
|
|
5
|
+
import type { ModelResult } from '../lib/model-result.js';
|
|
6
|
+
import type { StateAccessor, Tool } from '../lib/tool-types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Thrown by {@link resumeToolResults} (and the deferred tool `.resolve()` /
|
|
9
|
+
* `.fail()` / `.cancel()` methods) when the target task was already settled —
|
|
10
|
+
* the at-most-once guard against double resolution and replayed webhooks.
|
|
11
|
+
* Opt out per call with `ifSettled: 'ignore'`.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ToolTaskAlreadySettledError extends Error {
|
|
14
|
+
readonly taskId: string;
|
|
15
|
+
readonly callId: string;
|
|
16
|
+
constructor(taskId: string, callId: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One task resolution: identified by `taskId` (typical — it's what the
|
|
20
|
+
* external system knows) or `callId`, carrying either a successful `output`
|
|
21
|
+
* or an `error`. `status` refines error deliveries (default `'failed'`).
|
|
22
|
+
*/
|
|
23
|
+
export type ResumeToolResultEntry = ({
|
|
24
|
+
taskId: string;
|
|
25
|
+
callId?: never;
|
|
26
|
+
} | {
|
|
27
|
+
callId: string;
|
|
28
|
+
taskId?: never;
|
|
29
|
+
}) & ({
|
|
30
|
+
output: unknown;
|
|
31
|
+
error?: never;
|
|
32
|
+
} | {
|
|
33
|
+
error: string;
|
|
34
|
+
output?: never;
|
|
35
|
+
status?: 'failed' | 'cancelled' | 'expired';
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Run configuration for continuing the conversation immediately after
|
|
39
|
+
* recording the results. Any `CallModelInput` field except `state` / `input`
|
|
40
|
+
* (the SDK supplies both — the resumed history already carries everything).
|
|
41
|
+
*/
|
|
42
|
+
export type ResumeRunConfig<TTools extends readonly Tool[]> = Omit<CallModelInput<TTools>, 'state' | 'input' | 'approveToolCalls' | 'rejectToolCalls'>;
|
|
43
|
+
/**
|
|
44
|
+
* The `tool_task_result` envelope injected as a user-role message when an
|
|
45
|
+
* async tool's result arrives. Never a second `function_call_output` — the
|
|
46
|
+
* pending placeholder already paired the original `function_call` in
|
|
47
|
+
* history, and providers reject duplicate outputs for one callId.
|
|
48
|
+
*/
|
|
49
|
+
export interface ToolTaskResultEnvelope {
|
|
50
|
+
type: 'tool_task_result';
|
|
51
|
+
tool: string;
|
|
52
|
+
taskId: string;
|
|
53
|
+
callId: string;
|
|
54
|
+
status: 'completed' | 'failed' | 'cancelled' | 'timed_out' | 'expired';
|
|
55
|
+
result?: unknown;
|
|
56
|
+
error?: string;
|
|
57
|
+
}
|
|
58
|
+
/** Build the user-role message carrying a task-result envelope. */
|
|
59
|
+
export declare function buildTaskResultMessage(envelope: ToolTaskResultEnvelope): models.BaseInputsUnion;
|
|
60
|
+
/**
|
|
61
|
+
* Deliver results for pending async tool tasks (started by `tool.deferred`,
|
|
62
|
+
* or background tasks orphaned across a run boundary) into a persisted
|
|
63
|
+
* conversation — typically from a different process than the one that
|
|
64
|
+
* started them (a webhook handler, a queue worker).
|
|
65
|
+
*
|
|
66
|
+
* This is the low-level, untyped entry point; prefer the typed `.resolve()`
|
|
67
|
+
* / `.fail()` / `.cancel()` methods on the deferred tool itself, which
|
|
68
|
+
* check `output` against the tool's `outputSchema` at compile time.
|
|
69
|
+
*
|
|
70
|
+
* Behavior:
|
|
71
|
+
* 1. Loads the conversation via `state`, resolves each entry to a pending
|
|
72
|
+
* task (by `taskId` or `callId`).
|
|
73
|
+
* 2. Enforces at-most-once settlement: an already-settled task throws
|
|
74
|
+
* {@link ToolTaskAlreadySettledError} (or is skipped with
|
|
75
|
+
* `ifSettled: 'ignore'`).
|
|
76
|
+
* 3. Validates each `output` against the named tool's `outputSchema` when
|
|
77
|
+
* the tool is present in `tools` — an invalid payload throws before
|
|
78
|
+
* anything is persisted or dispatched.
|
|
79
|
+
* 4. Appends a `tool_task_result` envelope (user-role message) per entry,
|
|
80
|
+
* marks the tasks settled, and persists the state. The conversation
|
|
81
|
+
* status becomes `'in_progress'` (or stays `'awaiting_async_tools'` when
|
|
82
|
+
* other tasks are still pending).
|
|
83
|
+
* 5. With `run` config: continues the conversation immediately and returns
|
|
84
|
+
* the `ModelResult`. Without: returns `null` — the recorded results ride
|
|
85
|
+
* along on the next `callModel({ state })`. When every entry was skipped
|
|
86
|
+
* under `ifSettled: 'ignore'` there is nothing new to deliver, so the
|
|
87
|
+
* function returns `null` WITHOUT running — a replayed webhook never
|
|
88
|
+
* triggers a duplicate continuation.
|
|
89
|
+
*
|
|
90
|
+
* SECURITY: this call injects a value the model will treat as a tool
|
|
91
|
+
* result. Authenticate the webhook/caller BEFORE invoking it — the SDK
|
|
92
|
+
* cannot do that for you. And PASS `tools`: without it the output is
|
|
93
|
+
* appended UNVALIDATED (no outputSchema to check against) — prefer the
|
|
94
|
+
* typed `.resolve()` methods, which always carry the tool's schema.
|
|
95
|
+
*
|
|
96
|
+
* CONCURRENCY: this is a read-modify-write over the StateAccessor. Two
|
|
97
|
+
* concurrent calls for the SAME conversation (e.g. two webhooks resolving
|
|
98
|
+
* two different tasks) can interleave load/save and the later save wins,
|
|
99
|
+
* silently dropping the earlier envelope. Serialize calls per conversation
|
|
100
|
+
* — a per-conversation lock or queue in your StateAccessor, or batch
|
|
101
|
+
* concurrent completions into one call via `results: [...]` (which settles
|
|
102
|
+
* any number of tasks atomically).
|
|
103
|
+
*
|
|
104
|
+
* HOOKS: PostToolUse / PostToolUseFailure do NOT fire here — hooks are
|
|
105
|
+
* run-scoped (a HooksManager passed to `callModel`), and this entry point
|
|
106
|
+
* runs outside any run, typically in another process. Deployments that
|
|
107
|
+
* audit tool outputs via hooks should scan webhook payloads in the webhook
|
|
108
|
+
* handler itself. In-process settlements (background tasks) DO fire these
|
|
109
|
+
* hooks at delivery.
|
|
110
|
+
*/
|
|
111
|
+
export declare function resumeToolResults<TTools extends readonly Tool[]>(client: OpenRouterCore, request: {
|
|
112
|
+
state: StateAccessor<TTools>;
|
|
113
|
+
/** Tools list — used to validate outputs against each tool's outputSchema. */
|
|
114
|
+
tools?: TTools;
|
|
115
|
+
results: ReadonlyArray<ResumeToolResultEntry>;
|
|
116
|
+
/** Behavior when a task is already settled. Default 'throw'. */
|
|
117
|
+
ifSettled?: 'throw' | 'ignore';
|
|
118
|
+
/** Continue the conversation immediately with this run configuration. */
|
|
119
|
+
run?: ResumeRunConfig<TTools>;
|
|
120
|
+
/**
|
|
121
|
+
* Ownership guard: every resolved task must belong to this tool (by
|
|
122
|
+
* name) or the call throws BEFORE anything is persisted. Set by the
|
|
123
|
+
* typed `.resolve()`/`.fail()`/`.cancel()` methods — a taskId from a
|
|
124
|
+
* webhook cannot settle a different tool's task through them.
|
|
125
|
+
*/
|
|
126
|
+
expectToolName?: string;
|
|
127
|
+
}, options?: RequestOptions): Promise<ModelResult<TTools> | null>;
|
|
128
|
+
//# sourceMappingURL=resume-tool-results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-tool-results.d.ts","sourceRoot":"","sources":["../../src/inner-loop/resume-tool-results.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,EAAoB,aAAa,EAAE,IAAI,EAAkB,MAAM,sBAAsB,CAAC;AAIlG;;;;;GAKG;AACH,qBAAa,2BAA4B,SAAQ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