@wrongstack/core 0.89.1 → 0.89.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/{agent-bridge-B8F2ORwg.d.ts → agent-bridge-DbVe1dHT.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CQaLFNnA.d.ts → agent-subagent-runner-C6eqID1t.d.ts} +433 -433
  3. package/dist/{events-DzyLtja6.d.ts → brain-s9DyD_Vf.d.ts} +179 -92
  4. package/dist/{compactor-CJq7LQev.d.ts → compactor-DXLxLcmU.d.ts} +2 -2
  5. package/dist/{config-_DZ7dN-T.d.ts → config-84VaZpH6.d.ts} +45 -38
  6. package/dist/{context-ToHAp4-U.d.ts → context-CNRYfhUv.d.ts} +1 -1
  7. package/dist/coordination/index.d.ts +16 -17
  8. package/dist/coordination/index.js +25 -37
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +31 -33
  11. package/dist/defaults/index.js +476 -206
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
  14. package/dist/execution/index.d.ts +18 -19
  15. package/dist/execution/index.js +23 -45
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/extension/index.d.ts +9 -10
  18. package/dist/extension/index.js +8 -6
  19. package/dist/extension/index.js.map +1 -1
  20. package/dist/{index-Ca_lOmKl.d.ts → index-CqrroYcU.d.ts} +13 -15
  21. package/dist/{index-Dx-CnrDN.d.ts → index-D3Nax3YU.d.ts} +9 -10
  22. package/dist/index.d.ts +184 -174
  23. package/dist/index.js +973 -349
  24. package/dist/index.js.map +1 -1
  25. package/dist/infrastructure/index.d.ts +9 -9
  26. package/dist/infrastructure/index.js +4 -2
  27. package/dist/infrastructure/index.js.map +1 -1
  28. package/dist/kernel/index.d.ts +14 -16
  29. package/dist/kernel/index.js.map +1 -1
  30. package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
  31. package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
  32. package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-D3E5ixAR.d.ts} +3 -3
  33. package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
  34. package/dist/models/index.d.ts +5 -5
  35. package/dist/models/index.js +8 -6
  36. package/dist/models/index.js.map +1 -1
  37. package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
  38. package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
  39. package/dist/{multi-agent-coordinator-Da9nd8Ic.d.ts → multi-agent-coordinator-DHNrjPaA.d.ts} +2 -2
  40. package/dist/{null-fleet-bus-CHJOXv3t.d.ts → null-fleet-bus-BzzciAc4.d.ts} +32 -31
  41. package/dist/observability/index.d.ts +3 -3
  42. package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
  43. package/dist/{parallel-eternal-engine-DyMCj2Pw.d.ts → parallel-eternal-engine-CTpcrb9O.d.ts} +33 -33
  44. package/dist/{path-resolver-TjBlRKyH.d.ts → path-resolver-B7hgMAVe.d.ts} +3 -3
  45. package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
  46. package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
  47. package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-C1Ad9OjI.d.ts} +73 -73
  48. package/dist/{plan-templates-D9UhwoGh.d.ts → plan-templates-CNphsz0n.d.ts} +79 -11
  49. package/dist/{provider-runner-BEPWwkxH.d.ts → provider-runner-cqvlB_oS.d.ts} +5 -5
  50. package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
  51. package/dist/sdd/index.d.ts +12 -33
  52. package/dist/sdd/index.js +21 -31
  53. package/dist/sdd/index.js.map +1 -1
  54. package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
  55. package/dist/security/index.d.ts +4 -5
  56. package/dist/security/index.js +4 -2
  57. package/dist/security/index.js.map +1 -1
  58. package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
  59. package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-IVzs2GpE.d.ts} +1 -1
  60. package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
  61. package/dist/{skill-BJeF2DwY.d.ts → skill-BJxzIyyN.d.ts} +1 -1
  62. package/dist/skills/index.d.ts +1 -1
  63. package/dist/skills/index.js +3 -9
  64. package/dist/skills/index.js.map +1 -1
  65. package/dist/storage/index.d.ts +132 -12
  66. package/dist/storage/index.js +834 -159
  67. package/dist/storage/index.js.map +1 -1
  68. package/dist/{task-graph-CikNdRTG.d.ts → task-graph-DJBqO0EY.d.ts} +1 -1
  69. package/dist/types/index.d.ts +25 -27
  70. package/dist/types/index.js +19 -31
  71. package/dist/types/index.js.map +1 -1
  72. package/dist/utils/expect-defined.d.ts +7 -0
  73. package/dist/utils/expect-defined.js +11 -0
  74. package/dist/utils/expect-defined.js.map +1 -0
  75. package/dist/utils/index.d.ts +6 -20
  76. package/dist/utils/index.js +11 -41
  77. package/dist/utils/index.js.map +1 -1
  78. package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
  79. package/package.json +5 -1
  80. package/dist/memory-CEXuo7sz.d.ts +0 -16
  81. package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
@@ -158,4 +158,4 @@ declare function computeTaskProgress(graph: TaskGraph): TaskProgress;
158
158
  declare function findCriticalPath(graph: TaskGraph): CriticalPathResult;
159
159
  declare function topologicalSort(graph: TaskGraph): string[];
160
160
 
161
- export { type CriticalPathResult as C, DEFAULT_SPEC_TEMPLATE as D, type SpecAnalysis as S, type TaskAssignment as T, type SpecApiEndpoint as a, type SpecRequirement as b, type SpecSection as c, type SpecSectionType as d, type SpecStatus as e, type SpecTemplate as f, type SpecValidationResult as g, type Specification as h, type TaskDependency as i, type TaskEdge as j, type TaskFilter as k, type TaskGraph as l, type TaskNode as m, type TaskPriority as n, type TaskProgress as o, type TaskSort as p, type TaskStatus as q, type TaskType as r, computeTaskProgress as s, findCriticalPath as t, topologicalSort as u };
161
+ export { type CriticalPathResult as C, DEFAULT_SPEC_TEMPLATE as D, type SpecAnalysis as S, type TaskGraph as T, type TaskType as a, type TaskPriority as b, type TaskNode as c, type SpecApiEndpoint as d, type SpecRequirement as e, type SpecSection as f, type SpecSectionType as g, type SpecStatus as h, type SpecTemplate as i, type SpecValidationResult as j, type Specification as k, type TaskAssignment as l, type TaskDependency as m, type TaskEdge as n, type TaskFilter as o, type TaskProgress as p, type TaskSort as q, type TaskStatus as r, computeTaskProgress as s, findCriticalPath as t, topologicalSort as u };
@@ -1,36 +1,34 @@
1
- export { A as AgentError, a as Capabilities, b as ConfigError, c as ContentBlock, E as ERROR_CODES, g as ErrorCode, h as ErrorSeverity, i as ErrorSubsystem, F as FileSnapshot, j as FsError, I as ImageBlock, J as JSONSchema, M as Message, k as MessageRole, P as Permission, l as PluginError, m as Provider, n as ProviderError, o as ProviderErrorBody, p as Request, q as Response, r as ResumedSession, s as RiskTier, S as SessionData, v as SessionError, w as SessionEvent, x as SessionMetadata, y as SessionStore, z as SessionSummary, B as SessionWriter, H as StopReason, K as StreamEvent, T as TextBlock, L as ThinkingBlock, Q as Tool, U as ToolCallContext, V as ToolError, W as ToolFinalEvent, X as ToolProgressEvent, Y as ToolResultBlock, Z as ToolStreamEvent, _ as ToolUseBlock, $ as Usage, a0 as WrongStackError, a1 as asBlocks, a2 as asText, a4 as isAgentError, a5 as isConfigError, a6 as isFsError, a7 as isImageBlock, a8 as isPluginError, a9 as isSessionError, aa as isTextBlock, ab as isThinkingBlock, ac as isToolError, ad as isToolResultBlock, ae as isToolUseBlock, af as isWrongStackError, ag as toWrongStackError } from '../context-ToHAp4-U.js';
2
- export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BEPWwkxH.js';
3
- export { A as AutonomyConfig, 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, k as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, H as HookEntry, l as HookEvent, m as HookInput, n as HookMatcher, o as HookOutcome, I as InProcessHook, p as IndexingConfig, L as LaunchConfig, q as LogConfig, M as MCPServerConfig, r as ModelMatrixEntry, P as PluginConfig, s as ProviderApiKey, t as ProviderConfig, S as SessionLoggingConfig, u as ShellHook, v as SyncCategory, w as SyncConfig, T as ToolsConfig, x as formatContextWindowModeList, y as getContextWindowMode, z as isContextWindowModeId, B as listContextWindowModes, E as resolveContextWindowPolicy } from '../config-_DZ7dN-T.js';
4
- export { C as CompactReport, a as Compactor } from '../compactor-CJq7LQev.js';
5
- export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../permission-14CChMmO.js';
1
+ export { A as AgentError, k as Capabilities, u as ConfigError, g as ContentBlock, E as ERROR_CODES, w as ErrorCode, x as ErrorSeverity, y as ErrorSubsystem, F as FileSnapshot, z as FsError, I as ImageBlock, J as JSONSchema, M as Message, B as MessageRole, f as Permission, D as PluginError, P as Provider, e as ProviderError, G as ProviderErrorBody, R as Request, b as Response, p as ResumedSession, K as RiskTier, q as SessionData, N as SessionError, S as SessionEvent, h as SessionMetadata, i as SessionStore, r as SessionSummary, a as SessionWriter, V as StopReason, W as StreamEvent, l as TextBlock, X as ThinkingBlock, T as Tool, Y as ToolCallContext, Z as ToolError, _ as ToolFinalEvent, j as ToolProgressEvent, n as ToolResultBlock, $ as ToolStreamEvent, m as ToolUseBlock, U as Usage, a0 as WrongStackError, a1 as asBlocks, a2 as asText, a4 as isAgentError, a5 as isConfigError, a6 as isFsError, a7 as isImageBlock, a8 as isPluginError, a9 as isSessionError, aa as isTextBlock, ab as isThinkingBlock, ac as isToolError, ad as isToolResultBlock, ae as isToolUseBlock, af as isWrongStackError, ag as toWrongStackError } from '../context-CNRYfhUv.js';
2
+ export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-cqvlB_oS.js';
3
+ export { A as AutonomyConfig, i as CONTEXT_WINDOW_MODES, C as Config, d as ConfigLoader, c as ConfigStore, j as ContextConfig, k as ContextWindowAggressiveOn, l as ContextWindowConfigLike, m as ContextWindowMode, n as ContextWindowModeId, o as ContextWindowPolicy, p as ContextWindowThresholds, q as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, F as FeaturesConfig, b as HookEntry, H as HookEvent, g as HookInput, a as HookMatcher, h as HookOutcome, I as InProcessHook, r as IndexingConfig, L as LaunchConfig, s as LogConfig, M as MCPServerConfig, f as ModelMatrixEntry, P as PluginConfig, t as ProviderApiKey, u as ProviderConfig, v as SessionLoggingConfig, S as ShellHook, w as SyncCategory, e as SyncConfig, T as ToolsConfig, x as formatContextWindowModeList, y as getContextWindowMode, z as isContextWindowModeId, B as listContextWindowModes, E as resolveContextWindowPolicy } from '../config-84VaZpH6.js';
4
+ export { a as CompactReport, C as Compactor } from '../compactor-DXLxLcmU.js';
5
+ export { a as PermissionDecision, P as PermissionPolicy, T as TrustPolicy } from '../permission-BDv7z0mk.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-BQU-toaN.js';
7
+ export { a as AddAttachmentInput, c as Attachment, d as AttachmentKind, e as AttachmentMeta, b as AttachmentRef, A as AttachmentStore, D as DefaultSessionReader } from '../session-reader-DDz1Ek4V.js';
8
8
  export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_SESSION_LOGGING_CONFIG, c as DEFAULT_SESSION_PRUNE_DAYS, d as DEFAULT_TOOLS_CONFIG } from '../default-config-CXsDvOmP.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-yGBFQYju.js';
10
- export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-C_27pj9i.js';
11
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-TjBlRKyH.js';
12
- export { M as MemoryEntry, a as MemoryScope, b as MemoryStore } from '../memory-CEXuo7sz.js';
13
- import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-DyMCj2Pw.js';
14
- export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-DyMCj2Pw.js';
15
- export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-BJeF2DwY.js';
16
- export { a as BuildContext, c as ModelCapabilities, e as Renderer, S as SystemPromptBuilder } from '../system-prompt-C0rLCeyn.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-vault-DrOhc2i5.js';
10
+ export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-B9J5puGM.js';
11
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-B7hgMAVe.js';
12
+ export { p as MEMORY_TYPE_LABELS, q as MemoryClearedPayload, r as MemoryConsolidatedPayload, k as MemoryEntry, s as MemoryForgottenPayload, t as MemoryPriority, m as MemoryRelevanceContext, u as MemoryRememberedPayload, M as MemoryScope, l as MemoryStore, v as MemoryType, S as ScoredEntry } from '../brain-s9DyD_Vf.js';
13
+ import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-CTpcrb9O.js';
14
+ export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-CTpcrb9O.js';
15
+ export { a as SkillEntry, S as SkillLoader, b as SkillManifest } from '../skill-BJxzIyyN.js';
16
+ export { B as BuildContext, M as ModelCapabilities, a as Renderer, S as SystemPromptBuilder } from '../pipeline-C1Ad9OjI.js';
17
17
  export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
18
- export { C as CoordinatorEvents, o as CoordinatorStatus, D as DoneCondition, M as MCPRegistryView, t as MetricsSinkView, u as MultiAgentConfig, v as MultiAgentCoordinator, P as Plugin, w as PluginAPI, x as PluginCapabilities, y as PluginDependency, z as PluginPipelines, E as ProviderFactory, G as ProviderRegistryView, S as SessionWriterView, H as SlashCommand, I as SlashCommandRegistryView, J as SpawnResult, L as SubagentConfig, N as SubagentContext, O as SubagentError, Q as SubagentErrorKind, R as SubagentRunContext, T as SubagentRunOutcome, U as SubagentRunner, W as TaskDelegation, X as TaskResult, Y as TaskSpec, Z as ToolRegistryView } from '../agent-subagent-runner-CQaLFNnA.js';
19
- export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-Boz639EI.js';
20
- export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-CHo2XtHs.js';
21
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-B8F2ORwg.js';
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-CikNdRTG.js';
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-CoSNZdhX.js';
24
- export { S as SystemPromptContributor } from '../index-Dx-CnrDN.js';
25
- import '../events-DzyLtja6.js';
26
- import '../logger-B72yyPc6.js';
27
- import '../retry-policy-DSu6O6rD.js';
28
- import '../models-registry-Be3osGt5.js';
18
+ export { N as CoordinatorEvents, C as CoordinatorStatus, O as DoneCondition, H as MCPRegistryView, K as MetricsSinkView, c as MultiAgentConfig, M as MultiAgentCoordinator, L as Plugin, P as PluginAPI, Q as PluginCapabilities, R as PluginDependency, D as PluginPipelines, _ as ProviderFactory, G as ProviderRegistryView, J as SessionWriterView, z as SlashCommand, I as SlashCommandRegistryView, e as SpawnResult, S as SubagentConfig, U as SubagentContext, V as SubagentError, W as SubagentErrorKind, X as SubagentRunContext, Y as SubagentRunOutcome, d as SubagentRunner, Z as TaskDelegation, f as TaskResult, T as TaskSpec, E as ToolRegistryView } from '../agent-subagent-runner-C6eqID1t.js';
19
+ export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DU64QxQa.js';
20
+ export { D as DEFAULT_MODES, a as Mode, b as ModeConfig, c as ModeManifest, M as ModeStore } from '../mode-ARA3HrkY.js';
21
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DbVe1dHT.js';
22
+ export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, d as SpecApiEndpoint, e as SpecRequirement, f as SpecSection, g as SpecSectionType, h as SpecStatus, i as SpecTemplate, j as SpecValidationResult, k as Specification, l as TaskAssignment, m as TaskDependency, n as TaskEdge, o as TaskFilter, T as TaskGraph, c as TaskNode, b as TaskPriority, p as TaskProgress, q as TaskSort, r as TaskStatus, a as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from '../task-graph-DJBqO0EY.js';
23
+ export { A as AggregateHealth, a as HealthCheck, b as HealthCheckResult, H as HealthRegistry, c as HealthStatus, d as MetricLabels, e as MetricSeries, M as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from '../observability-D-HZN_mF.js';
24
+ export { S as SystemPromptContributor } from '../index-D3Nax3YU.js';
25
+ import '../logger-B63L5bTg.js';
26
+ import '../retry-policy-BcmuT_V0.js';
27
+ import '../models-registry-B6_KfS65.js';
29
28
  import '../secret-vault-DoISxaKO.js';
30
- import '../secret-scrubber-3MHDDAtm.js';
31
29
  import '../path-resolver-CPRj4bFY.js';
32
30
  import '../goal-store-DvWLNu52.js';
33
- import '../multi-agent-coordinator-Da9nd8Ic.js';
31
+ import '../multi-agent-coordinator-DHNrjPaA.js';
34
32
  import 'node:events';
35
33
 
36
34
  /** Union of serial and parallel autonomy engine stage types (from EternalAutonomyEngine / ParallelEternalEngine). */
@@ -892,13 +892,25 @@ function round4(n) {
892
892
  return Math.round(n * 1e4) / 1e4;
893
893
  }
894
894
 
895
- // src/utils/token-estimate.ts
896
- function expectDefined(value) {
895
+ // src/types/memory.ts
896
+ var MEMORY_TYPE_LABELS = {
897
+ fact: "Fact",
898
+ decision: "Decision",
899
+ convention: "Convention",
900
+ preference: "Preference",
901
+ reference: "Reference",
902
+ anti_pattern: "Anti-pattern"
903
+ };
904
+
905
+ // src/utils/expect-defined.ts
906
+ function expectDefined(value, label) {
897
907
  if (value === null || value === void 0) {
898
908
  throw new Error("Expected value to be defined");
899
909
  }
900
910
  return value;
901
911
  }
912
+
913
+ // src/utils/token-estimate.ts
902
914
  var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
903
915
  var ESTIMATE_CACHE = /* @__PURE__ */ new Map();
904
916
  var ESTIMATE_CACHE_MAX_SIZE = 1e4;
@@ -982,12 +994,6 @@ function estimateRequestTokens(messages, systemPrompt, tools) {
982
994
  }
983
995
 
984
996
  // src/utils/message-invariants.ts
985
- function expectDefined2(value) {
986
- if (value === null || value === void 0) {
987
- throw new Error("Expected value to be defined");
988
- }
989
- return value;
990
- }
991
997
  function repairToolUseAdjacency(messages) {
992
998
  const removedToolUses = [];
993
999
  const removedToolResults = [];
@@ -995,7 +1001,7 @@ function repairToolUseAdjacency(messages) {
995
1001
  let changed = false;
996
1002
  const out = [];
997
1003
  for (let i = 0; i < messages.length; i++) {
998
- const original = expectDefined2(messages[i]);
1004
+ const original = expectDefined(messages[i]);
999
1005
  let msg = original;
1000
1006
  if (hasToolUse(msg)) {
1001
1007
  const nextIds = toolResultIds(messages[i + 1]);
@@ -2150,12 +2156,6 @@ Remember: your job is to make the user a better developer, not just to complete
2150
2156
  ];
2151
2157
 
2152
2158
  // src/types/context-window.ts
2153
- function expectDefined3(value) {
2154
- if (value === null || value === void 0) {
2155
- throw new Error("Expected value to be defined");
2156
- }
2157
- return value;
2158
- }
2159
2159
  var DEFAULT_CONTEXT_WINDOW_MODE_ID = "balanced";
2160
2160
  var CONTEXT_WINDOW_MODES = Object.freeze([
2161
2161
  {
@@ -2212,7 +2212,7 @@ function isContextWindowModeId(id) {
2212
2212
  }
2213
2213
  function resolveContextWindowPolicy(config = {}, overrideMode) {
2214
2214
  const requested = overrideMode ?? config.mode ?? DEFAULT_CONTEXT_WINDOW_MODE_ID;
2215
- const mode = getContextWindowMode(requested) ?? expectDefined3(getContextWindowMode(DEFAULT_CONTEXT_WINDOW_MODE_ID));
2215
+ const mode = getContextWindowMode(requested) ?? expectDefined(getContextWindowMode(DEFAULT_CONTEXT_WINDOW_MODE_ID));
2216
2216
  if (mode.id !== DEFAULT_CONTEXT_WINDOW_MODE_ID) {
2217
2217
  return mode;
2218
2218
  }
@@ -2669,12 +2669,6 @@ function createToolOutputSerializer(opts = {}) {
2669
2669
  }
2670
2670
 
2671
2671
  // src/execution/tool-executor.ts
2672
- function expectDefined4(value) {
2673
- if (value === null || value === void 0) {
2674
- throw new Error("Expected value to be defined");
2675
- }
2676
- return value;
2677
- }
2678
2672
  var ToolExecutor = class {
2679
2673
  constructor(registry, opts) {
2680
2674
  this.registry = registry;
@@ -3081,7 +3075,7 @@ function hasMalformedArguments(input) {
3081
3075
  function extractMalformedRaw(input) {
3082
3076
  if (!hasMalformedArguments(input)) return void 0;
3083
3077
  const obj = input;
3084
- const value = obj[expectDefined4(Object.keys(obj)[0])];
3078
+ const value = obj[expectDefined(Object.keys(obj)[0])];
3085
3079
  if (value === void 0 || value === null) return void 0;
3086
3080
  if (typeof value === "string") return value;
3087
3081
  try {
@@ -3128,12 +3122,6 @@ function compileUserRegex(pattern, flags) {
3128
3122
  }
3129
3123
 
3130
3124
  // src/storage/session-reader.ts
3131
- function expectDefined5(value) {
3132
- if (value === null || value === void 0) {
3133
- throw new Error("Expected value to be defined");
3134
- }
3135
- return value;
3136
- }
3137
3125
  var DefaultSessionReader = class {
3138
3126
  store;
3139
3127
  constructor(opts) {
@@ -3195,7 +3183,7 @@ var DefaultSessionReader = class {
3195
3183
  continue;
3196
3184
  }
3197
3185
  for (let i = 0; i < data.events.length; i++) {
3198
- const ev = expectDefined5(data.events[i]);
3186
+ const ev = expectDefined(data.events[i]);
3199
3187
  if (allowedTypes && !allowedTypes.has(ev.type)) continue;
3200
3188
  const text = eventText(ev);
3201
3189
  if (text === null) continue;
@@ -3409,6 +3397,6 @@ function renderPlainText(meta, events) {
3409
3397
  return lines.join("\n");
3410
3398
  }
3411
3399
 
3412
- export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SESSION_PRUNE_DAYS, 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 };
3400
+ export { AgentError, CONTEXT_WINDOW_MODES, ConfigError, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SESSION_PRUNE_DAYS, DEFAULT_SPEC_TEMPLATE, DEFAULT_TOOLS_CONFIG, DefaultErrorHandler, DefaultLogger, DefaultModelsRegistry, DefaultPathResolver, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultTokenCounter, ERROR_CODES, FsError, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, MEMORY_TYPE_LABELS, 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 };
3413
3401
  //# sourceMappingURL=index.js.map
3414
3402
  //# sourceMappingURL=index.js.map