@wrongstack/core 0.73.1 → 0.82.6

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 (79) hide show
  1. package/dist/{agent-bridge-C0Ze7Ldm.d.ts → agent-bridge-C9P_HPez.d.ts} +2 -2
  2. package/dist/{agent-subagent-runner-BmITbs1Q.d.ts → agent-subagent-runner-2Aq0jOSj.d.ts} +107 -102
  3. package/dist/{compactor-D_ExJajC.d.ts → compactor-CJq7LQev.d.ts} +3 -3
  4. package/dist/{config-Dy0CK_o6.d.ts → config-_DZ7dN-T.d.ts} +77 -75
  5. package/dist/{context-y87Jc5ei.d.ts → context-ToHAp4-U.d.ts} +119 -90
  6. package/dist/coordination/index.d.ts +16 -16
  7. package/dist/coordination/index.js +382 -43
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/defaults/index.d.ts +31 -31
  10. package/dist/defaults/index.js +524 -110
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{director-state-BmYi3DGA.d.ts → director-state-CgIc30qi.d.ts} +19 -19
  13. package/dist/{events-BBAlxBuw.d.ts → events-DnRqXaZ3.d.ts} +77 -39
  14. package/dist/execution/index.d.ts +53 -53
  15. package/dist/execution/index.js +67 -23
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/extension/index.d.ts +9 -9
  18. package/dist/extension/index.js +8 -1
  19. package/dist/extension/index.js.map +1 -1
  20. package/dist/{goal-store-C7jcumEh.d.ts → goal-store-DvWLNu52.d.ts} +4 -4
  21. package/dist/{index-yQbZ2NQx.d.ts → index-BNOLadHw.d.ts} +28 -28
  22. package/dist/{index-BN6i2Nfg.d.ts → index-N0_c4bHQ.d.ts} +45 -45
  23. package/dist/index.d.ts +233 -160
  24. package/dist/index.js +825 -160
  25. package/dist/index.js.map +1 -1
  26. package/dist/infrastructure/index.d.ts +9 -9
  27. package/dist/infrastructure/index.js +29 -7
  28. package/dist/infrastructure/index.js.map +1 -1
  29. package/dist/kernel/index.d.ts +14 -14
  30. package/dist/kernel/index.js +7 -0
  31. package/dist/kernel/index.js.map +1 -1
  32. package/dist/logger-B72yyPc6.d.ts +12 -0
  33. package/dist/{logger-bOzkF5LL.d.ts → logger-C_27pj9i.d.ts} +12 -4
  34. package/dist/{mcp-servers-T0O6UN_w.d.ts → mcp-servers-Dck3T85_.d.ts} +20 -20
  35. package/dist/{mode-BO4SEUIv.d.ts → mode-CHo2XtHs.d.ts} +4 -4
  36. package/dist/models/index.d.ts +10 -10
  37. package/dist/models/index.js +8 -2
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-BcYJDKLm.d.ts → models-registry-Be3osGt5.d.ts} +28 -28
  40. package/dist/{models-registry-Cuq1C8V9.d.ts → models-registry-Boz639EI.d.ts} +12 -12
  41. package/dist/{multi-agent-coordinator-BSBbZt0e.d.ts → multi-agent-coordinator-DllpCVkF.d.ts} +12 -12
  42. package/dist/{null-fleet-bus-BCIRT_nV.d.ts → null-fleet-bus-BY0AN-sr.d.ts} +129 -120
  43. package/dist/observability/index.d.ts +41 -41
  44. package/dist/observability/index.js.map +1 -1
  45. package/dist/{observability-BhnVLBLS.d.ts → observability-CoSNZdhX.d.ts} +4 -4
  46. package/dist/{parallel-eternal-engine-CjAYGaCw.d.ts → parallel-eternal-engine-D402RASp.d.ts} +49 -49
  47. package/dist/{path-resolver-BnqXa9Ze.d.ts → path-resolver-UPFTsDyD.d.ts} +6 -6
  48. package/dist/{permission-V5BLOrY6.d.ts → permission-14CChMmO.d.ts} +10 -8
  49. package/dist/{permission-policy-CBVx-d-8.d.ts → permission-policy-gW5htOo1.d.ts} +7 -7
  50. package/dist/{plan-templates-DBgrTGPu.d.ts → plan-templates-DRvPgkfZ.d.ts} +70 -32
  51. package/dist/{provider-runner-n3KkHT_w.d.ts → provider-runner-COAJM8tC.d.ts} +6 -6
  52. package/dist/{retry-policy-CG3qvH_e.d.ts → retry-policy-DSu6O6rD.d.ts} +4 -4
  53. package/dist/sdd/index.d.ts +47 -47
  54. package/dist/sdd/index.js +47 -22
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/security/index.d.ts +6 -6
  57. package/dist/security/index.js +7 -1
  58. package/dist/security/index.js.map +1 -1
  59. package/dist/{selector-RvBR_YRW.d.ts → selector-11-fm95U.d.ts} +2 -2
  60. package/dist/{session-event-bridge-CDHxcmQU.d.ts → session-event-bridge-D0u-x576.d.ts} +7 -7
  61. package/dist/{session-reader-BIpwM60D.d.ts → session-reader-BQU-toaN.d.ts} +23 -23
  62. package/dist/{skill-CxuWrsKK.d.ts → skill-BJeF2DwY.d.ts} +1 -1
  63. package/dist/skills/index.d.ts +9 -9
  64. package/dist/skills/index.js +15 -3
  65. package/dist/skills/index.js.map +1 -1
  66. package/dist/storage/index.d.ts +15 -15
  67. package/dist/storage/index.js +398 -80
  68. package/dist/storage/index.js.map +1 -1
  69. package/dist/{system-prompt-CA11g6Jo.d.ts → system-prompt-C0rLCeyn.d.ts} +16 -11
  70. package/dist/{task-graph-D1YQbpxF.d.ts → task-graph-CikNdRTG.d.ts} +22 -22
  71. package/dist/types/index.d.ts +25 -25
  72. package/dist/types/index.js +61 -12
  73. package/dist/types/index.js.map +1 -1
  74. package/dist/utils/index.d.ts +46 -45
  75. package/dist/utils/index.js +64 -13
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/{wstack-paths-eMXnY1_X.d.ts → wstack-paths-BQMvEllz.d.ts} +10 -3
  78. package/package.json +1 -1
  79. package/dist/logger-DDd5C--Z.d.ts +0 -12
@@ -1,5 +1,5 @@
1
- import { l as HookEvent, n as HookMatcher, I as InProcessHook, u as ShellHook, H as HookEntry } from './config-Dy0CK_o6.js';
2
- import { T as TextBlock, c as ContentBlock, Q as Tool } from './context-y87Jc5ei.js';
1
+ import { l as HookEvent, n as HookMatcher, I as InProcessHook, u as ShellHook, H as HookEntry } from './config-_DZ7dN-T.js';
2
+ import { T as TextBlock, c as ContentBlock, Q as Tool } from './context-ToHAp4-U.js';
3
3
 
4
4
  /**
5
5
  * Container — dependency injection with explicit bind / override / decorate.
@@ -15,8 +15,8 @@ type Token<T> = symbol & {
15
15
  type Factory<T> = (c: Container) => T;
16
16
  type Decorator<T> = (inner: T, c: Container) => T;
17
17
  interface BindOptions {
18
- singleton?: boolean;
19
- owner?: string;
18
+ singleton?: boolean | undefined;
19
+ owner?: string | undefined;
20
20
  }
21
21
  declare class Container {
22
22
  private readonly entries;
@@ -43,6 +43,11 @@ declare class Container {
43
43
  */
44
44
  private describeCycle;
45
45
  has<T>(token: Token<T>): boolean;
46
+ /**
47
+ * Resolve a token if it is bound, otherwise return undefined.
48
+ * Unlike resolve(), this does not throw if the token is unbound.
49
+ */
50
+ safeResolve<T>(token: Token<T>): T | undefined;
46
51
  ownerOf<T>(token: Token<T>): string | undefined;
47
52
  /**
48
53
  * Remove a token's binding (along with any decorators stacked on it).
@@ -93,18 +98,18 @@ type MiddlewareHandler<T> = (value: T, next: NextFn<T>) => Promise<T>;
93
98
  type PipelineErrorPolicy = 'rethrow' | 'swallow';
94
99
  interface PipelineErrorEvent {
95
100
  middleware: string;
96
- owner?: string;
101
+ owner?: string | undefined;
97
102
  err: unknown;
98
103
  }
99
104
  type PipelineErrorHandler = (ev: PipelineErrorEvent) => PipelineErrorPolicy | Promise<PipelineErrorPolicy>;
100
105
  interface Middleware<T> {
101
106
  name: string;
102
107
  handler: MiddlewareHandler<T>;
103
- owner?: string;
108
+ owner?: string | undefined;
104
109
  }
105
110
  interface PipelineOptions {
106
111
  /** When true and the target middleware is not found, operations silently no-op instead of throwing. */
107
- optional?: boolean;
112
+ optional?: boolean | undefined;
108
113
  }
109
114
  /**
110
115
  * Read-only view of a pipeline. Returned to consumers (plugins, hooks)
@@ -170,7 +175,7 @@ declare class Pipeline<T> {
170
175
  declare class HookRegistry {
171
176
  private readonly entries;
172
177
  /** Register an in-process hook. Returns an unsubscribe function. */
173
- registerInProcess(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, owner?: string): () => void;
178
+ registerInProcess(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, owner?: string | undefined): () => void;
174
179
  /** Register a single shell hook. Returns an unsubscribe function. */
175
180
  registerShell(event: HookEvent, hook: ShellHook): () => void;
176
181
  /** Bulk-load shell hooks from a `config.hooks` map. */
@@ -215,9 +220,9 @@ interface BuildContext {
215
220
  projectRoot: string;
216
221
  tools: Tool[];
217
222
  /** Provider id (e.g. "anthropic", "minimax-coding-plan"). */
218
- provider?: string;
223
+ provider?: string | undefined;
219
224
  /** Model id (e.g. "claude-sonnet-4-6", "MiniMax-M2.7"). */
220
- model?: string;
225
+ model?: string | undefined;
221
226
  /**
222
227
  * True when the prompt is being built for a SUBAGENT, not the host
223
228
  * agent. Subagents are scoped to a single task — they should NOT see
@@ -225,7 +230,7 @@ interface BuildContext {
225
230
  * turns, not steering individual subtasks). The plan-injection
226
231
  * layer short-circuits when this flag is set.
227
232
  */
228
- subagent?: boolean;
233
+ subagent?: boolean | undefined;
229
234
  }
230
235
  interface SystemPromptBuilder {
231
236
  build(ctx: BuildContext): Promise<TextBlock[]>;
@@ -5,7 +5,7 @@ interface SpecSection {
5
5
  title: string;
6
6
  content: string;
7
7
  level: number;
8
- children?: SpecSection[];
8
+ children?: SpecSection[] | undefined;
9
9
  }
10
10
  interface SpecRequirement {
11
11
  id: string;
@@ -13,8 +13,8 @@ interface SpecRequirement {
13
13
  priority: 'critical' | 'high' | 'medium' | 'low';
14
14
  description: string;
15
15
  acceptanceCriteria: string[];
16
- blockedBy?: string[];
17
- implements?: string[];
16
+ blockedBy?: string[] | undefined;
17
+ implements?: string[] | undefined;
18
18
  }
19
19
  interface SpecApiEndpoint {
20
20
  method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
@@ -22,7 +22,7 @@ interface SpecApiEndpoint {
22
22
  description: string;
23
23
  request?: Record<string, unknown>;
24
24
  response?: Record<string, unknown>;
25
- auth?: boolean;
25
+ auth?: boolean | undefined;
26
26
  }
27
27
  interface Specification {
28
28
  id: string;
@@ -32,8 +32,8 @@ interface Specification {
32
32
  overview: string;
33
33
  sections: SpecSection[];
34
34
  requirements: SpecRequirement[];
35
- apiEndpoints?: SpecApiEndpoint[];
36
- dependencies?: string[];
35
+ apiEndpoints?: SpecApiEndpoint[] | undefined;
36
+ dependencies?: string[] | undefined;
37
37
  createdAt: number;
38
38
  updatedAt: number;
39
39
  metadata?: Record<string, unknown>;
@@ -85,17 +85,17 @@ interface TaskNode {
85
85
  type: TaskType;
86
86
  priority: TaskPriority;
87
87
  status: TaskStatus;
88
- assignee?: string;
89
- estimateHours?: number;
90
- actualHours?: number;
91
- tags?: string[];
92
- specRequirementId?: string;
93
- parentId?: string;
94
- children?: string[];
88
+ assignee?: string | undefined;
89
+ estimateHours?: number | undefined;
90
+ actualHours?: number | undefined;
91
+ tags?: string[] | undefined;
92
+ specRequirementId?: string | undefined;
93
+ parentId?: string | undefined;
94
+ children?: string[] | undefined;
95
95
  createdAt: number;
96
96
  updatedAt: number;
97
- startedAt?: number;
98
- completedAt?: number;
97
+ startedAt?: number | undefined;
98
+ completedAt?: number | undefined;
99
99
  metadata?: Record<string, unknown>;
100
100
  }
101
101
  interface TaskEdge {
@@ -103,7 +103,7 @@ interface TaskEdge {
103
103
  from: string;
104
104
  to: string;
105
105
  type: 'blocks' | 'depends_on' | 'relates_to' | 'implements';
106
- weight?: number;
106
+ weight?: number | undefined;
107
107
  }
108
108
  interface TaskGraph {
109
109
  id: string;
@@ -138,12 +138,12 @@ interface TaskProgress {
138
138
  actualHours: number;
139
139
  }
140
140
  interface TaskFilter {
141
- status?: TaskStatus[];
142
- priority?: TaskPriority[];
143
- type?: TaskType[];
144
- assignee?: string[];
145
- tags?: string[];
146
- specRequirementId?: string;
141
+ status?: TaskStatus[] | undefined;
142
+ priority?: TaskPriority[] | undefined;
143
+ type?: TaskType[] | undefined;
144
+ assignee?: string[] | undefined;
145
+ tags?: string[] | undefined;
146
+ specRequirementId?: string | undefined;
147
147
  }
148
148
  interface TaskSort {
149
149
  field: 'priority' | 'createdAt' | 'updatedAt' | 'status';
@@ -1,36 +1,36 @@
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-y87Jc5ei.js';
2
- export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-n3KkHT_w.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-Dy0CK_o6.js';
4
- export { C as CompactReport, a as Compactor } from '../compactor-D_ExJajC.js';
5
- export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from '../permission-V5BLOrY6.js';
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-COAJM8tC.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';
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-BIpwM60D.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';
8
8
  export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, b as DEFAULT_SESSION_LOGGING_CONFIG, c as DEFAULT_TOOLS_CONFIG } from '../default-config-DEXI4jsl.js';
9
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-7rSC_emZ.js';
10
- export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-bOzkF5LL.js';
11
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-BnqXa9Ze.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-UPFTsDyD.js';
12
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-CjAYGaCw.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-CjAYGaCw.js';
15
- export { S as SkillEntry, a as SkillLoader, b as SkillManifest } from '../skill-CxuWrsKK.js';
16
- export { a as BuildContext, c as ModelCapabilities, e as Renderer, S as SystemPromptBuilder } from '../system-prompt-CA11g6Jo.js';
13
+ import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-D402RASp.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-D402RASp.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';
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-BmITbs1Q.js';
19
- export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-Cuq1C8V9.js';
20
- export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest, c as ModeStore } from '../mode-BO4SEUIv.js';
21
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-C0Ze7Ldm.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-D1YQbpxF.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-BhnVLBLS.js';
24
- export { S as SystemPromptContributor } from '../index-BN6i2Nfg.js';
25
- import '../events-BBAlxBuw.js';
26
- import '../logger-DDd5C--Z.js';
27
- import '../retry-policy-CG3qvH_e.js';
28
- import '../models-registry-BcYJDKLm.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-2Aq0jOSj.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-C9P_HPez.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-N0_c4bHQ.js';
25
+ import '../events-DnRqXaZ3.js';
26
+ import '../logger-B72yyPc6.js';
27
+ import '../retry-policy-DSu6O6rD.js';
28
+ import '../models-registry-Be3osGt5.js';
29
29
  import '../secret-vault-DoISxaKO.js';
30
30
  import '../secret-scrubber-3MHDDAtm.js';
31
31
  import '../path-resolver-CPRj4bFY.js';
32
- import '../goal-store-C7jcumEh.js';
33
- import '../multi-agent-coordinator-BSBbZt0e.js';
32
+ import '../goal-store-DvWLNu52.js';
33
+ import '../multi-agent-coordinator-DllpCVkF.js';
34
34
  import 'node:events';
35
35
 
36
36
  /** Union of serial and parallel autonomy engine stage types (from EternalAutonomyEngine / ParallelEternalEngine). */
@@ -2,6 +2,7 @@ import { randomBytes, createCipheriv, createDecipheriv, randomUUID } from 'crypt
2
2
  import * as fs2 from 'fs';
3
3
  import * as fs from 'fs/promises';
4
4
  import * as path4 from 'path';
5
+ import * as os from 'os';
5
6
 
6
7
  // src/types/blocks.ts
7
8
  function isTextBlock(b) {
@@ -605,8 +606,10 @@ function isStdoutTTY() {
605
606
  }
606
607
  function writeTo(s, stream) {
607
608
  if (!stream || typeof stream.write !== "function") return false;
608
- stream.write(s);
609
- return true;
609
+ {
610
+ stream.write(s);
611
+ return true;
612
+ }
610
613
  }
611
614
  function writeErr(s, stream = process.stderr) {
612
615
  return writeTo(s, stream);
@@ -659,11 +662,13 @@ var DefaultLogger = class _DefaultLogger {
659
662
  file;
660
663
  bindings;
661
664
  pretty;
665
+ stderr;
662
666
  constructor(opts = {}) {
663
667
  this.level = opts.level ?? process.env.WRONGSTACK_LOG_LEVEL ?? "info";
664
668
  this.file = opts.file;
665
669
  this.bindings = opts.bindings ?? {};
666
670
  this.pretty = opts.pretty ?? true;
671
+ this.stderr = opts.stderr !== false;
667
672
  if (this.file) {
668
673
  try {
669
674
  fs2.mkdirSync(path4.dirname(this.file), { recursive: true });
@@ -691,6 +696,7 @@ var DefaultLogger = class _DefaultLogger {
691
696
  level: this.level,
692
697
  file: this.file,
693
698
  pretty: this.pretty,
699
+ stderr: this.stderr,
694
700
  bindings: { ...this.bindings, ...bindings }
695
701
  });
696
702
  }
@@ -710,6 +716,7 @@ var DefaultLogger = class _DefaultLogger {
710
716
  } catch {
711
717
  }
712
718
  }
719
+ if (!this.stderr) return;
713
720
  if (r <= LEVEL_RANK.warn || this.level === "debug" || this.level === "trace") {
714
721
  const head = `${color.dim(ts)} ${COLORS[level](level.toUpperCase().padEnd(5))} ${msg}`;
715
722
  if (ctx !== void 0) {
@@ -766,7 +773,7 @@ var DefaultTokenCounter = class {
766
773
  } else if (this.registry && this.providerId && model) {
767
774
  if (this.priceCache.size >= PRICE_CACHE_MAX_SIZE) {
768
775
  const keys = [...this.priceCache.keys()];
769
- this.priceCache.delete(keys[0]);
776
+ this.priceCache.delete(keys[0] ?? "");
770
777
  }
771
778
  void this.registry.getModel(this.providerId, model).then((m) => {
772
779
  if (m) {
@@ -791,7 +798,7 @@ var DefaultTokenCounter = class {
791
798
  const price = priceFromModel(resolved);
792
799
  if (this.priceCache.size >= PRICE_CACHE_MAX_SIZE) {
793
800
  const keys = [...this.priceCache.keys()];
794
- this.priceCache.delete(keys[0]);
801
+ this.priceCache.delete(keys[0] ?? "");
795
802
  }
796
803
  this.priceCache.set(resolved.modelId, price);
797
804
  this.applyPrice(usage, price);
@@ -859,6 +866,12 @@ function round4(n) {
859
866
  }
860
867
 
861
868
  // src/utils/token-estimate.ts
869
+ function expectDefined(value) {
870
+ if (value === null || value === void 0) {
871
+ throw new Error("Expected value to be defined");
872
+ }
873
+ return value;
874
+ }
862
875
  var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
863
876
  var ESTIMATE_CACHE = /* @__PURE__ */ new Map();
864
877
  var ESTIMATE_CACHE_MAX_SIZE = 1e4;
@@ -868,7 +881,7 @@ function getCachedEstimate(key, compute) {
868
881
  if (ESTIMATE_CACHE.size >= ESTIMATE_CACHE_MAX_SIZE) {
869
882
  const keys = [...ESTIMATE_CACHE.keys()];
870
883
  for (let i = 0; i < Math.floor(ESTIMATE_CACHE_MAX_SIZE / 4); i++) {
871
- ESTIMATE_CACHE.delete(keys[i]);
884
+ ESTIMATE_CACHE.delete(expectDefined(keys[i]));
872
885
  }
873
886
  }
874
887
  const estimate = compute();
@@ -942,6 +955,12 @@ function estimateRequestTokens(messages, systemPrompt, tools) {
942
955
  }
943
956
 
944
957
  // src/utils/message-invariants.ts
958
+ function expectDefined2(value) {
959
+ if (value === null || value === void 0) {
960
+ throw new Error("Expected value to be defined");
961
+ }
962
+ return value;
963
+ }
945
964
  function repairToolUseAdjacency(messages) {
946
965
  const removedToolUses = [];
947
966
  const removedToolResults = [];
@@ -949,7 +968,7 @@ function repairToolUseAdjacency(messages) {
949
968
  let changed = false;
950
969
  const out = [];
951
970
  for (let i = 0; i < messages.length; i++) {
952
- const original = messages[i];
971
+ const original = expectDefined2(messages[i]);
953
972
  let msg = original;
954
973
  if (hasToolUse(msg)) {
955
974
  const nextIds = toolResultIds(messages[i + 1]);
@@ -1205,7 +1224,11 @@ var PROJECT_MARKERS = [
1205
1224
  "go.mod",
1206
1225
  "Cargo.toml",
1207
1226
  "pyproject.toml",
1208
- ".wrongstack"
1227
+ // Use AGENTS.md, not the bare .wrongstack directory. A bare .wrongstack/
1228
+ // directory can be the global config directory (~/.wrongstack), which is
1229
+ // NOT a project marker. Only .wrongstack/AGENTS.md signals a real
1230
+ // WrongStack project.
1231
+ ".wrongstack/AGENTS.md"
1209
1232
  ];
1210
1233
  var DefaultPathResolver = class {
1211
1234
  projectRoot;
@@ -1217,7 +1240,12 @@ var DefaultPathResolver = class {
1217
1240
  detectProjectRoot(start) {
1218
1241
  let dir = path4.resolve(start);
1219
1242
  const root = path4.parse(dir).root;
1243
+ const home = path4.resolve(os.homedir());
1244
+ const startPath = path4.resolve(start);
1220
1245
  while (dir !== root) {
1246
+ if (dir === home && dir !== startPath) {
1247
+ break;
1248
+ }
1221
1249
  for (const marker of PROJECT_MARKERS) {
1222
1250
  try {
1223
1251
  fs2.accessSync(path4.join(dir, marker));
@@ -1229,7 +1257,7 @@ var DefaultPathResolver = class {
1229
1257
  if (parent === dir) break;
1230
1258
  dir = parent;
1231
1259
  }
1232
- return path4.resolve(start);
1260
+ return startPath;
1233
1261
  }
1234
1262
  resolve(input) {
1235
1263
  const abs = path4.isAbsolute(input) ? input : path4.resolve(this.cwd, input);
@@ -2095,6 +2123,12 @@ Remember: your job is to make the user a better developer, not just to complete
2095
2123
  ];
2096
2124
 
2097
2125
  // src/types/context-window.ts
2126
+ function expectDefined3(value) {
2127
+ if (value === null || value === void 0) {
2128
+ throw new Error("Expected value to be defined");
2129
+ }
2130
+ return value;
2131
+ }
2098
2132
  var DEFAULT_CONTEXT_WINDOW_MODE_ID = "balanced";
2099
2133
  var CONTEXT_WINDOW_MODES = Object.freeze([
2100
2134
  {
@@ -2151,7 +2185,7 @@ function isContextWindowModeId(id) {
2151
2185
  }
2152
2186
  function resolveContextWindowPolicy(config = {}, overrideMode) {
2153
2187
  const requested = overrideMode ?? config.mode ?? DEFAULT_CONTEXT_WINDOW_MODE_ID;
2154
- const mode = getContextWindowMode(requested) ?? getContextWindowMode(DEFAULT_CONTEXT_WINDOW_MODE_ID);
2188
+ const mode = getContextWindowMode(requested) ?? expectDefined3(getContextWindowMode(DEFAULT_CONTEXT_WINDOW_MODE_ID));
2155
2189
  if (mode.id !== DEFAULT_CONTEXT_WINDOW_MODE_ID) {
2156
2190
  return mode;
2157
2191
  }
@@ -2202,7 +2236,7 @@ var InMemoryBridgeTransport = class {
2202
2236
  }
2203
2237
  subscribe(agentId, handler) {
2204
2238
  if (!this.subs.has(agentId)) this.subs.set(agentId, /* @__PURE__ */ new Set());
2205
- this.subs.get(agentId).add(handler);
2239
+ this.subs.get(agentId)?.add(handler);
2206
2240
  return () => this.subs.get(agentId)?.delete(handler);
2207
2241
  }
2208
2242
  close(agentId) {
@@ -2608,6 +2642,12 @@ function createToolOutputSerializer(opts = {}) {
2608
2642
  }
2609
2643
 
2610
2644
  // src/execution/tool-executor.ts
2645
+ function expectDefined4(value) {
2646
+ if (value === null || value === void 0) {
2647
+ throw new Error("Expected value to be defined");
2648
+ }
2649
+ return value;
2650
+ }
2611
2651
  var ToolExecutor = class {
2612
2652
  constructor(registry, opts) {
2613
2653
  this.registry = registry;
@@ -2896,6 +2936,9 @@ ${post.additionalContext}` };
2896
2936
  async runStreamedTool(tool, input, ctx, signal, toolUseId) {
2897
2937
  let finalOutput;
2898
2938
  let sawFinal = false;
2939
+ if (!tool.executeStream) {
2940
+ throw new Error(`Tool "${tool.name}" does not support streaming execution`);
2941
+ }
2899
2942
  const stream = tool.executeStream(input, ctx, { signal });
2900
2943
  for await (const ev of stream) {
2901
2944
  if (ev.type === "final") {
@@ -3000,7 +3043,7 @@ function hasMalformedArguments(input) {
3000
3043
  function extractMalformedRaw(input) {
3001
3044
  if (!hasMalformedArguments(input)) return void 0;
3002
3045
  const obj = input;
3003
- const value = obj[Object.keys(obj)[0]];
3046
+ const value = obj[expectDefined4(Object.keys(obj)[0])];
3004
3047
  if (value === void 0 || value === null) return void 0;
3005
3048
  if (typeof value === "string") return value;
3006
3049
  try {
@@ -3047,6 +3090,12 @@ function compileUserRegex(pattern, flags) {
3047
3090
  }
3048
3091
 
3049
3092
  // src/storage/session-reader.ts
3093
+ function expectDefined5(value) {
3094
+ if (value === null || value === void 0) {
3095
+ throw new Error("Expected value to be defined");
3096
+ }
3097
+ return value;
3098
+ }
3050
3099
  var DefaultSessionReader = class {
3051
3100
  store;
3052
3101
  constructor(opts) {
@@ -3108,7 +3157,7 @@ var DefaultSessionReader = class {
3108
3157
  continue;
3109
3158
  }
3110
3159
  for (let i = 0; i < data.events.length; i++) {
3111
- const ev = data.events[i];
3160
+ const ev = expectDefined5(data.events[i]);
3112
3161
  if (allowedTypes && !allowedTypes.has(ev.type)) continue;
3113
3162
  const text = eventText(ev);
3114
3163
  if (text === null) continue;