@wrongstack/core 0.275.1 → 0.276.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-D9JkPvJ0.d.ts → agent-bridge-D7A-eu3C.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CArSFKFl.d.ts → agent-subagent-runner-CEuw4ATz.d.ts} +16 -10
  3. package/dist/{brain-DCkB5_e7.d.ts → brain-BLOyN5ZP.d.ts} +127 -1
  4. package/dist/{compactor-CzSvxM1g.d.ts → compactor-DcBpaJsI.d.ts} +1 -1
  5. package/dist/{config-BzFRKkg7.d.ts → config-Bf5mj-ad.d.ts} +20 -2
  6. package/dist/{context-BrLe8pJy.d.ts → context-CLnUMW5g.d.ts} +40 -2
  7. package/dist/coordination/index.d.ts +43 -24
  8. package/dist/coordination/index.js +849 -648
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +28 -28
  11. package/dist/defaults/index.js +1636 -845
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +16 -16
  14. package/dist/execution/index.js +218 -49
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +1 -1
  17. package/dist/extension/index.d.ts +7 -7
  18. package/dist/extension/index.js.map +1 -1
  19. package/dist/{global-mailbox-CXkugtNQ.d.ts → global-mailbox-Iqfkgmwu.d.ts} +3 -3
  20. package/dist/{goal-store-DUwdbdoY.d.ts → goal-store-DGb6b5Ed.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +6 -6
  22. package/dist/hq/index.js +178 -75
  23. package/dist/hq/index.js.map +1 -1
  24. package/dist/{index-CtlizLTK.d.ts → index-Cn0NOshr.d.ts} +10 -5
  25. package/dist/{index-neOCEy6q.d.ts → index-L4RZN9jJ.d.ts} +2 -2
  26. package/dist/index.d.ts +56 -48
  27. package/dist/index.js +2789 -1546
  28. package/dist/index.js.map +1 -1
  29. package/dist/infrastructure/index.d.ts +6 -6
  30. package/dist/infrastructure/index.js +26 -7
  31. package/dist/infrastructure/index.js.map +1 -1
  32. package/dist/kernel/index.d.ts +20 -12
  33. package/dist/kernel/index.js +55 -9
  34. package/dist/kernel/index.js.map +1 -1
  35. package/dist/{mailbox-types-_7gaY0Rl.d.ts → mailbox-types-DTl7bRH3.d.ts} +3 -1
  36. package/dist/{mcp-servers-MLL6bMlv.d.ts → mcp-servers-CuZGf9fI.d.ts} +4 -4
  37. package/dist/models/index.d.ts +5 -5
  38. package/dist/models/index.js +223 -139
  39. package/dist/models/index.js.map +1 -1
  40. package/dist/{models-registry-CrkcxQ-g.d.ts → models-registry-8XOdxWQu.d.ts} +16 -1
  41. package/dist/{multi-agent-coordinator-Dc_HuG9p.d.ts → multi-agent-coordinator-CiRtKVTk.d.ts} +8 -1
  42. package/dist/{null-fleet-bus-BMZwMin7.d.ts → null-fleet-bus-d9G-bVy9.d.ts} +26 -22
  43. package/dist/observability/index.d.ts +2 -2
  44. package/dist/{path-resolver-uVK4BatM.d.ts → path-resolver-BhIb6mtd.d.ts} +8 -3
  45. package/dist/{permission-CJR1qfOi.d.ts → permission-BCbQDR2s.d.ts} +1 -1
  46. package/dist/{permission-policy-DLVKKk4w.d.ts → permission-policy-C0ikndX_.d.ts} +2 -18
  47. package/dist/{pipeline-BYR-Vdau.d.ts → pipeline-Dl6XbfE7.d.ts} +10 -6
  48. package/dist/{provider-model-resolve-iREK_1lG.d.ts → provider-model-resolve-B70epO19.d.ts} +3 -3
  49. package/dist/{provider-runner-i7SQXZuC.d.ts → provider-runner-DZ808MSM.d.ts} +3 -3
  50. package/dist/{retry-policy-BmY5ooh3.d.ts → retry-policy-Dt3_z8Aj.d.ts} +1 -1
  51. package/dist/sdd/index.d.ts +19 -10
  52. package/dist/sdd/index.js +411 -240
  53. package/dist/sdd/index.js.map +1 -1
  54. package/dist/{secret-vault-C9leEMzr.d.ts → secret-vault-BUJ2d1gB.d.ts} +1 -1
  55. package/dist/security/index.d.ts +5 -5
  56. package/dist/security/index.js +30 -6
  57. package/dist/security/index.js.map +1 -1
  58. package/dist/{selector-qjpee9BF.d.ts → selector-BCkWgdwy.d.ts} +1 -1
  59. package/dist/{session-event-bridge-m7y--I-H.d.ts → session-event-bridge-CMvIO59_.d.ts} +1 -1
  60. package/dist/{session-reader-BjLH4V9n.d.ts → session-reader-C8aiChUu.d.ts} +1 -1
  61. package/dist/skills/index.js +1 -0
  62. package/dist/skills/index.js.map +1 -1
  63. package/dist/storage/index.d.ts +68 -30
  64. package/dist/storage/index.js +839 -528
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/{strategy-compactor-C2bmlWYg.d.ts → strategy-compactor-DI1OHVbB.d.ts} +10 -10
  67. package/dist/{todos-checkpoint-oDS9IBNS.d.ts → todos-checkpoint-Ddd2CGr0.d.ts} +56 -9
  68. package/dist/{tool-executor-D4YdaJ-M.d.ts → tool-executor-Bmd5Ygoo.d.ts} +45 -10
  69. package/dist/tools/index.d.ts +2 -2
  70. package/dist/tools/index.js.map +1 -1
  71. package/dist/types/index.d.ts +20 -20
  72. package/dist/types/index.js +331 -98
  73. package/dist/types/index.js.map +1 -1
  74. package/dist/utils/index.d.ts +16 -3
  75. package/dist/utils/index.js +159 -83
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/{worktree-manager-A1Efnvs0.d.ts → worktree-manager-DBdl_5rs.d.ts} +4 -1
  78. package/instructions/agents/shadow-agent.md +3 -3
  79. package/instructions/coordination/director-preamble.md +3 -3
  80. package/instructions/modes/research-web.md +4 -4
  81. package/package.json +1 -1
  82. package/skills/research-web/SKILL.md +26 -26
  83. package/skills/research-web/SKILL.save.md +1 -1
@@ -1,4 +1,4 @@
1
- import { M as ModelsRegistry, a as ModelsDevPayload, R as ResolvedProvider, b as ResolvedModel, W as WireFamily } from './config-BzFRKkg7.js';
1
+ import { M as ModelsRegistry, a as ModelsDevPayload, R as ResolvedProvider, b as ResolvedModel, W as WireFamily } from './config-Bf5mj-ad.js';
2
2
 
3
3
  interface DefaultModelsRegistryOptions {
4
4
  cacheFile: string;
@@ -42,6 +42,14 @@ declare class DefaultModelsRegistry implements ModelsRegistry {
42
42
  private payload?;
43
43
  /** Memoised overlay payload (in-memory / fetched / file). */
44
44
  private overlayPayload?;
45
+ /**
46
+ * Extra providers injected at runtime via `mergeOverlay()` — e.g. an
47
+ * openai-compatible server (omniroute, LiteLLM, …) auto-discovered from its
48
+ * `/v1/models` endpoint at boot. Applied LAST (on top of base + curated
49
+ * overlay) and re-applied across `refresh()` so the discovered catalog
50
+ * survives a models.dev refetch.
51
+ */
52
+ private extraOverlay?;
45
53
  private fetchedAt?;
46
54
  private readonly cacheFile;
47
55
  private readonly url;
@@ -58,6 +66,13 @@ declare class DefaultModelsRegistry implements ModelsRegistry {
58
66
  load(opts?: {
59
67
  force?: boolean | undefined;
60
68
  }): Promise<ModelsDevPayload>;
69
+ /**
70
+ * Merge an additional provider payload on top of the resolved catalog. Used
71
+ * for runtime-discovered openai-compatible providers. Remembered so it is
72
+ * re-applied across `refresh()`. A no-op for an empty payload.
73
+ */
74
+ mergeOverlay(payload: ModelsDevPayload): void;
75
+ private withExtraOverlay;
61
76
  /**
62
77
  * Load the models.dev base payload: fresh cache → network → stale cache.
63
78
  * On total failure, degrade to `{}` (so a non-empty overlay still drives
@@ -1,4 +1,4 @@
1
- import { S as SubagentConfig, M as MultiAgentCoordinator, c as MultiAgentConfig, d as SubagentRunner, F as FleetBus, e as SpawnResult, T as TaskSpec, a as BridgeMessage, A as AgentBridge, C as CoordinatorStatus, f as TaskResult } from './agent-subagent-runner-CArSFKFl.js';
1
+ import { S as SubagentConfig, M as MultiAgentCoordinator, c as MultiAgentConfig, d as SubagentRunner, e as BudgetSessionIdSource, F as FleetBus, f as SpawnResult, T as TaskSpec, a as BridgeMessage, A as AgentBridge, C as CoordinatorStatus, g as TaskResult } from './agent-subagent-runner-CEuw4ATz.js';
2
2
  import { EventEmitter } from 'node:events';
3
3
 
4
4
  /**
@@ -170,11 +170,17 @@ interface MultiAgentCoordinatorOptions {
170
170
  * own bridge) and enforces timeout + concurrency.
171
171
  */
172
172
  runner?: SubagentRunner | undefined;
173
+ /**
174
+ * Session id for EventBus/FleetBus emissions produced by this coordinator.
175
+ * Accepts a getter so a long-lived coordinator follows session resume/new.
176
+ */
177
+ sessionId?: BudgetSessionIdSource | undefined;
173
178
  }
174
179
  declare class DefaultMultiAgentCoordinator extends EventEmitter implements MultiAgentCoordinator {
175
180
  readonly coordinatorId: string;
176
181
  readonly config: MultiAgentConfig;
177
182
  private runner?;
183
+ private readonly sessionId;
178
184
  private fleetBus?;
179
185
  private readonly subagents;
180
186
  /**
@@ -204,6 +210,7 @@ declare class DefaultMultiAgentCoordinator extends EventEmitter implements Multi
204
210
  */
205
211
  private readonly terminating;
206
212
  constructor(config: MultiAgentConfig, options?: MultiAgentCoordinatorOptions);
213
+ private currentSessionId;
207
214
  /**
208
215
  * Replace the runner after construction. Used when the runner depends
209
216
  * on infrastructure (e.g. FleetBus) that isn't available until after
@@ -1,12 +1,12 @@
1
- import { A as AgentPhase, b as AgentDefinition, a as DefaultMultiAgentCoordinator, D as DispatchClassifier } from './multi-agent-coordinator-Dc_HuG9p.js';
2
- import { F as FleetBus, i as FleetUsage, S as SubagentConfig, j as FleetUsageAggregator, f as TaskResult, C as CoordinatorStatus, T as TaskSpec, c as MultiAgentConfig, d as SubagentRunner } from './agent-subagent-runner-CArSFKFl.js';
3
- import { b as SessionWriter, T as Tool, k as SessionStore } from './context-BrLe8pJy.js';
4
- import { B as BrainArbiter, E as EventBus } from './brain-DCkB5_e7.js';
1
+ import { A as AgentPhase, b as AgentDefinition, a as DefaultMultiAgentCoordinator, D as DispatchClassifier } from './multi-agent-coordinator-CiRtKVTk.js';
2
+ import { F as FleetBus, j as FleetUsage, S as SubagentConfig, k as FleetUsageAggregator, g as TaskResult, C as CoordinatorStatus, T as TaskSpec, c as MultiAgentConfig, d as SubagentRunner } from './agent-subagent-runner-CEuw4ATz.js';
3
+ import { b as SessionWriter, T as Tool, k as SessionStore } from './context-CLnUMW5g.js';
4
+ import { B as BrainArbiter, E as EventBus } from './brain-BLOyN5ZP.js';
5
5
  import { EventEmitter } from 'node:events';
6
6
  import { L as Logger } from './logger-B63L5bTg.js';
7
7
  import { D as DirectorStateSnapshot } from './director-state-BfeCUbmk.js';
8
- import { d as ModelMatrixEntry } from './config-BzFRKkg7.js';
9
- import { I as InMemoryAgentBridge } from './agent-bridge-D9JkPvJ0.js';
8
+ import { d as ModelMatrixEntry } from './config-Bf5mj-ad.js';
9
+ import { I as InMemoryAgentBridge } from './agent-bridge-D7A-eu3C.js';
10
10
 
11
11
  /**
12
12
  * Alert levels the Director can emit when a collab session needs attention.
@@ -901,6 +901,12 @@ interface DirectorOptions {
901
901
  * writer the host Agent uses so all events land in a single JSONL.
902
902
  */
903
903
  sessionWriter?: SessionWriter | undefined;
904
+ /**
905
+ * Session id for live fleet/coordinator events. Defaults to
906
+ * `sessionWriter.id` when a writer is available; accepts a getter so
907
+ * embedding surfaces can follow session swaps.
908
+ */
909
+ sessionId?: string | (() => string | undefined) | undefined;
904
910
  /**
905
911
  * Debounce window for periodic manifest writes triggered by spawn/
906
912
  * assign/complete events. Default: 2000ms. Pass 0 to disable periodic
@@ -946,7 +952,7 @@ interface DirectorOptions {
946
952
  /**
947
953
  * Sessions root directory for per-subagent JSONL transcripts.
948
954
  * When set, the director can read subagent transcripts directly for
949
- * `fleet_session` tool — no bridge round-trip needed. Path convention:
955
+ * `fleet` tool (action: session) — no bridge round-trip needed. Path convention:
950
956
  * `<sessionsRoot>/<directorRunId>/<subagentId>.jsonl`.
951
957
  */
952
958
  sessionsRoot?: string | undefined;
@@ -1041,6 +1047,7 @@ declare class Director implements ICoordinator {
1041
1047
  */
1042
1048
  getLeaderContextPressure(): number;
1043
1049
  private resolveMaxContext;
1050
+ private currentSessionId;
1044
1051
  /** Optional Brain arbiter for director-level policy decisions. */
1045
1052
  private readonly brain?;
1046
1053
  /**
@@ -1100,6 +1107,7 @@ declare class Director implements ICoordinator {
1100
1107
  private readonly stateCheckpoint;
1101
1108
  /** Optional session writer for emitting task_* / agent_* lifecycle events. */
1102
1109
  private readonly sessionWriter;
1110
+ private readonly sessionIdSource;
1103
1111
  /** Debounce timer for periodic manifest writes. */
1104
1112
  private manifestTimer;
1105
1113
  private readonly manifestDebounceMs;
@@ -1107,7 +1115,7 @@ declare class Director implements ICoordinator {
1107
1115
  private readonly maxFleetCostUsd;
1108
1116
  /** Max auto-extensions per subagent per budget kind before denying. */
1109
1117
  private readonly maxBudgetExtensions;
1110
- /** Sessions root for direct subagent JSONL reads (fleet_session tool). */
1118
+ /** Sessions root for direct subagent JSONL reads (fleet tool, action: session). */
1111
1119
  private readonly sessionsRoot?;
1112
1120
  /** Director run id for JSONL path resolution. */
1113
1121
  private readonly directorRunId;
@@ -1468,21 +1476,17 @@ declare function makeAskTool(director: Director): Tool;
1468
1476
  declare function makeAskResultTool(director: Director): Tool;
1469
1477
  declare function makeRollUpTool(director: Director): Tool;
1470
1478
  declare function makeTerminateTool(director: Director): Tool;
1471
- declare function makeFleetStatusTool(director: Director): Tool;
1472
- declare function makeFleetUsageTool(director: Director): Tool;
1479
+ declare function makeTerminateAllTool(director: Director): Tool;
1473
1480
  /**
1474
- * Read a subagent's JSONL transcript and return the last assistant text,
1475
- * stop reason, and tool-use count. The director can call this on a
1476
- * running or timed-out subagent to see what it actually produced without
1477
- * having to wait for natural completion.
1478
- */
1479
- declare function makeFleetSessionTool(director: Director): Tool;
1480
- /**
1481
- * Health snapshot per subagent — budget pressure (how close to limits),
1482
- * last activity timestamp, and current status. Lets the director make
1483
- * smarter routing decisions without having to call fleet_usage + fleet_status separately.
1481
+ * Unified fleet observation tool consolidates the former fleet_status,
1482
+ * fleet_usage, fleet_session, and fleet_health tools under a single `action`
1483
+ * parameter (status, usage, health, session).
1484
+ *
1485
+ * These four are all read-only fleet queries; merging them into one tool
1486
+ * reduces tool-schema token overhead (4 × ~150 tokens → 1 × ~250 tokens)
1487
+ * and eliminates model confusion when choosing between similar tools.
1484
1488
  */
1485
- declare function makeFleetHealthTool(director: Director): Tool;
1489
+ declare function makeFleetTool(director: Director): Tool;
1486
1490
  /**
1487
1491
  * Collaborative debugging session: BugHunter, RefactorPlanner, and Critic
1488
1492
  * run in parallel on the same target files, with findings flowing through
@@ -1900,4 +1904,4 @@ declare function attachAutoExtend(events: EventBus, policy?: AutoExtendPolicy):
1900
1904
  */
1901
1905
  declare const NULL_FLEET_BUS: FleetBus;
1902
1906
 
1903
- export { getAgentDefinition as $, ACP_AGENTS as A, BUG_HUNTER_AGENT as B, type CollabBudgetConfig as C, DEFAULT_DIRECTOR_PREAMBLE as D, FLEET_ROSTER_WITHACP as E, FLEET_ROSTER as F, FleetCostCapError as G, FleetManager as H, type FleetManagerOptions as I, type FleetRosterBudget as J, FleetSpawnBudgetError as K, type ICoordinator as L, type IFleetManager as M, LargeAnswerStore as N, NULL_FLEET_BUS as O, type RefactorPhase as P, type RefactorPlan as Q, REFACTOR_PLANNER_AGENT as R, SECURITY_SCANNER_AGENT as S, type SharedFileEntry as T, type SharedFileSnapshot as U, type SubagentPromptParts as V, applyRosterBudget as W, attachAutoExtend as X, composeDirectorPrompt as Y, composeSubagentPrompt as Z, createDelegateTool as _, AGENTS_BY_PHASE as a, makeAskResultTool as a0, makeAskTool as a1, makeAssignTool as a2, makeAwaitTasksTool as a3, makeCollabDebugTool as a4, makeDirectorSessionFactory as a5, makeFleetEmitTool as a6, makeFleetHealthTool as a7, makeFleetSessionTool as a8, makeFleetStatusTool as a9, makeFleetUsageTool as aa, makeRollUpTool as ab, makeSpawnTool as ac, makeTerminateTool as ad, makeWorkCompleteTool as ae, rosterSummaryFromConfigs as af, AGENT_CATALOG as b, ALL_AGENT_DEFINITIONS as c, ALL_FLEET_AGENTS as d, AUDIT_LOG_AGENT as e, type AutoExtendCeiling as f, type AutoExtendPolicy as g, type BugFinding as h, type CollabBudgetOverrides as i, type CollabBudgetWarningPayload as j, type CollabDebugReport as k, CollabSession as l, type CollabSessionOptions as m, type CreateDelegateToolOptions as n, type CriticConcern as o, type CriticEvaluation as p, DEFAULT_SUBAGENT_BASELINE as q, type DelegateHost as r, Director as s, type DirectorAlert as t, DirectorAlertLevel as u, type DirectorCancelCollabPayload as v, type DirectorPromptParts as w, type DirectorSessionFactory as x, type DirectorSessionFactoryOptions as y, FLEET_ROSTER_BUDGETS as z };
1907
+ export { getAgentDefinition as $, ACP_AGENTS as A, BUG_HUNTER_AGENT as B, type CollabBudgetConfig as C, DEFAULT_DIRECTOR_PREAMBLE as D, FLEET_ROSTER_WITHACP as E, FLEET_ROSTER as F, FleetCostCapError as G, FleetManager as H, type FleetManagerOptions as I, type FleetRosterBudget as J, FleetSpawnBudgetError as K, type ICoordinator as L, type IFleetManager as M, LargeAnswerStore as N, NULL_FLEET_BUS as O, type RefactorPhase as P, type RefactorPlan as Q, REFACTOR_PLANNER_AGENT as R, SECURITY_SCANNER_AGENT as S, type SharedFileEntry as T, type SharedFileSnapshot as U, type SubagentPromptParts as V, applyRosterBudget as W, attachAutoExtend as X, composeDirectorPrompt as Y, composeSubagentPrompt as Z, createDelegateTool as _, AGENTS_BY_PHASE as a, makeAskResultTool as a0, makeAskTool as a1, makeAssignTool as a2, makeAwaitTasksTool as a3, makeCollabDebugTool as a4, makeDirectorSessionFactory as a5, makeFleetEmitTool as a6, makeFleetTool as a7, makeRollUpTool as a8, makeSpawnTool as a9, makeTerminateAllTool as aa, makeTerminateTool as ab, makeWorkCompleteTool as ac, rosterSummaryFromConfigs as ad, AGENT_CATALOG as b, ALL_AGENT_DEFINITIONS as c, ALL_FLEET_AGENTS as d, AUDIT_LOG_AGENT as e, type AutoExtendCeiling as f, type AutoExtendPolicy as g, type BugFinding as h, type CollabBudgetOverrides as i, type CollabBudgetWarningPayload as j, type CollabDebugReport as k, CollabSession as l, type CollabSessionOptions as m, type CreateDelegateToolOptions as n, type CriticConcern as o, type CriticEvaluation as p, DEFAULT_SUBAGENT_BASELINE as q, type DelegateHost as r, Director as s, type DirectorAlert as t, DirectorAlertLevel as u, type DirectorCancelCollabPayload as v, type DirectorPromptParts as w, type DirectorSessionFactory as x, type DirectorSessionFactoryOptions as y, FLEET_ROSTER_BUDGETS as z };
@@ -1,6 +1,6 @@
1
1
  import { M as MetricsSink, d as MetricLabels, f as MetricsSnapshot, H as HealthRegistry, a as HealthCheck, A as AggregateHealth, T as Tracer, S as Span } from '../observability-D-HZN_mF.js';
2
- import { E as EventBus } from '../brain-DCkB5_e7.js';
3
- import '../context-BrLe8pJy.js';
2
+ import { E as EventBus } from '../brain-BLOyN5ZP.js';
3
+ import '../context-CLnUMW5g.js';
4
4
 
5
5
  /**
6
6
  * In-memory metrics sink. Suitable for embedded use, tests, and /metrics
@@ -1,6 +1,6 @@
1
- import { E as EventBus } from './brain-DCkB5_e7.js';
2
- import { M as ModelsRegistry, b as ResolvedModel } from './config-BzFRKkg7.js';
3
- import { e as TokenCounter, U as Usage, f as CacheStats } from './context-BrLe8pJy.js';
1
+ import { E as EventBus } from './brain-BLOyN5ZP.js';
2
+ import { M as ModelsRegistry, b as ResolvedModel } from './config-Bf5mj-ad.js';
3
+ import { e as TokenCounter, U as Usage, f as CacheStats } from './context-CLnUMW5g.js';
4
4
  import { P as PathResolver } from './path-resolver-CPRj4bFY.js';
5
5
 
6
6
  /**
@@ -18,6 +18,7 @@ declare class DefaultTokenCounter implements TokenCounter {
18
18
  private readonly registry?;
19
19
  private readonly providerId?;
20
20
  private readonly events?;
21
+ private sessionId?;
21
22
  private priceCache;
22
23
  /** Most recently accounted request's tokens. Used for per-request context pressure. */
23
24
  private lastInput;
@@ -26,7 +27,9 @@ declare class DefaultTokenCounter implements TokenCounter {
26
27
  registry?: ModelsRegistry | undefined;
27
28
  providerId?: string | undefined;
28
29
  events?: EventBus | undefined;
30
+ sessionId?: string | (() => string | undefined) | undefined;
29
31
  });
32
+ setSessionId(sessionId: string | (() => string | undefined) | undefined): void;
30
33
  account(usage: Usage, model?: string): void;
31
34
  /** Synchronous variant for code paths that have already resolved the model. */
32
35
  accountWithModel(usage: Usage, resolved: ResolvedModel): void;
@@ -35,6 +38,7 @@ declare class DefaultTokenCounter implements TokenCounter {
35
38
  input: number;
36
39
  cacheRead: number;
37
40
  };
41
+ setCurrentRequestTokens(input: number, cacheRead?: number): void;
38
42
  estimateCost(): {
39
43
  input: number;
40
44
  output: number;
@@ -45,6 +49,7 @@ declare class DefaultTokenCounter implements TokenCounter {
45
49
  /** Invalidate cached prices so the next account() call fetches fresh data. */
46
50
  invalidateCache(): void;
47
51
  private emitAccounted;
52
+ private currentSessionId;
48
53
  reset(): void;
49
54
  private applyPrice;
50
55
  }
@@ -1,4 +1,4 @@
1
- import { T as Tool, C as Context, h as Permission } from './context-BrLe8pJy.js';
1
+ import { T as Tool, C as Context, h as Permission } from './context-CLnUMW5g.js';
2
2
 
3
3
  interface SecretScrubber {
4
4
  scrub(text: string): string;
@@ -1,6 +1,6 @@
1
- import { T as Tool, C as Context } from './context-BrLe8pJy.js';
1
+ import { T as Tool, C as Context } from './context-CLnUMW5g.js';
2
2
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
3
- import { P as PermissionPolicy, a as PermissionDecision } from './permission-CJR1qfOi.js';
3
+ import { P as PermissionPolicy, a as PermissionDecision } from './permission-BCbQDR2s.js';
4
4
 
5
5
  interface PermissionPolicyOptions {
6
6
  trustFile: string;
@@ -122,22 +122,6 @@ declare class DefaultPermissionPolicy implements PermissionPolicy {
122
122
  }): void;
123
123
  private findNamespaceEntry;
124
124
  }
125
- /**
126
- * Auto-approving PermissionPolicy used for subagents. Subagents run
127
- * non-interactively under a director — they cannot answer permission
128
- * prompts, so a non-YOLO policy on the leader would silently hang the
129
- * delegated run on the first sensitive tool call. The user already
130
- * authorized the delegation when they invoked the leader; subagents
131
- * inherit that authorization automatically.
132
- *
133
- * Tool defaults of `permission: 'deny'` are still honored (this is a
134
- * subagent capability override, not a deny-bypass).
135
- *
136
- * 2026-06+: Primary decision is now based on declared `Tool.capabilities`
137
- * (capability allowlist / denylist model). The legacy name-based DENY set
138
- * is kept only for backward compatibility with tools that have not yet
139
- * declared capabilities.
140
- */
141
125
  /**
142
126
  * Auto-approving PermissionPolicy used for subagents. Subagents run
143
127
  * non-interactively under a director — they cannot answer permission
@@ -1,6 +1,6 @@
1
- import { T as Tool, q as TextBlock, i as ContentBlock } from './context-BrLe8pJy.js';
2
- import { a as MailboxAgentStatus } from './mailbox-types-_7gaY0Rl.js';
3
- import { H as HookEvent, f as HookMatcher, I as InProcessHook, S as ShellHook, g as HookEntry, T as ToolResultRenderMode } from './config-BzFRKkg7.js';
1
+ import { T as Tool, r as TextBlock, i as ContentBlock } from './context-CLnUMW5g.js';
2
+ import { a as MailboxAgentStatus } from './mailbox-types-DTl7bRH3.js';
3
+ import { H as HookEvent, f as HookMatcher, I as InProcessHook, S as ShellHook, g as HookEntry, T as ToolResultRenderMode } from './config-Bf5mj-ad.js';
4
4
 
5
5
  /** Model capabilities relevant to prompt composition. */
6
6
  interface ModelCapabilities {
@@ -208,9 +208,13 @@ type MiddlewareHandler<T> = (value: T, next: NextFn<T>) => Promise<T>;
208
208
  * Pipeline's error boundary to log the offender without aborting the run.
209
209
  *
210
210
  * Return `'rethrow'` to propagate the error (default for core middleware),
211
- * or `'swallow'` to skip past the crashing middleware and continue with the
212
- * value the previous one produced. Plugin middleware should usually be
213
- * swallowed so one bad plugin can't kill an agent run.
211
+ * or `'swallow'` to abort descent into the crashing middleware: its caller's
212
+ * `await next()` resolves with the value that was about to flow into the
213
+ * crashed middleware. The crashed middleware AND every middleware after it in
214
+ * the chain are skipped (they never run); UPSTREAM middleware, already paused
215
+ * at their own `await next()`, resume their post-`next()` work normally. It
216
+ * does NOT continue at the next sibling middleware. Plugin middleware should
217
+ * usually be swallowed so one bad plugin can't kill an agent run.
214
218
  */
215
219
  type PipelineErrorPolicy = 'rethrow' | 'swallow';
216
220
  interface PipelineErrorEvent {
@@ -1,7 +1,7 @@
1
- import { P as Provider, M as Message } from './context-BrLe8pJy.js';
2
- import { M as MessageSelector, S as SelectorResult } from './selector-qjpee9BF.js';
1
+ import { P as Provider, M as Message } from './context-CLnUMW5g.js';
2
+ import { M as MessageSelector, S as SelectorResult } from './selector-BCkWgdwy.js';
3
3
  import { M as ModeStore, a as ModeConfig, b as Mode } from './mode-CZlO9iU1.js';
4
- import { e as ModelsDevModel, R as ResolvedProvider } from './config-BzFRKkg7.js';
4
+ import { e as ModelsDevModel, R as ResolvedProvider } from './config-Bf5mj-ad.js';
5
5
 
6
6
  /**
7
7
  * Offline **floor** for the ChatGPT "Sign in with ChatGPT" (`openai-codex`)
@@ -1,8 +1,8 @@
1
- import { E as EventBus } from './brain-DCkB5_e7.js';
1
+ import { E as EventBus } from './brain-BLOyN5ZP.js';
2
2
  import { L as Logger } from './logger-B63L5bTg.js';
3
3
  import { T as Tracer } from './observability-D-HZN_mF.js';
4
- import { P as Provider, c as Request, C as Context, d as Response } from './context-BrLe8pJy.js';
5
- import { R as RetryPolicy } from './retry-policy-BmY5ooh3.js';
4
+ import { P as Provider, c as Request, C as Context, d as Response } from './context-CLnUMW5g.js';
5
+ import { R as RetryPolicy } from './retry-policy-Dt3_z8Aj.js';
6
6
 
7
7
  /**
8
8
  * Options passed to a ProviderRunner when calling the provider.
@@ -1,4 +1,4 @@
1
- import { C as Context, d as Response, g as ProviderError } from './context-BrLe8pJy.js';
1
+ import { C as Context, d as Response, g as ProviderError } from './context-CLnUMW5g.js';
2
2
 
3
3
  type RecoveryDecision = {
4
4
  /**
@@ -1,17 +1,17 @@
1
1
  import { h as Specification, e as SpecStatus, S as SpecAnalysis, g as SpecValidationResult, f as SpecTemplate, b as SpecRequirement } from '../spec-TBi3Jr6T.js';
2
2
  import { d as TaskGraph, e as TaskNode, i as TaskFilter, j as TaskSort, c as TaskProgress, T as TaskType, a as TaskPriority } from '../task-graph-u1q9Jkyk.js';
3
- import { E as EventBus, B as BrainArbiter } from '../brain-DCkB5_e7.js';
4
- import { g as Agent, h as AgentFactory, f as TaskResult, D as DoneCondition } from '../agent-subagent-runner-CArSFKFl.js';
5
- import { W as WorktreeManager } from '../worktree-manager-A1Efnvs0.js';
6
- import '../context-BrLe8pJy.js';
7
- import '../index-CtlizLTK.js';
3
+ import { E as EventBus, B as BrainArbiter } from '../brain-BLOyN5ZP.js';
4
+ import { h as Agent, i as AgentFactory, g as TaskResult, D as DoneCondition } from '../agent-subagent-runner-CEuw4ATz.js';
5
+ import { W as WorktreeManager } from '../worktree-manager-DBdl_5rs.js';
6
+ import '../context-CLnUMW5g.js';
7
+ import '../index-Cn0NOshr.js';
8
8
  import '../logger-B63L5bTg.js';
9
- import '../pipeline-BYR-Vdau.js';
10
- import '../mailbox-types-_7gaY0Rl.js';
11
- import '../config-BzFRKkg7.js';
9
+ import '../pipeline-Dl6XbfE7.js';
10
+ import '../mailbox-types-DTl7bRH3.js';
11
+ import '../config-Bf5mj-ad.js';
12
12
  import '../observability-D-HZN_mF.js';
13
- import '../permission-CJR1qfOi.js';
14
- import '../retry-policy-BmY5ooh3.js';
13
+ import '../permission-BCbQDR2s.js';
14
+ import '../retry-policy-Dt3_z8Aj.js';
15
15
 
16
16
  interface TaskStore {
17
17
  saveGraph(graph: TaskGraph): Promise<void>;
@@ -641,6 +641,8 @@ interface SddParallelRunOptions {
641
641
  onProgress?: ((progress: SddProgress) => void) | undefined;
642
642
  /** Shared EventBus — when set, the run emits `sdd.*` live-board events. */
643
643
  events?: EventBus | undefined;
644
+ /** Parent session id for every emitted `sdd.*` event. */
645
+ sessionId?: string | (() => string | undefined) | undefined;
644
646
  /** Stable id correlating all events of this run (default: random). */
645
647
  runId?: string | undefined;
646
648
  /**
@@ -717,6 +719,7 @@ declare class SddParallelRun {
717
719
  private retryMap;
718
720
  readonly runId: string;
719
721
  private readonly events?;
722
+ private readonly sessionIdSource;
720
723
  private readonly maxTotalWaves;
721
724
  private readonly maxWallClockMs?;
722
725
  private readonly maxRecoveryRounds;
@@ -750,6 +753,7 @@ declare class SddParallelRun {
750
753
  constructor(opts: SddParallelRunOptions);
751
754
  /** Type-safe emit on the optional EventBus (no-op when unwired). */
752
755
  private emit;
756
+ private currentSessionId;
753
757
  private paused;
754
758
  /** Trigger stop — causes run() to abort after the current wave. */
755
759
  stop(): void;
@@ -1005,6 +1009,8 @@ interface SddBoardProjectorOptions {
1005
1009
  graph: TaskGraph;
1006
1010
  tracker: TaskTracker;
1007
1011
  events: EventBus;
1012
+ /** Parent session id for emitted `sdd.board.snapshot` events. */
1013
+ sessionId?: string | (() => string | undefined) | undefined;
1008
1014
  /** Persist snapshots + JSONL events (optional — omit for in-memory only). */
1009
1015
  store?: SddBoardStore | undefined;
1010
1016
  specId?: string | undefined;
@@ -1060,6 +1066,7 @@ declare class SddBoardProjector {
1060
1066
  private build;
1061
1067
  private markDirty;
1062
1068
  private flush;
1069
+ private currentSessionId;
1063
1070
  }
1064
1071
 
1065
1072
  interface SpecStoreOptions {
@@ -1740,6 +1747,8 @@ interface StartSddRunOptions {
1740
1747
  agent: Agent;
1741
1748
  projectRoot: string;
1742
1749
  events: EventBus;
1750
+ /** Parent session id for all SDD EventBus emissions. */
1751
+ sessionId?: string | (() => string | undefined) | undefined;
1743
1752
  /** Per-task agent factory. Omit to run every task on the leader agent. */
1744
1753
  subagentFactory?: AgentFactory | undefined;
1745
1754
  /** Board snapshot/event persistence (also drained for cross-process control). */