@wrongstack/core 0.5.6 → 0.5.7
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-B07AYFBk.d.ts → agent-bridge-BKNiE1VH.d.ts} +1 -1
- package/dist/{compactor-BWhJXxsW.d.ts → compactor-RIPuTtWK.d.ts} +1 -1
- package/dist/{config-BgM0BIpz.d.ts → config-BGGuP_Ar.d.ts} +1 -1
- package/dist/{context-CLZXPPYk.d.ts → context-CDRyrkKQ.d.ts} +7 -0
- package/dist/coordination/index.d.ts +9 -9
- package/dist/coordination/index.js +301 -58
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +18 -18
- package/dist/defaults/index.js +124 -61
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-qnDZbrtb.d.ts → events-DPQKFX7W.d.ts} +1 -1
- package/dist/execution/index.d.ts +18 -11
- package/dist/execution/index.js +19 -3
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{index-BDnUCRvL.d.ts → index-Bf9Bpkdc.d.ts} +351 -15
- package/dist/{index-DPLJw_ZI.d.ts → index-j2WyAyML.d.ts} +20 -5
- package/dist/index.d.ts +107 -27
- package/dist/index.js +417 -84
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/kernel/index.d.ts +9 -9
- package/dist/{mcp-servers-CSMfaBuL.d.ts → mcp-servers-DBdh3cee.d.ts} +3 -3
- package/dist/models/index.d.ts +2 -2
- package/dist/{multi-agent-Cv8wk47i.d.ts → multi-agent-Cpp7FXUl.d.ts} +11 -3
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-DiCUvEg6.d.ts → path-resolver--g_hKJ7V.d.ts} +2 -2
- package/dist/{plan-templates-DaxTCPfk.d.ts → plan-templates-Bveo2W8n.d.ts} +4 -4
- package/dist/{provider-runner-3SHqk9zB.d.ts → provider-runner-hl4Il3xS.d.ts} +3 -3
- package/dist/{retry-policy-LLUxJmYY.d.ts → retry-policy-LKS8MHsB.d.ts} +1 -1
- package/dist/sdd/index.d.ts +3 -3
- package/dist/{secret-scrubber-Z_VXuXQT.d.ts → secret-scrubber-BzQR5BiL.d.ts} +1 -1
- package/dist/{secret-scrubber-BhJTNr9v.d.ts → secret-scrubber-CfMdAJ_l.d.ts} +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/{selector-DB2-byKH.d.ts → selector-C7HqnZJU.d.ts} +1 -1
- package/dist/{session-reader-4jxsYLZ8.d.ts → session-reader-CzfRA6Vk.d.ts} +1 -1
- package/dist/storage/index.d.ts +5 -5
- package/dist/{system-prompt-DI4Dtc1I.d.ts → system-prompt-Dl2QY1_B.d.ts} +1 -1
- package/dist/{tool-executor-DSvmOBe6.d.ts → tool-executor-DbAFkHdP.d.ts} +4 -4
- package/dist/types/index.d.ts +15 -15
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/defaults/index.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-BH6AE0W9.js';
|
|
2
|
-
export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from '../plan-templates-
|
|
3
|
-
export { D as DefaultSessionReader } from '../session-reader-
|
|
2
|
+
export { A as AbandonedSession, a as AttachmentStoreOptions, C as ConfigLoaderOptions, b as ConfigMigration, c as ConfigMigrationError, d as ConfigSource, D as DEFAULT_CONFIG_MIGRATIONS, e as DefaultAttachmentStore, f as DefaultConfigLoader, g as DefaultConfigStore, h as DefaultMemoryStore, i as DefaultSessionStore, M as MemoryStoreOptions, j as MigrationContext, k as MigrationResult, P as PersistedQueueItem, l as PlanFile, m as PlanItem, n as PlanTemplate, Q as QueueStore, R as RecoveryLock, o as RecoveryLockOptions, S as SessionAnalyzer, p as SessionStoreOptions, T as TodosCheckpointFile, q as addPlanItem, r as attachPlanCheckpoint, s as attachTodosCheckpoint, t as clearPlan, u as deriveTodosFromPlanItem, v as emptyPlan, w as formatPlan, x as formatPlanTemplates, y as getPlanTemplate, z as listPlanTemplates, B as loadPlan, E as loadTodosCheckpoint, F as removePlanItem, G as runConfigMigrations, H as savePlan, I as saveTodosCheckpoint, J as setPlanItemStatus } from '../plan-templates-Bveo2W8n.js';
|
|
3
|
+
export { D as DefaultSessionReader } from '../session-reader-CzfRA6Vk.js';
|
|
4
4
|
export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BmYi3DGA.js';
|
|
5
|
-
export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-
|
|
5
|
+
export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-BzQR5BiL.js';
|
|
6
6
|
export { AutoApprovePermissionPolicy, DefaultPermissionPolicy, PermissionPolicyOptions } from '../security/index.js';
|
|
7
|
-
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-
|
|
7
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-DbAFkHdP.js';
|
|
8
8
|
export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, IntelligentCompactor, IntelligentCompactorOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions } from '../execution/index.js';
|
|
9
|
-
import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-
|
|
10
|
-
import { j as Response } from '../context-
|
|
11
|
-
export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as
|
|
12
|
-
export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, r as SubagentBudget } from '../multi-agent-
|
|
13
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
9
|
+
import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-hl4Il3xS.js';
|
|
10
|
+
import { j as Response } from '../context-CDRyrkKQ.js';
|
|
11
|
+
export { A as ALL_FLEET_AGENTS, a as AUDIT_LOG_AGENT, b as AgentFactory, c as AgentFactoryResult, d as AgentRunnerOptions, B as BUG_HUNTER_AGENT, C as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, e as DEFAULT_SUBAGENT_BASELINE, f as DefaultMultiAgentCoordinator, g as DelegateHost, h as Director, i as DirectorPromptParts, j as DirectorSessionFactory, k as DirectorSessionFactoryOptions, F as FLEET_ROSTER, l as FLEET_ROSTER_BUDGETS, m as FleetBus, n as FleetEvent, o as FleetHandler, r as FleetSpawnBudgetError, s as FleetUsage, t as FleetUsageAggregator, I as ICoordinator, u as IFleetManager, M as MultiAgentCoordinatorOptions, N as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, v as SubagentPromptParts, w as SubagentUsageSnapshot, x as applyRosterBudget, y as composeDirectorPrompt, z as composeSubagentPrompt, E as createDelegateTool, G as makeAgentSubagentRunner, H as makeDirectorSessionFactory, J as rosterSummaryFromConfigs } from '../index-Bf9Bpkdc.js';
|
|
12
|
+
export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, r as SubagentBudget } from '../multi-agent-Cpp7FXUl.js';
|
|
13
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-BKNiE1VH.js';
|
|
14
14
|
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-DqzwpBQy.js';
|
|
15
15
|
export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from '../models/index.js';
|
|
16
16
|
export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, SPEC_TEMPLATES, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from '../sdd/index.js';
|
|
17
17
|
export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from '../observability/index.js';
|
|
18
|
-
export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, p as slackServer, z as zaiVisionServer } from '../mcp-servers-
|
|
18
|
+
export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, s as sentinelServer, p as slackServer, z as zaiVisionServer } from '../mcp-servers-DBdh3cee.js';
|
|
19
19
|
import '../logger-BMQgxvdy.js';
|
|
20
|
-
import '../events-
|
|
20
|
+
import '../events-DPQKFX7W.js';
|
|
21
21
|
import '../memory-CEXuo7sz.js';
|
|
22
22
|
import '../wstack-paths-86YPFktR.js';
|
|
23
|
-
import '../config-
|
|
23
|
+
import '../config-BGGuP_Ar.js';
|
|
24
24
|
import '../models-registry-Y2xbog0E.js';
|
|
25
25
|
import '../secret-vault-DoISxaKO.js';
|
|
26
|
-
import '../secret-scrubber-
|
|
26
|
+
import '../secret-scrubber-CfMdAJ_l.js';
|
|
27
27
|
import '../input-reader-E-ffP2ee.js';
|
|
28
|
-
import '../compactor-
|
|
29
|
-
import '../retry-policy-
|
|
30
|
-
import '../index-
|
|
31
|
-
import '../system-prompt-
|
|
28
|
+
import '../compactor-RIPuTtWK.js';
|
|
29
|
+
import '../retry-policy-LKS8MHsB.js';
|
|
30
|
+
import '../index-j2WyAyML.js';
|
|
31
|
+
import '../system-prompt-Dl2QY1_B.js';
|
|
32
32
|
import '../observability-BhnVLBLS.js';
|
|
33
|
-
import '../selector-
|
|
33
|
+
import '../selector-C7HqnZJU.js';
|
|
34
34
|
import '../skill-CxuWrsKK.js';
|
|
35
35
|
import 'node:events';
|
|
36
36
|
import '../mode-CV077NjV.js';
|
package/dist/defaults/index.js
CHANGED
|
@@ -5037,6 +5037,14 @@ var DoneConditionChecker = class {
|
|
|
5037
5037
|
};
|
|
5038
5038
|
}
|
|
5039
5039
|
break;
|
|
5040
|
+
case "directive":
|
|
5041
|
+
if (this.condition.maxIterations && state.iterations >= this.condition.maxIterations) {
|
|
5042
|
+
return { done: true, reason: `max iterations (${this.condition.maxIterations}) reached`, ...state };
|
|
5043
|
+
}
|
|
5044
|
+
if (this.condition.maxToolCalls && state.toolCalls >= this.condition.maxToolCalls) {
|
|
5045
|
+
return { done: true, reason: `max tool calls (${this.condition.maxToolCalls}) reached`, ...state };
|
|
5046
|
+
}
|
|
5047
|
+
break;
|
|
5040
5048
|
}
|
|
5041
5049
|
return { done: false, iterations: state.iterations, toolCalls: state.toolCalls };
|
|
5042
5050
|
}
|
|
@@ -5056,10 +5064,16 @@ var AutonomousRunner = class {
|
|
|
5056
5064
|
const offToolExecuted = this.opts.agent.events?.on?.("tool.executed", () => {
|
|
5057
5065
|
this.toolCalls++;
|
|
5058
5066
|
});
|
|
5067
|
+
const offIterationCompleted = this.opts.agent.events?.on?.("iteration.completed", () => {
|
|
5068
|
+
if (this.opts.enableAutonomousContinue && this.opts.doneCondition.type === "directive") {
|
|
5069
|
+
this.iterations++;
|
|
5070
|
+
}
|
|
5071
|
+
});
|
|
5059
5072
|
try {
|
|
5060
5073
|
return await this.runLoop();
|
|
5061
5074
|
} finally {
|
|
5062
5075
|
offToolExecuted?.();
|
|
5076
|
+
offIterationCompleted?.();
|
|
5063
5077
|
}
|
|
5064
5078
|
}
|
|
5065
5079
|
async runLoop() {
|
|
@@ -5083,12 +5097,14 @@ var AutonomousRunner = class {
|
|
|
5083
5097
|
const ctrl = new AbortController();
|
|
5084
5098
|
const timeout = setTimeout(() => ctrl.abort(), this.opts.iterationTimeoutMs ?? 3e4);
|
|
5085
5099
|
try {
|
|
5100
|
+
const isDirectiveMode = this.opts.doneCondition.type === "directive" && this.opts.enableAutonomousContinue;
|
|
5086
5101
|
const result = await this.opts.agent.run("", {
|
|
5087
5102
|
signal: ctrl.signal,
|
|
5088
|
-
maxIterations: 1,
|
|
5089
|
-
executionStrategy: "sequential"
|
|
5103
|
+
maxIterations: isDirectiveMode ? this.opts.doneCondition.maxIterations ?? 100 : 1,
|
|
5104
|
+
executionStrategy: "sequential",
|
|
5105
|
+
autonomousContinue: isDirectiveMode ? true : void 0
|
|
5090
5106
|
});
|
|
5091
|
-
this.iterations++;
|
|
5107
|
+
if (!isDirectiveMode) this.iterations++;
|
|
5092
5108
|
if (result.status === "done") {
|
|
5093
5109
|
this.lastOutput = result.finalText;
|
|
5094
5110
|
}
|
|
@@ -6431,10 +6447,10 @@ function makeSpawnTool(director, roster) {
|
|
|
6431
6447
|
const subagentId = await director.spawn(cfg);
|
|
6432
6448
|
return { subagentId, provider: cfg.provider, model: cfg.model, name: cfg.name };
|
|
6433
6449
|
} catch (err) {
|
|
6434
|
-
if (err instanceof
|
|
6450
|
+
if (err instanceof FleetSpawnBudgetError) {
|
|
6435
6451
|
return { error: err.message, kind: err.kind, limit: err.limit, observed: err.observed };
|
|
6436
6452
|
}
|
|
6437
|
-
if (err instanceof
|
|
6453
|
+
if (err instanceof FleetCostCapError) {
|
|
6438
6454
|
return { error: err.message, kind: err.kind, limit: err.limit, observed: err.observed };
|
|
6439
6455
|
}
|
|
6440
6456
|
return { error: err instanceof Error ? err.message : String(err) };
|
|
@@ -6635,7 +6651,7 @@ function makeFleetHealthTool(director) {
|
|
|
6635
6651
|
}
|
|
6636
6652
|
|
|
6637
6653
|
// src/coordination/director.ts
|
|
6638
|
-
var
|
|
6654
|
+
var FleetSpawnBudgetError = class extends Error {
|
|
6639
6655
|
kind;
|
|
6640
6656
|
limit;
|
|
6641
6657
|
observed;
|
|
@@ -6643,13 +6659,13 @@ var DirectorBudgetError = class extends Error {
|
|
|
6643
6659
|
super(
|
|
6644
6660
|
kind === "max_spawns" ? `Director spawn budget exceeded: tried to spawn #${observed} but maxSpawns is ${limit}` : `Director spawn depth budget exceeded: this director is at depth ${observed} and maxSpawnDepth is ${limit}`
|
|
6645
6661
|
);
|
|
6646
|
-
this.name = "
|
|
6662
|
+
this.name = "FleetSpawnBudgetError";
|
|
6647
6663
|
this.kind = kind;
|
|
6648
6664
|
this.limit = limit;
|
|
6649
6665
|
this.observed = observed;
|
|
6650
6666
|
}
|
|
6651
6667
|
};
|
|
6652
|
-
var
|
|
6668
|
+
var FleetCostCapError = class extends Error {
|
|
6653
6669
|
kind;
|
|
6654
6670
|
limit;
|
|
6655
6671
|
observed;
|
|
@@ -6657,16 +6673,34 @@ var DirectorCostCapError = class extends Error {
|
|
|
6657
6673
|
super(
|
|
6658
6674
|
`Director cost cap exceeded: total fleet spend ${observed.toFixed(4)} exceeds maxCostUsd ${limit.toFixed(4)}`
|
|
6659
6675
|
);
|
|
6660
|
-
this.name = "
|
|
6676
|
+
this.name = "FleetCostCapError";
|
|
6661
6677
|
this.kind = "max_cost_usd";
|
|
6662
6678
|
this.limit = limit;
|
|
6663
6679
|
this.observed = observed;
|
|
6664
6680
|
}
|
|
6665
6681
|
};
|
|
6666
6682
|
var Director = class {
|
|
6683
|
+
/** Alias for the ICoordinator contract. `id` is retained for backward compatibility. */
|
|
6684
|
+
get coordinatorId() {
|
|
6685
|
+
return this.id;
|
|
6686
|
+
}
|
|
6667
6687
|
id;
|
|
6688
|
+
/**
|
|
6689
|
+
* The fleet event bus. Backed by `fleetManager?.fleet` when a FleetManager
|
|
6690
|
+
* is injected; otherwise own FleetBus instance (preserves existing behavior).
|
|
6691
|
+
*/
|
|
6668
6692
|
fleet;
|
|
6693
|
+
/**
|
|
6694
|
+
* Usage rollup. Backed by `fleetManager?.usage` when a FleetManager is
|
|
6695
|
+
* injected; otherwise own FleetUsageAggregator.
|
|
6696
|
+
*/
|
|
6669
6697
|
usage;
|
|
6698
|
+
/**
|
|
6699
|
+
* Optional fleet-level policy container. When provided the Director
|
|
6700
|
+
* delegates spawn budgeting, manifest entries, and checkpointing to it
|
|
6701
|
+
* instead of managing those internally. All other behavior is unchanged.
|
|
6702
|
+
*/
|
|
6703
|
+
fleetManager;
|
|
6670
6704
|
/**
|
|
6671
6705
|
* Director-side bridge endpoint. Subagents are wired to the same
|
|
6672
6706
|
* in-memory transport so the director can `ask()` them synchronously
|
|
@@ -6717,8 +6751,8 @@ var Director = class {
|
|
|
6717
6751
|
/** Debounce timer for periodic manifest writes. */
|
|
6718
6752
|
manifestTimer = null;
|
|
6719
6753
|
manifestDebounceMs;
|
|
6720
|
-
/** Fleet-wide cost cap. Infinity means no cap. */
|
|
6721
|
-
|
|
6754
|
+
/** Fleet-wide cost cap (entire fleet total, distinct from SubagentBudget limits). Infinity means no cap. */
|
|
6755
|
+
maxFleetCostUsd;
|
|
6722
6756
|
/** Max auto-extensions per subagent per budget kind before denying. */
|
|
6723
6757
|
maxBudgetExtensions;
|
|
6724
6758
|
/** Sessions root for direct subagent JSONL reads (fleet_session tool). */
|
|
@@ -6751,7 +6785,7 @@ var Director = class {
|
|
|
6751
6785
|
this.spawnDepth = opts.spawnDepth ?? 0;
|
|
6752
6786
|
this.sessionWriter = opts.sessionWriter ?? null;
|
|
6753
6787
|
this.manifestDebounceMs = opts.manifestDebounceMs ?? 2e3;
|
|
6754
|
-
this.
|
|
6788
|
+
this.maxFleetCostUsd = opts.directorBudget?.maxCostUsd ?? Number.POSITIVE_INFINITY;
|
|
6755
6789
|
this.maxBudgetExtensions = opts.maxBudgetExtensions ?? 2;
|
|
6756
6790
|
this.sessionsRoot = opts.sessionsRoot;
|
|
6757
6791
|
this.directorRunId = opts.directorRunId ?? this.id;
|
|
@@ -6762,6 +6796,7 @@ var Director = class {
|
|
|
6762
6796
|
maxSpawnDepth: this.maxSpawnDepth,
|
|
6763
6797
|
directorBudget: opts.directorBudget
|
|
6764
6798
|
}, opts.checkpointDebounceMs ?? 250) : null;
|
|
6799
|
+
this.fleetManager = opts.fleetManager;
|
|
6765
6800
|
if (this.sharedScratchpadPath) {
|
|
6766
6801
|
void fsp.mkdir(this.sharedScratchpadPath, { recursive: true }).catch(() => void 0);
|
|
6767
6802
|
}
|
|
@@ -6770,12 +6805,17 @@ var Director = class {
|
|
|
6770
6805
|
{ agentId: this.id, coordinatorId: this.id },
|
|
6771
6806
|
this.transport
|
|
6772
6807
|
);
|
|
6773
|
-
this.
|
|
6774
|
-
|
|
6775
|
-
this.
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6808
|
+
if (this.fleetManager) {
|
|
6809
|
+
this.fleet = this.fleetManager.fleet;
|
|
6810
|
+
this.usage = this.fleetManager.usage;
|
|
6811
|
+
} else {
|
|
6812
|
+
this.fleet = new FleetBus();
|
|
6813
|
+
this.usage = new FleetUsageAggregator(
|
|
6814
|
+
this.fleet,
|
|
6815
|
+
(id) => this.priceLookups.get(id),
|
|
6816
|
+
(id) => this.subagentMeta.get(id)
|
|
6817
|
+
);
|
|
6818
|
+
}
|
|
6779
6819
|
this.coordinator = new DefaultMultiAgentCoordinator(
|
|
6780
6820
|
{ ...opts.config, coordinatorId: this.id },
|
|
6781
6821
|
{ runner: opts.runner }
|
|
@@ -6877,58 +6917,73 @@ var Director = class {
|
|
|
6877
6917
|
* it the `cost` column in `usage.snapshot()` stays at 0.
|
|
6878
6918
|
*/
|
|
6879
6919
|
async spawn(config, priceLookup) {
|
|
6880
|
-
if (this.
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
if (
|
|
6889
|
-
throw new
|
|
6920
|
+
if (this.fleetManager) {
|
|
6921
|
+
const rejection = this.fleetManager.canSpawn(config);
|
|
6922
|
+
if (rejection) {
|
|
6923
|
+
if (rejection.kind === "max_spawn_depth") throw new FleetSpawnBudgetError("max_spawn_depth", rejection.limit, rejection.observed);
|
|
6924
|
+
if (rejection.kind === "max_spawns") throw new FleetSpawnBudgetError("max_spawns", rejection.limit, rejection.observed);
|
|
6925
|
+
if (rejection.kind === "max_cost_usd") throw new FleetCostCapError(rejection.limit, rejection.observed);
|
|
6926
|
+
}
|
|
6927
|
+
} else {
|
|
6928
|
+
if (this.spawnDepth >= this.maxSpawnDepth) {
|
|
6929
|
+
throw new FleetSpawnBudgetError("max_spawn_depth", this.maxSpawnDepth, this.spawnDepth);
|
|
6930
|
+
}
|
|
6931
|
+
if (this.spawnCount >= this.maxSpawns) {
|
|
6932
|
+
throw new FleetSpawnBudgetError("max_spawns", this.maxSpawns, this.spawnCount + 1);
|
|
6933
|
+
}
|
|
6934
|
+
if (this.maxFleetCostUsd < Number.POSITIVE_INFINITY) {
|
|
6935
|
+
const totalCost = this.usage.snapshot().total?.cost ?? 0;
|
|
6936
|
+
if (totalCost >= this.maxFleetCostUsd) {
|
|
6937
|
+
throw new FleetCostCapError(this.maxFleetCostUsd, totalCost);
|
|
6938
|
+
}
|
|
6890
6939
|
}
|
|
6891
6940
|
}
|
|
6892
6941
|
const result = await this.coordinator.spawn(config);
|
|
6893
|
-
this.
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6942
|
+
if (this.fleetManager) {
|
|
6943
|
+
this.fleetManager.recordSpawn(result.subagentId, config, priceLookup);
|
|
6944
|
+
} else {
|
|
6945
|
+
this.spawnCount += 1;
|
|
6946
|
+
this.subagentMeta.set(result.subagentId, {
|
|
6947
|
+
provider: config.provider,
|
|
6948
|
+
model: config.model
|
|
6949
|
+
});
|
|
6950
|
+
if (priceLookup) this.priceLookups.set(result.subagentId, priceLookup);
|
|
6951
|
+
}
|
|
6899
6952
|
const subagentBridge = new InMemoryAgentBridge(
|
|
6900
6953
|
{ agentId: result.subagentId, coordinatorId: this.id },
|
|
6901
6954
|
this.transport
|
|
6902
6955
|
);
|
|
6903
6956
|
this.coordinator.setSubagentBridge(result.subagentId, subagentBridge);
|
|
6904
6957
|
this.subagentBridges.set(result.subagentId, subagentBridge);
|
|
6905
|
-
this.
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
role: config.role,
|
|
6909
|
-
provider: config.provider,
|
|
6910
|
-
model: config.model,
|
|
6911
|
-
taskIds: []
|
|
6912
|
-
});
|
|
6913
|
-
const spawnedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6914
|
-
this.stateCheckpoint?.recordSpawn(
|
|
6915
|
-
{
|
|
6916
|
-
id: result.subagentId,
|
|
6958
|
+
if (!this.fleetManager) {
|
|
6959
|
+
this.manifestEntries.set(result.subagentId, {
|
|
6960
|
+
subagentId: result.subagentId,
|
|
6917
6961
|
name: config.name,
|
|
6918
6962
|
role: config.role,
|
|
6919
6963
|
provider: config.provider,
|
|
6920
6964
|
model: config.model,
|
|
6921
|
-
|
|
6922
|
-
}
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6965
|
+
taskIds: []
|
|
6966
|
+
});
|
|
6967
|
+
const spawnedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6968
|
+
this.stateCheckpoint?.recordSpawn(
|
|
6969
|
+
{
|
|
6970
|
+
id: result.subagentId,
|
|
6971
|
+
name: config.name,
|
|
6972
|
+
role: config.role,
|
|
6973
|
+
provider: config.provider,
|
|
6974
|
+
model: config.model,
|
|
6975
|
+
spawnedAt
|
|
6976
|
+
},
|
|
6977
|
+
this.spawnCount
|
|
6978
|
+
);
|
|
6979
|
+
void this.appendSessionEvent({
|
|
6980
|
+
type: "agent_spawned",
|
|
6981
|
+
ts: spawnedAt,
|
|
6982
|
+
agentId: result.subagentId,
|
|
6983
|
+
role: config.role ?? config.name
|
|
6984
|
+
});
|
|
6985
|
+
this.scheduleManifest();
|
|
6986
|
+
}
|
|
6932
6987
|
return result.subagentId;
|
|
6933
6988
|
}
|
|
6934
6989
|
/**
|
|
@@ -7095,8 +7150,12 @@ var Director = class {
|
|
|
7095
7150
|
async assign(task) {
|
|
7096
7151
|
const taskWithId = task.id ? task : { ...task, id: randomUUID() };
|
|
7097
7152
|
if (task.subagentId) {
|
|
7098
|
-
|
|
7099
|
-
|
|
7153
|
+
if (this.fleetManager) {
|
|
7154
|
+
this.fleetManager.addTaskToSubagent(task.subagentId, taskWithId.id);
|
|
7155
|
+
} else {
|
|
7156
|
+
const entry = this.manifestEntries.get(task.subagentId);
|
|
7157
|
+
if (entry) entry.taskIds.push(taskWithId.id);
|
|
7158
|
+
}
|
|
7100
7159
|
}
|
|
7101
7160
|
await this.coordinator.assign(taskWithId);
|
|
7102
7161
|
this.taskDescriptions.set(taskWithId.id, taskWithId.description);
|
|
@@ -7294,8 +7353,9 @@ var Director = class {
|
|
|
7294
7353
|
* still permission-checked normally.
|
|
7295
7354
|
*/
|
|
7296
7355
|
tools(roster) {
|
|
7356
|
+
const effectiveRoster = roster ?? this.roster;
|
|
7297
7357
|
const t = [
|
|
7298
|
-
makeSpawnTool(this,
|
|
7358
|
+
makeSpawnTool(this, effectiveRoster),
|
|
7299
7359
|
makeAssignTool(this),
|
|
7300
7360
|
makeAwaitTasksTool(this),
|
|
7301
7361
|
makeAskTool(this),
|
|
@@ -7761,6 +7821,9 @@ function makeDirectorSessionFactory(opts) {
|
|
|
7761
7821
|
}
|
|
7762
7822
|
};
|
|
7763
7823
|
}
|
|
7824
|
+
|
|
7825
|
+
// src/coordination/null-fleet-bus.ts
|
|
7826
|
+
var NULL_FLEET_BUS = new FleetBus();
|
|
7764
7827
|
var DEFAULT_URL = "https://models.dev/api.json";
|
|
7765
7828
|
var DEFAULT_TTL_SECONDS = 24 * 3600;
|
|
7766
7829
|
var FAMILY_BY_NPM = {
|
|
@@ -11680,6 +11743,6 @@ var allServers = () => ({
|
|
|
11680
11743
|
"minimax-vision": { ...miniMaxVisionServer(), enabled: false }
|
|
11681
11744
|
});
|
|
11682
11745
|
|
|
11683
|
-
export { AISpecBuilder, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, AutoApprovePermissionPolicy, AutoCompactionMiddleware, AutoExecutor, AutonomousRunner, BUG_HUNTER_AGENT, BudgetExceededError, ConfigMigrationError, DEFAULT_CONFIG_MIGRATIONS, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_SUBAGENT_BASELINE, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultErrorHandler, DefaultHealthRegistry, DefaultLogger, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultMultiAgentCoordinator, DefaultPermissionPolicy, DefaultProviderRunner, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultSessionStore, DefaultSkillLoader, DefaultTaskStore, Director,
|
|
11746
|
+
export { AISpecBuilder, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, AutoApprovePermissionPolicy, AutoCompactionMiddleware, AutoExecutor, AutonomousRunner, BUG_HUNTER_AGENT, BudgetExceededError, ConfigMigrationError, DEFAULT_CONFIG_MIGRATIONS, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_SUBAGENT_BASELINE, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultErrorHandler, DefaultHealthRegistry, DefaultLogger, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultMultiAgentCoordinator, DefaultPermissionPolicy, DefaultProviderRunner, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultSessionStore, DefaultSkillLoader, DefaultTaskStore, Director, DirectorStateCheckpoint, DoneConditionChecker, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FleetBus, FleetSpawnBudgetError, FleetUsageAggregator, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, InMemoryMetricsSink, IntelligentCompactor, LLMSelector, NULL_FLEET_BUS, NoopMetricsSink, NoopTracer, OTelTracer, PROMETHEUS_CONTENT_TYPE, QueueStore, REFACTOR_PLANNER_AGENT, RecoveryLock, SECURITY_SCANNER_AGENT, SPEC_TEMPLATES, SelectiveCompactor, SessionAnalyzer, SpecDrivenDev, SpecParser, SpecStore, SpecVersioning, SubagentBudget, TaskFlow, TaskGenerator, TaskGraphStore, TaskTracker, ToolExecutor, addPlanItem, allServers, analyzeCriticalPath, applyRosterBudget, attachPlanCheckpoint, attachTodosCheckpoint, awsServer, blockServer, braveSearchServer, buildOtlpMetricsRequest, buildOtlpTracesRequest, classifyFamily, clearPlan, composeDirectorPrompt, composeSubagentPrompt, context7Server, contextManagerTool, createAutoExecutor, createContextManagerTool, createDelegateTool, createMessage, decryptConfigSecrets2 as decryptConfigSecrets, deriveTodosFromPlanItem, emptyPlan, encryptConfigSecrets, everArtServer, filesystemServer, formatPlan, formatPlanTemplates, getPlanTemplate, getTemplate, githubServer, googleMapsServer, listPlanTemplates, listTemplates, loadDirectorState, loadPlan, loadProjectModes, loadTodosCheckpoint, loadUserModes, makeAgentSubagentRunner, makeDirectorSessionFactory, migratePlaintextSecrets, miniMaxVisionServer, removePlanItem, renderProgress, renderPrometheus, renderSpecAnalysis, renderTaskGraph, renderTaskList, rewriteConfigEncrypted, rosterSummaryFromConfigs, runConfigMigrations, savePlan, saveTodosCheckpoint, sentinelServer, setPlanItemStatus, slackServer, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, templateToMarkdown, wireMetricsToEvents, zaiVisionServer };
|
|
11684
11747
|
//# sourceMappingURL=index.js.map
|
|
11685
11748
|
//# sourceMappingURL=index.js.map
|