@nuvin/agent-core 0.0.0-rc.1 → 0.0.0-rc.3
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/dist/VERSION +2 -2
- package/dist/agent/index.d.ts +525 -17
- package/dist/agent/index.js +1 -1
- package/dist/chunk-G2FR4UGO.js +1 -0
- package/dist/chunk-LXQDGX4K.js +1 -0
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-VFTQW5WK.js +1 -0
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/formats/index.d.ts +319 -23
- package/dist/formats/index.js +1 -1
- package/dist/models/index.d.ts +634 -332
- package/dist/models/index.js +1 -1
- package/dist/{provider-adapters-F0kn75gb.d.ts → provider-adapters-Cb5hUJoD.d.ts} +1 -1
- package/dist/shared/index.d.ts +709 -14
- package/dist/shared/index.js +1 -1
- package/dist/tools/index.d.ts +969 -421
- package/dist/tools/index.js +1 -1
- package/dist/{types-D11KxtW1.d.ts → types-QPBW5jHO.d.ts} +22 -3
- package/package.json +6 -4
- package/dist/chunk-C6OLKGP6.js +0 -1
- package/dist/chunk-U2BLX7Y5.js +0 -1
- package/dist/chunk-WVVWOCQ5.js +0 -1
package/dist/VERSION
CHANGED
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,20 +1,528 @@
|
|
|
1
|
-
|
|
2
|
-
export { d as TurnState } from '../types-D11KxtW1.js';
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly systemPrompt: string;
|
|
8
|
-
messages: Message[];
|
|
9
|
-
readonly defaultMessage?: Message;
|
|
10
|
-
turnIndex: number;
|
|
11
|
-
constructor(options?: AgentOptions);
|
|
12
|
-
setTools(tools?: AgentOptions["tools"]): void;
|
|
13
|
-
send(input?: AgentInput | undefined, options?: AgentSendOptions): Promise<TurnResult>;
|
|
3
|
+
export type JsonPrimitive = boolean | number | string | null;
|
|
4
|
+
export interface JsonObject {
|
|
5
|
+
[key: string]: JsonValue;
|
|
14
6
|
}
|
|
7
|
+
export type JsonValue = JsonObject | JsonPrimitive | JsonValue[];
|
|
8
|
+
export interface JsonSchemaString {
|
|
9
|
+
type: "string";
|
|
10
|
+
}
|
|
11
|
+
export interface JsonSchemaNumber {
|
|
12
|
+
type: "number";
|
|
13
|
+
}
|
|
14
|
+
export interface JsonSchemaBoolean {
|
|
15
|
+
type: "boolean";
|
|
16
|
+
}
|
|
17
|
+
export interface JsonSchemaArray<TItem extends JsonSchema = JsonSchema> {
|
|
18
|
+
type: "array";
|
|
19
|
+
items: TItem;
|
|
20
|
+
}
|
|
21
|
+
export interface JsonSchemaObject<TProperties extends Record<string, JsonSchema> = Record<string, JsonSchema>, TRequired extends readonly string[] | undefined = readonly string[] | undefined> {
|
|
22
|
+
type: "object";
|
|
23
|
+
properties: TProperties;
|
|
24
|
+
required?: TRequired;
|
|
25
|
+
}
|
|
26
|
+
export type JsonSchema = JsonSchemaArray | JsonSchemaBoolean | JsonSchemaNumber | JsonSchemaObject | JsonSchemaString;
|
|
27
|
+
export interface TextBlock {
|
|
28
|
+
type: "text";
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
export type ImageMediaType = "image/gif" | "image/jpeg" | "image/png" | "image/webp";
|
|
32
|
+
export interface ImageBlock {
|
|
33
|
+
type: "image";
|
|
34
|
+
source: {
|
|
35
|
+
type: "base64";
|
|
36
|
+
media_type: ImageMediaType;
|
|
37
|
+
data: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export type ToolResultContentBlock = ImageBlock | TextBlock;
|
|
41
|
+
export type ToolResultContent = string | ToolResultContentBlock[];
|
|
42
|
+
export interface AnthropicThinkingBlock {
|
|
43
|
+
type: "anthropic_thinking";
|
|
44
|
+
thinking: string;
|
|
45
|
+
signature: string;
|
|
46
|
+
}
|
|
47
|
+
export interface AnthropicRedactedThinkingBlock {
|
|
48
|
+
type: "anthropic_redacted_thinking";
|
|
49
|
+
data: string;
|
|
50
|
+
}
|
|
51
|
+
export interface OpenAiReasoningSummaryText {
|
|
52
|
+
type: "summary_text";
|
|
53
|
+
text: string;
|
|
54
|
+
}
|
|
55
|
+
export interface OpenAiReasoningBlock {
|
|
56
|
+
type: "openai_reasoning";
|
|
57
|
+
encryptedContent?: string;
|
|
58
|
+
id?: string;
|
|
59
|
+
summary: OpenAiReasoningSummaryText[];
|
|
60
|
+
text?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ToolUseBlock {
|
|
63
|
+
type: "tool_use";
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
input: JsonValue;
|
|
67
|
+
}
|
|
68
|
+
export interface ToolResultBlock {
|
|
69
|
+
type: "tool_result";
|
|
70
|
+
tool_use_id: string;
|
|
71
|
+
content: ToolResultContent;
|
|
72
|
+
is_error: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface AnthropicThinkingWireBlock {
|
|
75
|
+
type: "thinking";
|
|
76
|
+
thinking: string;
|
|
77
|
+
signature: string;
|
|
78
|
+
}
|
|
79
|
+
export interface AnthropicRedactedThinkingWireBlock {
|
|
80
|
+
type: "redacted_thinking";
|
|
81
|
+
data: string;
|
|
82
|
+
}
|
|
83
|
+
export type AnthropicAssistantContentBlock = AnthropicRedactedThinkingWireBlock | AnthropicThinkingWireBlock | TextBlock | ToolUseBlock;
|
|
84
|
+
export type ReasoningVisibility = "continuity-only" | "user-visible";
|
|
85
|
+
export type AutoReasoningEffort = "low" | "medium" | "high";
|
|
86
|
+
export interface AutoReasoningConfig {
|
|
87
|
+
effort: AutoReasoningEffort;
|
|
88
|
+
}
|
|
89
|
+
export type AnthropicThinkingDisplay = "omitted" | "summarized";
|
|
90
|
+
export type AnthropicThinkingEffort = "low" | "medium" | "high";
|
|
91
|
+
export interface AnthropicEnabledThinkingConfig {
|
|
92
|
+
type: "enabled";
|
|
93
|
+
budgetTokens: number;
|
|
94
|
+
display?: AnthropicThinkingDisplay;
|
|
95
|
+
interleaved?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface AnthropicAdaptiveThinkingConfig {
|
|
98
|
+
type: "adaptive";
|
|
99
|
+
display?: AnthropicThinkingDisplay;
|
|
100
|
+
effort?: AnthropicThinkingEffort;
|
|
101
|
+
interleaved?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface AnthropicDisabledThinkingConfig {
|
|
104
|
+
type: "disabled";
|
|
105
|
+
}
|
|
106
|
+
export type AnthropicThinkingConfig = AnthropicAdaptiveThinkingConfig | AnthropicDisabledThinkingConfig | AnthropicEnabledThinkingConfig;
|
|
107
|
+
export type OpenAiReasoningEffort = "high" | "low" | "medium" | "minimal" | "none" | "xhigh";
|
|
108
|
+
export type OpenAiReasoningSummary = "auto" | "concise" | "detailed";
|
|
109
|
+
export interface OpenAiReasoningConfig {
|
|
110
|
+
effort?: OpenAiReasoningEffort;
|
|
111
|
+
includeEncryptedContent?: boolean;
|
|
112
|
+
summary?: OpenAiReasoningSummary;
|
|
113
|
+
}
|
|
114
|
+
export interface ReasoningConfig {
|
|
115
|
+
auto?: AutoReasoningConfig;
|
|
116
|
+
anthropic?: AnthropicThinkingConfig;
|
|
117
|
+
openai?: OpenAiReasoningConfig;
|
|
118
|
+
visibility?: ReasoningVisibility;
|
|
119
|
+
}
|
|
120
|
+
export interface MessageProviderState {
|
|
121
|
+
anthropicAssistantContent?: AnthropicAssistantContentBlock[];
|
|
122
|
+
openaiResponsesOutput?: OpenAiResponsesOutputItem[];
|
|
123
|
+
openaiResponsesResponseId?: string;
|
|
124
|
+
}
|
|
125
|
+
export type AssistantContentBlock = AnthropicRedactedThinkingBlock | AnthropicThinkingBlock | OpenAiReasoningBlock | TextBlock | ToolUseBlock;
|
|
126
|
+
export type ContentBlock = AssistantContentBlock | ToolResultBlock;
|
|
127
|
+
export type ContentInput = ContentBlock[] | string | null | undefined;
|
|
128
|
+
export type MessageRole = "assistant" | "user";
|
|
129
|
+
export type SystemInput = TextBlock[] | string | null | undefined;
|
|
130
|
+
export interface Message {
|
|
131
|
+
id?: string;
|
|
132
|
+
role: MessageRole;
|
|
133
|
+
content: ContentBlock[];
|
|
134
|
+
providerState?: MessageProviderState;
|
|
135
|
+
}
|
|
136
|
+
export interface IdentifiedMessage extends Message {
|
|
137
|
+
id: string;
|
|
138
|
+
}
|
|
139
|
+
export interface MessageInput {
|
|
140
|
+
id?: string;
|
|
141
|
+
role: MessageRole;
|
|
142
|
+
content?: ContentInput;
|
|
143
|
+
providerState?: MessageProviderState;
|
|
144
|
+
}
|
|
145
|
+
export interface ToolSchema {
|
|
146
|
+
name: string;
|
|
147
|
+
description: string;
|
|
148
|
+
input_schema: JsonSchemaObject;
|
|
149
|
+
}
|
|
150
|
+
export interface ChatRequest {
|
|
151
|
+
model: string;
|
|
152
|
+
maxTokens: number;
|
|
153
|
+
reasoning?: ReasoningConfig;
|
|
154
|
+
system: TextBlock[];
|
|
155
|
+
messages: Message[];
|
|
156
|
+
tools: ToolSchema[];
|
|
157
|
+
metadata: {
|
|
158
|
+
sessionId: string;
|
|
159
|
+
turnId: string;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export interface ChatResponse {
|
|
163
|
+
id: string;
|
|
164
|
+
content: AssistantContentBlock[];
|
|
165
|
+
stopReason: "end_turn" | "tool_use";
|
|
166
|
+
usage: {
|
|
167
|
+
inputTokens: number;
|
|
168
|
+
outputTokens: number;
|
|
169
|
+
reasoningTokens?: number;
|
|
170
|
+
};
|
|
171
|
+
providerState?: MessageProviderState;
|
|
172
|
+
}
|
|
173
|
+
export interface ContentDeltaChunk {
|
|
174
|
+
type: "content_delta";
|
|
175
|
+
index?: number;
|
|
176
|
+
text?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface ToolUseDeltaChunk {
|
|
179
|
+
type: "tool_use_delta";
|
|
180
|
+
id: string;
|
|
181
|
+
index: number;
|
|
182
|
+
inputDelta?: string;
|
|
183
|
+
name?: string;
|
|
184
|
+
}
|
|
185
|
+
export interface AnthropicThinkingDeltaChunk {
|
|
186
|
+
type: "anthropic_thinking_delta";
|
|
187
|
+
index: number;
|
|
188
|
+
thinking: string;
|
|
189
|
+
}
|
|
190
|
+
export interface OpenAiReasoningDeltaChunk {
|
|
191
|
+
type: "openai_reasoning_delta";
|
|
192
|
+
contentIndex: number;
|
|
193
|
+
delta: string;
|
|
194
|
+
itemId: string;
|
|
195
|
+
outputIndex: number;
|
|
196
|
+
}
|
|
197
|
+
export interface OpenAiReasoningSummaryDeltaChunk {
|
|
198
|
+
type: "openai_reasoning_summary_delta";
|
|
199
|
+
delta: string;
|
|
200
|
+
itemId: string;
|
|
201
|
+
outputIndex: number;
|
|
202
|
+
summaryIndex: number;
|
|
203
|
+
}
|
|
204
|
+
export interface ChatResponseChunk {
|
|
205
|
+
type: "anthropic_signature_delta" | "anthropic_thinking_delta" | "content_delta" | "done" | "openai_reasoning_delta" | "openai_reasoning_summary_delta" | "tool_use_delta";
|
|
206
|
+
contentIndex?: number;
|
|
207
|
+
delta?: string;
|
|
208
|
+
index?: number;
|
|
209
|
+
itemId?: string;
|
|
210
|
+
outputIndex?: number;
|
|
211
|
+
signature?: string;
|
|
212
|
+
summaryIndex?: number;
|
|
213
|
+
text?: string;
|
|
214
|
+
thinking?: string;
|
|
215
|
+
inputDelta?: string;
|
|
216
|
+
name?: string;
|
|
217
|
+
id?: string;
|
|
218
|
+
response?: ChatResponse;
|
|
219
|
+
}
|
|
220
|
+
export interface ModelLimits {
|
|
221
|
+
contextWindow?: number;
|
|
222
|
+
maxOutput?: number;
|
|
223
|
+
}
|
|
224
|
+
export interface ModelInfo {
|
|
225
|
+
id: string;
|
|
226
|
+
name: string;
|
|
227
|
+
limits?: ModelLimits;
|
|
228
|
+
supportedEndpoints?: string[];
|
|
229
|
+
}
|
|
230
|
+
export interface ToolResultMeta {
|
|
231
|
+
truncated?: boolean;
|
|
232
|
+
originalBytes?: number;
|
|
233
|
+
transforms: string[];
|
|
234
|
+
}
|
|
235
|
+
export interface ToolResultChunk {
|
|
236
|
+
output: string;
|
|
237
|
+
structured: JsonObject;
|
|
238
|
+
content?: ToolResultContent;
|
|
239
|
+
}
|
|
240
|
+
export interface ToolOutputEnvelope {
|
|
241
|
+
output: string;
|
|
242
|
+
structured?: JsonObject;
|
|
243
|
+
content?: ToolResultContent;
|
|
244
|
+
}
|
|
245
|
+
export interface ToolResult {
|
|
246
|
+
callId: string;
|
|
247
|
+
toolName: string;
|
|
248
|
+
status: "error" | "ok";
|
|
249
|
+
output: string;
|
|
250
|
+
structured: JsonObject;
|
|
251
|
+
content?: ToolResultContent;
|
|
252
|
+
chunks: ToolResultChunk[];
|
|
253
|
+
meta: ToolResultMeta;
|
|
254
|
+
}
|
|
255
|
+
export interface TurnInput {
|
|
256
|
+
sessionId: string;
|
|
257
|
+
turnId: string;
|
|
258
|
+
streaming?: boolean;
|
|
259
|
+
signal?: AbortSignal;
|
|
260
|
+
system?: SystemInput;
|
|
261
|
+
messages?: MessageInput[];
|
|
262
|
+
message: MessageInput;
|
|
263
|
+
}
|
|
264
|
+
export interface TurnState {
|
|
265
|
+
sessionId: string;
|
|
266
|
+
turnId: string;
|
|
267
|
+
system: TextBlock[];
|
|
268
|
+
messages: Message[];
|
|
269
|
+
lastResponse?: ChatResponse;
|
|
270
|
+
toolResults: ToolResult[];
|
|
271
|
+
finalMessage?: IdentifiedMessage;
|
|
272
|
+
}
|
|
273
|
+
export type TurnResultStatus = "completed" | "aborted";
|
|
274
|
+
export interface TurnResult {
|
|
275
|
+
status: TurnResultStatus;
|
|
276
|
+
finalMessage?: IdentifiedMessage;
|
|
277
|
+
state: TurnState;
|
|
278
|
+
}
|
|
279
|
+
export interface ModelExecutionOptions {
|
|
280
|
+
signal?: AbortSignal;
|
|
281
|
+
}
|
|
282
|
+
export interface EngineChatModel {
|
|
283
|
+
model: string;
|
|
284
|
+
maxTokens?: number;
|
|
285
|
+
complete(request: ChatRequest, options?: ModelExecutionOptions): Promise<ChatResponse>;
|
|
286
|
+
stream?(request: ChatRequest, options?: ModelExecutionOptions): AsyncIterable<ChatResponseChunk>;
|
|
287
|
+
getModels?(signal?: AbortSignal): Promise<ModelInfo[]>;
|
|
288
|
+
}
|
|
289
|
+
export interface AgentEventContext {
|
|
290
|
+
sessionId: string;
|
|
291
|
+
turnId: string;
|
|
292
|
+
state: TurnState;
|
|
293
|
+
}
|
|
294
|
+
export interface ToolExecutionContext extends AgentEventContext {
|
|
295
|
+
signal: AbortSignal;
|
|
296
|
+
toolCallId?: string;
|
|
297
|
+
}
|
|
298
|
+
export interface ToolRuntimeStartedEvent {
|
|
299
|
+
type: "tool_started";
|
|
300
|
+
toolCall: ToolUseBlock;
|
|
301
|
+
}
|
|
302
|
+
export interface ToolRuntimeOutputChunkEvent {
|
|
303
|
+
type: "tool_output_chunk";
|
|
304
|
+
toolCall: ToolUseBlock;
|
|
305
|
+
chunk: ToolResultChunk;
|
|
306
|
+
}
|
|
307
|
+
export interface ToolRuntimeCompletedEvent {
|
|
308
|
+
type: "tool_completed";
|
|
309
|
+
toolCall: ToolUseBlock;
|
|
310
|
+
result: ToolResult;
|
|
311
|
+
}
|
|
312
|
+
export interface ToolRuntimeRejectedEvent {
|
|
313
|
+
type: "tool_rejected";
|
|
314
|
+
toolCall: ToolUseBlock;
|
|
315
|
+
result: ToolResult;
|
|
316
|
+
}
|
|
317
|
+
export type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
318
|
+
export interface AgentUserMessageEvent {
|
|
319
|
+
type: "user_message";
|
|
320
|
+
message: Message;
|
|
321
|
+
}
|
|
322
|
+
export interface AgentModelRequestEvent {
|
|
323
|
+
type: "model_request";
|
|
324
|
+
request: ChatRequest;
|
|
325
|
+
}
|
|
326
|
+
export interface AgentModelResponseEvent {
|
|
327
|
+
type: "model_response";
|
|
328
|
+
response: ChatResponse;
|
|
329
|
+
}
|
|
330
|
+
export interface AgentAssistantMessageEvent {
|
|
331
|
+
type: "assistant_message";
|
|
332
|
+
message: IdentifiedMessage;
|
|
333
|
+
}
|
|
334
|
+
export interface AgentAssistantChunkEvent {
|
|
335
|
+
type: "assistant_chunk";
|
|
336
|
+
index: number;
|
|
337
|
+
messageId: string;
|
|
338
|
+
chunk: ContentDeltaChunk;
|
|
339
|
+
}
|
|
340
|
+
export interface AgentToolUseMessageEvent {
|
|
341
|
+
type: "tool_use_message";
|
|
342
|
+
message: IdentifiedMessage;
|
|
343
|
+
}
|
|
344
|
+
export interface AgentToolUseChunkEvent {
|
|
345
|
+
type: "tool_use_chunk";
|
|
346
|
+
index: number;
|
|
347
|
+
messageId: string;
|
|
348
|
+
chunk: ToolUseDeltaChunk;
|
|
349
|
+
}
|
|
350
|
+
export interface AgentReasoningMessageEvent {
|
|
351
|
+
type: "reasoning_message";
|
|
352
|
+
message: IdentifiedMessage;
|
|
353
|
+
}
|
|
354
|
+
export interface AgentReasoningChunkEvent {
|
|
355
|
+
type: "reasoning_chunk";
|
|
356
|
+
index: number;
|
|
357
|
+
messageId: string;
|
|
358
|
+
chunk: AnthropicThinkingDeltaChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk;
|
|
359
|
+
text: string;
|
|
360
|
+
}
|
|
361
|
+
export interface AgentToolCallEvent {
|
|
362
|
+
type: "tool_call";
|
|
363
|
+
toolCall: ToolUseBlock;
|
|
364
|
+
}
|
|
365
|
+
export interface AgentToolResultEvent {
|
|
366
|
+
type: "tool_result";
|
|
367
|
+
result: ToolResult;
|
|
368
|
+
}
|
|
369
|
+
export interface AgentToolResultMessageEvent {
|
|
370
|
+
type: "tool_result_message";
|
|
371
|
+
message: Message;
|
|
372
|
+
}
|
|
373
|
+
export interface AgentFinalMessageEvent {
|
|
374
|
+
type: "final_message";
|
|
375
|
+
message: IdentifiedMessage;
|
|
376
|
+
}
|
|
377
|
+
export interface AgentTurnCompleteEvent {
|
|
378
|
+
type: "turn_complete";
|
|
379
|
+
state: TurnState;
|
|
380
|
+
}
|
|
381
|
+
export type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
|
|
382
|
+
export type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
|
|
383
|
+
export type ToolRuntimeDispatchDecision = {
|
|
384
|
+
action: "reject";
|
|
385
|
+
reason?: string;
|
|
386
|
+
} | {
|
|
387
|
+
action: "run";
|
|
388
|
+
};
|
|
389
|
+
export type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
|
|
390
|
+
export type AgentEventHandler = (event: AgentEvent, ctx: AgentEventContext) => Promise<void> | void;
|
|
391
|
+
export interface ToolRuntime {
|
|
392
|
+
listToolSchemas(): ToolSchema[];
|
|
393
|
+
setTools(tools: AnyToolDefinition[]): void;
|
|
394
|
+
executeCalls(toolCalls: ToolUseBlock[], ctx: ToolExecutionContext): Promise<ToolResult[]>;
|
|
395
|
+
execute(toolCall: ToolUseBlock, ctx: ToolExecutionContext): Promise<ToolResult>;
|
|
396
|
+
}
|
|
397
|
+
export type ToolOutputValue = JsonValue | ToolOutputEnvelope;
|
|
398
|
+
export type ToolGenerator<TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined> = AsyncGenerator<TYield, TReturn, void>;
|
|
399
|
+
export interface ToolDefinition<TInput extends JsonObject = JsonObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined, TSchema extends JsonSchemaObject = JsonSchemaObject> {
|
|
400
|
+
name: string;
|
|
401
|
+
description: string;
|
|
402
|
+
inputSchema: TSchema;
|
|
403
|
+
execute(input: TInput, ctx: ToolExecutionContext): ToolGenerator<TYield, TReturn>;
|
|
404
|
+
}
|
|
405
|
+
export type AnyToolDefinition = ToolDefinition<JsonObject, ToolOutputValue, ToolOutputValue | undefined, JsonSchemaObject>;
|
|
406
|
+
export type Stage = "afterModelResponse" | "afterToolResult" | "afterTurnComplete" | "beforeAssistantAppend" | "beforeFinalOutput" | "beforeModelRequest" | "beforeToolExecution" | "beforeToolResultAppend" | "onUserMessage";
|
|
407
|
+
export interface PayloadByStage {
|
|
408
|
+
onUserMessage: Message;
|
|
409
|
+
beforeModelRequest: ChatRequest;
|
|
410
|
+
afterModelResponse: ChatResponse;
|
|
411
|
+
beforeToolExecution: ToolUseBlock;
|
|
412
|
+
afterToolResult: ToolResult;
|
|
413
|
+
beforeAssistantAppend: Message;
|
|
414
|
+
beforeFinalOutput: Message;
|
|
415
|
+
beforeToolResultAppend: Message;
|
|
416
|
+
afterTurnComplete: TurnState;
|
|
417
|
+
}
|
|
418
|
+
export interface ExtensionContext {
|
|
419
|
+
state: TurnState;
|
|
420
|
+
}
|
|
421
|
+
type Transformer$1<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => PayloadByStage[S] | Promise<PayloadByStage[S]>;
|
|
422
|
+
export type Observer<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => Promise<void> | void;
|
|
423
|
+
export interface TransformerExtensionRegistration<S extends Stage = Stage> {
|
|
424
|
+
id: string;
|
|
425
|
+
stage: S;
|
|
426
|
+
kind: "transformer";
|
|
427
|
+
order: number;
|
|
428
|
+
enabled: boolean;
|
|
429
|
+
run: Transformer$1<S>;
|
|
430
|
+
}
|
|
431
|
+
export interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
432
|
+
id: string;
|
|
433
|
+
stage: S;
|
|
434
|
+
kind: "observer";
|
|
435
|
+
order: number;
|
|
436
|
+
enabled: boolean;
|
|
437
|
+
run: Observer<S>;
|
|
438
|
+
}
|
|
439
|
+
export type ExtensionRegistration<S extends Stage = Stage> = ObserverExtensionRegistration<S> | TransformerExtensionRegistration<S>;
|
|
440
|
+
export type AnyExtensionRegistration = {
|
|
441
|
+
[S in Stage]: ExtensionRegistration<S>;
|
|
442
|
+
}[Stage];
|
|
443
|
+
export interface ExtensionRegistry {
|
|
444
|
+
register(extension: AnyExtensionRegistration): void;
|
|
445
|
+
runTransformers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<PayloadByStage[S]>;
|
|
446
|
+
runObservers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<void>;
|
|
447
|
+
}
|
|
448
|
+
export interface RunTurnDeps {
|
|
449
|
+
registry: ExtensionRegistry;
|
|
450
|
+
chatModel: EngineChatModel;
|
|
451
|
+
toolRuntime: ToolRuntime;
|
|
452
|
+
onEvent?: AgentEventHandler;
|
|
453
|
+
}
|
|
454
|
+
export type AgentInput = MessageInput | string;
|
|
455
|
+
export interface AgentSendOptions {
|
|
456
|
+
streaming?: boolean;
|
|
457
|
+
signal?: AbortSignal;
|
|
458
|
+
}
|
|
459
|
+
export interface AgentOptions {
|
|
460
|
+
sessionId?: string;
|
|
461
|
+
systemPrompt?: string;
|
|
462
|
+
messages?: MessageInput[];
|
|
463
|
+
message?: AgentInput;
|
|
464
|
+
onEvent?: AgentEventHandler;
|
|
465
|
+
onToolCall?: ToolRuntimeToolCallHandler;
|
|
466
|
+
registry?: ExtensionRegistry;
|
|
467
|
+
extensions?: AnyExtensionRegistration[];
|
|
468
|
+
chatModel?: EngineChatModel;
|
|
469
|
+
tools?: AnyToolDefinition[];
|
|
470
|
+
}
|
|
471
|
+
export interface OpenAiFunctionCall {
|
|
472
|
+
type: "function_call";
|
|
473
|
+
call_id: string;
|
|
474
|
+
name: string;
|
|
475
|
+
arguments: string;
|
|
476
|
+
}
|
|
477
|
+
export interface OpenAiOutputTextPart {
|
|
478
|
+
type: "output_text";
|
|
479
|
+
text: string;
|
|
480
|
+
}
|
|
481
|
+
export interface OpenAiRefusalPart {
|
|
482
|
+
type: "refusal";
|
|
483
|
+
refusal: string;
|
|
484
|
+
}
|
|
485
|
+
export interface OpenAiOutputMessage {
|
|
486
|
+
type: "message";
|
|
487
|
+
content?: Array<OpenAiOutputTextPart | OpenAiRefusalPart>;
|
|
488
|
+
role?: string;
|
|
489
|
+
status?: string;
|
|
490
|
+
}
|
|
491
|
+
export interface OpenAiReasoningOutputItem {
|
|
492
|
+
type: "reasoning";
|
|
493
|
+
content?: Array<{
|
|
494
|
+
text?: string;
|
|
495
|
+
type?: string;
|
|
496
|
+
}>;
|
|
497
|
+
encrypted_content?: string;
|
|
498
|
+
id?: string;
|
|
499
|
+
status?: string;
|
|
500
|
+
summary?: OpenAiReasoningSummaryText[];
|
|
501
|
+
text?: string;
|
|
502
|
+
}
|
|
503
|
+
export type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
504
|
+
export declare class Agent {
|
|
505
|
+
readonly deps: RunTurnDeps;
|
|
506
|
+
readonly sessionId: string;
|
|
507
|
+
private _systemPrompt;
|
|
508
|
+
messages: Message[];
|
|
509
|
+
readonly defaultMessage?: Message;
|
|
510
|
+
turnIndex: number;
|
|
511
|
+
constructor(options?: AgentOptions);
|
|
512
|
+
get systemPrompt(): string;
|
|
513
|
+
setTools(tools?: AgentOptions["tools"]): void;
|
|
514
|
+
setSystemPrompt(systemPrompt: string, options?: {
|
|
515
|
+
resetMessages?: boolean;
|
|
516
|
+
}): void;
|
|
517
|
+
/**
|
|
518
|
+
* Replace the chat model used for subsequent turns. Existing conversation
|
|
519
|
+
* state is preserved; the next call to {@link send} uses the new model.
|
|
520
|
+
* Useful for runtime model switching (e.g. via a `/model` slash command).
|
|
521
|
+
*/
|
|
522
|
+
setChatModel(chatModel: RunTurnDeps["chatModel"]): void;
|
|
523
|
+
send(input?: AgentInput | undefined, options?: AgentSendOptions): Promise<TurnResult>;
|
|
524
|
+
}
|
|
525
|
+
export declare function createExtensionRegistry(): ExtensionRegistry;
|
|
526
|
+
export declare function runTurn(input: TurnInput, deps: RunTurnDeps): Promise<TurnResult>;
|
|
15
527
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
declare function runTurn(input: TurnInput, deps: RunTurnDeps): Promise<TurnResult>;
|
|
19
|
-
|
|
20
|
-
export { Agent, AgentInput, AgentOptions, AgentSendOptions, ExtensionRegistry, RunTurnDeps, TurnInput, TurnResult, createExtensionRegistry, runTurn };
|
|
528
|
+
export {};
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xcba386,_0x3dcb02){var _0x4e280a={_0x30211d:0x278,_0x3cb691:0x273,_0x29e067:0x27e,_0x384b52:0x3f2,_0x24c8d1:0x3f5,_0x554077:0x3f8,_0x18281f:0x3f1,_0x4d27f8:0x3fa,_0x375dbf:0x3f6,_0x5634ad:0x402,_0x26ac70:0x3fc,_0x5e9e5e:0x3f9,_0x268fab:0x3f0,_0x367fc5:0x3f9},_0x5b46f8={_0x1f8ceb:0x361},_0xcbed13=_0xcba386();function _0x12a6c2(_0x5ca36d,_0x3a484e,_0x2137d0,_0x40b1e5){return _0x46c7(_0x5ca36d- -0x312,_0x2137d0);}function _0x316ac9(_0x3ec464,_0x4a28f6,_0x1bfc19,_0x81480e){return _0x46c7(_0x3ec464-_0x5b46f8._0x1f8ceb,_0x81480e);}while(!![]){try{var _0x12bbce=parseInt(_0x12a6c2(-_0x4e280a._0x30211d,-0x277,-_0x4e280a._0x3cb691,-_0x4e280a._0x29e067))/0x1*(-parseInt(_0x316ac9(_0x4e280a._0x384b52,0x3f0,_0x4e280a._0x24c8d1,0x3f7))/0x2)+-parseInt(_0x316ac9(_0x4e280a._0x554077,0x3f4,_0x4e280a._0x24c8d1,0x3fd))/0x3+-parseInt(_0x316ac9(0x3f3,0x3f6,_0x4e280a._0x18281f,0x3f1))/0x4*(parseInt(_0x316ac9(_0x4e280a._0x4d27f8,0x3f4,0x3fc,0x3ff))/0x5)+-parseInt(_0x316ac9(0x3fc,0x3fb,_0x4e280a._0x375dbf,_0x4e280a._0x5634ad))/0x6+parseInt(_0x316ac9(0x3f6,_0x4e280a._0x24c8d1,_0x4e280a._0x26ac70,_0x4e280a._0x375dbf))/0x7+parseInt(_0x316ac9(_0x4e280a._0x5e9e5e,0x3f7,0x3f4,0x3fd))/0x8*(parseInt(_0x316ac9(0x3f4,0x3f2,0x3f2,0x3f3))/0x9)+-parseInt(_0x316ac9(_0x4e280a._0x24c8d1,0x3f2,_0x4e280a._0x268fab,_0x4e280a._0x5e9e5e))/0xa*(-parseInt(_0x316ac9(0x3f7,_0x4e280a._0x4d27f8,_0x4e280a._0x367fc5,_0x4e280a._0x375dbf))/0xb);if(_0x12bbce===_0x3dcb02)break;else _0xcbed13['push'](_0xcbed13['shift']());}catch(_0x5afec7){_0xcbed13['push'](_0xcbed13['shift']());}}}(_0x36fb,0x1a673));function _0x36fb(){var _0x4f8e9c=['mtbTzwjzt04','mZe2ody5rgjcv29k','mZiZotaZohPjve9iza','mti0mZqXtLbeAuri','ofzPv3bYCa','mJmWzwTxu2Xv','ndG5n3rOAuz3BW','nJG2mti0sfDgr2Pg','mJzKsNPSD08','nZGXnMPgv01luq','nJK5oteYywn4yvrM'];_0x36fb=function(){return _0x4f8e9c;};return _0x36fb();}import{Agent,createExtensionRegistry,runTurn}from'../chunk-VFTQW5WK.js';import'../chunk-G2FR4UGO.js';import'../chunk-X7VAACWY.js';function _0x46c7(_0x27eee1,_0x1ae95a){_0x27eee1=_0x27eee1-0x91;var _0x36fb3a=_0x36fb();var _0x46c7a8=_0x36fb3a[_0x27eee1];if(_0x46c7['ALGiVc']===undefined){var _0x410bb8=function(_0x3b2545){var _0x1a9213='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xdf6e6='',_0x21a7c0='';for(var _0x268d4f=0x0,_0x1bdffd,_0x167b1d,_0x39aabf=0x0;_0x167b1d=_0x3b2545['charAt'](_0x39aabf++);~_0x167b1d&&(_0x1bdffd=_0x268d4f%0x4?_0x1bdffd*0x40+_0x167b1d:_0x167b1d,_0x268d4f++%0x4)?_0xdf6e6+=String['fromCharCode'](0xff&_0x1bdffd>>(-0x2*_0x268d4f&0x6)):0x0){_0x167b1d=_0x1a9213['indexOf'](_0x167b1d);}for(var _0x40d4cc=0x0,_0x5b027e=_0xdf6e6['length'];_0x40d4cc<_0x5b027e;_0x40d4cc++){_0x21a7c0+='%'+('00'+_0xdf6e6['charCodeAt'](_0x40d4cc)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x21a7c0);};_0x46c7['QcNHXJ']=_0x410bb8,_0x46c7['hNfELx']={},_0x46c7['ALGiVc']=!![];}var _0x450b47=_0x36fb3a[0x0],_0x5e50ef=_0x27eee1+_0x450b47,_0xcbb246=_0x46c7['hNfELx'][_0x5e50ef];return!_0xcbb246?(_0x46c7a8=_0x46c7['QcNHXJ'](_0x46c7a8),_0x46c7['hNfELx'][_0x5e50ef]=_0x46c7a8):_0x46c7a8=_0xcbb246,_0x46c7a8;}export{Agent,createExtensionRegistry,runTurn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x14997a,_0x266482){const _0x348292={_0xf0cc99:0x49b,_0x13521c:0x4b1,_0x57bc40:0x4a7,_0x343ca5:0x4ad,_0x557a06:0x4ba,_0x580891:0x155,_0x1cfaa8:0x147,_0x140fff:0x4b2,_0x58de46:0x4b0,_0x5cf197:0x14e,_0x422a8d:0x131,_0x246033:0x137,_0x332ab1:0x13f,_0x160200:0x139,_0x126ea4:0x13c,_0x683e70:0x150},_0x552eb8={_0x4a1b12:0x2e2};function _0x27800b(_0x596a9b,_0xfbff50,_0x2d57ca,_0x1f53da){return _0x5b2f(_0x596a9b- -_0x552eb8._0x4a1b12,_0x2d57ca);}const _0x497e10=_0x14997a();function _0x56a373(_0x5b1681,_0x507b60,_0x987b38,_0x395f05){return _0x5b2f(_0x5b1681-0x317,_0x507b60);}while(!![]){try{const _0x295b74=-parseInt(_0x56a373(0x498,0x482,0x4aa,0x4a9))/0x1*(-parseInt(_0x27800b(-0x159,-0x14f,-0x158,-0x166))/0x2)+-parseInt(_0x56a373(_0x348292._0xf0cc99,_0x348292._0x13521c,_0x348292._0x57bc40,0x490))/0x3*(parseInt(_0x56a373(_0x348292._0x343ca5,0x4b4,_0x348292._0x557a06,0x4be))/0x4)+-parseInt(_0x27800b(-0x164,-_0x348292._0x580891,-0x165,-0x179))/0x5*(parseInt(_0x27800b(-_0x348292._0x1cfaa8,-0x140,-0x13c,-0x130))/0x6)+-parseInt(_0x27800b(-0x150,-0x146,-0x169,-0x157))/0x7+parseInt(_0x56a373(0x4b3,_0x348292._0x140fff,0x49f,_0x348292._0x58de46))/0x8+parseInt(_0x27800b(-0x136,-0x13b,-0x122,-_0x348292._0x5cf197))/0x9*(-parseInt(_0x27800b(-0x14b,-_0x348292._0x422a8d,-_0x348292._0x246033,-_0x348292._0x332ab1))/0xa)+-parseInt(_0x27800b(-_0x348292._0x160200,-0x151,-0x13c,-0x123))/0xb*(-parseInt(_0x27800b(-_0x348292._0x126ea4,-0x12b,-_0x348292._0x683e70,-0x141))/0xc);if(_0x295b74===_0x266482)break;else _0x497e10['push'](_0x497e10['shift']());}catch(_0x19ceea){_0x497e10['push'](_0x497e10['shift']());}}}(_0x4ad9,0x2bd2d));function createTextBlock(_0x584b36){const _0x1b8cec={_0x44f968:0x8};function _0x166aa2(_0xc6fa62,_0x171dc3,_0x555cfe,_0x17b6a3){return _0x5b2f(_0xc6fa62- -0x1a1,_0x17b6a3);}return{'type':_0x166aa2(-0xc,-0x1a,-0x10,-_0x1b8cec._0x44f968),'text':_0x584b36};}function normalizeTextBlock(_0xb818cd){const _0xb2f708={_0x2d1979:0x223,_0x2f4eb9:0x21e},_0x219abd={_0x2d47d7:0x3b8};function _0x54d150(_0x502a3c,_0x6ae535,_0x1f5221,_0x6e32ee){return _0x5b2f(_0x1f5221- -_0x219abd._0x2d47d7,_0x502a3c);}return createTextBlock(_0xb818cd[_0x54d150(-0x235,-0x20c,-_0xb2f708._0x2d1979,-_0xb2f708._0x2f4eb9)]??'');}function normalizeContent(_0x1c85b3){const _0x1792e2={_0x19b3e5:0x237,_0x31f9ad:0x227},_0x5564e0={_0x27a702:0x241,_0x58aa57:0x223,_0x390bcc:0x235,_0x43e9d7:0x251,_0x369d97:0x252},_0x339bb8={_0x455860:0x99},_0x13d578={_0x3a985f:0x3ca};if(typeof _0x1c85b3==='string')return[createTextBlock(_0x1c85b3)];if(!Array['isArray'](_0x1c85b3))return[];function _0x1a83b1(_0x3aab40,_0x128aa9,_0x439e91,_0x33f478){return _0x5b2f(_0x3aab40- -_0x13d578._0x3a985f,_0x33f478);}return _0x1c85b3[_0x1a83b1(-_0x1792e2._0x19b3e5,-0x227,-0x21c,-_0x1792e2._0x31f9ad)](_0x43b89b=>{const _0x32c05d={_0x279eef:0x14c,_0x50ac40:0x16e};function _0x499ef9(_0x5685e5,_0x5549ad,_0x55c0ac,_0x4c9ee8){return _0x1a83b1(_0x55c0ac-0x6f4,_0x5549ad-_0x32c05d._0x279eef,_0x55c0ac-_0x32c05d._0x50ac40,_0x5549ad);}function _0x2216d6(_0x3d34ca,_0x3143de,_0x4d4af2,_0x2f7164){return _0x1a83b1(_0x4d4af2- -0xc,_0x3143de-0x8a,_0x4d4af2-_0x339bb8._0x455860,_0x3143de);}if(_0x43b89b[_0x2216d6(-_0x5564e0._0x27a702,-_0x5564e0._0x58aa57,-_0x5564e0._0x390bcc,-_0x5564e0._0x43e9d7)]===_0x2216d6(-0x24b,-_0x5564e0._0x369d97,-0x241,-0x229))return normalizeTextBlock(_0x43b89b);return structuredClone(_0x43b89b);});}function normalizeSystem(_0x232c9c=[]){const _0x918765={_0x4ba04c:0x242,_0x416561:0x231};function _0x3db068(_0x1fe49b,_0x38eefd,_0x2b2cce,_0x444fb9){return _0x5b2f(_0x38eefd- -0x3c2,_0x444fb9);}return normalizeContent(_0x232c9c)[_0x3db068(-0x23f,-_0x918765._0x4ba04c,-0x22c,-_0x918765._0x416561)](_0x85dba9=>_0x85dba9['type']==='text');}function normalizeMessage(_0x52bb25){const _0x473851={_0xe8cda3:0x2e4,_0x4f3ab8:0x2d9,_0x185e59:0x192,_0x38186d:0x2d2,_0x5c2561:0x2b9,_0x140d2b:0x2c5},_0x4622cb={_0x1b448a:0x14d};function _0xbf356c(_0x16a8bb,_0xff7d05,_0x4eaee7,_0x508484){return _0x5b2f(_0x16a8bb- -0x7,_0x4eaee7);}function _0x423ea9(_0x19321f,_0x1c7d97,_0x33dce2,_0x5544a8){return _0x5b2f(_0x5544a8-_0x4622cb._0x1b448a,_0x33dce2);}return{...typeof _0x52bb25['id']===_0x423ea9(0x2ee,0x2cb,_0x473851._0xe8cda3,_0x473851._0x4f3ab8)?{'id':_0x52bb25['id']}:{},'role':_0x52bb25[_0xbf356c(_0x473851._0x185e59,0x1a2,0x1a5,0x19a)],'content':normalizeContent(_0x52bb25['content']),..._0x52bb25[_0x423ea9(_0x473851._0x38186d,_0x473851._0x5c2561,_0x473851._0x140d2b,0x2cf)]?{'providerState':structuredClone(_0x52bb25['providerState'])}:{}};}function compileRequest(_0x4e264b){const _0x23ad24={_0x3c81ed:0x94,_0x2a9678:0x96,_0x27d225:0xa8,_0x25c0cf:0xa6,_0x423561:0x7d,_0x1167d7:0xf4,_0x104f81:0xa3,_0x34c569:0xdf,_0x5801dc:0xef},_0x567912={_0x313245:0x10a},_0x3c01e6={_0x2a5075:0x28c};function _0x3a95c9(_0x46ce5c,_0x4c166d,_0x3b1f79,_0x2fca5c){return _0x5b2f(_0x2fca5c- -_0x3c01e6._0x2a5075,_0x4c166d);}function _0x5de85d(_0x1c7d81,_0x20d5a6,_0x56cdc3,_0xa648e9){return _0x5b2f(_0x20d5a6- -_0x567912._0x313245,_0xa648e9);}return{'model':_0x4e264b['model']??'claude-sonnet-4-20250514','max_tokens':_0x4e264b['max_tokens']??0x400,..._0x4e264b[_0x5de85d(_0x23ad24._0x3c81ed,_0x23ad24._0x2a9678,_0x23ad24._0x27d225,0x7f)]?{'reasoning':structuredClone(_0x4e264b[_0x5de85d(_0x23ad24._0x25c0cf,_0x23ad24._0x2a9678,_0x23ad24._0x423561,0xa7)])}:{},'system':normalizeSystem(_0x4e264b[_0x3a95c9(-_0x23ad24._0x1167d7,-0xf2,-0xdd,-0xe2)]),'messages':_0x4e264b[_0x5de85d(0xab,_0x23ad24._0x104f81,0xa6,0x8b)]['map'](normalizeMessage),'tools':structuredClone(_0x4e264b['tools']??[]),'metadata':{'session_id':_0x4e264b['sessionId'],'turn_id':_0x4e264b[_0x3a95c9(-_0x23ad24._0x34c569,-0xd9,-0xea,-_0x23ad24._0x5801dc)]}};}function toChatRequest(_0x465fd4){const _0x22fe4a={_0x4546db:0x510,_0x2cd1a3:0x51c,_0x135073:0x509,_0x560d7b:0x508,_0x584e33:0x521,_0x40709e:0x344,_0x2233e0:0x314,_0x3d5847:0x32a,_0x30c05f:0x326,_0x25153a:0x319,_0x54fc3f:0x30a,_0x1fa0d7:0x2fe,_0xc77168:0x4ec,_0x4127d8:0x4f4},_0x53dcf3={_0x5dfba2:0x18a};function _0x1835e3(_0x26bed4,_0x3ce0f6,_0x33d2e8,_0x5b3d00){return _0x5b2f(_0x33d2e8-_0x53dcf3._0x5dfba2,_0x26bed4);}function _0x9b47a1(_0x5d8d09,_0x4ee04b,_0x5b9fe8,_0x25b8fb){return _0x5b2f(_0x5d8d09-0x365,_0x4ee04b);}return{'model':_0x465fd4[_0x9b47a1(_0x22fe4a._0x4546db,0x4f9,0x519,_0x22fe4a._0x2cd1a3)],'maxTokens':_0x465fd4[_0x9b47a1(_0x22fe4a._0x135073,0x51a,_0x22fe4a._0x560d7b,_0x22fe4a._0x584e33)],..._0x465fd4[_0x1835e3(_0x22fe4a._0x40709e,_0x22fe4a._0x2233e0,_0x22fe4a._0x3d5847,_0x22fe4a._0x30c05f)]?{'reasoning':structuredClone(_0x465fd4['reasoning'])}:{},'system':structuredClone(_0x465fd4[_0x9b47a1(0x50f,0x507,0x504,0x4ff)]),'messages':structuredClone(_0x465fd4['messages']),'tools':structuredClone(_0x465fd4[_0x1835e3(_0x22fe4a._0x25153a,_0x22fe4a._0x54fc3f,0x318,_0x22fe4a._0x1fa0d7)]),'metadata':{'sessionId':_0x465fd4['metadata'][_0x9b47a1(0x4ec,0x505,_0x22fe4a._0xc77168,_0x22fe4a._0x4127d8)],'turnId':_0x465fd4['metadata'][_0x1835e3(0x30e,0x2f3,0x309,0x31b)]}};}function toModelRequest(_0x3497ed){const _0x328c18={_0x13be83:0x4b8,_0x1ebe5f:0x4d9,_0x18ed8a:0x4db,_0x20cd30:0x4e6,_0xbe7754:0x4cb,_0xb54de5:0x4c8,_0x46b535:0x2cf,_0x5d473e:0x2c2,_0x596b37:0x2c4,_0x2728b0:0x4fd,_0x2e5d60:0x4e8,_0x4b4d0f:0x4fc,_0x142209:0x28d,_0x32289c:0x4e2,_0x2a8e91:0x4cf,_0x27f20a:0x4c3,_0x4e60a6:0x4d5},_0x8ab478={_0x5d2872:0x33b};function _0x5844ca(_0x2f9c84,_0x47fce9,_0x4c6ab0,_0x49a2de){return _0x5b2f(_0x47fce9-_0x8ab478._0x5d2872,_0x2f9c84);}function _0x2b0d8b(_0x1d80d7,_0x430fd9,_0x844c7d,_0xccab65){return _0x5b2f(_0xccab65-0x11a,_0x844c7d);}return{'model':_0x3497ed['model'],'max_tokens':_0x3497ed[_0x5844ca(0x4bc,_0x328c18._0x13be83,_0x328c18._0x13be83,0x4b4)],..._0x3497ed[_0x5844ca(_0x328c18._0x1ebe5f,_0x328c18._0x18ed8a,_0x328c18._0x20cd30,_0x328c18._0xbe7754)]?{'reasoning':structuredClone(_0x3497ed[_0x5844ca(_0x328c18._0xb54de5,_0x328c18._0x18ed8a,0x4cb,0x4de)])}:{},'system':structuredClone(_0x3497ed[_0x2b0d8b(0x2b2,_0x328c18._0x46b535,_0x328c18._0x5d473e,_0x328c18._0x596b37)]),'messages':structuredClone(_0x3497ed[_0x5844ca(_0x328c18._0x2728b0,_0x328c18._0x2e5d60,_0x328c18._0x4b4d0f,0x4e7)]),'tools':structuredClone(_0x3497ed[_0x2b0d8b(_0x328c18._0x142209,0x293,0x290,0x2a8)]),'metadata':{'session_id':_0x3497ed['metadata'][_0x5844ca(_0x328c18._0x32289c,_0x328c18._0x2a8e91,0x4d0,_0x328c18._0x27f20a)],'turn_id':_0x3497ed[_0x5844ca(0x4ee,_0x328c18._0x4e60a6,0x4ec,0x4e3)]['turnId']}};}function _0x4ad9(){const _0x1746f9=['B3bLBMfPx3jLyxnVBMLUzW','mteWr0zbthD3','C3LZDgvT','Bw9KzwW','odfmDejKBLG','BwvZC2fNzxm','AM9PBG','C3rVCfjLyxnVBG','y2fSBeLK','khjLzgfJDgvKihjLyxnVBMLUzYK','yw50AhjVCgLJx3jLzgfJDgvKx3rOAw5RAw5N','BgvUz3rO','Bwf4vg9Rzw5Z','ntK3nw1bzgzJtq','DhvYBL9Pza','zMLSDgvY','otDqA1bVBfy','ChjVDMLKzxjtDgf0zq','DxnHz2u','ovzLAwL5DW','DhjPBq','yxnZAxn0yw50','C2vZC2LVBL9Pza','yw50AhjVCgLJx3rOAw5RAw5N','ntm1neXHzLbfAa','Aw5WDxruB2TLBNm','C3vTBwfYEq','C3rYAw5N','Dg9VBf91C2u','Dg9VBhm','Dg9VBf9Yzxn1Bhq','DgHPBMTPBMC','B3v0Chv0x3rVA2vUCW','nJi4mtu5rKDMEMH5','BwfW','C2vZC2LVBKLK','Dgv4Da','ndeWndGWBwjMzNvf','mZi4ndyWC09WC2Dk','y29UDgvUDa','CM9Szq','Bwv0ywrHDge','mZe4uu1Rt1LA','mtiZodi0AeLyu0L0','DhvYBKLK','zw5JCNLWDgvKq29UDgvUDa','C3rHDhvZ','CMvHC29UAw5N','DhLWzq','C3rVCf9YzwfZB24','CMvHC29UAw5Nvg9Rzw5Z','Bwf4x3rVA2vUCW','B3v0Chv0vg9Rzw5Z','nZKZmdGWvwPkB1vy','CMvHC29UAw5Nx3rVA2vUCW'];_0x4ad9=function(){return _0x1746f9;};return _0x4ad9();}function toProviderModelRequest(_0x2989e2){const _0x511b37={_0x3526e7:0x1f5,_0x4c2a6f:0x3bf,_0x1e987a:0x3ce,_0x14304e:0x3a3,_0x30f7d1:0x3a3};function _0x3ce5b5(_0xa76183,_0x3dde26,_0x3a9d10,_0x462c3f){return _0x5b2f(_0x3dde26- -0x399,_0x462c3f);}function _0x582558(_0x519f53,_0x108236,_0x806ee0,_0xf73546){return _0x5b2f(_0x519f53-0x212,_0x806ee0);}return{'model':_0x2989e2[_0x3ce5b5(-_0x511b37._0x3526e7,-0x1ee,-0x1f1,-0x1d9)],'max_tokens':_0x2989e2['maxTokens'],'system':structuredClone(_0x2989e2['system']),'messages':structuredClone(_0x2989e2[_0x582558(_0x511b37._0x4c2a6f,_0x511b37._0x1e987a,0x3c7,0x3ca)]),'tools':structuredClone(_0x2989e2[_0x582558(0x3a0,_0x511b37._0x14304e,_0x511b37._0x30f7d1,0x386)])};}function toChatResponse(_0x5c7c43){const _0x4512ff={_0x308179:0x5b,_0x37d66c:0x4a,_0x2902f8:0xac,_0xb87296:0xa3,_0x4e1d26:0xe1,_0x56815f:0x52,_0x5a40c9:0x58,_0x27781c:0xd5,_0x4e1bc1:0xa2,_0x52934a:0xb6,_0x3df491:0xa7,_0x577fc6:0xdb,_0x331e78:0x6f,_0x3277d7:0x31,_0x303b8f:0x49};function _0x2cf556(_0x5dd215,_0x2399b3,_0x1e4c6c,_0x24c257){return _0x5b2f(_0x5dd215- -0x139,_0x2399b3);}function _0x18a71b(_0x33c1b9,_0x4dc886,_0x2f9b19,_0x50bf4c){return _0x5b2f(_0x4dc886- -0x24e,_0x2f9b19);}return{'id':_0x5c7c43['id'],'content':structuredClone(_0x5c7c43[_0x2cf556(0x5f,_0x4512ff._0x308179,0x44,_0x4512ff._0x37d66c)]),'stopReason':_0x5c7c43[_0x18a71b(-0x93,-_0x4512ff._0x2902f8,-_0x4512ff._0xb87296,-0xaf)],'usage':{'inputTokens':_0x5c7c43[_0x18a71b(-0xc8,-0xcb,-_0x4512ff._0x4e1d26,-0xb1)]['input_tokens'],'outputTokens':_0x5c7c43[_0x2cf556(_0x4512ff._0x37d66c,_0x4512ff._0x56815f,0x60,_0x4512ff._0x5a40c9)][_0x18a71b(-_0x4512ff._0x27781c,-0xbd,-0xbd,-_0x4512ff._0x4e1bc1)],..._0x5c7c43[_0x18a71b(-0xaf,-0xcb,-0xc3,-0xbe)][_0x18a71b(-_0x4512ff._0x52934a,-_0x4512ff._0x3df491,-0xc3,-_0x4512ff._0x4e1bc1)]!==void 0x0?{'reasoningTokens':_0x5c7c43[_0x18a71b(-0xbb,-0xcb,-0xc4,-_0x4512ff._0x577fc6)][_0x2cf556(0x6e,0x66,0x7a,_0x4512ff._0x331e78)]}:{}},..._0x5c7c43['providerState']?{'providerState':structuredClone(_0x5c7c43[_0x2cf556(0x49,_0x4512ff._0x3277d7,_0x4512ff._0x303b8f,0x46)])}:{}};}function toModelResponse(_0x22fe51){const _0x574eb0={_0x229cf2:0x2a0,_0x111dd0:0x1c3,_0x59de30:0x1ac,_0x234a26:0x1d6,_0x511e3b:0x264,_0x338e3b:0x275,_0x4ba91f:0x267,_0x3622fc:0x284,_0x182229:0x28f,_0x26f6cd:0x278,_0x1e45a2:0x260,_0x4a40f0:0x29a,_0x2db25b:0x282,_0x3a0ca0:0x1b6,_0x1c8d4f:0x27a,_0x525708:0x285,_0x4c704a:0x27b,_0x27831a:0x290},_0x336496={_0x153ca1:0x372};function _0x456dcd(_0x4ac48c,_0x14cfe9,_0x222238,_0x549b50){return _0x5b2f(_0x4ac48c- -_0x336496._0x153ca1,_0x14cfe9);}function _0xa0295(_0x5c3357,_0x5a8c59,_0x517203,_0x3c5157){return _0x5b2f(_0x5a8c59-0xf5,_0x517203);}return{'id':_0x22fe51['id'],'type':'message','role':'assistant','content':structuredClone(_0x22fe51[_0xa0295(_0x574eb0._0x229cf2,0x28d,0x283,0x277)]),'stop_reason':_0x22fe51[_0x456dcd(-_0x574eb0._0x111dd0,-_0x574eb0._0x59de30,-_0x574eb0._0x234a26,-0x1c4)],'stop_sequence':null,'usage':{'input_tokens':_0x22fe51[_0xa0295(0x289,0x278,0x28a,_0x574eb0._0x511e3b)][_0xa0295(_0x574eb0._0x338e3b,0x27f,_0x574eb0._0x4ba91f,_0x574eb0._0x3622fc)],'output_tokens':_0x22fe51[_0xa0295(_0x574eb0._0x182229,_0x574eb0._0x26f6cd,0x26c,_0x574eb0._0x1e45a2)][_0xa0295(0x2a0,_0x574eb0._0x4a40f0,_0x574eb0._0x2db25b,0x285)],..._0x22fe51[_0xa0295(0x286,0x278,0x266,0x286)][_0x456dcd(-0x1cf,-0x1cc,-0x1d3,-_0x574eb0._0x3a0ca0)]!==void 0x0?{'reasoning_tokens':_0x22fe51[_0xa0295(0x28f,0x278,_0x574eb0._0x1c8d4f,0x291)][_0xa0295(_0x574eb0._0x525708,0x298,0x298,0x2a5)]}:{}},..._0x22fe51['providerState']?{'providerState':structuredClone(_0x22fe51[_0xa0295(_0x574eb0._0x4c704a,0x277,_0x574eb0._0x27831a,0x281)])}:{}};}function responseToAssistantMessage(_0x59e1b7){const _0x450dfa={_0x3b6831:0x190,_0x584d91:0x19e,_0x1dd6cc:0xc3,_0x5963f5:0xd3,_0x112dc3:0xd2,_0x278758:0x19a};function _0x554182(_0x44f42f,_0x3f98c9,_0x4b9702,_0x487814){return _0x5b2f(_0x487814-0x18,_0x44f42f);}function _0x1074c0(_0x534795,_0x4bd3f4,_0x4d94a2,_0x231846){return _0x5b2f(_0x4bd3f4- -0x272,_0x534795);}return{'role':_0x554182(0x1a8,_0x450dfa._0x3b6831,0x186,_0x450dfa._0x584d91),'content':normalizeContent(_0x59e1b7[_0x1074c0(-_0x450dfa._0x1dd6cc,-0xda,-_0x450dfa._0x5963f5,-_0x450dfa._0x112dc3)]),..._0x59e1b7[_0x554182(0x1a2,0x1b5,0x1b2,_0x450dfa._0x278758)]?{'providerState':structuredClone(_0x59e1b7['providerState'])}:{}};}function createReasoningMessage(_0x2cd709){const _0x12575f={_0x10f564:0x36e,_0x4e0009:0x387,_0x2f2cb2:0x36a,_0x1ca5ce:0x383,_0xc88b11:0x377,_0x2258fd:0x38d},_0x998f29={_0x56073d:0x35a,_0x4d48f5:0x355,_0x8075c8:0x366,_0x356437:0x34f,_0x475aa7:0x336,_0x316a86:0x33f,_0x84b125:0x34d,_0x206e60:0x359,_0x14c542:0x371,_0x32d5db:0x353},_0x1207cf={_0x4610d1:0x42},_0x24f76c={_0x7bafa2:0x207};function _0x1e2f5a(_0x25d36e,_0x4282b8,_0x571344,_0x39b224){return _0x5b2f(_0x39b224-_0x24f76c._0x7bafa2,_0x25d36e);}const _0x51a44c=normalizeContent(_0x2cd709?.['content'])[_0x1e2f5a(0x373,_0x12575f._0x10f564,0x39f,_0x12575f._0x4e0009)](_0x447e68=>{const _0x7424a4={_0x55810b:0xd5,_0x2e3493:0x12};function _0x1abf20(_0x5b2dfb,_0x265ac8,_0x458c19,_0x1d806b){return _0x1e2f5a(_0x458c19,_0x265ac8-_0x7424a4._0x55810b,_0x458c19-_0x7424a4._0x2e3493,_0x1d806b- -0x6f);}function _0x172621(_0x111b3e,_0x4d1c51,_0x3dee3f,_0x30799b){return _0x1e2f5a(_0x111b3e,_0x4d1c51-0x187,_0x3dee3f-0x141,_0x3dee3f- -_0x1207cf._0x4610d1);}return _0x447e68[_0x172621(_0x998f29._0x56073d,_0x998f29._0x4d48f5,_0x998f29._0x8075c8,_0x998f29._0x356437)]==='anthropic_redacted_thinking'||_0x447e68['type']===_0x172621(_0x998f29._0x475aa7,_0x998f29._0x316a86,_0x998f29._0x84b125,_0x998f29._0x206e60)||_0x447e68[_0x172621(0x379,0x35c,0x366,_0x998f29._0x14c542)]===_0x172621(_0x998f29._0x32d5db,_0x998f29._0x32d5db,0x36d,0x37b);});function _0x38e9c5(_0x160b71,_0x278744,_0x9202cf,_0x40043f){return _0x5b2f(_0x160b71- -0x5b,_0x40043f);}if(_0x51a44c[_0x1e2f5a(_0x12575f._0x10f564,0x39a,_0x12575f._0x2f2cb2,_0x12575f._0x1ca5ce)]===0x0)return void 0x0;return{'role':_0x1e2f5a(0x387,_0x12575f._0xc88b11,_0x12575f._0x2258fd,_0x12575f._0x2258fd),'content':_0x51a44c};}function createAssistantTextMessage(_0x155f4b){const _0x157637={_0x338a44:0x244,_0x3b653a:0x242,_0x4131ea:0x25f,_0x3ed039:0x1c1,_0x224fc1:0x1cc},_0x8b5414={_0x380142:0x139,_0x4b07c9:0x126,_0x573e90:0x138,_0x11a480:0x149},_0x6a37f0={_0x130806:0x27,_0x4530ab:0x11a},_0x2a4030=normalizeContent(_0x155f4b?.[_0x34e649(-_0x157637._0x338a44,-0x24c,-_0x157637._0x3b653a,-_0x157637._0x4131ea)])['filter'](_0x165a75=>{const _0x3a5768={_0x2ad3cc:0x59a,_0x4ecfab:0xb7};function _0x1536fc(_0x5b2fd1,_0x1c9812,_0x11510f,_0x9ef2e){return _0x34e649(_0x5b2fd1-0x1a2,_0x1c9812-_0x3a5768._0x2ad3cc,_0x11510f,_0x9ef2e-_0x3a5768._0x4ecfab);}function _0xf8a43c(_0x36e020,_0x551ada,_0x4ff22b,_0x1d71bf){return _0x34e649(_0x36e020-_0x6a37f0._0x130806,_0x551ada-0x381,_0x36e020,_0x1d71bf-_0x6a37f0._0x4530ab);}return _0x165a75[_0xf8a43c(_0x8b5414._0x380142,0x13e,0x13c,0x133)]===_0xf8a43c(_0x8b5414._0x4b07c9,0x132,_0x8b5414._0x573e90,_0x8b5414._0x11a480);});function _0x34e649(_0x3ece94,_0xa9cd70,_0x2f2091,_0x53ff1a){return _0x5b2f(_0xa9cd70- -0x3e4,_0x2f2091);}function _0x402066(_0x42c17a,_0xabe8d2,_0x36a979,_0x3e81a0){return _0x5b2f(_0x36a979- -0x352,_0x42c17a);}if(_0x2a4030['length']===0x0)return void 0x0;return{'role':_0x402066(-_0x157637._0x3ed039,-0x1b8,-_0x157637._0x224fc1,-0x1ca),'content':_0x2a4030};}function createToolUseMessage(_0x368a33){const _0x37451c={_0x3ddfd1:0x1bb,_0x467ec0:0x1af,_0xc6550c:0x1b6,_0x2d02d0:0x1ac,_0x38575b:0x4ca,_0x125a7a:0x4b4,_0x375c8b:0x4bd,_0x1e4fd5:0x4d6},_0x16ee22={_0x4d9bac:0x344},_0x2495a7={_0x7fcb68:0xc8},_0x32a854={_0x23b21c:0x8},_0x30e7e0=normalizeContent(_0x368a33?.[_0x385407(0x1c7,_0x37451c._0x3ddfd1,0x1b3,0x1bd)])[_0x385407(_0x37451c._0x467ec0,0x1c4,_0x37451c._0xc6550c,_0x37451c._0x2d02d0)](_0x29daf8=>{function _0x131c22(_0x5acb8,_0x296266,_0x144de5,_0x361264){return _0x385407(_0x296266- -0x27d,_0x296266-_0x32a854._0x23b21c,_0x144de5,_0x361264-0xd0);}return _0x29daf8['type']===_0x131c22(-0xc8,-0xc1,-_0x2495a7._0x7fcb68,-0xcd);});function _0x2c4ef8(_0x4b022b,_0x3d6787,_0xd9063e,_0x47729a){return _0x5b2f(_0x4b022b-_0x16ee22._0x4d9bac,_0x3d6787);}if(_0x30e7e0[_0x385407(0x1ab,0x1a9,0x1a6,_0x37451c._0x3ddfd1)]===0x0)return void 0x0;function _0x385407(_0x11cf86,_0x42bc2a,_0x554565,_0x45a76c){return _0x5b2f(_0x11cf86-0x2f,_0x554565);}return{'role':_0x2c4ef8(_0x37451c._0x38575b,_0x37451c._0x125a7a,_0x37451c._0x375c8b,_0x37451c._0x1e4fd5),'content':_0x30e7e0};}function getTextFromMessage(_0x2d01b8){const _0x43b04f={_0x4d9151:0x24f,_0x41a034:0x243,_0x2b02fe:0x237,_0x4bebde:0x22e,_0x4b298e:0x252,_0x39cbaf:0x243,_0x43260a:0x263,_0x14894e:0xe1,_0x294fd5:0xda,_0x141c95:0xbe};function _0x61166(_0x5eeea3,_0x996ebe,_0x323a29,_0x167d49){return _0x5b2f(_0x323a29- -0x288,_0x996ebe);}function _0x24c832(_0x123204,_0x519aa0,_0x4b6a12,_0x3b288f){return _0x5b2f(_0x123204-0xb7,_0x3b288f);}return normalizeContent(_0x2d01b8?.[_0x24c832(_0x43b04f._0x4d9151,0x24d,_0x43b04f._0x41a034,0x23a)])[_0x24c832(_0x43b04f._0x2b02fe,_0x43b04f._0x4bebde,_0x43b04f._0x4b298e,0x250)](_0x4cbe45=>_0x4cbe45[_0x61166(-0xe2,-0xfe,-0xe7,-0xdd)]===_0x24c832(0x24c,0x261,0x241,0x25d))[_0x24c832(0x24a,_0x43b04f._0x39cbaf,0x235,_0x43b04f._0x43260a)](_0xecab55=>_0xecab55['text'])[_0x61166(-0xc3,-_0x43b04f._0x14894e,-_0x43b04f._0x294fd5,-_0x43b04f._0x141c95)]('\x0a');}function getReasoningTextFromMessage(_0x2d8bd0){const _0xb5449={_0x40300b:0xa5,_0x164a04:0x85,_0x165a8c:0x7b,_0x595ed8:0x6e},_0x4fe722={_0x5374a8:0x55a,_0x678684:0x573,_0x2b5a11:0x563,_0x6a5d31:0x571,_0x5181b9:0x12d,_0x293300:0xf6,_0x392447:0x112,_0x44a4b3:0x56b,_0x3a4212:0x114,_0x150741:0x102,_0x4a3bd1:0xfd,_0x1f4413:0xf1,_0x9abc4f:0xfe,_0x40f63a:0xf8,_0x2761ff:0x11f,_0x17afa0:0x10f,_0x3ea2f4:0x561,_0x32a5a0:0x55d,_0x370362:0x547,_0xcd1aa0:0x562,_0x126de2:0x55f,_0x2f4f8d:0x566,_0x17955c:0x115,_0x17ae35:0x10b,_0x21adf2:0x132,_0x26b5c3:0x117,_0x484765:0x569,_0x1cb3a1:0x568,_0x3d8002:0x107,_0x55e235:0xfe,_0x21db2c:0x57a,_0x19899f:0x579,_0x4cf51f:0x568,_0x585bbd:0x118,_0x553254:0x120},_0xf173a6={_0x54fec0:0x226},_0x3bc014={_0x5bf9f9:0x133};function _0x12a366(_0x100159,_0x2c5846,_0xfd58cc,_0x49be29){return _0x5b2f(_0x100159- -_0x3bc014._0x5bf9f9,_0xfd58cc);}function _0x514ca1(_0x1789b4,_0x7ef051,_0x1c948e,_0x43f30c){return _0x5b2f(_0x1789b4- -_0xf173a6._0x54fec0,_0x1c948e);}return normalizeContent(_0x2d8bd0?.[_0x514ca1(-0x8e,-_0xb5449._0x40300b,-_0xb5449._0x164a04,-0x7b)])['flatMap'](_0x319c8f=>{const _0x2a3c40={_0x2fd39b:0x5f9},_0x10f8eb={_0x59af4b:0x1a8,_0x457ebc:0x1f0,_0x4510cb:0x196};if(_0x319c8f[_0x2e3eed(0x576,0x57d,0x580,0x574)]==='anthropic_thinking')return _0x319c8f[_0x2e3eed(_0x4fe722._0x5374a8,0x569,_0x4fe722._0x678684,_0x4fe722._0x2b5a11)][_0x2e3eed(_0x4fe722._0x6a5d31,0x550,0x546,0x558)]()['length']>0x0?[_0x319c8f[_0x539ead(_0x4fe722._0x5181b9,_0x4fe722._0x293300,0x112,_0x4fe722._0x392447)]]:[];if(_0x319c8f[_0x2e3eed(_0x4fe722._0x44a4b3,0x564,0x56d,0x574)]===_0x539ead(_0x4fe722._0x3a4212,_0x4fe722._0x150741,0x10a,_0x4fe722._0x4a3bd1))return[_0x539ead(_0x4fe722._0x1f4413,_0x4fe722._0x9abc4f,_0x4fe722._0x40f63a,0xfc)];function _0x539ead(_0xd24fad,_0x18c9a7,_0x502ed6,_0x50bb63){return _0x514ca1(_0x50bb63-_0x10f8eb._0x59af4b,_0x18c9a7-_0x10f8eb._0x457ebc,_0x18c9a7,_0x50bb63-_0x10f8eb._0x4510cb);}function _0x2e3eed(_0x514408,_0x5b9657,_0x415dd8,_0x5656a5){return _0x514ca1(_0x5656a5-_0x2a3c40._0x2fd39b,_0x5b9657-0xbf,_0x5b9657,_0x5656a5-0x12a);}if(_0x319c8f[_0x539ead(0x138,_0x4fe722._0x2761ff,_0x4fe722._0x17afa0,0x123)]!=='openai_reasoning')return[];const _0x5e2f86=_0x319c8f[_0x2e3eed(_0x4fe722._0x3ea2f4,_0x4fe722._0x32a5a0,_0x4fe722._0x370362,0x55e)][_0x2e3eed(_0x4fe722._0xcd1aa0,_0x4fe722._0x126de2,_0x4fe722._0x6a5d31,_0x4fe722._0x2f4f8d)](_0xeb8cd3=>_0xeb8cd3[_0x539ead(0x12e,0x104,0x10b,0x117)])['filter'](_0x48846b=>_0x48846b[_0x539ead(0xf2,0xff,0xec,0x107)]()[_0x2e3eed(0x567,0x557,0x541,0x54f)]>0x0)[_0x539ead(0x115,_0x4fe722._0x17955c,0x13d,0x130)]('\x0a\x0a');if(_0x5e2f86[_0x539ead(0xfc,0xf0,0xed,_0x4fe722._0x9abc4f)]>0x0)return[_0x5e2f86];if(_0x319c8f[_0x539ead(0x12f,_0x4fe722._0x17ae35,_0x4fe722._0x21adf2,_0x4fe722._0x26b5c3)]&&_0x319c8f[_0x2e3eed(0x570,_0x4fe722._0x484765,0x567,_0x4fe722._0x1cb3a1)][_0x539ead(0xee,0xfe,0x11c,_0x4fe722._0x3d8002)]()[_0x539ead(_0x4fe722._0x40f63a,0x112,0x10b,_0x4fe722._0x55e235)]>0x0)return[_0x319c8f[_0x2e3eed(_0x4fe722._0x21db2c,0x572,_0x4fe722._0x19899f,_0x4fe722._0x4cf51f)]];return _0x319c8f[_0x539ead(0x10c,0x117,_0x4fe722._0x585bbd,_0x4fe722._0x553254)]?['(encrypted\x20reasoning)']:[];})[_0x12a366(0x7b,_0xb5449._0x165a8c,_0xb5449._0x595ed8,0x6e)]('\x0a\x0a');}function getToolUseBlocks(_0xcfcb11){const _0x43ca7b={_0x212451:0x186,_0x56f89f:0x17b};function _0x504e0a(_0x3c08a2,_0x3741c8,_0x100a1f,_0x219db2){return _0x5b2f(_0x3c08a2-0x6,_0x3741c8);}return normalizeContent(_0xcfcb11?.['content'])[_0x504e0a(_0x43ca7b._0x212451,0x191,0x192,_0x43ca7b._0x56f89f)](_0x575ccc=>_0x575ccc['type']==='tool_use');}function getToolResultBlocks(_0x5cf95c){const _0x58af38={_0x454c95:0xc1,_0x4c4f82:0xbf},_0x137b03={_0x5136ae:0x2f4};function _0x37d66a(_0x356c03,_0x107da7,_0x36f789,_0x28ec43){return _0x5b2f(_0x28ec43- -0x23f,_0x356c03);}function _0x489ca2(_0x4be0bb,_0x50df68,_0x5070fd,_0x516ddb){return _0x5b2f(_0x5070fd-_0x137b03._0x5136ae,_0x50df68);}return normalizeContent(_0x5cf95c?.['content'])[_0x37d66a(-_0x58af38._0x454c95,-0xdb,-0xab,-_0x58af38._0x4c4f82)](_0x4eae77=>_0x4eae77[_0x37d66a(-0x97,-0xb2,-0xa1,-0x9e)]===_0x489ca2(0x47a,0x46f,0x483,0x48d));}function _0x5b2f(_0x54763f,_0x17967f){_0x54763f=_0x54763f-0x179;const _0x4ad9bf=_0x4ad9();let _0x5b2fdb=_0x4ad9bf[_0x54763f];if(_0x5b2f['UZuMtC']===undefined){var _0x987f89=function(_0x12382a){const _0xb502a5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x584b36='',_0xb818cd='';for(let _0x1c85b3=0x0,_0x43b89b,_0x232c9c,_0x85dba9=0x0;_0x232c9c=_0x12382a['charAt'](_0x85dba9++);~_0x232c9c&&(_0x43b89b=_0x1c85b3%0x4?_0x43b89b*0x40+_0x232c9c:_0x232c9c,_0x1c85b3++%0x4)?_0x584b36+=String['fromCharCode'](0xff&_0x43b89b>>(-0x2*_0x1c85b3&0x6)):0x0){_0x232c9c=_0xb502a5['indexOf'](_0x232c9c);}for(let _0x52bb25=0x0,_0x4e264b=_0x584b36['length'];_0x52bb25<_0x4e264b;_0x52bb25++){_0xb818cd+='%'+('00'+_0x584b36['charCodeAt'](_0x52bb25)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xb818cd);};_0x5b2f['wmbLyu']=_0x987f89,_0x5b2f['PORrta']={},_0x5b2f['UZuMtC']=!![];}const _0x462852=_0x4ad9bf[0x0],_0x232b73=_0x54763f+_0x462852,_0x5754a5=_0x5b2f['PORrta'][_0x232b73];return!_0x5754a5?(_0x5b2fdb=_0x5b2f['wmbLyu'](_0x5b2fdb),_0x5b2f['PORrta'][_0x232b73]=_0x5b2fdb):_0x5b2fdb=_0x5754a5,_0x5b2fdb;}function createToolResultUserMessage(_0x31cf2a){const _0x352f17={_0x21966b:0x19d,_0x574371:0x1b5,_0xed9155:0x1a1,_0x4850a3:0x1b7,_0x4dcd6f:0x2a7,_0x21b530:0x2d9,_0x53a2af:0x2da};return{'role':'user','content':_0x31cf2a['map'](_0x24dea5=>{const _0x1a415c={_0x21cec3:0x330};function _0xcc7110(_0xd2e445,_0x42ce89,_0x5607a4,_0x2981d1){return _0x5b2f(_0x42ce89-0x123,_0x2981d1);}function _0x4e54dd(_0xfa9462,_0x438e85,_0x4cdfbb,_0x449cc5){return _0x5b2f(_0x4cdfbb- -_0x1a415c._0x21cec3,_0x449cc5);}return{'type':_0x4e54dd(-_0x352f17._0x21966b,-_0x352f17._0x574371,-_0x352f17._0xed9155,-0x1a8),'tool_use_id':_0x24dea5[_0x4e54dd(-0x1bd,-0x1c5,-_0x352f17._0x4850a3,-0x1b8)],'content':_0x24dea5[_0xcc7110(0x2d5,0x2bb,0x2cc,_0x352f17._0x4dcd6f)]??_0x24dea5['output'],'is_error':_0x24dea5[_0xcc7110(_0x352f17._0x21b530,0x2c2,0x2c6,_0x352f17._0x53a2af)]==='error'};})};}export{createTextBlock,normalizeTextBlock,normalizeContent,normalizeSystem,normalizeMessage,compileRequest,toChatRequest,toModelRequest,toProviderModelRequest,toChatResponse,toModelResponse,responseToAssistantMessage,createReasoningMessage,createAssistantTextMessage,createToolUseMessage,getTextFromMessage,getReasoningTextFromMessage,getToolUseBlocks,getToolResultBlocks,createToolResultUserMessage};
|