@wrongstack/core 0.283.1 → 0.284.1

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 (78) hide show
  1. package/dist/{compactor-BxddyCFu.d.ts → compactor-DQLL4HTo.d.ts} +1 -1
  2. package/dist/{config-DkCbA3Bw.d.ts → config-MRqn1V-u.d.ts} +130 -22
  3. package/dist/coordination/index.d.ts +43 -20
  4. package/dist/coordination/index.js +1744 -912
  5. package/dist/coordination/index.js.map +1 -1
  6. package/dist/{default-config-Buho8yge.d.ts → default-config-B79_gJYv.d.ts} +7 -0
  7. package/dist/defaults/index.d.ts +25 -29
  8. package/dist/defaults/index.js +2546 -7396
  9. package/dist/defaults/index.js.map +1 -1
  10. package/dist/{director-state-B_GPa78Q.d.ts → director-state-CMS_bMs4.d.ts} +2 -0
  11. package/dist/{events-KmxSmvho.d.ts → events-Bgnh43r9.d.ts} +27 -10
  12. package/dist/execution/index.d.ts +15 -16
  13. package/dist/execution/index.js +534 -140
  14. package/dist/execution/index.js.map +1 -1
  15. package/dist/execution/prompt-enhancer.d.ts +1 -1
  16. package/dist/extension/index.d.ts +6 -6
  17. package/dist/{global-mailbox-rWVt8YlO.d.ts → global-mailbox-sZwyI6CS.d.ts} +13 -2
  18. package/dist/{goal-store-8owBXJT2.d.ts → goal-store-Datpp-ar.d.ts} +1 -1
  19. package/dist/hq/index.d.ts +6 -6
  20. package/dist/hq/index.js +58 -7
  21. package/dist/hq/index.js.map +1 -1
  22. package/dist/{index-BhCteHAF.d.ts → index--Gm41aBJ.d.ts} +26 -11
  23. package/dist/{index-BEFWNZYs.d.ts → index-CbyuOE5y.d.ts} +5 -1
  24. package/dist/index.d.ts +50 -1015
  25. package/dist/index.js +21028 -27775
  26. package/dist/index.js.map +1 -1
  27. package/dist/infrastructure/index.d.ts +9 -7
  28. package/dist/infrastructure/index.js +7 -2
  29. package/dist/infrastructure/index.js.map +1 -1
  30. package/dist/kernel/index.d.ts +11 -11
  31. package/dist/kernel/index.js.map +1 -1
  32. package/dist/{mcp-servers-BUx9A_AQ.d.ts → mcp-servers-DEV4s6Ks.d.ts} +3 -3
  33. package/dist/models/index.d.ts +4 -4
  34. package/dist/models/index.js +18 -3
  35. package/dist/models/index.js.map +1 -1
  36. package/dist/{agent-subagent-runner-BsuWhB28.d.ts → multi-agent-coordinator-4RCRZKjN.d.ts} +417 -9
  37. package/dist/{null-fleet-bus-D4e9R7Qc.d.ts → null-fleet-bus-CFoNVQEK.d.ts} +53 -12
  38. package/dist/observability/index.d.ts +3 -3
  39. package/dist/{parallel-eternal-engine-iY2uxocj.d.ts → parallel-eternal-engine-HUrtePLd.d.ts} +4 -5
  40. package/dist/{permission-B6YAtNFz.d.ts → permission-ByDKXEcG.d.ts} +1 -1
  41. package/dist/{pipeline-ixSFe5jg.d.ts → pipeline-DGDyIohT.d.ts} +28 -7
  42. package/dist/{provider-model-resolve-DIxKL_T-.d.ts → provider-model-resolve-o2hHLs79.d.ts} +3 -3
  43. package/dist/{provider-runner-oQhDaZmH.d.ts → provider-runner-ChL-kVg6.d.ts} +3 -3
  44. package/dist/{retry-policy-V67lBOJz.d.ts → retry-policy-CQ7KwXJa.d.ts} +2 -2
  45. package/dist/{secret-vault-D7jeyXUQ.d.ts → secret-vault-DxohkUBc.d.ts} +3 -2
  46. package/dist/security/index.d.ts +4 -4
  47. package/dist/security/index.js +232 -2
  48. package/dist/security/index.js.map +1 -1
  49. package/dist/{selector-Bx2HgUkU.d.ts → selector-D8O6B_Rm.d.ts} +1 -1
  50. package/dist/{session-event-bridge-Bkp7ORfc.d.ts → session-event-bridge-D_z_mBwk.d.ts} +3 -3
  51. package/dist/{session-reader-B-Fi9L6I.d.ts → session-reader-7Esxrkpw.d.ts} +1 -1
  52. package/dist/storage/index.d.ts +77 -39
  53. package/dist/storage/index.js +1223 -288
  54. package/dist/storage/index.js.map +1 -1
  55. package/dist/tasking/index.d.ts +124 -0
  56. package/dist/tasking/index.js +492 -0
  57. package/dist/tasking/index.js.map +1 -0
  58. package/dist/{todos-checkpoint-BwCrj4Cb.d.ts → todos-checkpoint-FY7PjmMx.d.ts} +13 -4
  59. package/dist/{tool-LVSLiE1s.d.ts → tool-BNlnIJvo.d.ts} +216 -17
  60. package/dist/{tool-executor-kElSEgO0.d.ts → tool-executor-CckSCM5E.d.ts} +12 -15
  61. package/dist/tools/index.d.ts +2 -2
  62. package/dist/tools/index.js.map +1 -1
  63. package/dist/types/index.d.ts +94 -19
  64. package/dist/types/index.js +76 -12
  65. package/dist/types/index.js.map +1 -1
  66. package/dist/utils/index.d.ts +44 -10
  67. package/dist/utils/index.js +106 -17
  68. package/dist/utils/index.js.map +1 -1
  69. package/dist/{worktree-manager-BjyAW30D.d.ts → worktree-manager-DzwxKE35.d.ts} +1 -1
  70. package/instructions/coordination/subagent-baseline.md +5 -0
  71. package/instructions/llm/autonomy-brain.md +3 -2
  72. package/instructions/system.md +4 -0
  73. package/package.json +10 -3
  74. package/dist/multi-agent-coordinator-CrjeTB9i.d.ts +0 -357
  75. package/dist/sdd/index.d.ts +0 -1993
  76. package/dist/sdd/index.js +0 -9500
  77. package/dist/sdd/index.js.map +0 -1
  78. package/dist/spec-TBi3Jr6T.d.ts +0 -78
@@ -1,4 +1,4 @@
1
- import { d as Context } from './tool-LVSLiE1s.js';
1
+ import { d as Context } from './tool-BNlnIJvo.js';
2
2
 
3
3
  interface CompactRepairReport {
4
4
  removedToolUses: string[];
@@ -1,4 +1,4 @@
1
- import { a as ReasoningConfig, p as ReasoningEffort, q as CacheTtl, r as Capabilities, f as Permission } from './tool-LVSLiE1s.js';
1
+ import { a as ReasoningConfig, p as ReasoningEffort, q as CacheTtl, r as Capabilities, f as Permission } from './tool-BNlnIJvo.js';
2
2
 
3
3
  type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
4
4
  type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
@@ -53,6 +53,35 @@ type HookEvent = 'PreToolUse' | 'PostToolUse' | 'UserPromptSubmit' | 'SessionSta
53
53
  * `"edit|write"`, `"*"`. Ignored (treated as `*`) for non-tool events.
54
54
  */
55
55
  type HookMatcher = string;
56
+ /** What to do when a hook crashes, times out, or returns malformed output. */
57
+ type HookFailurePolicy = 'open' | 'closed';
58
+ /**
59
+ * PreToolUse hooks run in two phases. Mutators compose first; validators then
60
+ * inspect the final arguments and may no longer rewrite them.
61
+ */
62
+ type PreToolUseStage = 'mutate' | 'validate';
63
+ /** Per-registration runtime controls shared by every hook transport. */
64
+ interface HookRegistrationOptions {
65
+ /** Stable name used in logs and model-visible fail-closed errors. */
66
+ name?: string | undefined;
67
+ /** Per-invocation deadline in milliseconds (default 5000). */
68
+ timeoutMs?: number | undefined;
69
+ /** `open` skips a failed hook; `closed` converts failure to a denial. */
70
+ failurePolicy?: HookFailurePolicy | undefined;
71
+ /** PreToolUse phase. Legacy registrations default to `mutate`. */
72
+ stage?: PreToolUseStage | undefined;
73
+ /**
74
+ * Trusted enforcement hook. Policy hooks remain active under `--no-hooks`;
75
+ * ordinary automation hooks do not.
76
+ */
77
+ policy?: boolean | undefined;
78
+ }
79
+ /** Deadline/cancellation context passed to in-process hooks. */
80
+ interface HookInvocationContext {
81
+ signal: AbortSignal;
82
+ /** Absolute Unix epoch deadline in milliseconds. */
83
+ deadlineAt: number;
84
+ }
56
85
  /**
57
86
  * The JSON payload handed to a hook. For shell hooks this is serialized to
58
87
  * stdin; for in-process hooks it is passed as the sole argument. Kept flat and
@@ -107,35 +136,70 @@ interface HookOutcome {
107
136
  */
108
137
  contextAs?: 'inline' | 'separate' | undefined;
109
138
  }
139
+ /**
140
+ * Preferred, mutually-exclusive PreToolUse result. `allow` means only that
141
+ * this hook has no objection; it never bypasses the core permission policy.
142
+ */
143
+ type PreToolUseOutcome = {
144
+ additionalContext?: string | undefined;
145
+ contextAs?: 'inline' | 'separate' | undefined;
146
+ } & ({
147
+ action: 'allow';
148
+ } | {
149
+ action: 'deny';
150
+ reason: string;
151
+ } | {
152
+ action: 'mutate';
153
+ input: Record<string, unknown>;
154
+ reason?: string | undefined;
155
+ });
156
+ /** New and legacy hook outputs accepted at the transport boundary. */
157
+ type AnyHookOutcome = HookOutcome | PreToolUseOutcome;
110
158
  /** An in-process hook function (registered via the plugin API). */
111
- type InProcessHook = (input: HookInput) => HookOutcome | void | Promise<HookOutcome | void>;
159
+ type InProcessHook = (input: HookInput, runtime: HookInvocationContext) => AnyHookOutcome | void | Promise<AnyHookOutcome | void>;
160
+ interface ConfiguredHookBase extends HookRegistrationOptions {
161
+ /** Tool-name matcher (defaults to `*`). */
162
+ matcher?: HookMatcher | undefined;
163
+ }
112
164
  /**
113
165
  * A shell-command hook (declared in `config.hooks`). Claude-compatible: the
114
166
  * `HookInput` JSON is written to the command's stdin; a JSON `HookOutcome` may
115
167
  * be printed to stdout, and exit code 2 forces `decision: 'block'`.
116
168
  */
117
- interface ShellHook {
169
+ interface ShellHook extends ConfiguredHookBase {
170
+ type?: 'command' | undefined;
118
171
  /** Command line run via the platform shell. */
119
172
  command: string;
120
- /** Tool-name matcher (defaults to `*`). */
121
- matcher?: HookMatcher | undefined;
122
- /** Per-invocation timeout in ms (default 5000). */
173
+ }
174
+ /** Native HTTP hook. The HookInput JSON is POSTed and JSON output is parsed. */
175
+ interface HttpHook extends ConfiguredHookBase {
176
+ type: 'http';
177
+ url: string;
178
+ headers?: Record<string, string> | undefined;
179
+ }
180
+ type ConfiguredHook = ShellHook | HttpHook;
181
+ interface HookEntryBase {
182
+ event: HookEvent;
183
+ matcher: HookMatcher;
184
+ name: string;
123
185
  timeoutMs?: number | undefined;
186
+ failurePolicy: HookFailurePolicy;
187
+ stage: PreToolUseStage;
188
+ policy: boolean;
124
189
  }
125
190
  /** A registered hook entry, discriminated by transport. */
126
- type HookEntry = {
191
+ type HookEntry = (HookEntryBase & {
127
192
  kind: 'inprocess';
128
- event: HookEvent;
129
- matcher: HookMatcher;
130
193
  hook: InProcessHook;
131
194
  owner?: string | undefined;
132
- } | {
195
+ }) | (HookEntryBase & {
133
196
  kind: 'shell';
134
- event: HookEvent;
135
- matcher: HookMatcher;
136
197
  command: string;
137
- timeoutMs?: number | undefined;
138
- };
198
+ }) | (HookEntryBase & {
199
+ kind: 'http';
200
+ url: string;
201
+ headers?: Record<string, string> | undefined;
202
+ });
139
203
 
140
204
  /**
141
205
  * Mirror of the models.dev/api.json schema. Top-level is keyed by provider id.
@@ -489,6 +553,41 @@ interface ToolsConfig {
489
553
  * it is honored from any source.
490
554
  */
491
555
  exec?: ExecToolConfig | undefined;
556
+ /**
557
+ * Agent-loop repetition detector tuning. The detector watches two signals:
558
+ * consecutive effectively-identical iterations (same tool-name set + inputs
559
+ * + text) and per-call repeats (the same tool invoked with identical
560
+ * arguments N times within a sliding window, even when interleaved with
561
+ * other calls). In the default `steer-then-cut` mode the first detection
562
+ * folds a corrective note into the conversation and lets the run continue;
563
+ * only persistent repetition cuts the turn. Omitted fields use built-in
564
+ * defaults (see DEFAULT_TOOLS_CONFIG.loopDetection).
565
+ */
566
+ loopDetection?: LoopDetectionConfig | undefined;
567
+ }
568
+ /** Tuning for the agent-loop repetition detector (`tools.loopDetection`). */
569
+ interface LoopDetectionConfig {
570
+ /**
571
+ * `steer-then-cut` (default): inject a corrective note at the steer
572
+ * threshold, cut the turn only if repetition persists to the cut threshold.
573
+ * `cut`: legacy behavior — hard-stop at the steer threshold, per-call
574
+ * detector disabled. `off`: disable loop detection entirely.
575
+ */
576
+ mode?: 'steer-then-cut' | 'cut' | 'off' | undefined;
577
+ /** Consecutive identical iterations before the detector acts (default 3, min 2). */
578
+ steerThreshold?: number | undefined;
579
+ /**
580
+ * Consecutive identical iterations at which the turn is cut in
581
+ * `steer-then-cut` mode (default steerThreshold + 2, min steerThreshold + 1).
582
+ */
583
+ cutThreshold?: number | undefined;
584
+ /** Sliding window of recent tool calls for per-call repeat detection (default 12, min 4). */
585
+ windowSize?: number | undefined;
586
+ /**
587
+ * Identical (name + canonicalized args) calls within the window that
588
+ * trigger a steer note (default 4, min 2).
589
+ */
590
+ callRepeatThreshold?: number | undefined;
492
591
  }
493
592
  /** Allow/deny extension of the `exec` tool's built-in command allowlist. */
494
593
  interface ExecToolConfig {
@@ -874,7 +973,7 @@ interface IndexingConfig {
874
973
  /**
875
974
  * Watchdog timeout (ms) for a full index run. A run exceeding this is
876
975
  * aborted (so it can never wedge the indexing mutex or freeze the terminal)
877
- * and counts toward the indexing circuit breaker. Default: 120000.
976
+ * and counts toward the indexing circuit breaker. Default: 240000.
878
977
  */
879
978
  indexTimeoutMs?: number | undefined;
880
979
  }
@@ -1013,6 +1112,15 @@ interface SkillsConfig {
1013
1112
  * supervisor semantics.
1014
1113
  */
1015
1114
  interface FleetConfig {
1115
+ /** Fleet-wide hard ceilings. In-flight work may finish; new spawns are refused at the cap. */
1116
+ budget?: {
1117
+ /** Maximum subagents spawned during one Director lifetime. Default 64 in CLI. */
1118
+ maxSpawns?: number | undefined;
1119
+ /** Maximum cumulative input+output tokens across all fleet subagents. */
1120
+ maxTokens?: number | undefined;
1121
+ /** Maximum cumulative estimated USD cost across all fleet subagents. */
1122
+ maxCostUsd?: number | undefined;
1123
+ } | undefined;
1016
1124
  /** Periodic "[FLEET PULSE]" peer-status digest folded into each agent's context. */
1017
1125
  pulse?: {
1018
1126
  /** Default true. */
@@ -1077,7 +1185,7 @@ interface FleetSupervisorConfig {
1077
1185
  overloadPinnedThreshold?: number | undefined;
1078
1186
  /** pending > backlogFactor × live workers (sustained) → spawn-helper signal. Default 2. */
1079
1187
  backlogFactor?: number | undefined;
1080
- /** Running subagent with no tool activity for this long → stuck signal. Default 180000. */
1188
+ /** Running subagent with no observable fleet activity for this long → stuck signal. Default 180000. */
1081
1189
  stuckMs?: number | undefined;
1082
1190
  /** Consecutive failed/timeout results from one subagent → failure-streak signal. Default 2. */
1083
1191
  failureStreak?: number | undefined;
@@ -1174,12 +1282,12 @@ interface Config {
1174
1282
  */
1175
1283
  fallbackAuto?: boolean | undefined;
1176
1284
  /**
1177
- * Lifecycle shell hooks, keyed by event. Each command receives the hook
1178
- * `HookInput` JSON on stdin; a JSON `HookOutcome` on stdout (and exit code 2
1179
- * = block) steers the agent. In-process hooks are registered separately via
1180
- * the plugin API. Disabled entirely under `--bare` / `--no-hooks`.
1285
+ * Lifecycle command/HTTP hooks, keyed by event. Commands receive HookInput
1286
+ * JSON on stdin; HTTP hooks receive the same object as a POST body. A typed
1287
+ * outcome can allow, deny, or mutate. `policy: true` enforcement hooks remain
1288
+ * active under `--no-hooks`; ordinary automation is disabled.
1181
1289
  */
1182
- hooks?: Partial<Record<HookEvent, ShellHook[]>>;
1290
+ hooks?: Partial<Record<HookEvent, ConfiguredHook[]>>;
1183
1291
  plugins?: (string | PluginConfig)[] | undefined;
1184
1292
  log: LogConfig;
1185
1293
  features: FeaturesConfig;
@@ -1299,4 +1407,4 @@ interface ConfigStore {
1299
1407
  watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
1300
1408
  }
1301
1409
 
1302
- export { type ProviderApiKey as $, type AdaptiveConcurrencyConfig as A, type ExecToolConfig as B, type Config as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type ExecDangerConfig as E, type FleetConfig as F, type FeaturesConfig as G, type HookEvent as H, type InProcessHook as I, type FleetSupervisorConfig as J, type HqClientConfig as K, type IndexingConfig as L, type ModelsRegistry as M, type InputHistoryConfig as N, type LaunchConfig as O, type ProviderConfig as P, type LogConfig as Q, type ResolvedModel as R, type ShellHook as S, type ToolResultRenderMode as T, MAX_TUI_THINKING_WORD_LENGTH as U, type ModelRuntimeCacheConfig as V, type WireFamily as W, type ModelRuntimeParametersConfig as X, type ModelRuntimeReasoningConfig as Y, type ModelsDevProvider as Z, type PluginConfig as _, type ModelMatrixEntry as a, type SessionLoggingConfig as a0, type SkillsConfig as a1, type SyncCategory as a2, type ToolDescriptionMode as a3, type ToolDescriptionModeConfig as a4, type ToolResultRenderModeConfig as a5, type ToolsConfig as a6, formatContextWindowModeList as a7, getContextWindowMode as a8, isContextWindowModeId as a9, listContextWindowModes as aa, normalizeTokenSavingTier as ab, normalizeTuiThinkingWord as ac, resolveContextWindowPolicy as ad, type MCPServerConfig as b, type ModelsDevPayload as c, type ResolvedProvider as d, type ModelsDevModel as e, type HookMatcher as f, type HookEntry as g, type ModelRuntimeConfig as h, type ConfigLoader as i, type SyncConfig as j, type ConfigStore as k, type ContextWindowAggressiveOn as l, type ContextWindowPolicy as m, type TokenSavingTier as n, type HookInput as o, type HookOutcome as p, type AutonomyConfig as q, CONTEXT_WINDOW_MODES as r, type CircuitBreakerRuntimeConfig as s, type ContextConfig as t, type ContextWindowConfigLike as u, type ContextWindowMode as v, type ContextWindowModeId as w, type ContextWindowThresholds as x, type CustomModelDefinition as y, DEFAULT_TUI_THINKING_WORD as z };
1410
+ export { type LoopDetectionConfig as $, type AdaptiveConcurrencyConfig as A, type ContextWindowModeId as B, type ConfiguredHook as C, type ContextWindowThresholds as D, type CustomModelDefinition as E, type FleetConfig as F, DEFAULT_CONTEXT_WINDOW_MODE_ID as G, type HookEvent as H, type InProcessHook as I, DEFAULT_TUI_THINKING_WORD as J, type ExecDangerConfig as K, type ExecToolConfig as L, type ModelsRegistry as M, type FeaturesConfig as N, type FleetSupervisorConfig as O, type ProviderConfig as P, type HookFailurePolicy as Q, type ResolvedModel as R, type ShellHook as S, type ToolResultRenderMode as T, type HookInvocationContext as U, type HqClientConfig as V, type WireFamily as W, type IndexingConfig as X, type InputHistoryConfig as Y, type LaunchConfig as Z, type LogConfig as _, type ModelMatrixEntry as a, MAX_TUI_THINKING_WORD_LENGTH as a0, type ModelRuntimeCacheConfig as a1, type ModelRuntimeParametersConfig as a2, type ModelRuntimeReasoningConfig as a3, type ModelsDevProvider as a4, type PluginConfig as a5, type PreToolUseOutcome as a6, type PreToolUseStage as a7, type ProviderApiKey as a8, type SessionLoggingConfig as a9, type SkillsConfig as aa, type SyncCategory as ab, type ToolDescriptionMode as ac, type ToolDescriptionModeConfig as ad, type ToolResultRenderModeConfig as ae, type ToolsConfig as af, formatContextWindowModeList as ag, getContextWindowMode as ah, isContextWindowModeId as ai, listContextWindowModes as aj, normalizeTokenSavingTier as ak, normalizeTuiThinkingWord as al, resolveContextWindowPolicy as am, type MCPServerConfig as b, type ModelsDevPayload as c, type ResolvedProvider as d, type ModelsDevModel as e, type HookMatcher as f, type HookRegistrationOptions as g, type HttpHook as h, type HookEntry as i, type Config as j, type ModelRuntimeConfig as k, type ConfigLoader as l, type SyncConfig as m, type ConfigStore as n, type ContextWindowAggressiveOn as o, type ContextWindowPolicy as p, type TokenSavingTier as q, type HookInput as r, type HookOutcome as s, type AnyHookOutcome as t, type AutonomyConfig as u, CONTEXT_WINDOW_MODES as v, type CircuitBreakerRuntimeConfig as w, type ContextConfig as x, type ContextWindowConfigLike as y, type ContextWindowMode as z };
@@ -1,28 +1,26 @@
1
- import { H as FleetManager, s as Director } from '../null-fleet-bus-D4e9R7Qc.js';
2
- export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as FleetWorktreePolicy, M as ICoordinator, N as IFleetManager, O as InMemoryAgentBridge, P as InMemoryBridgeTransport, Q as LargeAnswerStore, R as NULL_FLEET_BUS, S as REFACTOR_PLANNER_AGENT, T as RefactorPhase, U as RefactorPlan, V as SECURITY_SCANNER_AGENT, W as SharedFileEntry, X as SharedFileSnapshot, Y as SubagentPromptParts, Z as TaskResultNotification, _ as WorktreeIntegrationError, $ as WorktreeIsolationDecision, a0 as WorktreeTaskRunnerOptions, a1 as WorktreeTaskStateUpdate, a2 as applyRosterBudget, a3 as attachAutoExtend, a4 as composeDirectorPrompt, a5 as composeSubagentPrompt, a6 as createDelegateTool, a7 as createMessage, a8 as getAgentDefinition, a9 as makeAskResultTool, aa as makeAskTool, ab as makeAssignTool, ac as makeAwaitTasksTool, ad as makeCollabDebugTool, ae as makeDirectorSessionFactory, af as makeFleetEmitTool, ag as makeFleetHealthTool, ag as makeFleetSessionTool, ag as makeFleetTool, ag as makeFleetUsageTool, ah as makeKanbanQueueTool, ai as makeQualityGateTool, aj as makeRollUpTool, ak as makeSpawnTool, al as makeTerminateAllTool, am as makeTerminateTool, an as makeWorkCompleteTool, ao as resolveSubagentWorktreeDecision, ap as rosterSummaryFromConfigs, aq as subagentNeedsWorktree, ar as wrapSubagentRunnerWithWorktrees } from '../null-fleet-bus-D4e9R7Qc.js';
3
- import { F as FleetBus, T as TaskSpec } from '../agent-subagent-runner-BsuWhB28.js';
4
- export { a as AgentFactory, y as AgentFactoryResult, z as AgentRunnerOptions, E as BudgetExceededError, G as BudgetKind, H as BudgetLimits, I as BudgetNegotiationMode, J as BudgetThresholdDecision, K as BudgetThresholdHandler, L as BudgetThresholdSignal, N as BudgetUsage, Q as DECISION_TIMEOUT_MS, R as FleetEvent, U as FleetHandler, k as FleetUsage, l as FleetUsageAggregator, X as SubagentBudget, a1 as SubagentUsageSnapshot, a2 as TIMEOUT_PREEMPT_FRACTION, a4 as makeAgentSubagentRunner, a5 as withDisabledToolFiltering } from '../agent-subagent-runner-BsuWhB28.js';
5
- import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../events-KmxSmvho.js';
6
- export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../events-KmxSmvho.js';
1
+ import { H as FleetManager, s as Director } from '../null-fleet-bus-CFoNVQEK.js';
2
+ export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as FleetTokenCapError, M as FleetWorktreePolicy, N as ICoordinator, O as IFleetManager, P as InMemoryAgentBridge, Q as InMemoryBridgeTransport, R as LargeAnswerStore, S as NULL_FLEET_BUS, T as REFACTOR_PLANNER_AGENT, U as RefactorPhase, V as RefactorPlan, W as SECURITY_SCANNER_AGENT, X as SharedFileEntry, Y as SharedFileSnapshot, Z as SubagentPromptParts, _ as TaskResultNotification, $ as WorktreeIntegrationError, a0 as WorktreeIsolationDecision, a1 as WorktreeTaskRunnerOptions, a2 as WorktreeTaskStateUpdate, a3 as applyRosterBudget, a4 as attachAutoExtend, a5 as composeDirectorPrompt, a6 as composeSubagentPrompt, a7 as createDelegateTool, a8 as createMessage, a9 as getAgentDefinition, aa as makeAskResultTool, ab as makeAskTool, ac as makeAssignTool, ad as makeAwaitTasksTool, ae as makeCollabDebugTool, af as makeDirectorSessionFactory, ag as makeFleetEmitTool, ah as makeFleetHealthTool, ah as makeFleetSessionTool, ah as makeFleetTool, ah as makeFleetUsageTool, ai as makeKanbanQueueTool, aj as makeQualityGateTool, ak as makeRollUpTool, al as makeSpawnTool, am as makeTerminateAllTool, an as makeTerminateTool, ao as makeWorkCompleteTool, ap as resolveSubagentWorktreeDecision, aq as rosterSummaryFromConfigs, ar as subagentNeedsWorktree, as as wrapSubagentRunnerWithWorktrees } from '../null-fleet-bus-CFoNVQEK.js';
3
+ import { h as AgentDefinition, F as FleetBus, T as TaskSpec, ai as SubagentStructuredReport } from '../multi-agent-coordinator-4RCRZKjN.js';
4
+ export { z as AGENT_TOOL_PRESETS, E as AgentBudgetTier, G as AgentCapability, a as AgentFactory, H as AgentFactoryResult, g as AgentPhase, I as AgentRunnerOptions, J as BudgetExceededError, K as BudgetKind, L as BudgetLimits, N as BudgetNegotiationMode, O as BudgetThresholdDecision, Q as BudgetThresholdHandler, R as BudgetThresholdSignal, U as BudgetUsage, W as DECISION_TIMEOUT_MS, X as DEFAULT_DISPATCH_ROLE, b as DefaultMultiAgentCoordinator, Y as DispatchCandidate, D as DispatchClassifier, Z as DispatchMethod, _ as DispatchOptions, $ as DispatchResult, a0 as FleetEvent, a1 as FleetHandler, j as FleetUsage, k as FleetUsageAggregator, a2 as HEAVY_BUDGET, a3 as LIGHT_BUDGET, a4 as MEDIUM_BUDGET, a6 as MultiAgentCoordinatorOptions, aa as SubagentBudget, aj as SubagentUsageSnapshot, ak as TIMEOUT_PREEMPT_FRACTION, am as dispatchAgent, an as makeAgentSubagentRunner, ao as makeLLMClassifier, ap as scoreAgents, aq as withDisabledToolFiltering } from '../multi-agent-coordinator-4RCRZKjN.js';
5
+ import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../events-Bgnh43r9.js';
6
+ export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../events-Bgnh43r9.js';
7
7
  import { b as Mailbox, c as MailboxSendInput, M as MailboxMessage, d as MailboxQuery, e as MailboxAckInput, f as MailboxAckBatchInput, a as MailboxAgentStatus, A as AgentRegistrationInput, g as AgentHeartbeatInput, P as PurgeOptions, j as PurgeResult, C as ClientRegistrationInput, h as ClientHeartbeatInput, i as ClientStatus } from '../mailbox-types-BGZWrYTJ.js';
8
8
  export { k as ClientSource, l as MailboxMessageType, m as MailboxTaskContext, R as ReadReceipts, n as RegisteredAgent, o as normalizeRecipient } from '../mailbox-types-BGZWrYTJ.js';
9
- import { b as AgentDefinition } from '../multi-agent-coordinator-CrjeTB9i.js';
10
- export { T as AGENT_TOOL_PRESETS, c as AgentBudgetTier, d as AgentCapability, A as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-CrjeTB9i.js';
11
9
  import { A as AgentEntry } from '../session-registry-Dvg7i_IA.js';
12
- import { d as Context, g as Tool } from '../tool-LVSLiE1s.js';
13
- import { J as FleetSupervisorConfig, a as ModelMatrixEntry, C as Config, A as AdaptiveConcurrencyConfig } from '../config-DkCbA3Bw.js';
14
- import { G as GlobalMailbox } from '../global-mailbox-rWVt8YlO.js';
15
- export { aA as resolveProjectDir } from '../global-mailbox-rWVt8YlO.js';
10
+ import { d as Context, g as Tool } from '../tool-BNlnIJvo.js';
11
+ import { O as FleetSupervisorConfig, a as ModelMatrixEntry, j as Config, A as AdaptiveConcurrencyConfig } from '../config-MRqn1V-u.js';
12
+ import { G as GlobalMailbox } from '../global-mailbox-sZwyI6CS.js';
13
+ export { aA as resolveProjectDir } from '../global-mailbox-sZwyI6CS.js';
16
14
  import { L as Logger } from '../logger-B63L5bTg.js';
17
15
  import 'node:events';
18
- import '../director-state-B_GPa78Q.js';
19
- import '../worktree-manager-BjyAW30D.js';
20
- import '../index-BhCteHAF.js';
21
- import '../pipeline-ixSFe5jg.js';
22
- import '../permission-B6YAtNFz.js';
16
+ import '../director-state-CMS_bMs4.js';
17
+ import '../worktree-manager-DzwxKE35.js';
18
+ import '../index--Gm41aBJ.js';
19
+ import '../pipeline-DGDyIohT.js';
20
+ import '../permission-ByDKXEcG.js';
23
21
  import '../observability-D-HZN_mF.js';
24
22
  import '../secret-scrubber-3MHDDAtm.js';
25
- import '../retry-policy-V67lBOJz.js';
23
+ import '../retry-policy-CQ7KwXJa.js';
26
24
 
27
25
  /** Phase 1 · Discovery — map the territory before any work begins. */
28
26
  declare const DISCOVERY_AGENTS: AgentDefinition[];
@@ -396,6 +394,8 @@ interface FleetSupervisorActions {
396
394
  /** Spawn an additional helper worker. Return {error} to degrade gracefully. */
397
395
  spawnHelper(input: {
398
396
  reason: string;
397
+ /** Oldest queued task used to route the helper's role/tool profile. */
398
+ task?: TaskSpec | undefined;
399
399
  }): Promise<{
400
400
  subagentId: string;
401
401
  } | {
@@ -452,7 +452,7 @@ declare class FleetSupervisor {
452
452
  private stopped;
453
453
  /** taskId → first tick timestamp we saw it pending. */
454
454
  private readonly pendingSince;
455
- /** subagentId → last tool.executed timestamp (fleet-wide activity map). */
455
+ /** subagentId → last observable fleet event timestamp. */
456
456
  private readonly lastActivityAt;
457
457
  /** subagentId → consecutive non-success completions. */
458
458
  private readonly failStreaks;
@@ -498,6 +498,29 @@ declare class FleetSupervisor {
498
498
  private engageIdleWithWork;
499
499
  }
500
500
 
501
+ /** Absolute recursion ceiling. Configuration may narrow this, never widen it. */
502
+ declare const HARD_MAX_SPAWN_DEPTH = 2;
503
+ /** CLI fleet default; core embedders retain their historical Infinity default. */
504
+ declare const DEFAULT_MAX_FLEET_SPAWNS = 64;
505
+ declare function resolveMaxSpawnDepth(requested?: number | undefined): number;
506
+
507
+ /** Context metadata key used to hand the submitted report to the task runner. */
508
+ declare const SUBAGENT_STRUCTURED_REPORT_META_KEY = "subagentStructuredReport";
509
+ declare const MAX_SUBAGENT_STRUCTURED_REPORT_CHARS = 8000;
510
+ /**
511
+ * Validate and normalize a model-supplied structured result. The tool executor
512
+ * already applies JSON Schema validation, but this guard keeps direct callers,
513
+ * custom executors, and data read back from Context metadata honest too.
514
+ */
515
+ declare function normalizeSubagentStructuredReport(value: unknown): SubagentStructuredReport | undefined;
516
+ declare function readSubagentStructuredReport(ctx: Pick<Context, 'meta'> | {
517
+ meta?: Record<string, unknown>;
518
+ } | undefined): SubagentStructuredReport | undefined;
519
+ /** Stable compact text form for mailbox/roll-up surfaces. */
520
+ declare function formatSubagentStructuredReport(report: SubagentStructuredReport): string;
521
+ /** Safe, task-local handoff channel from a subagent to its Director. */
522
+ declare function makeSubagentResultTool(): Tool;
523
+
501
524
  /**
502
525
  * mail-tools — thin, high-affordance wrappers over the project mailbox.
503
526
  *
@@ -2561,4 +2584,4 @@ declare class AutonomousCoordinator {
2561
2584
  private _emit;
2562
2585
  }
2563
2586
 
2564
- export { type AcquireOptions, type AcquireResult, AdaptiveConcurrencyController, type AdaptiveConcurrencyState, AgentDefinition, AgentHeartbeatInput, type AgentMonitorOptions, AgentMonitorService, AgentRegistrationInput, type AgentTimelineEntry, type AgentVirtualSession, type ApplyResult, type ApprovalDecision, AutonomousBrain, type AutonomousBrainOptions, AutonomousCoordinator, type AutonomousCoordinatorOptions, type AutonomousDecisionRequest, type AutonomousDecisionType, BUILD_AGENTS, BrainArbiter, BrainDecision, BrainDecisionOption, BrainDecisionRequest, BrainDecisionSource, type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, BrainRisk, type ChangeFile, ChangeManager, type ChangeManagerOptions, type ChangeNode, type ChangeProposal, type ChangeStatus, ClientHeartbeatInput, ClientRegistrationInput, ClientStatus, type ConsensusOptions, ConsensusProtocol, type ConsensusResult, type CoordinatorEvent, type CoordinatorStats, type DAGEdgeEvent, type DAGEdgeHandler, type DAGNode, type DAGNodeStatus, DEFAULT_QUALITY_CHECKS, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, type DecisionNode, type DecisionPrompt, DefaultMailbox, type DepWatchEntry, type DepWatcherBridgeOptions, type DependencyWatcherConfig, Director, type DownAlertInput, type EscalationDecision, type FactCategory, type FactNode, FleetBus, FleetManager, type FleetStatusToolOptions, FleetSupervisor, type FleetSupervisorActions, FleetSupervisorConfig, type FleetSupervisorOptions, type FleetSupervisorSource, GlobalMailbox, type GoalNode, type GoalPriority, type GoalStatus, type GraphSubscription, KNOWLEDGE_AGENTS, KnowledgeGraph, type LLMProvider, type LiveLockResult, MAILBOX_BRIDGE_LOCK_FILENAME, MAILBOX_BRIDGE_TOKEN_FILENAME, MAILBOX_HEALTH_DEFAULT_FAILURE_THRESHOLD, MAILBOX_HEALTH_DEFAULT_FROM, MAILBOX_HEALTH_DEFAULT_INTERVAL_MS, MAILBOX_HEALTH_DEFAULT_TIMEOUT_MS, MATRIX_PHASE_KEYS, META_AGENTS, type MailToolsOptions, Mailbox, MailboxAckBatchInput, MailboxAckInput, type MailboxActionInput, type MailboxActionResult, MailboxAgentStatus, type MailboxBridgeLock, type MailboxHealthEvent, MailboxHealthWatchdog, type MailboxHealthWatchdogOptions, type MailboxHooksOptions, MailboxMessage, type MailboxMessageAction, MailboxQuery, type MailboxResolver, MailboxSendInput, type MailboxToolOptions, type MatrixKeyKind, type ModelMatrixResolution, type ModelMatrixResolutionSource, type ModelReference, type NodeFilter, type NodeType, type OutdatedNotifyMessage, PLANNING_AGENTS, type PackageAuthorEntry, type PackageAuthorLog, type PackageAuthorTrackerOptions, type PackageOutdatedEntry, type PackageOutdatedResult, type PackageOutdatedWatcherOptions, type PrioritizationDecision, PurgeOptions, PurgeResult, type QualityCheck, type QualityGateChecks, type QualityGateResult, type QuorumRule, REVIEW_AGENTS, type RecoveryAlertInput, type ResolvedModelTarget, type ResolvedSubagentModelTarget, type RollbackResult, type RunOptions, type RunnablesHandler, type SpawnDecision, type SupervisedSubagent, type SupervisorLogEntry, type TaskAuctionOptions, TaskAuctioneer, type TaskBid, TaskDAG, VERIFY_AGENTS, type VoteNode, type VoteRecord, type VoteValue, type VoterConfig, type WatchdogConfig, acquireOrJoin, actionToAckInput, attachDepWatcherBridge, buildDownAlert, buildRecoveryAlert, createAgentMonitorService, createMailboxHooks, detectEcosystem, finalize, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, isValidMatrixKey, mailboxSessionTag, makeDependencyWatcherConfig, makeFleetStatusTool, makeMailInboxTool, makeMailSendTool, makeMailboxTool, matrixKeyKind, phaseForRole, readLiveLock, recordPackageAction, release, resolveImplementationModelTarget, resolveMailboxIdentity, resolveModelMatrix, resolveModelMatrixResolution, resolveModelTargetFromEntry, resolveSubagentModelTarget, roleNeedsIndependentReviewModel, sameModelReference, startPackageOutdatedWatcher, updatePackageOutdatedStatus, validateWatchdogOptions };
2587
+ export { type AcquireOptions, type AcquireResult, AdaptiveConcurrencyController, type AdaptiveConcurrencyState, AgentDefinition, AgentHeartbeatInput, type AgentMonitorOptions, AgentMonitorService, AgentRegistrationInput, type AgentTimelineEntry, type AgentVirtualSession, type ApplyResult, type ApprovalDecision, AutonomousBrain, type AutonomousBrainOptions, AutonomousCoordinator, type AutonomousCoordinatorOptions, type AutonomousDecisionRequest, type AutonomousDecisionType, BUILD_AGENTS, BrainArbiter, BrainDecision, BrainDecisionOption, BrainDecisionRequest, BrainDecisionSource, type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, BrainRisk, type ChangeFile, ChangeManager, type ChangeManagerOptions, type ChangeNode, type ChangeProposal, type ChangeStatus, ClientHeartbeatInput, ClientRegistrationInput, ClientStatus, type ConsensusOptions, ConsensusProtocol, type ConsensusResult, type CoordinatorEvent, type CoordinatorStats, type DAGEdgeEvent, type DAGEdgeHandler, type DAGNode, type DAGNodeStatus, DEFAULT_MAX_FLEET_SPAWNS, DEFAULT_QUALITY_CHECKS, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, type DecisionNode, type DecisionPrompt, DefaultMailbox, type DepWatchEntry, type DepWatcherBridgeOptions, type DependencyWatcherConfig, Director, type DownAlertInput, type EscalationDecision, type FactCategory, type FactNode, FleetBus, FleetManager, type FleetStatusToolOptions, FleetSupervisor, type FleetSupervisorActions, FleetSupervisorConfig, type FleetSupervisorOptions, type FleetSupervisorSource, GlobalMailbox, type GoalNode, type GoalPriority, type GoalStatus, type GraphSubscription, HARD_MAX_SPAWN_DEPTH, KNOWLEDGE_AGENTS, KnowledgeGraph, type LLMProvider, type LiveLockResult, MAILBOX_BRIDGE_LOCK_FILENAME, MAILBOX_BRIDGE_TOKEN_FILENAME, MAILBOX_HEALTH_DEFAULT_FAILURE_THRESHOLD, MAILBOX_HEALTH_DEFAULT_FROM, MAILBOX_HEALTH_DEFAULT_INTERVAL_MS, MAILBOX_HEALTH_DEFAULT_TIMEOUT_MS, MATRIX_PHASE_KEYS, MAX_SUBAGENT_STRUCTURED_REPORT_CHARS, META_AGENTS, type MailToolsOptions, Mailbox, MailboxAckBatchInput, MailboxAckInput, type MailboxActionInput, type MailboxActionResult, MailboxAgentStatus, type MailboxBridgeLock, type MailboxHealthEvent, MailboxHealthWatchdog, type MailboxHealthWatchdogOptions, type MailboxHooksOptions, MailboxMessage, type MailboxMessageAction, MailboxQuery, type MailboxResolver, MailboxSendInput, type MailboxToolOptions, type MatrixKeyKind, type ModelMatrixResolution, type ModelMatrixResolutionSource, type ModelReference, type NodeFilter, type NodeType, type OutdatedNotifyMessage, PLANNING_AGENTS, type PackageAuthorEntry, type PackageAuthorLog, type PackageAuthorTrackerOptions, type PackageOutdatedEntry, type PackageOutdatedResult, type PackageOutdatedWatcherOptions, type PrioritizationDecision, PurgeOptions, PurgeResult, type QualityCheck, type QualityGateChecks, type QualityGateResult, type QuorumRule, REVIEW_AGENTS, type RecoveryAlertInput, type ResolvedModelTarget, type ResolvedSubagentModelTarget, type RollbackResult, type RunOptions, type RunnablesHandler, SUBAGENT_STRUCTURED_REPORT_META_KEY, type SpawnDecision, type SupervisedSubagent, type SupervisorLogEntry, type TaskAuctionOptions, TaskAuctioneer, type TaskBid, TaskDAG, VERIFY_AGENTS, type VoteNode, type VoteRecord, type VoteValue, type VoterConfig, type WatchdogConfig, acquireOrJoin, actionToAckInput, attachDepWatcherBridge, buildDownAlert, buildRecoveryAlert, createAgentMonitorService, createMailboxHooks, detectEcosystem, finalize, formatSubagentStructuredReport, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, isValidMatrixKey, mailboxSessionTag, makeDependencyWatcherConfig, makeFleetStatusTool, makeMailInboxTool, makeMailSendTool, makeMailboxTool, makeSubagentResultTool, matrixKeyKind, normalizeSubagentStructuredReport, phaseForRole, readLiveLock, readSubagentStructuredReport, recordPackageAction, release, resolveImplementationModelTarget, resolveMailboxIdentity, resolveMaxSpawnDepth, resolveModelMatrix, resolveModelMatrixResolution, resolveModelTargetFromEntry, resolveSubagentModelTarget, roleNeedsIndependentReviewModel, sameModelReference, startPackageOutdatedWatcher, updatePackageOutdatedStatus, validateWatchdogOptions };