@wrongstack/core 0.54.1 → 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 (63) hide show
  1. package/dist/{agent-bridge-Dnhw4tnM.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-Duhsf0ge.d.ts → compactor-D_ExJajC.d.ts} +1 -1
  4. package/dist/{config-bht0txXS.d.ts → config--86aHSln.d.ts} +112 -2
  5. package/dist/{context-DtPKqKYV.d.ts → context-y87Jc5ei.d.ts} +8 -8
  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 +365 -174
  11. package/dist/defaults/index.js.map +1 -1
  12. package/dist/{events-CbHTS4ZZ.d.ts → events-CIplI98R.d.ts} +20 -1
  13. package/dist/execution/index.d.ts +16 -385
  14. package/dist/execution/index.js +129 -61
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +7 -7
  17. package/dist/goal-store-C7jcumEh.d.ts +96 -0
  18. package/dist/index-DKUvyTvV.d.ts +560 -0
  19. package/dist/{index-ge5F2dnc.d.ts → index-b5uhfTSl.d.ts} +10 -8
  20. package/dist/index.d.ts +59 -33
  21. package/dist/index.js +1138 -733
  22. package/dist/index.js.map +1 -1
  23. package/dist/infrastructure/index.d.ts +6 -6
  24. package/dist/infrastructure/index.js +1 -1
  25. package/dist/infrastructure/index.js.map +1 -1
  26. package/dist/kernel/index.d.ts +9 -9
  27. package/dist/kernel/index.js +3 -1
  28. package/dist/kernel/index.js.map +1 -1
  29. package/dist/{mcp-servers-DE6gzBry.d.ts → mcp-servers-DwoNBf6r.d.ts} +3 -3
  30. package/dist/models/index.d.ts +2 -2
  31. package/dist/{multi-agent-coordinator-CjNX4uBD.d.ts → multi-agent-coordinator-CWnH-CiX.d.ts} +10 -2
  32. package/dist/{null-fleet-bus-BNiSlTna.d.ts → null-fleet-bus-VApKRxcp.d.ts} +6 -7
  33. package/dist/observability/index.d.ts +2 -2
  34. package/dist/parallel-eternal-engine-0UwotoSx.d.ts +483 -0
  35. package/dist/{path-resolver-Bax85amb.d.ts → path-resolver-DVkEcIw8.d.ts} +2 -2
  36. package/dist/{permission-Drm7LpPo.d.ts → permission-C1A5whY5.d.ts} +17 -1
  37. package/dist/{permission-policy-CU6sqWxF.d.ts → permission-policy-B2dK-T5N.d.ts} +28 -7
  38. package/dist/{plan-templates-CLRcurWN.d.ts → plan-templates-Bprrzhbu.d.ts} +4 -4
  39. package/dist/{provider-runner-BikCxGCx.d.ts → provider-runner-mXvXGSIw.d.ts} +3 -3
  40. package/dist/{retry-policy-Chtlvr5b.d.ts → retry-policy-CG3qvH_e.d.ts} +1 -1
  41. package/dist/sdd/index.d.ts +9 -9
  42. package/dist/sdd/index.js +59 -52
  43. package/dist/sdd/index.js.map +1 -1
  44. package/dist/security/index.d.ts +3 -3
  45. package/dist/security/index.js +144 -33
  46. package/dist/security/index.js.map +1 -1
  47. package/dist/{selector-BvSPdJj6.d.ts → selector-RvBR_YRW.d.ts} +1 -1
  48. package/dist/session-event-bridge-CDHxcmQU.d.ts +93 -0
  49. package/dist/{session-reader-BGhzMir4.d.ts → session-reader-BIpwM60D.d.ts} +1 -1
  50. package/dist/storage/index.d.ts +7 -6
  51. package/dist/{system-prompt-dtzV_mLm.d.ts → system-prompt-b61lOd49.d.ts} +32 -2
  52. package/dist/types/index.d.ts +23 -14
  53. package/dist/types/index.js +62 -6
  54. package/dist/types/index.js.map +1 -1
  55. package/dist/utils/index.d.ts +2 -2
  56. package/dist/utils/index.js.map +1 -1
  57. package/package.json +1 -1
  58. package/skills/multi-agent/SKILL.md +0 -2
  59. package/dist/agent-subagent-runner-By7jruZ_.d.ts +0 -182
  60. package/dist/goal-store-DwcTDDiX.d.ts +0 -188
  61. package/dist/index-CI271MjL.d.ts +0 -903
  62. package/dist/multi-agent-BmC_xiog.d.ts +0 -554
  63. package/dist/tool-executor-CgU0yWpB.d.ts +0 -110
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;
@@ -5507,7 +5514,10 @@ var NICKNAME_POOL = {
5507
5514
  "lavoisier": { name: "Lavoisier", domain: "chemistry" },
5508
5515
  "mendeleev": { name: "Mendeleev", domain: "chemistry" }
5509
5516
  };
5510
- var ALL_NICKNAMES = Object.values(NICKNAME_POOL);
5517
+ var ALL_NICKNAMES = Object.entries(NICKNAME_POOL);
5518
+ Object.fromEntries(
5519
+ ALL_NICKNAMES.map(([key, entry]) => [entry.name, key])
5520
+ );
5511
5521
  var DOMAIN_PREFERENCES = {
5512
5522
  "security": ["shannon", "turing", "lamarr", "stallman"],
5513
5523
  "bug-hunter": ["darwin", "curie", "feynman", "fermi"],
@@ -5540,17 +5550,16 @@ function assignNickname(role, used) {
5540
5550
  for (const key of preferences) {
5541
5551
  const entry = NICKNAME_POOL[key];
5542
5552
  if (entry && !used.has(key)) {
5543
- return `${entry.name} (${formatRole(role)})`;
5553
+ return { key, display: `${entry.name} (${formatRole(role)})` };
5544
5554
  }
5545
5555
  }
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)})`;
5556
+ for (const [key, entry] of ALL_NICKNAMES) {
5557
+ if (!used.has(key)) {
5558
+ return { key, display: `${entry.name} (${formatRole(role)})` };
5550
5559
  }
5551
5560
  }
5552
5561
  const counter = used.size + 1;
5553
- return `Scientist #${counter} (${formatRole(role)})`;
5562
+ return { key: `scientist-${counter}`, display: `Scientist #${counter} (${formatRole(role)})` };
5554
5563
  }
5555
5564
  function formatRole(role) {
5556
5565
  return role.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
@@ -5637,11 +5646,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
5637
5646
  const name = subagent.name?.trim() ?? "";
5638
5647
  const isPlaceholder = name === "" || name.toLowerCase() === role.toLowerCase() || name === "subagent" || name === "adhoc" || name === "generic" || /^slot-/.test(name);
5639
5648
  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 };
5649
+ const { key, display } = assignNickname(role, this.usedNicknames);
5650
+ this.usedNicknames.add(key);
5651
+ this.subagentNicknames.set(subagentId, key);
5652
+ return { ...subagent, name: display };
5645
5653
  }
5646
5654
  async spawn(subagent) {
5647
5655
  const id = subagent.id || randomUUID();
@@ -5893,23 +5901,32 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
5893
5901
  */
5894
5902
  drainPendingAsAborted(message) {
5895
5903
  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
- }
5904
+ for (const t of dropped) this.emitPendingAborted(t, message);
5905
+ }
5906
+ /**
5907
+ * Emit a synthetic `stopped`/`aborted_by_parent` completion for a single
5908
+ * PENDING task — one that was never counted in `inFlight`. This MUST bypass
5909
+ * `recordCompletion`: that path does `inFlight--`, which for a pending task
5910
+ * steals a decrement from a genuinely in-flight task and trips the underflow
5911
+ * guard — suppressing that real task's `task.completed` and hanging its
5912
+ * `awaitTasks()` caller. Pushes the result and fires the event directly.
5913
+ */
5914
+ emitPendingAborted(task, message) {
5915
+ const synthetic = {
5916
+ subagentId: task.subagentId ?? "unassigned",
5917
+ taskId: task.id,
5918
+ status: "stopped",
5919
+ error: {
5920
+ kind: "aborted_by_parent",
5921
+ message,
5922
+ retryable: false
5923
+ },
5924
+ iterations: 0,
5925
+ toolCalls: 0,
5926
+ durationMs: 0
5927
+ };
5928
+ this.completedResults.push(synthetic);
5929
+ this.emit("task.completed", { task, result: synthetic });
5913
5930
  }
5914
5931
  async runDispatched(subagentId, task) {
5915
5932
  const subagent = this.subagents.get(subagentId);
@@ -6170,20 +6187,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
6170
6187
  const orphaned = this.pendingTasks.filter((t) => t.subagentId === subagentId);
6171
6188
  this.pendingTasks = this.pendingTasks.filter((t) => t.subagentId !== subagentId);
6172
6189
  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);
6190
+ this.emitPendingAborted(
6191
+ t,
6192
+ `Subagent "${subagentId}" was removed while task "${t.id}" was pending`
6193
+ );
6187
6194
  }
6188
6195
  this.fleetBus?.emit({
6189
6196
  subagentId,
@@ -6397,7 +6404,7 @@ var SddParallelRun = class {
6397
6404
  "\u2500\u2500 EXECUTION PROTOCOL \u2500\u2500",
6398
6405
  "\u2022 Execute the assigned SDD task end-to-end using multiple tool calls.",
6399
6406
  "\u2022 Mark the task [done] in the tracker when complete.",
6400
- "\u2022 Do not ask for confirmation.",
6407
+ "\u2022 Do not ask before routine in-project tool use; if a permission gate appears, wait for that flow.",
6401
6408
  "\u2022 Keep output concise \u2014 summarize changes, do not transcribe files."
6402
6409
  ].join("\n");
6403
6410
  const spawns = subagentIds.map(