@wrongstack/core 0.10.2 → 0.24.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.
- package/dist/{agent-bridge-DBBGP5O4.d.ts → agent-bridge-D_XcS2HL.d.ts} +3 -1
- package/dist/{agent-subagent-runner-KwufTWwn.d.ts → agent-subagent-runner-DpZTLdBe.d.ts} +13 -3
- package/dist/{config-CJXBka2r.d.ts → config-BUEGM4JP.d.ts} +2 -0
- package/dist/coordination/index.d.ts +9 -9
- package/dist/coordination/index.js +83 -21
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +13 -13
- package/dist/defaults/index.js +89 -23
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-Bw1K5E6K.d.ts → events-BrQiweXN.d.ts} +1 -1
- package/dist/execution/index.d.ts +7 -7
- package/dist/execution/index.js +32 -10
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +3 -3
- package/dist/{index-DIt5TIaF.d.ts → index-pXJdVLe0.d.ts} +3 -3
- package/dist/{index-DgQWnZxP.d.ts → index-ysfO_DlX.d.ts} +2 -2
- package/dist/index.d.ts +20 -20
- package/dist/index.js +226 -101
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +4 -4
- package/dist/kernel/index.d.ts +4 -4
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-BgINZzuo.d.ts → mcp-servers-BzB3r7_c.d.ts} +1 -1
- package/dist/{multi-agent-C1O8EFzb.d.ts → multi-agent-C8Z1i__e.d.ts} +2 -2
- package/dist/{multi-agent-coordinator-DoVSBFNx.d.ts → multi-agent-coordinator-Dcsc5t4-.d.ts} +8 -3
- package/dist/{null-fleet-bus-T-s3JaOt.d.ts → null-fleet-bus-Cq4YKOiW.d.ts} +28 -23
- package/dist/observability/index.d.ts +1 -1
- package/dist/{path-resolver-BfyK-I7w.d.ts → path-resolver-DumKAi0n.d.ts} +1 -1
- package/dist/{plan-templates-BWs6Je7j.d.ts → plan-templates-BZMi-VpU.d.ts} +3 -3
- package/dist/{provider-runner-BmPe2RuU.d.ts → provider-runner-Dlv8Fvw9.d.ts} +1 -1
- package/dist/sdd/index.d.ts +5 -5
- package/dist/sdd/index.js +30 -8
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.js +3 -3
- package/dist/security/index.js.map +1 -1
- package/dist/{session-reader-CCSBfQmd.d.ts → session-reader-bfgsy2a0.d.ts} +7 -3
- package/dist/storage/index.d.ts +30 -11
- package/dist/storage/index.js +131 -65
- package/dist/storage/index.js.map +1 -1
- package/dist/{tool-executor-D7RxLtg4.d.ts → tool-executor-BAi4WI2d.d.ts} +1 -1
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +25 -5
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as BridgeTransport, B as BridgeMessage, A as AgentBridge, a as AgentBridgeConfig } from './multi-agent-
|
|
1
|
+
import { b as BridgeTransport, B as BridgeMessage, A as AgentBridge, a as AgentBridgeConfig } from './multi-agent-C8Z1i__e.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -21,6 +21,8 @@ declare class InMemoryAgentBridge implements AgentBridge {
|
|
|
21
21
|
private timeoutMs;
|
|
22
22
|
/** Guards request() so concurrent calls on the same id can't silently overwrite. */
|
|
23
23
|
private readonly inflightGuards;
|
|
24
|
+
/** Stores the transport unsubscribe function so it can be called on stop(). */
|
|
25
|
+
private _transportUnsubscribe?;
|
|
24
26
|
constructor(config: AgentBridgeConfig, transport: BridgeTransport);
|
|
25
27
|
send(msg: BridgeMessage): Promise<void>;
|
|
26
28
|
broadcast(msg: BridgeMessage): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as Agent, f as AgentInput } from './index-
|
|
2
|
-
import { E as EventBus } from './events-
|
|
3
|
-
import { n as SubagentConfig, v as TaskSpec, t as SubagentRunner } from './multi-agent-
|
|
1
|
+
import { c as Agent, f as AgentInput } from './index-ysfO_DlX.js';
|
|
2
|
+
import { E as EventBus } from './events-BrQiweXN.js';
|
|
3
|
+
import { n as SubagentConfig, v as TaskSpec, t as SubagentRunner } from './multi-agent-C8Z1i__e.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Single fleet-wide event with subagent attribution. Whatever a child
|
|
@@ -95,6 +95,7 @@ declare class FleetUsageAggregator {
|
|
|
95
95
|
private readonly metaLookup?;
|
|
96
96
|
private readonly perSubagent;
|
|
97
97
|
private readonly total;
|
|
98
|
+
private readonly unsub;
|
|
98
99
|
constructor(bus: FleetBus, priceLookup?: ((subagentId: string, provider?: string, model?: string) => {
|
|
99
100
|
input?: number;
|
|
100
101
|
output?: number;
|
|
@@ -104,6 +105,15 @@ declare class FleetUsageAggregator {
|
|
|
104
105
|
provider?: string;
|
|
105
106
|
model?: string;
|
|
106
107
|
} | undefined) | undefined);
|
|
108
|
+
/**
|
|
109
|
+
* Remove a terminated subagent's data from the aggregator and subtract its
|
|
110
|
+
* contribution from the running totals. Call this when a subagent is removed
|
|
111
|
+
* from the fleet so the aggregator doesn't accumulate unbounded data for
|
|
112
|
+
* entities that will never emit events again.
|
|
113
|
+
*/
|
|
114
|
+
removeSubagent(subagentId: string): void;
|
|
115
|
+
/** Disposes all fleet-bus subscriptions. Call when the aggregator is no longer needed. */
|
|
116
|
+
dispose(): void;
|
|
107
117
|
/** Live snapshot — safe to call from a tool's execute() body. */
|
|
108
118
|
snapshot(): FleetUsage;
|
|
109
119
|
private ensure;
|
|
@@ -219,6 +219,8 @@ interface Config {
|
|
|
219
219
|
log: LogConfig;
|
|
220
220
|
features: FeaturesConfig;
|
|
221
221
|
yolo?: boolean;
|
|
222
|
+
/** When true, show lightweight LLM-predicted next steps after each turn (/next). */
|
|
223
|
+
nextPrediction?: boolean;
|
|
222
224
|
cwd?: string;
|
|
223
225
|
/** Autonomy mode configuration (auto-proceed delay, etc.). */
|
|
224
226
|
autonomy?: AutonomyConfig;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
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 NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, O as RefactorPhase, P as RefactorPlan, S as SECURITY_SCANNER_AGENT, Q as SharedFileEntry, T as SharedFileSnapshot, U as SubagentPromptParts, V as applyRosterBudget, W as attachAutoExtend, X as composeDirectorPrompt, Y as composeSubagentPrompt, Z as createDelegateTool, _ as getAgentDefinition, $ as makeAskTool, a0 as makeAssignTool, a1 as makeAwaitTasksTool, a2 as makeCollabDebugTool, a3 as makeDirectorSessionFactory, a4 as makeFleetEmitTool, a5 as makeFleetHealthTool, a6 as makeFleetSessionTool, a7 as makeFleetStatusTool, a8 as makeFleetUsageTool, a9 as makeRollUpTool, aa as makeSpawnTool, ab as makeTerminateTool, ac as makeWorkCompleteTool, ad as rosterSummaryFromConfigs } from '../null-fleet-bus-
|
|
2
|
-
import { b as AgentDefinition } from '../multi-agent-coordinator-
|
|
3
|
-
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-
|
|
4
|
-
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, f as BudgetNegotiationMode, g as BudgetThresholdDecision, h as BudgetThresholdHandler, i as BudgetThresholdSignal, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-
|
|
5
|
-
export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-
|
|
6
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
1
|
+
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 NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, O as RefactorPhase, P as RefactorPlan, S as SECURITY_SCANNER_AGENT, Q as SharedFileEntry, T as SharedFileSnapshot, U as SubagentPromptParts, V as applyRosterBudget, W as attachAutoExtend, X as composeDirectorPrompt, Y as composeSubagentPrompt, Z as createDelegateTool, _ as getAgentDefinition, $ as makeAskTool, a0 as makeAssignTool, a1 as makeAwaitTasksTool, a2 as makeCollabDebugTool, a3 as makeDirectorSessionFactory, a4 as makeFleetEmitTool, a5 as makeFleetHealthTool, a6 as makeFleetSessionTool, a7 as makeFleetStatusTool, a8 as makeFleetUsageTool, a9 as makeRollUpTool, aa as makeSpawnTool, ab as makeTerminateTool, ac as makeWorkCompleteTool, ad as rosterSummaryFromConfigs } from '../null-fleet-bus-Cq4YKOiW.js';
|
|
2
|
+
import { b as AgentDefinition } from '../multi-agent-coordinator-Dcsc5t4-.js';
|
|
3
|
+
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-Dcsc5t4-.js';
|
|
4
|
+
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, f as BudgetNegotiationMode, g as BudgetThresholdDecision, h as BudgetThresholdHandler, i as BudgetThresholdSignal, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-C8Z1i__e.js';
|
|
5
|
+
export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from '../agent-subagent-runner-DpZTLdBe.js';
|
|
6
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-D_XcS2HL.js';
|
|
7
7
|
import '../context-7u93AcGD.js';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '../director-state-BmYi3DGA.js';
|
|
10
|
-
import '../events-
|
|
11
|
-
import '../index-
|
|
10
|
+
import '../events-BrQiweXN.js';
|
|
11
|
+
import '../index-ysfO_DlX.js';
|
|
12
12
|
import '../logger-DDd5C--Z.js';
|
|
13
13
|
import '../system-prompt-CM6zOhd2.js';
|
|
14
14
|
import '../observability-BhnVLBLS.js';
|
|
15
15
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
16
16
|
import '../permission-B6sldrSp.js';
|
|
17
|
-
import '../config-
|
|
17
|
+
import '../config-BUEGM4JP.js';
|
|
18
18
|
import '../models-registry-BcYJDKLm.js';
|
|
19
19
|
|
|
20
20
|
/** Phase 1 · Discovery — map the territory before any work begins. */
|
|
@@ -286,12 +286,14 @@ var InMemoryAgentBridge = class {
|
|
|
286
286
|
timeoutMs;
|
|
287
287
|
/** Guards request() so concurrent calls on the same id can't silently overwrite. */
|
|
288
288
|
inflightGuards = /* @__PURE__ */ new Set();
|
|
289
|
+
/** Stores the transport unsubscribe function so it can be called on stop(). */
|
|
290
|
+
_transportUnsubscribe;
|
|
289
291
|
constructor(config, transport) {
|
|
290
292
|
this.agentId = config.agentId;
|
|
291
293
|
this.coordinatorId = config.coordinatorId;
|
|
292
294
|
this.transport = transport;
|
|
293
295
|
this.timeoutMs = config.timeoutMs ?? 3e4;
|
|
294
|
-
this.transport.subscribe(this.agentId, (msg) => {
|
|
296
|
+
this._transportUnsubscribe = this.transport.subscribe(this.agentId, (msg) => {
|
|
295
297
|
if (msg.type === "heartbeat") return;
|
|
296
298
|
const pending = this.pendingRequests.get(msg.id);
|
|
297
299
|
if (pending) {
|
|
@@ -366,6 +368,8 @@ var InMemoryAgentBridge = class {
|
|
|
366
368
|
this.pendingRequests.clear();
|
|
367
369
|
this.inflightGuards.clear();
|
|
368
370
|
this.subscriptions.clear();
|
|
371
|
+
this._transportUnsubscribe?.();
|
|
372
|
+
this._transportUnsubscribe = void 0;
|
|
369
373
|
await this.transport.close(this.agentId);
|
|
370
374
|
}
|
|
371
375
|
};
|
|
@@ -561,14 +565,36 @@ var FleetUsageAggregator = class {
|
|
|
561
565
|
constructor(bus, priceLookup, metaLookup) {
|
|
562
566
|
this.priceLookup = priceLookup;
|
|
563
567
|
this.metaLookup = metaLookup;
|
|
564
|
-
bus.filter("provider.response", (e) => this.onProviderResponse(e));
|
|
565
|
-
bus.filter("tool.executed", (e) => this.onToolExecuted(e));
|
|
566
|
-
bus.filter("iteration.started", (e) => this.onIterationStarted(e));
|
|
568
|
+
this.unsub.push(bus.filter("provider.response", (e) => this.onProviderResponse(e)));
|
|
569
|
+
this.unsub.push(bus.filter("tool.executed", (e) => this.onToolExecuted(e)));
|
|
570
|
+
this.unsub.push(bus.filter("iteration.started", (e) => this.onIterationStarted(e)));
|
|
567
571
|
}
|
|
568
572
|
priceLookup;
|
|
569
573
|
metaLookup;
|
|
570
574
|
perSubagent = /* @__PURE__ */ new Map();
|
|
571
575
|
total = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0 };
|
|
576
|
+
unsub = new Array();
|
|
577
|
+
/**
|
|
578
|
+
* Remove a terminated subagent's data from the aggregator and subtract its
|
|
579
|
+
* contribution from the running totals. Call this when a subagent is removed
|
|
580
|
+
* from the fleet so the aggregator doesn't accumulate unbounded data for
|
|
581
|
+
* entities that will never emit events again.
|
|
582
|
+
*/
|
|
583
|
+
removeSubagent(subagentId) {
|
|
584
|
+
const snap = this.perSubagent.get(subagentId);
|
|
585
|
+
if (!snap) return;
|
|
586
|
+
this.perSubagent.delete(subagentId);
|
|
587
|
+
this.total.input -= snap.input;
|
|
588
|
+
this.total.output -= snap.output;
|
|
589
|
+
this.total.cacheRead -= snap.cacheRead;
|
|
590
|
+
this.total.cacheWrite -= snap.cacheWrite;
|
|
591
|
+
this.total.cost -= snap.cost;
|
|
592
|
+
}
|
|
593
|
+
/** Disposes all fleet-bus subscriptions. Call when the aggregator is no longer needed. */
|
|
594
|
+
dispose() {
|
|
595
|
+
for (const off of this.unsub) off();
|
|
596
|
+
this.unsub.length = 0;
|
|
597
|
+
}
|
|
572
598
|
/** Live snapshot — safe to call from a tool's execute() body. */
|
|
573
599
|
snapshot() {
|
|
574
600
|
return {
|
|
@@ -998,8 +1024,9 @@ var SubagentBudget = class _SubagentBudget {
|
|
|
998
1024
|
if (elapsedMs !== void 0) {
|
|
999
1025
|
const idle = this.idleMs();
|
|
1000
1026
|
if (this.limits.idleTimeoutMs !== void 0 && idle > this.limits.idleTimeoutMs) {
|
|
1001
|
-
exceeded.push({ kind: "
|
|
1002
|
-
}
|
|
1027
|
+
exceeded.push({ kind: "idle_timeout", used: idle, limit: this.limits.idleTimeoutMs });
|
|
1028
|
+
}
|
|
1029
|
+
if (this.limits.timeoutMs !== void 0 && elapsedMs > this.limits.timeoutMs) {
|
|
1003
1030
|
exceeded.push({ kind: "timeout", used: elapsedMs, limit: this.limits.timeoutMs });
|
|
1004
1031
|
}
|
|
1005
1032
|
}
|
|
@@ -3819,10 +3846,6 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
|
|
|
3819
3846
|
this.drainPendingAsAborted("Coordinator stopAll() drained the pending queue");
|
|
3820
3847
|
await Promise.allSettled([...this.subagents.keys()].map((id) => this.stop(id)));
|
|
3821
3848
|
}
|
|
3822
|
-
async remove(subagentId) {
|
|
3823
|
-
await this.stop(subagentId);
|
|
3824
|
-
this.subagents.delete(subagentId);
|
|
3825
|
-
}
|
|
3826
3849
|
/**
|
|
3827
3850
|
* Get current coordinator stats for monitoring/debugging.
|
|
3828
3851
|
*/
|
|
@@ -4088,7 +4111,7 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
|
|
|
4088
4111
|
durationMs: Date.now() - startTime
|
|
4089
4112
|
};
|
|
4090
4113
|
} catch (err) {
|
|
4091
|
-
const status = err instanceof BudgetExceededError && err.kind === "timeout" ? "timeout" : subagent.abortController.signal.aborted ? "stopped" : "failed";
|
|
4114
|
+
const status = err instanceof BudgetExceededError && (err.kind === "timeout" || err.kind === "idle_timeout") ? "timeout" : subagent.abortController.signal.aborted ? "stopped" : "failed";
|
|
4092
4115
|
const usage = budget.usage();
|
|
4093
4116
|
result = {
|
|
4094
4117
|
subagentId,
|
|
@@ -4242,6 +4265,30 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
|
|
|
4242
4265
|
});
|
|
4243
4266
|
}
|
|
4244
4267
|
}
|
|
4268
|
+
/**
|
|
4269
|
+
* Stop a subagent and remove it from the coordinator. Releases all
|
|
4270
|
+
* associated resources (AbortController, context, budget state).
|
|
4271
|
+
* The subagent entry is deleted so the id can be reused in a future spawn.
|
|
4272
|
+
*/
|
|
4273
|
+
async remove(subagentId) {
|
|
4274
|
+
const subagent = this.subagents.get(subagentId);
|
|
4275
|
+
if (!subagent) return;
|
|
4276
|
+
if (subagent.status === "running" || subagent.status === "idle") {
|
|
4277
|
+
this.terminating.add(subagentId);
|
|
4278
|
+
subagent.abortController.abort();
|
|
4279
|
+
subagent.status = "stopped";
|
|
4280
|
+
}
|
|
4281
|
+
this.subagents.delete(subagentId);
|
|
4282
|
+
this.terminating.delete(subagentId);
|
|
4283
|
+
this.pendingTasks = this.pendingTasks.filter((t) => t.subagentId !== subagentId);
|
|
4284
|
+
this.fleetBus?.emit({
|
|
4285
|
+
subagentId,
|
|
4286
|
+
ts: Date.now(),
|
|
4287
|
+
type: "subagent.removed",
|
|
4288
|
+
payload: { subagentId }
|
|
4289
|
+
});
|
|
4290
|
+
this.emitCoordinatorStats();
|
|
4291
|
+
}
|
|
4245
4292
|
isDone() {
|
|
4246
4293
|
if (this.config.doneCondition.type === "all_tasks_done") {
|
|
4247
4294
|
return this.pendingTasks.length === 0 && this.inFlight === 0;
|
|
@@ -4265,7 +4312,8 @@ function classifySubagentError(err, hints = {}) {
|
|
|
4265
4312
|
tool_calls: "budget_tool_calls",
|
|
4266
4313
|
tokens: "budget_tokens",
|
|
4267
4314
|
cost: "budget_cost",
|
|
4268
|
-
timeout: "budget_timeout"
|
|
4315
|
+
timeout: "budget_timeout",
|
|
4316
|
+
idle_timeout: "budget_timeout"
|
|
4269
4317
|
};
|
|
4270
4318
|
return {
|
|
4271
4319
|
kind: map[err.kind],
|
|
@@ -5165,7 +5213,7 @@ Emit each evaluation immediately. Do not wait until you have read all reports.`;
|
|
|
5165
5213
|
this.cancel(`Director cancelled: ${role} ${payload.kind} threshold`);
|
|
5166
5214
|
return;
|
|
5167
5215
|
}
|
|
5168
|
-
if (payload.kind === "timeout") {
|
|
5216
|
+
if (payload.kind === "timeout" || payload.kind === "idle_timeout") {
|
|
5169
5217
|
const progress = this.progressBySubagent.get(e.subagentId) ?? 0;
|
|
5170
5218
|
const lastProgress = this.lastTimeoutProgress.get(e.subagentId) ?? -1;
|
|
5171
5219
|
if (progress <= lastProgress) {
|
|
@@ -5903,7 +5951,7 @@ var Director = class {
|
|
|
5903
5951
|
if (needsNickname) {
|
|
5904
5952
|
const role = config.role ?? "subagent";
|
|
5905
5953
|
if (this.fleetManager) {
|
|
5906
|
-
this.fleetManager.assignNicknameAndRecord(
|
|
5954
|
+
this.fleetManager.assignNicknameAndRecord(config);
|
|
5907
5955
|
} else {
|
|
5908
5956
|
config.name = assignNickname(role, this._usedNicknames);
|
|
5909
5957
|
this._usedNicknames.add(config.name.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-"));
|
|
@@ -5911,9 +5959,7 @@ var Director = class {
|
|
|
5911
5959
|
}
|
|
5912
5960
|
result = await this.coordinator.spawn(config);
|
|
5913
5961
|
if (this.fleetManager) {
|
|
5914
|
-
|
|
5915
|
-
this.fleetManager.recordSpawn(result.subagentId, config, priceLookup);
|
|
5916
|
-
}
|
|
5962
|
+
this.fleetManager.recordSpawn(result.subagentId, config, priceLookup);
|
|
5917
5963
|
} else {
|
|
5918
5964
|
this.spawnCount += 1;
|
|
5919
5965
|
this.subagentMeta.set(result.subagentId, {
|
|
@@ -6201,6 +6247,7 @@ var Director = class {
|
|
|
6201
6247
|
}
|
|
6202
6248
|
async remove(subagentId) {
|
|
6203
6249
|
await this.coordinator.remove(subagentId);
|
|
6250
|
+
this.usage.removeSubagent(subagentId);
|
|
6204
6251
|
}
|
|
6205
6252
|
status() {
|
|
6206
6253
|
const base = this.coordinator.getStatus();
|
|
@@ -6536,6 +6583,7 @@ function createDelegateTool(opts) {
|
|
|
6536
6583
|
if (timer) clearTimeout(timer);
|
|
6537
6584
|
offTool();
|
|
6538
6585
|
offIter();
|
|
6586
|
+
offProgress();
|
|
6539
6587
|
resolve(value);
|
|
6540
6588
|
};
|
|
6541
6589
|
const arm = () => {
|
|
@@ -6547,6 +6595,7 @@ function createDelegateTool(opts) {
|
|
|
6547
6595
|
};
|
|
6548
6596
|
const offTool = dir.fleet.filter("tool.executed", bump);
|
|
6549
6597
|
const offIter = dir.fleet.filter("iteration.started", bump);
|
|
6598
|
+
const offProgress = dir.fleet.filter("tool.progress", bump);
|
|
6550
6599
|
arm();
|
|
6551
6600
|
dir.awaitTasks([taskId]).then((r) => finish(r[0] ?? { __timeout: true })).catch(() => finish({ __timeout: true }));
|
|
6552
6601
|
});
|
|
@@ -7578,7 +7627,8 @@ var FIELD_BY_KIND = {
|
|
|
7578
7627
|
tool_calls: "maxToolCalls",
|
|
7579
7628
|
tokens: "maxTokens",
|
|
7580
7629
|
cost: "maxCostUsd",
|
|
7581
|
-
timeout: "timeoutMs"
|
|
7630
|
+
timeout: "timeoutMs",
|
|
7631
|
+
idle_timeout: "timeoutMs"
|
|
7582
7632
|
};
|
|
7583
7633
|
function attachAutoExtend(events, policy = {}) {
|
|
7584
7634
|
const factor = policy.factor ?? 0.5;
|
|
@@ -7596,7 +7646,7 @@ function attachAutoExtend(events, policy = {}) {
|
|
|
7596
7646
|
}),
|
|
7597
7647
|
events.on("budget.threshold_reached", (e) => {
|
|
7598
7648
|
const { kind, limit, extend, deny } = e;
|
|
7599
|
-
if (kind === "timeout") {
|
|
7649
|
+
if (kind === "timeout" || kind === "idle_timeout") {
|
|
7600
7650
|
if (progress > lastTimeoutProgress) {
|
|
7601
7651
|
lastTimeoutProgress = progress;
|
|
7602
7652
|
const next2 = Math.min(Math.ceil(limit * (1 + factor)), ceiling.timeoutMs);
|
|
@@ -7763,14 +7813,18 @@ var FleetManager = class {
|
|
|
7763
7813
|
* Call this INSTEAD of `recordSpawn` when you want automatic nicknames.
|
|
7764
7814
|
* The nickname is written back to `config.name` BEFORE the coordinator
|
|
7765
7815
|
* sees the config, so the manifest, logs, and fleet UI all show it.
|
|
7816
|
+
*
|
|
7817
|
+
* NOTE: This method ONLY assigns the nickname and marks it used.
|
|
7818
|
+
* The caller MUST call `recordSpawn(subagentId, config, priceLookup)` AFTER
|
|
7819
|
+
* `coordinator.spawn()` returns with the real subagentId. This is because
|
|
7820
|
+
* the subagentId is not known until after the coordinator creates the subagent.
|
|
7766
7821
|
*/
|
|
7767
|
-
assignNicknameAndRecord(
|
|
7822
|
+
assignNicknameAndRecord(config) {
|
|
7768
7823
|
const role = config.role ?? "subagent";
|
|
7769
7824
|
const nickname = assignNickname(role, this._usedNicknames);
|
|
7770
7825
|
const baseKey = nickname.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
7771
7826
|
this._usedNicknames.add(baseKey);
|
|
7772
7827
|
config.name = nickname;
|
|
7773
|
-
this.recordSpawn(subagentId, config, priceLookup);
|
|
7774
7828
|
return nickname;
|
|
7775
7829
|
}
|
|
7776
7830
|
/**
|
|
@@ -7948,6 +8002,14 @@ var FleetManager = class {
|
|
|
7948
8002
|
}));
|
|
7949
8003
|
return { pending, live: [] };
|
|
7950
8004
|
}
|
|
8005
|
+
/** Release all resources: clear the manifest debounce timer and dispose the usage aggregator. */
|
|
8006
|
+
dispose() {
|
|
8007
|
+
if (this.manifestTimer) {
|
|
8008
|
+
clearTimeout(this.manifestTimer);
|
|
8009
|
+
this.manifestTimer = null;
|
|
8010
|
+
}
|
|
8011
|
+
this.usage.dispose();
|
|
8012
|
+
}
|
|
7951
8013
|
};
|
|
7952
8014
|
|
|
7953
8015
|
export { ACP_AGENTS, AGENTS_BY_PHASE, AGENT_CATALOG, TOOLS as AGENT_TOOL_PRESETS, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, BUG_HUNTER_AGENT, BUILD_AGENTS, BudgetExceededError, BudgetThresholdSignal, CollabSession, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_SUBAGENT_BASELINE, DELIVERY_AGENTS, DISCOVERY_AGENTS, DOMAIN_AGENTS, DefaultMultiAgentCoordinator, Director, DirectorAlertLevel, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, FleetBus, FleetCostCapError, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, HEAVY_BUDGET, InMemoryAgentBridge, InMemoryBridgeTransport, KNOWLEDGE_AGENTS, LIGHT_BUDGET, MEDIUM_BUDGET, META_AGENTS, NULL_FLEET_BUS, PLANNING_AGENTS, REFACTOR_PLANNER_AGENT, REVIEW_AGENTS, SECURITY_SCANNER_AGENT, SubagentBudget, VERIFY_AGENTS, applyRosterBudget, attachAutoExtend, composeDirectorPrompt, composeSubagentPrompt, createDelegateTool, createMessage, dispatchAgent, getAgentDefinition, makeAgentSubagentRunner, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeRollUpTool, makeSpawnTool, makeTerminateTool, makeWorkCompleteTool, rosterSummaryFromConfigs, scoreAgents };
|