noumen 0.2.0 → 0.4.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 (83) hide show
  1. package/README.md +95 -16
  2. package/dist/a2a/index.d.ts +5 -5
  3. package/dist/a2a/index.js +3 -3
  4. package/dist/a2a/index.js.map +1 -1
  5. package/dist/acp/index.d.ts +5 -5
  6. package/dist/acp/index.js +4 -4
  7. package/dist/acp/index.js.map +1 -1
  8. package/dist/{agent-BrkbZyOT.d.ts → agent-1nFVUP9E.d.ts} +319 -15
  9. package/dist/{cache-DVqaCX8v.d.ts → cache-DsRqxx6v.d.ts} +1 -1
  10. package/dist/{chunk-BGG2E6JD.js → chunk-3HEYCV26.js} +1 -1
  11. package/dist/chunk-3SK5GCI6.js +75 -0
  12. package/dist/chunk-3SK5GCI6.js.map +1 -0
  13. package/dist/{chunk-NBDFQYUZ.js → chunk-4HW6LN6D.js} +4784 -2411
  14. package/dist/chunk-4HW6LN6D.js.map +1 -0
  15. package/dist/{chunk-7ZMN7XJE.js → chunk-5JN4SPI7.js} +6 -6
  16. package/dist/chunk-5JN4SPI7.js.map +1 -0
  17. package/dist/{chunk-CPFHEPW4.js → chunk-CS6WNDCF.js} +73 -41
  18. package/dist/chunk-CS6WNDCF.js.map +1 -0
  19. package/dist/chunk-EKOGVTBT.js +472 -0
  20. package/dist/chunk-EKOGVTBT.js.map +1 -0
  21. package/dist/{chunk-KY6ZPWHO.js → chunk-HEQQQGK5.js} +47 -28
  22. package/dist/chunk-HEQQQGK5.js.map +1 -0
  23. package/dist/{chunk-QTJ7VTJY.js → chunk-HL6JCRZJ.js} +1599 -481
  24. package/dist/chunk-HL6JCRZJ.js.map +1 -0
  25. package/dist/chunk-L3L3FG5T.js +16 -0
  26. package/dist/chunk-L3L3FG5T.js.map +1 -0
  27. package/dist/cli/index.js +36 -30
  28. package/dist/cli/index.js.map +1 -1
  29. package/dist/client/index.d.ts +2 -2
  30. package/dist/{headless-Q7XHHZIW.js → headless-FFU2DESQ.js} +3 -4
  31. package/dist/headless-FFU2DESQ.js.map +1 -0
  32. package/dist/index.d.ts +218 -68
  33. package/dist/index.js +37 -23
  34. package/dist/lsp/index.d.ts +4 -4
  35. package/dist/mcp/index.d.ts +5 -5
  36. package/dist/mcp/index.js +2 -1
  37. package/dist/mcp/index.js.map +1 -1
  38. package/dist/{provider-factory-34MSWJZ3.js → provider-factory-KCLIF34X.js} +2 -2
  39. package/dist/providers/anthropic.d.ts +2 -2
  40. package/dist/providers/anthropic.js +5 -3
  41. package/dist/providers/anthropic.js.map +1 -1
  42. package/dist/providers/bedrock.d.ts +2 -2
  43. package/dist/providers/bedrock.js +5 -3
  44. package/dist/providers/bedrock.js.map +1 -1
  45. package/dist/providers/gemini.d.ts +2 -1
  46. package/dist/providers/gemini.js +133 -95
  47. package/dist/providers/gemini.js.map +1 -1
  48. package/dist/providers/ollama.d.ts +13 -0
  49. package/dist/{ollama-YNXAYP3R.js → providers/ollama.js} +6 -4
  50. package/dist/providers/ollama.js.map +1 -0
  51. package/dist/providers/openai.d.ts +4 -1
  52. package/dist/providers/openai.js +2 -1
  53. package/dist/providers/openrouter.d.ts +1 -1
  54. package/dist/providers/openrouter.js +2 -1
  55. package/dist/providers/openrouter.js.map +1 -1
  56. package/dist/providers/vertex.d.ts +4 -2
  57. package/dist/providers/vertex.js +6 -3
  58. package/dist/providers/vertex.js.map +1 -1
  59. package/dist/{resolve-XM52G7YE.js → resolve-4JA2BBDA.js} +2 -2
  60. package/dist/server/index.d.ts +35 -20
  61. package/dist/server/index.js +276 -207
  62. package/dist/server/index.js.map +1 -1
  63. package/dist/{server-Cg1yWGaV.d.ts → server-CHMxuWKq.d.ts} +1 -1
  64. package/dist/{types-DwdzmXfs.d.ts → types-CD0rUKKT.d.ts} +2 -0
  65. package/dist/{types-3c88cRKH.d.ts → types-LrU4LRmX.d.ts} +28 -0
  66. package/dist/{types-CwKKucOF.d.ts → types-RPKUTu1k.d.ts} +27 -2
  67. package/dist/uuid-RVN2T26F.js +8 -0
  68. package/dist/uuid-RVN2T26F.js.map +1 -0
  69. package/dist/zod-7YXKWYMC.js +12 -0
  70. package/dist/zod-7YXKWYMC.js.map +1 -0
  71. package/package.json +22 -13
  72. package/dist/chunk-2ZTGQLYK.js +0 -356
  73. package/dist/chunk-2ZTGQLYK.js.map +0 -1
  74. package/dist/chunk-7ZMN7XJE.js.map +0 -1
  75. package/dist/chunk-CPFHEPW4.js.map +0 -1
  76. package/dist/chunk-KY6ZPWHO.js.map +0 -1
  77. package/dist/chunk-NBDFQYUZ.js.map +0 -1
  78. package/dist/chunk-QTJ7VTJY.js.map +0 -1
  79. package/dist/headless-Q7XHHZIW.js.map +0 -1
  80. package/dist/ollama-YNXAYP3R.js.map +0 -1
  81. /package/dist/{chunk-BGG2E6JD.js.map → chunk-3HEYCV26.js.map} +0 -0
  82. /package/dist/{provider-factory-34MSWJZ3.js.map → provider-factory-KCLIF34X.js.map} +0 -0
  83. /package/dist/{resolve-XM52G7YE.js.map → resolve-4JA2BBDA.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { S as Sandbox, A as Agent, D as DockerContainer, E as E2BSandboxInstance, a as SkillDefinition, T as ThreadConfig, b as SessionStorage, C as ContextFile, P as ProjectContextConfig, c as ContextScope, R as RetryConfig, d as RetryContext, e as RetryEngineOptions, f as Span, g as SpanAttributeValue, h as SpanStatusCode, i as Tracer, j as SpanOptions, k as StoredCostState } from './agent-BrkbZyOT.js';
2
- export { l as AgentOptions, m as AutoCompactConfig, n as AutoCompactTrackingState, B as BudgetState, o as CLEARED_PLACEHOLDER, p as COMPACTABLE_TOOLS, q as ContentReplacementState, r as CostTracker, s as DEFAULT_MODELS, t as DEFAULT_RETRY_CONFIG, u as DiagnoseCheckResult, v as DiagnoseResult, w as DockerComputer, x as DockerComputerOptions, y as DockerSandbox, z as DockerSandboxOptions, F as E2BComputer, G as E2BComputerOptions, H as E2BSandbox, I as E2BSandboxOptions, L as LocalSandbox, J as LocalSandboxOptions, M as MicrocompactConfig, K as MicrocompactResult, N as ProviderName, O as ReactiveCompactConfig, Q as ReactiveCompactResult, U as ResolveProviderOptions, V as RetryEvent, W as RunCallbacks, X as RunResult, Y as SUPPORTED_PROVIDERS, Z as SandboxConfig, _ as SandboxedLocalComputer, $ as SandboxedLocalComputerOptions, a0 as SnipConfig, a1 as SnipResult, a2 as SpritesSandbox, a3 as SpritesSandboxOptions, a4 as Thread, a5 as ThreadOptions, a6 as ToolResultBudgetConfig, a7 as ToolResultBudgetResult, a8 as ToolResultReplacementRecord, a9 as ToolResultSpillResult, aa as ToolResultStorageConfig, ab as TracingConfig, ac as UnsandboxedLocal, ad as UnsandboxedLocalOptions, ae as WebSearchConfig, af as WebSearchResult, ag as applyPersistedReplacements, ah as applySnipRemovals, ai as canAutoCompact, aj as createAutoCompactConfig, ak as createAutoCompactTracking, al as createBudgetState, am as createContentReplacementState, an as createWebSearchTool, ao as detectProvider, ap as enforceToolResultBudget, aq as enforceToolResultStorageBudget, ar as microcompactMessages, as as persistToolResult, at as projectSnippedView, au as reconstructContentReplacementState, av as recordAutoCompactFailure, aw as recordAutoCompactSuccess, ax as resolveProvider, ay as shouldAutoCompact, az as snipMessagesByUuids, aA as tryReactiveCompact, aB as webSearchToolPlaceholder } from './agent-BrkbZyOT.js';
3
- import { A as AIProvider, T as ToolDefinition, o as ToolCallContent, S as StreamEvent, e as ContentPart, b as ChatMessage, k as ChatCompletionUsage, M as ModelPricing, h as UsageRecord, a as ChatStreamChunk, p as MemoryProvider, q as MemoryEntry, l as ThinkingConfig, r as AssistantMessage, s as ToolResultMessage, d as FileCheckpointSnapshot, t as ToolResultOverflowEntry, f as ContentReplacementRecord, J as JsonSchemaOutputFormat } from './types-3c88cRKH.js';
4
- export { C as ChatParams, u as ChatStreamChoice, v as ChatStreamDelta, w as ChatStreamError, c as CheckpointConfig, x as CompactBoundaryEntry, y as ContentReplacementEntry, i as CostSummary, z as CustomTitleEntry, D as DiffStats, E as Entry, B as FileCheckpointBackup, G as FileCheckpointEntry, F as FileCheckpointState, I as ImageContent, H as ImageUrlContent, K as JsonObjectOutputFormat, m as MemoryConfig, L as MemoryType, N as MessageEntry, P as MetadataEntry, j as ModelUsageSummary, O as OutputFormat, R as RunOptions, Q as SerializedMessage, g as SessionInfo, V as SnipBoundaryEntry, W as SummaryEntry, X as SystemMessage, Y as TextContent, Z as ToolDefParameterProperty, n as ToolResult, _ as UserMessage, $ as createCheckpointState } from './types-3c88cRKH.js';
5
- import { H as HookDefinition, V as VirtualFs, R as ReadOptions, F as FileEntry, i as FileStat, j as VirtualComputer, E as ExecOptions, C as CommandResult, T as Tool, h as ToolContext, g as ToolResult, o as HookEvent, p as HookInput, P as PostToolUseFailureHookInput, q as PostToolUseFailureHookOutput, r as PostToolUseHookInput, s as PostToolUseHookOutput, t as PreToolUseHookInput, u as PreToolUseHookOutput } from './types-CwKKucOF.js';
6
- export { m as FileCheckpointManager, v as FileState, w as FileStateCache, n as FileStateCacheConfig, x as FileWriteHookInput, y as HookOutput, J as JsonSchemaType, b as LspDiagnostic, c as LspLocation, d as LspOperation, L as LspServerConfig, a as LspServerState, f as LspSymbol, M as MemoryUpdateHookInput, z as ModelSwitchHookInput, N as NotificationHookInput, A as PermissionDeniedHookInput, B as PermissionRequestHookInput, G as RetryAttemptHookInput, I as SafeParseResult, K as SessionEndHookInput, O as SessionStartHookInput, S as SubagentConfig, k as SubagentRun, Q as SubagentStartHookInput, U as SubagentStopHookInput, W as Task, X as TaskCreateInput, Y as TaskStatus, l as TaskStore, Z as TaskUpdateInput, _ as ToolParameters, $ as ZodLikeSchema, a0 as formatZodValidationError, a1 as registerZodToJsonSchema, a2 as zodToJsonSchema } from './types-CwKKucOF.js';
1
+ import { S as Sandbox, A as Agent, D as DockerContainer, E as E2BSandboxInstance, F as FreestyleVmInstance, a as SkillDefinition, T as ThreadConfig, b as SessionStorage, C as ContextFile, P as ProjectContextConfig, c as ContextScope, R as RetryConfig, d as RetryContext, e as RetryEngineOptions, f as Span, g as SpanAttributeValue, h as SpanStatusCode, i as Tracer, j as SpanOptions, k as StoredCostState } from './agent-1nFVUP9E.js';
2
+ export { l as AgentOptions, m as AutoCompactConfig, n as AutoCompactTrackingState, B as BudgetState, o as CLEARED_PLACEHOLDER, p as COMPACTABLE_TOOLS, q as ContentReplacementState, r as CostTracker, s as DEFAULT_MODELS, t as DEFAULT_RETRY_CONFIG, u as DiagnoseCheckResult, v as DiagnoseResult, w as DockerComputer, x as DockerComputerOptions, y as DockerSandbox, z as DockerSandboxOptions, G as E2BComputer, H as E2BComputerOptions, I as E2BSandbox, J as E2BSandboxOptions, K as FreestyleComputer, L as FreestyleComputerOptions, M as FreestyleSandbox, N as FreestyleSandboxOptions, O as LocalSandbox, Q as LocalSandboxOptions, U as MicrocompactConfig, V as MicrocompactResult, W as ProviderName, X as ReactiveCompactConfig, Y as ReactiveCompactResult, Z as ResolveProviderOptions, _ as RetryEvent, $ as RunCallbacks, a0 as RunResult, a1 as SUPPORTED_PROVIDERS, a2 as SandboxConfig, a3 as SandboxedLocalComputer, a4 as SandboxedLocalComputerOptions, a5 as SnipConfig, a6 as SnipResult, a7 as SpritesSandbox, a8 as SpritesSandboxOptions, a9 as Thread, aa as ThreadOptions, ab as ToolResultBudgetConfig, ac as ToolResultBudgetResult, ad as ToolResultReplacementRecord, ae as ToolResultSpillResult, af as ToolResultStorageConfig, ag as TracingConfig, ah as UnsandboxedLocal, ai as UnsandboxedLocalOptions, aj as WebSearchConfig, ak as WebSearchResult, al as applyPersistedReplacements, am as applySnipRemovals, an as canAutoCompact, ao as createAutoCompactConfig, ap as createAutoCompactTracking, aq as createBudgetState, ar as createContentReplacementState, as as createWebSearchTool, at as detectProvider, au as enforceToolResultBudget, av as enforceToolResultStorageBudget, aw as microcompactMessages, ax as persistToolResult, ay as projectSnippedView, az as reconstructContentReplacementState, aA as recordAutoCompactFailure, aB as recordAutoCompactSuccess, aC as resolveProvider, aD as shouldAutoCompact, aE as snipMessagesByUuids, aF as tryReactiveCompact, aG as webSearchToolPlaceholder } from './agent-1nFVUP9E.js';
3
+ import { A as AIProvider, T as ToolDefinition, o as ToolCallContent, S as StreamEvent, e as ContentPart, b as ChatMessage, k as ChatCompletionUsage, M as ModelPricing, h as UsageRecord, a as ChatStreamChunk, p as MemoryProvider, q as MemoryEntry, l as ThinkingConfig, r as AssistantMessage, s as ToolResultMessage, d as FileCheckpointSnapshot, t as ToolResultOverflowEntry, f as ContentReplacementRecord, J as JsonSchemaOutputFormat } from './types-LrU4LRmX.js';
4
+ export { C as ChatParams, u as ChatStreamChoice, v as ChatStreamDelta, w as ChatStreamError, c as CheckpointConfig, x as CompactBoundaryEntry, y as ContentReplacementEntry, i as CostSummary, z as CustomTitleEntry, D as DiffStats, E as Entry, B as FileCheckpointBackup, G as FileCheckpointEntry, F as FileCheckpointState, I as ImageContent, H as ImageUrlContent, K as JsonObjectOutputFormat, m as MemoryConfig, L as MemoryType, N as MessageEntry, P as MetadataEntry, j as ModelUsageSummary, O as OutputFormat, R as RunOptions, Q as SerializedMessage, g as SessionInfo, V as SnipBoundaryEntry, W as SummaryEntry, X as SystemMessage, Y as TextContent, Z as ToolDefParameterProperty, n as ToolResult, _ as UserMessage, $ as createCheckpointState } from './types-LrU4LRmX.js';
5
+ import { H as HookDefinition, V as VirtualFs, R as ReadOptions, F as FileEntry, i as FileStat, j as VirtualComputer, E as ExecOptions, C as CommandResult, T as Tool, h as ToolContext, g as ToolResult, o as HookEvent, p as HookInput, P as PostToolUseFailureHookInput, q as PostToolUseFailureHookOutput, r as PostToolUseHookInput, s as PostToolUseHookOutput, t as PreToolUseHookInput, u as PreToolUseHookOutput } from './types-RPKUTu1k.js';
6
+ export { m as FileCheckpointManager, v as FileState, w as FileStateCache, n as FileStateCacheConfig, x as FileWriteHookInput, y as HookOutput, J as JsonSchemaType, b as LspDiagnostic, c as LspLocation, d as LspOperation, L as LspServerConfig, a as LspServerState, f as LspSymbol, M as MemoryUpdateHookInput, z as ModelSwitchHookInput, N as NotificationHookInput, A as PermissionDeniedHookInput, B as PermissionRequestHookInput, G as RetryAttemptHookInput, I as SafeParseResult, K as SessionEndHookInput, O as SessionStartHookInput, S as SubagentConfig, k as SubagentRun, Q as SubagentStartHookInput, U as SubagentStopHookInput, W as Task, X as TaskCreateInput, Y as TaskStatus, l as TaskStore, Z as TaskUpdateInput, _ as ToolParameters, $ as ZodLikeSchema, a0 as formatZodValidationError, a1 as registerZodToJsonSchema, a2 as zodToJsonSchema } from './types-RPKUTu1k.js';
7
7
  import { M as McpServerConfig } from './types-2kTLUCnD.js';
8
8
  export { b as McpConfig, c as McpConnection, d as McpHttpServerConfig, e as McpOAuthConfig, f as McpSseServerConfig, g as McpStdioServerConfig, h as McpToolInfo, i as McpWebSocketServerConfig, a as OAuthProviderOptions, O as OAuthTokenData, T as TokenStorage } from './types-2kTLUCnD.js';
9
9
  export { OpenAIProviderOptions } from './providers/openai.js';
@@ -12,10 +12,11 @@ export { GeminiProviderOptions } from './providers/gemini.js';
12
12
  export { OpenRouterProviderOptions } from './providers/openrouter.js';
13
13
  export { BedrockAnthropicProviderOptions } from './providers/bedrock.js';
14
14
  export { VertexAnthropicProviderOptions } from './providers/vertex.js';
15
- import { c as PermissionHandler, e as PermissionContext, f as PermissionBehavior, g as PermissionRule, A as AutoModeConfig, h as PermissionDecision, i as PermissionUpdate } from './types-DwdzmXfs.js';
16
- export { D as DenialTrackingConfig, j as PermissionAllowResult, k as PermissionAskResult, d as PermissionConfig, l as PermissionDenyResult, a as PermissionMode, m as PermissionPassthroughResult, n as PermissionRequest, P as PermissionResponse, b as PermissionResult, o as PermissionRuleSource, R as RULE_SOURCE_PRECEDENCE } from './types-DwdzmXfs.js';
17
- export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from './server-Cg1yWGaV.js';
18
- export { C as CacheControlConfig, a as CacheScope, g as getMessageCacheBreakpointIndex, s as sortToolDefinitionsForCache } from './cache-DVqaCX8v.js';
15
+ export { OllamaProviderOptions } from './providers/ollama.js';
16
+ import { c as PermissionHandler, e as PermissionContext, f as PermissionBehavior, g as PermissionRule, A as AutoModeConfig, h as PermissionDecision, i as PermissionUpdate } from './types-CD0rUKKT.js';
17
+ export { D as DenialTrackingConfig, j as PermissionAllowResult, k as PermissionAskResult, d as PermissionConfig, l as PermissionDenyResult, a as PermissionMode, m as PermissionPassthroughResult, n as PermissionRequest, P as PermissionResponse, b as PermissionResult, o as PermissionRuleSource, R as RULE_SOURCE_PRECEDENCE } from './types-CD0rUKKT.js';
18
+ export { a as McpClientManagerOptions, b as McpServerOptions, c as buildMcpToolName, g as getMcpPrefix, n as normalizeNameForMCP, p as parseMcpToolName } from './server-CHMxuWKq.js';
19
+ export { C as CacheControlConfig, a as CacheScope, g as getMessageCacheBreakpointIndex, s as sortToolDefinitionsForCache } from './cache-DsRqxx6v.js';
19
20
  export { JsonRpcErrorObject, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse } from './jsonrpc/index.js';
20
21
  export { b as AcpCapabilities, c as AcpInitializeParams, d as AcpInitializeResult, A as AcpTransport } from './types-QwfylltH.js';
21
22
  export { e as A2AArtifact, M as A2AMessage, P as A2APart, b as A2ATask, g as A2ATaskStatus, a as AgentCard, A as AgentSkill } from './types-NIyVwQ4h.js';
@@ -55,12 +56,6 @@ declare function planningAgent(opts: PresetOptions): Agent;
55
56
  */
56
57
  declare function reviewAgent(opts: PresetOptions): Agent;
57
58
 
58
- interface OllamaProviderOptions {
59
- /** Ollama server URL. Defaults to http://localhost:11434/v1. */
60
- baseURL?: string;
61
- model?: string;
62
- }
63
-
64
59
  interface LocalFsOptions {
65
60
  basePath?: string;
66
61
  }
@@ -73,7 +68,10 @@ interface LocalFsOptions {
73
68
  */
74
69
  declare class LocalFs implements VirtualFs {
75
70
  private basePath;
71
+ private resolvedBasePath;
72
+ private realBasePathPromise;
76
73
  constructor(opts?: LocalFsOptions);
74
+ private getRealBasePath;
77
75
  private resolve;
78
76
  readFile(filePath: string, opts?: ReadOptions): Promise<string>;
79
77
  readFileBytes(filePath: string, maxBytes?: number): Promise<Buffer>;
@@ -139,6 +137,10 @@ declare class SpritesFs implements VirtualFs {
139
137
  readFile(filePath: string, _opts?: ReadOptions): Promise<string>;
140
138
  readFileBytes(filePath: string, maxBytes?: number): Promise<Buffer>;
141
139
  writeFile(filePath: string, content: string): Promise<void>;
140
+ /**
141
+ * @warning Not atomic. Concurrent appends may lose data due to
142
+ * read-then-write TOCTOU. The Sprites API does not expose an append primitive.
143
+ */
142
144
  appendFile(filePath: string, content: string): Promise<void>;
143
145
  deleteFile(filePath: string, opts?: {
144
146
  recursive?: boolean;
@@ -245,6 +247,10 @@ declare class E2BFs implements VirtualFs {
245
247
  readFile(path: string, _opts?: ReadOptions): Promise<string>;
246
248
  readFileBytes(path: string, maxBytes?: number): Promise<Buffer>;
247
249
  writeFile(path: string, content: string): Promise<void>;
250
+ /**
251
+ * @warning Not atomic. Concurrent appends may lose data due to
252
+ * read-then-write TOCTOU. The E2B SDK does not expose an append primitive.
253
+ */
248
254
  appendFile(path: string, content: string): Promise<void>;
249
255
  deleteFile(path: string, _opts?: {
250
256
  recursive?: boolean;
@@ -259,6 +265,44 @@ declare class E2BFs implements VirtualFs {
259
265
  stat(path: string): Promise<FileStat>;
260
266
  }
261
267
 
268
+ interface FreestyleFsOptions {
269
+ /** A Freestyle VM instance. */
270
+ vm: FreestyleVmInstance;
271
+ /** Working directory for relative path resolution. */
272
+ workingDir?: string;
273
+ }
274
+ /**
275
+ * VirtualFs backed by a Freestyle VM.
276
+ *
277
+ * Uses `vm.fs.*` for operations with native SDK support (readTextFile,
278
+ * writeTextFile, readDir) and falls back to `vm.exec()` for the rest
279
+ * (stat, exists, mkdir, deleteFile, appendFile, readFileBytes).
280
+ *
281
+ * Requires `freestyle-sandboxes` as an optional peer dependency.
282
+ * The user is responsible for VM lifecycle when using explicit mode.
283
+ */
284
+ declare class FreestyleFs implements VirtualFs {
285
+ private vm;
286
+ private workingDir;
287
+ constructor(opts: FreestyleFsOptions);
288
+ private resolvePath;
289
+ readFile(filePath: string, _opts?: ReadOptions): Promise<string>;
290
+ readFileBytes(filePath: string, maxBytes?: number): Promise<Buffer>;
291
+ writeFile(filePath: string, content: string): Promise<void>;
292
+ appendFile(filePath: string, content: string): Promise<void>;
293
+ deleteFile(filePath: string, opts?: {
294
+ recursive?: boolean;
295
+ }): Promise<void>;
296
+ mkdir(filePath: string, opts?: {
297
+ recursive?: boolean;
298
+ }): Promise<void>;
299
+ readdir(dirPath: string, _opts?: {
300
+ recursive?: boolean;
301
+ }): Promise<FileEntry[]>;
302
+ exists(filePath: string): Promise<boolean>;
303
+ stat(filePath: string): Promise<FileStat>;
304
+ }
305
+
262
306
  /**
263
307
  * Resolve a tool flag that can be a static boolean or a function of the input.
264
308
  * Returns `defaultValue` when the flag is `undefined`.
@@ -394,6 +438,16 @@ interface ToolCallExecResult {
394
438
  result: ToolResult;
395
439
  /** When true, the result came from a permission denial — not actual tool execution */
396
440
  permissionDenied?: boolean;
441
+ /** When true, the turn loop should stop after processing this batch */
442
+ preventContinuation?: boolean;
443
+ /** Permission and lifecycle events emitted during execution */
444
+ events?: StreamEvent[];
445
+ /**
446
+ * Optional context modifier to apply after a concurrent batch completes.
447
+ * Applied in original tool_call order (not completion order) so state
448
+ * transitions are deterministic.
449
+ */
450
+ contextModifier?: () => void | Promise<void>;
397
451
  }
398
452
  type ToolCallExecutor = (toolCall: ToolCallContent, parsedArgs: Record<string, unknown>) => Promise<ToolCallExecResult>;
399
453
  interface Batch {
@@ -422,7 +476,7 @@ interface StreamingExecResult {
422
476
  preventContinuation?: boolean;
423
477
  events: StreamEvent[];
424
478
  }
425
- type StreamingToolExecutorFn = (toolCall: ToolCallContent, parsedArgs: Record<string, unknown>) => Promise<{
479
+ type StreamingToolExecutorFn = (toolCall: ToolCallContent, parsedArgs: Record<string, unknown>, signal?: AbortSignal) => Promise<{
426
480
  result: ToolResult;
427
481
  permissionDenied?: boolean;
428
482
  preventContinuation?: boolean;
@@ -432,25 +486,29 @@ type StreamingToolExecutorFn = (toolCall: ToolCallContent, parsedArgs: Record<st
432
486
  * Executes tools as they arrive during model streaming.
433
487
  * Concurrency-safe tools run in parallel; unsafe tools wait for all prior
434
488
  * executions to finish before starting.
489
+ *
490
+ * Supports abort propagation: a parent signal aborts all tools, and a
491
+ * Bash tool error aborts sibling tools via siblingAbortController.
435
492
  */
436
493
  declare class StreamingToolExecutor {
437
494
  private readonly getTool;
438
495
  private readonly executeFn;
496
+ private readonly parentSignal?;
439
497
  private tools;
440
498
  private progressResolve?;
441
- constructor(getTool: (name: string) => Tool | undefined, executeFn: StreamingToolExecutorFn);
499
+ private discarded;
500
+ private siblingAbortController;
501
+ private hasErrored;
502
+ private processingQueue;
503
+ constructor(getTool: (name: string) => Tool | undefined, executeFn: StreamingToolExecutorFn, parentSignal?: AbortSignal | undefined);
504
+ discard(): void;
505
+ isDiscarded(): boolean;
442
506
  addTool(toolCall: ToolCallContent, parsedArgs: Record<string, unknown>): void;
443
507
  private canExecute;
444
508
  private processQueue;
509
+ private createToolAbortController;
445
510
  private executeTool;
446
- /**
447
- * Synchronously yield any completed results (called during streaming).
448
- * Preserves declaration order: stops before a non-safe executing tool.
449
- */
450
511
  getCompletedResults(): Generator<StreamingExecResult, void>;
451
- /**
452
- * Async drain: waits for all in-flight tools then yields remaining results.
453
- */
454
512
  getRemainingResults(): AsyncGenerator<StreamingExecResult, void>;
455
513
  private hasUnfinished;
456
514
  private hasExecuting;
@@ -513,7 +571,7 @@ declare function looksLikeBareRepo(dirEntries: string[]): boolean;
513
571
  /**
514
572
  * Check if a shell command targets git-internal paths for writes.
515
573
  * Scans for redirect operators (`>`, `>>`, `tee`) whose target is
516
- * inside `.git/`.
574
+ * inside `.git/` or matches a bare repo internal path.
517
575
  */
518
576
  declare function commandWritesGitInternals(command: string): boolean;
519
577
 
@@ -826,6 +884,13 @@ interface CompactOptions {
826
884
  stripBinaryContent?: boolean;
827
885
  /** Abort signal — if fired, the partial summary is discarded instead of persisted. */
828
886
  signal?: AbortSignal;
887
+ /**
888
+ * Recently-read file contents to reinject after compaction so the model
889
+ * doesn't lose awareness of files that were only in the compacted portion.
890
+ * Map of file path -> file content. At most 5 files are reinjected, capped
891
+ * at 50 KB total.
892
+ */
893
+ recentlyReadFiles?: Map<string, string>;
829
894
  }
830
895
  declare function compactConversation(provider: AIProvider, model: string, messages: ChatMessage[], storage: SessionStorage, sessionId: string, opts?: CompactOptions): Promise<ChatMessage[]>;
831
896
  /**
@@ -878,18 +943,26 @@ declare function estimateMessagesTokens(messages: Array<{
878
943
  */
879
944
  declare function tokenCountWithEstimation(messages: ChatMessage[], lastUsage?: ChatCompletionUsage, anchorMessageIndex?: number): number;
880
945
  /**
881
- * Group messages into API-round groups. A new group starts when an
882
- * assistant message follows a tool result (i.e. each model response
883
- * round). This gives finer-grained groups than splitting on user
884
- * messages, enabling PTL recovery in agentic sessions with many
885
- * tool-use rounds under a single user prompt.
946
+ * Group messages into API-round groups. A new group starts at each
947
+ * assistant boundary (after tool results) or user message. This gives
948
+ * finer-grained groups than splitting on user messages alone, enabling
949
+ * PTL recovery in agentic sessions with many tool-use rounds.
886
950
  */
887
951
  declare function groupMessagesByTurn(messages: ChatMessage[]): ChatMessage[][];
952
+ interface PTLRetryOptions {
953
+ /** Tokens the server reported we need to shed, or undefined if unknown. */
954
+ tokenGap?: number;
955
+ /** Effective context window for this model (fallback when gap unknown). */
956
+ targetTokens: number;
957
+ }
888
958
  /**
889
- * Drop the oldest turn groups until estimated tokens drop below `targetTokens`.
890
- * Returns the trimmed message list. Used for prompt-too-long recovery.
959
+ * Drop the oldest turn groups to fit within the context window.
960
+ *
961
+ * If `tokenGap` is provided (parsed from the server error), use it to
962
+ * determine exactly how many tokens to shed. Otherwise fall back to
963
+ * dropping 20% of groups (more conservative than the heuristic target).
891
964
  */
892
- declare function truncateHeadForPTLRetry(messages: ChatMessage[], targetTokens: number): ChatMessage[];
965
+ declare function truncateHeadForPTLRetry(messages: ChatMessage[], targetOrOpts: number | PTLRetryOptions): ChatMessage[];
893
966
 
894
967
  declare function buildSystemPrompt(opts: {
895
968
  customPrompt?: string;
@@ -948,6 +1021,9 @@ declare function toolMatchesRule(toolName: string, rule: PermissionRule, mcpInfo
948
1021
  * - **exact**: `ruleContent === content`
949
1022
  * - **prefix**: `ruleContent` ends with `:*` → prefix match
950
1023
  * - **glob**: `ruleContent` contains `*` or `**` → simple glob match
1024
+ *
1025
+ * For deny/ask rules, also tries matching after stripping env vars and
1026
+ * safe wrapper commands from the content.
951
1027
  */
952
1028
  declare function contentMatchesRule(content: string, ruleContent: string): boolean;
953
1029
  /**
@@ -970,6 +1046,46 @@ declare function getMatchingRules(context: PermissionContext, toolName: string,
970
1046
  */
971
1047
  declare function isPathInWorkingDirectories(filePath: string, workingDirectories: string[]): boolean;
972
1048
 
1049
+ interface DenialLimits {
1050
+ maxConsecutive: number;
1051
+ maxTotal: number;
1052
+ }
1053
+ interface DenialState {
1054
+ consecutiveDenials: number;
1055
+ totalDenials: number;
1056
+ }
1057
+ type FallbackCheck = {
1058
+ triggered: false;
1059
+ } | {
1060
+ triggered: true;
1061
+ reason: "consecutive" | "total" | "repeated_consecutive";
1062
+ };
1063
+ /**
1064
+ * Tracks permission denials and determines when limits are exceeded.
1065
+ * When limits are hit, the system should fall back to prompting or abort.
1066
+ */
1067
+ declare class DenialTracker {
1068
+ private state;
1069
+ private limits;
1070
+ private consecutiveFallbacksWithoutSuccess;
1071
+ constructor(limits?: Partial<DenialLimits>);
1072
+ recordDenial(): void;
1073
+ recordSuccess(): void;
1074
+ shouldFallback(): FallbackCheck;
1075
+ /**
1076
+ * Reset counters after a fallback. Only resets totalDenials when the
1077
+ * total limit was the trigger — consecutive-only fallbacks preserve
1078
+ * the total counter so the session-wide safety net stays effective.
1079
+ *
1080
+ * Tracks repeated consecutive fallbacks: if `resetAfterFallback("consecutive")`
1081
+ * is called again without an intervening `recordSuccess()`, the next
1082
+ * `shouldFallback()` returns `"repeated_consecutive"` to signal escalation.
1083
+ */
1084
+ resetAfterFallback(trigger: "consecutive" | "total"): void;
1085
+ getState(): Readonly<DenialState>;
1086
+ reset(): void;
1087
+ }
1088
+
973
1089
  /**
974
1090
  * Resolve the permission decision for a tool invocation.
975
1091
  *
@@ -987,6 +1103,7 @@ interface ResolvePermissionOptions {
987
1103
  recentMessages?: ChatMessage[];
988
1104
  autoModeConfig?: AutoModeConfig;
989
1105
  signal?: AbortSignal;
1106
+ denialTracker?: DenialTracker;
990
1107
  }
991
1108
  declare function resolvePermission(tool: Tool, input: Record<string, unknown>, ctx: ToolContext, permCtx: PermissionContext, opts?: ResolvePermissionOptions): Promise<PermissionDecision>;
992
1109
 
@@ -1000,29 +1117,6 @@ declare function applyPermissionUpdate(ctx: PermissionContext, update: Permissio
1000
1117
  */
1001
1118
  declare function applyPermissionUpdates(ctx: PermissionContext, updates: PermissionUpdate[]): PermissionContext;
1002
1119
 
1003
- interface DenialLimits {
1004
- maxConsecutive: number;
1005
- maxTotal: number;
1006
- }
1007
- interface DenialState {
1008
- consecutiveDenials: number;
1009
- totalDenials: number;
1010
- }
1011
- /**
1012
- * Tracks permission denials and determines when limits are exceeded.
1013
- * When limits are hit, the system should fall back to prompting or abort.
1014
- */
1015
- declare class DenialTracker {
1016
- private state;
1017
- private limits;
1018
- constructor(limits?: Partial<DenialLimits>);
1019
- recordDenial(): void;
1020
- recordSuccess(): void;
1021
- shouldFallback(): boolean;
1022
- getState(): Readonly<DenialState>;
1023
- reset(): void;
1024
- }
1025
-
1026
1120
  interface ClassifierResult {
1027
1121
  shouldBlock: boolean;
1028
1122
  reason: string;
@@ -1087,18 +1181,13 @@ declare function isRetryable(classified: ClassifiedError, config: RetryConfig):
1087
1181
  * If a Retry-After header value is provided (seconds), it takes precedence.
1088
1182
  * Ported from claude-code's getRetryDelay with the same formula.
1089
1183
  */
1090
- declare function getRetryDelay(attempt: number, retryAfterHeader?: string | null, maxDelayMs?: number): number;
1184
+ declare function getRetryDelay(attempt: number, retryAfterHeader?: string | null, maxDelayMs?: number, baseDelayMs?: number): number;
1091
1185
 
1092
1186
  declare class CannotRetryError extends Error {
1093
1187
  readonly originalError: unknown;
1094
1188
  readonly retryContext: RetryContext;
1095
1189
  constructor(originalError: unknown, retryContext: RetryContext);
1096
1190
  }
1097
- declare class FallbackTriggeredError extends Error {
1098
- readonly originalModel: string;
1099
- readonly fallbackModel: string;
1100
- constructor(originalModel: string, fallbackModel: string);
1101
- }
1102
1191
  /**
1103
1192
  * Retry engine that wraps a stream-creating operation.
1104
1193
  * Yields retry_attempt events while waiting, then returns the stream on success.
@@ -1251,12 +1340,46 @@ declare function createCacheSafeParams(opts: {
1251
1340
  thinking?: ThinkingConfig;
1252
1341
  }): CacheSafeParams;
1253
1342
 
1343
+ /**
1344
+ * Centralized message normalization for API calls.
1345
+ *
1346
+ * Ensures a ChatMessage[] is structurally valid before being sent to any
1347
+ * provider. Handles duplicate tool IDs, orphaned results, missing pairing,
1348
+ * empty assistants, consecutive same-role messages, and other corruption
1349
+ * from error/abort/compaction paths.
1350
+ *
1351
+ * Pure function: returns a new array, never mutates the input.
1352
+ */
1353
+
1354
+ /**
1355
+ * Normalize a message array so it is structurally valid for any LLM API.
1356
+ *
1357
+ * Transformations applied (order matters):
1358
+ * 1. Drop system messages (system prompt is a separate param)
1359
+ * 2. Deduplicate tool_use IDs across assistants
1360
+ * 3. Strip orphaned tool_results with no matching tool_use
1361
+ * 4. Deduplicate tool_results with the same tool_call_id
1362
+ * 5. Insert synthetic error results for unpaired tool_uses
1363
+ * 6. Filter orphaned thinking-only assistants (null/undefined content)
1364
+ * 7. Filter whitespace-only assistant messages
1365
+ * 8. Merge consecutive same-role messages
1366
+ * 9. Ensure every assistant has non-null content
1367
+ * 10. Strip thinking-only trailing assistant (after merge — merge can
1368
+ * create new trailing messages with only thinking content)
1369
+ * 11. Ensure array starts with a user message
1370
+ */
1371
+ declare function normalizeMessagesForAPI(messages: ChatMessage[]): ChatMessage[];
1372
+
1254
1373
  /**
1255
1374
  * Conversation recovery and message sanitization.
1256
1375
  *
1257
1376
  * Cleans up persisted messages before resuming a session so the API
1258
1377
  * receives a structurally valid conversation. Handles crashes, streaming
1259
1378
  * interruptions, orphaned tool calls, and whitespace-only messages.
1379
+ *
1380
+ * Shared normalization primitives (merge, filter, pairing) live in
1381
+ * `src/messages/normalize.ts` and are re-exported here for backward
1382
+ * compatibility.
1260
1383
  */
1261
1384
 
1262
1385
  type TurnInterruption = {
@@ -1299,10 +1422,6 @@ declare function filterWhitespaceOnlyAssistantMessages(messages: ChatMessage[]):
1299
1422
  * real text and no tool_calls). These are artifacts of streaming
1300
1423
  * interruptions where a thinking block was streamed but the model
1301
1424
  * never produced a real response.
1302
- *
1303
- * In noumen's format, thinking content appears as `content: null`
1304
- * with no tool_calls (the thinking deltas were streamed separately).
1305
- * We detect these as assistants with null/empty content and no calls.
1306
1425
  */
1307
1426
  declare function filterOrphanedThinkingMessages(messages: ChatMessage[]): {
1308
1427
  messages: ChatMessage[];
@@ -1372,6 +1491,37 @@ interface ResumePayload {
1372
1491
  */
1373
1492
  declare function restoreSession(storage: SessionStorage, sessionId: string): Promise<ResumePayload>;
1374
1493
 
1494
+ /**
1495
+ * Runtime invariant assertions for normalized message sequences.
1496
+ *
1497
+ * `assertValidMessageSequence` throws an `InvariantViolation` error
1498
+ * when a ChatMessage[] violates the structural rules that every LLM
1499
+ * provider expects. Wire it behind a `debug` flag in thread.ts to
1500
+ * catch normalization regressions during development and testing.
1501
+ */
1502
+
1503
+ declare class InvariantViolation extends Error {
1504
+ constructor(message: string);
1505
+ }
1506
+ /**
1507
+ * Assert that `messages` is a structurally valid sequence for the LLM API.
1508
+ *
1509
+ * Checks:
1510
+ * 1. Non-empty (at least one message)
1511
+ * 2. First message has role "user"
1512
+ * 3. No system messages
1513
+ * 4. No consecutive same-role (non-tool) messages
1514
+ * 5. Every tool_use has exactly one matching tool result
1515
+ * 6. No orphaned tool results (no matching tool_use)
1516
+ * 7. No duplicate tool_use IDs
1517
+ * 8. No duplicate tool_result IDs
1518
+ * 9. No assistant with null/undefined content
1519
+ * 10. No whitespace-only assistant without tool_calls or thinking_content
1520
+ * 11. Trailing assistant must not be thinking-only (no text, no tool_calls)
1521
+ * 12. Tool results appear in a contiguous block after their owning assistant
1522
+ */
1523
+ declare function assertValidMessageSequence(messages: ChatMessage[]): void;
1524
+
1375
1525
  declare const STRUCTURED_OUTPUT_TOOL_NAME = "StructuredOutput";
1376
1526
  /**
1377
1527
  * Creates a synthetic tool whose input schema matches the user's desired
@@ -1435,4 +1585,4 @@ declare const IMAGE_EXTENSIONS: Set<string>;
1435
1585
  */
1436
1586
  declare function createImageMetadataText(dims: ImageDimensions): string;
1437
1587
 
1438
- export { AIProvider, API_IMAGE_MAX_BASE64_SIZE, Agent, AssistantMessage, AutoModeConfig, type CacheSafeParams, CannotRetryError, ChatCompletionUsage, ChatMessage, ChatStreamChunk, type ClassifiedError, type ClassifierResult, type CommandClassification, CommandResult, type CompactOptions, type CompressedImageResult, ContentPart, ContentReplacementRecord, ContextFile, ContextScope, DEFAULT_PRICING, type DenialLimits, type DenialState, DenialTracker, DockerContainer, DockerFs, type DockerFsOptions, E2BFs, type E2BFsOptions, E2BSandboxInstance, ExecOptions, type ExtractMemoriesResult, FallbackTriggeredError, FileCheckpointSnapshot, FileEntry, FileMemoryProvider, FileStat, type FrontmatterData, type GitOperationEvent, type GitOperationType, HookDefinition, HookEvent, HookInput, IMAGE_EXTENSIONS, IMAGE_MAX_HEIGHT, IMAGE_MAX_WIDTH, type ImageDimensions, InProcessBackend, type IndexTruncation, JsonSchemaOutputFormat, LocalComputer, type LocalComputerOptions, LocalFs, type LocalFsOptions, Mailbox, McpServerConfig, MemoryEntry, MemoryProvider, ModelPricing, NoopSpan, NoopTracer, OTelTracer, type OllamaProviderOptions, type ParsedFrontmatter, PermissionBehavior, PermissionContext, PermissionDecision, PermissionHandler, PermissionRule, PermissionUpdate, PostToolUseFailureHookInput, PostToolUseFailureHookOutput, PostToolUseHookInput, PostToolUseHookOutput, PreToolUseHookInput, PreToolUseHookOutput, type PresetOptions, ProjectContextConfig, ReadOptions, type ResizedImage, type ResolvePermissionOptions, type ResumePayload, RetryConfig, RetryContext, RetryEngineOptions, STRUCTURED_OUTPUT_TOOL_NAME, Sandbox, type SanitizeResult, type ShellSafetyConfig, SkillDefinition, Span, SpanAttributeValue, SpanOptions, SpanStatusCode, SpritesComputer, type SpritesComputerOptions, SpritesFs, type SpritesFsOptions, StoredCostState, StreamEvent, type StreamingExecResult, StreamingToolExecutor, type StreamingToolExecutorFn, type SwarmBackend, type SwarmConfig, type SwarmEvents, SwarmManager, type SwarmMember, type SwarmMemberConfig, type SwarmMemberStatus, type SwarmMessage, type SwarmStatus, TOOL_SEARCH_NAME, ThinkingConfig, ThreadConfig, Tool, ToolCallContent, type ToolCallExecResult, type ToolCallExecutor, ToolResult as ToolCallResult, ToolContext, ToolDefinition, ToolRegistry, ToolResultMessage, ToolResultOverflowEntry, type ToolWithDeferral, Tracer, type TurnInterruption, UsageRecord, type UserInputHandler, VirtualComputer, VirtualFs, type WorktreeInfo, activateContextForPaths, activateSkillsForPaths, agentTool, all, applyPermissionUpdate, applyPermissionUpdates, askUserTool, bashTool, buildExtractionPrompt, buildMemorySystemPromptSection, buildProjectContextSection, buildSystemPrompt, calculateCost, classifyCommand, classifyError, classifyPermission, codingAgent, commandWritesGitInternals, compactConversation, compressImageBufferWithTokenLimit, contentMatchesRule, contentToString, countOccurrences, createCacheSafeParams, createImageMetadataText, createSkillTool, createStructuredOutputTool, createToolSearchTool, createWorktree, detectGitOperations, detectTurnInterruption, editFileTool, enterPlanModeTool, enterWorktreeTool, estimateCompactionSavings, estimateMessagesTokens, estimateTokens, exitPlanModeTool, exitWorktreeTool, extractCommandName, extractMemories, filterActiveContextFiles, filterOrphanedThinkingMessages, filterUnresolvedToolUses, filterWhitespaceOnlyAssistantMessages, findActualString, findGitRoot, findModelPricing, formatDeferredToolLine, generateMissingToolResults, getActiveSkills, getAutoCompactThreshold, getContextWindowForModel, getEffectiveContextWindow, getLastCacheSafeParams, getMatchingRules, getRetryDelay, getWorktreeChanges, globTool, grepTool, groupMessagesByTurn, hasGitIndexLockError, hasImageContent, isDeferredTool, isGitInternalPath, isPathInWorkingDirectories, isRetryable, listWorktrees, loadProjectContext, loadSkills, looksLikeBareRepo, matchSimpleGlob, maybeResizeAndDownsampleImageBlock, maybeResizeAndDownsampleImageBuffer, normalizeContent, normalizeQuotes, notebookEditTool, parseAllowedTools, parseFrontmatter, parsePaths, partitionToolCalls, planningAgent, preserveQuoteStyle, readFileTool, registerContextWindows, removeWorktree, resolvePermission, resolveToolFlag, restoreSession, reviewAgent, runNotificationHooks, runPostToolUseFailureHooks, runPostToolUseHooks, runPreToolUseHooks, runToolsBatched, sanitizeForResume, sanitizeWorktreeSlug, saveCacheSafeParams, searchToolsWithKeywords, stripImageContent, stripTrailingWhitespace, taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, tokenCountWithEstimation, toolMatchesRule, truncateHeadForPTLRetry, truncateIndex, webFetchTool, withRetry, writeFileTool };
1588
+ export { AIProvider, API_IMAGE_MAX_BASE64_SIZE, Agent, AssistantMessage, AutoModeConfig, type CacheSafeParams, CannotRetryError, ChatCompletionUsage, ChatMessage, ChatStreamChunk, type ClassifiedError, type ClassifierResult, type CommandClassification, CommandResult, type CompactOptions, type CompressedImageResult, ContentPart, ContentReplacementRecord, ContextFile, ContextScope, DEFAULT_PRICING, type DenialLimits, type DenialState, DenialTracker, DockerContainer, DockerFs, type DockerFsOptions, E2BFs, type E2BFsOptions, E2BSandboxInstance, ExecOptions, type ExtractMemoriesResult, FileCheckpointSnapshot, FileEntry, FileMemoryProvider, FileStat, FreestyleFs, type FreestyleFsOptions, FreestyleVmInstance, type FrontmatterData, type GitOperationEvent, type GitOperationType, HookDefinition, HookEvent, HookInput, IMAGE_EXTENSIONS, IMAGE_MAX_HEIGHT, IMAGE_MAX_WIDTH, type ImageDimensions, InProcessBackend, type IndexTruncation, InvariantViolation, JsonSchemaOutputFormat, LocalComputer, type LocalComputerOptions, LocalFs, type LocalFsOptions, Mailbox, McpServerConfig, MemoryEntry, MemoryProvider, ModelPricing, NoopSpan, NoopTracer, OTelTracer, type ParsedFrontmatter, PermissionBehavior, PermissionContext, PermissionDecision, PermissionHandler, PermissionRule, PermissionUpdate, PostToolUseFailureHookInput, PostToolUseFailureHookOutput, PostToolUseHookInput, PostToolUseHookOutput, PreToolUseHookInput, PreToolUseHookOutput, type PresetOptions, ProjectContextConfig, ReadOptions, type ResizedImage, type ResolvePermissionOptions, type ResumePayload, RetryConfig, RetryContext, RetryEngineOptions, STRUCTURED_OUTPUT_TOOL_NAME, Sandbox, type SanitizeResult, type ShellSafetyConfig, SkillDefinition, Span, SpanAttributeValue, SpanOptions, SpanStatusCode, SpritesComputer, type SpritesComputerOptions, SpritesFs, type SpritesFsOptions, StoredCostState, StreamEvent, type StreamingExecResult, StreamingToolExecutor, type StreamingToolExecutorFn, type SwarmBackend, type SwarmConfig, type SwarmEvents, SwarmManager, type SwarmMember, type SwarmMemberConfig, type SwarmMemberStatus, type SwarmMessage, type SwarmStatus, TOOL_SEARCH_NAME, ThinkingConfig, ThreadConfig, Tool, ToolCallContent, type ToolCallExecResult, type ToolCallExecutor, ToolResult as ToolCallResult, ToolContext, ToolDefinition, ToolRegistry, ToolResultMessage, ToolResultOverflowEntry, type ToolWithDeferral, Tracer, type TurnInterruption, UsageRecord, type UserInputHandler, VirtualComputer, VirtualFs, type WorktreeInfo, activateContextForPaths, activateSkillsForPaths, agentTool, all, applyPermissionUpdate, applyPermissionUpdates, askUserTool, assertValidMessageSequence, bashTool, buildExtractionPrompt, buildMemorySystemPromptSection, buildProjectContextSection, buildSystemPrompt, calculateCost, classifyCommand, classifyError, classifyPermission, codingAgent, commandWritesGitInternals, compactConversation, compressImageBufferWithTokenLimit, contentMatchesRule, contentToString, countOccurrences, createCacheSafeParams, createImageMetadataText, createSkillTool, createStructuredOutputTool, createToolSearchTool, createWorktree, detectGitOperations, detectTurnInterruption, editFileTool, enterPlanModeTool, enterWorktreeTool, estimateCompactionSavings, estimateMessagesTokens, estimateTokens, exitPlanModeTool, exitWorktreeTool, extractCommandName, extractMemories, filterActiveContextFiles, filterOrphanedThinkingMessages, filterUnresolvedToolUses, filterWhitespaceOnlyAssistantMessages, findActualString, findGitRoot, findModelPricing, formatDeferredToolLine, generateMissingToolResults, getActiveSkills, getAutoCompactThreshold, getContextWindowForModel, getEffectiveContextWindow, getLastCacheSafeParams, getMatchingRules, getRetryDelay, getWorktreeChanges, globTool, grepTool, groupMessagesByTurn, hasGitIndexLockError, hasImageContent, isDeferredTool, isGitInternalPath, isPathInWorkingDirectories, isRetryable, listWorktrees, loadProjectContext, loadSkills, looksLikeBareRepo, matchSimpleGlob, maybeResizeAndDownsampleImageBlock, maybeResizeAndDownsampleImageBuffer, normalizeContent, normalizeMessagesForAPI, normalizeQuotes, notebookEditTool, parseAllowedTools, parseFrontmatter, parsePaths, partitionToolCalls, planningAgent, preserveQuoteStyle, readFileTool, registerContextWindows, removeWorktree, resolvePermission, resolveToolFlag, restoreSession, reviewAgent, runNotificationHooks, runPostToolUseFailureHooks, runPostToolUseHooks, runPreToolUseHooks, runToolsBatched, sanitizeForResume, sanitizeWorktreeSlug, saveCacheSafeParams, searchToolsWithKeywords, stripImageContent, stripTrailingWhitespace, taskCreateTool, taskGetTool, taskListTool, taskUpdateTool, tokenCountWithEstimation, toolMatchesRule, truncateHeadForPTLRetry, truncateIndex, webFetchTool, withRetry, writeFileTool };