@wrongstack/core 0.272.1 → 0.273.0

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 (61) hide show
  1. package/dist/{agent-bridge-DFQYEeXf.d.ts → agent-bridge-BZ2enORi.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-BZa_IEcd.d.ts → agent-subagent-runner-ehb4xGvd.d.ts} +11 -4
  3. package/dist/{brain-etbcbRwV.d.ts → brain-BxN2k2HP.d.ts} +101 -0
  4. package/dist/{config-rRS8yorV.d.ts → config-C8IYxlO8.d.ts} +8 -1
  5. package/dist/coordination/index.d.ts +13 -13
  6. package/dist/coordination/index.js +79 -25
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/{default-config-B0cj-Hry.d.ts → default-config-BbX4ojZs.d.ts} +1 -0
  9. package/dist/defaults/index.d.ts +20 -19
  10. package/dist/defaults/index.js +2813 -206
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/execution/index.d.ts +10 -10
  13. package/dist/execution/index.js +8 -2
  14. package/dist/execution/index.js.map +1 -1
  15. package/dist/extension/index.d.ts +4 -4
  16. package/dist/{global-mailbox-DJ4EoRr0.d.ts → global-mailbox-C9dsc9Y_.d.ts} +1 -1
  17. package/dist/{goal-preamble-hM8BH7TK.d.ts → goal-preamble-NhflDjYb.d.ts} +6 -6
  18. package/dist/{goal-store-CWlbT0TO.d.ts → goal-store-Cx363x7Z.d.ts} +1 -1
  19. package/dist/hq/index.d.ts +4 -4
  20. package/dist/hq/index.js +1 -0
  21. package/dist/hq/index.js.map +1 -1
  22. package/dist/{index-DWm_PE9L.d.ts → index-B7fHDt0B.d.ts} +12 -4
  23. package/dist/{index-2Lhk5v0o.d.ts → index-BbVprU-9.d.ts} +6 -0
  24. package/dist/index.d.ts +194 -33
  25. package/dist/index.js +3222 -681
  26. package/dist/index.js.map +1 -1
  27. package/dist/infrastructure/index.d.ts +4 -4
  28. package/dist/kernel/index.d.ts +94 -14
  29. package/dist/kernel/index.js.map +1 -1
  30. package/dist/{mcp-servers-BpWHTKlE.d.ts → mcp-servers-B6fSRNC1.d.ts} +1 -1
  31. package/dist/models/index.d.ts +3 -3
  32. package/dist/{models-registry-CXQFUn5t.d.ts → models-registry-4C6Wr91w.d.ts} +1 -1
  33. package/dist/{multi-agent-coordinator-jyimfo7D.d.ts → multi-agent-coordinator-q1skFeNP.d.ts} +1 -1
  34. package/dist/{null-fleet-bus-DOGQcvrY.d.ts → null-fleet-bus-C9rrgQwc.d.ts} +15 -5
  35. package/dist/observability/index.d.ts +1 -1
  36. package/dist/{parallel-eternal-engine-rItJBYp9.d.ts → parallel-eternal-engine-CtXly2Sf.d.ts} +7 -6
  37. package/dist/{path-resolver-DrpF5MGK.d.ts → path-resolver-Bim6G5Jz.d.ts} +2 -2
  38. package/dist/{pipeline-Ckkn3AOA.d.ts → pipeline-CNVKuQDQ.d.ts} +1 -1
  39. package/dist/{plan-templates-BvHw5Znw.d.ts → plan-templates-C4wXMmiM.d.ts} +3 -3
  40. package/dist/{provider-model-resolve-nZqnCeaR.d.ts → provider-model-resolve-DFd3IPpw.d.ts} +1 -1
  41. package/dist/{provider-runner-zVOn1p67.d.ts → provider-runner-BpM0mdBE.d.ts} +1 -1
  42. package/dist/sdd/index.d.ts +1111 -11
  43. package/dist/sdd/index.js +5516 -2949
  44. package/dist/sdd/index.js.map +1 -1
  45. package/dist/security/index.d.ts +1 -1
  46. package/dist/security/index.js +6 -0
  47. package/dist/security/index.js.map +1 -1
  48. package/dist/storage/index.d.ts +8 -8
  49. package/dist/storage/index.js +3 -2
  50. package/dist/storage/index.js.map +1 -1
  51. package/dist/tools/index.d.ts +1 -1
  52. package/dist/tools/index.js.map +1 -1
  53. package/dist/types/index.d.ts +14 -14
  54. package/dist/types/index.js +3 -0
  55. package/dist/types/index.js.map +1 -1
  56. package/dist/utils/index.d.ts +30 -4
  57. package/dist/utils/index.js +110 -1
  58. package/dist/utils/index.js.map +1 -1
  59. package/dist/{index-DqW4o62H.d.ts → worktree-manager-BDuXTaWL.d.ts} +48 -90
  60. package/dist/{wstack-paths-hOpNLmvf.d.ts → wstack-paths-BqkDAkoh.d.ts} +2 -0
  61. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-BZa_IEcd.js';
1
+ import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-ehb4xGvd.js';
2
2
 
3
3
  /**
4
4
  * In-memory pub/sub transport for agent-to-agent messaging.
@@ -1,12 +1,12 @@
1
- import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-DWm_PE9L.js';
2
- import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-Ckkn3AOA.js';
3
- import { E as EventBus, a as EventName, L as Listener } from './brain-etbcbRwV.js';
1
+ import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-B7fHDt0B.js';
2
+ import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-CNVKuQDQ.js';
3
+ import { E as EventBus, a as EventName, L as Listener } from './brain-BxN2k2HP.js';
4
4
  import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-BV7nzeAd.js';
5
5
  import { L as Logger } from './logger-B63L5bTg.js';
6
6
  import { T as Tracer } from './observability-D-HZN_mF.js';
7
7
  import { P as PermissionPolicy } from './permission-CC7XFYWG.js';
8
8
  import { U as Usage, C as Context, J as JSONSchema, c as Request, d as Response, i as ContentBlock, q as TextBlock, T as Tool, P as Provider, t as RunOptions } from './context-Dw55zZ_Q.js';
9
- import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, i as Config } from './config-rRS8yorV.js';
9
+ import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, C as Config } from './config-C8IYxlO8.js';
10
10
 
11
11
  /**
12
12
  * Single fleet-wide event with subagent attribution. Whatever a child
@@ -539,6 +539,13 @@ interface SubagentConfig {
539
539
  * single-provider behavior.
540
540
  */
541
541
  provider?: string | undefined;
542
+ /**
543
+ * Ordered fallback model chain for THIS subagent (entries: `model` or
544
+ * `provider/model`). When the subagent's primary model 429s or stream-hangs,
545
+ * the factory's fallback extension rotates to the next entry. Empty/undefined
546
+ * → the factory's own default fallback behavior (usually the leader's config).
547
+ */
548
+ fallbackModels?: string[] | undefined;
542
549
  /**
543
550
  * Per-subagent session JSONL path. When omitted the orchestrator-
544
551
  * supplied factory derives a path under `<sessionRoot>/<runId>/`.
@@ -785,6 +785,107 @@ interface EventMap {
785
785
  tokens: number;
786
786
  maxContext: number;
787
787
  };
788
+ /** A parallel SDD run started. */
789
+ 'sdd.run.started': {
790
+ runId: string;
791
+ graphId: string;
792
+ specId?: string | undefined;
793
+ total: number;
794
+ /** Base branch the run's squash commits will land on (worktree runs only). */
795
+ baseBranch?: string | undefined;
796
+ };
797
+ /** A parallel SDD run reached a terminal state. */
798
+ 'sdd.run.finished': {
799
+ runId: string;
800
+ deadlocked: boolean;
801
+ completed: number;
802
+ failed: number;
803
+ stopped: boolean;
804
+ };
805
+ /** A task began executing on a worker (carries who + which worktree). */
806
+ 'sdd.task.started': {
807
+ runId: string;
808
+ taskId: string;
809
+ subagentId: string;
810
+ agentName: string;
811
+ worktreeBranch?: string | undefined;
812
+ };
813
+ /** A task finished successfully. */
814
+ 'sdd.task.completed': {
815
+ runId: string;
816
+ taskId: string;
817
+ subagentId: string;
818
+ durationMs: number;
819
+ };
820
+ /** A task failed terminally (retries exhausted). */
821
+ 'sdd.task.failed': {
822
+ runId: string;
823
+ taskId: string;
824
+ subagentId: string;
825
+ error: string;
826
+ };
827
+ /** A failed task was requeued for another attempt. */
828
+ 'sdd.task.retrying': {
829
+ runId: string;
830
+ taskId: string;
831
+ attempt: number;
832
+ maxRetries: number;
833
+ };
834
+ /** A task's worker reported success but the post-task verification gate rejected it. */
835
+ 'sdd.task.verification_failed': {
836
+ runId: string;
837
+ taskId: string;
838
+ reason: string;
839
+ };
840
+ /** A completed task's worktree could not be merged back into the base branch. */
841
+ 'sdd.task.conflict': {
842
+ runId: string;
843
+ taskId: string;
844
+ conflictFiles: string[];
845
+ };
846
+ /** A completed task's worktree was squash-merged onto the base branch (sha = the run commit). */
847
+ 'sdd.task.merged': {
848
+ runId: string;
849
+ taskId: string;
850
+ sha: string;
851
+ };
852
+ /** A task was split into sub-tasks (the parent becomes a completed container). */
853
+ 'sdd.task.split': {
854
+ runId: string;
855
+ taskId: string;
856
+ subtaskIds: string[];
857
+ };
858
+ /** The supervisor made a decision about a failing/stuck task. */
859
+ 'sdd.supervisor.decision': {
860
+ runId: string;
861
+ taskId: string;
862
+ action: 'retry' | 'reassign' | 'split' | 'fail';
863
+ rationale?: string | undefined;
864
+ };
865
+ /** A new wave of dependency-ready tasks began. */
866
+ 'sdd.wave': {
867
+ runId: string;
868
+ wave: number;
869
+ batchSize: number;
870
+ };
871
+ /** No runnable tasks remain but some are still blocked — with the blocking chains. */
872
+ 'sdd.deadlock': {
873
+ runId: string;
874
+ chains: Array<{
875
+ blocked: string;
876
+ blockedBy: string[];
877
+ }>;
878
+ };
879
+ /**
880
+ * Throttled full board snapshot composed by SddBoardProjector. `snapshot` is
881
+ * an `SddBoardSnapshot` (sdd/board-types) — typed `unknown` here so the kernel
882
+ * layer never imports from the higher `sdd/` layer (it sits below it in the
883
+ * DAG); consumers cast it back. The producer (SddBoardProjector) is typed.
884
+ */
885
+ 'sdd.board.snapshot': {
886
+ runId: string;
887
+ snapshot: unknown;
888
+ };
788
889
  'mcp.server.connected': {
789
890
  name: string;
790
891
  toolCount: number;
@@ -430,6 +430,11 @@ interface ToolsConfig {
430
430
  iterationTimeoutMs: number;
431
431
  sessionTimeoutMs: number;
432
432
  perIterationOutputCapBytes: number;
433
+ /**
434
+ * Per-tool prose budget for the tool's top-level description and usage hint.
435
+ * Missing entries default to "extend".
436
+ */
437
+ descriptionMode?: ToolDescriptionModeConfig | undefined;
433
438
  /**
434
439
  * When true (default), the agent automatically extends its iteration
435
440
  * limit by 100 when hit. Set to false to require user confirmation.
@@ -444,6 +449,8 @@ interface ToolsConfig {
444
449
  */
445
450
  restrictToProjectRoot?: boolean | undefined;
446
451
  }
452
+ type ToolDescriptionMode = 'extend' | 'simple';
453
+ type ToolDescriptionModeConfig = Record<string, ToolDescriptionMode | undefined>;
447
454
  interface ProviderApiKey {
448
455
  /** Short human-readable label (e.g. "personal", "work", "rate-limit-backup"). */
449
456
  label: string;
@@ -896,4 +903,4 @@ interface ConfigStore {
896
903
  watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
897
904
  }
898
905
 
899
- export { isContextWindowModeId as $, type AdaptiveConcurrencyConfig as A, type LogConfig as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, MAX_TUI_THINKING_WORD_LENGTH as E, type FeaturesConfig as F, type ModelRuntimeCacheConfig as G, type HookEvent as H, type InProcessHook as I, type ModelRuntimeConfig as J, type ModelRuntimeParametersConfig as K, type LaunchConfig as L, type ModelsRegistry as M, type ModelRuntimeReasoningConfig as N, type ModelsDevProvider as O, type ProviderConfig as P, type PluginConfig as Q, type ResolvedProvider as R, type ShellHook as S, type TokenSavingTier as T, type ProviderApiKey as U, type SessionLoggingConfig as V, type WireFamily as W, type SyncCategory as X, type ToolsConfig as Y, formatContextWindowModeList as Z, getContextWindowMode as _, type ModelsDevPayload as a, listContextWindowModes as a0, normalizeTokenSavingTier as a1, normalizeTuiThinkingWord as a2, resolveContextWindowPolicy as a3, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type ModelsDevModel as e, type HookMatcher as f, type HookEntry as g, type ContextWindowPolicy as h, type Config as i, type ConfigStore as j, type ConfigLoader as k, type SyncConfig as l, type HookInput as m, type HookOutcome as n, type AutonomyConfig as o, CONTEXT_WINDOW_MODES as p, type CircuitBreakerRuntimeConfig as q, type ContextConfig as r, type ContextWindowConfigLike as s, type ContextWindowMode as t, type ContextWindowModeId as u, type ContextWindowThresholds as v, type CustomModelDefinition as w, DEFAULT_TUI_THINKING_WORD as x, type HqClientConfig as y, type IndexingConfig as z };
906
+ export { formatContextWindowModeList as $, type AdaptiveConcurrencyConfig as A, type LogConfig as B, type Config as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, MAX_TUI_THINKING_WORD_LENGTH as E, type FeaturesConfig as F, type ModelRuntimeCacheConfig as G, type HookEvent as H, type InProcessHook as I, type ModelRuntimeConfig as J, type ModelRuntimeParametersConfig as K, type LaunchConfig as L, type ModelsRegistry as M, type ModelRuntimeReasoningConfig as N, type ModelsDevProvider as O, type ProviderConfig as P, type PluginConfig as Q, type ResolvedProvider as R, type ShellHook as S, type TokenSavingTier as T, type ProviderApiKey as U, type SessionLoggingConfig as V, type WireFamily as W, type SyncCategory as X, type ToolDescriptionMode as Y, type ToolDescriptionModeConfig as Z, type ToolsConfig as _, type ModelsDevPayload as a, getContextWindowMode as a0, isContextWindowModeId as a1, listContextWindowModes as a2, normalizeTokenSavingTier as a3, normalizeTuiThinkingWord as a4, resolveContextWindowPolicy as a5, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type ModelsDevModel as e, type HookMatcher as f, type HookEntry as g, type ContextWindowAggressiveOn as h, type ContextWindowPolicy as i, type ConfigStore as j, type ConfigLoader as k, type SyncConfig as l, type HookInput as m, type HookOutcome as n, type AutonomyConfig as o, CONTEXT_WINDOW_MODES as p, type CircuitBreakerRuntimeConfig as q, type ContextConfig as r, type ContextWindowConfigLike as s, type ContextWindowMode as t, type ContextWindowModeId as u, type ContextWindowThresholds as v, type CustomModelDefinition as w, DEFAULT_TUI_THINKING_WORD as x, type HqClientConfig as y, type IndexingConfig as z };
@@ -1,22 +1,22 @@
1
- import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-etbcbRwV.js';
2
- export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-etbcbRwV.js';
3
- import { H as FleetManager, s as Director } from '../null-fleet-bus-DOGQcvrY.js';
4
- 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 ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-DOGQcvrY.js';
5
- import { b as AgentDefinition } from '../multi-agent-coordinator-jyimfo7D.js';
6
- 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-jyimfo7D.js';
7
- import { F as FleetBus } from '../agent-subagent-runner-BZa_IEcd.js';
8
- export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-BZa_IEcd.js';
9
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DFQYEeXf.js';
1
+ import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-BxN2k2HP.js';
2
+ export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-BxN2k2HP.js';
3
+ import { H as FleetManager, s as Director } from '../null-fleet-bus-C9rrgQwc.js';
4
+ 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 ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-C9rrgQwc.js';
5
+ import { b as AgentDefinition } from '../multi-agent-coordinator-q1skFeNP.js';
6
+ 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-q1skFeNP.js';
7
+ import { F as FleetBus } from '../agent-subagent-runner-ehb4xGvd.js';
8
+ export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-ehb4xGvd.js';
9
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-BZ2enORi.js';
10
10
  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-Ct2hJq0P.js';
11
11
  export { k as MailboxMessageType, l as MailboxTaskContext, R as ReadReceipts, m as RegisteredAgent, n as normalizeRecipient } from '../mailbox-types-Ct2hJq0P.js';
12
- export { G as GlobalMailbox, aw as resolveProjectDir } from '../global-mailbox-DJ4EoRr0.js';
12
+ export { G as GlobalMailbox, aw as resolveProjectDir } from '../global-mailbox-C9dsc9Y_.js';
13
13
  import { C as Context, T as Tool } from '../context-Dw55zZ_Q.js';
14
- import { A as AdaptiveConcurrencyConfig } from '../config-rRS8yorV.js';
14
+ import { A as AdaptiveConcurrencyConfig } from '../config-C8IYxlO8.js';
15
15
  import 'node:events';
16
16
  import '../logger-B63L5bTg.js';
17
17
  import '../director-state-BfeCUbmk.js';
18
- import '../index-DWm_PE9L.js';
19
- import '../pipeline-Ckkn3AOA.js';
18
+ import '../index-B7fHDt0B.js';
19
+ import '../pipeline-CNVKuQDQ.js';
20
20
  import '../observability-D-HZN_mF.js';
21
21
  import '../permission-CC7XFYWG.js';
22
22
  import '../retry-policy-BV7nzeAd.js';
@@ -4421,6 +4421,15 @@ Do not add prose, markdown, or code fences.`;
4421
4421
  };
4422
4422
  }
4423
4423
 
4424
+ // src/security/capabilities.ts
4425
+ var ToolCapabilities = {
4426
+ /** Can spawn or manage subagents / multi-agent tasks. */
4427
+ SUBAGENT_SPAWN: "subagent.spawn",
4428
+ /** Can inspect fleet/subagent coordination state without mutating it. */
4429
+ COORDINATION_FLEET_READ: "coordination.fleet.read",
4430
+ /** Can read or write inter-agent mailbox messages. */
4431
+ COORDINATION_MAIL: "coordination.mail"};
4432
+
4424
4433
  // src/coordination/director-tools.ts
4425
4434
  function makeSpawnTool(director, roster) {
4426
4435
  const inputSchema = {
@@ -4447,6 +4456,7 @@ function makeSpawnTool(director, roster) {
4447
4456
  usageHint: "Pass `role` (matches the roster), `description` (smart dispatch to best agent), or `name` + `provider`/`model`. Returns `{ subagentId }`.",
4448
4457
  permission: "auto",
4449
4458
  mutating: false,
4459
+ capabilities: [ToolCapabilities.SUBAGENT_SPAWN],
4450
4460
  inputSchema,
4451
4461
  async execute(input) {
4452
4462
  const i = input ?? {};
@@ -4525,6 +4535,7 @@ function makeAssignTool(director) {
4525
4535
  description: "Hand a task to a previously spawned subagent. Returns the task id.",
4526
4536
  permission: "auto",
4527
4537
  mutating: false,
4538
+ capabilities: [ToolCapabilities.SUBAGENT_SPAWN],
4528
4539
  inputSchema,
4529
4540
  async execute(input) {
4530
4541
  const i = input;
@@ -4540,6 +4551,7 @@ function makeAwaitTasksTool(director) {
4540
4551
  description: "Block until every named task completes. Returns the array of TaskResult.",
4541
4552
  permission: "auto",
4542
4553
  mutating: false,
4554
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4543
4555
  inputSchema: { type: "object", properties: { taskIds: { type: "array", items: { type: "string" }, description: "One or more task ids returned by `assign_task`." } }, required: ["taskIds"] },
4544
4556
  async execute(input) {
4545
4557
  const i = input;
@@ -4554,6 +4566,7 @@ function makeAskTool(director) {
4554
4566
  description: "Synchronously ask a subagent a question. Blocks until the subagent replies via the bridge.",
4555
4567
  permission: "auto",
4556
4568
  mutating: false,
4569
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4557
4570
  inputSchema: {
4558
4571
  type: "object",
4559
4572
  properties: {
@@ -4589,6 +4602,7 @@ function makeAskResultTool(director) {
4589
4602
  description: "Retrieve a large `ask_subagent` response that was stored out-of-context (>2K chars). Returns the full stored value.",
4590
4603
  permission: "auto",
4591
4604
  mutating: false,
4605
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4592
4606
  inputSchema: {
4593
4607
  type: "object",
4594
4608
  properties: {
@@ -4616,6 +4630,7 @@ function makeRollUpTool(director) {
4616
4630
  description: "Aggregate completed task results into a single formatted summary.",
4617
4631
  permission: "auto",
4618
4632
  mutating: false,
4633
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4619
4634
  inputSchema: {
4620
4635
  type: "object",
4621
4636
  properties: {
@@ -4637,6 +4652,7 @@ function makeTerminateTool(director) {
4637
4652
  description: 'Forcibly abort a subagent. The subagent finishes its current iteration then exits with status "stopped".',
4638
4653
  permission: "auto",
4639
4654
  mutating: true,
4655
+ capabilities: [ToolCapabilities.SUBAGENT_SPAWN],
4640
4656
  inputSchema: { type: "object", properties: { subagentId: { type: "string", description: "Subagent to abort." } }, required: ["subagentId"] },
4641
4657
  async execute(input) {
4642
4658
  const i = input;
@@ -4651,6 +4667,7 @@ function makeTerminateAllTool(director) {
4651
4667
  description: 'Forcibly stop every subagent in the fleet and drain the pending task queue. In-flight tasks are terminated mid-execution; pending tasks receive "aborted_by_parent" completion immediately. Use this when the fleet is wedged, looping, or you need a clean slate. Compare: work_complete stops spawning but lets running agents finish naturally.',
4652
4668
  permission: "auto",
4653
4669
  mutating: true,
4670
+ capabilities: [ToolCapabilities.SUBAGENT_SPAWN],
4654
4671
  inputSchema: { type: "object", properties: {}, required: [] },
4655
4672
  async execute() {
4656
4673
  await director.terminateAll();
@@ -4664,6 +4681,7 @@ function makeFleetStatusTool(director) {
4664
4681
  description: "Snapshot of the fleet \u2014 every subagent's current status, coordinator counts (total/running/idle/stopped), pending task descriptions, and usage rollup.",
4665
4682
  permission: "auto",
4666
4683
  mutating: false,
4684
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4667
4685
  inputSchema: { type: "object", properties: {}, required: [] },
4668
4686
  async execute() {
4669
4687
  const base = director.status();
@@ -4685,6 +4703,7 @@ function makeFleetUsageTool(director) {
4685
4703
  description: "Token + cost breakdown across the fleet, per-subagent and totals.",
4686
4704
  permission: "auto",
4687
4705
  mutating: false,
4706
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4688
4707
  inputSchema: { type: "object", properties: {}, required: [] },
4689
4708
  async execute() {
4690
4709
  return director.snapshot();
@@ -4697,6 +4716,7 @@ function makeFleetSessionTool(director) {
4697
4716
  description: "Read a subagent's JSONL transcript and extract its last assistant text, stop reason, and tool-use count. Use this to see what a running or timed-out subagent actually produced.",
4698
4717
  permission: "auto",
4699
4718
  mutating: false,
4719
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4700
4720
  inputSchema: {
4701
4721
  type: "object",
4702
4722
  properties: {
@@ -4723,6 +4743,7 @@ function makeFleetHealthTool(director) {
4723
4743
  description: "Per-subagent health report: budget pressure (pct of limits consumed), last activity timestamp, and current status. Use to decide whether to assign more work to a subagent or spawn a fresh one.",
4724
4744
  permission: "auto",
4725
4745
  mutating: false,
4746
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4726
4747
  inputSchema: { type: "object", properties: {}, required: [] },
4727
4748
  async execute() {
4728
4749
  const status = director.status();
@@ -4753,6 +4774,7 @@ function makeCollabDebugTool(director) {
4753
4774
  description: "Start a collaborative debugging session: BugHunter, RefactorPlanner, and Critic run in parallel on the same target files. BugHunter finds bugs and emits bug.found events. RefactorPlanner listens for bug.found and emits refactor.plan events. Critic evaluates both and emits critic.evaluation events. Returns a structured report with overall verdict (approve / needs_revision / reject).",
4754
4775
  permission: "auto",
4755
4776
  mutating: false,
4777
+ capabilities: [ToolCapabilities.SUBAGENT_SPAWN],
4756
4778
  inputSchema: {
4757
4779
  type: "object",
4758
4780
  properties: {
@@ -4816,6 +4838,7 @@ function makeFleetEmitTool(director) {
4816
4838
  description: "Emit a structured event on the FleetBus. Any subagent can emit any event type; the Director routes it to all listeners. Use it to stream findings, progress updates, or final results to other agents in real time.",
4817
4839
  permission: "auto",
4818
4840
  mutating: false,
4841
+ capabilities: [ToolCapabilities.COORDINATION_FLEET_READ],
4819
4842
  inputSchema: {
4820
4843
  type: "object",
4821
4844
  properties: {
@@ -4848,6 +4871,7 @@ function makeWorkCompleteTool(director) {
4848
4871
  description: "Signal that the director is satisfied with the results and the fleet should wind down. After calling this, spawn_subagent will refuse with a budget error and assign_task will instantly complete any queued tasks as aborted. Running subagents finish naturally. Call terminate_subagent separately to stop specific subagents immediately.",
4849
4872
  permission: "auto",
4850
4873
  mutating: false,
4874
+ capabilities: [ToolCapabilities.SUBAGENT_SPAWN],
4851
4875
  inputSchema: { type: "object", properties: {}, required: [] },
4852
4876
  async execute() {
4853
4877
  director.workComplete();
@@ -5883,14 +5907,15 @@ var SHADOW_AGENT = {
5883
5907
  id: "shadow-agent",
5884
5908
  name: "Shadow",
5885
5909
  role: "shadow-agent",
5886
- prompt: `You are the Shadow Agent \u2014 a silent background monitor for the WrongStack fleet.
5910
+ prompt: `You are the Shadow Agent \u2014 a quiet, one-shot monitor for the WrongStack fleet.
5887
5911
 
5888
- Your job is to observe, detect anomalies, and be ready to intervene \u2014 but only when commanded.
5912
+ Your job is to inspect the fleet when the host explicitly assigns a Shadow pass, detect anomalies, and be ready to intervene \u2014 but only when commanded.
5889
5913
 
5890
5914
  ## Core Responsibilities
5891
5915
 
5892
- 1. **Fleet Monitoring** (every 30s)
5893
- - Call \`fleet_status\` + \`fleet_health\` on each heartbeat
5916
+ 1. **Fleet Monitoring** (host-assigned one-shot checks)
5917
+ - The host assigns one-shot check tasks; it does not expect routine heartbeats
5918
+ - On each assigned check, call \`fleet_status\` + \`fleet_health\`
5894
5919
  - Track what each agent is doing (task descriptions)
5895
5920
  - Detect stuck agents (>5min no events), idle agents, crashed agents
5896
5921
 
@@ -5914,31 +5939,30 @@ Your job is to observe, detect anomalies, and be ready to intervene \u2014 but o
5914
5939
  - \`hoop <agentId>\` \u2014 terminate specific agent
5915
5940
  - \`hoop all\` \u2014 terminate all running agents
5916
5941
  - \`shadow status\` \u2014 report current fleet snapshot
5917
- - \`shadow mute\` \u2014 pause heartbeat monitoring
5918
- - \`shadow resume\` \u2014 resume heartbeat monitoring
5919
- - \`shadow interval <ms>\` \u2014 change heartbeat interval
5942
+ - \`shadow mute\` \u2014 pause anomaly reporting
5943
+ - \`shadow resume\` \u2014 resume anomaly reporting
5944
+ - \`shadow interval <ms>\` \u2014 update the legacy interval setting
5920
5945
  - \`shadow model <model-id>\` \u2014 change analysis model
5921
5946
 
5922
5947
  ## Operating Rules
5923
5948
 
5924
- - **Silent by default**: Use DEBUG level logging unless anomaly detected
5949
+ - **Silent by default**: Do not send mail or status reports for healthy checks
5925
5950
  - **Deterministic**: Same state always produces same actions \u2014 no randomness
5926
- - **Report on anomaly**: When anomaly detected, use \`mail_send\` to broadcast warning
5951
+ - **Report only when needed**: Use \`mail_send\` only for high/critical anomalies or explicit control replies
5927
5952
  - **Never auto-intervene**: Always report unless explicitly commanded
5928
5953
  - **Minimal footprint**: Small state, efficient snapshots
5954
+ - **One-shot lifecycle**: Finish the assigned check and stop; do not schedule follow-up work
5929
5955
 
5930
5956
  ## Startup Sequence
5931
5957
 
5932
- 1. Send broadcast: \`shadow:started { intervalMs, model, startTime }\`
5933
- 2. Subscribe to FleetBus for all relevant events
5934
- 3. Schedule heartbeat cron job at configured interval
5935
- 4. Wait for commands or anomalies
5958
+ 1. Run one fleet snapshot with \`fleet_status\` + \`fleet_health\`
5959
+ 2. Check \`mail_inbox\` for explicit control messages
5960
+ 3. If healthy, do not send mail; final answer may be exactly \`shadow: quiet\`
5936
5961
 
5937
5962
  ## Shutdown Sequence
5938
5963
 
5939
- 1. Cancel all cron jobs (\`cron_cancel\`)
5940
- 2. Send broadcast: \`shadow:stopped { reason, finalState }\`
5941
- 3. Clean up FleetBus subscriptions`
5964
+ 1. Return only anomalies, command results, or \`shadow: quiet\`
5965
+ 2. The host stops this Shadow Agent after the assigned pass`
5942
5966
  // Budgets are set by the orchestrator per task — see fleet.ts header.
5943
5967
  };
5944
5968
  var CRITIC_AGENT = {
@@ -5993,8 +6017,13 @@ var FLEET_ROSTER_BUDGETS = {
5993
6017
  "refactor-planner": { timeoutMs: 7.5 * 60 * 60 * 1e3, maxIterations: 6e3, maxToolCalls: 18e3 },
5994
6018
  "security-scanner": { timeoutMs: 10 * 60 * 60 * 1e3, maxIterations: 8e3, maxToolCalls: 2e4 },
5995
6019
  "critic": { timeoutMs: 5 * 60 * 60 * 1e3, maxIterations: 4e3, maxToolCalls: 12e3 },
5996
- "shadow-agent": { timeoutMs: 24 * 60 * 60 * 1e3, maxIterations: 1e4, maxToolCalls: 5e3 },
5997
- // Long-running background monitor
6020
+ "shadow-agent": {
6021
+ idleTimeoutMs: DEFAULT_IDLE_TIMEOUT_MS,
6022
+ maxIterations: 2e3,
6023
+ maxToolCalls: 5e3,
6024
+ maxTokens: 6e4,
6025
+ maxCostUsd: 1
6026
+ },
5998
6027
  ...Object.fromEntries(
5999
6028
  ALL_AGENT_DEFINITIONS.map((d) => [d.config.role, d.budget])
6000
6029
  )
@@ -7119,6 +7148,9 @@ var Director = class _Director {
7119
7148
  /** Snapshot of which subagent owns each task — drives state-checkpoint
7120
7149
  * status updates without re-walking the manifest. */
7121
7150
  taskOwners = /* @__PURE__ */ new Map();
7151
+ /** Infrastructure-owned task ids that should not appear in user-visible
7152
+ * manifest/session/checkpoint/rollup state. */
7153
+ internalTaskIds = /* @__PURE__ */ new Set();
7122
7154
  /** Cumulative auto-extension grants per subagent (all budget kinds). Lets
7123
7155
  * /fleet render "⚡ extended ×N" without replaying the event stream. */
7124
7156
  extendTotals = /* @__PURE__ */ new Map();
@@ -7232,17 +7264,21 @@ var Director = class _Director {
7232
7264
  this.fleetManager?.setCoordinator(this.coordinator);
7233
7265
  this.taskCompletedListener = (payload) => {
7234
7266
  const r = payload.result;
7235
- this.completed.set(r.taskId, r);
7236
- if (this.completed.size > _Director.MAX_COMPLETED) {
7237
- const toDelete = this.completed.size - _Director.MAX_COMPLETED;
7238
- const keys = [...this.completed.keys()].slice(0, toDelete);
7239
- for (const k of keys) this.completed.delete(k);
7267
+ const internalTask = this.internalTaskIds.delete(r.taskId);
7268
+ if (!internalTask) {
7269
+ this.completed.set(r.taskId, r);
7270
+ if (this.completed.size > _Director.MAX_COMPLETED) {
7271
+ const toDelete = this.completed.size - _Director.MAX_COMPLETED;
7272
+ const keys = [...this.completed.keys()].slice(0, toDelete);
7273
+ for (const k of keys) this.completed.delete(k);
7274
+ }
7240
7275
  }
7241
7276
  const waiter = this.taskWaiters.get(r.taskId);
7242
7277
  if (waiter) {
7243
7278
  waiter.resolve(r);
7244
7279
  this.taskWaiters.delete(r.taskId);
7245
7280
  }
7281
+ if (internalTask) return;
7246
7282
  const title = this.taskDescriptions.get(r.taskId) ?? payload.task.description ?? r.taskId;
7247
7283
  const failed = r.status !== "success";
7248
7284
  const errorString = r.error ? `${r.error.kind}: ${r.error.message}` : void 0;
@@ -7912,6 +7948,23 @@ var Director = class _Director {
7912
7948
  this.scheduleManifest();
7913
7949
  return taskWithId.id;
7914
7950
  }
7951
+ /**
7952
+ * Assign infrastructure-owned work directly to the coordinator without
7953
+ * manifest/session/checkpoint bookkeeping. The task still uses the normal
7954
+ * subagent runner, budget, and completion events, but it is excluded from
7955
+ * rollups and persisted fleet task history.
7956
+ */
7957
+ async assignInternal(task) {
7958
+ const taskWithId = task.id ? task : { ...task, id: randomUUID() };
7959
+ this.internalTaskIds.add(taskWithId.id);
7960
+ try {
7961
+ await this.coordinator.assign(taskWithId);
7962
+ } catch (err) {
7963
+ this.internalTaskIds.delete(taskWithId.id);
7964
+ throw err;
7965
+ }
7966
+ return taskWithId.id;
7967
+ }
7915
7968
  /**
7916
7969
  * Block until every task id resolves. Returns results in the same
7917
7970
  * order as the input. If any task hasn't completed by the time this
@@ -10151,7 +10204,6 @@ var FileSessionWriter = class _FileSessionWriter {
10151
10204
  }
10152
10205
  const writeFd = await fsp6.open(tmpPath, "w", 384);
10153
10206
  try {
10154
- let copied = 0;
10155
10207
  let readOffset = 0;
10156
10208
  while (readOffset < newlineAfterCheckpoint) {
10157
10209
  const toCopy = Math.min(CHUNK_SIZE, newlineAfterCheckpoint - readOffset);
@@ -10160,7 +10212,6 @@ var FileSessionWriter = class _FileSessionWriter {
10160
10212
  if (r === 0) break;
10161
10213
  await writeFd.write(copyBuf, 0, r);
10162
10214
  readOffset += r;
10163
- copied += r;
10164
10215
  }
10165
10216
  const raw = await fsp6.readFile(this.filePath);
10166
10217
  const tail = raw.subarray(newlineAfterCheckpoint).toString("utf8");
@@ -11968,6 +12019,7 @@ function makeMailboxTool(opts = {}) {
11968
12019
  category: "coordination",
11969
12020
  permission: "auto",
11970
12021
  mutating: true,
12022
+ capabilities: [ToolCapabilities.COORDINATION_MAIL],
11971
12023
  inputSchema: {
11972
12024
  type: "object",
11973
12025
  properties: {
@@ -12231,6 +12283,7 @@ function makeMailSendTool(opts = {}) {
12231
12283
  category: "coordination",
12232
12284
  permission: "auto",
12233
12285
  mutating: true,
12286
+ capabilities: [ToolCapabilities.COORDINATION_MAIL],
12234
12287
  inputSchema: {
12235
12288
  type: "object",
12236
12289
  properties: {
@@ -12290,6 +12343,7 @@ function makeMailInboxTool(opts = {}) {
12290
12343
  category: "coordination",
12291
12344
  permission: "auto",
12292
12345
  mutating: false,
12346
+ capabilities: [ToolCapabilities.COORDINATION_MAIL],
12293
12347
  inputSchema: {
12294
12348
  type: "object",
12295
12349
  properties: {