@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
package/dist/defaults/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-bOzkF5LL.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-
|
|
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-BmDdJ7UL.js';
|
|
3
3
|
export { D as DefaultSessionReader } from '../session-reader-bfgsy2a0.js';
|
|
4
4
|
export { A as AuditLevel, a as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, e as createSessionEventBridge, r as resolveAuditLevel, i as resolveSessionLoggingConfig } from '../goal-store-BeRsj7YX.js';
|
|
5
5
|
export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BmYi3DGA.js';
|
|
6
6
|
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-7rSC_emZ.js';
|
|
7
7
|
export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-CtNscWOA.js';
|
|
8
|
-
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-
|
|
9
|
-
export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, ParallelEngineState, ParallelEternalEngine, ParallelEternalOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from '../execution/index.js';
|
|
10
|
-
import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-
|
|
8
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-p4tP9tGF.js';
|
|
9
|
+
export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, IterationStage, ParallelEngineState, ParallelEternalEngine, ParallelEternalOptions, ParallelIterationStage, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from '../execution/index.js';
|
|
10
|
+
import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BGro2qQB.js';
|
|
11
11
|
import { q as Response } from '../context-7u93AcGD.js';
|
|
12
|
-
export { 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from '../null-fleet-bus-
|
|
13
|
-
export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, 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, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-
|
|
14
|
-
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-
|
|
15
|
-
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-
|
|
16
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
12
|
+
export { 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from '../null-fleet-bus-C0xd73YP.js';
|
|
13
|
+
export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, 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, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-BuKq0q89.js';
|
|
14
|
+
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-Ba9Ni2hC.js';
|
|
15
|
+
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';
|
|
16
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-CjbD-i7-.js';
|
|
17
17
|
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-gwMAo6E3.js';
|
|
18
18
|
export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from '../models/index.js';
|
|
19
19
|
export { AISpecBuilder, AISpecBuilderOptions, AISpecPhase, AISpecSession, AutoExecutor, AutoExecutorOptions, BottleneckTask, CollectedAnswer, CriticalPathAnalysis, DefaultTaskStore, ExecutionSummary, GeneratedTask, RunResult, SPEC_TEMPLATES, SddParallelRun, SddParallelRunOptions, SddProgress, SddTaskDecomposer, SddTaskDecomposerOptions, SpecDiff, SpecDrivenDev, SpecDrivenDevOptions, SpecIndexEntry, SpecParser, SpecStore, SpecStoreOptions, SpecVersion, SpecVersioning, TaskBatch, TaskExecutionContext, TaskExecutionResult, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskGraphIndexEntry, TaskGraphStore, TaskGraphStoreOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition, WaveResult, analyzeCriticalPath, createAutoExecutor, getTemplate, listTemplates, renderProgress, renderSpecAnalysis, renderTaskGraph, renderTaskList, templateToMarkdown } from '../sdd/index.js';
|
|
@@ -21,7 +21,7 @@ export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, Metric
|
|
|
21
21
|
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-DONdo-XM.js';
|
|
22
22
|
export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, c as DEFAULT_TOOLS_CONFIG } from '../default-config-DEXI4jsl.js';
|
|
23
23
|
import '../logger-DDd5C--Z.js';
|
|
24
|
-
import '../events-
|
|
24
|
+
import '../events-Bt44ikPN.js';
|
|
25
25
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
26
26
|
import '../memory-CEXuo7sz.js';
|
|
27
27
|
import '../wstack-paths-eMXnY1_X.js';
|
|
@@ -32,7 +32,7 @@ import '../input-reader-E-ffP2ee.js';
|
|
|
32
32
|
import '../permission-B6sldrSp.js';
|
|
33
33
|
import '../compactor-D1RHFRmF.js';
|
|
34
34
|
import '../retry-policy-KF18W4dg.js';
|
|
35
|
-
import '../index-
|
|
35
|
+
import '../index-mAWBdLyJ.js';
|
|
36
36
|
import '../system-prompt-CM6zOhd2.js';
|
|
37
37
|
import '../observability-BhnVLBLS.js';
|
|
38
38
|
import '../selector-DmXxpFyM.js';
|
package/dist/defaults/index.js
CHANGED
|
@@ -10786,8 +10786,14 @@ var ParallelEternalEngine = class {
|
|
|
10786
10786
|
await this.runOneIteration();
|
|
10787
10787
|
} catch (err) {
|
|
10788
10788
|
this.consecutiveFailures++;
|
|
10789
|
-
this.opts.onError?.(
|
|
10790
|
-
|
|
10789
|
+
this.opts.onError?.(
|
|
10790
|
+
err instanceof Error ? err : new Error(String(err)),
|
|
10791
|
+
this.consecutiveFailures
|
|
10792
|
+
);
|
|
10793
|
+
await this.appendFailure(
|
|
10794
|
+
"engine error",
|
|
10795
|
+
err instanceof Error ? err.message : String(err)
|
|
10796
|
+
);
|
|
10791
10797
|
}
|
|
10792
10798
|
if (this.stopRequested) break;
|
|
10793
10799
|
await sleep2(2e3);
|
|
@@ -10803,14 +10809,19 @@ var ParallelEternalEngine = class {
|
|
|
10803
10809
|
* Called by the REPL in its main loop (REPL drives, engine is stateless per tick).
|
|
10804
10810
|
*/
|
|
10805
10811
|
async runOneIteration() {
|
|
10812
|
+
const emit = (stage) => {
|
|
10813
|
+
this.opts.onStage?.(stage);
|
|
10814
|
+
};
|
|
10806
10815
|
this.iterations++;
|
|
10807
10816
|
const goal = await loadGoal(this.goalPath);
|
|
10808
10817
|
if (!goal) {
|
|
10809
10818
|
this.stopRequested = true;
|
|
10819
|
+
emit({ phase: "stopped" });
|
|
10810
10820
|
return false;
|
|
10811
10821
|
}
|
|
10812
10822
|
if (goal.goalState !== "active") {
|
|
10813
10823
|
this.stopRequested = true;
|
|
10824
|
+
emit({ phase: "stopped" });
|
|
10814
10825
|
return false;
|
|
10815
10826
|
}
|
|
10816
10827
|
if (!this.coordinator) {
|
|
@@ -10823,10 +10834,13 @@ var ParallelEternalEngine = class {
|
|
|
10823
10834
|
const runner = makeAgentSubagentRunner({ factory: this.agentFactory });
|
|
10824
10835
|
this.coordinator.setRunner?.(runner);
|
|
10825
10836
|
}
|
|
10837
|
+
emit({ phase: "decompose" });
|
|
10826
10838
|
const tasks = await this.decomposeGoal(goal);
|
|
10827
10839
|
if (!tasks || tasks.length === 0) {
|
|
10840
|
+
emit({ phase: "sleep", ms: 2e3 });
|
|
10828
10841
|
return false;
|
|
10829
10842
|
}
|
|
10843
|
+
emit({ phase: "fanout", slots: Math.min(this.slots, tasks.length) });
|
|
10830
10844
|
const fanOut = await this.fanOut(goal, tasks);
|
|
10831
10845
|
this.iterationsSinceCompact++;
|
|
10832
10846
|
const successCount = fanOut.results.filter((r) => r.status === "success").length;
|
|
@@ -10843,12 +10857,20 @@ var ParallelEternalEngine = class {
|
|
|
10843
10857
|
status,
|
|
10844
10858
|
note
|
|
10845
10859
|
});
|
|
10860
|
+
emit({
|
|
10861
|
+
phase: "aggregate",
|
|
10862
|
+
successCount,
|
|
10863
|
+
total: fanOut.results.length,
|
|
10864
|
+
goalComplete: fanOut.goalComplete
|
|
10865
|
+
});
|
|
10846
10866
|
if (fanOut.goalComplete) {
|
|
10847
10867
|
this.stopRequested = true;
|
|
10848
10868
|
this.state = "stopped";
|
|
10869
|
+
emit({ phase: "stopped" });
|
|
10849
10870
|
return true;
|
|
10850
10871
|
}
|
|
10851
10872
|
await this.maybeCompact();
|
|
10873
|
+
emit({ phase: "sleep", ms: 2e3 });
|
|
10852
10874
|
return fanOut.allSuccessful;
|
|
10853
10875
|
}
|
|
10854
10876
|
// -------------------------------------------------------------------------
|
|
@@ -10862,7 +10884,9 @@ var ParallelEternalEngine = class {
|
|
|
10862
10884
|
(t) => dispatchAgent(t, { classifier: this.dispatchClassifier }).catch(() => null)
|
|
10863
10885
|
)
|
|
10864
10886
|
) : [];
|
|
10865
|
-
const recentJournal = goal.journal.slice(-5).map(
|
|
10887
|
+
const recentJournal = goal.journal.slice(-5).map(
|
|
10888
|
+
(e) => ` #${e.iteration} [${e.status}] ${e.task}${e.note ? ` \u2014 ${e.note.slice(0, 80)}` : ""}`
|
|
10889
|
+
).join("\n");
|
|
10866
10890
|
const directivePreamble = [
|
|
10867
10891
|
"\u2550\u2550\u2550 ETERNAL AUTONOMY \u2014 parallel task slot \u2550\u2550\u2550",
|
|
10868
10892
|
"",
|
|
@@ -10905,35 +10929,44 @@ ${personaLine}Task: ${task}
|
|
|
10905
10929
|
role: route?.role ?? "generic",
|
|
10906
10930
|
method: route?.method ?? "none"
|
|
10907
10931
|
});
|
|
10908
|
-
spawnPromises.push(
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
+
spawnPromises.push(
|
|
10933
|
+
(async () => {
|
|
10934
|
+
try {
|
|
10935
|
+
await coordinator.spawn(
|
|
10936
|
+
route ? {
|
|
10937
|
+
id: subagentId,
|
|
10938
|
+
name: route.definition.config.name,
|
|
10939
|
+
role: route.role,
|
|
10940
|
+
tools: route.definition.config.tools,
|
|
10941
|
+
systemPromptOverride: route.definition.config.prompt,
|
|
10942
|
+
timeoutMs: this.timeoutMs
|
|
10943
|
+
} : {
|
|
10944
|
+
id: subagentId,
|
|
10945
|
+
name: `slot-${subagentId.slice(-6)}`,
|
|
10946
|
+
// Let the coordinator apply its default budget (roster or generic).
|
|
10947
|
+
// Hardcoding low limits here defeats the x10 budget improvement.
|
|
10948
|
+
timeoutMs: this.timeoutMs
|
|
10949
|
+
}
|
|
10950
|
+
);
|
|
10951
|
+
subagentIds.push(subagentId);
|
|
10952
|
+
taskIds.push(taskId);
|
|
10953
|
+
await coordinator.assign(spec);
|
|
10954
|
+
} catch {
|
|
10955
|
+
}
|
|
10956
|
+
})()
|
|
10957
|
+
);
|
|
10932
10958
|
}
|
|
10933
10959
|
await Promise.all(spawnPromises);
|
|
10934
10960
|
if (taskIds.length === 0) {
|
|
10935
|
-
return {
|
|
10961
|
+
return {
|
|
10962
|
+
results: [],
|
|
10963
|
+
allSuccessful: false,
|
|
10964
|
+
goalComplete: false,
|
|
10965
|
+
partialOutput: "",
|
|
10966
|
+
routes: routeInfo
|
|
10967
|
+
};
|
|
10936
10968
|
}
|
|
10969
|
+
this.opts.onStage?.({ phase: "await", taskIds: [...taskIds] });
|
|
10937
10970
|
let results = [];
|
|
10938
10971
|
try {
|
|
10939
10972
|
const ctrl = new AbortController();
|
|
@@ -12887,6 +12920,12 @@ var Director = class _Director {
|
|
|
12887
12920
|
getLeaderContextPressure() {
|
|
12888
12921
|
return this.leaderContextPressure;
|
|
12889
12922
|
}
|
|
12923
|
+
resolveMaxContext() {
|
|
12924
|
+
const resolved = typeof this.maxContext === "function" ? this.maxContext() : this.maxContext;
|
|
12925
|
+
return resolved && resolved > 0 ? resolved : 128e3;
|
|
12926
|
+
}
|
|
12927
|
+
/** Optional Brain arbiter for director-level policy decisions. */
|
|
12928
|
+
brain;
|
|
12890
12929
|
/**
|
|
12891
12930
|
* Optional fleet-level policy container. When provided the Director
|
|
12892
12931
|
* delegates spawn budgeting, manifest entries, and checkpointing to it
|
|
@@ -12978,7 +13017,7 @@ var Director = class _Director {
|
|
|
12978
13017
|
leaderContextPressure = 0;
|
|
12979
13018
|
/** Maximum context load fraction before spawn is refused. */
|
|
12980
13019
|
maxLeaderContextLoad;
|
|
12981
|
-
/** Provider's max context window in tokens. */
|
|
13020
|
+
/** Provider's max context window in tokens, or a live resolver for runtime model switches. */
|
|
12982
13021
|
maxContext;
|
|
12983
13022
|
/** Per-task model matrix (static record or live getter); resolved
|
|
12984
13023
|
* per-spawn when no explicit model is set. */
|
|
@@ -12998,6 +13037,7 @@ var Director = class _Director {
|
|
|
12998
13037
|
largeAnswerStore;
|
|
12999
13038
|
constructor(opts) {
|
|
13000
13039
|
this.id = opts.config.coordinatorId || randomUUID();
|
|
13040
|
+
this.brain = opts.brain;
|
|
13001
13041
|
this.manifestPath = opts.manifestPath;
|
|
13002
13042
|
this.roster = opts.roster;
|
|
13003
13043
|
this.directorPreamble = opts.directorPreamble ?? DEFAULT_DIRECTOR_PREAMBLE;
|
|
@@ -13142,33 +13182,81 @@ var Director = class _Director {
|
|
|
13142
13182
|
return;
|
|
13143
13183
|
}
|
|
13144
13184
|
}
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13185
|
+
const grantExtension = () => {
|
|
13186
|
+
setImmediate(() => {
|
|
13187
|
+
const extra = {};
|
|
13188
|
+
const base = Math.max(payload.limit, payload.used);
|
|
13189
|
+
const grow = (ceiling) => Math.min(Math.ceil(base * 1.5), ceiling);
|
|
13190
|
+
let newLimit = base;
|
|
13191
|
+
switch (payload.kind) {
|
|
13192
|
+
case "iterations":
|
|
13193
|
+
newLimit = grow(5e4);
|
|
13194
|
+
extra.maxIterations = newLimit;
|
|
13195
|
+
break;
|
|
13196
|
+
case "tool_calls":
|
|
13197
|
+
newLimit = grow(1e5);
|
|
13198
|
+
extra.maxToolCalls = newLimit;
|
|
13199
|
+
break;
|
|
13200
|
+
case "tokens":
|
|
13201
|
+
newLimit = grow(5e6);
|
|
13202
|
+
extra.maxTokens = newLimit;
|
|
13203
|
+
break;
|
|
13204
|
+
case "cost":
|
|
13205
|
+
newLimit = Math.min(base * 1.5, 100);
|
|
13206
|
+
extra.maxCostUsd = newLimit;
|
|
13207
|
+
break;
|
|
13208
|
+
}
|
|
13209
|
+
extendCounts.set(guardKey, prior + 1);
|
|
13210
|
+
this.recordExtension(e.subagentId, e.taskId, payload.kind, newLimit);
|
|
13211
|
+
payload.extend(extra);
|
|
13212
|
+
});
|
|
13213
|
+
};
|
|
13214
|
+
if (this.brain) {
|
|
13215
|
+
void this.brain.decide({
|
|
13216
|
+
id: `director-budget-${e.subagentId}-${payload.kind}`,
|
|
13217
|
+
source: "director",
|
|
13218
|
+
question: `Should the director extend the ${payload.kind} budget for subagent ${e.subagentId}?`,
|
|
13219
|
+
context: [
|
|
13220
|
+
e.taskId ? `Task id: ${e.taskId}` : void 0,
|
|
13221
|
+
`Used: ${payload.used}`,
|
|
13222
|
+
`Limit: ${payload.limit}`,
|
|
13223
|
+
`Prior extensions for this kind: ${prior}`
|
|
13224
|
+
].filter(Boolean).join("\n"),
|
|
13225
|
+
risk: payload.kind === "cost" ? "high" : "medium",
|
|
13226
|
+
fallback: "continue",
|
|
13227
|
+
options: [
|
|
13228
|
+
{
|
|
13229
|
+
id: "extend",
|
|
13230
|
+
label: "Grant the director default budget extension",
|
|
13231
|
+
consequence: "The subagent continues with a larger per-kind budget.",
|
|
13232
|
+
risk: payload.kind === "cost" ? "high" : "medium",
|
|
13233
|
+
recommended: true
|
|
13234
|
+
},
|
|
13235
|
+
{
|
|
13236
|
+
id: "stop",
|
|
13237
|
+
label: "Stop this subagent at the current budget limit",
|
|
13238
|
+
consequence: "The current task will fail or stop due to budget pressure.",
|
|
13239
|
+
risk: "low"
|
|
13240
|
+
}
|
|
13241
|
+
]
|
|
13242
|
+
}).then((decision) => {
|
|
13243
|
+
if (decision.type === "deny") {
|
|
13244
|
+
payload.deny();
|
|
13245
|
+
return;
|
|
13246
|
+
}
|
|
13247
|
+
if (decision.type === "ask_human") {
|
|
13248
|
+
payload.deny();
|
|
13249
|
+
return;
|
|
13250
|
+
}
|
|
13251
|
+
if (decision.optionId === "stop" || /\bstop\b/i.test(decision.text)) {
|
|
13252
|
+
payload.deny();
|
|
13253
|
+
return;
|
|
13254
|
+
}
|
|
13255
|
+
grantExtension();
|
|
13256
|
+
}).catch(() => payload.deny());
|
|
13257
|
+
return;
|
|
13258
|
+
}
|
|
13259
|
+
grantExtension();
|
|
13172
13260
|
});
|
|
13173
13261
|
this.largeAnswerStore = new LargeAnswerStore(2e3);
|
|
13174
13262
|
}
|
|
@@ -13378,7 +13466,8 @@ var Director = class _Director {
|
|
|
13378
13466
|
}
|
|
13379
13467
|
}
|
|
13380
13468
|
if (this.maxLeaderContextLoad < 1) {
|
|
13381
|
-
const
|
|
13469
|
+
const maxContext = this.resolveMaxContext();
|
|
13470
|
+
const threshold = maxContext * this.maxLeaderContextLoad;
|
|
13382
13471
|
if (this.leaderContextPressure >= threshold) {
|
|
13383
13472
|
throw new FleetContextOverflowError(threshold, this.leaderContextPressure);
|
|
13384
13473
|
}
|
|
@@ -14559,12 +14648,12 @@ var DefaultModelsRegistry = class {
|
|
|
14559
14648
|
*/
|
|
14560
14649
|
async loadOverlay(opts = {}) {
|
|
14561
14650
|
if (this.overlayPayload && !opts.force) return this.overlayPayload;
|
|
14562
|
-
if (this.overlay) {
|
|
14651
|
+
if (hasEntries(this.overlay)) {
|
|
14563
14652
|
this.overlayPayload = this.overlay;
|
|
14564
14653
|
return this.overlayPayload;
|
|
14565
14654
|
}
|
|
14566
14655
|
const fetched = await this.loadOverlayFromUrl(opts);
|
|
14567
|
-
if (fetched) {
|
|
14656
|
+
if (hasEntries(fetched)) {
|
|
14568
14657
|
this.overlayPayload = fetched;
|
|
14569
14658
|
return fetched;
|
|
14570
14659
|
}
|
|
@@ -14691,6 +14780,9 @@ var DefaultModelsRegistry = class {
|
|
|
14691
14780
|
return path15.resolve(this.cacheFile);
|
|
14692
14781
|
}
|
|
14693
14782
|
};
|
|
14783
|
+
function hasEntries(payload) {
|
|
14784
|
+
return payload !== void 0 && Object.keys(payload).length > 0;
|
|
14785
|
+
}
|
|
14694
14786
|
|
|
14695
14787
|
// src/models/mode-store.ts
|
|
14696
14788
|
init_atomic_write();
|