@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,4 +1,4 @@
1
- import { Q as Tool, d as Context, P as Permission } from './context-iFMEO2rN.js';
1
+ import { Q as Tool, d as Context, P as Permission } from './context-y87Jc5ei.js';
2
2
 
3
3
  interface TrustPolicy {
4
4
  [toolNameOrPattern: string]: {
@@ -58,6 +58,10 @@ interface PermissionPolicy {
58
58
  getForceAllYolo?(): boolean;
59
59
  /** @deprecated Use `setYoloDestructive`. */
60
60
  setForceAllYolo?(enabled: boolean): void;
61
+ /** Query whether destructive-operation confirmation gate is active. */
62
+ getConfirmDestructive?(): boolean;
63
+ /** Enable/disable destructive-operation confirmation (only meaningful in yolo mode). */
64
+ setConfirmDestructive?(enabled: boolean): void;
61
65
  }
62
66
 
63
67
  export type { PermissionDecision as P, TrustPolicy as T, PermissionPolicy as a };
@@ -1,17 +1,25 @@
1
- import { Q as Tool, d as Context } from './context-iFMEO2rN.js';
1
+ import { Q as Tool, d as Context } from './context-y87Jc5ei.js';
2
2
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
3
- import { a as PermissionPolicy, P as PermissionDecision } from './permission-Ld-i5ugf.js';
3
+ import { a as PermissionPolicy, P as PermissionDecision } from './permission-C1A5whY5.js';
4
4
 
5
5
  interface PermissionPolicyOptions {
6
6
  trustFile: string;
7
7
  yolo?: boolean;
8
8
  /**
9
- * When true, YOLO mode allows even calls classified as truly destructive
10
- * without confirm. Corresponds to the `--yolo-destructive` CLI flag.
9
+ * When true, YOLO mode auto-approves even destructive calls without confirm.
10
+ * @deprecated YOLO now auto-approves everything by default. Use `confirmDestructive`
11
+ * to opt back into destructive-operation confirmation prompts.
11
12
  */
12
13
  yoloDestructive?: boolean;
13
- /** @deprecated Use `yoloDestructive`. Kept for `--force-all-yolo` compatibility. */
14
+ /** @deprecated Use `yoloDestructive`. */
14
15
  forceAllYolo?: boolean;
16
+ /**
17
+ * When true AND yolo is true, destructive operations still require confirmation.
18
+ * This is the opt-in safety net: set this if you want YOLO for normal work but
19
+ * explicit approval for `rm -rf`, project-escaping writes, etc.
20
+ * Has no effect when yolo is false (normal permission flow applies).
21
+ */
22
+ confirmDestructive?: boolean;
15
23
  promptDelegate?: (tool: Tool, input: unknown, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'deny'>;
16
24
  inputReader?: InputReader;
17
25
  }
@@ -21,6 +29,8 @@ declare class DefaultPermissionPolicy implements PermissionPolicy {
21
29
  private readonly trustFile;
22
30
  private yolo;
23
31
  private yoloDestructive;
32
+ /** When true, destructive ops still require confirmation even in YOLO mode. */
33
+ private confirmDestructive;
24
34
  /**
25
35
  * Session-scoped "soft deny" map. When the user presses 'n' (block once),
26
36
  * the tool+pattern is added here. If the LLM retries in the same session,
@@ -66,6 +76,10 @@ declare class DefaultPermissionPolicy implements PermissionPolicy {
66
76
  setYoloDestructive(enabled: boolean): void;
67
77
  /** Check whether the destructive YOLO override is active. */
68
78
  getYoloDestructive(): boolean;
79
+ /** Toggle destructive confirmation gate (only meaningful when yolo is active). */
80
+ setConfirmDestructive(enabled: boolean): void;
81
+ /** Check whether destructive confirmation gate is active. */
82
+ getConfirmDestructive(): boolean;
69
83
  /** @deprecated Use `setYoloDestructive`. */
70
84
  setForceAllYolo(enabled: boolean): void;
71
85
  /** @deprecated Use `getYoloDestructive`. */
@@ -1,10 +1,10 @@
1
- import { E as EventBus } from './events-k8CHjcrN.js';
1
+ import { E as EventBus } from './events-CIplI98R.js';
2
2
  import { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
3
- import { y as SessionStore, x as SessionMetadata, B as SessionWriter, r as ResumedSession, S as SessionData, z as SessionSummary, c as ContentBlock, w as SessionEvent, N as TodoItem, f as ConversationState } from './context-iFMEO2rN.js';
4
- import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-q2ThszgG.js';
3
+ import { y as SessionStore, x as SessionMetadata, B as SessionWriter, r as ResumedSession, S as SessionData, z as SessionSummary, c as ContentBlock, w as SessionEvent, N as TodoItem, f as ConversationState } from './context-y87Jc5ei.js';
4
+ import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-BIpwM60D.js';
5
5
  import { b as MemoryStore, a as MemoryScope } from './memory-CEXuo7sz.js';
6
6
  import { a as WstackPaths } from './wstack-paths-eMXnY1_X.js';
7
- import { c as ConfigStore, a as Config, b as ConfigLoader, u as SyncConfig } from './config-BdDuaZmB.js';
7
+ import { c as ConfigStore, a as Config, b as ConfigLoader, u as SyncConfig } from './config--86aHSln.js';
8
8
  import { S as SecretVault } from './secret-vault-DoISxaKO.js';
9
9
 
10
10
  interface SessionStoreOptions {
@@ -1,8 +1,8 @@
1
- import { E as EventBus } from './events-k8CHjcrN.js';
1
+ import { E as EventBus } from './events-CIplI98R.js';
2
2
  import { a as Logger } from './logger-DDd5C--Z.js';
3
3
  import { T as Tracer } from './observability-BhnVLBLS.js';
4
- import { m as Provider, p as Request, d as Context, q as Response } from './context-iFMEO2rN.js';
5
- import { a as RetryPolicy } from './retry-policy-BfBScewS.js';
4
+ import { m as Provider, p as Request, d as Context, q as Response } from './context-y87Jc5ei.js';
5
+ import { a as RetryPolicy } from './retry-policy-CG3qvH_e.js';
6
6
 
7
7
  /**
8
8
  * Options passed to a ProviderRunner when calling the provider.
@@ -1,4 +1,4 @@
1
- import { q as Response, d as Context, n as ProviderError } from './context-iFMEO2rN.js';
1
+ import { d as Context, q as Response, n as ProviderError } from './context-y87Jc5ei.js';
2
2
 
3
3
  type RecoveryDecision = {
4
4
  /**
@@ -1,16 +1,16 @@
1
1
  import { h as Specification, S as SpecAnalysis, g as SpecValidationResult, l as TaskGraph, m as TaskNode, k as TaskFilter, p as TaskSort, o as TaskProgress, r as TaskType, n as TaskPriority, e as SpecStatus, f as SpecTemplate, b as SpecRequirement } from '../task-graph-D1YQbpxF.js';
2
- import { E as EventBus } from '../events-k8CHjcrN.js';
3
- import { D as DoneCondition, u as TaskResult } from '../multi-agent-SASYOrWA.js';
4
- import { c as Agent } from '../index-Bc6BiP5q.js';
5
- import { A as AgentFactory } from '../agent-subagent-runner-Zc3f37Sg.js';
6
- import '../context-iFMEO2rN.js';
2
+ import { E as EventBus } from '../events-CIplI98R.js';
3
+ import { D as DoneCondition, A as Agent, c as AgentFactory, X as TaskResult } from '../agent-subagent-runner-DRZ9-NnR.js';
4
+ import '../context-y87Jc5ei.js';
5
+ import '../index-DKUvyTvV.js';
7
6
  import '../logger-DDd5C--Z.js';
8
- import '../system-prompt-7LHyBbIf.js';
9
- import '../config-BdDuaZmB.js';
7
+ import '../system-prompt-b61lOd49.js';
8
+ import '../config--86aHSln.js';
10
9
  import '../models-registry-BcYJDKLm.js';
11
10
  import '../observability-BhnVLBLS.js';
12
11
  import '../secret-scrubber-3MHDDAtm.js';
13
- import '../permission-Ld-i5ugf.js';
12
+ import '../permission-C1A5whY5.js';
13
+ import '../retry-policy-CG3qvH_e.js';
14
14
 
15
15
  declare class SpecParser {
16
16
  parse(content: string): Specification;
package/dist/sdd/index.js CHANGED
@@ -2867,15 +2867,22 @@ var SubagentBudget = class _SubagentBudget {
2867
2867
  void this.checkLimits();
2868
2868
  }
2869
2869
  /**
2870
- * Wall-clock budget check. Unlike other limits, timeout is always a hard stop
2871
- * wall-clock time cannot be "extended" by the coordinator, so it throws
2872
- * synchronously rather than entering the negotiation flow.
2870
+ * Wall-clock / idle budget check. Delegates to `checkLimits(elapsed)`, so
2871
+ * `timeout` and `idle_timeout` follow the SAME negotiation path as the other
2872
+ * kinds they are NOT a special-cased hard stop. This is deliberate: a
2873
+ * heartbeat-aware policy (see `attachAutoExtend` and `CollabSession`) grants
2874
+ * a timeout extension only while the agent is making progress and denies it
2875
+ * once the agent is genuinely stuck, which is safer than an unconditional
2876
+ * hard kill of a long-but-working agent. The runner translates the resulting
2877
+ * `BudgetThresholdSignal` decision (`extend` → patch limits in place,
2878
+ * `stop` → abort) just like every other kind.
2873
2879
  *
2874
- * Decision table:
2875
- * - no `onThreshold` handler → throw `BudgetExceededError`
2876
- * - `mode === 'sync'` → throw `BudgetExceededError`
2877
- * - `mode === 'auto'` + no listener → throw `BudgetExceededError`
2878
- * - `mode === 'auto'` + listener → throw `BudgetExceededError` (timeout is not extendable)
2880
+ * Decision table (same as `checkLimits`):
2881
+ * - no `onThreshold` handler → throw `BudgetExceededError` (hard stop)
2882
+ * - `mode === 'sync'` → throw `BudgetExceededError` (hard stop)
2883
+ * - `mode === 'auto'` + no listener → throw `BudgetExceededError` (no one to ask)
2884
+ * - `mode === 'auto'` + listener → throw `BudgetThresholdSignal` (negotiated;
2885
+ * a heartbeat-aware policy may extend the timeout)
2879
2886
  */
2880
2887
  checkTimeout() {
2881
2888
  if (this.startTime === null) return;
@@ -3190,6 +3197,71 @@ function providerStatusToCode(status, type) {
3190
3197
  return ERROR_CODES.PROVIDER_INVALID_REQUEST;
3191
3198
  }
3192
3199
 
3200
+ // src/coordination/coordinator/error-classifier.ts
3201
+ function classifySubagentError(err, hints = {}) {
3202
+ const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
3203
+ if (err instanceof ProviderError) {
3204
+ const baseMessage2 = err.describe();
3205
+ return providerErrorToSubagentError(err, baseMessage2, cause);
3206
+ }
3207
+ const baseMessage = err instanceof Error ? err.message : String(err);
3208
+ if (err instanceof BudgetExceededError) {
3209
+ const map = {
3210
+ iterations: "budget_iterations",
3211
+ tool_calls: "budget_tool_calls",
3212
+ tokens: "budget_tokens",
3213
+ cost: "budget_cost",
3214
+ timeout: "budget_timeout",
3215
+ idle_timeout: "budget_timeout"
3216
+ };
3217
+ return {
3218
+ kind: map[err.kind],
3219
+ message: baseMessage,
3220
+ retryable: false,
3221
+ cause
3222
+ };
3223
+ }
3224
+ if (hints.parentAborted) {
3225
+ return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
3226
+ }
3227
+ const lower = baseMessage.toLowerCase();
3228
+ if (/agent aborted$/i.test(baseMessage)) {
3229
+ return { kind: "aborted_by_parent", message: baseMessage, retryable: false, cause };
3230
+ }
3231
+ if (/agent exhausted iteration limit$/i.test(baseMessage)) {
3232
+ return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
3233
+ }
3234
+ if (/empty response$/i.test(baseMessage)) {
3235
+ return { kind: "empty_response", message: baseMessage, retryable: false, cause };
3236
+ }
3237
+ if (/^tool failed: /i.test(baseMessage)) {
3238
+ return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
3239
+ }
3240
+ if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
3241
+ return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
3242
+ }
3243
+ if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
3244
+ return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
3245
+ }
3246
+ return { kind: "unknown", message: baseMessage, retryable: false, cause };
3247
+ }
3248
+ function providerErrorToSubagentError(err, message, cause) {
3249
+ const status = err.status;
3250
+ if (status === 429 || err.body?.type === "rate_limit_error") {
3251
+ return { kind: "provider_rate_limit", message, retryable: true, backoffMs: 5e3, cause };
3252
+ }
3253
+ if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
3254
+ return { kind: "provider_auth", message, retryable: false, cause };
3255
+ }
3256
+ if (status === 408 || status === 0) {
3257
+ return { kind: "provider_timeout", message, retryable: true, cause };
3258
+ }
3259
+ if (status >= 500 && status < 600) {
3260
+ return { kind: "provider_5xx", message, retryable: true, backoffMs: 3e3, cause };
3261
+ }
3262
+ return { kind: "unknown", message, retryable: err.retryable, cause };
3263
+ }
3264
+
3193
3265
  // src/coordination/agents/types.ts
3194
3266
  var HOUR = 60 * 60 * 1e3;
3195
3267
  var LIGHT_BUDGET = {
@@ -5507,7 +5579,10 @@ var NICKNAME_POOL = {
5507
5579
  "lavoisier": { name: "Lavoisier", domain: "chemistry" },
5508
5580
  "mendeleev": { name: "Mendeleev", domain: "chemistry" }
5509
5581
  };
5510
- var ALL_NICKNAMES = Object.values(NICKNAME_POOL);
5582
+ var ALL_NICKNAMES = Object.entries(NICKNAME_POOL);
5583
+ Object.fromEntries(
5584
+ ALL_NICKNAMES.map(([key, entry]) => [entry.name, key])
5585
+ );
5511
5586
  var DOMAIN_PREFERENCES = {
5512
5587
  "security": ["shannon", "turing", "lamarr", "stallman"],
5513
5588
  "bug-hunter": ["darwin", "curie", "feynman", "fermi"],
@@ -5540,17 +5615,16 @@ function assignNickname(role, used) {
5540
5615
  for (const key of preferences) {
5541
5616
  const entry = NICKNAME_POOL[key];
5542
5617
  if (entry && !used.has(key)) {
5543
- return `${entry.name} (${formatRole(role)})`;
5618
+ return { key, display: `${entry.name} (${formatRole(role)})` };
5544
5619
  }
5545
5620
  }
5546
- for (const entry of ALL_NICKNAMES) {
5547
- const key = Object.entries(NICKNAME_POOL).find(([, v]) => v.name === entry.name)?.[0];
5548
- if (key && !used.has(key)) {
5549
- return `${entry.name} (${formatRole(role)})`;
5621
+ for (const [key, entry] of ALL_NICKNAMES) {
5622
+ if (!used.has(key)) {
5623
+ return { key, display: `${entry.name} (${formatRole(role)})` };
5550
5624
  }
5551
5625
  }
5552
5626
  const counter = used.size + 1;
5553
- return `Scientist #${counter} (${formatRole(role)})`;
5627
+ return { key: `scientist-${counter}`, display: `Scientist #${counter} (${formatRole(role)})` };
5554
5628
  }
5555
5629
  function formatRole(role) {
5556
5630
  return role.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
@@ -5637,11 +5711,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
5637
5711
  const name = subagent.name?.trim() ?? "";
5638
5712
  const isPlaceholder = name === "" || name.toLowerCase() === role.toLowerCase() || name === "subagent" || name === "adhoc" || name === "generic" || /^slot-/.test(name);
5639
5713
  if (!isPlaceholder) return subagent;
5640
- const nickname = assignNickname(role, this.usedNicknames);
5641
- const baseKey = nickname.split(" ")[0].toLowerCase().replace(/[^a-z0-9-]/g, "-");
5642
- this.usedNicknames.add(baseKey);
5643
- this.subagentNicknames.set(subagentId, baseKey);
5644
- return { ...subagent, name: nickname };
5714
+ const { key, display } = assignNickname(role, this.usedNicknames);
5715
+ this.usedNicknames.add(key);
5716
+ this.subagentNicknames.set(subagentId, key);
5717
+ return { ...subagent, name: display };
5645
5718
  }
5646
5719
  async spawn(subagent) {
5647
5720
  const id = subagent.id || randomUUID();
@@ -5893,23 +5966,32 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
5893
5966
  */
5894
5967
  drainPendingAsAborted(message) {
5895
5968
  const dropped = this.pendingTasks.splice(0, this.pendingTasks.length);
5896
- for (const t of dropped) {
5897
- const synthetic = {
5898
- subagentId: t.subagentId ?? "unassigned",
5899
- taskId: t.id,
5900
- status: "stopped",
5901
- error: {
5902
- kind: "aborted_by_parent",
5903
- message,
5904
- retryable: false
5905
- },
5906
- iterations: 0,
5907
- toolCalls: 0,
5908
- durationMs: 0
5909
- };
5910
- this.completedResults.push(synthetic);
5911
- this.emit("task.completed", { task: t, result: synthetic });
5912
- }
5969
+ for (const t of dropped) this.emitPendingAborted(t, message);
5970
+ }
5971
+ /**
5972
+ * Emit a synthetic `stopped`/`aborted_by_parent` completion for a single
5973
+ * PENDING task — one that was never counted in `inFlight`. This MUST bypass
5974
+ * `recordCompletion`: that path does `inFlight--`, which for a pending task
5975
+ * steals a decrement from a genuinely in-flight task and trips the underflow
5976
+ * guard — suppressing that real task's `task.completed` and hanging its
5977
+ * `awaitTasks()` caller. Pushes the result and fires the event directly.
5978
+ */
5979
+ emitPendingAborted(task, message) {
5980
+ const synthetic = {
5981
+ subagentId: task.subagentId ?? "unassigned",
5982
+ taskId: task.id,
5983
+ status: "stopped",
5984
+ error: {
5985
+ kind: "aborted_by_parent",
5986
+ message,
5987
+ retryable: false
5988
+ },
5989
+ iterations: 0,
5990
+ toolCalls: 0,
5991
+ durationMs: 0
5992
+ };
5993
+ this.completedResults.push(synthetic);
5994
+ this.emit("task.completed", { task, result: synthetic });
5913
5995
  }
5914
5996
  async runDispatched(subagentId, task) {
5915
5997
  const subagent = this.subagents.get(subagentId);
@@ -6170,20 +6252,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
6170
6252
  const orphaned = this.pendingTasks.filter((t) => t.subagentId === subagentId);
6171
6253
  this.pendingTasks = this.pendingTasks.filter((t) => t.subagentId !== subagentId);
6172
6254
  for (const t of orphaned) {
6173
- const synthetic = {
6174
- subagentId,
6175
- taskId: t.id,
6176
- status: "stopped",
6177
- error: {
6178
- kind: "aborted_by_parent",
6179
- message: `Subagent "${subagentId}" was removed while task "${t.id}" was pending`,
6180
- retryable: false
6181
- },
6182
- iterations: 0,
6183
- toolCalls: 0,
6184
- durationMs: 0
6185
- };
6186
- this.recordCompletion(synthetic);
6255
+ this.emitPendingAborted(
6256
+ t,
6257
+ `Subagent "${subagentId}" was removed while task "${t.id}" was pending`
6258
+ );
6187
6259
  }
6188
6260
  this.fleetBus?.emit({
6189
6261
  subagentId,
@@ -6203,101 +6275,6 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
6203
6275
  return false;
6204
6276
  }
6205
6277
  };
6206
- function classifySubagentError(err, hints = {}) {
6207
- const cause = err instanceof Error ? { name: err.name, message: err.message, stack: err.stack } : void 0;
6208
- if (err instanceof ProviderError) {
6209
- const baseMessage2 = err.describe();
6210
- return providerErrorToSubagentError(err, baseMessage2, cause);
6211
- }
6212
- const baseMessage = err instanceof Error ? err.message : String(err);
6213
- if (err instanceof BudgetExceededError) {
6214
- const map = {
6215
- iterations: "budget_iterations",
6216
- tool_calls: "budget_tool_calls",
6217
- tokens: "budget_tokens",
6218
- cost: "budget_cost",
6219
- timeout: "budget_timeout",
6220
- idle_timeout: "budget_timeout"
6221
- };
6222
- return {
6223
- kind: map[err.kind],
6224
- message: baseMessage,
6225
- // Budgets are user-configured ceilings, not transient failures —
6226
- // retrying with the same budget will hit the same ceiling. The
6227
- // orchestrator must raise the budget or narrow the task first.
6228
- retryable: false,
6229
- cause
6230
- };
6231
- }
6232
- if (hints.parentAborted) {
6233
- return {
6234
- kind: "aborted_by_parent",
6235
- message: baseMessage,
6236
- retryable: false,
6237
- cause
6238
- };
6239
- }
6240
- const lower = baseMessage.toLowerCase();
6241
- if (/agent aborted$/i.test(baseMessage)) {
6242
- return {
6243
- kind: "aborted_by_parent",
6244
- message: baseMessage,
6245
- retryable: false,
6246
- cause
6247
- };
6248
- }
6249
- if (/agent exhausted iteration limit$/i.test(baseMessage)) {
6250
- return { kind: "budget_iterations", message: baseMessage, retryable: false, cause };
6251
- }
6252
- if (/empty response$/i.test(baseMessage)) {
6253
- return { kind: "empty_response", message: baseMessage, retryable: false, cause };
6254
- }
6255
- if (/^tool failed: /i.test(baseMessage)) {
6256
- return { kind: "tool_failed", message: baseMessage, retryable: false, cause };
6257
- }
6258
- if (lower.includes("bridge transport") || /bridge.*(closed|disconnect)/i.test(baseMessage)) {
6259
- return { kind: "bridge_failed", message: baseMessage, retryable: false, cause };
6260
- }
6261
- if (/context length|max.*tokens?.*exceeded|prompt is too long/i.test(baseMessage)) {
6262
- return { kind: "context_overflow", message: baseMessage, retryable: false, cause };
6263
- }
6264
- return {
6265
- kind: "unknown",
6266
- message: baseMessage,
6267
- retryable: false,
6268
- cause
6269
- };
6270
- }
6271
- function providerErrorToSubagentError(err, message, cause) {
6272
- const status = err.status;
6273
- if (status === 429 || err.body?.type === "rate_limit_error") {
6274
- return {
6275
- kind: "provider_rate_limit",
6276
- message,
6277
- retryable: true,
6278
- // Conservative default: 5s. Provider-specific code can override
6279
- // by emitting an error whose body carries an explicit hint.
6280
- backoffMs: 5e3,
6281
- cause
6282
- };
6283
- }
6284
- if (status === 401 || status === 403 || err.body?.type === "authentication_error") {
6285
- return { kind: "provider_auth", message, retryable: false, cause };
6286
- }
6287
- if (status === 408 || status === 0) {
6288
- return { kind: "provider_timeout", message, retryable: true, cause };
6289
- }
6290
- if (status >= 500 && status < 600) {
6291
- return {
6292
- kind: "provider_5xx",
6293
- message,
6294
- retryable: true,
6295
- backoffMs: 3e3,
6296
- cause
6297
- };
6298
- }
6299
- return { kind: "unknown", message, retryable: err.retryable, cause };
6300
- }
6301
6278
 
6302
6279
  // src/sdd/sdd-parallel-run.ts
6303
6280
  var SddParallelRun = class {