@wrongstack/core 0.63.4 → 0.66.13

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 +87 -69
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/defaults/index.d.ts +22 -22
  10. package/dist/defaults/index.js +113 -84
  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 +59 -51
  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 +647 -677
  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-VApKRxcp.d.ts} +6 -7
  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 +58 -51
  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-VApKRxcp.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;
@@ -10085,7 +10101,10 @@ var NICKNAME_POOL = {
10085
10101
  "lavoisier": { name: "Lavoisier", domain: "chemistry" },
10086
10102
  "mendeleev": { name: "Mendeleev", domain: "chemistry" }
10087
10103
  };
10088
- var ALL_NICKNAMES = Object.values(NICKNAME_POOL);
10104
+ var ALL_NICKNAMES = Object.entries(NICKNAME_POOL);
10105
+ var NAME_TO_KEY = Object.fromEntries(
10106
+ ALL_NICKNAMES.map(([key, entry]) => [entry.name, key])
10107
+ );
10089
10108
  var DOMAIN_PREFERENCES = {
10090
10109
  "security": ["shannon", "turing", "lamarr", "stallman"],
10091
10110
  "bug-hunter": ["darwin", "curie", "feynman", "fermi"],
@@ -10118,17 +10137,23 @@ function assignNickname(role, used) {
10118
10137
  for (const key of preferences) {
10119
10138
  const entry = NICKNAME_POOL[key];
10120
10139
  if (entry && !used.has(key)) {
10121
- return `${entry.name} (${formatRole(role)})`;
10140
+ return { key, display: `${entry.name} (${formatRole(role)})` };
10122
10141
  }
10123
10142
  }
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)})`;
10143
+ for (const [key, entry] of ALL_NICKNAMES) {
10144
+ if (!used.has(key)) {
10145
+ return { key, display: `${entry.name} (${formatRole(role)})` };
10128
10146
  }
10129
10147
  }
10130
10148
  const counter = used.size + 1;
10131
- return `Scientist #${counter} (${formatRole(role)})`;
10149
+ return { key: `scientist-${counter}`, display: `Scientist #${counter} (${formatRole(role)})` };
10150
+ }
10151
+ function nicknameKeyFromDisplay(display) {
10152
+ const base = display.replace(/\s*\([^)]*\)\s*$/, "").trim();
10153
+ const key = NAME_TO_KEY[base];
10154
+ if (key) return key;
10155
+ const synthesized = base.match(/^Scientist #(\d+)$/);
10156
+ return synthesized ? `scientist-${synthesized[1]}` : void 0;
10132
10157
  }
10133
10158
  function formatRole(role) {
10134
10159
  return role.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
@@ -10215,11 +10240,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
10215
10240
  const name = subagent.name?.trim() ?? "";
10216
10241
  const isPlaceholder = name === "" || name.toLowerCase() === role.toLowerCase() || name === "subagent" || name === "adhoc" || name === "generic" || /^slot-/.test(name);
10217
10242
  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 };
10243
+ const { key, display } = assignNickname(role, this.usedNicknames);
10244
+ this.usedNicknames.add(key);
10245
+ this.subagentNicknames.set(subagentId, key);
10246
+ return { ...subagent, name: display };
10223
10247
  }
10224
10248
  async spawn(subagent) {
10225
10249
  const id = subagent.id || randomUUID();
@@ -10471,23 +10495,32 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
10471
10495
  */
10472
10496
  drainPendingAsAborted(message) {
10473
10497
  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
- }
10498
+ for (const t of dropped) this.emitPendingAborted(t, message);
10499
+ }
10500
+ /**
10501
+ * Emit a synthetic `stopped`/`aborted_by_parent` completion for a single
10502
+ * PENDING task — one that was never counted in `inFlight`. This MUST bypass
10503
+ * `recordCompletion`: that path does `inFlight--`, which for a pending task
10504
+ * steals a decrement from a genuinely in-flight task and trips the underflow
10505
+ * guard — suppressing that real task's `task.completed` and hanging its
10506
+ * `awaitTasks()` caller. Pushes the result and fires the event directly.
10507
+ */
10508
+ emitPendingAborted(task, message) {
10509
+ const synthetic = {
10510
+ subagentId: task.subagentId ?? "unassigned",
10511
+ taskId: task.id,
10512
+ status: "stopped",
10513
+ error: {
10514
+ kind: "aborted_by_parent",
10515
+ message,
10516
+ retryable: false
10517
+ },
10518
+ iterations: 0,
10519
+ toolCalls: 0,
10520
+ durationMs: 0
10521
+ };
10522
+ this.completedResults.push(synthetic);
10523
+ this.emit("task.completed", { task, result: synthetic });
10491
10524
  }
10492
10525
  async runDispatched(subagentId, task) {
10493
10526
  const subagent = this.subagents.get(subagentId);
@@ -10748,20 +10781,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
10748
10781
  const orphaned = this.pendingTasks.filter((t) => t.subagentId === subagentId);
10749
10782
  this.pendingTasks = this.pendingTasks.filter((t) => t.subagentId !== subagentId);
10750
10783
  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);
10784
+ this.emitPendingAborted(
10785
+ t,
10786
+ `Subagent "${subagentId}" was removed while task "${t.id}" was pending`
10787
+ );
10765
10788
  }
10766
10789
  this.fleetBus?.emit({
10767
10790
  subagentId,
@@ -11139,6 +11162,7 @@ ${personaLine}Task: ${task}
11139
11162
  } catch {
11140
11163
  results = coordinator.results().slice(-taskIds.length);
11141
11164
  }
11165
+ await Promise.allSettled(subagentIds.map((id) => coordinator.remove(id)));
11142
11166
  const allSuccessful = results.length > 0 && results.every((r) => r.status === "success");
11143
11167
  const goalComplete = results.some(
11144
11168
  (r) => r.status === "success" && typeof r.result === "string" && GOAL_COMPLETE_MARKER2.test(r.result)
@@ -12198,6 +12222,10 @@ Emit each evaluation immediately. Do not wait until you have read all reports.`;
12198
12222
  return lines.join("\n");
12199
12223
  }
12200
12224
  cleanup() {
12225
+ if (this._timeoutTimer) {
12226
+ clearTimeout(this._timeoutTimer);
12227
+ this._timeoutTimer = void 0;
12228
+ }
12201
12229
  for (const dispose of this.disposers) dispose();
12202
12230
  this.disposers.length = 0;
12203
12231
  }
@@ -13315,18 +13343,20 @@ var Director = class _Director {
13315
13343
  if (e.subagentId.startsWith("bug-hunter-") || e.subagentId.startsWith("refactor-planner-") || e.subagentId.startsWith("critic-")) {
13316
13344
  return;
13317
13345
  }
13318
- if (payload.kind === "timeout") {
13346
+ if (payload.kind === "timeout" || payload.kind === "idle_timeout") {
13347
+ const heartbeatKey = `${e.subagentId}:${payload.kind}`;
13319
13348
  const progress = progressBySubagent.get(e.subagentId) ?? 0;
13320
- const lastProgress = lastTimeoutProgress.get(e.subagentId) ?? -1;
13349
+ const lastProgress = lastTimeoutProgress.get(heartbeatKey) ?? -1;
13321
13350
  if (progress <= lastProgress) {
13322
13351
  payload.deny();
13323
13352
  return;
13324
13353
  }
13325
- lastTimeoutProgress.set(e.subagentId, progress);
13354
+ lastTimeoutProgress.set(heartbeatKey, progress);
13355
+ const field = payload.kind === "timeout" ? "timeoutMs" : "idleTimeoutMs";
13326
13356
  setImmediate(() => {
13327
13357
  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 });
13358
+ this.recordExtension(e.subagentId, e.taskId, payload.kind, newLimit);
13359
+ payload.extend({ [field]: newLimit });
13330
13360
  });
13331
13361
  return;
13332
13362
  }
@@ -13642,10 +13672,9 @@ var Director = class _Director {
13642
13672
  if (this.fleetManager) {
13643
13673
  this.fleetManager.assignNicknameAndRecord(config);
13644
13674
  } else {
13645
- config.name = assignNickname(role, this._usedNicknames);
13646
- this._usedNicknames.add(
13647
- config.name.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-")
13648
- );
13675
+ const { key, display } = assignNickname(role, this._usedNicknames);
13676
+ config.name = display;
13677
+ this._usedNicknames.add(key);
13649
13678
  }
13650
13679
  }
13651
13680
  result = await this.coordinator.spawn(config);
@@ -13967,8 +13996,8 @@ var Director = class _Director {
13967
13996
  } else {
13968
13997
  const entry = this.manifestEntries.get(subagentId);
13969
13998
  if (entry?.name) {
13970
- const nicknameKey = entry.name.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-");
13971
- this._usedNicknames.delete(nicknameKey);
13999
+ const nicknameKey = nicknameKeyFromDisplay(entry.name);
14000
+ if (nicknameKey) this._usedNicknames.delete(nicknameKey);
13972
14001
  }
13973
14002
  }
13974
14003
  this.manifestEntries.delete(subagentId);