@wrongstack/core 0.73.1 → 0.82.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/{agent-bridge-C0Ze7Ldm.d.ts → agent-bridge-C9P_HPez.d.ts} +2 -2
  2. package/dist/{agent-subagent-runner-BmITbs1Q.d.ts → agent-subagent-runner-2Aq0jOSj.d.ts} +107 -102
  3. package/dist/{compactor-D_ExJajC.d.ts → compactor-CJq7LQev.d.ts} +3 -3
  4. package/dist/{config-Dy0CK_o6.d.ts → config-_DZ7dN-T.d.ts} +77 -75
  5. package/dist/{context-y87Jc5ei.d.ts → context-ToHAp4-U.d.ts} +119 -90
  6. package/dist/coordination/index.d.ts +16 -16
  7. package/dist/coordination/index.js +382 -43
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/defaults/index.d.ts +31 -31
  10. package/dist/defaults/index.js +524 -110
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{director-state-BmYi3DGA.d.ts → director-state-CgIc30qi.d.ts} +19 -19
  13. package/dist/{events-BBAlxBuw.d.ts → events-DnRqXaZ3.d.ts} +77 -39
  14. package/dist/execution/index.d.ts +53 -53
  15. package/dist/execution/index.js +67 -23
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/extension/index.d.ts +9 -9
  18. package/dist/extension/index.js +8 -1
  19. package/dist/extension/index.js.map +1 -1
  20. package/dist/{goal-store-C7jcumEh.d.ts → goal-store-DvWLNu52.d.ts} +4 -4
  21. package/dist/{index-yQbZ2NQx.d.ts → index-BNOLadHw.d.ts} +28 -28
  22. package/dist/{index-BN6i2Nfg.d.ts → index-N0_c4bHQ.d.ts} +45 -45
  23. package/dist/index.d.ts +233 -160
  24. package/dist/index.js +825 -160
  25. package/dist/index.js.map +1 -1
  26. package/dist/infrastructure/index.d.ts +9 -9
  27. package/dist/infrastructure/index.js +29 -7
  28. package/dist/infrastructure/index.js.map +1 -1
  29. package/dist/kernel/index.d.ts +14 -14
  30. package/dist/kernel/index.js +7 -0
  31. package/dist/kernel/index.js.map +1 -1
  32. package/dist/logger-B72yyPc6.d.ts +12 -0
  33. package/dist/{logger-bOzkF5LL.d.ts → logger-C_27pj9i.d.ts} +12 -4
  34. package/dist/{mcp-servers-T0O6UN_w.d.ts → mcp-servers-Dck3T85_.d.ts} +20 -20
  35. package/dist/{mode-BO4SEUIv.d.ts → mode-CHo2XtHs.d.ts} +4 -4
  36. package/dist/models/index.d.ts +10 -10
  37. package/dist/models/index.js +8 -2
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-BcYJDKLm.d.ts → models-registry-Be3osGt5.d.ts} +28 -28
  40. package/dist/{models-registry-Cuq1C8V9.d.ts → models-registry-Boz639EI.d.ts} +12 -12
  41. package/dist/{multi-agent-coordinator-BSBbZt0e.d.ts → multi-agent-coordinator-DllpCVkF.d.ts} +12 -12
  42. package/dist/{null-fleet-bus-BCIRT_nV.d.ts → null-fleet-bus-BY0AN-sr.d.ts} +129 -120
  43. package/dist/observability/index.d.ts +41 -41
  44. package/dist/observability/index.js.map +1 -1
  45. package/dist/{observability-BhnVLBLS.d.ts → observability-CoSNZdhX.d.ts} +4 -4
  46. package/dist/{parallel-eternal-engine-CjAYGaCw.d.ts → parallel-eternal-engine-D402RASp.d.ts} +49 -49
  47. package/dist/{path-resolver-BnqXa9Ze.d.ts → path-resolver-UPFTsDyD.d.ts} +6 -6
  48. package/dist/{permission-V5BLOrY6.d.ts → permission-14CChMmO.d.ts} +10 -8
  49. package/dist/{permission-policy-CBVx-d-8.d.ts → permission-policy-gW5htOo1.d.ts} +7 -7
  50. package/dist/{plan-templates-DBgrTGPu.d.ts → plan-templates-DRvPgkfZ.d.ts} +70 -32
  51. package/dist/{provider-runner-n3KkHT_w.d.ts → provider-runner-COAJM8tC.d.ts} +6 -6
  52. package/dist/{retry-policy-CG3qvH_e.d.ts → retry-policy-DSu6O6rD.d.ts} +4 -4
  53. package/dist/sdd/index.d.ts +47 -47
  54. package/dist/sdd/index.js +47 -22
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/security/index.d.ts +6 -6
  57. package/dist/security/index.js +7 -1
  58. package/dist/security/index.js.map +1 -1
  59. package/dist/{selector-RvBR_YRW.d.ts → selector-11-fm95U.d.ts} +2 -2
  60. package/dist/{session-event-bridge-CDHxcmQU.d.ts → session-event-bridge-D0u-x576.d.ts} +7 -7
  61. package/dist/{session-reader-BIpwM60D.d.ts → session-reader-BQU-toaN.d.ts} +23 -23
  62. package/dist/{skill-CxuWrsKK.d.ts → skill-BJeF2DwY.d.ts} +1 -1
  63. package/dist/skills/index.d.ts +9 -9
  64. package/dist/skills/index.js +15 -3
  65. package/dist/skills/index.js.map +1 -1
  66. package/dist/storage/index.d.ts +15 -15
  67. package/dist/storage/index.js +398 -80
  68. package/dist/storage/index.js.map +1 -1
  69. package/dist/{system-prompt-CA11g6Jo.d.ts → system-prompt-C0rLCeyn.d.ts} +16 -11
  70. package/dist/{task-graph-D1YQbpxF.d.ts → task-graph-CikNdRTG.d.ts} +22 -22
  71. package/dist/types/index.d.ts +25 -25
  72. package/dist/types/index.js +61 -12
  73. package/dist/types/index.js.map +1 -1
  74. package/dist/utils/index.d.ts +46 -45
  75. package/dist/utils/index.js +64 -13
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/{wstack-paths-eMXnY1_X.d.ts → wstack-paths-BQMvEllz.d.ts} +10 -3
  78. package/package.json +1 -1
  79. package/dist/logger-DDd5C--Z.d.ts +0 -12
@@ -1,16 +1,16 @@
1
- import { d as Context, n as ProviderError, Q as Tool, _ as ToolUseBlock, Y as ToolResultBlock } from './context-y87Jc5ei.js';
2
- import { a as Compactor, C as CompactReport } from './compactor-D_ExJajC.js';
3
- import { R as RecoveryDecision, E as ErrorHandler, a as RetryPolicy } from './retry-policy-CG3qvH_e.js';
4
- import { b as ModelsRegistry } from './models-registry-BcYJDKLm.js';
5
- import { r as ToolExecutorOptions, s as ToolExecutorStrategy, T as ToolBatchResult } from './index-BN6i2Nfg.js';
6
- import { A as Agent, c as AgentFactory } from './agent-subagent-runner-BmITbs1Q.js';
7
- import { J as JournalEntry } from './goal-store-C7jcumEh.js';
8
- import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-BSBbZt0e.js';
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';
7
+ import { J as JournalEntry } from './goal-store-DvWLNu52.js';
8
+ import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from './multi-agent-coordinator-DllpCVkF.js';
9
9
 
10
10
  interface CompactorOptions {
11
- preserveK?: number;
12
- eliseThreshold?: number;
13
- estimator?: (text: string) => number;
11
+ preserveK?: number | undefined;
12
+ eliseThreshold?: number | undefined;
13
+ estimator?: (((text: string) => number)) | undefined;
14
14
  }
15
15
 
16
16
  declare class HybridCompactor implements Compactor {
@@ -19,7 +19,7 @@ declare class HybridCompactor implements Compactor {
19
19
  private readonly estimator;
20
20
  constructor(opts?: CompactorOptions);
21
21
  compact(ctx: Context, opts?: {
22
- aggressive?: boolean;
22
+ aggressive?: boolean | undefined;
23
23
  }): Promise<CompactReport>;
24
24
  /**
25
25
  * Estimate the full API request token count: messages + systemPrompt + toolDefs.
@@ -39,7 +39,7 @@ interface RecoveryStrategy {
39
39
  /** Human-readable label for logs. */
40
40
  label: string;
41
41
  /** Optional compactor for context_overflow recovery. */
42
- compactor?: Compactor;
42
+ compactor?: Compactor | undefined;
43
43
  /** Returns an explicit recovery decision, or null to fall through. */
44
44
  attempt: (err: unknown, ctx: Context) => Promise<RecoveryDecision | null>;
45
45
  }
@@ -48,8 +48,8 @@ interface RecoveryStrategy {
48
48
  * Exported so callers can customise or extend the strategy chain.
49
49
  */
50
50
  declare function buildRecoveryStrategies(opts?: {
51
- compactor?: Compactor;
52
- modelsRegistry?: ModelsRegistry;
51
+ compactor?: Compactor | undefined;
52
+ modelsRegistry?: ModelsRegistry | undefined;
53
53
  }): RecoveryStrategy[];
54
54
  declare const DEFAULT_RECOVERY_STRATEGIES: RecoveryStrategy[];
55
55
  declare class DefaultErrorHandler implements ErrorHandler {
@@ -132,7 +132,7 @@ interface EternalAutonomyOptions {
132
132
  * Per-iteration agent timeout. Defaults to 5 minutes. A single hung
133
133
  * provider call should not freeze the whole eternal loop.
134
134
  */
135
- iterationTimeoutMs?: number;
135
+ iterationTimeoutMs?: number | undefined;
136
136
  /**
137
137
  * Maximum number of internal agent.run iterations the engine grants per
138
138
  * eternal-loop tick. The engine sets `autonomousContinue: true` so the
@@ -140,18 +140,18 @@ interface EternalAutonomyOptions {
140
140
  * bouncing back to the engine after every single tool call. Default 500.
141
141
  * Previous 50 was far too low — agents hit the limit and restart constantly.
142
142
  */
143
- iterationMaxAgentSteps?: number;
143
+ iterationMaxAgentSteps?: number | undefined;
144
144
  /**
145
145
  * Minimum sleep between iterations. Defaults to 1 s — enough for
146
146
  * SIGINT handlers to fire mid-loop without pegging a core when the
147
147
  * provider is being rate-limited.
148
148
  */
149
- cycleGapMs?: number;
149
+ cycleGapMs?: number | undefined;
150
150
  /**
151
151
  * Maximum consecutive failures before the source rotation forces a
152
152
  * brainstorm cycle. Default 3. Acts as a soft-recovery, not a stop.
153
153
  */
154
- failureBudget?: number;
154
+ failureBudget?: number | undefined;
155
155
  /**
156
156
  * Per-todo failed-attempt ceiling. When the engine picks the same todo
157
157
  * and the iteration fails this many times in total, the todo is taken
@@ -159,7 +159,7 @@ interface EternalAutonomyOptions {
159
159
  * status. Default 3. Prevents the loop from spinning forever on one
160
160
  * stuck task.
161
161
  */
162
- todoMaxAttempts?: number;
162
+ todoMaxAttempts?: number | undefined;
163
163
  /**
164
164
  * Consecutive brainstorm-DONE responses required to consider the goal
165
165
  * complete and stop the engine. When the LLM's brainstorm step keeps
@@ -167,26 +167,26 @@ interface EternalAutonomyOptions {
167
167
  * this many in a row, marks the goal as completed instead of sleeping
168
168
  * forever. Default 3.
169
169
  */
170
- brainstormDoneStopThreshold?: number;
170
+ brainstormDoneStopThreshold?: number | undefined;
171
171
  /** Side-channel notifications (logging, UI updates). */
172
- onIteration?: (entry: JournalEntry) => void;
173
- onError?: (err: Error, iteration: number) => void;
172
+ onIteration?: (((entry: JournalEntry) => void)) | undefined;
173
+ onError?: (err: Error | undefined, iteration: number) => void;
174
174
  /**
175
175
  * Per-iteration phase notifications for live UI updates (TUI status bar,
176
176
  * etc.). Fires at each major stage transition: idle → decide → execute →
177
177
  * reflect → (sleep | paused | stopped). Fire-and-forget — the engine
178
178
  * does not await the callback.
179
179
  */
180
- onStage?: (stage: IterationStage) => void;
180
+ onStage?: (((stage: IterationStage) => void)) | undefined;
181
181
  /**
182
182
  * Optional injected git status reader — production code uses git, tests
183
183
  * stub this out so they don't shell out.
184
184
  */
185
- gitStatusReader?: () => Promise<string>;
185
+ gitStatusReader?: ((() => Promise<string>)) | undefined;
186
186
  /**
187
187
  * Optional clock — tests stub for deterministic timestamps.
188
188
  */
189
- now?: () => Date;
189
+ now?: ((() => Date)) | undefined;
190
190
  /**
191
191
  * Optional compactor. When provided, the engine runs compaction every
192
192
  * `compactEveryNIterations` iterations to keep the agent's message
@@ -194,22 +194,22 @@ interface EternalAutonomyOptions {
194
194
  * compaction, an infinite loop will eventually overflow the provider's
195
195
  * context window and start failing.
196
196
  */
197
- compactor?: Compactor;
197
+ compactor?: Compactor | undefined;
198
198
  /** How many iterations between compaction calls. Default 25. */
199
- compactEveryNIterations?: number;
199
+ compactEveryNIterations?: number | undefined;
200
200
  /**
201
201
  * Aggressive compaction threshold. When ctx token usage exceeds this
202
202
  * fraction of `maxContextTokens`, compaction runs in aggressive mode
203
203
  * regardless of the iteration cadence. 0.85 by default.
204
204
  */
205
- aggressiveCompactRatio?: number;
205
+ aggressiveCompactRatio?: number | undefined;
206
206
  /**
207
207
  * Model's max context window in tokens. When set, the engine watches
208
208
  * `currentRequestTokens()` against this and triggers aggressive compact
209
209
  * before the next iteration would overflow. Omit to disable threshold
210
210
  * checks (iteration cadence still applies).
211
211
  */
212
- maxContextTokens?: number;
212
+ maxContextTokens?: number | undefined;
213
213
  /**
214
214
  * Base delay (ms) for the first transient-error backoff. Subsequent
215
215
  * transient failures double this, capped at `transientBackoffMaxMs`.
@@ -221,11 +221,11 @@ interface EternalAutonomyOptions {
221
221
  * backoff and count toward `failureBudget` like before — backing off
222
222
  * on a permanent failure is wasted time.
223
223
  */
224
- transientBackoffBaseMs?: number;
224
+ transientBackoffBaseMs?: number | undefined;
225
225
  /** Ceiling for the exponential backoff. Default 60_000 (60 s). */
226
- transientBackoffMaxMs?: number;
226
+ transientBackoffMaxMs?: number | undefined;
227
227
  /** Called when the eternal loop stops for any reason (manual stop, goal complete, etc.). */
228
- onEternalStop?: () => void;
228
+ onEternalStop?: ((() => void)) | undefined;
229
229
  }
230
230
  type EternalEngineState = 'idle' | 'running' | 'stopped';
231
231
  /**
@@ -243,7 +243,7 @@ type IterationStage = {
243
243
  } | {
244
244
  phase: 'reflect';
245
245
  status: 'success' | 'failure' | 'aborted' | 'skipped';
246
- note?: string;
246
+ note?: string | undefined;
247
247
  } | {
248
248
  phase: 'sleep';
249
249
  ms: number;
@@ -395,26 +395,26 @@ interface ParallelEternalOptions {
395
395
  * `goalFilePath(projectRoot)` (a hashed location under the home dir).
396
396
  * Primarily for tests that want an isolated goal file under a temp dir.
397
397
  */
398
- goalPath?: string;
398
+ goalPath?: string | undefined;
399
399
  /**
400
400
  * Number of parallel subagent slots per tick.
401
401
  * Default: 4. Range 1–16; values >8 are for high-throughput machines.
402
402
  */
403
- parallelSlots?: number;
403
+ parallelSlots?: number | undefined;
404
404
  /** Per-subagent default timeout in ms. Default: 300_000 (5 min). */
405
- iterationTimeoutMs?: number;
406
- onIteration?: (entry: JournalEntry) => void;
407
- onError?: (err: Error, iteration: number) => void;
405
+ iterationTimeoutMs?: number | undefined;
406
+ onIteration?: (((entry: JournalEntry) => void)) | undefined;
407
+ onError?: (err: Error | undefined, iteration: number) => void;
408
408
  /** Per-tick phase notifications for live UI/status updates. */
409
- onStage?: (stage: ParallelIterationStage) => void;
410
- gitStatusReader?: () => Promise<string>;
411
- now?: () => Date;
412
- compactor?: Compactor;
413
- compactEveryNIterations?: number;
414
- aggressiveCompactRatio?: number;
415
- maxContextTokens?: number;
409
+ onStage?: (((stage: ParallelIterationStage) => void)) | undefined;
410
+ gitStatusReader?: ((() => Promise<string>)) | undefined;
411
+ now?: ((() => Date)) | undefined;
412
+ compactor?: Compactor | undefined;
413
+ compactEveryNIterations?: number | undefined;
414
+ aggressiveCompactRatio?: number | undefined;
415
+ maxContextTokens?: number | undefined;
416
416
  /** Override the default agent factory (uses main agent if not provided). */
417
- subagentFactory?: AgentFactory;
417
+ subagentFactory?: AgentFactory | undefined;
418
418
  /**
419
419
  * Route each decomposed slot task to the best-fit catalog agent via the
420
420
  * smart dispatcher (heuristic keyword scoring). When enabled (default), each
@@ -422,13 +422,13 @@ interface ParallelEternalOptions {
422
422
  * injected into the task — instead of as a faceless generic worker. Set
423
423
  * false to keep the legacy generic spawn.
424
424
  */
425
- dispatch?: boolean;
425
+ dispatch?: boolean | undefined;
426
426
  /**
427
427
  * Optional LLM fallback for ambiguous tasks. Passed straight to
428
428
  * `dispatchAgent`; when omitted, routing is pure heuristic (instant, no
429
429
  * provider call — preferred for a continuously-ticking autonomous loop).
430
430
  */
431
- dispatchClassifier?: DispatchClassifier;
431
+ dispatchClassifier?: DispatchClassifier | undefined;
432
432
  }
433
433
  /**
434
434
  * Sense → Decide → Fan-out (4–8 parallel agents) → Aggregate → Loop.
@@ -1,6 +1,6 @@
1
- import { E as EventBus } from './events-BBAlxBuw.js';
2
- import { b as ModelsRegistry, R as ResolvedModel } from './models-registry-BcYJDKLm.js';
3
- import { O as TokenCounter, $ as Usage, C as CacheStats } from './context-y87Jc5ei.js';
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';
4
4
  import { P as PathResolver } from './path-resolver-CPRj4bFY.js';
5
5
 
6
6
  /**
@@ -23,9 +23,9 @@ declare class DefaultTokenCounter implements TokenCounter {
23
23
  private lastInput;
24
24
  private lastCacheRead;
25
25
  constructor(opts?: {
26
- registry?: ModelsRegistry;
27
- providerId?: string;
28
- events?: EventBus;
26
+ registry?: ModelsRegistry | undefined;
27
+ providerId?: string | undefined;
28
+ events?: EventBus | undefined;
29
29
  });
30
30
  account(usage: Usage, model?: string): void;
31
31
  /** Synchronous variant for code paths that have already resolved the model. */
@@ -1,20 +1,20 @@
1
- import { Q as Tool, d as Context, P as Permission } from './context-y87Jc5ei.js';
1
+ import { Q as Tool, d as Context, P as Permission } from './context-ToHAp4-U.js';
2
2
 
3
3
  interface TrustPolicy {
4
4
  [toolNameOrPattern: string]: {
5
- allow?: string[];
6
- deny?: string[];
7
- auto?: boolean;
8
- trustWorkdir?: boolean;
9
- denyPrivate?: boolean;
5
+ allow?: string[] | undefined;
6
+ deny?: string[] | undefined;
7
+ auto?: boolean | undefined;
8
+ trustWorkdir?: boolean | undefined;
9
+ denyPrivate?: boolean | undefined;
10
10
  };
11
11
  }
12
12
  interface PermissionDecision {
13
13
  permission: Permission;
14
- reason?: string;
14
+ reason?: string | undefined;
15
15
  source: 'default' | 'trust' | 'yolo' | 'yolo_destructive' | 'user' | 'deny' | 'context' | 'subagent_guard';
16
16
  /** Risk tier of the tool, if classified. */
17
- riskTier?: 'safe' | 'standard' | 'destructive';
17
+ riskTier?: 'safe' | 'standard' | 'destructive' | undefined;
18
18
  }
19
19
  interface PermissionPolicy {
20
20
  evaluate(tool: Tool, input: unknown, ctx: Context): Promise<PermissionDecision>;
@@ -58,6 +58,8 @@ interface PermissionPolicy {
58
58
  getConfirmDestructive?(): boolean;
59
59
  /** Enable/disable destructive-operation confirmation (only meaningful in yolo mode). */
60
60
  setConfirmDestructive?(enabled: boolean): void;
61
+ /** Set the prompt delegate (optional). */
62
+ setPromptDelegate?(delegate: ((tool: Tool, input: unknown, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'deny'>) | undefined): void;
61
63
  }
62
64
 
63
65
  export type { PermissionDecision as P, TrustPolicy as T, PermissionPolicy as a };
@@ -1,27 +1,27 @@
1
- import { Q as Tool, d as Context } from './context-y87Jc5ei.js';
1
+ import { Q as Tool, d as Context } from './context-ToHAp4-U.js';
2
2
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
3
- import { a as PermissionPolicy, P as PermissionDecision } from './permission-V5BLOrY6.js';
3
+ import { a as PermissionPolicy, P as PermissionDecision } from './permission-14CChMmO.js';
4
4
 
5
5
  interface PermissionPolicyOptions {
6
6
  trustFile: string;
7
- yolo?: boolean;
7
+ yolo?: boolean | undefined;
8
8
  /**
9
9
  * When true, YOLO mode auto-approves even destructive calls without confirm.
10
10
  * @deprecated YOLO now auto-approves everything by default. Use `confirmDestructive`
11
11
  * to opt back into destructive-operation confirmation prompts.
12
12
  */
13
- yoloDestructive?: boolean;
13
+ yoloDestructive?: boolean | undefined;
14
14
  /** @deprecated Use `yoloDestructive`. */
15
- forceAllYolo?: boolean;
15
+ forceAllYolo?: boolean | undefined;
16
16
  /**
17
17
  * When true AND yolo is true, destructive operations still require confirmation.
18
18
  * This is the opt-in safety net: set this if you want YOLO for normal work but
19
19
  * explicit approval for `rm -rf`, project-escaping writes, etc.
20
20
  * Has no effect when yolo is false (normal permission flow applies).
21
21
  */
22
- confirmDestructive?: boolean;
22
+ confirmDestructive?: boolean | undefined;
23
23
  promptDelegate?: (tool: Tool, input: unknown, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'deny'>;
24
- inputReader?: InputReader;
24
+ inputReader?: InputReader | undefined;
25
25
  }
26
26
  declare class DefaultPermissionPolicy implements PermissionPolicy {
27
27
  private policy;
@@ -1,16 +1,16 @@
1
- import { E as EventBus } from './events-BBAlxBuw.js';
1
+ import { E as EventBus } from './events-DnRqXaZ3.js';
2
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-y87Jc5ei.js';
4
- import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-BIpwM60D.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
5
  import { b as MemoryStore, a as MemoryScope } from './memory-CEXuo7sz.js';
6
- import { a as WstackPaths } from './wstack-paths-eMXnY1_X.js';
7
- import { c as ConfigStore, a as Config, b as ConfigLoader, w as SyncConfig } from './config-Dy0CK_o6.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';
8
8
  import { S as SecretVault } from './secret-vault-DoISxaKO.js';
9
9
 
10
10
  interface SessionStoreOptions {
11
11
  dir: string;
12
12
  /** Optional EventBus for emitting session diagnostics. */
13
- events?: EventBus;
13
+ events?: EventBus | undefined;
14
14
  /**
15
15
  * Optional secret scrubber. When set, `user_input` and `llm_response` event
16
16
  * content is scrubbed before being persisted to the JSONL log and the
@@ -19,24 +19,62 @@ interface SessionStoreOptions {
19
19
  * Tool output is already scrubbed upstream by the executor; this closes the
20
20
  * conversation-turn gap (finding F-06).
21
21
  */
22
- secretScrubber?: SecretScrubber;
22
+ secretScrubber?: SecretScrubber | undefined;
23
23
  }
24
24
  declare class DefaultSessionStore implements SessionStore {
25
25
  private readonly dir;
26
26
  private readonly events?;
27
27
  private readonly secretScrubber?;
28
28
  constructor(opts: SessionStoreOptions);
29
+ /** Absolute path to the session index file. */
30
+ private get indexFile();
29
31
  /** Join session ID to its absolute path within the store directory. */
30
32
  private sessionPath;
33
+ /**
34
+ * Ensure the directory implied by the session ID exists. When the ID
35
+ * contains a date prefix like `2026-06-06/...`, this creates the date
36
+ * subdirectory so sessions group naturally by day.
37
+ */
31
38
  private ensureShardDir;
32
39
  create(meta: Omit<SessionMetadata, 'startedAt'>): Promise<SessionWriter>;
33
40
  resume(id: string): Promise<ResumedSession>;
34
41
  load(id: string): Promise<SessionData>;
35
42
  list(limit?: number): Promise<SessionSummary[]>;
36
- /** Recursively collect all session IDs from shard subdirectories. */
43
+ private indexAppendCount;
44
+ private static readonly COMPACT_EVERY;
45
+ /** Append a session summary to the index. */
46
+ private appendToIndex;
47
+ /** Append a tombstone entry for a deleted session. */
48
+ private writeTombstone;
49
+ /**
50
+ * Compact the index: read all entries, drop tombstones, deduplicate
51
+ * (keep latest per session), and rewrite. Atomic via temp+rename.
52
+ */
53
+ private compactIndex;
54
+ /**
55
+ * Read the index file and return deduplicated session summaries.
56
+ * Entries with a matching tombstone are filtered out.
57
+ * Returns empty array when the index doesn't exist or is corrupt.
58
+ */
59
+ private readIndex;
60
+ /**
61
+ * Rebuild the index from disk by scanning all sessions and writing a
62
+ * fresh _index.jsonl. Useful after manual cleanup or index corruption.
63
+ */
64
+ rebuildIndex(): Promise<number>;
65
+ /** Recursively collect session IDs from date-shard subdirectories.
66
+ * IDs include the date-prefix path (e.g. "2026-06-06/17-46-57Z_…").
67
+ * Skips `.jsonl`/`.summary.json` root files, dot-files, and
68
+ * sub-directories that belong to fleet/subagent sessions. */
37
69
  private collectSessionIds;
38
70
  private summaryFor;
71
+ /**
72
+ * Delete a session and all associated files: JSONL, summary, plan/todos
73
+ * sidecars, and the session directory (fleet.json, shared/, subagents/).
74
+ */
75
+ private deleteSession;
39
76
  delete(id: string): Promise<void>;
77
+ prune(maxAgeDays?: number): Promise<number>;
40
78
  clearHistory(id: string): Promise<void>;
41
79
  private summarize;
42
80
  private metaFromEvents;
@@ -79,8 +117,8 @@ interface AttachmentStoreOptions {
79
117
  * Directory for spooling payloads larger than `spoolThresholdBytes`.
80
118
  * When omitted, all payloads stay in memory.
81
119
  */
82
- spoolDir?: string;
83
- spoolThresholdBytes?: number;
120
+ spoolDir?: string | undefined;
121
+ spoolThresholdBytes?: number | undefined;
84
122
  }
85
123
  /**
86
124
  * In-memory attachment store with optional disk spool. Placeholder syntax
@@ -172,7 +210,7 @@ interface ConfigSource {
172
210
  /** Unique name for debugging and error messages. */
173
211
  name: string;
174
212
  /** Lower numbers merge first, higher numbers override lower. Default: 50. */
175
- priority?: number;
213
+ priority?: number | undefined;
176
214
  /**
177
215
  * Read the raw config patch. Return an empty object if unavailable.
178
216
  * Errors are surfaced but do not abort loading — the source is skipped.
@@ -181,10 +219,10 @@ interface ConfigSource {
181
219
  }
182
220
  interface ConfigLoaderOptions {
183
221
  paths: WstackPaths;
184
- strict?: boolean;
185
- vault?: SecretVault;
222
+ strict?: boolean | undefined;
223
+ vault?: SecretVault | undefined;
186
224
  /** Extra sources merged after the built-in layers. */
187
- sources?: ConfigSource[];
225
+ sources?: ConfigSource[] | undefined;
188
226
  }
189
227
  declare class DefaultConfigLoader implements ConfigLoader {
190
228
  private readonly paths;
@@ -193,8 +231,8 @@ declare class DefaultConfigLoader implements ConfigLoader {
193
231
  private readonly extraSources;
194
232
  constructor(opts: ConfigLoaderOptions);
195
233
  load(opts?: {
196
- cliFlags?: Partial<Config>;
197
- cwd?: string;
234
+ cliFlags?: Partial<Config> | undefined;
235
+ cwd?: string | undefined;
198
236
  }): Promise<Config>;
199
237
  /**
200
238
  * Persist a sync config to ~/.wrongstack/sync.json, with the token encrypted
@@ -246,7 +284,7 @@ interface ConfigMigration {
246
284
  /** Pure transform — no I/O. */
247
285
  migrate(input: Record<string, unknown>, ctx: MigrationContext): Record<string, unknown>;
248
286
  /** Optional human-readable description for migration logs / banners. */
249
- describe?: string;
287
+ describe?: string | undefined;
250
288
  }
251
289
  interface MigrationResult {
252
290
  /** Final config (still typed as `unknown`-keyed — caller validates). */
@@ -317,19 +355,19 @@ interface RecoveryLockOptions {
317
355
  /** Directory the lockfile lives in. Usually `wpaths.projectSessions`. */
318
356
  dir: string;
319
357
  /** This process's PID. Default: `process.pid`. */
320
- pid?: number;
358
+ pid?: number | undefined;
321
359
  /** Hostname recorded for the lock. Default: `os.hostname()`. */
322
- hostname?: string;
360
+ hostname?: string | undefined;
323
361
  /** Locks older than this are considered orphaned (disk wiped, etc.). Default 24h. */
324
- maxAgeMs?: number;
362
+ maxAgeMs?: number | undefined;
325
363
  /** Used to check whether the abandoned session was actually closed cleanly. */
326
- sessionStore?: SessionStore;
364
+ sessionStore?: SessionStore | undefined;
327
365
  /**
328
366
  * Override the PID-liveness probe. Default: `process.kill(pid, 0)` —
329
367
  * succeeds (or throws EPERM) when the PID is alive, throws ESRCH when
330
368
  * it is gone. Tests inject a deterministic stub.
331
369
  */
332
- isPidAlive?: (pid: number) => boolean;
370
+ isPidAlive?: (((pid: number) => boolean)) | undefined;
333
371
  }
334
372
  interface AbandonedSession {
335
373
  sessionId: string;
@@ -380,12 +418,12 @@ declare class RecoveryLock {
380
418
  }
381
419
 
382
420
  interface QueryFilter {
383
- eventTypes?: string[];
384
- toolNames?: string[];
421
+ eventTypes?: string[] | undefined;
422
+ toolNames?: string[] | undefined;
385
423
  timeRange?: {
386
424
  start: string;
387
425
  end: string;
388
- };
426
+ } | undefined;
389
427
  }
390
428
  interface ModeChange {
391
429
  ts: string;
@@ -397,7 +435,7 @@ interface TaskSummary {
397
435
  title: string;
398
436
  status: string;
399
437
  createdAt: string;
400
- completedAt?: string;
438
+ completedAt?: string | undefined;
401
439
  }
402
440
  interface SessionAnalysis {
403
441
  sessionId: string;
@@ -463,7 +501,7 @@ interface PlanItem {
463
501
  id: string;
464
502
  title: string;
465
503
  /** Optional longer-form context or rationale. */
466
- details?: string;
504
+ details?: string | undefined;
467
505
  status: 'open' | 'in_progress' | 'done';
468
506
  createdAt: string;
469
507
  updatedAt: string;
@@ -471,7 +509,7 @@ interface PlanItem {
471
509
  interface PlanFile {
472
510
  version: 1;
473
511
  sessionId: string;
474
- title?: string;
512
+ title?: string | undefined;
475
513
  updatedAt: string;
476
514
  items: PlanItem[];
477
515
  }
@@ -479,7 +517,7 @@ declare function loadPlan(filePath: string): Promise<PlanFile | null>;
479
517
  declare function savePlan(filePath: string, plan: PlanFile): Promise<void>;
480
518
  /** Create a new PlanFile when none exists on disk. */
481
519
  declare function emptyPlan(sessionId: string, title?: string): PlanFile;
482
- declare function addPlanItem(plan: PlanFile, title: string, details?: string): {
520
+ declare function addPlanItem(plan: PlanFile, title: string, details?: string | undefined): {
483
521
  plan: PlanFile;
484
522
  item: PlanItem;
485
523
  };
@@ -495,13 +533,13 @@ declare function formatPlan(plan: PlanFile): string;
495
533
  * Returns the derived todo list so the caller can pass it to `todoTool`
496
534
  * or `ctx.state.replaceTodos()`.
497
535
  */
498
- declare function deriveTodosFromPlanItem(plan: PlanFile, idOrIndex: string, subtasks?: string[]): {
536
+ declare function deriveTodosFromPlanItem(plan: PlanFile, idOrIndex: string, subtasks?: string[] | undefined): {
499
537
  plan: PlanFile;
500
538
  todos: Array<{
501
539
  id: string;
502
540
  content: string;
503
541
  status: 'pending' | 'in_progress' | 'completed';
504
- activeForm?: string;
542
+ activeForm?: string | undefined;
505
543
  }>;
506
544
  } | null;
507
545
  /**
@@ -526,7 +564,7 @@ interface PlanTemplate {
526
564
  category: 'development' | 'release' | 'maintenance' | 'infrastructure';
527
565
  items: Array<{
528
566
  title: string;
529
- details?: string;
567
+ details?: string | undefined;
530
568
  }>;
531
569
  }
532
570
  declare function listPlanTemplates(): PlanTemplate[];
@@ -1,8 +1,8 @@
1
- import { E as EventBus } from './events-BBAlxBuw.js';
2
- import { a as Logger } from './logger-DDd5C--Z.js';
3
- import { T as Tracer } from './observability-BhnVLBLS.js';
4
- import { m as Provider, p as Request, d as Context, q as Response } from './context-y87Jc5ei.js';
5
- import { a as RetryPolicy } from './retry-policy-CG3qvH_e.js';
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';
6
6
 
7
7
  /**
8
8
  * Options passed to a ProviderRunner when calling the provider.
@@ -17,7 +17,7 @@ interface RunProviderOptions {
17
17
  events: EventBus;
18
18
  retry: RetryPolicy;
19
19
  logger: Logger;
20
- tracer?: Tracer;
20
+ tracer?: Tracer | undefined;
21
21
  }
22
22
  /**
23
23
  * A replaceable service for calling a provider with retry logic,
@@ -1,4 +1,4 @@
1
- import { d as Context, q as Response, n as ProviderError } from './context-y87Jc5ei.js';
1
+ import { d as Context, q as Response, n as ProviderError } from './context-ToHAp4-U.js';
2
2
 
3
3
  type RecoveryDecision = {
4
4
  /**
@@ -7,7 +7,7 @@ type RecoveryDecision = {
7
7
  */
8
8
  action: 'retry';
9
9
  reason: string;
10
- model?: string;
10
+ model?: string | undefined;
11
11
  } | {
12
12
  /**
13
13
  * Recovery produced a substitute provider response that should be
@@ -15,12 +15,12 @@ type RecoveryDecision = {
15
15
  */
16
16
  action: 'continue';
17
17
  response: Response;
18
- reason?: string;
18
+ reason?: string | undefined;
19
19
  } | {
20
20
  /** Recovery inspected the error and decided the agent must fail. */
21
21
  action: 'fail';
22
22
  reason: string;
23
- error?: unknown;
23
+ error?: unknown | undefined;
24
24
  };
25
25
  interface ErrorHandler {
26
26
  /**