@meistrari/agent-sdk 0.2.0 → 0.3.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.
@@ -0,0 +1,665 @@
1
+ 'use strict';
2
+
3
+ const zod = require('zod');
4
+
5
+ function getDefaultExportFromCjs (x) {
6
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
7
+ }
8
+
9
+ var openrouterModels = [
10
+ {
11
+ id: "openai/gpt-5.5",
12
+ name: "OpenAI: GPT-5.5",
13
+ context_length: 1050000,
14
+ max_completion_tokens: 128000,
15
+ pricing: {
16
+ prompt_per_million: 5,
17
+ completion_per_million: 30,
18
+ input_cache_read_per_million: 0.5
19
+ },
20
+ supported_parameters: [
21
+ "include_reasoning",
22
+ "max_completion_tokens",
23
+ "max_tokens",
24
+ "reasoning",
25
+ "response_format",
26
+ "seed",
27
+ "structured_outputs",
28
+ "tool_choice",
29
+ "tools"
30
+ ],
31
+ modality: "text+image+file->text",
32
+ description: "GPT-5.5 is OpenAI’s frontier model designed for complex professional workloads, building on GPT-5.4 with stronger reasoning, higher reliability, and improved token efficiency on hard tasks. It features a 1M+ token..."
33
+ },
34
+ {
35
+ id: "openai/gpt-5.4",
36
+ name: "OpenAI: GPT-5.4",
37
+ context_length: 1050000,
38
+ max_completion_tokens: 128000,
39
+ pricing: {
40
+ prompt_per_million: 2.5,
41
+ completion_per_million: 15,
42
+ input_cache_read_per_million: 0.25
43
+ },
44
+ supported_parameters: [
45
+ "include_reasoning",
46
+ "max_completion_tokens",
47
+ "max_tokens",
48
+ "reasoning",
49
+ "response_format",
50
+ "seed",
51
+ "structured_outputs",
52
+ "tool_choice",
53
+ "tools"
54
+ ],
55
+ modality: "text+image+file->text",
56
+ description: "GPT-5.4 is OpenAI’s latest frontier model, unifying the Codex and GPT lines into a single system. It features a 1M+ token context window (922K input, 128K output) with support for..."
57
+ },
58
+ {
59
+ id: "openai/gpt-5.3-codex",
60
+ name: "OpenAI: GPT-5.3-Codex",
61
+ context_length: 400000,
62
+ max_completion_tokens: 128000,
63
+ pricing: {
64
+ prompt_per_million: 1.75,
65
+ completion_per_million: 14,
66
+ input_cache_read_per_million: 0.17
67
+ },
68
+ supported_parameters: [
69
+ "include_reasoning",
70
+ "max_completion_tokens",
71
+ "max_tokens",
72
+ "reasoning",
73
+ "response_format",
74
+ "seed",
75
+ "structured_outputs",
76
+ "tool_choice",
77
+ "tools"
78
+ ],
79
+ modality: "text+image+file->text",
80
+ description: "GPT-5.3-Codex is OpenAI’s most advanced agentic coding model, combining the frontier software engineering performance of GPT-5.2-Codex with the broader reasoning and professional knowledge capabilities of GPT-5.2. It achieves state-of-the-art results"
81
+ },
82
+ {
83
+ id: "google/gemini-3.5-flash",
84
+ name: "Google: Gemini 3.5 Flash",
85
+ context_length: 1048576,
86
+ max_completion_tokens: 65536,
87
+ pricing: {
88
+ prompt_per_million: 1.5,
89
+ completion_per_million: 9,
90
+ input_cache_read_per_million: 0.15
91
+ },
92
+ supported_parameters: [
93
+ "include_reasoning",
94
+ "max_tokens",
95
+ "reasoning",
96
+ "response_format",
97
+ "seed",
98
+ "stop",
99
+ "structured_outputs",
100
+ "temperature",
101
+ "tool_choice",
102
+ "tools",
103
+ "top_p"
104
+ ],
105
+ modality: "text+image+file+audio+video->text",
106
+ description: "Gemini 3.5 Flash is a fast multimodal Google model aimed at coding, reasoning, and parallel agent workflows with a Flash-tier cost profile."
107
+ },
108
+ {
109
+ id: "google/gemini-3-flash-preview",
110
+ name: "Google: Gemini 3 Flash Preview",
111
+ context_length: 1048576,
112
+ max_completion_tokens: 65536,
113
+ pricing: {
114
+ prompt_per_million: 0.5,
115
+ completion_per_million: 3,
116
+ input_cache_read_per_million: 0.05
117
+ },
118
+ supported_parameters: [
119
+ "include_reasoning",
120
+ "max_tokens",
121
+ "reasoning",
122
+ "response_format",
123
+ "seed",
124
+ "stop",
125
+ "structured_outputs",
126
+ "temperature",
127
+ "tool_choice",
128
+ "tools",
129
+ "top_p"
130
+ ],
131
+ modality: "text+image+file+audio+video->text",
132
+ description: "Gemini 3 Flash Preview is a high speed, high value thinking model designed for agentic workflows, multi turn chat, and coding assistance. It delivers near Pro level reasoning and tool..."
133
+ },
134
+ {
135
+ id: "google/gemini-3.1-pro-preview",
136
+ name: "Google: Gemini 3.1 Pro Preview",
137
+ context_length: 1048576,
138
+ max_completion_tokens: 65536,
139
+ pricing: {
140
+ prompt_per_million: 2,
141
+ completion_per_million: 12,
142
+ input_cache_read_per_million: 0.2
143
+ },
144
+ supported_parameters: [
145
+ "include_reasoning",
146
+ "max_tokens",
147
+ "reasoning",
148
+ "response_format",
149
+ "seed",
150
+ "stop",
151
+ "structured_outputs",
152
+ "temperature",
153
+ "tool_choice",
154
+ "tools",
155
+ "top_p"
156
+ ],
157
+ modality: "text+image+file+audio+video->text",
158
+ description: "Gemini 3.1 Pro Preview is Google’s frontier reasoning model, delivering enhanced software engineering performance, improved agentic reliability, and more efficient token usage across complex workflows. Building on the multimodal foundation..."
159
+ },
160
+ {
161
+ id: "xiaomi/mimo-v2-pro",
162
+ name: "Xiaomi: MiMo-V2-Pro",
163
+ context_length: 1048576,
164
+ max_completion_tokens: 131072,
165
+ pricing: {
166
+ prompt_per_million: 1,
167
+ completion_per_million: 3,
168
+ input_cache_read_per_million: 0.2
169
+ },
170
+ supported_parameters: [
171
+ "frequency_penalty",
172
+ "include_reasoning",
173
+ "max_tokens",
174
+ "presence_penalty",
175
+ "reasoning",
176
+ "response_format",
177
+ "stop",
178
+ "temperature",
179
+ "tool_choice",
180
+ "tools",
181
+ "top_p"
182
+ ],
183
+ modality: "text->text",
184
+ description: "MiMo-V2-Pro is Xiaomi's flagship foundation model, featuring over 1T total parameters and a 1M context length, deeply optimized for agentic scenarios. It is highly adaptable to general agent frameworks like..."
185
+ },
186
+ {
187
+ id: "xiaomi/mimo-v2-omni",
188
+ name: "Xiaomi: MiMo-V2-Omni",
189
+ context_length: 262144,
190
+ max_completion_tokens: 65536,
191
+ pricing: {
192
+ prompt_per_million: 0.4,
193
+ completion_per_million: 2,
194
+ input_cache_read_per_million: 0.08
195
+ },
196
+ supported_parameters: [
197
+ "frequency_penalty",
198
+ "include_reasoning",
199
+ "max_tokens",
200
+ "presence_penalty",
201
+ "reasoning",
202
+ "response_format",
203
+ "stop",
204
+ "temperature",
205
+ "tool_choice",
206
+ "tools",
207
+ "top_p"
208
+ ],
209
+ modality: "text+image+audio+video->text",
210
+ description: "MiMo-V2-Omni is a frontier omni-modal model that natively processes image, video, and audio inputs within a unified architecture. It combines strong multimodal perception with agentic capability - visual grounding, multi-step..."
211
+ },
212
+ {
213
+ id: "moonshotai/kimi-k2.5",
214
+ name: "MoonshotAI: Kimi K2.5",
215
+ context_length: 262144,
216
+ max_completion_tokens: 65535,
217
+ pricing: {
218
+ prompt_per_million: 0.38,
219
+ completion_per_million: 1.72,
220
+ input_cache_read_per_million: 0.19
221
+ },
222
+ supported_parameters: [
223
+ "frequency_penalty",
224
+ "include_reasoning",
225
+ "logit_bias",
226
+ "logprobs",
227
+ "max_tokens",
228
+ "min_p",
229
+ "parallel_tool_calls",
230
+ "presence_penalty",
231
+ "reasoning",
232
+ "repetition_penalty",
233
+ "response_format",
234
+ "seed",
235
+ "stop",
236
+ "structured_outputs",
237
+ "temperature",
238
+ "tool_choice",
239
+ "tools",
240
+ "top_k",
241
+ "top_logprobs",
242
+ "top_p"
243
+ ],
244
+ modality: "text+image->text",
245
+ description: "Kimi K2.5 is Moonshot AI's native multimodal model, delivering state-of-the-art visual coding capability and a self-directed agent swarm paradigm. Built on Kimi K2 with continued pretraining over approximately 15T mixed..."
246
+ },
247
+ {
248
+ id: "moonshotai/kimi-k2-thinking",
249
+ name: "MoonshotAI: Kimi K2 Thinking",
250
+ context_length: 262144,
251
+ max_completion_tokens: null,
252
+ pricing: {
253
+ prompt_per_million: 0.6,
254
+ completion_per_million: 2.5
255
+ },
256
+ supported_parameters: [
257
+ "frequency_penalty",
258
+ "include_reasoning",
259
+ "logit_bias",
260
+ "max_tokens",
261
+ "min_p",
262
+ "presence_penalty",
263
+ "reasoning",
264
+ "repetition_penalty",
265
+ "response_format",
266
+ "seed",
267
+ "stop",
268
+ "structured_outputs",
269
+ "temperature",
270
+ "tool_choice",
271
+ "tools",
272
+ "top_k",
273
+ "top_p"
274
+ ],
275
+ modality: "text->text",
276
+ description: "Kimi K2 Thinking is Moonshot AI’s most advanced open reasoning model to date, extending the K2 series into agentic, long-horizon reasoning. Built on the trillion-parameter Mixture-of-Experts (MoE) architecture introduced in..."
277
+ },
278
+ {
279
+ id: "moonshotai/kimi-k2-0905",
280
+ name: "MoonshotAI: Kimi K2 0905",
281
+ context_length: 262144,
282
+ max_completion_tokens: 262144,
283
+ pricing: {
284
+ prompt_per_million: 0.4,
285
+ completion_per_million: 2
286
+ },
287
+ supported_parameters: [
288
+ "frequency_penalty",
289
+ "logit_bias",
290
+ "logprobs",
291
+ "max_tokens",
292
+ "min_p",
293
+ "presence_penalty",
294
+ "repetition_penalty",
295
+ "response_format",
296
+ "seed",
297
+ "stop",
298
+ "structured_outputs",
299
+ "temperature",
300
+ "tool_choice",
301
+ "tools",
302
+ "top_k",
303
+ "top_logprobs",
304
+ "top_p"
305
+ ],
306
+ modality: "text->text",
307
+ description: "Kimi K2 0905 is the September update of [Kimi K2 0711](moonshotai/kimi-k2). It is a large-scale Mixture-of-Experts (MoE) language model developed by Moonshot AI, featuring 1 trillion total parameters with 32..."
308
+ },
309
+ {
310
+ id: "z-ai/glm-5.1",
311
+ name: "Z.ai: GLM 5.1",
312
+ context_length: 202752,
313
+ max_completion_tokens: 131072,
314
+ pricing: {
315
+ prompt_per_million: 1.4,
316
+ completion_per_million: 4.4,
317
+ input_cache_read_per_million: 0.26
318
+ },
319
+ supported_parameters: [
320
+ "frequency_penalty",
321
+ "include_reasoning",
322
+ "logit_bias",
323
+ "logprobs",
324
+ "max_tokens",
325
+ "min_p",
326
+ "presence_penalty",
327
+ "reasoning",
328
+ "repetition_penalty",
329
+ "response_format",
330
+ "seed",
331
+ "stop",
332
+ "structured_outputs",
333
+ "temperature",
334
+ "tool_choice",
335
+ "tools",
336
+ "top_k",
337
+ "top_logprobs",
338
+ "top_p"
339
+ ],
340
+ modality: "text->text",
341
+ description: "GLM-5.1 delivers a major leap in coding capability, with particularly significant gains in handling long-horizon tasks. Unlike previous models built around minute-level interactions, GLM-5.1 can work independently and continuously on..."
342
+ },
343
+ {
344
+ id: "z-ai/glm-5v-turbo",
345
+ name: "Z.ai: GLM 5V Turbo",
346
+ context_length: 202752,
347
+ max_completion_tokens: 131072,
348
+ pricing: {
349
+ prompt_per_million: 1.2,
350
+ completion_per_million: 4,
351
+ input_cache_read_per_million: 0.24
352
+ },
353
+ supported_parameters: [
354
+ "include_reasoning",
355
+ "max_tokens",
356
+ "reasoning",
357
+ "response_format",
358
+ "temperature",
359
+ "tool_choice",
360
+ "tools",
361
+ "top_p"
362
+ ],
363
+ modality: "text+image+video->text",
364
+ description: "GLM-5V-Turbo is Z.ai’s first native multimodal agent foundation model, built for vision-based coding and agent-driven tasks. It natively handles image, video, and text inputs, excels at long-horizon planning, complex coding,..."
365
+ },
366
+ {
367
+ id: "minimax/minimax-m2.7",
368
+ name: "MiniMax: MiniMax M2.7",
369
+ context_length: 204800,
370
+ max_completion_tokens: 131072,
371
+ pricing: {
372
+ prompt_per_million: 0.3,
373
+ completion_per_million: 1.2,
374
+ input_cache_read_per_million: 0.06
375
+ },
376
+ supported_parameters: [
377
+ "include_reasoning",
378
+ "max_tokens",
379
+ "reasoning",
380
+ "response_format",
381
+ "temperature",
382
+ "tool_choice",
383
+ "tools",
384
+ "top_p"
385
+ ],
386
+ modality: "text->text",
387
+ description: "MiniMax-M2.7 is a next-generation large language model designed for autonomous, real-world productivity and continuous improvement. Built to actively participate in its own evolution, M2.7 integrates advanced agentic capabilities through multi-agent."
388
+ },
389
+ {
390
+ id: "minimax/minimax-m2.5",
391
+ name: "MiniMax: MiniMax M2.5",
392
+ context_length: 196608,
393
+ max_completion_tokens: 65536,
394
+ pricing: {
395
+ prompt_per_million: 0.12,
396
+ completion_per_million: 0.99,
397
+ input_cache_read_per_million: 0.06
398
+ },
399
+ supported_parameters: [
400
+ "frequency_penalty",
401
+ "include_reasoning",
402
+ "logit_bias",
403
+ "logprobs",
404
+ "max_tokens",
405
+ "min_p",
406
+ "parallel_tool_calls",
407
+ "presence_penalty",
408
+ "reasoning",
409
+ "reasoning_effort",
410
+ "repetition_penalty",
411
+ "response_format",
412
+ "seed",
413
+ "stop",
414
+ "structured_outputs",
415
+ "temperature",
416
+ "tool_choice",
417
+ "tools",
418
+ "top_k",
419
+ "top_logprobs",
420
+ "top_p"
421
+ ],
422
+ modality: "text->text",
423
+ description: "MiniMax-M2.5 is a SOTA large language model designed for real-world productivity. Trained in a diverse range of complex real-world digital working environments, M2.5 builds upon the coding expertise of M2.1..."
424
+ }
425
+ ];
426
+
427
+ const openrouterCatalog = /*@__PURE__*/getDefaultExportFromCjs(openrouterModels);
428
+
429
+ const nativeAnthropicModelIds = [
430
+ "claude-sonnet-4-5",
431
+ "claude-sonnet-4-6",
432
+ "claude-haiku-4-5",
433
+ "claude-opus-4-6",
434
+ "claude-opus-4-7",
435
+ "claude-opus-4-8"
436
+ ];
437
+ const nativeModelSchema = zod.z.enum(nativeAnthropicModelIds);
438
+ const openrouterModelCatalog = openrouterCatalog;
439
+ const openrouterModelIds = openrouterCatalog.map((entry) => entry.id);
440
+ const modelSchema = zod.z.enum([
441
+ ...nativeAnthropicModelIds,
442
+ ...openrouterModelIds
443
+ ]);
444
+
445
+ const vaultReferenceSchema = zod.z.string().regex(/^vault:\/\/\S+$/, "vaultRef must start with vault:// and cannot contain whitespace");
446
+ const agentInputSchema = zod.z.object({
447
+ vaultRef: vaultReferenceSchema,
448
+ filename: zod.z.string().min(1, "Filename is required").max(255, "Filename must be 255 characters or less"),
449
+ metadata: zod.z.string().max(16384, "Metadata must be 16,384 characters or less").optional()
450
+ }).strict();
451
+ const executeAgentRequestSchema = zod.z.object({
452
+ sessionId: zod.z.string().uuid().optional(),
453
+ organizationName: zod.z.string().min(1).max(200).optional(),
454
+ repository: zod.z.string().min(1).max(200).optional(),
455
+ ref: zod.z.string().max(200).optional(),
456
+ message: zod.z.string().min(1).max(8e5).optional(),
457
+ inputs: zod.z.array(agentInputSchema).optional(),
458
+ environmentVariables: zod.z.record(zod.z.string(), zod.z.string()).optional(),
459
+ recover: zod.z.boolean().optional()
460
+ }).strict().superRefine((data, ctx) => {
461
+ if (!data.sessionId) {
462
+ if (!data.organizationName) {
463
+ ctx.addIssue({ code: "custom", message: "organizationName is required for new sessions", path: ["organizationName"] });
464
+ }
465
+ if (!data.repository) {
466
+ ctx.addIssue({ code: "custom", message: "repository is required for new sessions", path: ["repository"] });
467
+ }
468
+ if (!data.message) {
469
+ ctx.addIssue({ code: "custom", message: "message is required for new sessions", path: ["message"] });
470
+ }
471
+ } else if (!data.recover && !data.message) {
472
+ ctx.addIssue({ code: "custom", message: "message is required for session continuations", path: ["message"] });
473
+ }
474
+ if (data.recover && !data.sessionId) {
475
+ ctx.addIssue({ code: "custom", message: "sessionId is required when recover is true", path: ["sessionId"] });
476
+ }
477
+ });
478
+ const executeAgentSuccessResponseSchema = zod.z.object({
479
+ success: zod.z.literal(true),
480
+ sessionId: zod.z.string()
481
+ });
482
+ const executeAgentErrorResponseSchema = zod.z.object({
483
+ success: zod.z.literal(false),
484
+ error: zod.z.string()
485
+ });
486
+ const executeAgentResponseSchema = zod.z.discriminatedUnion("success", [
487
+ executeAgentSuccessResponseSchema,
488
+ executeAgentErrorResponseSchema
489
+ ]);
490
+ const repositoryNameSchema = zod.z.string().min(1, "Repository is required").max(200, "Repository must be 200 characters or less").regex(/^[\w.-]+$/, "Repository contains unsupported characters");
491
+ const updateAgentModelRequestSchema = zod.z.object({
492
+ repository: repositoryNameSchema,
493
+ model: modelSchema,
494
+ commitMessage: zod.z.string().max(4096, "Commit message must be 4096 characters or less").optional()
495
+ }).strict();
496
+ const updateAgentModelSuccessResponseSchema = zod.z.object({
497
+ success: zod.z.literal(true).describe("Whether the model update succeeded"),
498
+ organizationName: zod.z.string().optional().describe("Resolved Forgejo organization name"),
499
+ repository: zod.z.string().optional().describe("Forgejo repository name"),
500
+ branch: zod.z.string().optional().describe("Branch written to"),
501
+ commitHash: zod.z.string().optional().describe("Commit hash after update"),
502
+ model: modelSchema.optional().describe("Configured model after update"),
503
+ providerTemplate: zod.z.string().optional().describe("Provider template selected from the model prefix"),
504
+ templateSynced: zod.z.boolean().optional().describe("Whether managed template files were synchronized"),
505
+ files: zod.z.array(zod.z.string()).optional().describe("Files written by the update"),
506
+ deletedFiles: zod.z.array(zod.z.string()).optional().describe("Files deleted by the update")
507
+ });
508
+ const updateAgentModelErrorResponseSchema = zod.z.object({
509
+ success: zod.z.literal(false).describe("Whether the model update succeeded"),
510
+ error: zod.z.string().describe("Error message if the request failed")
511
+ });
512
+ const updateAgentModelResponseSchema = zod.z.discriminatedUnion("success", [
513
+ updateAgentModelSuccessResponseSchema,
514
+ updateAgentModelErrorResponseSchema
515
+ ]);
516
+
517
+ const sessionStatusSchema = zod.z.enum([
518
+ "pending",
519
+ "running",
520
+ "completed",
521
+ "failed",
522
+ "waiting_messages",
523
+ "cancelled"
524
+ ]);
525
+ const sessionTimelineIdSchema = zod.z.string().min(1, "Session ID is required");
526
+ const timelineMetricsSchema = zod.z.object({
527
+ durationMs: zod.z.number().describe("Total execution duration in milliseconds"),
528
+ toolCalls: zod.z.number().describe("Total number of tool calls"),
529
+ apiCalls: zod.z.number().describe("Total number of API calls to the model"),
530
+ tokensIn: zod.z.number().describe("Total input tokens"),
531
+ tokensOut: zod.z.number().describe("Total output tokens"),
532
+ cachedTokens: zod.z.number().describe("Total cached input tokens"),
533
+ totalCostUsd: zod.z.number().describe("Total cost in USD"),
534
+ cacheSavingsUsd: zod.z.number().describe("Estimated savings from prompt caching in USD")
535
+ });
536
+ const timelinePromptSchema = zod.z.object({
537
+ model: zod.z.string().nullable().describe("Model used for the session"),
538
+ claudeSessionId: zod.z.string().nullable().describe("Claude Code internal session ID"),
539
+ timestamp: zod.z.number().nullable().describe("Timestamp of session start (epoch ms)"),
540
+ text: zod.z.string().nullable().describe("Initial user prompt text")
541
+ });
542
+ const timelineToolResultSchema = zod.z.object({
543
+ output: zod.z.string().describe("Tool execution output"),
544
+ isError: zod.z.boolean().describe("Whether the tool execution resulted in an error"),
545
+ durationMs: zod.z.number().describe("Real tool execution duration in milliseconds. Tool calls inside a run_turn may run in parallel, so summing tool durations is not the same as run_turn duration.")
546
+ });
547
+ const timelineRunTurnMetricsSchema = zod.z.object({
548
+ tokensIn: zod.z.number().describe("Input tokens used by model API responses in this run_turn"),
549
+ tokensOut: zod.z.number().describe("Output tokens used by model API responses in this run_turn"),
550
+ cachedTokens: zod.z.number().describe("Cached input tokens used by model API responses in this run_turn"),
551
+ costUsd: zod.z.number().describe("Estimated model API cost in USD for this run_turn"),
552
+ toolCallCount: zod.z.number().describe("Number of tool_call events in this run_turn"),
553
+ apiCallCount: zod.z.number().describe("Number of api_response events in this run_turn")
554
+ });
555
+ const timelineEventSchema = zod.z.object({
556
+ type: zod.z.enum(["api_response", "tool_call", "text", "thinking", "tool_result"]).describe("Event type. text, api_response, and thinking are point-in-time events; tool_call carries a result duration and tool_result is the lightweight completion marker merged by callId."),
557
+ relativeTimeMs: zod.z.number().describe("Milliseconds since the beginning of the session_loop, anchored at the first turn"),
558
+ timestamp: zod.z.number().describe("Absolute timestamp (epoch ms)"),
559
+ sequenceIndex: zod.z.number().int().nonnegative().describe("Stable chronological order within the events array, used to break ties when multiple events have the same timestamp"),
560
+ runTurnId: zod.z.string().nullable().describe("ID of the run_turn span this event belongs to"),
561
+ toolName: zod.z.string().optional().describe("Tool name (e.g. exec_command, Read, Write)"),
562
+ callId: zod.z.string().optional().describe("Tool call ID for correlating with results"),
563
+ arguments: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Tool call arguments"),
564
+ displaySummary: zod.z.string().nullable().optional().describe("Backend-formatted summary for tool_call display, such as file path, command, pattern, URL, or query"),
565
+ category: zod.z.enum(["file", "shell", "search", "edit", "web", "other"]).optional().describe("Backend-classified tool_call category for UI iconography"),
566
+ status: zod.z.enum(["success", "failed", "cancelled", "timeout"]).optional().describe("Explicit tool_call status when known"),
567
+ result: timelineToolResultSchema.optional().describe("Tool execution result"),
568
+ text: zod.z.string().nullable().optional().describe("Text content for assistant text and thinking events. api_response is a call marker and does not duplicate content blocks."),
569
+ tokensIn: zod.z.number().optional().describe("Input tokens for api_response events"),
570
+ tokensOut: zod.z.number().optional().describe("Output tokens for api_response events"),
571
+ cachedTokens: zod.z.number().optional().describe("Cached input tokens for api_response events"),
572
+ costUsd: zod.z.number().optional().describe("Estimated cost in USD for api_response events")
573
+ });
574
+ const timelineSpanSchema = zod.z.object({
575
+ type: zod.z.enum(["session_loop", "session_task_turn", "run_turn", "wait"]).describe("Span type. run_turn represents one model API call until the next model API call and includes thinking plus parallel tool calls."),
576
+ id: zod.z.string().describe("Unique span identifier"),
577
+ parentId: zod.z.string().nullable().describe("Parent span ID for hierarchy"),
578
+ startMs: zod.z.number().describe("Start time relative to session start (ms)"),
579
+ endMs: zod.z.number().describe("End time relative to session start (ms)"),
580
+ metrics: timelineRunTurnMetricsSchema.optional().describe("Aggregated metrics present on run_turn spans")
581
+ });
582
+ const sessionTimelineResponseSchema = zod.z.object({
583
+ sessionId: zod.z.string(),
584
+ status: zod.z.string(),
585
+ metrics: timelineMetricsSchema,
586
+ prompt: timelinePromptSchema,
587
+ spans: zod.z.array(timelineSpanSchema)
588
+ });
589
+ const sessionStatusEventSchema = zod.z.object({
590
+ kind: zod.z.literal("status"),
591
+ sessionId: zod.z.string(),
592
+ status: sessionStatusSchema,
593
+ error: zod.z.string().optional(),
594
+ createdAt: zod.z.number(),
595
+ updatedAt: zod.z.number()
596
+ });
597
+ const sessionStepsEventSchema = zod.z.object({
598
+ kind: zod.z.literal("steps"),
599
+ sessionId: zod.z.string(),
600
+ status: sessionStatusSchema,
601
+ steps: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())),
602
+ nextCursor: zod.z.number().nullable(),
603
+ createdAt: zod.z.number(),
604
+ updatedAt: zod.z.number()
605
+ });
606
+ const sessionResultEventSchema = zod.z.object({
607
+ kind: zod.z.literal("result"),
608
+ sessionId: zod.z.string(),
609
+ status: zod.z.enum(["completed", "waiting_messages"]),
610
+ result: zod.z.record(zod.z.string(), zod.z.unknown()),
611
+ nextCursor: zod.z.number().nullable(),
612
+ createdAt: zod.z.number(),
613
+ updatedAt: zod.z.number()
614
+ });
615
+ const sessionErrorEventSchema = zod.z.object({
616
+ kind: zod.z.literal("error"),
617
+ sessionId: zod.z.string(),
618
+ error: zod.z.string()
619
+ });
620
+ const sessionTimelineFinalizeEventSchema = zod.z.object({
621
+ kind: zod.z.literal("timeline-finalize"),
622
+ sessionId: zod.z.string(),
623
+ status: sessionStatusSchema,
624
+ metrics: timelineMetricsSchema.nullable().optional(),
625
+ prompt: timelinePromptSchema.nullable().optional(),
626
+ spans: zod.z.array(timelineSpanSchema).nullable().optional(),
627
+ events: zod.z.array(timelineEventSchema).nullable().optional(),
628
+ continuation: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
629
+ createdAt: zod.z.number(),
630
+ updatedAt: zod.z.number()
631
+ });
632
+ const sessionStreamEventSchema = zod.z.discriminatedUnion("kind", [
633
+ sessionStatusEventSchema,
634
+ sessionStepsEventSchema,
635
+ sessionResultEventSchema,
636
+ sessionTimelineFinalizeEventSchema,
637
+ sessionErrorEventSchema
638
+ ]);
639
+ const SESSION_STREAM_EVENT_KINDS = /* @__PURE__ */ new Set(["status", "steps", "result", "timeline-finalize", "error"]);
640
+
641
+ exports.SESSION_STREAM_EVENT_KINDS = SESSION_STREAM_EVENT_KINDS;
642
+ exports.agentInputSchema = agentInputSchema;
643
+ exports.executeAgentErrorResponseSchema = executeAgentErrorResponseSchema;
644
+ exports.executeAgentRequestSchema = executeAgentRequestSchema;
645
+ exports.executeAgentResponseSchema = executeAgentResponseSchema;
646
+ exports.executeAgentSuccessResponseSchema = executeAgentSuccessResponseSchema;
647
+ exports.modelSchema = modelSchema;
648
+ exports.nativeAnthropicModelIds = nativeAnthropicModelIds;
649
+ exports.nativeModelSchema = nativeModelSchema;
650
+ exports.openrouterModelCatalog = openrouterModelCatalog;
651
+ exports.openrouterModelIds = openrouterModelIds;
652
+ exports.sessionStatusSchema = sessionStatusSchema;
653
+ exports.sessionStreamEventSchema = sessionStreamEventSchema;
654
+ exports.sessionTimelineIdSchema = sessionTimelineIdSchema;
655
+ exports.sessionTimelineResponseSchema = sessionTimelineResponseSchema;
656
+ exports.timelineEventSchema = timelineEventSchema;
657
+ exports.timelineMetricsSchema = timelineMetricsSchema;
658
+ exports.timelinePromptSchema = timelinePromptSchema;
659
+ exports.timelineRunTurnMetricsSchema = timelineRunTurnMetricsSchema;
660
+ exports.timelineSpanSchema = timelineSpanSchema;
661
+ exports.timelineToolResultSchema = timelineToolResultSchema;
662
+ exports.updateAgentModelErrorResponseSchema = updateAgentModelErrorResponseSchema;
663
+ exports.updateAgentModelRequestSchema = updateAgentModelRequestSchema;
664
+ exports.updateAgentModelResponseSchema = updateAgentModelResponseSchema;
665
+ exports.updateAgentModelSuccessResponseSchema = updateAgentModelSuccessResponseSchema;