@wrongstack/core 0.87.0 → 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 (83) hide show
  1. package/dist/{agent-bridge-C9P_HPez.d.ts → agent-bridge-DbVe1dHT.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-2Aq0jOSj.d.ts → agent-subagent-runner-C6eqID1t.d.ts} +477 -476
  3. package/dist/{events-DnRqXaZ3.d.ts → brain-s9DyD_Vf.d.ts} +185 -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 +208 -93
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/{default-config-DEXI4jsl.d.ts → default-config-CXsDvOmP.d.ts} +3 -1
  11. package/dist/defaults/index.d.ts +32 -34
  12. package/dist/defaults/index.js +744 -274
  13. package/dist/defaults/index.js.map +1 -1
  14. package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
  15. package/dist/execution/index.d.ts +18 -19
  16. package/dist/execution/index.js +79 -64
  17. package/dist/execution/index.js.map +1 -1
  18. package/dist/extension/index.d.ts +9 -10
  19. package/dist/extension/index.js +8 -6
  20. package/dist/extension/index.js.map +1 -1
  21. package/dist/{index-BNOLadHw.d.ts → index-CqrroYcU.d.ts} +13 -15
  22. package/dist/{index-N0_c4bHQ.d.ts → index-D3Nax3YU.d.ts} +11 -10
  23. package/dist/index.d.ts +191 -178
  24. package/dist/index.js +1419 -526
  25. package/dist/index.js.map +1 -1
  26. package/dist/infrastructure/index.d.ts +9 -9
  27. package/dist/infrastructure/index.js +16 -5
  28. package/dist/infrastructure/index.js.map +1 -1
  29. package/dist/kernel/index.d.ts +14 -16
  30. package/dist/kernel/index.js +17 -0
  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-D3E5ixAR.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-DllpCVkF.d.ts → multi-agent-coordinator-DHNrjPaA.d.ts} +2 -2
  42. package/dist/{null-fleet-bus-BY0AN-sr.d.ts → null-fleet-bus-BzzciAc4.d.ts} +39 -32
  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-D402RASp.d.ts → parallel-eternal-engine-CTpcrb9O.d.ts} +34 -33
  46. package/dist/{path-resolver-UPFTsDyD.d.ts → path-resolver-B7hgMAVe.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-C1Ad9OjI.d.ts} +73 -73
  50. package/dist/{plan-templates-DRvPgkfZ.d.ts → plan-templates-CNphsz0n.d.ts} +79 -11
  51. package/dist/{provider-runner-COAJM8tC.d.ts → provider-runner-cqvlB_oS.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 +12 -33
  54. package/dist/sdd/index.js +110 -50
  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 +22 -4
  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-IVzs2GpE.d.ts} +1 -1
  62. package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
  63. package/dist/{skill-BJeF2DwY.d.ts → skill-BJxzIyyN.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/storage/index.d.ts +134 -14
  68. package/dist/storage/index.js +982 -248
  69. package/dist/storage/index.js.map +1 -1
  70. package/dist/{task-graph-CikNdRTG.d.ts → task-graph-DJBqO0EY.d.ts} +1 -1
  71. package/dist/types/index.d.ts +26 -28
  72. package/dist/types/index.js +62 -37
  73. package/dist/types/index.js.map +1 -1
  74. package/dist/utils/expect-defined.d.ts +7 -0
  75. package/dist/utils/expect-defined.js +11 -0
  76. package/dist/utils/expect-defined.js.map +1 -0
  77. package/dist/utils/index.d.ts +11 -20
  78. package/dist/utils/index.js +61 -43
  79. package/dist/utils/index.js.map +1 -1
  80. package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
  81. package/package.json +5 -1
  82. package/dist/memory-CEXuo7sz.d.ts +0 -16
  83. package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
@@ -1,34 +1,16 @@
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-N0_c4bHQ.js';
6
- import { A as Agent, c as AgentFactory } from './agent-subagent-runner-2Aq0jOSj.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-D3Nax3YU.js';
6
+ import { g as Agent, h as AgentFactory } from './agent-subagent-runner-C6eqID1t.js';
7
7
  import { J as JournalEntry } from './goal-store-DvWLNu52.js';
8
- import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-DllpCVkF.js';
8
+ import { D as DispatchClassifier, a as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-DHNrjPaA.js';
9
9
 
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;
10
+ declare class DefaultRetryPolicy implements RetryPolicy {
11
+ shouldRetry(err: Error | ProviderError, attempt: number): boolean;
12
+ maxAttempts(err: Error | ProviderError): number;
13
+ delayMs(attempt: number): number;
32
14
  }
33
15
 
34
16
  /**
@@ -62,10 +44,28 @@ declare class DefaultErrorHandler implements ErrorHandler {
62
44
  recover(err: unknown, ctx: Context): Promise<RecoveryDecision | null>;
63
45
  }
64
46
 
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;
47
+ interface CompactorOptions {
48
+ preserveK?: number | undefined;
49
+ eliseThreshold?: number | undefined;
50
+ estimator?: (((text: string) => number)) | undefined;
51
+ }
52
+
53
+ declare class HybridCompactor implements Compactor {
54
+ private readonly preserveK;
55
+ private readonly eliseThreshold;
56
+ private readonly estimator;
57
+ constructor(opts?: CompactorOptions);
58
+ compact(ctx: Context, opts?: {
59
+ aggressive?: boolean | undefined;
60
+ }): Promise<CompactReport>;
61
+ /**
62
+ * Estimate the full API request token count: messages + systemPrompt + toolDefs.
63
+ * This is the accurate figure for context-window pressure monitoring.
64
+ */
65
+ private estimateFullRequest;
66
+ private eliseOldToolResults;
67
+ private collapseAncientTurns;
68
+ private estimateMessages;
69
69
  }
70
70
 
71
71
  declare class ToolExecutor {
@@ -73,6 +73,7 @@ declare class ToolExecutor {
73
73
  private opts;
74
74
  private readonly serializer;
75
75
  private readonly iterationTimeoutMs;
76
+ private readonly maxToolTimeoutMs;
76
77
  constructor(registry: {
77
78
  get(name: string): Tool | undefined;
78
79
  list(): Tool[];
@@ -1,6 +1,6 @@
1
- import { E as EventBus } from './events-DnRqXaZ3.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-s9DyD_Vf.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-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-DnRqXaZ3.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-DnRqXaZ3.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-DnRqXaZ3.js';
3
- import { D as DoneCondition, A as Agent, c as AgentFactory, X as TaskResult } from '../agent-subagent-runner-2Aq0jOSj.js';
4
- import '../context-ToHAp4-U.js';
5
- import '../index-N0_c4bHQ.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;