@wrongstack/core 0.63.4 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{agent-bridge-B5rxWrg3.d.ts → agent-bridge-D-j6OOBT.d.ts} +1 -1
  2. package/dist/agent-subagent-runner-DRZ9-NnR.d.ts +1042 -0
  3. package/dist/{compactor-0vjZ8KTk.d.ts → compactor-D_ExJajC.d.ts} +1 -1
  4. package/dist/{config-BdDuaZmB.d.ts → config--86aHSln.d.ts} +1 -1
  5. package/dist/{context-iFMEO2rN.d.ts → context-y87Jc5ei.d.ts} +3 -3
  6. package/dist/coordination/index.d.ts +12 -12
  7. package/dist/coordination/index.js +265 -275
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/defaults/index.d.ts +22 -22
  10. package/dist/defaults/index.js +181 -180
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{events-k8CHjcrN.d.ts → events-CIplI98R.d.ts} +1 -1
  13. package/dist/execution/index.d.ts +16 -385
  14. package/dist/execution/index.js +124 -146
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -6
  17. package/dist/goal-store-C7jcumEh.d.ts +96 -0
  18. package/dist/{index-Bc6BiP5q.d.ts → index-DKUvyTvV.d.ts} +28 -442
  19. package/dist/{index-CWdW_CJt.d.ts → index-b5uhfTSl.d.ts} +8 -8
  20. package/dist/index.d.ts +34 -32
  21. package/dist/index.js +692 -750
  22. package/dist/index.js.map +1 -1
  23. package/dist/infrastructure/index.d.ts +6 -6
  24. package/dist/kernel/index.d.ts +9 -9
  25. package/dist/{mcp-servers-CwqQDMYy.d.ts → mcp-servers-DwoNBf6r.d.ts} +3 -3
  26. package/dist/models/index.d.ts +2 -2
  27. package/dist/{multi-agent-coordinator-CNUJYq7U.d.ts → multi-agent-coordinator-CWnH-CiX.d.ts} +10 -2
  28. package/dist/{null-fleet-bus-DRoJ0uOY.d.ts → null-fleet-bus-CuN0ObJr.d.ts} +24 -31
  29. package/dist/observability/index.d.ts +2 -2
  30. package/dist/parallel-eternal-engine-0UwotoSx.d.ts +483 -0
  31. package/dist/{path-resolver-C5sPVne8.d.ts → path-resolver-DVkEcIw8.d.ts} +2 -2
  32. package/dist/{permission-Ld-i5ugf.d.ts → permission-C1A5whY5.d.ts} +5 -1
  33. package/dist/{permission-policy-CL-mPufp.d.ts → permission-policy-B2dK-T5N.d.ts} +19 -5
  34. package/dist/{plan-templates-ThBHOjaM.d.ts → plan-templates-Bprrzhbu.d.ts} +4 -4
  35. package/dist/{provider-runner-DJQa211J.d.ts → provider-runner-mXvXGSIw.d.ts} +3 -3
  36. package/dist/{retry-policy-BfBScewS.d.ts → retry-policy-CG3qvH_e.d.ts} +1 -1
  37. package/dist/sdd/index.d.ts +8 -8
  38. package/dist/sdd/index.js +123 -146
  39. package/dist/sdd/index.js.map +1 -1
  40. package/dist/security/index.d.ts +3 -3
  41. package/dist/security/index.js +31 -22
  42. package/dist/security/index.js.map +1 -1
  43. package/dist/{selector-DxhW7ML3.d.ts → selector-RvBR_YRW.d.ts} +1 -1
  44. package/dist/session-event-bridge-CDHxcmQU.d.ts +93 -0
  45. package/dist/{session-reader-q2ThszgG.d.ts → session-reader-BIpwM60D.d.ts} +1 -1
  46. package/dist/storage/index.d.ts +7 -6
  47. package/dist/{system-prompt-7LHyBbIf.d.ts → system-prompt-b61lOd49.d.ts} +2 -2
  48. package/dist/types/index.d.ts +23 -14
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/utils/index.d.ts +2 -2
  51. package/dist/utils/index.js.map +1 -1
  52. package/package.json +1 -1
  53. package/skills/multi-agent/SKILL.md +0 -2
  54. package/dist/agent-subagent-runner-Zc3f37Sg.d.ts +0 -182
  55. package/dist/goal-store-iHltMi5n.d.ts +0 -188
  56. package/dist/multi-agent-SASYOrWA.d.ts +0 -554
  57. package/dist/tool-executor-CIjpGaRA.d.ts +0 -111
@@ -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-ThBHOjaM.js';
3
- export { D as DefaultSessionReader } from '../session-reader-q2ThszgG.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-iHltMi5n.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-Bprrzhbu.js';
3
+ export { D as DefaultSessionReader } from '../session-reader-BIpwM60D.js';
4
+ export { A as AuditLevel, a as SessionEventBridge, b as SessionEventBridgeOptions, c as SessionSamplingOptions, T as ToolProgressSamplingOptions, d as createSessionEventBridge, r as resolveAuditLevel, e as resolveSessionLoggingConfig } from '../session-event-bridge-CDHxcmQU.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-CL-mPufp.js';
8
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-CIjpGaRA.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-DJQa211J.js';
11
- import { q as Response } from '../context-iFMEO2rN.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-DRoJ0uOY.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-CNUJYq7U.js';
14
- export { c as BudgetExceededError, d as BudgetKind, e as BudgetLimits, j as BudgetUsage, m as SubagentBudget } from '../multi-agent-SASYOrWA.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-Zc3f37Sg.js';
16
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-B5rxWrg3.js';
7
+ export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-B2dK-T5N.js';
8
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-0UwotoSx.js';
9
+ export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, IntelligentCompactor, IntelligentCompactorOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from '../execution/index.js';
10
+ import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-mXvXGSIw.js';
11
+ import { q as Response } from '../context-y87Jc5ei.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-CuN0ObJr.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-CWnH-CiX.js';
14
+ export { c as AgentFactory, d as AgentFactoryResult, e as AgentRunnerOptions, g as BudgetExceededError, h as BudgetKind, i as BudgetLimits, n as BudgetUsage, F as FleetBus, p as FleetEvent, q as FleetHandler, r as FleetUsage, s as FleetUsageAggregator, K as SubagentBudget, V as SubagentUsageSnapshot, _ as makeAgentSubagentRunner } from '../agent-subagent-runner-DRZ9-NnR.js';
15
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-D-j6OOBT.js';
17
16
  export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-Cuq1C8V9.js';
18
17
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from '../models/index.js';
19
18
  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
19
  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-CwqQDMYy.js';
20
+ 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-DwoNBf6r.js';
22
21
  export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CONTEXT_CONFIG, c as DEFAULT_TOOLS_CONFIG } from '../default-config-DEXI4jsl.js';
23
22
  import '../logger-DDd5C--Z.js';
24
- import '../events-k8CHjcrN.js';
23
+ import '../events-CIplI98R.js';
25
24
  import '../secret-scrubber-3MHDDAtm.js';
26
25
  import '../memory-CEXuo7sz.js';
27
26
  import '../wstack-paths-eMXnY1_X.js';
28
- import '../config-BdDuaZmB.js';
27
+ import '../config--86aHSln.js';
29
28
  import '../models-registry-BcYJDKLm.js';
30
29
  import '../secret-vault-DoISxaKO.js';
31
30
  import '../input-reader-E-ffP2ee.js';
32
- import '../permission-Ld-i5ugf.js';
33
- import '../compactor-0vjZ8KTk.js';
34
- import '../retry-policy-BfBScewS.js';
35
- import '../index-Bc6BiP5q.js';
36
- import '../system-prompt-7LHyBbIf.js';
31
+ import '../permission-C1A5whY5.js';
32
+ import '../compactor-D_ExJajC.js';
33
+ import '../retry-policy-CG3qvH_e.js';
34
+ import '../index-DKUvyTvV.js';
35
+ import '../system-prompt-b61lOd49.js';
37
36
  import '../observability-BhnVLBLS.js';
38
- import '../selector-DxhW7ML3.js';
37
+ import '../goal-store-C7jcumEh.js';
38
+ import '../selector-RvBR_YRW.js';
39
39
  import '../skill-CxuWrsKK.js';
40
40
  import 'node:events';
41
41
  import '../mode-CV077NjV.js';
@@ -3410,6 +3410,8 @@ var DefaultPermissionPolicy = class {
3410
3410
  trustFile;
3411
3411
  yolo;
3412
3412
  yoloDestructive;
3413
+ /** When true, destructive ops still require confirmation even in YOLO mode. */
3414
+ confirmDestructive;
3413
3415
  /**
3414
3416
  * Session-scoped "soft deny" map. When the user presses 'n' (block once),
3415
3417
  * the tool+pattern is added here. If the LLM retries in the same session,
@@ -3443,6 +3445,7 @@ var DefaultPermissionPolicy = class {
3443
3445
  this.trustFile = opts.trustFile;
3444
3446
  this.yolo = opts.yolo ?? false;
3445
3447
  this.yoloDestructive = opts.yoloDestructive ?? opts.forceAllYolo ?? false;
3448
+ this.confirmDestructive = opts.confirmDestructive ?? false;
3446
3449
  this.promptDelegate = opts.promptDelegate;
3447
3450
  }
3448
3451
  /**
@@ -3470,6 +3473,14 @@ var DefaultPermissionPolicy = class {
3470
3473
  getYoloDestructive() {
3471
3474
  return this.yoloDestructive;
3472
3475
  }
3476
+ /** Toggle destructive confirmation gate (only meaningful when yolo is active). */
3477
+ setConfirmDestructive(enabled) {
3478
+ this.confirmDestructive = enabled;
3479
+ }
3480
+ /** Check whether destructive confirmation gate is active. */
3481
+ getConfirmDestructive() {
3482
+ return this.confirmDestructive;
3483
+ }
3473
3484
  /** @deprecated Use `setYoloDestructive`. */
3474
3485
  setForceAllYolo(enabled) {
3475
3486
  this.setYoloDestructive(enabled);
@@ -3523,30 +3534,28 @@ var DefaultPermissionPolicy = class {
3523
3534
  return { permission: "auto", source: "trust" };
3524
3535
  }
3525
3536
  if (this.yolo) {
3526
- const destructive = this.isDestructiveYoloCall(tool, input, ctx);
3527
- if (destructive && !this.yoloDestructive) {
3528
- if (this.promptDelegate) {
3529
- const decision = await this.promptDelegate(tool, input, subject ?? tool.name);
3530
- if (decision === "always") {
3531
- await this.trust({ tool: tool.name, pattern: subject ?? tool.name });
3532
- return {
3533
- permission: "auto",
3534
- source: "user",
3535
- reason: "destructive yolo always-allowed"
3536
- };
3537
- }
3538
- if (decision === "deny") {
3539
- await this.deny({ tool: tool.name, pattern: subject ?? tool.name });
3540
- return { permission: "deny", source: "user", reason: "user denied destructive yolo" };
3537
+ if (this.confirmDestructive) {
3538
+ const destructive = this.isDestructiveYoloCall(tool, input, ctx);
3539
+ if (destructive) {
3540
+ if (this.promptDelegate) {
3541
+ const decision = await this.promptDelegate(tool, input, subject ?? tool.name);
3542
+ if (decision === "always") {
3543
+ await this.trust({ tool: tool.name, pattern: subject ?? tool.name });
3544
+ return { permission: "auto", source: "user", reason: "destructive yolo always-allowed" };
3545
+ }
3546
+ if (decision === "deny") {
3547
+ await this.deny({ tool: tool.name, pattern: subject ?? tool.name });
3548
+ return { permission: "deny", source: "user", reason: "user denied destructive yolo" };
3549
+ }
3550
+ return { permission: decision === "yes" ? "auto" : "deny", source: "user" };
3541
3551
  }
3542
- return { permission: decision === "yes" ? "auto" : "deny", source: "user" };
3552
+ return {
3553
+ permission: "confirm",
3554
+ source: "yolo_destructive",
3555
+ riskTier: "destructive",
3556
+ reason: "destructive tool needs explicit approval (confirmDestructive is on)"
3557
+ };
3543
3558
  }
3544
- return {
3545
- permission: "confirm",
3546
- source: "yolo_destructive",
3547
- riskTier: "destructive",
3548
- reason: "destructive tool needs explicit approval even in yolo mode"
3549
- };
3550
3559
  }
3551
3560
  return { permission: "auto", source: "yolo" };
3552
3561
  }
@@ -7211,15 +7220,22 @@ var SubagentBudget = class _SubagentBudget {
7211
7220
  void this.checkLimits();
7212
7221
  }
7213
7222
  /**
7214
- * Wall-clock budget check. Unlike other limits, timeout is always a hard stop
7215
- * wall-clock time cannot be "extended" by the coordinator, so it throws
7216
- * synchronously rather than entering the negotiation flow.
7223
+ * Wall-clock / idle budget check. Delegates to `checkLimits(elapsed)`, so
7224
+ * `timeout` and `idle_timeout` follow the SAME negotiation path as the other
7225
+ * kinds they are NOT a special-cased hard stop. This is deliberate: a
7226
+ * heartbeat-aware policy (see `attachAutoExtend` and `CollabSession`) grants
7227
+ * a timeout extension only while the agent is making progress and denies it
7228
+ * once the agent is genuinely stuck, which is safer than an unconditional
7229
+ * hard kill of a long-but-working agent. The runner translates the resulting
7230
+ * `BudgetThresholdSignal` decision (`extend` → patch limits in place,
7231
+ * `stop` → abort) just like every other kind.
7217
7232
  *
7218
- * Decision table:
7219
- * - no `onThreshold` handler → throw `BudgetExceededError`
7220
- * - `mode === 'sync'` → throw `BudgetExceededError`
7221
- * - `mode === 'auto'` + no listener → throw `BudgetExceededError`
7222
- * - `mode === 'auto'` + listener → throw `BudgetExceededError` (timeout is not extendable)
7233
+ * Decision table (same as `checkLimits`):
7234
+ * - no `onThreshold` handler → throw `BudgetExceededError` (hard stop)
7235
+ * - `mode === 'sync'` → throw `BudgetExceededError` (hard stop)
7236
+ * - `mode === 'auto'` + no listener → throw `BudgetExceededError` (no one to ask)
7237
+ * - `mode === 'auto'` + listener → throw `BudgetThresholdSignal` (negotiated;
7238
+ * a heartbeat-aware policy may extend the timeout)
7223
7239
  */
7224
7240
  checkTimeout() {
7225
7241
  if (this.startTime === null) return;
@@ -9721,6 +9737,71 @@ Do not add prose, markdown, or code fences.`;
9721
9737
  };
9722
9738
  }
9723
9739
 
9740
+ // src/coordination/coordinator/error-classifier.ts
9741
+ function classifySubagentError(err, hints = {}) {
9742
+ const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
9743
+ if (err instanceof ProviderError) {
9744
+ const baseMessage2 = err.describe();
9745
+ return providerErrorToSubagentError(err, baseMessage2, cause);
9746
+ }
9747
+ const baseMessage = err instanceof Error ? err.message : String(err);
9748
+ if (err instanceof BudgetExceededError) {
9749
+ const map = {
9750
+ iterations: "budget_iterations",
9751
+ tool_calls: "budget_tool_calls",
9752
+ tokens: "budget_tokens",
9753
+ cost: "budget_cost",
9754
+ timeout: "budget_timeout",
9755
+ idle_timeout: "budget_timeout"
9756
+ };
9757
+ return {
9758
+ kind: map[err.kind],
9759
+ message: baseMessage,
9760
+ retryable: false,
9761
+ cause
9762
+ };
9763
+ }
9764
+ if (hints.parentAborted) {
9765
+ return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
9766
+ }
9767
+ const lower = baseMessage.toLowerCase();
9768
+ if (/agent aborted$/i.test(baseMessage)) {
9769
+ return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
9770
+ }
9771
+ if (/agent exhausted iteration limit$/i.test(baseMessage)) {
9772
+ return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
9773
+ }
9774
+ if (/empty response$/i.test(baseMessage)) {
9775
+ return { kind: "empty_response", message: baseMessage, retryable: false, cause };
9776
+ }
9777
+ if (/^tool failed: /i.test(baseMessage)) {
9778
+ return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
9779
+ }
9780
+ if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
9781
+ return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
9782
+ }
9783
+ if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
9784
+ return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
9785
+ }
9786
+ return { kind: "unknown", message: baseMessage, retryable: false, cause };
9787
+ }
9788
+ function providerErrorToSubagentError(err, message, cause) {
9789
+ const status = err.status;
9790
+ if (status === 429 || err.body?.type === "rate_limit_error") {
9791
+ return { kind: "provider_rate_limit", message, retryable: true, backoffMs: 5e3, cause };
9792
+ }
9793
+ if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
9794
+ return { kind: "provider_auth", message, retryable: false, cause };
9795
+ }
9796
+ if (status === 408 || status === 0) {
9797
+ return { kind: "provider_timeout", message, retryable: true, cause };
9798
+ }
9799
+ if (status >= 500 && status < 600) {
9800
+ return { kind: "provider_5xx", message, retryable: true, backoffMs: 3e3, cause };
9801
+ }
9802
+ return { kind: "unknown", message, retryable: err.retryable, cause };
9803
+ }
9804
+
9724
9805
  // src/coordination/fleet.ts
9725
9806
  var AUDIT_LOG_AGENT = {
9726
9807
  id: "audit-log",
@@ -10085,7 +10166,10 @@ var NICKNAME_POOL = {
10085
10166
  "lavoisier": { name: "Lavoisier", domain: "chemistry" },
10086
10167
  "mendeleev": { name: "Mendeleev", domain: "chemistry" }
10087
10168
  };
10088
- var ALL_NICKNAMES = Object.values(NICKNAME_POOL);
10169
+ var ALL_NICKNAMES = Object.entries(NICKNAME_POOL);
10170
+ var NAME_TO_KEY = Object.fromEntries(
10171
+ ALL_NICKNAMES.map(([key, entry]) => [entry.name, key])
10172
+ );
10089
10173
  var DOMAIN_PREFERENCES = {
10090
10174
  "security": ["shannon", "turing", "lamarr", "stallman"],
10091
10175
  "bug-hunter": ["darwin", "curie", "feynman", "fermi"],
@@ -10118,17 +10202,23 @@ function assignNickname(role, used) {
10118
10202
  for (const key of preferences) {
10119
10203
  const entry = NICKNAME_POOL[key];
10120
10204
  if (entry && !used.has(key)) {
10121
- return `${entry.name} (${formatRole(role)})`;
10205
+ return { key, display: `${entry.name} (${formatRole(role)})` };
10122
10206
  }
10123
10207
  }
10124
- for (const entry of ALL_NICKNAMES) {
10125
- const key = Object.entries(NICKNAME_POOL).find(([, v]) => v.name === entry.name)?.[0];
10126
- if (key && !used.has(key)) {
10127
- return `${entry.name} (${formatRole(role)})`;
10208
+ for (const [key, entry] of ALL_NICKNAMES) {
10209
+ if (!used.has(key)) {
10210
+ return { key, display: `${entry.name} (${formatRole(role)})` };
10128
10211
  }
10129
10212
  }
10130
10213
  const counter = used.size + 1;
10131
- return `Scientist #${counter} (${formatRole(role)})`;
10214
+ return { key: `scientist-${counter}`, display: `Scientist #${counter} (${formatRole(role)})` };
10215
+ }
10216
+ function nicknameKeyFromDisplay(display) {
10217
+ const base = display.replace(/\s*\([^)]*\)\s*$/, "").trim();
10218
+ const key = NAME_TO_KEY[base];
10219
+ if (key) return key;
10220
+ const synthesized = base.match(/^Scientist #(\d+)$/);
10221
+ return synthesized ? `scientist-${synthesized[1]}` : void 0;
10132
10222
  }
10133
10223
  function formatRole(role) {
10134
10224
  return role.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
@@ -10215,11 +10305,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
10215
10305
  const name = subagent.name?.trim() ?? "";
10216
10306
  const isPlaceholder = name === "" || name.toLowerCase() === role.toLowerCase() || name === "subagent" || name === "adhoc" || name === "generic" || /^slot-/.test(name);
10217
10307
  if (!isPlaceholder) return subagent;
10218
- const nickname = assignNickname(role, this.usedNicknames);
10219
- const baseKey = nickname.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-");
10220
- this.usedNicknames.add(baseKey);
10221
- this.subagentNicknames.set(subagentId, baseKey);
10222
- return { ...subagent, name: nickname };
10308
+ const { key, display } = assignNickname(role, this.usedNicknames);
10309
+ this.usedNicknames.add(key);
10310
+ this.subagentNicknames.set(subagentId, key);
10311
+ return { ...subagent, name: display };
10223
10312
  }
10224
10313
  async spawn(subagent) {
10225
10314
  const id = subagent.id || randomUUID();
@@ -10471,23 +10560,32 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
10471
10560
  */
10472
10561
  drainPendingAsAborted(message) {
10473
10562
  const dropped = this.pendingTasks.splice(0, this.pendingTasks.length);
10474
- for (const t of dropped) {
10475
- const synthetic = {
10476
- subagentId: t.subagentId ?? "unassigned",
10477
- taskId: t.id,
10478
- status: "stopped",
10479
- error: {
10480
- kind: "aborted_by_parent",
10481
- message,
10482
- retryable: false
10483
- },
10484
- iterations: 0,
10485
- toolCalls: 0,
10486
- durationMs: 0
10487
- };
10488
- this.completedResults.push(synthetic);
10489
- this.emit("task.completed", { task: t, result: synthetic });
10490
- }
10563
+ for (const t of dropped) this.emitPendingAborted(t, message);
10564
+ }
10565
+ /**
10566
+ * Emit a synthetic `stopped`/`aborted_by_parent` completion for a single
10567
+ * PENDING task — one that was never counted in `inFlight`. This MUST bypass
10568
+ * `recordCompletion`: that path does `inFlight--`, which for a pending task
10569
+ * steals a decrement from a genuinely in-flight task and trips the underflow
10570
+ * guard — suppressing that real task's `task.completed` and hanging its
10571
+ * `awaitTasks()` caller. Pushes the result and fires the event directly.
10572
+ */
10573
+ emitPendingAborted(task, message) {
10574
+ const synthetic = {
10575
+ subagentId: task.subagentId ?? "unassigned",
10576
+ taskId: task.id,
10577
+ status: "stopped",
10578
+ error: {
10579
+ kind: "aborted_by_parent",
10580
+ message,
10581
+ retryable: false
10582
+ },
10583
+ iterations: 0,
10584
+ toolCalls: 0,
10585
+ durationMs: 0
10586
+ };
10587
+ this.completedResults.push(synthetic);
10588
+ this.emit("task.completed", { task, result: synthetic });
10491
10589
  }
10492
10590
  async runDispatched(subagentId, task) {
10493
10591
  const subagent = this.subagents.get(subagentId);
@@ -10748,20 +10846,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
10748
10846
  const orphaned = this.pendingTasks.filter((t) => t.subagentId === subagentId);
10749
10847
  this.pendingTasks = this.pendingTasks.filter((t) => t.subagentId !== subagentId);
10750
10848
  for (const t of orphaned) {
10751
- const synthetic = {
10752
- subagentId,
10753
- taskId: t.id,
10754
- status: "stopped",
10755
- error: {
10756
- kind: "aborted_by_parent",
10757
- message: `Subagent "${subagentId}" was removed while task "${t.id}" was pending`,
10758
- retryable: false
10759
- },
10760
- iterations: 0,
10761
- toolCalls: 0,
10762
- durationMs: 0
10763
- };
10764
- this.recordCompletion(synthetic);
10849
+ this.emitPendingAborted(
10850
+ t,
10851
+ `Subagent "${subagentId}" was removed while task "${t.id}" was pending`
10852
+ );
10765
10853
  }
10766
10854
  this.fleetBus?.emit({
10767
10855
  subagentId,
@@ -10781,101 +10869,6 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
10781
10869
  return false;
10782
10870
  }
10783
10871
  };
10784
- function classifySubagentError(err, hints = {}) {
10785
- const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
10786
- if (err instanceof ProviderError) {
10787
- const baseMessage2 = err.describe();
10788
- return providerErrorToSubagentError(err, baseMessage2, cause);
10789
- }
10790
- const baseMessage = err instanceof Error ? err.message : String(err);
10791
- if (err instanceof BudgetExceededError) {
10792
- const map = {
10793
- iterations: "budget_iterations",
10794
- tool_calls: "budget_tool_calls",
10795
- tokens: "budget_tokens",
10796
- cost: "budget_cost",
10797
- timeout: "budget_timeout",
10798
- idle_timeout: "budget_timeout"
10799
- };
10800
- return {
10801
- kind: map[err.kind],
10802
- message: baseMessage,
10803
- // Budgets are user-configured ceilings, not transient failures —
10804
- // retrying with the same budget will hit the same ceiling. The
10805
- // orchestrator must raise the budget or narrow the task first.
10806
- retryable: false,
10807
- cause
10808
- };
10809
- }
10810
- if (hints.parentAborted) {
10811
- return {
10812
- kind: "aborted_by_parent",
10813
- message: baseMessage,
10814
- retryable: false,
10815
- cause
10816
- };
10817
- }
10818
- const lower = baseMessage.toLowerCase();
10819
- if (/agent aborted$/i.test(baseMessage)) {
10820
- return {
10821
- kind: "aborted_by_parent",
10822
- message: baseMessage,
10823
- retryable: false,
10824
- cause
10825
- };
10826
- }
10827
- if (/agent exhausted iteration limit$/i.test(baseMessage)) {
10828
- return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
10829
- }
10830
- if (/empty response$/i.test(baseMessage)) {
10831
- return { kind: "empty_response", message: baseMessage, retryable: false, cause };
10832
- }
10833
- if (/^tool failed: /i.test(baseMessage)) {
10834
- return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
10835
- }
10836
- if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
10837
- return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
10838
- }
10839
- if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
10840
- return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
10841
- }
10842
- return {
10843
- kind: "unknown",
10844
- message: baseMessage,
10845
- retryable: false,
10846
- cause
10847
- };
10848
- }
10849
- function providerErrorToSubagentError(err, message, cause) {
10850
- const status = err.status;
10851
- if (status === 429 || err.body?.type === "rate_limit_error") {
10852
- return {
10853
- kind: "provider_rate_limit",
10854
- message,
10855
- retryable: true,
10856
- // Conservative default: 5s. Provider-specific code can override
10857
- // by emitting an error whose body carries an explicit hint.
10858
- backoffMs: 5e3,
10859
- cause
10860
- };
10861
- }
10862
- if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
10863
- return { kind: "provider_auth", message, retryable: false, cause };
10864
- }
10865
- if (status === 408 || status === 0) {
10866
- return { kind: "provider_timeout", message, retryable: true, cause };
10867
- }
10868
- if (status >= 500 && status < 600) {
10869
- return {
10870
- kind: "provider_5xx",
10871
- message,
10872
- retryable: true,
10873
- backoffMs: 3e3,
10874
- cause
10875
- };
10876
- }
10877
- return { kind: "unknown", message, retryable: err.retryable, cause };
10878
- }
10879
10872
 
10880
10873
  // src/execution/parallel-eternal-engine.ts
10881
10874
  function sleep2(ms) {
@@ -11139,6 +11132,7 @@ ${personaLine}Task: ${task}
11139
11132
  } catch {
11140
11133
  results = coordinator.results().slice(-taskIds.length);
11141
11134
  }
11135
+ await Promise.allSettled(subagentIds.map((id) => coordinator.remove(id)));
11142
11136
  const allSuccessful = results.length > 0 && results.every((r) => r.status === "success");
11143
11137
  const goalComplete = results.some(
11144
11138
  (r) => r.status === "success" && typeof r.result === "string" && GOAL_COMPLETE_MARKER2.test(r.result)
@@ -12198,6 +12192,10 @@ Emit each evaluation immediately. Do not wait until you have read all reports.`;
12198
12192
  return lines.join("\n");
12199
12193
  }
12200
12194
  cleanup() {
12195
+ if (this._timeoutTimer) {
12196
+ clearTimeout(this._timeoutTimer);
12197
+ this._timeoutTimer = void 0;
12198
+ }
12201
12199
  for (const dispose of this.disposers) dispose();
12202
12200
  this.disposers.length = 0;
12203
12201
  }
@@ -13005,7 +13003,7 @@ function resolveModelMatrix(matrix, role) {
13005
13003
  return void 0;
13006
13004
  }
13007
13005
 
13008
- // src/coordination/director.ts
13006
+ // src/coordination/director/director-errors.ts
13009
13007
  var FleetSpawnBudgetError = class extends Error {
13010
13008
  kind;
13011
13009
  limit;
@@ -13047,6 +13045,8 @@ var FleetContextOverflowError = class extends Error {
13047
13045
  this.observed = observed;
13048
13046
  }
13049
13047
  };
13048
+
13049
+ // src/coordination/director.ts
13050
13050
  var Director = class _Director {
13051
13051
  /** Alias for the ICoordinator contract. `id` is retained for backward compatibility. */
13052
13052
  get coordinatorId() {
@@ -13315,18 +13315,20 @@ var Director = class _Director {
13315
13315
  if (e.subagentId.startsWith("bug-hunter-") || e.subagentId.startsWith("refactor-planner-") || e.subagentId.startsWith("critic-")) {
13316
13316
  return;
13317
13317
  }
13318
- if (payload.kind === "timeout") {
13318
+ if (payload.kind === "timeout" || payload.kind === "idle_timeout") {
13319
+ const heartbeatKey = `${e.subagentId}:${payload.kind}`;
13319
13320
  const progress = progressBySubagent.get(e.subagentId) ?? 0;
13320
- const lastProgress = lastTimeoutProgress.get(e.subagentId) ?? -1;
13321
+ const lastProgress = lastTimeoutProgress.get(heartbeatKey) ?? -1;
13321
13322
  if (progress <= lastProgress) {
13322
13323
  payload.deny();
13323
13324
  return;
13324
13325
  }
13325
- lastTimeoutProgress.set(e.subagentId, progress);
13326
+ lastTimeoutProgress.set(heartbeatKey, progress);
13327
+ const field = payload.kind === "timeout" ? "timeoutMs" : "idleTimeoutMs";
13326
13328
  setImmediate(() => {
13327
13329
  const newLimit = Math.min(Math.ceil(payload.limit * 2), 24 * 60 * 6e4);
13328
- this.recordExtension(e.subagentId, e.taskId, "timeout", newLimit);
13329
- payload.extend({ timeoutMs: newLimit });
13330
+ this.recordExtension(e.subagentId, e.taskId, payload.kind, newLimit);
13331
+ payload.extend({ [field]: newLimit });
13330
13332
  });
13331
13333
  return;
13332
13334
  }
@@ -13642,10 +13644,9 @@ var Director = class _Director {
13642
13644
  if (this.fleetManager) {
13643
13645
  this.fleetManager.assignNicknameAndRecord(config);
13644
13646
  } else {
13645
- config.name = assignNickname(role, this._usedNicknames);
13646
- this._usedNicknames.add(
13647
- config.name.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-")
13648
- );
13647
+ const { key, display } = assignNickname(role, this._usedNicknames);
13648
+ config.name = display;
13649
+ this._usedNicknames.add(key);
13649
13650
  }
13650
13651
  }
13651
13652
  result = await this.coordinator.spawn(config);
@@ -13967,8 +13968,8 @@ var Director = class _Director {
13967
13968
  } else {
13968
13969
  const entry = this.manifestEntries.get(subagentId);
13969
13970
  if (entry?.name) {
13970
- const nicknameKey = entry.name.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-");
13971
- this._usedNicknames.delete(nicknameKey);
13971
+ const nicknameKey = nicknameKeyFromDisplay(entry.name);
13972
+ if (nicknameKey) this._usedNicknames.delete(nicknameKey);
13972
13973
  }
13973
13974
  }
13974
13975
  this.manifestEntries.delete(subagentId);