@openrouter/sdk 1.5.56 → 1.5.57
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/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/additionaltoolsitem.d.ts +5 -4
- package/esm/models/additionaltoolsitem.js +3 -0
- package/esm/models/alignmentresponsesrejected.d.ts +4 -1
- package/esm/models/alignmentresponsesrejected.js +6 -0
- package/esm/models/byokproviderslug.d.ts +1 -0
- package/esm/models/byokproviderslug.js +1 -0
- package/esm/models/createworkspacerequest.d.ts +1 -0
- package/esm/models/createworkspacerequest.js +1 -0
- package/esm/models/decisionschoicequestion.d.ts +4 -4
- package/esm/models/decisionschoicequestion.js +1 -5
- package/esm/models/decisionsnoulquestion.d.ts +12 -12
- package/esm/models/decisionsnoulquestion.js +3 -7
- package/esm/models/decisionsscorequestion.d.ts +4 -4
- package/esm/models/decisionsscorequestion.js +1 -5
- package/esm/models/imagegenerationproviderpreferences.d.ts +6 -0
- package/esm/models/imagegenerationproviderpreferences.js +1 -0
- package/esm/models/imagegenerationrequest.d.ts +1 -1
- package/esm/models/index.d.ts +6 -0
- package/esm/models/index.js +6 -0
- package/esm/models/mcpapprovalrequestitem.d.ts +7 -0
- package/esm/models/mcpapprovalrequestitem.js +19 -1
- package/esm/models/mcpcallitem.d.ts +17 -1
- package/esm/models/mcpcallitem.js +18 -0
- package/esm/models/mcpservertool.d.ts +78 -69
- package/esm/models/mcpservertool.js +135 -105
- package/esm/models/mcpservertoolopenrouter.d.ts +28 -0
- package/esm/models/mcpservertoolopenrouter.js +20 -0
- package/esm/models/mcpservertoolparameters.d.ts +152 -0
- package/esm/models/mcpservertoolparameters.js +134 -0
- package/esm/models/openairesponsestoolchoiceunion.d.ts +3 -2
- package/esm/models/openairesponsestoolchoiceunion.js +3 -0
- package/esm/models/operations/listbyokkeys.d.ts +1 -0
- package/esm/models/operations/listbyokkeys.js +1 -0
- package/esm/models/outputitemmcpapprovalrequest.d.ts +14 -0
- package/esm/models/outputitemmcpapprovalrequest.js +23 -0
- package/esm/models/outputitemmcpcall.d.ts +74 -0
- package/esm/models/outputitemmcpcall.js +94 -0
- package/esm/models/outputitemmcplisttools.d.ts +25 -0
- package/esm/models/outputitemmcplisttools.js +37 -0
- package/esm/models/outputitems.d.ts +3 -0
- package/esm/models/outputitems.js +2 -0
- package/esm/models/providername.d.ts +1 -0
- package/esm/models/providername.js +1 -0
- package/esm/models/provideroptions.d.ts +6 -0
- package/esm/models/provideroptions.js +1 -0
- package/esm/models/providerresponse.d.ts +1 -0
- package/esm/models/providerresponse.js +1 -0
- package/esm/models/responsesrequest.d.ts +9 -0
- package/esm/models/responsesrequest.js +3 -0
- package/esm/models/toolchoicemcp.d.ts +33 -0
- package/esm/models/toolchoicemcp.js +42 -0
- package/esm/models/toolsearchoutputitem.d.ts +5 -4
- package/esm/models/toolsearchoutputitem.js +3 -0
- package/esm/models/updateworkspacerequest.d.ts +1 -0
- package/esm/models/updateworkspacerequest.js +1 -0
- package/esm/models/videogenerationrequest.d.ts +6 -0
- package/esm/models/videogenerationrequest.js +1 -0
- package/esm/sdk/sdk.d.ts +0 -9
- package/esm/sdk/sdk.js +1 -7
- package/jsr.json +1 -1
- package/package.json +7 -7
- package/esm/funcs/call-model.d.ts +0 -67
- package/esm/funcs/call-model.js +0 -98
- package/esm/lib/anthropic-compat.d.ts +0 -51
- package/esm/lib/anthropic-compat.js +0 -222
- package/esm/lib/async-params.d.ts +0 -107
- package/esm/lib/async-params.js +0 -88
- package/esm/lib/chat-compat.d.ts +0 -47
- package/esm/lib/chat-compat.js +0 -111
- package/esm/lib/claude-constants.d.ts +0 -22
- package/esm/lib/claude-constants.js +0 -20
- package/esm/lib/claude-type-guards.d.ts +0 -10
- package/esm/lib/claude-type-guards.js +0 -70
- package/esm/lib/conversation-state.d.ts +0 -63
- package/esm/lib/conversation-state.js +0 -210
- package/esm/lib/model-result.d.ts +0 -373
- package/esm/lib/model-result.js +0 -1414
- package/esm/lib/next-turn-params.d.ts +0 -30
- package/esm/lib/next-turn-params.js +0 -135
- package/esm/lib/reusable-stream.d.ts +0 -39
- package/esm/lib/reusable-stream.js +0 -192
- package/esm/lib/stop-conditions.d.ts +0 -80
- package/esm/lib/stop-conditions.js +0 -104
- package/esm/lib/stream-transformers.d.ts +0 -118
- package/esm/lib/stream-transformers.js +0 -852
- package/esm/lib/stream-type-guards.d.ts +0 -49
- package/esm/lib/stream-type-guards.js +0 -85
- package/esm/lib/tool-context.d.ts +0 -68
- package/esm/lib/tool-context.js +0 -175
- package/esm/lib/tool-event-broadcaster.d.ts +0 -44
- package/esm/lib/tool-event-broadcaster.js +0 -146
- package/esm/lib/tool-executor.d.ts +0 -74
- package/esm/lib/tool-executor.js +0 -267
- package/esm/lib/tool-orchestrator.d.ts +0 -52
- package/esm/lib/tool-orchestrator.js +0 -180
- package/esm/lib/tool-types.d.ts +0 -573
- package/esm/lib/tool-types.js +0 -80
- package/esm/lib/tool.d.ts +0 -108
- package/esm/lib/tool.js +0 -74
- package/esm/lib/turn-context.d.ts +0 -52
- package/esm/lib/turn-context.js +0 -59
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import type { OpenRouterCore } from '../core.js';
|
|
2
|
-
import type { FunctionCallOutputItem } from '../models/functioncalloutputitem.js';
|
|
3
|
-
import type { OpenResponsesResult } from '../models/openresponsesresult.js';
|
|
4
|
-
import type { OutputFunctionCallItem } from '../models/outputfunctioncallitem.js';
|
|
5
|
-
import type { OutputMessage } from '../models/outputmessage.js';
|
|
6
|
-
import type { CallModelInput } from './async-params.js';
|
|
7
|
-
import type { RequestOptions } from './sdks.js';
|
|
8
|
-
import type { $ZodObject, $ZodShape } from 'zod/v4/core';
|
|
9
|
-
import type { ConversationState, ToolContextMapWithShared, ResponseStreamEvent, InferToolEventsUnion, InferToolOutputsUnion, ParsedToolCall, StateAccessor, StopWhen, Tool, ToolStreamEvent, TurnContext } from './tool-types.js';
|
|
10
|
-
import { type ContextInput } from './tool-context.js';
|
|
11
|
-
import { type StreamableOutputItem } from './stream-transformers.js';
|
|
12
|
-
export interface GetResponseOptions<TTools extends readonly Tool[], TShared extends Record<string, unknown> = Record<string, never>> {
|
|
13
|
-
request: CallModelInput<TTools, TShared>;
|
|
14
|
-
client: OpenRouterCore;
|
|
15
|
-
options?: RequestOptions;
|
|
16
|
-
tools?: TTools;
|
|
17
|
-
stopWhen?: StopWhen<TTools>;
|
|
18
|
-
state?: StateAccessor<TTools>;
|
|
19
|
-
/** Typed context data passed to tools via contextSchema. `shared` key for shared context. */
|
|
20
|
-
context?: ContextInput<ToolContextMapWithShared<TTools, TShared>>;
|
|
21
|
-
/** Zod schema for shared context validation */
|
|
22
|
-
sharedContextSchema?: $ZodObject<$ZodShape>;
|
|
23
|
-
/**
|
|
24
|
-
* Call-level approval check - overrides tool-level requireApproval setting
|
|
25
|
-
* Receives the tool call and turn context, can be sync or async
|
|
26
|
-
*/
|
|
27
|
-
requireApproval?: (toolCall: ParsedToolCall<TTools[number]>, context: TurnContext) => boolean | Promise<boolean>;
|
|
28
|
-
approveToolCalls?: string[];
|
|
29
|
-
rejectToolCalls?: string[];
|
|
30
|
-
/** Callback invoked at the start of each tool execution turn */
|
|
31
|
-
onTurnStart?: (context: TurnContext) => void | Promise<void>;
|
|
32
|
-
/** Callback invoked at the end of each tool execution turn */
|
|
33
|
-
onTurnEnd?: (context: TurnContext, response: OpenResponsesResult) => void | Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* A wrapper around a streaming response that provides multiple consumption patterns.
|
|
37
|
-
*
|
|
38
|
-
* Allows consuming the response in multiple ways:
|
|
39
|
-
* - `await result.getText()` - Get just the text
|
|
40
|
-
* - `await result.getResponse()` - Get the full response object
|
|
41
|
-
* - `for await (const delta of result.getTextStream())` - Stream text deltas
|
|
42
|
-
* - `for await (const msg of result.getNewMessagesStream())` - Stream cumulative message snapshots
|
|
43
|
-
* - `for await (const event of result.getFullResponsesStream())` - Stream all response events
|
|
44
|
-
*
|
|
45
|
-
* For message format conversion, use the helper functions:
|
|
46
|
-
* - `toChatMessage(response)` for OpenAI chat format
|
|
47
|
-
* - `toClaudeMessage(response)` for Anthropic Claude format
|
|
48
|
-
*
|
|
49
|
-
* All consumption patterns can be used concurrently thanks to the underlying
|
|
50
|
-
* ReusableReadableStream implementation.
|
|
51
|
-
*
|
|
52
|
-
* @template TTools - The tools array type to enable typed tool calls and results
|
|
53
|
-
* @template TShared - The shape of the shared context (inferred from sharedContextSchema)
|
|
54
|
-
*/
|
|
55
|
-
export declare class ModelResult<TTools extends readonly Tool[], TShared extends Record<string, unknown> = Record<string, never>> {
|
|
56
|
-
private reusableStream;
|
|
57
|
-
private textPromise;
|
|
58
|
-
private options;
|
|
59
|
-
private initPromise;
|
|
60
|
-
private toolExecutionPromise;
|
|
61
|
-
private finalResponse;
|
|
62
|
-
private toolEventBroadcaster;
|
|
63
|
-
private allToolExecutionRounds;
|
|
64
|
-
private resolvedRequest;
|
|
65
|
-
private stateAccessor;
|
|
66
|
-
private currentState;
|
|
67
|
-
private requireApprovalFn;
|
|
68
|
-
private approvedToolCalls;
|
|
69
|
-
private rejectedToolCalls;
|
|
70
|
-
private isResumingFromApproval;
|
|
71
|
-
private turnBroadcaster;
|
|
72
|
-
private initialStreamPipeStarted;
|
|
73
|
-
private initialPipePromise;
|
|
74
|
-
private contextStore;
|
|
75
|
-
constructor(options: GetResponseOptions<TTools, TShared>);
|
|
76
|
-
/**
|
|
77
|
-
* Get or create the unified turn broadcaster (lazy initialization).
|
|
78
|
-
* Broadcasts all API stream events, tool events, and turn delimiters across turns.
|
|
79
|
-
*/
|
|
80
|
-
private ensureTurnBroadcaster;
|
|
81
|
-
/**
|
|
82
|
-
* Start piping the initial stream into the turn broadcaster.
|
|
83
|
-
* Idempotent — only starts once even if called multiple times.
|
|
84
|
-
* Wraps the initial stream events with turn.start(0) / turn.end(0) delimiters.
|
|
85
|
-
*/
|
|
86
|
-
private startInitialStreamPipe;
|
|
87
|
-
/**
|
|
88
|
-
* Pipe a follow-up stream into the turn broadcaster and capture the completed response.
|
|
89
|
-
* Emits turn.start / turn.end delimiters around the stream events.
|
|
90
|
-
*/
|
|
91
|
-
private pipeAndConsumeStream;
|
|
92
|
-
/**
|
|
93
|
-
* Push a tool result event to both the legacy tool event broadcaster
|
|
94
|
-
* and the unified turn broadcaster.
|
|
95
|
-
*/
|
|
96
|
-
private broadcastToolResult;
|
|
97
|
-
/**
|
|
98
|
-
* Push a preliminary result event to both the legacy tool event broadcaster
|
|
99
|
-
* and the unified turn broadcaster.
|
|
100
|
-
*/
|
|
101
|
-
private broadcastPreliminaryResult;
|
|
102
|
-
/**
|
|
103
|
-
* Set up the turn broadcaster with tool execution and return the consumer.
|
|
104
|
-
* Used by stream methods that need to iterate over all turns.
|
|
105
|
-
*/
|
|
106
|
-
private startTurnBroadcasterExecution;
|
|
107
|
-
/**
|
|
108
|
-
* Type guard to check if a value is a non-streaming response
|
|
109
|
-
* Only requires 'output' field and absence of 'toReadableStream' method
|
|
110
|
-
*/
|
|
111
|
-
private isNonStreamingResponse;
|
|
112
|
-
/**
|
|
113
|
-
* Get initial response from stream or cached final response.
|
|
114
|
-
* Consumes the stream to completion if needed to extract the response.
|
|
115
|
-
*
|
|
116
|
-
* @returns The complete non-streaming response
|
|
117
|
-
* @throws Error if neither stream nor response has been initialized
|
|
118
|
-
*/
|
|
119
|
-
private getInitialResponse;
|
|
120
|
-
/**
|
|
121
|
-
* Save response output to state.
|
|
122
|
-
* Appends the response output to the message history and records the response ID.
|
|
123
|
-
*
|
|
124
|
-
* @param response - The API response to save
|
|
125
|
-
*/
|
|
126
|
-
private saveResponseToState;
|
|
127
|
-
/**
|
|
128
|
-
* Mark state as complete.
|
|
129
|
-
* Sets the conversation status to 'complete' indicating no further tool execution is needed.
|
|
130
|
-
*/
|
|
131
|
-
private markStateComplete;
|
|
132
|
-
/**
|
|
133
|
-
* Save tool results to state.
|
|
134
|
-
* Appends tool execution results to the message history for multi-turn context.
|
|
135
|
-
*
|
|
136
|
-
* @param toolResults - The tool execution results to save
|
|
137
|
-
*/
|
|
138
|
-
private saveToolResultsToState;
|
|
139
|
-
/**
|
|
140
|
-
* Check if execution should be interrupted by external signal.
|
|
141
|
-
* Polls the state accessor for interruption flags set by external processes.
|
|
142
|
-
*
|
|
143
|
-
* @param currentResponse - The current response to save as partial state
|
|
144
|
-
* @returns True if interrupted and caller should exit, false to continue
|
|
145
|
-
*/
|
|
146
|
-
private checkForInterruption;
|
|
147
|
-
/**
|
|
148
|
-
* Check if stop conditions are met.
|
|
149
|
-
* Returns true if execution should stop.
|
|
150
|
-
*
|
|
151
|
-
* @remarks
|
|
152
|
-
* Default: stepCountIs(DEFAULT_MAX_STEPS) if no stopWhen is specified.
|
|
153
|
-
* This evaluates stop conditions against the complete step history.
|
|
154
|
-
*/
|
|
155
|
-
private shouldStopExecution;
|
|
156
|
-
/**
|
|
157
|
-
* Check if any tool calls have execute functions.
|
|
158
|
-
* Used to determine if automatic tool execution should be attempted.
|
|
159
|
-
*
|
|
160
|
-
* @param toolCalls - The tool calls to check
|
|
161
|
-
* @returns True if at least one tool call has an executable function
|
|
162
|
-
*/
|
|
163
|
-
private hasExecutableToolCalls;
|
|
164
|
-
/**
|
|
165
|
-
* Execute tools that can auto-execute (don't require approval) in parallel.
|
|
166
|
-
*
|
|
167
|
-
* @param toolCalls - The tool calls to execute
|
|
168
|
-
* @param turnContext - The current turn context
|
|
169
|
-
* @returns Array of unsent tool results for later submission
|
|
170
|
-
*/
|
|
171
|
-
private executeAutoApproveTools;
|
|
172
|
-
/**
|
|
173
|
-
* Check for tools requiring approval and handle accordingly.
|
|
174
|
-
* Partitions tool calls into those needing approval and those that can auto-execute.
|
|
175
|
-
*
|
|
176
|
-
* @param toolCalls - The tool calls to check
|
|
177
|
-
* @param currentRound - The current execution round (1-indexed)
|
|
178
|
-
* @param currentResponse - The current response to save if pausing
|
|
179
|
-
* @returns True if execution should pause for approval, false to continue
|
|
180
|
-
* @throws Error if approval is required but no state accessor is configured
|
|
181
|
-
*/
|
|
182
|
-
private handleApprovalCheck;
|
|
183
|
-
/**
|
|
184
|
-
* Execute all tools in a single round in parallel.
|
|
185
|
-
* Emits tool.result events after tool execution completes.
|
|
186
|
-
*
|
|
187
|
-
* @param toolCalls - The tool calls to execute
|
|
188
|
-
* @param turnContext - The current turn context
|
|
189
|
-
* @returns Array of function call outputs formatted for the API
|
|
190
|
-
*/
|
|
191
|
-
private executeToolRound;
|
|
192
|
-
/**
|
|
193
|
-
* Resolve async functions for the current turn.
|
|
194
|
-
* Updates the resolved request with turn-specific parameter values.
|
|
195
|
-
*
|
|
196
|
-
* @param turnContext - The turn context for parameter resolution
|
|
197
|
-
*/
|
|
198
|
-
private resolveAsyncFunctionsForTurn;
|
|
199
|
-
/**
|
|
200
|
-
* Apply nextTurnParams from executed tools.
|
|
201
|
-
* Allows tools to modify request parameters for subsequent turns.
|
|
202
|
-
*
|
|
203
|
-
* @param toolCalls - The tool calls that were just executed
|
|
204
|
-
*/
|
|
205
|
-
private applyNextTurnParams;
|
|
206
|
-
/**
|
|
207
|
-
* Make a follow-up API request with tool results.
|
|
208
|
-
* Uses streaming and pipes events through the turn broadcaster when available.
|
|
209
|
-
*/
|
|
210
|
-
private makeFollowupRequest;
|
|
211
|
-
/**
|
|
212
|
-
* Validate the final response has required fields.
|
|
213
|
-
*
|
|
214
|
-
* @param response - The response to validate
|
|
215
|
-
* @throws Error if response is missing required fields or has invalid output
|
|
216
|
-
*/
|
|
217
|
-
private validateFinalResponse;
|
|
218
|
-
/**
|
|
219
|
-
* Resolve async functions in the request for a given turn context.
|
|
220
|
-
* Extracts non-function fields and resolves any async parameter functions.
|
|
221
|
-
*
|
|
222
|
-
* @param context - The turn context for parameter resolution
|
|
223
|
-
* @returns The resolved request without async functions
|
|
224
|
-
*/
|
|
225
|
-
private resolveRequestForContext;
|
|
226
|
-
/**
|
|
227
|
-
* Safely persist state with error handling.
|
|
228
|
-
* Wraps state save operations to ensure failures are properly reported.
|
|
229
|
-
*
|
|
230
|
-
* @param updates - Optional partial state updates to apply before saving
|
|
231
|
-
* @throws Error if state persistence fails
|
|
232
|
-
*/
|
|
233
|
-
private saveStateSafely;
|
|
234
|
-
/**
|
|
235
|
-
* Remove optional properties from state when they should be cleared.
|
|
236
|
-
* Uses delete to properly remove optional properties rather than setting undefined.
|
|
237
|
-
*
|
|
238
|
-
* @param props - Array of property names to remove from current state
|
|
239
|
-
*/
|
|
240
|
-
private clearOptionalStateProperties;
|
|
241
|
-
/**
|
|
242
|
-
* Initialize the stream if not already started
|
|
243
|
-
* This is idempotent - multiple calls will return the same promise
|
|
244
|
-
*/
|
|
245
|
-
private initStream;
|
|
246
|
-
/**
|
|
247
|
-
* Process approval/rejection decisions and resume execution
|
|
248
|
-
*/
|
|
249
|
-
private processApprovalDecisions;
|
|
250
|
-
/**
|
|
251
|
-
* Continue execution with unsent tool results
|
|
252
|
-
*/
|
|
253
|
-
private continueWithUnsentResults;
|
|
254
|
-
/**
|
|
255
|
-
* Execute tools automatically if they are provided and have execute functions
|
|
256
|
-
* This is idempotent - multiple calls will return the same promise
|
|
257
|
-
*/
|
|
258
|
-
private executeToolsIfNeeded;
|
|
259
|
-
/**
|
|
260
|
-
* Internal helper to get the text after tool execution
|
|
261
|
-
*/
|
|
262
|
-
private getTextInternal;
|
|
263
|
-
/**
|
|
264
|
-
* Get just the text content from the response.
|
|
265
|
-
* This will consume the stream until completion, execute any tools, and extract the text.
|
|
266
|
-
*/
|
|
267
|
-
getText(): Promise<string>;
|
|
268
|
-
/**
|
|
269
|
-
* Get the complete response object including usage information.
|
|
270
|
-
* This will consume the stream until completion and execute any tools.
|
|
271
|
-
* Returns the full OpenResponsesResult with usage data (inputTokens, outputTokens, cachedTokens, etc.)
|
|
272
|
-
*/
|
|
273
|
-
getResponse(): Promise<OpenResponsesResult>;
|
|
274
|
-
/**
|
|
275
|
-
* Stream all response events as they arrive across all turns.
|
|
276
|
-
* Multiple consumers can iterate over this stream concurrently.
|
|
277
|
-
* Includes API events, tool events, and turn.start/turn.end delimiters.
|
|
278
|
-
*/
|
|
279
|
-
getFullResponsesStream(): AsyncIterableIterator<ResponseStreamEvent<InferToolEventsUnion<TTools>, InferToolOutputsUnion<TTools>>>;
|
|
280
|
-
/**
|
|
281
|
-
* Stream only text deltas as they arrive from all turns.
|
|
282
|
-
* This filters the full event stream to only yield text content,
|
|
283
|
-
* including text from follow-up responses in multi-turn tool loops.
|
|
284
|
-
*/
|
|
285
|
-
getTextStream(): AsyncIterableIterator<string>;
|
|
286
|
-
/**
|
|
287
|
-
* Stream all output items cumulatively as they arrive.
|
|
288
|
-
* Items are emitted with the same ID but progressively updated content as streaming progresses.
|
|
289
|
-
* Also yields tool results (function_call_output) after tool execution completes.
|
|
290
|
-
*
|
|
291
|
-
* Item types include:
|
|
292
|
-
* - message: Assistant text responses (emitted cumulatively as text streams)
|
|
293
|
-
* - function_call: Tool calls (emitted cumulatively as arguments stream)
|
|
294
|
-
* - reasoning: Model reasoning (emitted cumulatively as thinking streams)
|
|
295
|
-
* - web_search_call: Web search operations
|
|
296
|
-
* - file_search_call: File search operations
|
|
297
|
-
* - image_generation_call: Image generation operations
|
|
298
|
-
* - function_call_output: Results from executed tools
|
|
299
|
-
*/
|
|
300
|
-
getItemsStream(): AsyncIterableIterator<StreamableOutputItem>;
|
|
301
|
-
/**
|
|
302
|
-
* @deprecated Use `getItemsStream()` instead. This method only streams messages,
|
|
303
|
-
* while `getItemsStream()` streams all output item types (messages, function_calls,
|
|
304
|
-
* reasoning, etc.) with cumulative updates.
|
|
305
|
-
*
|
|
306
|
-
* Stream cumulative message snapshots as content is added in responses format.
|
|
307
|
-
* Each iteration yields an updated version of the message with new content.
|
|
308
|
-
* Also yields function_call items and FunctionCallOutputItem after tool execution completes.
|
|
309
|
-
* Returns OutputMessage, OutputFunctionCallItem, or FunctionCallOutputItem
|
|
310
|
-
* compatible with OpenAI Responses API format.
|
|
311
|
-
*/
|
|
312
|
-
getNewMessagesStream(): AsyncIterableIterator<OutputMessage | FunctionCallOutputItem | OutputFunctionCallItem>;
|
|
313
|
-
/**
|
|
314
|
-
* Stream only reasoning deltas as they arrive from all turns.
|
|
315
|
-
* This filters the full event stream to only yield reasoning content,
|
|
316
|
-
* including reasoning from follow-up responses in multi-turn tool loops.
|
|
317
|
-
*/
|
|
318
|
-
getReasoningStream(): AsyncIterableIterator<string>;
|
|
319
|
-
/**
|
|
320
|
-
* Stream tool call argument deltas and preliminary results from all turns.
|
|
321
|
-
* Preliminary results are streamed in REAL-TIME as generator tools yield.
|
|
322
|
-
* - Tool call argument deltas as { type: "delta", content: string }
|
|
323
|
-
* - Preliminary results as { type: "preliminary_result", toolCallId, result }
|
|
324
|
-
*/
|
|
325
|
-
getToolStream(): AsyncIterableIterator<ToolStreamEvent<InferToolEventsUnion<TTools>>>;
|
|
326
|
-
/**
|
|
327
|
-
* Get all tool calls from the completed response (before auto-execution).
|
|
328
|
-
* Note: If tools have execute functions, they will be automatically executed
|
|
329
|
-
* and this will return the tool calls from the initial response.
|
|
330
|
-
* Returns structured tool calls with parsed arguments.
|
|
331
|
-
*/
|
|
332
|
-
getToolCalls(): Promise<ParsedToolCall<TTools[number]>[]>;
|
|
333
|
-
/**
|
|
334
|
-
* Stream structured tool call objects as they're completed.
|
|
335
|
-
* Each iteration yields a complete tool call with parsed arguments.
|
|
336
|
-
*/
|
|
337
|
-
getToolCallsStream(): AsyncIterableIterator<ParsedToolCall<TTools[number]>>;
|
|
338
|
-
/**
|
|
339
|
-
* Returns an async iterable that emits a full context snapshot every time
|
|
340
|
-
* any tool calls ctx.update(). Can be consumed concurrently with getText(),
|
|
341
|
-
* getToolStream(), etc.
|
|
342
|
-
*
|
|
343
|
-
* @example
|
|
344
|
-
* ```typescript
|
|
345
|
-
* for await (const snapshot of result.getContextUpdates()) {
|
|
346
|
-
* console.log('Context changed:', snapshot);
|
|
347
|
-
* }
|
|
348
|
-
* ```
|
|
349
|
-
*/
|
|
350
|
-
getContextUpdates(): AsyncGenerator<ToolContextMapWithShared<TTools, TShared>>;
|
|
351
|
-
/**
|
|
352
|
-
* Cancel the underlying stream and all consumers
|
|
353
|
-
*/
|
|
354
|
-
cancel(): Promise<void>;
|
|
355
|
-
/**
|
|
356
|
-
* Check if the conversation requires human approval to continue.
|
|
357
|
-
* Returns true if there are pending tool calls awaiting approval.
|
|
358
|
-
*/
|
|
359
|
-
requiresApproval(): Promise<boolean>;
|
|
360
|
-
/**
|
|
361
|
-
* Get the pending tool calls that require approval.
|
|
362
|
-
* Returns empty array if no approvals needed.
|
|
363
|
-
*/
|
|
364
|
-
getPendingToolCalls(): Promise<ParsedToolCall<TTools[number]>[]>;
|
|
365
|
-
/**
|
|
366
|
-
* Get the current conversation state.
|
|
367
|
-
* Useful for inspection, debugging, or custom persistence.
|
|
368
|
-
* Note: This returns the raw ConversationState for inspection only.
|
|
369
|
-
* To resume a conversation, use the StateAccessor pattern.
|
|
370
|
-
*/
|
|
371
|
-
getState(): Promise<ConversationState<TTools>>;
|
|
372
|
-
}
|
|
373
|
-
//# sourceMappingURL=model-result.d.ts.map
|