noumen 0.1.0 → 0.2.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.
Files changed (118) hide show
  1. package/README.md +767 -51
  2. package/dist/a2a/index.d.ts +148 -0
  3. package/dist/a2a/index.js +579 -0
  4. package/dist/a2a/index.js.map +1 -0
  5. package/dist/acp/index.d.ts +129 -0
  6. package/dist/acp/index.js +498 -0
  7. package/dist/acp/index.js.map +1 -0
  8. package/dist/agent-BrkbZyOT.d.ts +1028 -0
  9. package/dist/cache-DVqaCX8v.d.ts +38 -0
  10. package/dist/chunk-2ZTGQLYK.js +356 -0
  11. package/dist/chunk-2ZTGQLYK.js.map +1 -0
  12. package/dist/chunk-42PHHZUA.js +132 -0
  13. package/dist/chunk-42PHHZUA.js.map +1 -0
  14. package/dist/chunk-4SQA2UCV.js +26 -0
  15. package/dist/chunk-4SQA2UCV.js.map +1 -0
  16. package/dist/chunk-5GEX6ZSB.js +179 -0
  17. package/dist/chunk-5GEX6ZSB.js.map +1 -0
  18. package/dist/chunk-7ZMN7XJE.js +94 -0
  19. package/dist/chunk-7ZMN7XJE.js.map +1 -0
  20. package/dist/chunk-AMYIJSAZ.js +57 -0
  21. package/dist/chunk-AMYIJSAZ.js.map +1 -0
  22. package/dist/chunk-BGG2E6JD.js +10 -0
  23. package/dist/chunk-BGG2E6JD.js.map +1 -0
  24. package/dist/chunk-BZSFUEWM.js +43 -0
  25. package/dist/chunk-BZSFUEWM.js.map +1 -0
  26. package/dist/chunk-CPFHEPW4.js +139 -0
  27. package/dist/chunk-CPFHEPW4.js.map +1 -0
  28. package/dist/chunk-D43BWEZA.js +346 -0
  29. package/dist/chunk-D43BWEZA.js.map +1 -0
  30. package/dist/chunk-DGUM43GV.js +11 -0
  31. package/dist/chunk-DGUM43GV.js.map +1 -0
  32. package/dist/chunk-JACGEMTF.js +43 -0
  33. package/dist/chunk-JACGEMTF.js.map +1 -0
  34. package/dist/chunk-JX7CLUCV.js +21 -0
  35. package/dist/chunk-JX7CLUCV.js.map +1 -0
  36. package/dist/chunk-KXDB56YW.js +39 -0
  37. package/dist/chunk-KXDB56YW.js.map +1 -0
  38. package/dist/chunk-KY6ZPWHO.js +112 -0
  39. package/dist/chunk-KY6ZPWHO.js.map +1 -0
  40. package/dist/chunk-NBDFQYUZ.js +7992 -0
  41. package/dist/chunk-NBDFQYUZ.js.map +1 -0
  42. package/dist/chunk-OGXNFXFA.js +196 -0
  43. package/dist/chunk-OGXNFXFA.js.map +1 -0
  44. package/dist/chunk-QTJ7VTJY.js +1994 -0
  45. package/dist/chunk-QTJ7VTJY.js.map +1 -0
  46. package/dist/chunk-UVSSQBDY.js +192 -0
  47. package/dist/chunk-UVSSQBDY.js.map +1 -0
  48. package/dist/chunk-Y45R3PQL.js +684 -0
  49. package/dist/chunk-Y45R3PQL.js.map +1 -0
  50. package/dist/cli/index.d.ts +1 -0
  51. package/dist/cli/index.js +868 -0
  52. package/dist/cli/index.js.map +1 -0
  53. package/dist/client/index.d.ts +64 -0
  54. package/dist/client/index.js +409 -0
  55. package/dist/client/index.js.map +1 -0
  56. package/dist/client-CRRO2376.js +10 -0
  57. package/dist/client-CRRO2376.js.map +1 -0
  58. package/dist/headless-Q7XHHZIW.js +143 -0
  59. package/dist/headless-Q7XHHZIW.js.map +1 -0
  60. package/dist/history-snip-64GYP4ZL.js +12 -0
  61. package/dist/history-snip-64GYP4ZL.js.map +1 -0
  62. package/dist/index.d.ts +1305 -418
  63. package/dist/index.js +384 -1757
  64. package/dist/index.js.map +1 -1
  65. package/dist/jsonrpc/index.d.ts +54 -0
  66. package/dist/jsonrpc/index.js +34 -0
  67. package/dist/jsonrpc/index.js.map +1 -0
  68. package/dist/lsp/index.d.ts +36 -0
  69. package/dist/lsp/index.js +16 -0
  70. package/dist/lsp/index.js.map +1 -0
  71. package/dist/lsp-PS3BWIHC.js +8 -0
  72. package/dist/lsp-PS3BWIHC.js.map +1 -0
  73. package/dist/manager-DLXK63XC.js +8 -0
  74. package/dist/manager-DLXK63XC.js.map +1 -0
  75. package/dist/mcp/index.d.ts +111 -0
  76. package/dist/mcp/index.js +104 -0
  77. package/dist/mcp/index.js.map +1 -0
  78. package/dist/mcp-auth-AEI2R4ZC.js +9 -0
  79. package/dist/mcp-auth-AEI2R4ZC.js.map +1 -0
  80. package/dist/ollama-YNXAYP3R.js +18 -0
  81. package/dist/ollama-YNXAYP3R.js.map +1 -0
  82. package/dist/provider-factory-34MSWJZ3.js +20 -0
  83. package/dist/provider-factory-34MSWJZ3.js.map +1 -0
  84. package/dist/providers/anthropic.d.ts +19 -0
  85. package/dist/providers/anthropic.js +33 -0
  86. package/dist/providers/anthropic.js.map +1 -0
  87. package/dist/providers/bedrock.d.ts +39 -0
  88. package/dist/providers/bedrock.js +54 -0
  89. package/dist/providers/bedrock.js.map +1 -0
  90. package/dist/providers/gemini.d.ts +16 -0
  91. package/dist/providers/gemini.js +224 -0
  92. package/dist/providers/gemini.js.map +1 -0
  93. package/dist/providers/openai.d.ts +18 -0
  94. package/dist/providers/openai.js +8 -0
  95. package/dist/providers/openai.js.map +1 -0
  96. package/dist/providers/openrouter.d.ts +16 -0
  97. package/dist/providers/openrouter.js +23 -0
  98. package/dist/providers/openrouter.js.map +1 -0
  99. package/dist/providers/vertex.d.ts +40 -0
  100. package/dist/providers/vertex.js +64 -0
  101. package/dist/providers/vertex.js.map +1 -0
  102. package/dist/render-GRN4ZSSW.js +14 -0
  103. package/dist/render-GRN4ZSSW.js.map +1 -0
  104. package/dist/resolve-XM52G7YE.js +14 -0
  105. package/dist/resolve-XM52G7YE.js.map +1 -0
  106. package/dist/server/index.d.ts +128 -0
  107. package/dist/server/index.js +626 -0
  108. package/dist/server/index.js.map +1 -0
  109. package/dist/server-Cg1yWGaV.d.ts +96 -0
  110. package/dist/spinner-OJNR6NFO.js +8 -0
  111. package/dist/spinner-OJNR6NFO.js.map +1 -0
  112. package/dist/types-2kTLUCnD.d.ts +107 -0
  113. package/dist/types-3c88cRKH.d.ts +547 -0
  114. package/dist/types-CwKKucOF.d.ts +620 -0
  115. package/dist/types-DwdzmXfs.d.ts +107 -0
  116. package/dist/types-NIyVwQ4h.d.ts +109 -0
  117. package/dist/types-QwfylltH.d.ts +71 -0
  118. package/package.json +134 -6
@@ -0,0 +1,547 @@
1
+ /**
2
+ * USD cost per 1 million tokens for a given model.
3
+ */
4
+ interface ModelPricing {
5
+ inputTokens: number;
6
+ outputTokens: number;
7
+ cacheReadTokens?: number;
8
+ cacheWriteTokens?: number;
9
+ }
10
+ /**
11
+ * Token usage from a single API call, extending the base ChatCompletionUsage
12
+ * with cache and thinking token counts.
13
+ */
14
+ interface UsageRecord {
15
+ prompt_tokens: number;
16
+ completion_tokens: number;
17
+ total_tokens: number;
18
+ cache_read_tokens?: number;
19
+ cache_creation_tokens?: number;
20
+ thinking_tokens?: number;
21
+ }
22
+ /**
23
+ * Accumulated usage and cost for a single model.
24
+ */
25
+ interface ModelUsageSummary {
26
+ inputTokens: number;
27
+ outputTokens: number;
28
+ cacheReadTokens: number;
29
+ cacheCreationTokens: number;
30
+ costUSD: number;
31
+ }
32
+ /**
33
+ * Complete cost summary across all models in the session.
34
+ */
35
+ interface CostSummary {
36
+ totalCostUSD: number;
37
+ totalInputTokens: number;
38
+ totalOutputTokens: number;
39
+ totalCacheReadTokens: number;
40
+ totalCacheCreationTokens: number;
41
+ byModel: Record<string, ModelUsageSummary>;
42
+ duration: {
43
+ apiMs: number;
44
+ wallMs: number;
45
+ };
46
+ }
47
+
48
+ type UUID = string & {
49
+ readonly __brand: unique symbol;
50
+ };
51
+
52
+ type MemoryType = "user" | "project" | "feedback" | "reference";
53
+ interface MemoryEntry {
54
+ /** Short identifier used as the basis for the filename. */
55
+ name: string;
56
+ /** One-line summary of what this memory contains. */
57
+ description: string;
58
+ type: MemoryType;
59
+ /** Full markdown content of the memory (excluding frontmatter). */
60
+ content: string;
61
+ /** Relative path within the memory directory (e.g. `"user_prefs.md"`). */
62
+ path?: string;
63
+ updatedAt?: string;
64
+ }
65
+ interface MemoryProvider {
66
+ /** Load the MEMORY.md index content for system-prompt injection. */
67
+ loadIndex(): Promise<string>;
68
+ /** Load a single memory entry by its path within the memory directory. */
69
+ loadEntry(path: string): Promise<MemoryEntry | null>;
70
+ /** Write or update a memory entry and refresh the index. */
71
+ saveEntry(entry: MemoryEntry): Promise<void>;
72
+ /** Delete a memory entry and refresh the index. */
73
+ removeEntry(path: string): Promise<void>;
74
+ /** List all memory entries in the directory. */
75
+ listEntries(): Promise<MemoryEntry[]>;
76
+ /** Simple keyword search across entry names and content. */
77
+ search(query: string): Promise<MemoryEntry[]>;
78
+ }
79
+ interface MemoryConfig {
80
+ provider: MemoryProvider;
81
+ /** Run LLM-driven memory extraction after each turn (default: false). */
82
+ autoExtract?: boolean;
83
+ /** Maximum number of lines in the MEMORY.md index before truncation (default: 200). */
84
+ maxIndexLines?: number;
85
+ /** Inject the memory index into the system prompt (default: true). */
86
+ injectIntoSystemPrompt?: boolean;
87
+ }
88
+
89
+ /**
90
+ * File checkpointing types.
91
+ *
92
+ * Adapted from claude-code's fileHistory system. Key difference: all I/O
93
+ * routes through VirtualFs so checkpointing works in any sandbox (Docker,
94
+ * E2B, Sprites, local).
95
+ */
96
+ interface FileCheckpointBackup {
97
+ /** Backup filename under the session backup dir, or null if the file did not exist at this version. */
98
+ backupFileName: string | null;
99
+ version: number;
100
+ backupTime: string;
101
+ }
102
+ interface FileCheckpointSnapshot {
103
+ messageId: string;
104
+ /** Map of tracked file paths → their backup at this snapshot. */
105
+ trackedFileBackups: Record<string, FileCheckpointBackup>;
106
+ timestamp: string;
107
+ }
108
+ interface FileCheckpointState {
109
+ snapshots: FileCheckpointSnapshot[];
110
+ trackedFiles: Set<string>;
111
+ /**
112
+ * Monotonically-increasing counter incremented on every snapshot, even when
113
+ * old snapshots are evicted. Useful as an activity signal (snapshots.length
114
+ * plateaus once the cap is reached).
115
+ */
116
+ snapshotSequence: number;
117
+ }
118
+ interface CheckpointConfig {
119
+ enabled: boolean;
120
+ /** Maximum number of snapshots to retain before evicting oldest. Default: 100. */
121
+ maxSnapshots?: number;
122
+ /** Base directory for backup files. Default: ".noumen/checkpoints". */
123
+ backupDir?: string;
124
+ }
125
+ type DiffStats = {
126
+ filesChanged?: string[];
127
+ insertions: number;
128
+ deletions: number;
129
+ } | undefined;
130
+ declare function createCheckpointState(): FileCheckpointState;
131
+
132
+ interface TextContent {
133
+ type: "text";
134
+ text: string;
135
+ }
136
+ interface ImageContent {
137
+ type: "image";
138
+ /** base64-encoded image data */
139
+ data: string;
140
+ /** MIME type: "image/png", "image/jpeg", "image/gif", "image/webp" */
141
+ media_type: string;
142
+ }
143
+ interface ImageUrlContent {
144
+ type: "image_url";
145
+ /** URL pointing to an image */
146
+ url: string;
147
+ }
148
+ type ContentPart = TextContent | ImageContent | ImageUrlContent;
149
+ interface ToolCallContent {
150
+ id: string;
151
+ type: "function";
152
+ function: {
153
+ name: string;
154
+ arguments: string;
155
+ };
156
+ }
157
+ interface UserMessage {
158
+ role: "user";
159
+ content: string | ContentPart[];
160
+ }
161
+ interface AssistantMessage {
162
+ role: "assistant";
163
+ content: string | null;
164
+ tool_calls?: ToolCallContent[];
165
+ }
166
+ interface ToolResultMessage {
167
+ role: "tool";
168
+ tool_call_id: string;
169
+ content: string | ContentPart[];
170
+ }
171
+ interface SystemMessage {
172
+ role: "system";
173
+ content: string;
174
+ }
175
+ type ChatMessage = UserMessage | AssistantMessage | ToolResultMessage | SystemMessage;
176
+ interface SerializedMessage {
177
+ uuid: UUID;
178
+ parentUuid: UUID | null;
179
+ sessionId: string;
180
+ timestamp: string;
181
+ message: ChatMessage;
182
+ }
183
+ interface MessageEntry {
184
+ type: "message";
185
+ uuid: UUID;
186
+ parentUuid: UUID | null;
187
+ sessionId: string;
188
+ timestamp: string;
189
+ message: ChatMessage;
190
+ }
191
+ interface CompactBoundaryEntry {
192
+ type: "compact-boundary";
193
+ uuid: UUID;
194
+ sessionId: string;
195
+ timestamp: string;
196
+ }
197
+ interface SummaryEntry {
198
+ type: "summary";
199
+ uuid: UUID;
200
+ parentUuid: UUID | null;
201
+ sessionId: string;
202
+ timestamp: string;
203
+ message: ChatMessage;
204
+ }
205
+ interface CustomTitleEntry {
206
+ type: "custom-title";
207
+ sessionId: string;
208
+ title: string;
209
+ timestamp: string;
210
+ }
211
+ interface MetadataEntry {
212
+ type: "metadata";
213
+ sessionId: string;
214
+ timestamp: string;
215
+ key: string;
216
+ value: unknown;
217
+ }
218
+ interface ToolResultOverflowEntry {
219
+ type: "tool-result-overflow";
220
+ sessionId: string;
221
+ timestamp: string;
222
+ toolCallId: string;
223
+ originalContent: string;
224
+ }
225
+ interface FileCheckpointEntry {
226
+ type: "file-checkpoint";
227
+ sessionId: string;
228
+ timestamp: string;
229
+ messageId: string;
230
+ snapshot: FileCheckpointSnapshot;
231
+ isSnapshotUpdate: boolean;
232
+ }
233
+ interface SnipBoundaryEntry {
234
+ type: "snip-boundary";
235
+ sessionId: string;
236
+ timestamp: string;
237
+ snipMetadata: {
238
+ removedUuids: string[];
239
+ };
240
+ }
241
+ interface ContentReplacementRecord {
242
+ toolUseId: string;
243
+ replacement: string;
244
+ }
245
+ interface ContentReplacementEntry {
246
+ type: "content-replacement";
247
+ sessionId: string;
248
+ timestamp: string;
249
+ replacements: ContentReplacementRecord[];
250
+ }
251
+ type Entry = MessageEntry | CompactBoundaryEntry | SummaryEntry | CustomTitleEntry | MetadataEntry | ToolResultOverflowEntry | FileCheckpointEntry | ContentReplacementEntry | SnipBoundaryEntry;
252
+ interface SessionInfo {
253
+ sessionId: string;
254
+ createdAt: string;
255
+ lastMessageAt: string;
256
+ title?: string;
257
+ messageCount: number;
258
+ }
259
+ interface ToolResult {
260
+ content: string | ContentPart[];
261
+ isError?: boolean;
262
+ }
263
+ type StreamEvent = {
264
+ type: "text_delta";
265
+ text: string;
266
+ } | {
267
+ type: "tool_use_start";
268
+ toolName: string;
269
+ toolUseId: string;
270
+ } | {
271
+ type: "tool_use_delta";
272
+ input: string;
273
+ } | {
274
+ type: "tool_result";
275
+ toolUseId: string;
276
+ toolName: string;
277
+ result: ToolResult;
278
+ } | {
279
+ type: "message_complete";
280
+ message: AssistantMessage;
281
+ } | {
282
+ type: "usage";
283
+ usage: ChatCompletionUsage;
284
+ model: string;
285
+ } | {
286
+ type: "turn_complete";
287
+ usage: ChatCompletionUsage;
288
+ model: string;
289
+ callCount: number;
290
+ } | {
291
+ type: "compact_start";
292
+ } | {
293
+ type: "compact_complete";
294
+ } | {
295
+ type: "microcompact_complete";
296
+ tokensFreed: number;
297
+ } | {
298
+ type: "tool_result_truncated";
299
+ toolCallId: string;
300
+ originalChars: number;
301
+ truncatedChars: number;
302
+ } | {
303
+ type: "error";
304
+ error: Error;
305
+ } | {
306
+ type: "permission_request";
307
+ toolName: string;
308
+ input: Record<string, unknown>;
309
+ message: string;
310
+ } | {
311
+ type: "permission_granted";
312
+ toolName: string;
313
+ input: Record<string, unknown>;
314
+ } | {
315
+ type: "permission_denied";
316
+ toolName: string;
317
+ input: Record<string, unknown>;
318
+ message: string;
319
+ } | {
320
+ type: "thinking_delta";
321
+ text: string;
322
+ } | {
323
+ type: "cost_update";
324
+ summary: CostSummary;
325
+ } | {
326
+ type: "retry_attempt";
327
+ attempt: number;
328
+ maxRetries: number;
329
+ delayMs: number;
330
+ error: Error;
331
+ } | {
332
+ type: "retry_exhausted";
333
+ attempts: number;
334
+ error: Error;
335
+ } | {
336
+ type: "subagent_start";
337
+ toolUseId: string;
338
+ prompt: string;
339
+ } | {
340
+ type: "subagent_end";
341
+ toolUseId: string;
342
+ result: string;
343
+ } | {
344
+ type: "user_input_request";
345
+ toolUseId: string;
346
+ question: string;
347
+ } | {
348
+ type: "denial_limit_exceeded";
349
+ consecutiveDenials: number;
350
+ totalDenials: number;
351
+ } | {
352
+ type: "span_start";
353
+ name: string;
354
+ spanId: string;
355
+ } | {
356
+ type: "span_end";
357
+ name: string;
358
+ spanId: string;
359
+ durationMs: number;
360
+ error?: string;
361
+ } | {
362
+ type: "memory_update";
363
+ created: MemoryEntry[];
364
+ updated: MemoryEntry[];
365
+ deleted: string[];
366
+ } | {
367
+ type: "session_resumed";
368
+ sessionId: string;
369
+ messageCount: number;
370
+ } | {
371
+ type: "checkpoint_snapshot";
372
+ messageId: string;
373
+ } | {
374
+ type: "recovery_filtered";
375
+ filterName: string;
376
+ removedCount: number;
377
+ } | {
378
+ type: "interrupted_turn_detected";
379
+ kind: "interrupted_tool" | "interrupted_prompt";
380
+ } | {
381
+ type: "git_operation";
382
+ operation: "commit" | "push" | "pr_create" | "merge" | "rebase";
383
+ details: string;
384
+ } | {
385
+ type: "structured_output";
386
+ data: unknown;
387
+ schema: OutputFormat;
388
+ } | {
389
+ type: "max_turns_reached";
390
+ maxTurns: number;
391
+ turnCount: number;
392
+ };
393
+ interface RunOptions {
394
+ signal?: AbortSignal;
395
+ /**
396
+ * Maximum number of model-to-tool turns before the loop terminates.
397
+ * When exceeded, the thread yields a `max_turns_reached` event and stops.
398
+ */
399
+ maxTurns?: number;
400
+ /**
401
+ * Constrain the model to produce structured output.
402
+ *
403
+ * In `"alongside_tools"` mode (default), the outputFormat is passed
404
+ * directly to the provider on every model call — the model may still
405
+ * use tools alongside its structured response.
406
+ *
407
+ * In `"final_response"` mode, a synthetic `StructuredOutput` tool is
408
+ * injected. The agent loop continues using tools normally until the
409
+ * model calls StructuredOutput with the schema-conforming data. This
410
+ * is the recommended mode when the agent needs to reason and use
411
+ * tools before producing the final structured answer.
412
+ */
413
+ outputFormat?: OutputFormat;
414
+ /**
415
+ * Controls how structured output interacts with the tool loop.
416
+ * - `"alongside_tools"` (default): pass outputFormat to the provider;
417
+ * the model response itself is structured JSON.
418
+ * - `"final_response"`: inject a synthetic StructuredOutput tool; the
419
+ * model calls it to signal completion with structured data.
420
+ */
421
+ structuredOutputMode?: "alongside_tools" | "final_response";
422
+ }
423
+
424
+ type ThinkingConfig = {
425
+ type: "enabled";
426
+ budgetTokens: number;
427
+ } | {
428
+ type: "disabled";
429
+ };
430
+
431
+ interface ToolParameterProperty {
432
+ type: string;
433
+ description?: string;
434
+ enum?: string[];
435
+ default?: unknown;
436
+ minimum?: number;
437
+ maximum?: number;
438
+ }
439
+ interface ToolDefinition {
440
+ type: "function";
441
+ function: {
442
+ name: string;
443
+ description: string;
444
+ parameters: {
445
+ type: "object";
446
+ properties: Record<string, ToolParameterProperty>;
447
+ required?: string[];
448
+ };
449
+ };
450
+ }
451
+ interface ChatStreamDelta {
452
+ role?: "assistant";
453
+ content?: string | null;
454
+ thinking_content?: string | null;
455
+ thinking_signature?: string | null;
456
+ tool_calls?: Array<{
457
+ index: number;
458
+ id?: string;
459
+ type?: "function";
460
+ function?: {
461
+ name?: string;
462
+ arguments?: string;
463
+ };
464
+ }>;
465
+ }
466
+ interface ChatStreamChoice {
467
+ index: number;
468
+ delta: ChatStreamDelta;
469
+ finish_reason: string | null;
470
+ }
471
+ interface ChatStreamChunk {
472
+ id: string;
473
+ choices: ChatStreamChoice[];
474
+ model: string;
475
+ usage?: {
476
+ prompt_tokens: number;
477
+ completion_tokens: number;
478
+ total_tokens: number;
479
+ cache_read_tokens?: number;
480
+ cache_creation_tokens?: number;
481
+ thinking_tokens?: number;
482
+ };
483
+ }
484
+ interface ChatCompletionUsage {
485
+ prompt_tokens: number;
486
+ completion_tokens: number;
487
+ total_tokens: number;
488
+ cache_read_tokens?: number;
489
+ cache_creation_tokens?: number;
490
+ thinking_tokens?: number;
491
+ }
492
+ /**
493
+ * Structured output format. When provided, the model is constrained to
494
+ * produce a response matching the given JSON schema.
495
+ *
496
+ * - `json_schema`: the model must produce JSON conforming to the given schema.
497
+ * - `json_object`: the model must produce valid JSON (no specific schema).
498
+ */
499
+ type OutputFormat = JsonSchemaOutputFormat | JsonObjectOutputFormat;
500
+ interface JsonSchemaOutputFormat {
501
+ type: "json_schema";
502
+ /** JSON Schema object describing the expected output shape. */
503
+ schema: Record<string, unknown>;
504
+ /** Optional name for the schema (required by some providers). */
505
+ name?: string;
506
+ /** When true, the provider enforces strict schema adherence. */
507
+ strict?: boolean;
508
+ }
509
+ interface JsonObjectOutputFormat {
510
+ type: "json_object";
511
+ }
512
+ interface ChatParams {
513
+ model: string;
514
+ messages: ChatMessage[];
515
+ tools?: ToolDefinition[];
516
+ max_tokens?: number;
517
+ system?: string;
518
+ temperature?: number;
519
+ thinking?: ThinkingConfig;
520
+ /** Constrain the model to produce structured output matching this schema. */
521
+ outputFormat?: OutputFormat;
522
+ /**
523
+ * When true, the provider should place the cache breakpoint on the
524
+ * second-to-last message instead of the last. Used by subagent forks
525
+ * to avoid writing fork-only tails into the shared prompt cache.
526
+ */
527
+ skipCacheWrite?: boolean;
528
+ }
529
+ interface AIProvider {
530
+ chat(params: ChatParams): AsyncIterable<ChatStreamChunk>;
531
+ }
532
+ /**
533
+ * Extended error type that providers can throw to convey retry-relevant metadata.
534
+ * Consumers (like the retry engine) can inspect these fields without knowing
535
+ * provider-specific SDK error types.
536
+ */
537
+ declare class ChatStreamError extends Error {
538
+ status?: number;
539
+ retryAfter?: string;
540
+ constructor(message: string, opts?: {
541
+ status?: number;
542
+ retryAfter?: string;
543
+ cause?: unknown;
544
+ });
545
+ }
546
+
547
+ export { createCheckpointState as $, type AIProvider as A, type FileCheckpointBackup as B, type ChatParams as C, type DiffStats as D, type Entry as E, type FileCheckpointState as F, type FileCheckpointEntry as G, type ImageUrlContent as H, type ImageContent as I, type JsonSchemaOutputFormat as J, type JsonObjectOutputFormat as K, type MemoryType as L, type ModelPricing as M, type MessageEntry as N, type OutputFormat as O, type MetadataEntry as P, type SerializedMessage as Q, type RunOptions as R, type StreamEvent as S, type ToolDefinition as T, type UUID as U, type SnipBoundaryEntry as V, type SummaryEntry as W, type SystemMessage as X, type TextContent as Y, type ToolParameterProperty as Z, type UserMessage as _, type ChatStreamChunk as a, type ChatMessage as b, type CheckpointConfig as c, type FileCheckpointSnapshot as d, type ContentPart as e, type ContentReplacementRecord as f, type SessionInfo as g, type UsageRecord as h, type CostSummary as i, type ModelUsageSummary as j, type ChatCompletionUsage as k, type ThinkingConfig as l, type MemoryConfig as m, type ToolResult as n, type ToolCallContent as o, type MemoryProvider as p, type MemoryEntry as q, type AssistantMessage as r, type ToolResultMessage as s, type ToolResultOverflowEntry as t, type ChatStreamChoice as u, type ChatStreamDelta as v, ChatStreamError as w, type CompactBoundaryEntry as x, type ContentReplacementEntry as y, type CustomTitleEntry as z };