@wrongstack/core 0.89.1 → 0.104.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/{agent-bridge-B8F2ORwg.d.ts → agent-bridge-mOxbpFcg.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CQaLFNnA.d.ts → agent-subagent-runner-DukQLUcS.d.ts} +433 -433
  3. package/dist/{events-DzyLtja6.d.ts → brain-Dfv4Y82E.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-BSU-6vah.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 +128 -37
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +34 -35
  11. package/dist/defaults/index.js +752 -218
  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 +65 -370
  15. package/dist/execution/index.js +446 -53
  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/goal-preamble-CI8lxeY1.d.ts +378 -0
  21. package/dist/{goal-store-DvWLNu52.d.ts → goal-store-ht0VmR1A.d.ts} +63 -21
  22. package/dist/{index-Ca_lOmKl.d.ts → index-BWRN6wOb.d.ts} +13 -15
  23. package/dist/{index-Dx-CnrDN.d.ts → index-DIKEcfgC.d.ts} +9 -10
  24. package/dist/index.d.ts +188 -176
  25. package/dist/index.js +1508 -407
  26. package/dist/index.js.map +1 -1
  27. package/dist/infrastructure/index.d.ts +9 -9
  28. package/dist/infrastructure/index.js +4 -2
  29. package/dist/infrastructure/index.js.map +1 -1
  30. package/dist/kernel/index.d.ts +14 -16
  31. package/dist/kernel/index.js.map +1 -1
  32. package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
  33. package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
  34. package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-CXCsANdY.d.ts} +3 -3
  35. package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +8 -6
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
  40. package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
  41. package/dist/{multi-agent-coordinator-Da9nd8Ic.d.ts → multi-agent-coordinator-51LvnXkD.d.ts} +2 -2
  42. package/dist/{null-fleet-bus-CHJOXv3t.d.ts → null-fleet-bus-D09hMzFQ.d.ts} +32 -31
  43. package/dist/observability/index.d.ts +3 -3
  44. package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
  45. package/dist/{parallel-eternal-engine-DyMCj2Pw.d.ts → parallel-eternal-engine-CUtmM_0V.d.ts} +54 -35
  46. package/dist/{path-resolver-TjBlRKyH.d.ts → path-resolver-DDJiMAtX.d.ts} +3 -3
  47. package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
  48. package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
  49. package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-BqiA_UMr.d.ts} +73 -73
  50. package/dist/{plan-templates-D9UhwoGh.d.ts → plan-templates-BdDxl9cI.d.ts} +79 -11
  51. package/dist/{provider-runner-BEPWwkxH.d.ts → provider-runner-BUunikwY.d.ts} +5 -5
  52. package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
  53. package/dist/sdd/index.d.ts +17 -33
  54. package/dist/sdd/index.js +145 -36
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
  57. package/dist/security/index.d.ts +4 -5
  58. package/dist/security/index.js +4 -2
  59. package/dist/security/index.js.map +1 -1
  60. package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
  61. package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-BpJ5trO9.d.ts} +2 -2
  62. package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
  63. package/dist/{skill-BJeF2DwY.d.ts → skill-Bj6Ezqb8.d.ts} +1 -1
  64. package/dist/skills/index.d.ts +1 -1
  65. package/dist/skills/index.js +3 -9
  66. package/dist/skills/index.js.map +1 -1
  67. package/dist/spec-TBi3Jr6T.d.ts +78 -0
  68. package/dist/storage/index.d.ts +145 -13
  69. package/dist/storage/index.js +990 -172
  70. package/dist/storage/index.js.map +1 -1
  71. package/dist/task-format-vGOIftmK.d.ts +23 -0
  72. package/dist/task-graph-u1q9Jkyk.d.ts +84 -0
  73. package/dist/types/index.d.ts +27 -28
  74. package/dist/types/index.js +19 -31
  75. package/dist/types/index.js.map +1 -1
  76. package/dist/utils/expect-defined.d.ts +7 -0
  77. package/dist/utils/expect-defined.js +11 -0
  78. package/dist/utils/expect-defined.js.map +1 -0
  79. package/dist/utils/index.d.ts +8 -20
  80. package/dist/utils/index.js +120 -41
  81. package/dist/utils/index.js.map +1 -1
  82. package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
  83. package/package.json +5 -1
  84. package/skills/tech-stack/SKILL.md +177 -0
  85. package/dist/memory-CEXuo7sz.d.ts +0 -16
  86. package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
  87. package/dist/task-graph-CikNdRTG.d.ts +0 -161
@@ -1,34 +1,17 @@
1
- import { d as Context, n as ProviderError, Q as Tool, _ as ToolUseBlock, Y as ToolResultBlock } from './context-ToHAp4-U.js';
2
- import { a as Compactor, C as CompactReport } from './compactor-CJq7LQev.js';
3
- import { R as RecoveryDecision, E as ErrorHandler, a as RetryPolicy } from './retry-policy-DSu6O6rD.js';
4
- import { b as ModelsRegistry } from './models-registry-Be3osGt5.js';
5
- import { r as ToolExecutorOptions, s as ToolExecutorStrategy, T as ToolBatchResult } from './index-Dx-CnrDN.js';
6
- import { A as Agent, c as AgentFactory } from './agent-subagent-runner-CQaLFNnA.js';
7
- import { J as JournalEntry } from './goal-store-DvWLNu52.js';
8
- import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-Da9nd8Ic.js';
1
+ import { e as ProviderError, C as Context, T as Tool, m as ToolUseBlock, n as ToolResultBlock } from './context-CNRYfhUv.js';
2
+ import { R as RetryPolicy, E as ErrorHandler, a as RecoveryDecision } from './retry-policy-BcmuT_V0.js';
3
+ import { C as Compactor, a as CompactReport } from './compactor-DXLxLcmU.js';
4
+ import { M as ModelsRegistry } from './models-registry-B6_KfS65.js';
5
+ import { T as ToolExecutorOptions, a as ToolExecutorStrategy, b as ToolBatchResult } from './index-DIKEcfgC.js';
6
+ import { g as Agent, h as AgentFactory } from './agent-subagent-runner-DukQLUcS.js';
7
+ import { b as BrainArbiter } from './brain-Dfv4Y82E.js';
8
+ import { J as JournalEntry } from './goal-store-ht0VmR1A.js';
9
+ import { D as DispatchClassifier, a as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-51LvnXkD.js';
9
10
 
10
- interface CompactorOptions {
11
- preserveK?: number | undefined;
12
- eliseThreshold?: number | undefined;
13
- estimator?: (((text: string) => number)) | undefined;
14
- }
15
-
16
- declare class HybridCompactor implements Compactor {
17
- private readonly preserveK;
18
- private readonly eliseThreshold;
19
- private readonly estimator;
20
- constructor(opts?: CompactorOptions);
21
- compact(ctx: Context, opts?: {
22
- aggressive?: boolean | undefined;
23
- }): Promise<CompactReport>;
24
- /**
25
- * Estimate the full API request token count: messages + systemPrompt + toolDefs.
26
- * This is the accurate figure for context-window pressure monitoring.
27
- */
28
- private estimateFullRequest;
29
- private eliseOldToolResults;
30
- private collapseAncientTurns;
31
- private estimateMessages;
11
+ declare class DefaultRetryPolicy implements RetryPolicy {
12
+ shouldRetry(err: Error | ProviderError, attempt: number): boolean;
13
+ maxAttempts(err: Error | ProviderError): number;
14
+ delayMs(attempt: number): number;
32
15
  }
33
16
 
34
17
  /**
@@ -62,10 +45,28 @@ declare class DefaultErrorHandler implements ErrorHandler {
62
45
  recover(err: unknown, ctx: Context): Promise<RecoveryDecision | null>;
63
46
  }
64
47
 
65
- declare class DefaultRetryPolicy implements RetryPolicy {
66
- shouldRetry(err: Error | ProviderError, attempt: number): boolean;
67
- maxAttempts(err: Error | ProviderError): number;
68
- delayMs(attempt: number): number;
48
+ interface CompactorOptions {
49
+ preserveK?: number | undefined;
50
+ eliseThreshold?: number | undefined;
51
+ estimator?: (((text: string) => number)) | undefined;
52
+ }
53
+
54
+ declare class HybridCompactor implements Compactor {
55
+ private readonly preserveK;
56
+ private readonly eliseThreshold;
57
+ private readonly estimator;
58
+ constructor(opts?: CompactorOptions);
59
+ compact(ctx: Context, opts?: {
60
+ aggressive?: boolean | undefined;
61
+ }): Promise<CompactReport>;
62
+ /**
63
+ * Estimate the full API request token count: messages + systemPrompt + toolDefs.
64
+ * This is the accurate figure for context-window pressure monitoring.
65
+ */
66
+ private estimateFullRequest;
67
+ private eliseOldToolResults;
68
+ private collapseAncientTurns;
69
+ private estimateMessages;
69
70
  }
70
71
 
71
72
  declare class ToolExecutor {
@@ -227,6 +228,15 @@ interface EternalAutonomyOptions {
227
228
  transientBackoffMaxMs?: number | undefined;
228
229
  /** Called when the eternal loop stops for any reason (manual stop, goal complete, etc.). */
229
230
  onEternalStop?: ((() => void)) | undefined;
231
+ /**
232
+ * Optional brain arbiter for autonomous decision-making. When wired,
233
+ * the engine consults the brain instead of auto-stopping on:
234
+ * - Brainstorm DONE threshold reached
235
+ * - Consecutive failures exceeding failure budget
236
+ * - Goal completion verification
237
+ * Without a brain, the engine uses its built-in heuristics.
238
+ */
239
+ brain?: BrainArbiter | undefined;
230
240
  }
231
241
  type EternalEngineState = 'idle' | 'running' | 'stopped';
232
242
  /**
@@ -358,6 +368,15 @@ declare class EternalAutonomyEngine {
358
368
  */
359
369
  private clearGoalManually;
360
370
  private appendFailure;
371
+ /**
372
+ * Consult the brain on whether the goal is truly complete.
373
+ * Without a brain, always returns true (use heuristic: DONE threshold met = done).
374
+ */
375
+ private consultBrainForDone;
376
+ /**
377
+ * Persist a progress update from the agent's [PROGRESS: N%] output.
378
+ */
379
+ private updateProgress;
361
380
  private persistEngineState;
362
381
  }
363
382
 
@@ -481,4 +500,4 @@ declare class ParallelEternalEngine {
481
500
  private persistState;
482
501
  }
483
502
 
484
- export { type CompactorOptions as C, DEFAULT_RECOVERY_STRATEGIES as D, EternalAutonomyEngine as E, HybridCompactor as H, type IterationStage as I, type ParallelEngineState as P, type RecoveryStrategy as R, ToolExecutor as T, DefaultErrorHandler as a, DefaultRetryPolicy as b, type EternalAutonomyOptions as c, type EternalEngineState as d, ParallelEternalEngine as e, type ParallelEternalOptions as f, type ParallelIterationStage as g, buildRecoveryStrategies as h };
503
+ export { type CompactorOptions as C, DefaultErrorHandler as D, EternalAutonomyEngine as E, HybridCompactor as H, type IterationStage as I, type ParallelEngineState as P, type RecoveryStrategy as R, ToolExecutor as T, DefaultRetryPolicy as a, type EternalAutonomyOptions as b, type EternalEngineState as c, ParallelEternalEngine as d, type ParallelEternalOptions as e, type ParallelIterationStage as f, DEFAULT_RECOVERY_STRATEGIES as g, buildRecoveryStrategies as h };
@@ -1,6 +1,6 @@
1
- import { E as EventBus } from './events-DzyLtja6.js';
2
- import { b as ModelsRegistry, R as ResolvedModel } from './models-registry-Be3osGt5.js';
3
- import { O as TokenCounter, $ as Usage, C as CacheStats } from './context-ToHAp4-U.js';
1
+ import { E as EventBus } from './brain-Dfv4Y82E.js';
2
+ import { M as ModelsRegistry, b as ResolvedModel } from './models-registry-B6_KfS65.js';
3
+ import { c as TokenCounter, U as Usage, d as CacheStats } from './context-CNRYfhUv.js';
4
4
  import { P as PathResolver } from './path-resolver-CPRj4bFY.js';
5
5
 
6
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-BSU-6vah.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 MiddlewareHandler 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 ModelCapabilities as b, type BindOptions as c, type Middleware 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-Dfv4Y82E.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 { e as ConfigStore, d as Config, f as ConfigLoader, g as SyncConfig } from './config-BSU-6vah.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-Dfv4Y82E.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,16 @@
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 { h as Specification, S as SpecAnalysis, g as SpecValidationResult, e as SpecStatus, f as SpecTemplate, b as SpecRequirement } from '../spec-TBi3Jr6T.js';
2
+ import { d as TaskGraph, e as TaskNode, i as TaskFilter, j as TaskSort, c as TaskProgress, T as TaskType, a as TaskPriority } from '../task-graph-u1q9Jkyk.js';
3
+ import { E as EventBus } from '../brain-Dfv4Y82E.js';
4
+ import { D as DoneCondition, g as Agent, h as AgentFactory, f as TaskResult } from '../agent-subagent-runner-DukQLUcS.js';
5
+ import '../context-CNRYfhUv.js';
6
+ import '../index-DIKEcfgC.js';
7
+ import '../logger-B63L5bTg.js';
8
+ import '../pipeline-BqiA_UMr.js';
9
+ import '../config-BSU-6vah.js';
10
+ import '../models-registry-B6_KfS65.js';
11
+ import '../observability-D-HZN_mF.js';
12
+ import '../permission-BDv7z0mk.js';
13
+ import '../retry-policy-BcmuT_V0.js';
14
14
 
15
15
  declare class SpecParser {
16
16
  parse(content: string): Specification;
@@ -708,26 +708,6 @@ declare class SddTaskDecomposer {
708
708
  private hasAnyBlockedTasks;
709
709
  }
710
710
 
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
711
  interface SddParallelRunOptions {
732
712
  /** Pre-constructed TaskTracker (must already hold the graph's initial state). */
733
713
  tracker: TaskTracker;
@@ -741,6 +721,8 @@ interface SddParallelRunOptions {
741
721
  parallelSlots?: number | undefined;
742
722
  /** Per-task timeout in ms. Default: 300_000 (5 min). */
743
723
  taskTimeoutMs?: number | undefined;
724
+ /** Maximum retry attempts for failed tasks. Default: 2. */
725
+ maxRetries?: number | undefined;
744
726
  /** Override the default agent factory. */
745
727
  subagentFactory?: AgentFactory | undefined;
746
728
  /** Called after each wave completes. */
@@ -781,9 +763,11 @@ declare class SddParallelRun {
781
763
  private readonly opts;
782
764
  private readonly slots;
783
765
  private readonly timeoutMs;
766
+ private readonly maxRetries;
784
767
  private decomposer;
785
768
  private coordinator;
786
769
  private stopRequested;
770
+ private retryMap;
787
771
  constructor(opts: SddParallelRunOptions);
788
772
  /** Trigger stop — causes run() to abort after the current wave. */
789
773
  stop(): void;