@wrongstack/core 0.6.7 → 0.7.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 (52) hide show
  1. package/dist/{agent-bridge-BCVxmrOn.d.ts → agent-bridge-CrQpYjM7.d.ts} +1 -1
  2. package/dist/{compactor-BUJ8550X.d.ts → compactor-CWV1u-IU.d.ts} +1 -1
  3. package/dist/{config-BHkYGzUT.d.ts → config-C34JRwl4.d.ts} +1 -1
  4. package/dist/{context-C8mBUzBv.d.ts → context-bmR0YgBm.d.ts} +71 -3
  5. package/dist/coordination/index.d.ts +11 -11
  6. package/dist/coordination/index.js +53 -9
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/default-config-DvRSTELf.d.ts +20 -0
  9. package/dist/defaults/index.d.ts +20 -19
  10. package/dist/defaults/index.js +130 -32
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{events-DounT6pP.d.ts → events-CEKFTmIY.d.ts} +1 -1
  13. package/dist/execution/index.d.ts +19 -13
  14. package/dist/execution/index.js +94 -22
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -6
  17. package/dist/extension/index.js +3 -1
  18. package/dist/extension/index.js.map +1 -1
  19. package/dist/{index-DiIGZh5I.d.ts → index-BJIFLGII.d.ts} +5 -5
  20. package/dist/{index-BlVITqm-.d.ts → index-CZR0HjxM.d.ts} +12 -105
  21. package/dist/index.d.ts +27 -26
  22. package/dist/index.js +184 -53
  23. package/dist/index.js.map +1 -1
  24. package/dist/infrastructure/index.d.ts +6 -6
  25. package/dist/kernel/index.d.ts +9 -9
  26. package/dist/kernel/index.js +8 -4
  27. package/dist/kernel/index.js.map +1 -1
  28. package/dist/{mcp-servers-CXFfDN_d.d.ts → mcp-servers-BRJicm5o.d.ts} +3 -3
  29. package/dist/models/index.d.ts +2 -2
  30. package/dist/{multi-agent-Iy8YUe3v.d.ts → multi-agent-Cm1wYSrw.d.ts} +7 -2
  31. package/dist/{agent-subagent-runner-BTloSwjE.d.ts → multi-agent-coordinator-CCupVFqv.d.ts} +117 -4
  32. package/dist/observability/index.d.ts +2 -2
  33. package/dist/{path-resolver-DwJO5XBn.d.ts → path-resolver-CfT7e_HT.d.ts} +2 -2
  34. package/dist/{plan-templates-CG_pInJV.d.ts → plan-templates-Q78an-GJ.d.ts} +4 -4
  35. package/dist/{provider-runner-DoohzfyD.d.ts → provider-runner-WDj28o7J.d.ts} +3 -3
  36. package/dist/{retry-policy-DOnwHAyz.d.ts → retry-policy-Dpxp4SET.d.ts} +1 -1
  37. package/dist/sdd/index.d.ts +3 -3
  38. package/dist/{secret-scrubber-C9UJxFCJ.d.ts → secret-scrubber-C2YCYtkn.d.ts} +1 -1
  39. package/dist/{secret-scrubber-DcTK9JHC.d.ts → secret-scrubber-CowtdEF8.d.ts} +1 -1
  40. package/dist/security/index.d.ts +3 -3
  41. package/dist/{selector-DVo3eT-P.d.ts → selector-CP39HhCe.d.ts} +1 -1
  42. package/dist/{session-reader-BXWxFAhS.d.ts → session-reader-Dwjn4WZR.d.ts} +1 -1
  43. package/dist/storage/index.d.ts +5 -5
  44. package/dist/storage/index.js +93 -10
  45. package/dist/storage/index.js.map +1 -1
  46. package/dist/{system-prompt-BBGles-N.d.ts → system-prompt-CfgXqyv2.d.ts} +1 -1
  47. package/dist/{tool-executor-CwpjhwHC.d.ts → tool-executor-D5NFi_LV.d.ts} +5 -5
  48. package/dist/types/index.d.ts +16 -15
  49. package/dist/types/index.js +101 -20
  50. package/dist/types/index.js.map +1 -1
  51. package/dist/utils/index.d.ts +1 -1
  52. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { T as TextBlock, b as ContentBlock, v as Tool } from './context-C8mBUzBv.js';
1
+ import { T as TextBlock, b as ContentBlock, x as Tool } from './context-bmR0YgBm.js';
2
2
 
3
3
  /**
4
4
  * Container — dependency injection with explicit bind / override / decorate.
@@ -1,14 +1,15 @@
1
- import { a2 as Context, h as ProviderError, v as Tool, G as ToolUseBlock, B as ToolResultBlock } from './context-C8mBUzBv.js';
2
- import { a as Compactor, C as CompactReport } from './compactor-BUJ8550X.js';
3
- import { a as RecoveryDecision, E as ErrorHandler, R as RetryPolicy } from './retry-policy-DOnwHAyz.js';
1
+ import { a5 as Context, j as ProviderError, x as Tool, K as ToolUseBlock, G as ToolResultBlock } from './context-bmR0YgBm.js';
2
+ import { a as Compactor, C as CompactReport } from './compactor-CWV1u-IU.js';
3
+ import { a as RecoveryDecision, E as ErrorHandler, R as RetryPolicy } from './retry-policy-Dpxp4SET.js';
4
4
  import { M as ModelsRegistry } from './models-registry-Y2xbog0E.js';
5
- import { l as ToolExecutorOptions, m as ToolExecutorStrategy, n as ToolBatchResult } from './index-DiIGZh5I.js';
5
+ import { l as ToolExecutorOptions, m as ToolExecutorStrategy, n as ToolBatchResult } from './index-BJIFLGII.js';
6
6
 
7
7
  interface CompactorOptions {
8
8
  preserveK?: number;
9
9
  eliseThreshold?: number;
10
10
  estimator?: (text: string) => number;
11
11
  }
12
+
12
13
  declare class HybridCompactor implements Compactor {
13
14
  private readonly preserveK;
14
15
  private readonly eliseThreshold;
@@ -54,7 +55,6 @@ declare class DefaultErrorHandler implements ErrorHandler {
54
55
  }
55
56
 
56
57
  declare class DefaultRetryPolicy implements RetryPolicy {
57
- private static readonly NETWORK_ERR_RE;
58
58
  shouldRetry(err: Error | ProviderError, attempt: number): boolean;
59
59
  maxAttempts(err: Error | ProviderError): number;
60
60
  delayMs(attempt: number): number;
@@ -1,28 +1,29 @@
1
- export { A as AgentError, C as Capabilities, a as ConfigError, b as ContentBlock, E as ErrorCode, c as ErrorSeverity, d as ErrorSubsystem, F as FileSnapshot, I as ImageBlock, J as JSONSchema, M as Message, e as MessageRole, P as Permission, f as PluginError, g as Provider, h as ProviderError, i as ProviderErrorBody, R as Request, j as Response, k as ResumedSession, l as RiskTier, S as SessionData, m as SessionError, n as SessionEvent, o as SessionMetadata, p as SessionStore, q as SessionSummary, r as SessionWriter, s as StopReason, t as StreamEvent, T as TextBlock, u as ThinkingBlock, v as Tool, w as ToolCallContext, x as ToolError, y as ToolFinalEvent, z as ToolProgressEvent, B as ToolResultBlock, D as ToolStreamEvent, G as ToolUseBlock, U as Usage, W as WrongStackError, H as asBlocks, K as asText, L as isAgentError, N as isConfigError, O as isImageBlock, Q as isPluginError, V as isSessionError, X as isTextBlock, Y as isThinkingBlock, Z as isToolError, _ as isToolResultBlock, $ as isToolUseBlock, a0 as isWrongStackError, a1 as toWrongStackError } from '../context-C8mBUzBv.js';
2
- export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-DoohzfyD.js';
3
- export { C as CONTEXT_WINDOW_MODES, a as Config, b as ConfigLoader, c as ConfigStore, d as ContextConfig, e as ContextWindowAggressiveOn, f as ContextWindowConfigLike, g as ContextWindowMode, h as ContextWindowModeId, i as ContextWindowPolicy, j as ContextWindowThresholds, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, L as LogConfig, M as MCPServerConfig, P as PluginConfig, k as ProviderApiKey, l as ProviderConfig, T as ToolsConfig, m as formatContextWindowModeList, n as getContextWindowMode, o as isContextWindowModeId, p as listContextWindowModes, r as resolveContextWindowPolicy } from '../config-BHkYGzUT.js';
4
- export { C as CompactReport, a as Compactor } from '../compactor-BUJ8550X.js';
5
- export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../secret-scrubber-C9UJxFCJ.js';
1
+ export { A as AgentError, C as Capabilities, a as ConfigError, b as ContentBlock, E as ERROR_CODES, c as ErrorCode, d as ErrorSeverity, e as ErrorSubsystem, F as FileSnapshot, f as FsError, I as ImageBlock, J as JSONSchema, M as Message, g as MessageRole, P as Permission, h as PluginError, i as Provider, j as ProviderError, k as ProviderErrorBody, R as Request, l as Response, m as ResumedSession, n as RiskTier, S as SessionData, o as SessionError, p as SessionEvent, q as SessionMetadata, r as SessionStore, s as SessionSummary, t as SessionWriter, u as StopReason, v as StreamEvent, T as TextBlock, w as ThinkingBlock, x as Tool, y as ToolCallContext, z as ToolError, B as ToolFinalEvent, D as ToolProgressEvent, G as ToolResultBlock, H as ToolStreamEvent, K as ToolUseBlock, U as Usage, W as WrongStackError, L as asBlocks, N as asText, O as isAgentError, Q as isConfigError, V as isFsError, X as isImageBlock, Y as isPluginError, Z as isSessionError, _ as isTextBlock, $ as isThinkingBlock, a0 as isToolError, a1 as isToolResultBlock, a2 as isToolUseBlock, a3 as isWrongStackError, a4 as toWrongStackError } from '../context-bmR0YgBm.js';
2
+ export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-WDj28o7J.js';
3
+ export { C as CONTEXT_WINDOW_MODES, a as Config, b as ConfigLoader, c as ConfigStore, d as ContextConfig, e as ContextWindowAggressiveOn, f as ContextWindowConfigLike, g as ContextWindowMode, h as ContextWindowModeId, i as ContextWindowPolicy, j as ContextWindowThresholds, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, L as LogConfig, M as MCPServerConfig, P as PluginConfig, k as ProviderApiKey, l as ProviderConfig, T as ToolsConfig, m as formatContextWindowModeList, n as getContextWindowMode, o as isContextWindowModeId, p as listContextWindowModes, r as resolveContextWindowPolicy } from '../config-C34JRwl4.js';
4
+ export { C as CompactReport, a as Compactor } from '../compactor-CWV1u-IU.js';
5
+ export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../secret-scrubber-C2YCYtkn.js';
6
6
  export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from '../session-rewinder-C9HnMkhP.js';
7
- export { A as AddAttachmentInput, a as Attachment, b as AttachmentKind, c as AttachmentMeta, d as AttachmentRef, e as AttachmentStore, D as DefaultSessionReader } from '../session-reader-BXWxFAhS.js';
8
- export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-DcTK9JHC.js';
7
+ export { A as AddAttachmentInput, a as Attachment, b as AttachmentKind, c as AttachmentMeta, d as AttachmentRef, e as AttachmentStore, D as DefaultSessionReader } from '../session-reader-Dwjn4WZR.js';
8
+ export { D as DEFAULT_CONTEXT_CONFIG, a as DEFAULT_TOOLS_CONFIG } from '../default-config-DvRSTELf.js';
9
+ export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-CowtdEF8.js';
9
10
  export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-BH6AE0W9.js';
10
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-DwJO5XBn.js';
11
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-CfT7e_HT.js';
11
12
  export { M as MemoryEntry, a as MemoryScope, b as MemoryStore } from '../memory-CEXuo7sz.js';
12
- export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from '../tool-executor-CwpjhwHC.js';
13
+ export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from '../tool-executor-D5NFi_LV.js';
13
14
  export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-CxuWrsKK.js';
14
- export { B as BuildContext, M as ModelCapabilities, R as Renderer, S as SystemPromptBuilder } from '../system-prompt-BBGles-N.js';
15
+ export { B as BuildContext, M as ModelCapabilities, R as Renderer, S as SystemPromptBuilder } from '../system-prompt-CfgXqyv2.js';
15
16
  export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
16
- export { M as MCPRegistryView, a as MetricsSinkView, P as Plugin, b as PluginAPI, c as PluginCapabilities, d as PluginDependency, e as PluginPipelines, f as ProviderFactory, g as ProviderRegistryView, S as SessionWriterView, h as SlashCommand, i as SlashCommandRegistryView, j as SystemPromptContributor, T as ToolRegistryView } from '../index-DiIGZh5I.js';
17
+ export { M as MCPRegistryView, a as MetricsSinkView, P as Plugin, b as PluginAPI, c as PluginCapabilities, d as PluginDependency, e as PluginPipelines, f as ProviderFactory, g as ProviderRegistryView, S as SessionWriterView, h as SlashCommand, i as SlashCommandRegistryView, j as SystemPromptContributor, T as ToolRegistryView } from '../index-BJIFLGII.js';
17
18
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DqzwpBQy.js';
18
19
  export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-CV077NjV.js';
19
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-BCVxmrOn.js';
20
- export { C as CoordinatorEvents, a as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, b as MultiAgentCoordinator, S as SpawnResult, c as SubagentConfig, d as SubagentContext, e as SubagentError, f as SubagentErrorKind, g as SubagentRunContext, h as SubagentRunOutcome, i as SubagentRunner, T as TaskDelegation, j as TaskResult, k as TaskSpec } from '../multi-agent-Iy8YUe3v.js';
20
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-CrQpYjM7.js';
21
+ export { C as CoordinatorEvents, a as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, b as MultiAgentCoordinator, S as SpawnResult, c as SubagentConfig, d as SubagentContext, e as SubagentError, f as SubagentErrorKind, g as SubagentRunContext, h as SubagentRunOutcome, i as SubagentRunner, T as TaskDelegation, j as TaskResult, k as TaskSpec } from '../multi-agent-Cm1wYSrw.js';
21
22
  export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification, T as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, l as TaskGraph, m as TaskNode, n as TaskPriority, o as TaskProgress, p as TaskSort, q as TaskStatus, r as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from '../task-graph-D1YQbpxF.js';
22
23
  export { A as AggregateHealth, H as HealthCheck, a as HealthCheckResult, b as HealthRegistry, c as HealthStatus, M as MetricLabels, d as MetricSeries, e as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from '../observability-BhnVLBLS.js';
23
- import '../events-DounT6pP.js';
24
+ import '../events-CEKFTmIY.js';
24
25
  import '../logger-BMQgxvdy.js';
25
- import '../retry-policy-DOnwHAyz.js';
26
+ import '../retry-policy-Dpxp4SET.js';
26
27
  import '../models-registry-Y2xbog0E.js';
27
28
  import '../secret-vault-DoISxaKO.js';
28
29
  import '../path-resolver-CPRj4bFY.js';
@@ -30,6 +30,53 @@ function asText(content) {
30
30
  }
31
31
 
32
32
  // src/types/errors.ts
33
+ var ERROR_CODES = {
34
+ // Provider
35
+ PROVIDER_RATE_LIMITED: "PROVIDER_RATE_LIMITED",
36
+ PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED",
37
+ PROVIDER_OVERLOADED: "PROVIDER_OVERLOADED",
38
+ PROVIDER_INVALID_REQUEST: "PROVIDER_INVALID_REQUEST",
39
+ PROVIDER_SERVER_ERROR: "PROVIDER_SERVER_ERROR",
40
+ PROVIDER_NETWORK_ERROR: "PROVIDER_NETWORK_ERROR",
41
+ PROVIDER_CONTEXT_OVERFLOW: "PROVIDER_CONTEXT_OVERFLOW",
42
+ // Tool
43
+ TOOL_NOT_FOUND: "TOOL_NOT_FOUND",
44
+ TOOL_PERMISSION_DENIED: "TOOL_PERMISSION_DENIED",
45
+ TOOL_EXECUTION_FAILED: "TOOL_EXECUTION_FAILED",
46
+ TOOL_TIMEOUT: "TOOL_TIMEOUT",
47
+ TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
48
+ // Config
49
+ CONFIG_INVALID: "CONFIG_INVALID",
50
+ CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
51
+ CONFIG_PARSE_FAILED: "CONFIG_PARSE_FAILED",
52
+ CONFIG_MIGRATION_NEEDED: "CONFIG_MIGRATION_NEEDED",
53
+ // Plugin
54
+ PLUGIN_LOAD_FAILED: "PLUGIN_LOAD_FAILED",
55
+ PLUGIN_API_MISMATCH: "PLUGIN_API_MISMATCH",
56
+ PLUGIN_MISSING_DEPENDENCY: "PLUGIN_MISSING_DEPENDENCY",
57
+ // Agent
58
+ AGENT_ITERATION_LIMIT: "AGENT_ITERATION_LIMIT",
59
+ AGENT_CONTEXT_OVERFLOW: "AGENT_CONTEXT_OVERFLOW",
60
+ AGENT_ABORTED: "AGENT_ABORTED",
61
+ AGENT_RUN_FAILED: "AGENT_RUN_FAILED",
62
+ // Session
63
+ SESSION_NOT_FOUND: "SESSION_NOT_FOUND",
64
+ SESSION_CORRUPTED: "SESSION_CORRUPTED",
65
+ SESSION_WRITE_FAILED: "SESSION_WRITE_FAILED",
66
+ // Container / Registry
67
+ CONTAINER_TOKEN_ALREADY_BOUND: "CONTAINER_TOKEN_ALREADY_BOUND",
68
+ CONTAINER_TOKEN_NOT_BOUND: "CONTAINER_TOKEN_NOT_BOUND",
69
+ REGISTRY_DUPLICATE: "REGISTRY_DUPLICATE",
70
+ REGISTRY_NOT_FOUND: "REGISTRY_NOT_FOUND",
71
+ // File system
72
+ FS_READ_FAILED: "FS_READ_FAILED",
73
+ FS_WRITE_FAILED: "FS_WRITE_FAILED",
74
+ FS_MKDIR_FAILED: "FS_MKDIR_FAILED",
75
+ FS_DELETE_FAILED: "FS_DELETE_FAILED",
76
+ FS_ATOMIC_WRITE_FAILED: "FS_ATOMIC_WRITE_FAILED",
77
+ // General
78
+ UNKNOWN: "UNKNOWN"
79
+ };
33
80
  var WrongStackError = class extends Error {
34
81
  code;
35
82
  subsystem;
@@ -95,7 +142,7 @@ var PluginError = class extends WrongStackError {
95
142
  code: opts.code,
96
143
  subsystem: "plugin",
97
144
  severity: "error",
98
- recoverable: opts.code === "PLUGIN_MISSING_DEPENDENCY",
145
+ recoverable: opts.code === ERROR_CODES.PLUGIN_MISSING_DEPENDENCY,
99
146
  context: { plugin: opts.pluginName, ...opts.context },
100
147
  cause: opts.cause
101
148
  });
@@ -109,20 +156,20 @@ var AgentError = class extends WrongStackError {
109
156
  message: opts.message,
110
157
  code: opts.code,
111
158
  subsystem: "agent",
112
- severity: opts.code === "AGENT_ABORTED" ? "warning" : "error",
113
- recoverable: opts.recoverable ?? opts.code === "AGENT_ITERATION_LIMIT",
159
+ severity: opts.code === ERROR_CODES.AGENT_ABORTED ? "warning" : "error",
160
+ recoverable: opts.recoverable ?? opts.code === ERROR_CODES.AGENT_ITERATION_LIMIT,
114
161
  context: opts.context,
115
162
  cause: opts.cause
116
163
  });
117
164
  this.name = "AgentError";
118
165
  }
119
166
  };
120
- function toWrongStackError(err, code = "AGENT_RUN_FAILED") {
167
+ function toWrongStackError(err, code = ERROR_CODES.AGENT_RUN_FAILED) {
121
168
  if (err instanceof WrongStackError) return err;
122
169
  const message = err instanceof Error ? err.message : String(err);
123
170
  return new AgentError({
124
171
  message,
125
- code: code === "UNKNOWN" ? "AGENT_RUN_FAILED" : code,
172
+ code: code === "UNKNOWN" ? ERROR_CODES.AGENT_RUN_FAILED : code,
126
173
  cause: err
127
174
  });
128
175
  }
@@ -133,8 +180,8 @@ var SessionError = class extends WrongStackError {
133
180
  message: opts.message,
134
181
  code: opts.code,
135
182
  subsystem: "session",
136
- severity: opts.code === "SESSION_WRITE_FAILED" ? "error" : "warning",
137
- recoverable: opts.code !== "SESSION_CORRUPTED",
183
+ severity: opts.code === ERROR_CODES.SESSION_WRITE_FAILED ? "error" : "warning",
184
+ recoverable: opts.code !== ERROR_CODES.SESSION_CORRUPTED,
138
185
  context: { sessionId: opts.sessionId, ...opts.context },
139
186
  cause: opts.cause
140
187
  });
@@ -142,6 +189,22 @@ var SessionError = class extends WrongStackError {
142
189
  this.sessionId = opts.sessionId;
143
190
  }
144
191
  };
192
+ var FsError = class extends WrongStackError {
193
+ path;
194
+ constructor(opts) {
195
+ super({
196
+ message: opts.message,
197
+ code: opts.code,
198
+ subsystem: "fs",
199
+ severity: "error",
200
+ recoverable: opts.code !== ERROR_CODES.FS_READ_FAILED,
201
+ context: { path: opts.path, ...opts.context },
202
+ cause: opts.cause
203
+ });
204
+ this.name = "FsError";
205
+ this.path = opts.path;
206
+ }
207
+ };
145
208
  function isWrongStackError(err) {
146
209
  return err instanceof WrongStackError;
147
210
  }
@@ -160,6 +223,9 @@ function isSessionError(err) {
160
223
  function isAgentError(err) {
161
224
  return err instanceof AgentError;
162
225
  }
226
+ function isFsError(err) {
227
+ return err instanceof FsError;
228
+ }
163
229
 
164
230
  // src/types/provider.ts
165
231
  var ProviderError = class extends WrongStackError {
@@ -223,16 +289,30 @@ function truncate(s, n) {
223
289
  return s.length <= n ? s : `${s.slice(0, n - 1)}\u2026`;
224
290
  }
225
291
  function providerStatusToCode(status, type) {
226
- if (status === 0) return "PROVIDER_NETWORK_ERROR";
227
- if (type === "rate_limit_error" || status === 429) return "PROVIDER_RATE_LIMITED";
228
- if (type === "authentication_error" || status === 401) return "PROVIDER_AUTH_FAILED";
229
- if (type === "overloaded_error" || status === 529) return "PROVIDER_OVERLOADED";
230
- if (type === "invalid_request_error" || status === 400) return "PROVIDER_INVALID_REQUEST";
231
- if (status === 408) return "PROVIDER_NETWORK_ERROR";
232
- if (status >= 500) return "PROVIDER_SERVER_ERROR";
233
- return "PROVIDER_INVALID_REQUEST";
292
+ if (status === 0) return ERROR_CODES.PROVIDER_NETWORK_ERROR;
293
+ if (type === "rate_limit_error" || status === 429) return ERROR_CODES.PROVIDER_RATE_LIMITED;
294
+ if (type === "authentication_error" || status === 401) return ERROR_CODES.PROVIDER_AUTH_FAILED;
295
+ if (type === "overloaded_error" || status === 529) return ERROR_CODES.PROVIDER_OVERLOADED;
296
+ if (type === "invalid_request_error" || status === 400) return ERROR_CODES.PROVIDER_INVALID_REQUEST;
297
+ if (status === 408) return ERROR_CODES.PROVIDER_NETWORK_ERROR;
298
+ if (status >= 500) return ERROR_CODES.PROVIDER_SERVER_ERROR;
299
+ return ERROR_CODES.PROVIDER_INVALID_REQUEST;
234
300
  }
235
301
 
302
+ // src/types/default-config.ts
303
+ var DEFAULT_TOOLS_CONFIG = Object.freeze({
304
+ defaultExecutionStrategy: "smart",
305
+ maxIterations: 100,
306
+ iterationTimeoutMs: 3e5,
307
+ sessionTimeoutMs: 18e5,
308
+ perIterationOutputCapBytes: 1e5,
309
+ autoExtendLimit: true
310
+ });
311
+ var DEFAULT_CONTEXT_CONFIG = Object.freeze({
312
+ preserveK: 10,
313
+ eliseThreshold: 2e3
314
+ });
315
+
236
316
  // src/types/secret-vault.ts
237
317
  var ENCRYPTED_PREFIX = "enc:v1:";
238
318
  async function atomicWrite(targetPath, content, opts = {}) {
@@ -1069,9 +1149,11 @@ var DefaultPathResolver = class {
1069
1149
  }
1070
1150
  };
1071
1151
 
1152
+ // src/execution/regex-patterns.ts
1153
+ var NETWORK_ERR_RE = /ECONN|ETIMEDOUT|ETIME|ENOTFOUND|EAI_AGAIN|fetch failed/i;
1154
+
1072
1155
  // src/execution/error-handler.ts
1073
1156
  var CONTEXT_OVERFLOW_RE = /context|too long|tokens/i;
1074
- var NETWORK_ERR_RE = /ECONN|ETIMEDOUT|ETIME|ENOTFOUND|EAI_AGAIN|fetch failed/i;
1075
1157
  function buildRecoveryStrategies(opts) {
1076
1158
  return [
1077
1159
  {
@@ -1178,15 +1260,14 @@ var DefaultErrorHandler = class {
1178
1260
  };
1179
1261
 
1180
1262
  // src/execution/retry-policy.ts
1181
- var DefaultRetryPolicy = class _DefaultRetryPolicy {
1182
- static NETWORK_ERR_RE = /ECONN|ETIMEDOUT|ETIME|ENOTFOUND|EAI_AGAIN|fetch failed/i;
1263
+ var DefaultRetryPolicy = class {
1183
1264
  shouldRetry(err, attempt) {
1184
1265
  if (err instanceof ProviderError) {
1185
1266
  if (!err.retryable) return false;
1186
1267
  return attempt < this.maxAttempts(err);
1187
1268
  }
1188
1269
  const msg = err.message ?? "";
1189
- const isNetwork = _DefaultRetryPolicy.NETWORK_ERR_RE.test(msg);
1270
+ const isNetwork = NETWORK_ERR_RE.test(msg);
1190
1271
  if (isNetwork) return attempt < 2;
1191
1272
  return false;
1192
1273
  }
@@ -2664,6 +2745,6 @@ function renderPlainText(meta, events) {
2664
2745
  return lines.join("\n");
2665
2746
  }
2666
2747
 
2667
- export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SPEC_TEMPLATE, DefaultErrorHandler, DefaultLogger, DefaultModelsRegistry, DefaultPathResolver, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultTokenCounter, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, PluginError, ProviderError, SessionError, ToolError, ToolExecutor, WrongStackError, asBlocks, asText, buildRecoveryStrategies, classifyFamily, computeTaskProgress, createMessage, decryptConfigSecrets, encryptConfigSecrets, findCriticalPath, formatContextWindowModeList, getContextWindowMode, isAgentError, isConfigError, isContextWindowModeId, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, migratePlaintextSecrets, resolveContextWindowPolicy, rewriteConfigEncrypted, toWrongStackError, topologicalSort };
2748
+ export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SPEC_TEMPLATE, DEFAULT_TOOLS_CONFIG, DefaultErrorHandler, DefaultLogger, DefaultModelsRegistry, DefaultPathResolver, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultTokenCounter, ERROR_CODES, FsError, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, PluginError, ProviderError, SessionError, ToolError, ToolExecutor, WrongStackError, asBlocks, asText, buildRecoveryStrategies, classifyFamily, computeTaskProgress, createMessage, decryptConfigSecrets, encryptConfigSecrets, findCriticalPath, formatContextWindowModeList, getContextWindowMode, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, migratePlaintextSecrets, resolveContextWindowPolicy, rewriteConfigEncrypted, toWrongStackError, topologicalSort };
2668
2749
  //# sourceMappingURL=index.js.map
2669
2750
  //# sourceMappingURL=index.js.map