@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
@@ -9,39 +9,39 @@
9
9
  */
10
10
  interface DirectorSubagentState {
11
11
  id: string;
12
- name?: string;
13
- role?: string;
14
- provider?: string;
15
- model?: string;
12
+ name?: string | undefined;
13
+ role?: string | undefined;
14
+ provider?: string | undefined;
15
+ model?: string | undefined;
16
16
  spawnedAt: string;
17
17
  }
18
18
  interface DirectorTaskState {
19
19
  taskId: string;
20
- subagentId?: string;
21
- description?: string;
20
+ subagentId?: string | undefined;
21
+ description?: string | undefined;
22
22
  status: 'pending' | 'running' | 'completed' | 'failed' | 'stopped' | 'timeout';
23
- assignedAt?: string;
24
- completedAt?: string;
25
- iterations?: number;
26
- toolCalls?: number;
27
- durationMs?: number;
28
- error?: string;
23
+ assignedAt?: string | undefined;
24
+ completedAt?: string | undefined;
25
+ iterations?: number | undefined;
26
+ toolCalls?: number | undefined;
27
+ durationMs?: number | undefined;
28
+ error?: string | undefined;
29
29
  }
30
30
  interface DirectorStateSnapshot {
31
31
  version: 1;
32
32
  directorRunId: string;
33
33
  updatedAt: string;
34
34
  spawnCount: number;
35
- maxSpawns?: number;
35
+ maxSpawns?: number | undefined;
36
36
  spawnDepth: number;
37
37
  maxSpawnDepth: number;
38
38
  directorBudget?: {
39
- maxCostUsd?: number;
40
- };
39
+ maxCostUsd?: number | undefined;
40
+ } | undefined;
41
41
  subagents: DirectorSubagentState[];
42
42
  tasks: DirectorTaskState[];
43
43
  /** Aggregated usage snapshot. Optional — populated by the Director on save when available. */
44
- usage?: unknown;
44
+ usage?: unknown | undefined;
45
45
  }
46
46
  declare function loadDirectorState(filePath: string): Promise<DirectorStateSnapshot | null>;
47
47
  /**
@@ -65,12 +65,12 @@ declare class DirectorStateCheckpoint {
65
65
  private rewriteRequested;
66
66
  constructor(filePath: string, init: {
67
67
  directorRunId: string;
68
- maxSpawns?: number;
68
+ maxSpawns?: number | undefined;
69
69
  spawnDepth: number;
70
70
  maxSpawnDepth: number;
71
71
  directorBudget?: {
72
- maxCostUsd?: number;
73
- };
72
+ maxCostUsd?: number | undefined;
73
+ } | undefined;
74
74
  }, debounceMs?: number);
75
75
  /**
76
76
  * Attempt to acquire the lock for this checkpoint. Call this before
@@ -1,4 +1,4 @@
1
- import { $ as Usage, d as Context, X as ToolProgressEvent, Q as Tool } from './context-y87Jc5ei.js';
1
+ import { $ as Usage, d as Context, X as ToolProgressEvent, Q as Tool } from './context-ToHAp4-U.js';
2
2
 
3
3
  /**
4
4
  * Brain coordination primitives.
@@ -15,30 +15,30 @@ type BrainFallback = 'ask_human' | 'deny' | 'continue';
15
15
  interface BrainDecisionOption {
16
16
  id: string;
17
17
  label: string;
18
- consequence?: string;
19
- risk?: BrainRisk;
20
- recommended?: boolean;
18
+ consequence?: string | undefined;
19
+ risk?: BrainRisk | undefined;
20
+ recommended?: boolean | undefined;
21
21
  }
22
22
  interface BrainDecisionRequest {
23
23
  id: string;
24
24
  source: BrainDecisionSource;
25
25
  question: string;
26
- context?: string;
27
- options?: BrainDecisionOption[];
26
+ context?: string | undefined;
27
+ options?: BrainDecisionOption[] | undefined;
28
28
  risk: BrainRisk;
29
29
  /** What a non-LLM/default Brain should do when policy cannot decide safely. */
30
30
  fallback: BrainFallback;
31
31
  }
32
32
  type BrainDecision = {
33
33
  type: 'answer';
34
- optionId?: string;
34
+ optionId?: string | undefined;
35
35
  text: string;
36
- rationale?: string;
36
+ rationale?: string | undefined;
37
37
  } | {
38
38
  type: 'ask_human';
39
39
  prompt: string;
40
- options?: BrainDecisionOption[];
41
- rationale?: string;
40
+ options?: BrainDecisionOption[] | undefined;
41
+ rationale?: string | undefined;
42
42
  } | {
43
43
  type: 'deny';
44
44
  reason: string;
@@ -59,7 +59,7 @@ declare class ObservableBrainArbiter implements BrainArbiter {
59
59
  }
60
60
  interface BrainDecisionQueueOptions {
61
61
  /** Safety fallback if the human never answers. Default: no timeout. */
62
- timeoutMs?: number;
62
+ timeoutMs?: number | undefined;
63
63
  }
64
64
  /**
65
65
  * Bridge between an `ask_human` Brain decision and the UI. It emits the visible
@@ -86,7 +86,7 @@ declare class HumanEscalatingBrainArbiter implements BrainArbiter {
86
86
  }
87
87
  interface DefaultBrainArbiterOptions {
88
88
  /** Allow deterministic auto-answering for low-risk requests. Default true. */
89
- allowLowRiskAutoAnswer?: boolean;
89
+ allowLowRiskAutoAnswer?: boolean | undefined;
90
90
  }
91
91
  /**
92
92
  * Conservative deterministic Brain implementation.
@@ -124,9 +124,9 @@ interface EventMap {
124
124
  };
125
125
  'brain.human_answered': {
126
126
  id: string;
127
- optionId?: string;
128
- deny?: boolean;
129
- text?: string;
127
+ optionId?: string | undefined;
128
+ deny?: boolean | undefined;
129
+ text?: string | undefined;
130
130
  at: number;
131
131
  };
132
132
  'brain.decision_denied': {
@@ -232,7 +232,7 @@ interface EventMap {
232
232
  'tool.started': {
233
233
  name: string;
234
234
  id: string;
235
- input?: unknown;
235
+ input?: unknown | undefined;
236
236
  };
237
237
  /**
238
238
  * Fired for each ToolProgressEvent yielded by `Tool.executeStream`. UIs
@@ -280,12 +280,12 @@ interface EventMap {
280
280
  * inputs. Optional only for legacy emit sites — new code should always
281
281
  * set it.
282
282
  */
283
- id?: string;
283
+ id?: string | undefined;
284
284
  name: string;
285
285
  durationMs: number;
286
286
  ok: boolean;
287
- input?: unknown;
288
- output?: string;
287
+ input?: unknown | undefined;
288
+ output?: string | undefined;
289
289
  /**
290
290
  * Full UTF-8 byte length of the serialized tool result that the model
291
291
  * actually sees (post-cap, post-scrub). The `output` preview is capped
@@ -293,19 +293,56 @@ interface EventMap {
293
293
  * model is really paying tokens for. Optional only for legacy emit
294
294
  * sites that may not yet populate it.
295
295
  */
296
- outputBytes?: number;
296
+ outputBytes?: number | undefined;
297
297
  /**
298
298
  * Estimated token count for the full result body the model sees.
299
299
  * Computed from `outputBytes` with the standard ~3.5 chars/token
300
300
  * heuristic. Cheap to show in the TUI; not authoritative — the real
301
301
  * provider count lives in `provider.response.usage`. */
302
- outputTokens?: number;
302
+ outputTokens?: number | undefined;
303
303
  /**
304
304
  * For tools whose output has a clear "line" notion (file reads with
305
305
  * numbered prefixes, grep hits, bash stdout), the agent counts the
306
306
  * actual lines the model received and forwards it here. Undefined
307
307
  * for tools without a meaningful line count. */
308
- outputLines?: number;
308
+ outputLines?: number | undefined;
309
+ };
310
+ /**
311
+ * Fired by the `delegate` tool right before it hands work to a subagent
312
+ * and blocks on the result. Lets UIs render a "started delegating" line
313
+ * immediately instead of looking idle for the (often minutes-long) life
314
+ * of the subagent. Paired with `delegate.completed`.
315
+ */
316
+ 'delegate.started': {
317
+ /** Resolved roster role or free-form subagent name. */
318
+ target: string;
319
+ /** The task instruction handed to the subagent (untruncated — UIs trim). */
320
+ task: string;
321
+ };
322
+ /**
323
+ * Fired by the `delegate` tool once the subagent settles (success,
324
+ * timeout, budget exhaustion, error). Carries human-friendly, untruncated
325
+ * fields so UIs / the Telegram bridge can render a readable summary
326
+ * instead of the JSON-stringified, ~400-char-truncated `tool.executed`
327
+ * preview.
328
+ */
329
+ 'delegate.completed': {
330
+ /** Resolved roster role or free-form subagent name. */
331
+ target: string;
332
+ /** The task instruction handed to the subagent. */
333
+ task: string;
334
+ /** True only when the subagent finished its task cleanly. */
335
+ ok: boolean;
336
+ /** Task status — 'success' | 'timeout' | 'host_timeout' | 'stopped' | ... */
337
+ status?: string | undefined;
338
+ /** One-line human summary (from `buildDelegateSummary`), untruncated. */
339
+ summary: string;
340
+ durationMs: number;
341
+ iterations: number;
342
+ toolCalls: number;
343
+ /** Estimated subagent cost in USD, from the director usage snapshot when known. */
344
+ costUsd?: number | undefined;
345
+ subagentId?: string | undefined;
309
346
  };
310
347
  /**
311
348
  * Fired on every `iteration.completed`. UIs subscribe to render a live
@@ -417,10 +454,10 @@ interface EventMap {
417
454
  'subagent.spawned': {
418
455
  subagentId: string;
419
456
  taskId: string;
420
- name?: string;
421
- provider?: string;
422
- model?: string;
423
- description?: string;
457
+ name?: string | undefined;
458
+ provider?: string | undefined;
459
+ model?: string | undefined;
460
+ description?: string | undefined;
424
461
  /**
425
462
  * Absolute path to the per-subagent JSONL transcript on disk, when
426
463
  * one was created. Undefined when the subagent shares the parent
@@ -428,12 +465,12 @@ interface EventMap {
428
465
  * Surfaced so the TUI (FleetPanel) and `/fleet log` can show the
429
466
  * user *where* to look without computing it from the run id.
430
467
  */
431
- transcriptPath?: string;
468
+ transcriptPath?: string | undefined;
432
469
  };
433
470
  'subagent.task_started': {
434
471
  subagentId: string;
435
472
  taskId: string;
436
- description?: string;
473
+ description?: string | undefined;
437
474
  };
438
475
  /**
439
476
  * Fired by `MultiAgentHost` when a subagent hits a soft budget limit
@@ -473,12 +510,12 @@ interface EventMap {
473
510
  */
474
511
  'subagent.tool_executed': {
475
512
  subagentId: string;
476
- taskId?: string;
513
+ taskId?: string | undefined;
477
514
  name: string;
478
515
  durationMs: number;
479
516
  ok: boolean;
480
- input?: unknown;
481
- outputBytes?: number;
517
+ input?: unknown | undefined;
518
+ outputBytes?: number | undefined;
482
519
  };
483
520
  /**
484
521
  * Periodic progress snapshot emitted by the subagent runner every ~25
@@ -493,8 +530,8 @@ interface EventMap {
493
530
  iteration: number;
494
531
  toolCalls: number;
495
532
  costUsd: number;
496
- currentTool?: string;
497
- partialText?: string;
533
+ currentTool?: string | undefined;
534
+ partialText?: string | undefined;
498
535
  };
499
536
  'subagent.task_completed': {
500
537
  subagentId: string;
@@ -515,11 +552,11 @@ interface EventMap {
515
552
  kind: string;
516
553
  message: string;
517
554
  retryable: boolean;
518
- backoffMs?: number;
555
+ backoffMs?: number | undefined;
519
556
  cause?: {
520
- name: string;
557
+ name: string | undefined;
521
558
  message: string;
522
- stack?: string;
559
+ stack?: string | undefined;
523
560
  };
524
561
  };
525
562
  };
@@ -641,7 +678,7 @@ interface EventMap {
641
678
  insertions: number;
642
679
  deletions: number;
643
680
  files: number;
644
- sha?: string;
681
+ sha?: string | undefined;
645
682
  };
646
683
  'worktree.merged': {
647
684
  handleId: string;
@@ -665,18 +702,19 @@ interface EventMap {
665
702
  'worktree.failed': {
666
703
  handleId: string;
667
704
  ownerId: string;
668
- branch?: string;
705
+ branch?: string | undefined;
669
706
  error: string;
670
707
  };
671
708
  error: {
672
709
  err: Error;
673
710
  phase: string;
711
+ _original?: Error | undefined;
674
712
  };
675
713
  }
676
714
  type EventName = keyof EventMap;
677
715
  type Listener<E extends EventName> = (payload: EventMap[E]) => void;
678
716
  interface EventLogger {
679
- error(msg: string, ctx?: unknown): void;
717
+ error(msg: string, ctx?: unknown): void | undefined;
680
718
  }
681
719
  declare class EventBus {
682
720
  private readonly listeners;
@@ -1,28 +1,28 @@
1
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-CjAYGaCw.js';
2
- import { m as Provider, d as Context } from '../context-y87Jc5ei.js';
3
- import { a as Compactor, C as CompactReport } from '../compactor-D_ExJajC.js';
4
- import { M as MessageSelector } from '../selector-RvBR_YRW.js';
5
- import { E as EventBus } from '../events-BBAlxBuw.js';
6
- import { b as MiddlewareHandler } from '../system-prompt-CA11g6Jo.js';
7
- import { a as SessionEventBridge } from '../session-event-bridge-CDHxcmQU.js';
8
- import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-Dy0CK_o6.js';
9
- import { A as Agent, D as DoneCondition } from '../agent-subagent-runner-BmITbs1Q.js';
10
- import { R as RunResult, S as SystemPromptContributor } from '../index-BN6i2Nfg.js';
11
- import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
12
- import { a as WstackPaths } from '../wstack-paths-eMXnY1_X.js';
13
- import '../retry-policy-CG3qvH_e.js';
14
- import '../models-registry-BcYJDKLm.js';
15
- import '../goal-store-C7jcumEh.js';
16
- import '../multi-agent-coordinator-BSBbZt0e.js';
1
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-D402RASp.js';
2
+ import { m as Provider, d as Context } from '../context-ToHAp4-U.js';
3
+ import { a as Compactor, C as CompactReport } from '../compactor-CJq7LQev.js';
4
+ import { M as MessageSelector } from '../selector-11-fm95U.js';
5
+ import { E as EventBus } from '../events-DnRqXaZ3.js';
6
+ import { b as MiddlewareHandler } from '../system-prompt-C0rLCeyn.js';
7
+ import { a as SessionEventBridge } from '../session-event-bridge-D0u-x576.js';
8
+ import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-_DZ7dN-T.js';
9
+ import { A as Agent, D as DoneCondition } from '../agent-subagent-runner-2Aq0jOSj.js';
10
+ import { R as RunResult, S as SystemPromptContributor } from '../index-N0_c4bHQ.js';
11
+ import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-BJeF2DwY.js';
12
+ import { a as WstackPaths } from '../wstack-paths-BQMvEllz.js';
13
+ import '../retry-policy-DSu6O6rD.js';
14
+ import '../models-registry-Be3osGt5.js';
15
+ import '../goal-store-DvWLNu52.js';
16
+ import '../multi-agent-coordinator-DllpCVkF.js';
17
17
  import 'node:events';
18
- import '../logger-DDd5C--Z.js';
19
- import '../observability-BhnVLBLS.js';
20
- import '../permission-V5BLOrY6.js';
18
+ import '../logger-B72yyPc6.js';
19
+ import '../observability-CoSNZdhX.js';
20
+ import '../permission-14CChMmO.js';
21
21
  import '../secret-scrubber-3MHDDAtm.js';
22
22
 
23
23
  interface SkillLoaderOptions {
24
24
  paths: WstackPaths;
25
- bundledDir?: string;
25
+ bundledDir?: string | undefined;
26
26
  }
27
27
  /**
28
28
  * Discovery order (later layers shadow earlier ones at boot, but we walk
@@ -50,25 +50,25 @@ interface IntelligentCompactorOptions {
50
50
  /** Provider to use for LLM-assisted summarization. Required. */
51
51
  provider: Provider;
52
52
  /** Fraction of maxContext that triggers a warning (default 0.6). */
53
- warnThreshold?: number;
53
+ warnThreshold?: number | undefined;
54
54
  /** Fraction of maxContext that triggers soft compaction (default 0.75). */
55
- softThreshold?: number;
55
+ softThreshold?: number | undefined;
56
56
  /** Fraction of maxContext that triggers hard compaction (default 0.9). */
57
- hardThreshold?: number;
57
+ hardThreshold?: number | undefined;
58
58
  /** Max context window in tokens (used only for threshold fraction math). */
59
- maxContext?: number;
59
+ maxContext?: number | undefined;
60
60
  /** How many recent (user+assistant) pairs to always preserve (default 4). */
61
- preserveK?: number;
61
+ preserveK?: number | undefined;
62
62
  /** Token threshold below which tool results are not elided (default 500). */
63
- eliseThreshold?: number;
63
+ eliseThreshold?: number | undefined;
64
64
  /** System prompt for the summarizer sub-LLM. */
65
- summarizerPrompt?: string;
65
+ summarizerPrompt?: string | undefined;
66
66
  /**
67
67
  * Model ID to use for summarization. When not set, the same model as the
68
68
  * agent is used (which risks cascading failure on context overflow). Set to
69
69
  * a fast/cheap model like `claude-3-5-haiku-20240620` for resilience.
70
70
  */
71
- summarizerModel?: string;
71
+ summarizerModel?: string | undefined;
72
72
  }
73
73
  /**
74
74
  * IntelligentCompactor uses an LLM to:
@@ -90,7 +90,7 @@ declare class IntelligentCompactor implements Compactor {
90
90
  private readonly summarizerModel?;
91
91
  constructor(opts: IntelligentCompactorOptions);
92
92
  compact(ctx: Context, opts?: {
93
- aggressive?: boolean;
93
+ aggressive?: boolean | undefined;
94
94
  }): Promise<CompactReport>;
95
95
  /**
96
96
  * Estimate the full API request token count: messages + systemPrompt + toolDefs.
@@ -115,25 +115,25 @@ interface SelectiveCompactorOptions {
115
115
  /** Provider for LLM calls (selector + summarizer). Required. */
116
116
  provider: Provider;
117
117
  /** Selector for LLM-driven importance analysis. */
118
- selector?: MessageSelector;
118
+ selector?: MessageSelector | undefined;
119
119
  /** Fraction of maxContext that triggers a warning (default 0.6). */
120
- warnThreshold?: number;
120
+ warnThreshold?: number | undefined;
121
121
  /** Fraction of maxContext that triggers soft compaction (default 0.75). */
122
- softThreshold?: number;
122
+ softThreshold?: number | undefined;
123
123
  /** Fraction of maxContext that triggers hard compaction (default 0.9). */
124
- hardThreshold?: number;
124
+ hardThreshold?: number | undefined;
125
125
  /** Max context window in tokens (used for threshold fraction math). */
126
- maxContext?: number;
126
+ maxContext?: number | undefined;
127
127
  /** How many recent (user+assistant) pairs to always preserve (default 4). */
128
- preserveK?: number;
128
+ preserveK?: number | undefined;
129
129
  /** Token threshold below which tool results are not elided (default 500). */
130
- eliseThreshold?: number;
130
+ eliseThreshold?: number | undefined;
131
131
  /** Model for selector LLM calls (default: same as provider default). */
132
- selectorModel?: string;
132
+ selectorModel?: string | undefined;
133
133
  /** Summarizer model for collapsed ranges (default: same as selectorModel). */
134
- summarizerModel?: string;
134
+ summarizerModel?: string | undefined;
135
135
  /** Prompt for the summarizer sub-LLM. */
136
- summarizerPrompt?: string;
136
+ summarizerPrompt?: string | undefined;
137
137
  }
138
138
  /**
139
139
  * SelectiveCompactor uses an LLM-driven MessageSelector to make
@@ -157,7 +157,7 @@ declare class SelectiveCompactor implements Compactor {
157
157
  private readonly summarizerPrompt;
158
158
  constructor(opts: SelectiveCompactorOptions);
159
159
  compact(ctx: Context, opts?: {
160
- aggressive?: boolean;
160
+ aggressive?: boolean | undefined;
161
161
  }): Promise<CompactReport>;
162
162
  /**
163
163
  * Estimate the full API request token count: messages + systemPrompt + toolDefs.
@@ -191,12 +191,12 @@ declare class SelectiveCompactor implements Compactor {
191
191
 
192
192
  type CompactionFailureMode = 'throw' | 'throw_on_hard' | 'continue';
193
193
  interface AutoCompactionOptions {
194
- aggressiveOn?: ContextWindowAggressiveOn;
195
- events?: EventBus;
196
- failureMode?: CompactionFailureMode;
194
+ aggressiveOn?: ContextWindowAggressiveOn | undefined;
195
+ events?: EventBus | undefined;
196
+ failureMode?: CompactionFailureMode | undefined;
197
197
  policyProvider?: (ctx: Context) => Pick<ContextWindowPolicy, 'thresholds' | 'aggressiveOn'> | null | undefined;
198
198
  /** Optional bridge for writing compaction events into the persistent session log. */
199
- sessionBridge?: SessionEventBridge;
199
+ sessionBridge?: SessionEventBridge | undefined;
200
200
  }
201
201
  /**
202
202
  * Pipeline middleware that monitors context token load and automatically
@@ -250,7 +250,7 @@ declare class AutoCompactionMiddleware {
250
250
  warn: number;
251
251
  soft: number;
252
252
  hard: number;
253
- }, optsOrAggressiveOn?: AutoCompactionOptions | ContextWindowAggressiveOn, events?: EventBus);
253
+ }, optsOrAggressiveOn?: AutoCompactionOptions | ContextWindowAggressiveOn, events?: EventBus | undefined);
254
254
  /** Allow callers (e.g. model-switch in WebUI) to update the context window
255
255
  * denominator when the active model changes. */
256
256
  setMaxContext(maxContext: number): void;
@@ -267,11 +267,11 @@ declare class AutoCompactionMiddleware {
267
267
 
268
268
  type AutonomousResult = RunResult & {
269
269
  toolCalls: number;
270
- reason?: string;
270
+ reason?: string | undefined;
271
271
  };
272
272
  interface DoneCheckResult {
273
273
  done: boolean;
274
- reason?: string;
274
+ reason?: string | undefined;
275
275
  iterations: number;
276
276
  toolCalls: number;
277
277
  }
@@ -282,26 +282,26 @@ declare class DoneConditionChecker {
282
282
  check(state: {
283
283
  iterations: number;
284
284
  toolCalls: number;
285
- lastOutput?: string;
285
+ lastOutput?: string | undefined;
286
286
  }): DoneCheckResult;
287
287
  }
288
288
  interface AutonomousRunnerOptions {
289
289
  agent: Agent;
290
290
  context: Context;
291
291
  doneCondition: DoneCondition;
292
- iterationTimeoutMs?: number;
292
+ iterationTimeoutMs?: number | undefined;
293
293
  onIteration?: (state: {
294
- iteration: number;
294
+ iteration: number | undefined;
295
295
  toolCalls: number;
296
296
  }) => void;
297
- onDone?: (result: AutonomousResult) => void;
297
+ onDone?: (((result: AutonomousResult) => void)) | undefined;
298
298
  /**
299
299
  * When true and `doneCondition.type === 'directive'`, the runner
300
300
  * runs the agent with `autonomousContinue: true` so the agent loop
301
301
  * handles its own [continue]/[done] markers internally (no outer
302
302
  * re-invocation needed). The runner still provides iteration/timeouts.
303
303
  */
304
- enableAutonomousContinue?: boolean;
304
+ enableAutonomousContinue?: boolean | undefined;
305
305
  }
306
306
  declare class AutonomousRunner {
307
307
  private readonly opts;
@@ -346,7 +346,7 @@ interface AutonomyPromptContributorOptions {
346
346
  */
347
347
  enabled: () => boolean;
348
348
  /** Number of journal entries to include in the recent-tail block. Default 5. */
349
- journalTailSize?: number;
349
+ journalTailSize?: number | undefined;
350
350
  }
351
351
  /**
352
352
  * Build a contributor that renders the autonomy-state system block.