@wrongstack/core 0.41.0 → 0.54.1
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-Dnhw4tnM.d.ts} +1 -1
- package/dist/{agent-subagent-runner-C66vi4Gq.d.ts → agent-subagent-runner-By7jruZ_.d.ts} +3 -3
- package/dist/{compactor-D1RHFRmF.d.ts → compactor-Duhsf0ge.d.ts} +1 -1
- package/dist/{config-ZRCf7sTu.d.ts → config-bht0txXS.d.ts} +33 -2
- package/dist/{context-7u93AcGD.d.ts → context-DtPKqKYV.d.ts} +1 -0
- package/dist/coordination/index.d.ts +12 -12
- package/dist/coordination/index.js +234 -32
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +23 -23
- package/dist/defaults/index.js +182 -75
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-BrQiweXN.d.ts → events-CbHTS4ZZ.d.ts} +136 -2
- package/dist/execution/index.d.ts +42 -16
- package/dist/execution/index.js +61 -28
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{goal-store-BeRsj7YX.d.ts → goal-store-DwcTDDiX.d.ts} +1 -1
- package/dist/{index-6_csX32J.d.ts → index-CI271MjL.d.ts} +5 -5
- package/dist/{index-DkVgH3wC.d.ts → index-ge5F2dnc.d.ts} +10 -8
- package/dist/index.d.ts +113 -37
- package/dist/index.js +601 -149
- 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/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DONdo-XM.d.ts → mcp-servers-DE6gzBry.d.ts} +3 -3
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +36 -18
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-gwMAo6E3.d.ts → models-registry-Cuq1C8V9.d.ts} +7 -0
- package/dist/{multi-agent-C8Z1i__e.d.ts → multi-agent-BmC_xiog.d.ts} +2 -2
- package/dist/{multi-agent-coordinator-BUsjiRWl.d.ts → multi-agent-coordinator-CjNX4uBD.d.ts} +2 -2
- package/dist/{null-fleet-bus-FvgHnZah.d.ts → null-fleet-bus-BNiSlTna.d.ts} +23 -11
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-DumKAi0n.d.ts → path-resolver-Bax85amb.d.ts} +2 -2
- package/dist/{permission-B6sldrSp.d.ts → permission-Drm7LpPo.d.ts} +1 -1
- package/dist/{permission-policy-CtNscWOA.d.ts → permission-policy-CU6sqWxF.d.ts} +2 -2
- package/dist/{plan-templates-DYCeRCDN.d.ts → plan-templates-CLRcurWN.d.ts} +4 -4
- package/dist/{provider-runner-Dlv8Fvw9.d.ts → provider-runner-BikCxGCx.d.ts} +3 -3
- package/dist/{retry-policy-KF18W4dg.d.ts → retry-policy-Chtlvr5b.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/{selector-DmXxpFyM.d.ts → selector-BvSPdJj6.d.ts} +1 -1
- package/dist/{session-reader-bfgsy2a0.d.ts → session-reader-BGhzMir4.d.ts} +1 -1
- package/dist/storage/index.d.ts +6 -6
- package/dist/storage/index.js +57 -37
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-CM6zOhd2.d.ts → system-prompt-dtzV_mLm.d.ts} +1 -1
- package/dist/{tool-executor-BpK-SWtJ.d.ts → tool-executor-CgU0yWpB.d.ts} +4 -4
- package/dist/types/index.d.ts +15 -15
- package/dist/types/index.js +36 -18
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +14 -2
- package/dist/utils/index.js +18 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/defaults/index.d.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
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-
|
|
3
|
-
export { D as DefaultSessionReader } from '../session-reader-
|
|
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-
|
|
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-CLRcurWN.js';
|
|
3
|
+
export { D as DefaultSessionReader } from '../session-reader-BGhzMir4.js';
|
|
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-DwcTDDiX.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
|
-
export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-
|
|
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-
|
|
11
|
-
import { q as Response } from '../context-
|
|
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-
|
|
17
|
-
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-
|
|
7
|
+
export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-CU6sqWxF.js';
|
|
8
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-CgU0yWpB.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-BikCxGCx.js';
|
|
11
|
+
import { q as Response } from '../context-DtPKqKYV.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-BNiSlTna.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-CjNX4uBD.js';
|
|
14
|
+
export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-BmC_xiog.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-By7jruZ_.js';
|
|
16
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-Dnhw4tnM.js';
|
|
17
|
+
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-Cuq1C8V9.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';
|
|
20
20
|
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';
|
|
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-
|
|
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-DE6gzBry.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-CbHTS4ZZ.js';
|
|
25
25
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
26
26
|
import '../memory-CEXuo7sz.js';
|
|
27
27
|
import '../wstack-paths-eMXnY1_X.js';
|
|
28
|
-
import '../config-
|
|
28
|
+
import '../config-bht0txXS.js';
|
|
29
29
|
import '../models-registry-BcYJDKLm.js';
|
|
30
30
|
import '../secret-vault-DoISxaKO.js';
|
|
31
31
|
import '../input-reader-E-ffP2ee.js';
|
|
32
|
-
import '../permission-
|
|
33
|
-
import '../compactor-
|
|
34
|
-
import '../retry-policy-
|
|
35
|
-
import '../index-
|
|
36
|
-
import '../system-prompt-
|
|
32
|
+
import '../permission-Drm7LpPo.js';
|
|
33
|
+
import '../compactor-Duhsf0ge.js';
|
|
34
|
+
import '../retry-policy-Chtlvr5b.js';
|
|
35
|
+
import '../index-CI271MjL.js';
|
|
36
|
+
import '../system-prompt-dtzV_mLm.js';
|
|
37
37
|
import '../observability-BhnVLBLS.js';
|
|
38
|
-
import '../selector-
|
|
38
|
+
import '../selector-BvSPdJj6.js';
|
|
39
39
|
import '../skill-CxuWrsKK.js';
|
|
40
40
|
import 'node:events';
|
|
41
41
|
import '../mode-CV077NjV.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
|
}
|
|
@@ -14436,6 +14525,7 @@ function stripUndefined(obj) {
|
|
|
14436
14525
|
// src/models/models-registry.ts
|
|
14437
14526
|
var DEFAULT_URL = "https://models.dev/api.json";
|
|
14438
14527
|
var DEFAULT_TTL_SECONDS = 24 * 3600;
|
|
14528
|
+
var DEFAULT_REFRESH_TIMEOUT_MS = 15e3;
|
|
14439
14529
|
var FAMILY_BY_NPM = {
|
|
14440
14530
|
"@ai-sdk/anthropic": "anthropic",
|
|
14441
14531
|
"@ai-sdk/google-vertex/anthropic": "anthropic",
|
|
@@ -14472,6 +14562,7 @@ var DefaultModelsRegistry = class {
|
|
|
14472
14562
|
fetchImpl;
|
|
14473
14563
|
seed;
|
|
14474
14564
|
maxStaleAgeMs;
|
|
14565
|
+
refreshTimeoutMs;
|
|
14475
14566
|
overlay;
|
|
14476
14567
|
overlayUrl;
|
|
14477
14568
|
overlayFile;
|
|
@@ -14484,6 +14575,7 @@ var DefaultModelsRegistry = class {
|
|
|
14484
14575
|
this.seed = opts.seed;
|
|
14485
14576
|
const maxStaleSeconds = opts.maxStaleAgeSeconds ?? 7 * 24 * 3600;
|
|
14486
14577
|
this.maxStaleAgeMs = maxStaleSeconds * 1e3;
|
|
14578
|
+
this.refreshTimeoutMs = opts.refreshTimeoutMs ?? DEFAULT_REFRESH_TIMEOUT_MS;
|
|
14487
14579
|
this.overlay = opts.overlay;
|
|
14488
14580
|
this.overlayUrl = opts.overlayUrl;
|
|
14489
14581
|
this.overlayFile = opts.overlayFile;
|
|
@@ -14535,22 +14627,34 @@ var DefaultModelsRegistry = class {
|
|
|
14535
14627
|
}
|
|
14536
14628
|
/** Fetch + cache the models.dev base. Throws on failure (used by `refresh`). */
|
|
14537
14629
|
async refreshBase() {
|
|
14538
|
-
const
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14630
|
+
const controller = new AbortController();
|
|
14631
|
+
const timeout = setTimeout(() => controller.abort(), this.refreshTimeoutMs);
|
|
14632
|
+
try {
|
|
14633
|
+
const res = await this.fetchImpl(this.url, {
|
|
14634
|
+
method: "GET",
|
|
14635
|
+
headers: { accept: "application/json" },
|
|
14636
|
+
signal: controller.signal
|
|
14637
|
+
});
|
|
14638
|
+
clearTimeout(timeout);
|
|
14639
|
+
if (!res.ok) {
|
|
14640
|
+
throw new Error(`ModelsRegistry: HTTP ${res.status} fetching ${this.url}`);
|
|
14641
|
+
}
|
|
14642
|
+
const json = await res.json();
|
|
14643
|
+
this.fetchedAt = /* @__PURE__ */ new Date();
|
|
14644
|
+
const envelope = {
|
|
14645
|
+
fetchedAt: this.fetchedAt.toISOString(),
|
|
14646
|
+
url: this.url,
|
|
14647
|
+
payload: json
|
|
14648
|
+
};
|
|
14649
|
+
await atomicWrite(this.cacheFile, JSON.stringify(envelope));
|
|
14650
|
+
return json;
|
|
14651
|
+
} catch (err) {
|
|
14652
|
+
clearTimeout(timeout);
|
|
14653
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
14654
|
+
throw new Error(`ModelsRegistry: fetch timed out after ${this.refreshTimeoutMs}ms`);
|
|
14655
|
+
}
|
|
14656
|
+
throw err;
|
|
14657
|
+
}
|
|
14554
14658
|
}
|
|
14555
14659
|
/**
|
|
14556
14660
|
* Resolve the curated overlay, memoised. Order: in-memory `overlay` →
|
|
@@ -14559,12 +14663,12 @@ var DefaultModelsRegistry = class {
|
|
|
14559
14663
|
*/
|
|
14560
14664
|
async loadOverlay(opts = {}) {
|
|
14561
14665
|
if (this.overlayPayload && !opts.force) return this.overlayPayload;
|
|
14562
|
-
if (this.overlay) {
|
|
14666
|
+
if (hasEntries(this.overlay)) {
|
|
14563
14667
|
this.overlayPayload = this.overlay;
|
|
14564
14668
|
return this.overlayPayload;
|
|
14565
14669
|
}
|
|
14566
14670
|
const fetched = await this.loadOverlayFromUrl(opts);
|
|
14567
|
-
if (fetched) {
|
|
14671
|
+
if (hasEntries(fetched)) {
|
|
14568
14672
|
this.overlayPayload = fetched;
|
|
14569
14673
|
return fetched;
|
|
14570
14674
|
}
|
|
@@ -14691,6 +14795,9 @@ var DefaultModelsRegistry = class {
|
|
|
14691
14795
|
return path15.resolve(this.cacheFile);
|
|
14692
14796
|
}
|
|
14693
14797
|
};
|
|
14798
|
+
function hasEntries(payload) {
|
|
14799
|
+
return payload !== void 0 && Object.keys(payload).length > 0;
|
|
14800
|
+
}
|
|
14694
14801
|
|
|
14695
14802
|
// src/models/mode-store.ts
|
|
14696
14803
|
init_atomic_write();
|