@wrongstack/core 0.54.1 → 0.66.13
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.
- package/dist/{agent-bridge-Dnhw4tnM.d.ts → agent-bridge-D-j6OOBT.d.ts} +1 -1
- package/dist/agent-subagent-runner-DRZ9-NnR.d.ts +1042 -0
- package/dist/{compactor-Duhsf0ge.d.ts → compactor-D_ExJajC.d.ts} +1 -1
- package/dist/{config-bht0txXS.d.ts → config--86aHSln.d.ts} +112 -2
- package/dist/{context-DtPKqKYV.d.ts → context-y87Jc5ei.d.ts} +8 -8
- package/dist/coordination/index.d.ts +12 -12
- package/dist/coordination/index.js +87 -69
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +22 -22
- package/dist/defaults/index.js +365 -174
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-CbHTS4ZZ.d.ts → events-CIplI98R.d.ts} +20 -1
- package/dist/execution/index.d.ts +16 -385
- package/dist/execution/index.js +129 -61
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +7 -7
- package/dist/goal-store-C7jcumEh.d.ts +96 -0
- package/dist/index-DKUvyTvV.d.ts +560 -0
- package/dist/{index-ge5F2dnc.d.ts → index-b5uhfTSl.d.ts} +10 -8
- package/dist/index.d.ts +59 -33
- package/dist/index.js +1138 -733
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +1 -1
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DE6gzBry.d.ts → mcp-servers-DwoNBf6r.d.ts} +3 -3
- package/dist/models/index.d.ts +2 -2
- package/dist/{multi-agent-coordinator-CjNX4uBD.d.ts → multi-agent-coordinator-CWnH-CiX.d.ts} +10 -2
- package/dist/{null-fleet-bus-BNiSlTna.d.ts → null-fleet-bus-VApKRxcp.d.ts} +6 -7
- package/dist/observability/index.d.ts +2 -2
- package/dist/parallel-eternal-engine-0UwotoSx.d.ts +483 -0
- package/dist/{path-resolver-Bax85amb.d.ts → path-resolver-DVkEcIw8.d.ts} +2 -2
- package/dist/{permission-Drm7LpPo.d.ts → permission-C1A5whY5.d.ts} +17 -1
- package/dist/{permission-policy-CU6sqWxF.d.ts → permission-policy-B2dK-T5N.d.ts} +28 -7
- package/dist/{plan-templates-CLRcurWN.d.ts → plan-templates-Bprrzhbu.d.ts} +4 -4
- package/dist/{provider-runner-BikCxGCx.d.ts → provider-runner-mXvXGSIw.d.ts} +3 -3
- package/dist/{retry-policy-Chtlvr5b.d.ts → retry-policy-CG3qvH_e.d.ts} +1 -1
- package/dist/sdd/index.d.ts +9 -9
- package/dist/sdd/index.js +59 -52
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/security/index.js +144 -33
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-BvSPdJj6.d.ts → selector-RvBR_YRW.d.ts} +1 -1
- package/dist/session-event-bridge-CDHxcmQU.d.ts +93 -0
- package/dist/{session-reader-BGhzMir4.d.ts → session-reader-BIpwM60D.d.ts} +1 -1
- package/dist/storage/index.d.ts +7 -6
- package/dist/{system-prompt-dtzV_mLm.d.ts → system-prompt-b61lOd49.d.ts} +32 -2
- package/dist/types/index.d.ts +23 -14
- package/dist/types/index.js +62 -6
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/multi-agent/SKILL.md +0 -2
- package/dist/agent-subagent-runner-By7jruZ_.d.ts +0 -182
- package/dist/goal-store-DwcTDDiX.d.ts +0 -188
- package/dist/index-CI271MjL.d.ts +0 -903
- package/dist/multi-agent-BmC_xiog.d.ts +0 -554
- package/dist/tool-executor-CgU0yWpB.d.ts +0 -110
|
@@ -1,5 +1,100 @@
|
|
|
1
1
|
import { W as WireFamily } from './models-registry-BcYJDKLm.js';
|
|
2
|
-
import { a as Capabilities, P as Permission } from './context-
|
|
2
|
+
import { a as Capabilities, P as Permission } from './context-y87Jc5ei.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Lifecycle hook types — the pure, serializable contract shared by the config
|
|
6
|
+
* layer, the in-process plugin API, and the shell-hook executor.
|
|
7
|
+
*
|
|
8
|
+
* These types intentionally avoid referencing the live `Context` (which lives
|
|
9
|
+
* in `core/`, a higher layer) so `types/config.ts` can import them without
|
|
10
|
+
* creating a layering cycle. The runtime pieces (`hooks/registry`,
|
|
11
|
+
* `hooks/runner`, `hooks/shell-executor`) translate live run state into the
|
|
12
|
+
* serializable `HookInput` below.
|
|
13
|
+
*/
|
|
14
|
+
/** Lifecycle phases a hook can subscribe to. */
|
|
15
|
+
type HookEvent = 'PreToolUse' | 'PostToolUse' | 'UserPromptSubmit' | 'SessionStart' | 'Stop';
|
|
16
|
+
/**
|
|
17
|
+
* Tool-name matcher for `PreToolUse`/`PostToolUse` hooks. A pipe-delimited
|
|
18
|
+
* list of exact tool names, or `*` for all tools. Examples: `"Bash"`,
|
|
19
|
+
* `"edit|write"`, `"*"`. Ignored (treated as `*`) for non-tool events.
|
|
20
|
+
*/
|
|
21
|
+
type HookMatcher = string;
|
|
22
|
+
/**
|
|
23
|
+
* The JSON payload handed to a hook. For shell hooks this is serialized to
|
|
24
|
+
* stdin; for in-process hooks it is passed as the sole argument. Kept flat and
|
|
25
|
+
* serializable so both transports see the same shape.
|
|
26
|
+
*/
|
|
27
|
+
interface HookInput {
|
|
28
|
+
event: HookEvent;
|
|
29
|
+
/** Present for PreToolUse / PostToolUse. */
|
|
30
|
+
toolName?: string;
|
|
31
|
+
/** Tool arguments (PreToolUse / PostToolUse). */
|
|
32
|
+
toolInput?: unknown;
|
|
33
|
+
/** Tool result preview (PostToolUse only). */
|
|
34
|
+
toolResult?: {
|
|
35
|
+
content: string;
|
|
36
|
+
isError: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** The submitted user text (UserPromptSubmit only). */
|
|
39
|
+
prompt?: string;
|
|
40
|
+
/** Absolute working directory of the session. */
|
|
41
|
+
cwd: string;
|
|
42
|
+
/** Active session id, when known. */
|
|
43
|
+
sessionId?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* What a hook returns. Every field is optional — an empty object (or a hook
|
|
47
|
+
* that returns nothing) is a no-op "allow".
|
|
48
|
+
*/
|
|
49
|
+
interface HookOutcome {
|
|
50
|
+
/**
|
|
51
|
+
* `block` stops the action (PreToolUse → tool not run; UserPromptSubmit →
|
|
52
|
+
* turn short-circuited). `allow` is the explicit no-op. Omitted = allow.
|
|
53
|
+
*/
|
|
54
|
+
decision?: 'block' | 'allow';
|
|
55
|
+
/** Human-readable reason, surfaced to the model when blocking. */
|
|
56
|
+
reason?: string;
|
|
57
|
+
/**
|
|
58
|
+
* PreToolUse only: replacement tool arguments. The executor swaps these in
|
|
59
|
+
* and RE-VALIDATES them against the tool's input schema before running.
|
|
60
|
+
*/
|
|
61
|
+
modifiedInput?: Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Extra context to fold back to the model — appended to the tool_result
|
|
64
|
+
* (PostToolUse), the user message (UserPromptSubmit), or the system preamble
|
|
65
|
+
* (SessionStart).
|
|
66
|
+
*/
|
|
67
|
+
additionalContext?: string;
|
|
68
|
+
}
|
|
69
|
+
/** An in-process hook function (registered via the plugin API). */
|
|
70
|
+
type InProcessHook = (input: HookInput) => HookOutcome | void | Promise<HookOutcome | void>;
|
|
71
|
+
/**
|
|
72
|
+
* A shell-command hook (declared in `config.hooks`). Claude-compatible: the
|
|
73
|
+
* `HookInput` JSON is written to the command's stdin; a JSON `HookOutcome` may
|
|
74
|
+
* be printed to stdout, and exit code 2 forces `decision: 'block'`.
|
|
75
|
+
*/
|
|
76
|
+
interface ShellHook {
|
|
77
|
+
/** Command line run via the platform shell. */
|
|
78
|
+
command: string;
|
|
79
|
+
/** Tool-name matcher (defaults to `*`). */
|
|
80
|
+
matcher?: HookMatcher;
|
|
81
|
+
/** Per-invocation timeout in ms (default 5000). */
|
|
82
|
+
timeoutMs?: number;
|
|
83
|
+
}
|
|
84
|
+
/** A registered hook entry, discriminated by transport. */
|
|
85
|
+
type HookEntry = {
|
|
86
|
+
kind: 'inprocess';
|
|
87
|
+
event: HookEvent;
|
|
88
|
+
matcher: HookMatcher;
|
|
89
|
+
hook: InProcessHook;
|
|
90
|
+
owner?: string;
|
|
91
|
+
} | {
|
|
92
|
+
kind: 'shell';
|
|
93
|
+
event: HookEvent;
|
|
94
|
+
matcher: HookMatcher;
|
|
95
|
+
command: string;
|
|
96
|
+
timeoutMs?: number;
|
|
97
|
+
};
|
|
3
98
|
|
|
4
99
|
type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
|
|
5
100
|
type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
|
|
@@ -266,6 +361,21 @@ interface Config {
|
|
|
266
361
|
context: ContextConfig;
|
|
267
362
|
tools: ToolsConfig;
|
|
268
363
|
mcpServers?: Record<string, MCPServerConfig>;
|
|
364
|
+
/**
|
|
365
|
+
* Ordered list of fallback model references tried, in order, when the
|
|
366
|
+
* primary model is overloaded (HTTP 429/529/5xx) and its own retries are
|
|
367
|
+
* exhausted. Each entry is a model reference: a bare model id (same
|
|
368
|
+
* provider), `provider/model`, or `provider model`. The primary is always
|
|
369
|
+
* re-tried first at the start of every user turn. See `createFallbackModelExtension`.
|
|
370
|
+
*/
|
|
371
|
+
fallbackModels?: string[];
|
|
372
|
+
/**
|
|
373
|
+
* Lifecycle shell hooks, keyed by event. Each command receives the hook
|
|
374
|
+
* `HookInput` JSON on stdin; a JSON `HookOutcome` on stdout (and exit code 2
|
|
375
|
+
* = block) steers the agent. In-process hooks are registered separately via
|
|
376
|
+
* the plugin API. Disabled entirely under `--bare` / `--no-hooks`.
|
|
377
|
+
*/
|
|
378
|
+
hooks?: Partial<Record<HookEvent, ShellHook[]>>;
|
|
269
379
|
plugins?: (string | PluginConfig)[];
|
|
270
380
|
log: LogConfig;
|
|
271
381
|
features: FeaturesConfig;
|
|
@@ -341,4 +451,4 @@ interface ConfigStore {
|
|
|
341
451
|
watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
342
452
|
}
|
|
343
453
|
|
|
344
|
-
export { type AutonomyConfig as A, CONTEXT_WINDOW_MODES as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type FeaturesConfig as F, type LogConfig as L, type MCPServerConfig as M, type PluginConfig as P, type SessionLoggingConfig as S, type ToolsConfig as T, type Config as a, type ConfigLoader as b, type ConfigStore as c, type ContextConfig as d, type ContextWindowAggressiveOn as e, type ContextWindowConfigLike as f, type ContextWindowMode as g, type ContextWindowModeId as h, type ContextWindowPolicy as i, type ContextWindowThresholds as j, type CustomModelDefinition as k, type
|
|
454
|
+
export { type AutonomyConfig as A, CONTEXT_WINDOW_MODES as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type FeaturesConfig as F, type HookEntry as H, type InProcessHook as I, type LogConfig as L, type MCPServerConfig as M, type PluginConfig as P, type SessionLoggingConfig as S, type ToolsConfig as T, type Config as a, type ConfigLoader as b, type ConfigStore as c, type ContextConfig as d, type ContextWindowAggressiveOn as e, type ContextWindowConfigLike as f, type ContextWindowMode as g, type ContextWindowModeId as h, type ContextWindowPolicy as i, type ContextWindowThresholds as j, type CustomModelDefinition as k, type HookEvent as l, type HookInput as m, type HookMatcher as n, type HookOutcome as o, type ModelMatrixEntry as p, type ProviderApiKey as q, type ProviderConfig as r, type ShellHook as s, type SyncCategory as t, type SyncConfig as u, formatContextWindowModeList as v, getContextWindowMode as w, isContextWindowModeId as x, listContextWindowModes as y, resolveContextWindowPolicy as z };
|
|
@@ -265,12 +265,12 @@ declare function isFsError(err: unknown): err is FsError;
|
|
|
265
265
|
|
|
266
266
|
type Permission = 'auto' | 'confirm' | 'deny';
|
|
267
267
|
/**
|
|
268
|
-
* Risk tier for tools in YOLO mode.
|
|
269
|
-
*
|
|
270
|
-
*
|
|
268
|
+
* Risk tier for tools in YOLO mode. YOLO auto-approves everything by default,
|
|
269
|
+
* including destructive calls. Use `--confirm-destructive` to re-enable
|
|
270
|
+
* confirmation prompts for destructive operations.
|
|
271
271
|
*
|
|
272
272
|
* - `safe` — read-only, no side effects (read, glob, grep, etc.)
|
|
273
|
-
* - `standard` — non-destructive writes and mutations (write, edit,
|
|
273
|
+
* - `standard` — non-destructive writes and mutations (write, edit, safe shell commands)
|
|
274
274
|
* - `destructive` — irreversible or broadside effects (recursive deletes, db drops, etc.)
|
|
275
275
|
*/
|
|
276
276
|
type RiskTier = 'safe' | 'standard' | 'destructive';
|
|
@@ -324,10 +324,10 @@ interface Tool<I = unknown, O = unknown> {
|
|
|
324
324
|
permission: Permission;
|
|
325
325
|
mutating: boolean;
|
|
326
326
|
/**
|
|
327
|
-
* Risk tier for selective YOLO gating. When YOLO is active,
|
|
328
|
-
*
|
|
329
|
-
* `standard` when omitted — callers should always check
|
|
330
|
-
* the basic permission decision.
|
|
327
|
+
* Risk tier for selective YOLO gating. When YOLO is active, clearly
|
|
328
|
+
* destructive calls still emit `confirm` unless the destructive override is
|
|
329
|
+
* set. Defaults to `standard` when omitted — callers should always check
|
|
330
|
+
* `riskTier` after the basic permission decision.
|
|
331
331
|
*/
|
|
332
332
|
riskTier?: RiskTier;
|
|
333
333
|
/**
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export { B as BrainArbiter, a as BrainDecision, b as BrainDecisionOption, c as BrainDecisionQueue, d as BrainDecisionRequest, e as BrainDecisionSource, f as BrainFallback, g as BrainRisk, D as DefaultBrainArbiter, h as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, l as formatHumanPrompt } from '../events-
|
|
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, s as Director, 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, H as FleetManager, 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-
|
|
3
|
-
import { b as AgentDefinition } from '../multi-agent-coordinator-
|
|
4
|
-
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-
|
|
5
|
-
export { c as
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
import '../context-DtPKqKYV.js';
|
|
1
|
+
export { B as BrainArbiter, a as BrainDecision, b as BrainDecisionOption, c as BrainDecisionQueue, d as BrainDecisionRequest, e as BrainDecisionSource, f as BrainFallback, g as BrainRisk, D as DefaultBrainArbiter, h as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, l as formatHumanPrompt } from '../events-CIplI98R.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, s as Director, 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, H as FleetManager, 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-VApKRxcp.js';
|
|
3
|
+
import { b as AgentDefinition } from '../multi-agent-coordinator-CWnH-CiX.js';
|
|
4
|
+
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-CWnH-CiX.js';
|
|
5
|
+
export { c as AgentFactory, d as AgentFactoryResult, e as AgentRunnerOptions, g as BudgetExceededError, h as BudgetKind, i as BudgetLimits, j as BudgetNegotiationMode, k as BudgetThresholdDecision, l as BudgetThresholdHandler, m as BudgetThresholdSignal, n as BudgetUsage, F as FleetBus, p as FleetEvent, q as FleetHandler, r as FleetUsage, s as FleetUsageAggregator, K as SubagentBudget, V as SubagentUsageSnapshot, _ as makeAgentSubagentRunner } from '../agent-subagent-runner-DRZ9-NnR.js';
|
|
6
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-D-j6OOBT.js';
|
|
7
|
+
import '../context-y87Jc5ei.js';
|
|
9
8
|
import 'node:events';
|
|
10
9
|
import '../director-state-BmYi3DGA.js';
|
|
11
|
-
import '../config
|
|
10
|
+
import '../config--86aHSln.js';
|
|
12
11
|
import '../models-registry-BcYJDKLm.js';
|
|
13
|
-
import '../index-
|
|
12
|
+
import '../index-DKUvyTvV.js';
|
|
14
13
|
import '../logger-DDd5C--Z.js';
|
|
15
|
-
import '../system-prompt-
|
|
14
|
+
import '../system-prompt-b61lOd49.js';
|
|
16
15
|
import '../observability-BhnVLBLS.js';
|
|
17
16
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
18
|
-
import '../permission-
|
|
17
|
+
import '../permission-C1A5whY5.js';
|
|
18
|
+
import '../retry-policy-CG3qvH_e.js';
|
|
19
19
|
|
|
20
20
|
/** Phase 1 · Discovery — map the territory before any work begins. */
|
|
21
21
|
declare const DISCOVERY_AGENTS: AgentDefinition[];
|
|
@@ -1174,6 +1174,10 @@ Emit each evaluation immediately. Do not wait until you have read all reports.`;
|
|
|
1174
1174
|
return lines.join("\n");
|
|
1175
1175
|
}
|
|
1176
1176
|
cleanup() {
|
|
1177
|
+
if (this._timeoutTimer) {
|
|
1178
|
+
clearTimeout(this._timeoutTimer);
|
|
1179
|
+
this._timeoutTimer = void 0;
|
|
1180
|
+
}
|
|
1177
1181
|
for (const dispose of this.disposers) dispose();
|
|
1178
1182
|
this.disposers.length = 0;
|
|
1179
1183
|
}
|
|
@@ -4679,15 +4683,22 @@ var SubagentBudget = class _SubagentBudget {
|
|
|
4679
4683
|
void this.checkLimits();
|
|
4680
4684
|
}
|
|
4681
4685
|
/**
|
|
4682
|
-
* Wall-clock budget check.
|
|
4683
|
-
*
|
|
4684
|
-
*
|
|
4686
|
+
* Wall-clock / idle budget check. Delegates to `checkLimits(elapsed)`, so
|
|
4687
|
+
* `timeout` and `idle_timeout` follow the SAME negotiation path as the other
|
|
4688
|
+
* kinds — they are NOT a special-cased hard stop. This is deliberate: a
|
|
4689
|
+
* heartbeat-aware policy (see `attachAutoExtend` and `CollabSession`) grants
|
|
4690
|
+
* a timeout extension only while the agent is making progress and denies it
|
|
4691
|
+
* once the agent is genuinely stuck, which is safer than an unconditional
|
|
4692
|
+
* hard kill of a long-but-working agent. The runner translates the resulting
|
|
4693
|
+
* `BudgetThresholdSignal` decision (`extend` → patch limits in place,
|
|
4694
|
+
* `stop` → abort) just like every other kind.
|
|
4685
4695
|
*
|
|
4686
|
-
* Decision table:
|
|
4687
|
-
* - no `onThreshold` handler
|
|
4688
|
-
* - `mode === 'sync'` → throw `BudgetExceededError`
|
|
4689
|
-
* - `mode === 'auto'` + no listener
|
|
4690
|
-
* - `mode === 'auto'` + listener
|
|
4696
|
+
* Decision table (same as `checkLimits`):
|
|
4697
|
+
* - no `onThreshold` handler → throw `BudgetExceededError` (hard stop)
|
|
4698
|
+
* - `mode === 'sync'` → throw `BudgetExceededError` (hard stop)
|
|
4699
|
+
* - `mode === 'auto'` + no listener → throw `BudgetExceededError` (no one to ask)
|
|
4700
|
+
* - `mode === 'auto'` + listener → throw `BudgetThresholdSignal` (negotiated;
|
|
4701
|
+
* a heartbeat-aware policy may extend the timeout)
|
|
4691
4702
|
*/
|
|
4692
4703
|
checkTimeout() {
|
|
4693
4704
|
if (this.startTime === null) return;
|
|
@@ -5086,7 +5097,10 @@ var NICKNAME_POOL = {
|
|
|
5086
5097
|
"lavoisier": { name: "Lavoisier", domain: "chemistry" },
|
|
5087
5098
|
"mendeleev": { name: "Mendeleev", domain: "chemistry" }
|
|
5088
5099
|
};
|
|
5089
|
-
var ALL_NICKNAMES = Object.
|
|
5100
|
+
var ALL_NICKNAMES = Object.entries(NICKNAME_POOL);
|
|
5101
|
+
var NAME_TO_KEY = Object.fromEntries(
|
|
5102
|
+
ALL_NICKNAMES.map(([key, entry]) => [entry.name, key])
|
|
5103
|
+
);
|
|
5090
5104
|
var DOMAIN_PREFERENCES = {
|
|
5091
5105
|
"security": ["shannon", "turing", "lamarr", "stallman"],
|
|
5092
5106
|
"bug-hunter": ["darwin", "curie", "feynman", "fermi"],
|
|
@@ -5119,17 +5133,23 @@ function assignNickname(role, used) {
|
|
|
5119
5133
|
for (const key of preferences) {
|
|
5120
5134
|
const entry = NICKNAME_POOL[key];
|
|
5121
5135
|
if (entry && !used.has(key)) {
|
|
5122
|
-
return `${entry.name} (${formatRole(role)})
|
|
5136
|
+
return { key, display: `${entry.name} (${formatRole(role)})` };
|
|
5123
5137
|
}
|
|
5124
5138
|
}
|
|
5125
|
-
for (const entry of ALL_NICKNAMES) {
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
return `${entry.name} (${formatRole(role)})`;
|
|
5139
|
+
for (const [key, entry] of ALL_NICKNAMES) {
|
|
5140
|
+
if (!used.has(key)) {
|
|
5141
|
+
return { key, display: `${entry.name} (${formatRole(role)})` };
|
|
5129
5142
|
}
|
|
5130
5143
|
}
|
|
5131
5144
|
const counter = used.size + 1;
|
|
5132
|
-
return `Scientist #${counter} (${formatRole(role)})
|
|
5145
|
+
return { key: `scientist-${counter}`, display: `Scientist #${counter} (${formatRole(role)})` };
|
|
5146
|
+
}
|
|
5147
|
+
function nicknameKeyFromDisplay(display) {
|
|
5148
|
+
const base = display.replace(/\s*\([^)]*\)\s*$/, "").trim();
|
|
5149
|
+
const key = NAME_TO_KEY[base];
|
|
5150
|
+
if (key) return key;
|
|
5151
|
+
const synthesized = base.match(/^Scientist #(\d+)$/);
|
|
5152
|
+
return synthesized ? `scientist-${synthesized[1]}` : void 0;
|
|
5133
5153
|
}
|
|
5134
5154
|
function formatRole(role) {
|
|
5135
5155
|
return role.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
@@ -5216,11 +5236,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5216
5236
|
const name = subagent.name?.trim() ?? "";
|
|
5217
5237
|
const isPlaceholder = name === "" || name.toLowerCase() === role.toLowerCase() || name === "subagent" || name === "adhoc" || name === "generic" || /^slot-/.test(name);
|
|
5218
5238
|
if (!isPlaceholder) return subagent;
|
|
5219
|
-
const
|
|
5220
|
-
|
|
5221
|
-
this.
|
|
5222
|
-
|
|
5223
|
-
return { ...subagent, name: nickname };
|
|
5239
|
+
const { key, display } = assignNickname(role, this.usedNicknames);
|
|
5240
|
+
this.usedNicknames.add(key);
|
|
5241
|
+
this.subagentNicknames.set(subagentId, key);
|
|
5242
|
+
return { ...subagent, name: display };
|
|
5224
5243
|
}
|
|
5225
5244
|
async spawn(subagent) {
|
|
5226
5245
|
const id = subagent.id || randomUUID();
|
|
@@ -5472,23 +5491,32 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5472
5491
|
*/
|
|
5473
5492
|
drainPendingAsAborted(message) {
|
|
5474
5493
|
const dropped = this.pendingTasks.splice(0, this.pendingTasks.length);
|
|
5475
|
-
for (const t of dropped)
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5494
|
+
for (const t of dropped) this.emitPendingAborted(t, message);
|
|
5495
|
+
}
|
|
5496
|
+
/**
|
|
5497
|
+
* Emit a synthetic `stopped`/`aborted_by_parent` completion for a single
|
|
5498
|
+
* PENDING task — one that was never counted in `inFlight`. This MUST bypass
|
|
5499
|
+
* `recordCompletion`: that path does `inFlight--`, which for a pending task
|
|
5500
|
+
* steals a decrement from a genuinely in-flight task and trips the underflow
|
|
5501
|
+
* guard — suppressing that real task's `task.completed` and hanging its
|
|
5502
|
+
* `awaitTasks()` caller. Pushes the result and fires the event directly.
|
|
5503
|
+
*/
|
|
5504
|
+
emitPendingAborted(task, message) {
|
|
5505
|
+
const synthetic = {
|
|
5506
|
+
subagentId: task.subagentId ?? "unassigned",
|
|
5507
|
+
taskId: task.id,
|
|
5508
|
+
status: "stopped",
|
|
5509
|
+
error: {
|
|
5510
|
+
kind: "aborted_by_parent",
|
|
5511
|
+
message,
|
|
5512
|
+
retryable: false
|
|
5513
|
+
},
|
|
5514
|
+
iterations: 0,
|
|
5515
|
+
toolCalls: 0,
|
|
5516
|
+
durationMs: 0
|
|
5517
|
+
};
|
|
5518
|
+
this.completedResults.push(synthetic);
|
|
5519
|
+
this.emit("task.completed", { task, result: synthetic });
|
|
5492
5520
|
}
|
|
5493
5521
|
async runDispatched(subagentId, task) {
|
|
5494
5522
|
const subagent = this.subagents.get(subagentId);
|
|
@@ -5749,20 +5777,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5749
5777
|
const orphaned = this.pendingTasks.filter((t) => t.subagentId === subagentId);
|
|
5750
5778
|
this.pendingTasks = this.pendingTasks.filter((t) => t.subagentId !== subagentId);
|
|
5751
5779
|
for (const t of orphaned) {
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
error: {
|
|
5757
|
-
kind: "aborted_by_parent",
|
|
5758
|
-
message: `Subagent "${subagentId}" was removed while task "${t.id}" was pending`,
|
|
5759
|
-
retryable: false
|
|
5760
|
-
},
|
|
5761
|
-
iterations: 0,
|
|
5762
|
-
toolCalls: 0,
|
|
5763
|
-
durationMs: 0
|
|
5764
|
-
};
|
|
5765
|
-
this.recordCompletion(synthetic);
|
|
5780
|
+
this.emitPendingAborted(
|
|
5781
|
+
t,
|
|
5782
|
+
`Subagent "${subagentId}" was removed while task "${t.id}" was pending`
|
|
5783
|
+
);
|
|
5766
5784
|
}
|
|
5767
5785
|
this.fleetBus?.emit({
|
|
5768
5786
|
subagentId,
|
|
@@ -6188,18 +6206,20 @@ var Director = class _Director {
|
|
|
6188
6206
|
if (e.subagentId.startsWith("bug-hunter-") || e.subagentId.startsWith("refactor-planner-") || e.subagentId.startsWith("critic-")) {
|
|
6189
6207
|
return;
|
|
6190
6208
|
}
|
|
6191
|
-
if (payload.kind === "timeout") {
|
|
6209
|
+
if (payload.kind === "timeout" || payload.kind === "idle_timeout") {
|
|
6210
|
+
const heartbeatKey = `${e.subagentId}:${payload.kind}`;
|
|
6192
6211
|
const progress = progressBySubagent.get(e.subagentId) ?? 0;
|
|
6193
|
-
const lastProgress = lastTimeoutProgress.get(
|
|
6212
|
+
const lastProgress = lastTimeoutProgress.get(heartbeatKey) ?? -1;
|
|
6194
6213
|
if (progress <= lastProgress) {
|
|
6195
6214
|
payload.deny();
|
|
6196
6215
|
return;
|
|
6197
6216
|
}
|
|
6198
|
-
lastTimeoutProgress.set(
|
|
6217
|
+
lastTimeoutProgress.set(heartbeatKey, progress);
|
|
6218
|
+
const field = payload.kind === "timeout" ? "timeoutMs" : "idleTimeoutMs";
|
|
6199
6219
|
setImmediate(() => {
|
|
6200
6220
|
const newLimit = Math.min(Math.ceil(payload.limit * 2), 24 * 60 * 6e4);
|
|
6201
|
-
this.recordExtension(e.subagentId, e.taskId,
|
|
6202
|
-
payload.extend({
|
|
6221
|
+
this.recordExtension(e.subagentId, e.taskId, payload.kind, newLimit);
|
|
6222
|
+
payload.extend({ [field]: newLimit });
|
|
6203
6223
|
});
|
|
6204
6224
|
return;
|
|
6205
6225
|
}
|
|
@@ -6515,10 +6535,9 @@ var Director = class _Director {
|
|
|
6515
6535
|
if (this.fleetManager) {
|
|
6516
6536
|
this.fleetManager.assignNicknameAndRecord(config);
|
|
6517
6537
|
} else {
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
);
|
|
6538
|
+
const { key, display } = assignNickname(role, this._usedNicknames);
|
|
6539
|
+
config.name = display;
|
|
6540
|
+
this._usedNicknames.add(key);
|
|
6522
6541
|
}
|
|
6523
6542
|
}
|
|
6524
6543
|
result = await this.coordinator.spawn(config);
|
|
@@ -6840,8 +6859,8 @@ var Director = class _Director {
|
|
|
6840
6859
|
} else {
|
|
6841
6860
|
const entry = this.manifestEntries.get(subagentId);
|
|
6842
6861
|
if (entry?.name) {
|
|
6843
|
-
const nicknameKey = entry.name
|
|
6844
|
-
this._usedNicknames.delete(nicknameKey);
|
|
6862
|
+
const nicknameKey = nicknameKeyFromDisplay(entry.name);
|
|
6863
|
+
if (nicknameKey) this._usedNicknames.delete(nicknameKey);
|
|
6845
6864
|
}
|
|
6846
6865
|
}
|
|
6847
6866
|
this.manifestEntries.delete(subagentId);
|
|
@@ -8453,11 +8472,10 @@ var FleetManager = class {
|
|
|
8453
8472
|
*/
|
|
8454
8473
|
assignNicknameAndRecord(config) {
|
|
8455
8474
|
const role = config.role ?? "subagent";
|
|
8456
|
-
const
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
return nickname;
|
|
8475
|
+
const { key, display } = assignNickname(role, this._usedNicknames);
|
|
8476
|
+
this._usedNicknames.add(key);
|
|
8477
|
+
config.name = display;
|
|
8478
|
+
return display;
|
|
8461
8479
|
}
|
|
8462
8480
|
/**
|
|
8463
8481
|
* Returns the set of already-assigned nickname keys — useful for debugging
|
|
@@ -8642,8 +8660,8 @@ var FleetManager = class {
|
|
|
8642
8660
|
removeSubagent(subagentId) {
|
|
8643
8661
|
const entry = this.manifestEntries.get(subagentId);
|
|
8644
8662
|
if (entry?.name) {
|
|
8645
|
-
const nicknameKey = entry.name
|
|
8646
|
-
this._usedNicknames.delete(nicknameKey);
|
|
8663
|
+
const nicknameKey = nicknameKeyFromDisplay(entry.name);
|
|
8664
|
+
if (nicknameKey) this._usedNicknames.delete(nicknameKey);
|
|
8647
8665
|
}
|
|
8648
8666
|
for (const [taskId, task] of this.pendingTasks) {
|
|
8649
8667
|
if (task.subagentId === subagentId) {
|