@wrongstack/core 0.41.0 → 0.51.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-bridge-D_XcS2HL.d.ts → agent-bridge-CjbD-i7-.d.ts} +1 -1
- package/dist/{agent-subagent-runner-C66vi4Gq.d.ts → agent-subagent-runner-DfvlBx5N.d.ts} +3 -3
- package/dist/coordination/index.d.ts +8 -8
- package/dist/coordination/index.js +234 -32
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +11 -11
- package/dist/defaults/index.js +151 -59
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-BrQiweXN.d.ts → events-Bt44ikPN.d.ts} +135 -1
- package/dist/execution/index.d.ts +34 -8
- package/dist/execution/index.js +61 -28
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +2 -2
- package/dist/{index-DkVgH3wC.d.ts → index-OzA1XjHL.d.ts} +4 -2
- package/dist/{index-6_csX32J.d.ts → index-mAWBdLyJ.d.ts} +1 -1
- package/dist/index.d.ts +96 -20
- package/dist/index.js +532 -132
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +2 -2
- package/dist/kernel/index.d.ts +3 -3
- package/dist/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/models/index.js +5 -2
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-C8Z1i__e.d.ts → multi-agent-Ba9Ni2hC.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-BUsjiRWl.d.ts → multi-agent-coordinator-BuKq0q89.d.ts} +2 -2
- package/dist/{null-fleet-bus-FvgHnZah.d.ts → null-fleet-bus-C0xd73YP.d.ts} +21 -9
- package/dist/observability/index.d.ts +1 -1
- package/dist/{path-resolver-DumKAi0n.d.ts → path-resolver-nkmdiFgi.d.ts} +1 -1
- package/dist/{plan-templates-DYCeRCDN.d.ts → plan-templates-BmDdJ7UL.d.ts} +1 -1
- package/dist/{provider-runner-Dlv8Fvw9.d.ts → provider-runner-BGro2qQB.d.ts} +1 -1
- package/dist/sdd/index.d.ts +4 -4
- package/dist/storage/index.d.ts +2 -2
- package/dist/{tool-executor-BpK-SWtJ.d.ts → tool-executor-p4tP9tGF.d.ts} +1 -1
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.js +5 -2
- 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-Ba9Ni2hC.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -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-mAWBdLyJ.js';
|
|
2
|
+
import { E as EventBus } from './events-Bt44ikPN.js';
|
|
3
|
+
import { n as SubagentConfig, v as TaskSpec, t as SubagentRunner } from './multi-agent-Ba9Ni2hC.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Single fleet-wide event with subagent attribution. Whatever a child
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { c as
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
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-Bt44ikPN.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-C0xd73YP.js';
|
|
3
|
+
import { b as AgentDefinition } from '../multi-agent-coordinator-BuKq0q89.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-BuKq0q89.js';
|
|
5
|
+
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-Ba9Ni2hC.js';
|
|
6
|
+
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-DfvlBx5N.js';
|
|
7
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-CjbD-i7-.js';
|
|
7
8
|
import '../context-7u93AcGD.js';
|
|
8
9
|
import 'node:events';
|
|
9
10
|
import '../director-state-BmYi3DGA.js';
|
|
10
11
|
import '../config-ZRCf7sTu.js';
|
|
11
12
|
import '../models-registry-BcYJDKLm.js';
|
|
12
|
-
import '../
|
|
13
|
-
import '../index-6_csX32J.js';
|
|
13
|
+
import '../index-mAWBdLyJ.js';
|
|
14
14
|
import '../logger-DDd5C--Z.js';
|
|
15
15
|
import '../system-prompt-CM6zOhd2.js';
|
|
16
16
|
import '../observability-BhnVLBLS.js';
|
|
@@ -10,6 +10,147 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
|
+
|
|
14
|
+
// src/coordination/brain.ts
|
|
15
|
+
var ObservableBrainArbiter = class {
|
|
16
|
+
constructor(inner, events) {
|
|
17
|
+
this.inner = inner;
|
|
18
|
+
this.events = events;
|
|
19
|
+
}
|
|
20
|
+
inner;
|
|
21
|
+
events;
|
|
22
|
+
async decide(request) {
|
|
23
|
+
this.events.emit("brain.decision_requested", { request, at: Date.now() });
|
|
24
|
+
const decision = await this.inner.decide(request);
|
|
25
|
+
const event = decision.type === "ask_human" ? "brain.decision_ask_human" : decision.type === "deny" ? "brain.decision_denied" : "brain.decision_answered";
|
|
26
|
+
this.events.emit(event, { request, decision, at: Date.now() });
|
|
27
|
+
return decision;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var BrainDecisionQueue = class {
|
|
31
|
+
constructor(events, opts = {}) {
|
|
32
|
+
this.events = events;
|
|
33
|
+
this.opts = opts;
|
|
34
|
+
this.offAnswer = this.events.on("brain.human_answered", (answer) => {
|
|
35
|
+
const pending = this.pending.get(answer.id);
|
|
36
|
+
if (!pending) return;
|
|
37
|
+
this.pending.delete(answer.id);
|
|
38
|
+
if (pending.timer) clearTimeout(pending.timer);
|
|
39
|
+
if (answer.deny) {
|
|
40
|
+
pending.resolve({ type: "deny", reason: answer.text ?? "Denied by human." });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const option = pending.request.options?.find((o) => o.id === answer.optionId);
|
|
44
|
+
pending.resolve({
|
|
45
|
+
type: "answer",
|
|
46
|
+
optionId: answer.optionId,
|
|
47
|
+
text: answer.text ?? option?.label ?? answer.optionId ?? "Human answered.",
|
|
48
|
+
rationale: "Human answered a Brain escalation prompt."
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
events;
|
|
53
|
+
opts;
|
|
54
|
+
pending = /* @__PURE__ */ new Map();
|
|
55
|
+
offAnswer;
|
|
56
|
+
async requestHumanDecision(request) {
|
|
57
|
+
const ask = {
|
|
58
|
+
type: "ask_human",
|
|
59
|
+
prompt: formatHumanPrompt(request),
|
|
60
|
+
options: request.options,
|
|
61
|
+
rationale: "Decision escalated to human authority."
|
|
62
|
+
};
|
|
63
|
+
const pending = new Promise((resolve2) => {
|
|
64
|
+
const entry = { request, resolve: resolve2 };
|
|
65
|
+
if (this.opts.timeoutMs && this.opts.timeoutMs > 0) {
|
|
66
|
+
entry.timer = setTimeout(() => {
|
|
67
|
+
this.pending.delete(request.id);
|
|
68
|
+
resolve2({ type: "deny", reason: "Brain human decision timed out." });
|
|
69
|
+
}, this.opts.timeoutMs);
|
|
70
|
+
}
|
|
71
|
+
this.pending.set(request.id, entry);
|
|
72
|
+
});
|
|
73
|
+
this.events.emit("brain.decision_ask_human", { request, decision: ask, at: Date.now() });
|
|
74
|
+
return pending;
|
|
75
|
+
}
|
|
76
|
+
dispose() {
|
|
77
|
+
this.offAnswer();
|
|
78
|
+
for (const [id, pending] of this.pending) {
|
|
79
|
+
if (pending.timer) clearTimeout(pending.timer);
|
|
80
|
+
pending.resolve({ type: "deny", reason: "Brain decision queue disposed." });
|
|
81
|
+
this.pending.delete(id);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var HumanEscalatingBrainArbiter = class {
|
|
86
|
+
constructor(inner, queue) {
|
|
87
|
+
this.inner = inner;
|
|
88
|
+
this.queue = queue;
|
|
89
|
+
}
|
|
90
|
+
inner;
|
|
91
|
+
queue;
|
|
92
|
+
async decide(request) {
|
|
93
|
+
const decision = await this.inner.decide(request);
|
|
94
|
+
if (decision.type !== "ask_human") return decision;
|
|
95
|
+
return this.queue.requestHumanDecision(request);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var DefaultBrainArbiter = class {
|
|
99
|
+
allowLowRiskAutoAnswer;
|
|
100
|
+
constructor(opts = {}) {
|
|
101
|
+
this.allowLowRiskAutoAnswer = opts.allowLowRiskAutoAnswer ?? true;
|
|
102
|
+
}
|
|
103
|
+
async decide(request) {
|
|
104
|
+
const recommended = request.options?.find((option) => option.recommended);
|
|
105
|
+
if (this.allowLowRiskAutoAnswer && request.risk === "low" && recommended) {
|
|
106
|
+
return {
|
|
107
|
+
type: "answer",
|
|
108
|
+
optionId: recommended.id,
|
|
109
|
+
text: recommended.label,
|
|
110
|
+
rationale: "Low-risk request with an explicit recommended option."
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
switch (request.fallback) {
|
|
114
|
+
case "deny":
|
|
115
|
+
return {
|
|
116
|
+
type: "deny",
|
|
117
|
+
reason: `Brain could not safely decide: ${request.question}`
|
|
118
|
+
};
|
|
119
|
+
case "continue":
|
|
120
|
+
return {
|
|
121
|
+
type: "answer",
|
|
122
|
+
text: "Continue with the caller default.",
|
|
123
|
+
rationale: "No safe Brain decision was available; request fallback is continue."
|
|
124
|
+
};
|
|
125
|
+
case "ask_human":
|
|
126
|
+
return {
|
|
127
|
+
type: "ask_human",
|
|
128
|
+
prompt: formatHumanPrompt(request),
|
|
129
|
+
options: request.options,
|
|
130
|
+
rationale: "Decision requires human authority or lacks a safe automatic option."
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
function formatHumanPrompt(request) {
|
|
136
|
+
const lines = [
|
|
137
|
+
`Brain requires human decision for ${request.source}:`,
|
|
138
|
+
`Question: ${request.question}`
|
|
139
|
+
];
|
|
140
|
+
if (request.context?.trim()) {
|
|
141
|
+
lines.push("", "Context:", request.context.trim());
|
|
142
|
+
}
|
|
143
|
+
if (request.options?.length) {
|
|
144
|
+
lines.push("", "Options:");
|
|
145
|
+
for (const option of request.options) {
|
|
146
|
+
const risk = option.risk ? ` [risk: ${option.risk}]` : "";
|
|
147
|
+
const consequence = option.consequence ? ` \u2014 ${option.consequence}` : "";
|
|
148
|
+
lines.push(`- ${option.id}: ${option.label}${risk}${consequence}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
lines.push("", `Risk: ${request.risk}`);
|
|
152
|
+
return lines.join("\n");
|
|
153
|
+
}
|
|
13
154
|
async function atomicWrite(targetPath, content, opts = {}) {
|
|
14
155
|
const dir = path4.dirname(targetPath);
|
|
15
156
|
await fsp6.mkdir(dir, { recursive: true });
|
|
@@ -5814,6 +5955,12 @@ var Director = class _Director {
|
|
|
5814
5955
|
getLeaderContextPressure() {
|
|
5815
5956
|
return this.leaderContextPressure;
|
|
5816
5957
|
}
|
|
5958
|
+
resolveMaxContext() {
|
|
5959
|
+
const resolved = typeof this.maxContext === "function" ? this.maxContext() : this.maxContext;
|
|
5960
|
+
return resolved && resolved > 0 ? resolved : 128e3;
|
|
5961
|
+
}
|
|
5962
|
+
/** Optional Brain arbiter for director-level policy decisions. */
|
|
5963
|
+
brain;
|
|
5817
5964
|
/**
|
|
5818
5965
|
* Optional fleet-level policy container. When provided the Director
|
|
5819
5966
|
* delegates spawn budgeting, manifest entries, and checkpointing to it
|
|
@@ -5905,7 +6052,7 @@ var Director = class _Director {
|
|
|
5905
6052
|
leaderContextPressure = 0;
|
|
5906
6053
|
/** Maximum context load fraction before spawn is refused. */
|
|
5907
6054
|
maxLeaderContextLoad;
|
|
5908
|
-
/** Provider's max context window in tokens. */
|
|
6055
|
+
/** Provider's max context window in tokens, or a live resolver for runtime model switches. */
|
|
5909
6056
|
maxContext;
|
|
5910
6057
|
/** Per-task model matrix (static record or live getter); resolved
|
|
5911
6058
|
* per-spawn when no explicit model is set. */
|
|
@@ -5925,6 +6072,7 @@ var Director = class _Director {
|
|
|
5925
6072
|
largeAnswerStore;
|
|
5926
6073
|
constructor(opts) {
|
|
5927
6074
|
this.id = opts.config.coordinatorId || randomUUID();
|
|
6075
|
+
this.brain = opts.brain;
|
|
5928
6076
|
this.manifestPath = opts.manifestPath;
|
|
5929
6077
|
this.roster = opts.roster;
|
|
5930
6078
|
this.directorPreamble = opts.directorPreamble ?? DEFAULT_DIRECTOR_PREAMBLE;
|
|
@@ -6069,33 +6217,81 @@ var Director = class _Director {
|
|
|
6069
6217
|
return;
|
|
6070
6218
|
}
|
|
6071
6219
|
}
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6220
|
+
const grantExtension = () => {
|
|
6221
|
+
setImmediate(() => {
|
|
6222
|
+
const extra = {};
|
|
6223
|
+
const base = Math.max(payload.limit, payload.used);
|
|
6224
|
+
const grow = (ceiling) => Math.min(Math.ceil(base * 1.5), ceiling);
|
|
6225
|
+
let newLimit = base;
|
|
6226
|
+
switch (payload.kind) {
|
|
6227
|
+
case "iterations":
|
|
6228
|
+
newLimit = grow(5e4);
|
|
6229
|
+
extra.maxIterations = newLimit;
|
|
6230
|
+
break;
|
|
6231
|
+
case "tool_calls":
|
|
6232
|
+
newLimit = grow(1e5);
|
|
6233
|
+
extra.maxToolCalls = newLimit;
|
|
6234
|
+
break;
|
|
6235
|
+
case "tokens":
|
|
6236
|
+
newLimit = grow(5e6);
|
|
6237
|
+
extra.maxTokens = newLimit;
|
|
6238
|
+
break;
|
|
6239
|
+
case "cost":
|
|
6240
|
+
newLimit = Math.min(base * 1.5, 100);
|
|
6241
|
+
extra.maxCostUsd = newLimit;
|
|
6242
|
+
break;
|
|
6243
|
+
}
|
|
6244
|
+
extendCounts.set(guardKey, prior + 1);
|
|
6245
|
+
this.recordExtension(e.subagentId, e.taskId, payload.kind, newLimit);
|
|
6246
|
+
payload.extend(extra);
|
|
6247
|
+
});
|
|
6248
|
+
};
|
|
6249
|
+
if (this.brain) {
|
|
6250
|
+
void this.brain.decide({
|
|
6251
|
+
id: `director-budget-${e.subagentId}-${payload.kind}`,
|
|
6252
|
+
source: "director",
|
|
6253
|
+
question: `Should the director extend the ${payload.kind} budget for subagent ${e.subagentId}?`,
|
|
6254
|
+
context: [
|
|
6255
|
+
e.taskId ? `Task id: ${e.taskId}` : void 0,
|
|
6256
|
+
`Used: ${payload.used}`,
|
|
6257
|
+
`Limit: ${payload.limit}`,
|
|
6258
|
+
`Prior extensions for this kind: ${prior}`
|
|
6259
|
+
].filter(Boolean).join("\n"),
|
|
6260
|
+
risk: payload.kind === "cost" ? "high" : "medium",
|
|
6261
|
+
fallback: "continue",
|
|
6262
|
+
options: [
|
|
6263
|
+
{
|
|
6264
|
+
id: "extend",
|
|
6265
|
+
label: "Grant the director default budget extension",
|
|
6266
|
+
consequence: "The subagent continues with a larger per-kind budget.",
|
|
6267
|
+
risk: payload.kind === "cost" ? "high" : "medium",
|
|
6268
|
+
recommended: true
|
|
6269
|
+
},
|
|
6270
|
+
{
|
|
6271
|
+
id: "stop",
|
|
6272
|
+
label: "Stop this subagent at the current budget limit",
|
|
6273
|
+
consequence: "The current task will fail or stop due to budget pressure.",
|
|
6274
|
+
risk: "low"
|
|
6275
|
+
}
|
|
6276
|
+
]
|
|
6277
|
+
}).then((decision) => {
|
|
6278
|
+
if (decision.type === "deny") {
|
|
6279
|
+
payload.deny();
|
|
6280
|
+
return;
|
|
6281
|
+
}
|
|
6282
|
+
if (decision.type === "ask_human") {
|
|
6283
|
+
payload.deny();
|
|
6284
|
+
return;
|
|
6285
|
+
}
|
|
6286
|
+
if (decision.optionId === "stop" || /\bstop\b/i.test(decision.text)) {
|
|
6287
|
+
payload.deny();
|
|
6288
|
+
return;
|
|
6289
|
+
}
|
|
6290
|
+
grantExtension();
|
|
6291
|
+
}).catch(() => payload.deny());
|
|
6292
|
+
return;
|
|
6293
|
+
}
|
|
6294
|
+
grantExtension();
|
|
6099
6295
|
});
|
|
6100
6296
|
this.largeAnswerStore = new LargeAnswerStore(2e3);
|
|
6101
6297
|
}
|
|
@@ -6305,7 +6501,8 @@ var Director = class _Director {
|
|
|
6305
6501
|
}
|
|
6306
6502
|
}
|
|
6307
6503
|
if (this.maxLeaderContextLoad < 1) {
|
|
6308
|
-
const
|
|
6504
|
+
const maxContext = this.resolveMaxContext();
|
|
6505
|
+
const threshold = maxContext * this.maxLeaderContextLoad;
|
|
6309
6506
|
if (this.leaderContextPressure >= threshold) {
|
|
6310
6507
|
throw new FleetContextOverflowError(threshold, this.leaderContextPressure);
|
|
6311
6508
|
}
|
|
@@ -8142,7 +8339,7 @@ var FleetManager = class {
|
|
|
8142
8339
|
leaderContextPressure = 0;
|
|
8143
8340
|
/** Maximum context load fraction before spawn is refused. */
|
|
8144
8341
|
maxLeaderContextLoad;
|
|
8145
|
-
/** Provider's max context window in tokens. */
|
|
8342
|
+
/** Provider's max context window in tokens, or a live resolver for runtime model switches. */
|
|
8146
8343
|
maxContext;
|
|
8147
8344
|
constructor(opts = {}) {
|
|
8148
8345
|
this.manifestPath = opts.manifestPath;
|
|
@@ -8222,7 +8419,8 @@ var FleetManager = class {
|
|
|
8222
8419
|
}
|
|
8223
8420
|
}
|
|
8224
8421
|
if (this.maxLeaderContextLoad < 1) {
|
|
8225
|
-
const
|
|
8422
|
+
const maxContext = this.resolveMaxContext();
|
|
8423
|
+
const threshold = maxContext * this.maxLeaderContextLoad;
|
|
8226
8424
|
if (this.leaderContextPressure >= threshold) {
|
|
8227
8425
|
return {
|
|
8228
8426
|
kind: "max_context_load",
|
|
@@ -8236,6 +8434,10 @@ var FleetManager = class {
|
|
|
8236
8434
|
setLeaderContextPressure(tokens) {
|
|
8237
8435
|
this.leaderContextPressure = tokens;
|
|
8238
8436
|
}
|
|
8437
|
+
resolveMaxContext() {
|
|
8438
|
+
const resolved = typeof this.maxContext === "function" ? this.maxContext() : this.maxContext;
|
|
8439
|
+
return resolved && resolved > 0 ? resolved : 128e3;
|
|
8440
|
+
}
|
|
8239
8441
|
/**
|
|
8240
8442
|
* Assign a memorable nickname (e.g. "Einstein (Bug Hunter)") to the config,
|
|
8241
8443
|
* record it so the same name is never reused, then record the spawn.
|
|
@@ -8459,6 +8661,6 @@ var FleetManager = class {
|
|
|
8459
8661
|
}
|
|
8460
8662
|
};
|
|
8461
8663
|
|
|
8462
|
-
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, LargeAnswerStore, 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, makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeRollUpTool, makeSpawnTool, makeTerminateTool, makeWorkCompleteTool, rosterSummaryFromConfigs, scoreAgents };
|
|
8664
|
+
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, BrainDecisionQueue, BudgetExceededError, BudgetThresholdSignal, CollabSession, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_SUBAGENT_BASELINE, DELIVERY_AGENTS, DISCOVERY_AGENTS, DOMAIN_AGENTS, DefaultBrainArbiter, DefaultMultiAgentCoordinator, Director, DirectorAlertLevel, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, FleetBus, FleetCostCapError, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, HEAVY_BUDGET, HumanEscalatingBrainArbiter, InMemoryAgentBridge, InMemoryBridgeTransport, KNOWLEDGE_AGENTS, LIGHT_BUDGET, LargeAnswerStore, MEDIUM_BUDGET, META_AGENTS, NULL_FLEET_BUS, ObservableBrainArbiter, PLANNING_AGENTS, REFACTOR_PLANNER_AGENT, REVIEW_AGENTS, SECURITY_SCANNER_AGENT, SubagentBudget, VERIFY_AGENTS, applyRosterBudget, attachAutoExtend, composeDirectorPrompt, composeSubagentPrompt, createDelegateTool, createMessage, dispatchAgent, formatHumanPrompt, getAgentDefinition, makeAgentSubagentRunner, makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeRollUpTool, makeSpawnTool, makeTerminateTool, makeWorkCompleteTool, rosterSummaryFromConfigs, scoreAgents };
|
|
8463
8665
|
//# sourceMappingURL=index.js.map
|
|
8464
8666
|
//# sourceMappingURL=index.js.map
|