@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
@@ -1,4 +1,9 @@
1
- import { Q as Tool, d as Context, P as Permission } from './context-ToHAp4-U.js';
1
+ import { T as Tool, C as Context, f as Permission } from './context-CNRYfhUv.js';
2
+
3
+ interface SecretScrubber {
4
+ scrub(text: string): string;
5
+ scrubObject<T>(obj: T): T;
6
+ }
2
7
 
3
8
  interface TrustPolicy {
4
9
  [toolNameOrPattern: string]: {
@@ -62,4 +67,4 @@ interface PermissionPolicy {
62
67
  setPromptDelegate?(delegate: ((tool: Tool, input: unknown, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'deny'>) | undefined): void;
63
68
  }
64
69
 
65
- export type { PermissionDecision as P, TrustPolicy as T, PermissionPolicy as a };
70
+ export type { PermissionPolicy as P, SecretScrubber as S, TrustPolicy as T, PermissionDecision as a };
@@ -1,6 +1,6 @@
1
- import { Q as Tool, d as Context } from './context-ToHAp4-U.js';
1
+ import { T as Tool, C as Context } from './context-CNRYfhUv.js';
2
2
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
3
- import { a as PermissionPolicy, P as PermissionDecision } from './permission-14CChMmO.js';
3
+ import { P as PermissionPolicy, a as PermissionDecision } from './permission-BDv7z0mk.js';
4
4
 
5
5
  interface PermissionPolicyOptions {
6
6
  trustFile: string;
@@ -1,5 +1,75 @@
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';
1
+ import { T as Tool, l as TextBlock, g as ContentBlock } from './context-CNRYfhUv.js';
2
+ import { H as HookEvent, a as HookMatcher, I as InProcessHook, S as ShellHook, b as HookEntry } from './config-84VaZpH6.js';
3
+
4
+ /** Model capabilities relevant to prompt composition. */
5
+ interface ModelCapabilities {
6
+ maxContextTokens: number;
7
+ supportsTools: boolean;
8
+ supportsVision: boolean;
9
+ supportsReasoning: boolean;
10
+ }
11
+ interface BuildContext {
12
+ cwd: string;
13
+ projectRoot: string;
14
+ tools: Tool[];
15
+ /** Provider id (e.g. "anthropic", "minimax-coding-plan"). */
16
+ provider?: string | undefined;
17
+ /** Model id (e.g. "claude-sonnet-4-6", "MiniMax-M2.7"). */
18
+ model?: string | undefined;
19
+ /**
20
+ * True when the prompt is being built for a SUBAGENT, not the host
21
+ * agent. Subagents are scoped to a single task — they should NOT see
22
+ * the host's strategic plan board (which is anchoring the host across
23
+ * turns, not steering individual subtasks). The plan-injection
24
+ * layer short-circuits when this flag is set.
25
+ */
26
+ subagent?: boolean | undefined;
27
+ }
28
+ interface SystemPromptBuilder {
29
+ build(ctx: BuildContext): Promise<TextBlock[]>;
30
+ }
31
+
32
+ /**
33
+ * Registry of lifecycle hooks (both in-process and shell). One instance is
34
+ * shared per session: the boot path loads `config.hooks` as shell entries and
35
+ * plugins add in-process entries via `PluginAPI.registerHook`. The
36
+ * `HookRunner` reads from it at each lifecycle phase.
37
+ */
38
+ declare class HookRegistry {
39
+ private readonly entries;
40
+ /** Register an in-process hook. Returns an unsubscribe function. */
41
+ registerInProcess(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, owner?: string | undefined): () => void;
42
+ /** Register a single shell hook. Returns an unsubscribe function. */
43
+ registerShell(event: HookEvent, hook: ShellHook): () => void;
44
+ /** Bulk-load shell hooks from a `config.hooks` map. */
45
+ loadShellHooks(hooks: Partial<Record<HookEvent, ShellHook[]>> | undefined): void;
46
+ /** All entries registered for an event, in registration order. */
47
+ list(event: HookEvent): readonly HookEntry[];
48
+ /** True when any entry is registered for the event. */
49
+ has(event: HookEvent): boolean;
50
+ /** Drop every registered hook (used in teardown / tests). */
51
+ clear(): void;
52
+ private remove;
53
+ }
54
+ /**
55
+ * Does a hook matcher apply to a tool name? `*` (or empty) matches everything;
56
+ * otherwise the matcher is a case-insensitive pipe-delimited list of exact
57
+ * tool names (`"edit|write"`). Non-tool events pass `undefined` and always match.
58
+ */
59
+ declare function hookMatcherMatches(matcher: HookMatcher, toolName: string | undefined): boolean;
60
+
61
+ interface Renderer {
62
+ write(text: string | TextBlock): void;
63
+ writeLine(text?: string): void;
64
+ writeBlock(block: ContentBlock): void;
65
+ writeToolCall(name: string, input: unknown): void;
66
+ writeToolResult(name: string, content: unknown, isError: boolean): void;
67
+ writeDiff(unifiedDiff: string): void;
68
+ writeWarning(text: string): void;
69
+ writeError(text: string): void;
70
+ writeInfo(text: string): void;
71
+ clear(): void;
72
+ }
3
73
 
4
74
  /**
5
75
  * Container — dependency injection with explicit bind / override / decorate.
@@ -166,74 +236,4 @@ declare class Pipeline<T> {
166
236
  private ensureUnique;
167
237
  }
168
238
 
169
- /**
170
- * Registry of lifecycle hooks (both in-process and shell). One instance is
171
- * shared per session: the boot path loads `config.hooks` as shell entries and
172
- * plugins add in-process entries via `PluginAPI.registerHook`. The
173
- * `HookRunner` reads from it at each lifecycle phase.
174
- */
175
- declare class HookRegistry {
176
- private readonly entries;
177
- /** Register an in-process hook. Returns an unsubscribe function. */
178
- registerInProcess(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, owner?: string | undefined): () => void;
179
- /** Register a single shell hook. Returns an unsubscribe function. */
180
- registerShell(event: HookEvent, hook: ShellHook): () => void;
181
- /** Bulk-load shell hooks from a `config.hooks` map. */
182
- loadShellHooks(hooks: Partial<Record<HookEvent, ShellHook[]>> | undefined): void;
183
- /** All entries registered for an event, in registration order. */
184
- list(event: HookEvent): readonly HookEntry[];
185
- /** True when any entry is registered for the event. */
186
- has(event: HookEvent): boolean;
187
- /** Drop every registered hook (used in teardown / tests). */
188
- clear(): void;
189
- private remove;
190
- }
191
- /**
192
- * Does a hook matcher apply to a tool name? `*` (or empty) matches everything;
193
- * otherwise the matcher is a case-insensitive pipe-delimited list of exact
194
- * tool names (`"edit|write"`). Non-tool events pass `undefined` and always match.
195
- */
196
- declare function hookMatcherMatches(matcher: HookMatcher, toolName: string | undefined): boolean;
197
-
198
- interface Renderer {
199
- write(text: string | TextBlock): void;
200
- writeLine(text?: string): void;
201
- writeBlock(block: ContentBlock): void;
202
- writeToolCall(name: string, input: unknown): void;
203
- writeToolResult(name: string, content: unknown, isError: boolean): void;
204
- writeDiff(unifiedDiff: string): void;
205
- writeWarning(text: string): void;
206
- writeError(text: string): void;
207
- writeInfo(text: string): void;
208
- clear(): void;
209
- }
210
-
211
- /** Model capabilities relevant to prompt composition. */
212
- interface ModelCapabilities {
213
- maxContextTokens: number;
214
- supportsTools: boolean;
215
- supportsVision: boolean;
216
- supportsReasoning: boolean;
217
- }
218
- interface BuildContext {
219
- cwd: string;
220
- projectRoot: string;
221
- tools: Tool[];
222
- /** Provider id (e.g. "anthropic", "minimax-coding-plan"). */
223
- provider?: string | undefined;
224
- /** Model id (e.g. "claude-sonnet-4-6", "MiniMax-M2.7"). */
225
- model?: string | undefined;
226
- /**
227
- * True when the prompt is being built for a SUBAGENT, not the host
228
- * agent. Subagents are scoped to a single task — they should NOT see
229
- * the host's strategic plan board (which is anchoring the host across
230
- * turns, not steering individual subtasks). The plan-injection
231
- * layer short-circuits when this flag is set.
232
- */
233
- subagent?: boolean | undefined;
234
- }
235
- interface SystemPromptBuilder {
236
- build(ctx: BuildContext): Promise<TextBlock[]>;
237
- }
238
-
239
- export { type BindOptions as B, Container as C, type Decorator as D, type Factory as F, HookRegistry as H, type Middleware as M, type NextFn as N, Pipeline as P, type ReadonlyPipeline as R, type SystemPromptBuilder as S, type Token as T, type BuildContext as a, type MiddlewareHandler as b, type ModelCapabilities as c, type PipelineOptions as d, type Renderer as e, hookMatcherMatches as h };
239
+ export { type BuildContext as B, Container as C, type Decorator as D, type Factory as F, HookRegistry as H, type ModelCapabilities as M, type NextFn as N, Pipeline as P, type ReadonlyPipeline as R, type SystemPromptBuilder as S, type Token as T, type Renderer as a, type BindOptions as b, type Middleware as c, type MiddlewareHandler as d, type PipelineOptions as e, hookMatcherMatches as h };
@@ -1,10 +1,9 @@
1
- import { E as EventBus } from './events-DzyLtja6.js';
2
- import { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
3
- import { y as SessionStore, x as SessionMetadata, B as SessionWriter, r as ResumedSession, S as SessionData, z as SessionSummary, c as ContentBlock, w as SessionEvent, N as TodoItem, f as ConversationState } from './context-ToHAp4-U.js';
4
- import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-BQU-toaN.js';
5
- import { b as MemoryStore, a as MemoryScope } from './memory-CEXuo7sz.js';
6
- import { a as WstackPaths } from './wstack-paths-BQMvEllz.js';
7
- import { c as ConfigStore, a as Config, b as ConfigLoader, w as SyncConfig } from './config-_DZ7dN-T.js';
1
+ import { E as EventBus, M as MemoryScope, k as MemoryEntry, l as MemoryStore, m as MemoryRelevanceContext, S as ScoredEntry } from './brain-s9DyD_Vf.js';
2
+ import { S as SecretScrubber } from './permission-BDv7z0mk.js';
3
+ import { i as SessionStore, h as SessionMetadata, a as SessionWriter, p as ResumedSession, q as SessionData, r as SessionSummary, g as ContentBlock, S as SessionEvent, s as TodoItem, t as ConversationState } from './context-CNRYfhUv.js';
4
+ import { A as AttachmentStore, a as AddAttachmentInput, b as AttachmentRef, c as Attachment } from './session-reader-DDz1Ek4V.js';
5
+ import { W as WstackPaths } from './wstack-paths-_lqjzErq.js';
6
+ import { c as ConfigStore, C as Config, d as ConfigLoader, e as SyncConfig } from './config-84VaZpH6.js';
8
7
  import { S as SecretVault } from './secret-vault-DoISxaKO.js';
9
8
 
10
9
  interface SessionStoreOptions {
@@ -141,8 +140,49 @@ declare class DefaultAttachmentStore implements AttachmentStore {
141
140
  private toBlock;
142
141
  }
143
142
 
143
+ interface MemoryBackend {
144
+ readonly kind: string;
145
+ remember(scope: MemoryScope, entry: MemoryEntry, filePath: string): Promise<void>;
146
+ forget(scope: MemoryScope, query: string, filePath: string): Promise<number>;
147
+ readAll(scope: MemoryScope, filePath: string): Promise<string>;
148
+ list(scope: MemoryScope, filePath: string, limit?: number | undefined): Promise<MemoryEntry[]>;
149
+ search(scope: MemoryScope, query: string, filePath: string, limit?: number | undefined): Promise<MemoryEntry[]>;
150
+ /** Find memories related to the given text via graph traversal. Optional — falls back to search. */
151
+ findRelated?(scope: MemoryScope, filePath: string, text: string, limit: number): Promise<MemoryEntry[]>;
152
+ clear(scope: MemoryScope, filePath: string): Promise<void>;
153
+ consolidate(scope: MemoryScope, filePath: string): Promise<number>;
154
+ }
155
+ interface FileMemoryBackendOptions {
156
+ paths: WstackPaths;
157
+ }
158
+ declare class FileMemoryBackend implements MemoryBackend {
159
+ readonly kind = "file";
160
+ private readonly files;
161
+ constructor(opts: FileMemoryBackendOptions);
162
+ private resolveFile;
163
+ remember(scope: MemoryScope, entry: MemoryEntry, filePath: string): Promise<void>;
164
+ forget(scope: MemoryScope, query: string, filePath: string): Promise<number>;
165
+ readAll(scope: MemoryScope, filePath: string): Promise<string>;
166
+ list(scope: MemoryScope, filePath: string, limit?: number): Promise<MemoryEntry[]>;
167
+ search(scope: MemoryScope, query: string, filePath: string, limit?: number): Promise<MemoryEntry[]>;
168
+ clear(scope: MemoryScope, filePath: string): Promise<void>;
169
+ consolidate(scope: MemoryScope, filePath: string): Promise<number>;
170
+ }
171
+ declare function parseEntries(raw: string, scope?: MemoryScope): MemoryEntry[];
172
+
144
173
  interface MemoryStoreOptions {
145
174
  paths: WstackPaths;
175
+ /**
176
+ * Optional event bus — when provided, mutations emit events so plugins
177
+ * and other subsystems can react to memory changes.
178
+ */
179
+ events?: EventBus | undefined;
180
+ /**
181
+ * Storage backend. Defaults to FileMemoryBackend when omitted.
182
+ * Plugins can register a custom backend (graph, semantic, vector)
183
+ * via the DI container to override storage behavior.
184
+ */
185
+ backend?: MemoryBackend | undefined;
146
186
  }
147
187
  /**
148
188
  * Three scopes:
@@ -152,6 +192,8 @@ interface MemoryStoreOptions {
152
192
  */
153
193
  declare class DefaultMemoryStore implements MemoryStore {
154
194
  private readonly files;
195
+ private readonly events?;
196
+ private readonly backend;
155
197
  /**
156
198
  * Per-scope serialization queue. `remember` / `forget` / `consolidate` /
157
199
  * `clear` are read-modify-write against a single file; without a lock,
@@ -168,16 +210,42 @@ declare class DefaultMemoryStore implements MemoryStore {
168
210
  private readonly writeChain;
169
211
  /** Last write error per scope — surfaced as warnings on the next readAll(). */
170
212
  private readonly writeErrors;
213
+ /**
214
+ * When the global root is a temporary directory (opencode, CI sandboxes),
215
+ * memory files are also mirrored to the project tree so they survive
216
+ * session cleanup. The primary path stays in the temp root for isolation;
217
+ * this backup ensures memory is never lost.
218
+ */
219
+ private readonly persistBackup;
220
+ private readonly backupDir;
171
221
  constructor(opts: MemoryStoreOptions);
222
+ /** Expose the backend for plugin introspection and advanced queries. */
223
+ getBackend(): MemoryBackend;
172
224
  private runSerialized;
173
225
  readAll(): Promise<string>;
174
226
  read(scope: MemoryScope): Promise<string>;
175
- remember(text: string, scope?: MemoryScope): Promise<void>;
227
+ /**
228
+ * List entries from a scope, newest first. Delegates to the backend
229
+ * so graph/semantic backends can return enriched or filtered results.
230
+ */
231
+ list(scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
232
+ /**
233
+ * Find memories related to the given text via graph traversal.
234
+ * Falls back to content search when no graph backend is available.
235
+ */
236
+ findRelated(text: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
237
+ search(query: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
238
+ remember(text: string, scope?: MemoryScope, metadata?: Omit<Partial<MemoryEntry>, 'scope' | 'text' | 'ts'>): Promise<void>;
239
+ /**
240
+ * Score and rank memories by relevance to the current context.
241
+ * Returns entries with score >= MIN_RELEVANCE_SCORE, sorted highest first.
242
+ */
243
+ scoreRelevant(ctx: MemoryRelevanceContext, scope?: MemoryScope, limit?: number): Promise<ScoredEntry[]>;
176
244
  forget(query: string, scope?: MemoryScope): Promise<number>;
177
- private forgetUnsafe;
178
245
  consolidate(scope: MemoryScope): Promise<void>;
179
- private consolidateUnsafe;
180
246
  clear(scope?: MemoryScope): Promise<void>;
247
+ /** Mirror current memory content to the persistent backup directory. */
248
+ private mirrorBackup;
181
249
  }
182
250
 
183
251
  /**
@@ -571,4 +639,4 @@ declare function listPlanTemplates(): PlanTemplate[];
571
639
  declare function getPlanTemplate(name: string): PlanTemplate | undefined;
572
640
  declare function formatPlanTemplates(): string;
573
641
 
574
- export { type AbandonedSession as A, loadPlan as B, type ConfigLoaderOptions as C, DEFAULT_CONFIG_MIGRATIONS as D, loadTodosCheckpoint as E, removePlanItem as F, runConfigMigrations as G, savePlan as H, saveTodosCheckpoint as I, setPlanItemStatus as J, type MemoryStoreOptions as M, type PersistedQueueItem as P, QueueStore as Q, RecoveryLock as R, SessionAnalyzer as S, type TodosCheckpointFile as T, type AttachmentStoreOptions as a, type ConfigMigration as b, ConfigMigrationError as c, type ConfigSource as d, DefaultAttachmentStore as e, DefaultConfigLoader as f, DefaultConfigStore as g, DefaultMemoryStore as h, DefaultSessionStore as i, type MigrationContext as j, type MigrationResult as k, type PlanFile as l, type PlanItem as m, type PlanTemplate as n, type RecoveryLockOptions as o, type SessionStoreOptions as p, addPlanItem as q, attachPlanCheckpoint as r, attachTodosCheckpoint as s, clearPlan as t, deriveTodosFromPlanItem as u, emptyPlan as v, formatPlan as w, formatPlanTemplates as x, getPlanTemplate as y, listPlanTemplates as z };
642
+ export { type AbandonedSession as A, getPlanTemplate as B, type ConfigLoaderOptions as C, DEFAULT_CONFIG_MIGRATIONS as D, listPlanTemplates as E, FileMemoryBackend as F, loadPlan as G, loadTodosCheckpoint as H, parseEntries as I, removePlanItem as J, runConfigMigrations as K, savePlan as L, type MemoryBackend as M, saveTodosCheckpoint as N, setPlanItemStatus as O, type PersistedQueueItem as P, QueueStore as Q, RecoveryLock as R, SessionAnalyzer as S, type TodosCheckpointFile as T, type AttachmentStoreOptions as a, type ConfigMigration as b, ConfigMigrationError as c, type ConfigSource as d, DefaultAttachmentStore as e, DefaultConfigLoader as f, DefaultConfigStore as g, DefaultMemoryStore as h, DefaultSessionStore as i, type FileMemoryBackendOptions as j, type MemoryStoreOptions as k, type MigrationContext as l, type MigrationResult as m, type PlanFile as n, type PlanItem as o, type PlanTemplate as p, type RecoveryLockOptions as q, type SessionStoreOptions as r, addPlanItem as s, attachPlanCheckpoint as t, attachTodosCheckpoint as u, clearPlan as v, deriveTodosFromPlanItem as w, emptyPlan as x, formatPlan as y, formatPlanTemplates as z };
@@ -1,8 +1,8 @@
1
- import { E as EventBus } from './events-DzyLtja6.js';
2
- import { a as Logger } from './logger-B72yyPc6.js';
3
- import { T as Tracer } from './observability-CoSNZdhX.js';
4
- import { m as Provider, p as Request, d as Context, q as Response } from './context-ToHAp4-U.js';
5
- import { a as RetryPolicy } from './retry-policy-DSu6O6rD.js';
1
+ import { E as EventBus } from './brain-s9DyD_Vf.js';
2
+ import { L as Logger } from './logger-B63L5bTg.js';
3
+ import { T as Tracer } from './observability-D-HZN_mF.js';
4
+ import { P as Provider, R as Request, C as Context, b as Response } from './context-CNRYfhUv.js';
5
+ import { R as RetryPolicy } from './retry-policy-BcmuT_V0.js';
6
6
 
7
7
  /**
8
8
  * Options passed to a ProviderRunner when calling the provider.
@@ -1,4 +1,4 @@
1
- import { d as Context, q as Response, n as ProviderError } from './context-ToHAp4-U.js';
1
+ import { C as Context, b as Response, e as ProviderError } from './context-CNRYfhUv.js';
2
2
 
3
3
  type RecoveryDecision = {
4
4
  /**
@@ -43,4 +43,4 @@ interface RetryPolicy {
43
43
  maxAttempts(err: ProviderError | Error): number;
44
44
  }
45
45
 
46
- export type { ErrorHandler as E, RecoveryDecision as R, RetryPolicy as a };
46
+ export type { ErrorHandler as E, RetryPolicy as R, RecoveryDecision as a };
@@ -1,16 +1,15 @@
1
- import { h as Specification, S as SpecAnalysis, g as SpecValidationResult, l as TaskGraph, m as TaskNode, k as TaskFilter, p as TaskSort, o as TaskProgress, r as TaskType, n as TaskPriority, e as SpecStatus, f as SpecTemplate, b as SpecRequirement } from '../task-graph-CikNdRTG.js';
2
- import { E as EventBus } from '../events-DzyLtja6.js';
3
- import { D as DoneCondition, A as Agent, c as AgentFactory, X as TaskResult } from '../agent-subagent-runner-CQaLFNnA.js';
4
- import '../context-ToHAp4-U.js';
5
- import '../index-Dx-CnrDN.js';
6
- import '../logger-B72yyPc6.js';
7
- import '../system-prompt-C0rLCeyn.js';
8
- import '../config-_DZ7dN-T.js';
9
- import '../models-registry-Be3osGt5.js';
10
- import '../observability-CoSNZdhX.js';
11
- import '../secret-scrubber-3MHDDAtm.js';
12
- import '../permission-14CChMmO.js';
13
- import '../retry-policy-DSu6O6rD.js';
1
+ import { k as Specification, S as SpecAnalysis, j as SpecValidationResult, T as TaskGraph, c as TaskNode, o as TaskFilter, q as TaskSort, p as TaskProgress, a as TaskType, b as TaskPriority, h as SpecStatus, i as SpecTemplate, e as SpecRequirement } from '../task-graph-DJBqO0EY.js';
2
+ import { E as EventBus } from '../brain-s9DyD_Vf.js';
3
+ import { O as DoneCondition, g as Agent, h as AgentFactory, f as TaskResult } from '../agent-subagent-runner-C6eqID1t.js';
4
+ import '../context-CNRYfhUv.js';
5
+ import '../index-D3Nax3YU.js';
6
+ import '../logger-B63L5bTg.js';
7
+ import '../pipeline-C1Ad9OjI.js';
8
+ import '../config-84VaZpH6.js';
9
+ import '../models-registry-B6_KfS65.js';
10
+ import '../observability-D-HZN_mF.js';
11
+ import '../permission-BDv7z0mk.js';
12
+ import '../retry-policy-BcmuT_V0.js';
14
13
 
15
14
  declare class SpecParser {
16
15
  parse(content: string): Specification;
@@ -708,26 +707,6 @@ declare class SddTaskDecomposer {
708
707
  private hasAnyBlockedTasks;
709
708
  }
710
709
 
711
- /**
712
- * SddParallelRun
713
- *
714
- * Drives a TaskGraph through ParallelEternalEngine's infrastructure
715
- * (DefaultMultiAgentCoordinator + AgentSubagentRunner) but powered by
716
- * SddTaskDecomposer — producing dependency-aware waves instead of
717
- * goal-driven iterations.
718
- *
719
- * One-shot: completes when all tasks are done OR a deadlock is detected.
720
- * Does NOT loop — each run() call is a discrete execution.
721
- *
722
- * Usage:
723
- * ```
724
- * const run = new SddParallelRun({ tracker, graph, agent, projectRoot });
725
- * await run.run({ onWave });
726
- * // or with progress callback:
727
- * await run.run({ onProgress: (p) => console.log(renderProgress(p)) });
728
- * ```
729
- */
730
-
731
710
  interface SddParallelRunOptions {
732
711
  /** Pre-constructed TaskTracker (must already hold the graph's initial state). */
733
712
  tracker: TaskTracker;
package/dist/sdd/index.js CHANGED
@@ -1243,13 +1243,15 @@ var TaskGraphStore = class {
1243
1243
  }
1244
1244
  };
1245
1245
 
1246
- // src/sdd/spec-builder.ts
1247
- function expectDefined(value) {
1246
+ // src/utils/expect-defined.ts
1247
+ function expectDefined(value, label) {
1248
1248
  if (value === null || value === void 0) {
1249
1249
  throw new Error("Expected value to be defined");
1250
1250
  }
1251
1251
  return value;
1252
1252
  }
1253
+
1254
+ // src/sdd/spec-builder.ts
1253
1255
  function buildQuestioningPrompt(session, min, max) {
1254
1256
  const answered = session.answers.length;
1255
1257
  const remaining = Math.max(0, min - answered);
@@ -2037,12 +2039,6 @@ function truncate(str, maxLen) {
2037
2039
  }
2038
2040
 
2039
2041
  // src/sdd/critical-path.ts
2040
- function expectDefined2(value) {
2041
- if (value === null || value === void 0) {
2042
- throw new Error("Expected value to be defined");
2043
- }
2044
- return value;
2045
- }
2046
2042
  function analyzeCriticalPath(graph) {
2047
2043
  const nodes = Array.from(graph.nodes.values());
2048
2044
  const topoOrder = topologicalSort(graph);
@@ -2118,7 +2114,7 @@ function getTransitiveBlocked(_graph, taskId, blocksMap) {
2118
2114
  const visited = /* @__PURE__ */ new Set();
2119
2115
  const queue = [taskId];
2120
2116
  while (queue.length > 0) {
2121
- const current = expectDefined2(queue.shift());
2117
+ const current = expectDefined(queue.shift());
2122
2118
  const blocked = blocksMap.get(current);
2123
2119
  if (!blocked) continue;
2124
2120
  for (const id of blocked) {
@@ -2164,7 +2160,7 @@ function computeCriticalPath(graph, _topoOrder, blockedByMap) {
2164
2160
  if (!changed) break;
2165
2161
  }
2166
2162
  let maxDist = 0;
2167
- let maxId = expectDefined2(allIds[0]);
2163
+ let maxId = expectDefined(allIds[0]);
2168
2164
  for (const id of allIds) {
2169
2165
  const d = dist.get(id) ?? 0;
2170
2166
  if (d > maxDist) {
@@ -2991,15 +2987,7 @@ function makeAgentSubagentRunner(opts) {
2991
2987
  let budgetError = null;
2992
2988
  const onBudgetError = (err) => {
2993
2989
  if (err instanceof BudgetThresholdSignal) {
2994
- err.decision.then((decision) => {
2995
- if (decision === "stop") {
2996
- budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
2997
- aborter.abort();
2998
- }
2999
- }).catch(() => {
3000
- budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
3001
- aborter.abort();
3002
- });
2990
+ budgetError = err;
3003
2991
  return;
3004
2992
  }
3005
2993
  aborter.abort();
@@ -3107,15 +3095,23 @@ function makeAgentSubagentRunner(opts) {
3107
3095
  }
3108
3096
  if (budgetError) {
3109
3097
  if ("decision" in budgetError) {
3110
- const decision = await budgetError.decision;
3111
- if (decision === "stop") {
3098
+ try {
3099
+ const decision = await budgetError.decision;
3100
+ if (decision === "stop") {
3101
+ budgetError = new BudgetExceededError(
3102
+ budgetError.kind,
3103
+ budgetError.limit,
3104
+ budgetError.used
3105
+ );
3106
+ } else {
3107
+ budgetError = null;
3108
+ }
3109
+ } catch {
3112
3110
  budgetError = new BudgetExceededError(
3113
3111
  budgetError.kind,
3114
3112
  budgetError.limit,
3115
3113
  budgetError.used
3116
3114
  );
3117
- } else {
3118
- budgetError = null;
3119
3115
  }
3120
3116
  }
3121
3117
  if (budgetError) throw budgetError;
@@ -6364,12 +6360,6 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
6364
6360
  };
6365
6361
 
6366
6362
  // src/sdd/sdd-parallel-run.ts
6367
- function expectDefined3(value) {
6368
- if (value === null || value === void 0) {
6369
- throw new Error("Expected value to be defined");
6370
- }
6371
- return value;
6372
- }
6373
6363
  var SddParallelRun = class {
6374
6364
  constructor(opts) {
6375
6365
  this.opts = opts;
@@ -6518,8 +6508,8 @@ var SddParallelRun = class {
6518
6508
  const successCount = results.filter((r) => r.status === "success").length;
6519
6509
  const failCount = results.length - successCount;
6520
6510
  for (let i = 0; i < results.length; i++) {
6521
- const result = expectDefined3(results[i]);
6522
- const taskId = expectDefined3(taskIds[i]);
6511
+ const result = expectDefined(results[i]);
6512
+ const taskId = expectDefined(taskIds[i]);
6523
6513
  if (result.status === "success") {
6524
6514
  this.opts.tracker.updateNodeStatus(taskId, "completed");
6525
6515
  } else {