@wrongstack/core 0.89.1 → 0.104.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 (87) hide show
  1. package/dist/{agent-bridge-B8F2ORwg.d.ts → agent-bridge-mOxbpFcg.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CQaLFNnA.d.ts → agent-subagent-runner-DukQLUcS.d.ts} +433 -433
  3. package/dist/{events-DzyLtja6.d.ts → brain-Dfv4Y82E.d.ts} +179 -92
  4. package/dist/{compactor-CJq7LQev.d.ts → compactor-DXLxLcmU.d.ts} +2 -2
  5. package/dist/{config-_DZ7dN-T.d.ts → config-BSU-6vah.d.ts} +45 -38
  6. package/dist/{context-ToHAp4-U.d.ts → context-CNRYfhUv.d.ts} +1 -1
  7. package/dist/coordination/index.d.ts +16 -17
  8. package/dist/coordination/index.js +128 -37
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +34 -35
  11. package/dist/defaults/index.js +752 -218
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
  14. package/dist/execution/index.d.ts +65 -370
  15. package/dist/execution/index.js +446 -53
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/extension/index.d.ts +9 -10
  18. package/dist/extension/index.js +8 -6
  19. package/dist/extension/index.js.map +1 -1
  20. package/dist/goal-preamble-CI8lxeY1.d.ts +378 -0
  21. package/dist/{goal-store-DvWLNu52.d.ts → goal-store-ht0VmR1A.d.ts} +63 -21
  22. package/dist/{index-Ca_lOmKl.d.ts → index-BWRN6wOb.d.ts} +13 -15
  23. package/dist/{index-Dx-CnrDN.d.ts → index-DIKEcfgC.d.ts} +9 -10
  24. package/dist/index.d.ts +188 -176
  25. package/dist/index.js +1508 -407
  26. package/dist/index.js.map +1 -1
  27. package/dist/infrastructure/index.d.ts +9 -9
  28. package/dist/infrastructure/index.js +4 -2
  29. package/dist/infrastructure/index.js.map +1 -1
  30. package/dist/kernel/index.d.ts +14 -16
  31. package/dist/kernel/index.js.map +1 -1
  32. package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
  33. package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
  34. package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-CXCsANdY.d.ts} +3 -3
  35. package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +8 -6
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
  40. package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
  41. package/dist/{multi-agent-coordinator-Da9nd8Ic.d.ts → multi-agent-coordinator-51LvnXkD.d.ts} +2 -2
  42. package/dist/{null-fleet-bus-CHJOXv3t.d.ts → null-fleet-bus-D09hMzFQ.d.ts} +32 -31
  43. package/dist/observability/index.d.ts +3 -3
  44. package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
  45. package/dist/{parallel-eternal-engine-DyMCj2Pw.d.ts → parallel-eternal-engine-CUtmM_0V.d.ts} +54 -35
  46. package/dist/{path-resolver-TjBlRKyH.d.ts → path-resolver-DDJiMAtX.d.ts} +3 -3
  47. package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
  48. package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
  49. package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-BqiA_UMr.d.ts} +73 -73
  50. package/dist/{plan-templates-D9UhwoGh.d.ts → plan-templates-BdDxl9cI.d.ts} +79 -11
  51. package/dist/{provider-runner-BEPWwkxH.d.ts → provider-runner-BUunikwY.d.ts} +5 -5
  52. package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
  53. package/dist/sdd/index.d.ts +17 -33
  54. package/dist/sdd/index.js +145 -36
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
  57. package/dist/security/index.d.ts +4 -5
  58. package/dist/security/index.js +4 -2
  59. package/dist/security/index.js.map +1 -1
  60. package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
  61. package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-BpJ5trO9.d.ts} +2 -2
  62. package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
  63. package/dist/{skill-BJeF2DwY.d.ts → skill-Bj6Ezqb8.d.ts} +1 -1
  64. package/dist/skills/index.d.ts +1 -1
  65. package/dist/skills/index.js +3 -9
  66. package/dist/skills/index.js.map +1 -1
  67. package/dist/spec-TBi3Jr6T.d.ts +78 -0
  68. package/dist/storage/index.d.ts +145 -13
  69. package/dist/storage/index.js +990 -172
  70. package/dist/storage/index.js.map +1 -1
  71. package/dist/task-format-vGOIftmK.d.ts +23 -0
  72. package/dist/task-graph-u1q9Jkyk.d.ts +84 -0
  73. package/dist/types/index.d.ts +27 -28
  74. package/dist/types/index.js +19 -31
  75. package/dist/types/index.js.map +1 -1
  76. package/dist/utils/expect-defined.d.ts +7 -0
  77. package/dist/utils/expect-defined.js +11 -0
  78. package/dist/utils/expect-defined.js.map +1 -0
  79. package/dist/utils/index.d.ts +8 -20
  80. package/dist/utils/index.js +120 -41
  81. package/dist/utils/index.js.map +1 -1
  82. package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
  83. package/package.json +5 -1
  84. package/skills/tech-stack/SKILL.md +177 -0
  85. package/dist/memory-CEXuo7sz.d.ts +0 -16
  86. package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
  87. package/dist/task-graph-CikNdRTG.d.ts +0 -161
package/dist/sdd/index.js CHANGED
@@ -761,7 +761,7 @@ var TaskTracker = class {
761
761
  const blockers = this.getBlockers(taskId);
762
762
  return blockers.every((id) => {
763
763
  const node = this.graph?.nodes.get(id);
764
- return node?.status === "completed";
764
+ return node?.status === "completed" || node?.status === "failed";
765
765
  });
766
766
  }
767
767
  getProgress() {
@@ -793,7 +793,7 @@ var TaskTracker = class {
793
793
  const remainingBlockers = this.getBlockers(depId);
794
794
  const allUnblocked = remainingBlockers.every((id) => {
795
795
  const blocker = this.graph?.nodes.get(id);
796
- return blocker?.status === "completed";
796
+ return blocker?.status === "completed" || blocker?.status === "failed";
797
797
  });
798
798
  if (allUnblocked) {
799
799
  dep.status = "pending";
@@ -807,7 +807,7 @@ var TaskTracker = class {
807
807
  const blockers = this.getBlockers(taskId);
808
808
  const someBlocked = blockers.some((id) => {
809
809
  const blocker = this.graph?.nodes.get(id);
810
- return blocker?.status !== "completed";
810
+ return blocker?.status !== "completed" && blocker?.status !== "failed";
811
811
  });
812
812
  if (someBlocked) {
813
813
  const node = this.graph.nodes.get(taskId);
@@ -1243,13 +1243,15 @@ var TaskGraphStore = class {
1243
1243
  }
1244
1244
  };
1245
1245
 
1246
- // src/sdd/spec-builder.ts
1247
- function expectDefined(value) {
1246
+ // src/utils/expect-defined.ts
1247
+ function expectDefined(value, label) {
1248
1248
  if (value === null || value === void 0) {
1249
1249
  throw new Error("Expected value to be defined");
1250
1250
  }
1251
1251
  return value;
1252
1252
  }
1253
+
1254
+ // src/sdd/spec-builder.ts
1253
1255
  function buildQuestioningPrompt(session, min, max) {
1254
1256
  const answered = session.answers.length;
1255
1257
  const remaining = Math.max(0, min - answered);
@@ -2037,12 +2039,6 @@ function truncate(str, maxLen) {
2037
2039
  }
2038
2040
 
2039
2041
  // src/sdd/critical-path.ts
2040
- function expectDefined2(value) {
2041
- if (value === null || value === void 0) {
2042
- throw new Error("Expected value to be defined");
2043
- }
2044
- return value;
2045
- }
2046
2042
  function analyzeCriticalPath(graph) {
2047
2043
  const nodes = Array.from(graph.nodes.values());
2048
2044
  const topoOrder = topologicalSort(graph);
@@ -2118,7 +2114,7 @@ function getTransitiveBlocked(_graph, taskId, blocksMap) {
2118
2114
  const visited = /* @__PURE__ */ new Set();
2119
2115
  const queue = [taskId];
2120
2116
  while (queue.length > 0) {
2121
- const current = expectDefined2(queue.shift());
2117
+ const current = expectDefined(queue.shift());
2122
2118
  const blocked = blocksMap.get(current);
2123
2119
  if (!blocked) continue;
2124
2120
  for (const id of blocked) {
@@ -2164,7 +2160,7 @@ function computeCriticalPath(graph, _topoOrder, blockedByMap) {
2164
2160
  if (!changed) break;
2165
2161
  }
2166
2162
  let maxDist = 0;
2167
- let maxId = expectDefined2(allIds[0]);
2163
+ let maxId = expectDefined(allIds[0]);
2168
2164
  for (const id of allIds) {
2169
2165
  const d = dist.get(id) ?? 0;
2170
2166
  if (d > maxDist) {
@@ -2991,15 +2987,7 @@ function makeAgentSubagentRunner(opts) {
2991
2987
  let budgetError = null;
2992
2988
  const onBudgetError = (err) => {
2993
2989
  if (err instanceof BudgetThresholdSignal) {
2994
- err.decision.then((decision) => {
2995
- if (decision === "stop") {
2996
- budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
2997
- aborter.abort();
2998
- }
2999
- }).catch(() => {
3000
- budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
3001
- aborter.abort();
3002
- });
2990
+ budgetError = err;
3003
2991
  return;
3004
2992
  }
3005
2993
  aborter.abort();
@@ -3107,15 +3095,23 @@ function makeAgentSubagentRunner(opts) {
3107
3095
  }
3108
3096
  if (budgetError) {
3109
3097
  if ("decision" in budgetError) {
3110
- const decision = await budgetError.decision;
3111
- if (decision === "stop") {
3098
+ try {
3099
+ const decision = await budgetError.decision;
3100
+ if (decision === "stop") {
3101
+ budgetError = new BudgetExceededError(
3102
+ budgetError.kind,
3103
+ budgetError.limit,
3104
+ budgetError.used
3105
+ );
3106
+ } else {
3107
+ budgetError = null;
3108
+ }
3109
+ } catch {
3112
3110
  budgetError = new BudgetExceededError(
3113
3111
  budgetError.kind,
3114
3112
  budgetError.limit,
3115
3113
  budgetError.used
3116
3114
  );
3117
- } else {
3118
- budgetError = null;
3119
3115
  }
3120
3116
  }
3121
3117
  if (budgetError) throw budgetError;
@@ -5454,6 +5450,109 @@ Working rules:
5454
5450
  "cloud cost"
5455
5451
  ]
5456
5452
  }
5453
+ },
5454
+ {
5455
+ config: {
5456
+ id: "tech-stack",
5457
+ name: "Tech Stack Validator",
5458
+ role: "tech-stack",
5459
+ tools: ["search", "fetch", "read", "grep", "glob", "outdated", "audit", "json"],
5460
+ prompt: `You are the Tech Stack Validator \u2014 a single-shot validation agent that fires
5461
+ before any package, library, or framework choice is committed.
5462
+
5463
+ Your ONLY job: verify that a technology choice is current, real, and not obsolete.
5464
+ You are the "this isn't code, this is 10-year-old technology" agent. Intervene
5465
+ hard when the LLM hallucinates a version number or suggests dead tech.
5466
+
5467
+ ## Critical rules
5468
+
5469
+ 1. **Verify existence.** Search npm registry (fetch https://registry.npmjs.org/<pkg>/latest)
5470
+ or web search. A package that doesn't exist = hallucination.
5471
+
5472
+ 2. **Check latest version.** Never trust any version number from the model. Always
5473
+ fetch the actual latest stable version from npm or the project's release page.
5474
+
5475
+ 3. **Reject dead packages.** No release in >2 years + unresolved critical issues =
5476
+ dead. Suggest a maintained replacement.
5477
+
5478
+ 4. **Reject prehistoric tech.** Any package/pattern superseded \u22655 years ago is
5479
+ REJECTED. Key blocklist:
5480
+ - axios / node-fetch / got / request \u2192 native fetch (Node 18+)
5481
+ - moment \u2192 date-fns / luxon / Temporal
5482
+ - jQuery (new projects) \u2192 vanilla DOM / React
5483
+ - Gulp / Grunt \u2192 tsup / esbuild / vite
5484
+ - CoffeeScript / Flow \u2192 TypeScript
5485
+ - Bluebird \u2192 native Promises
5486
+ - crypto-js \u2192 node:crypto / Web Crypto
5487
+ - Bower \u2192 npm/pnpm
5488
+ - underscore \u2192 lodash or native ES2020+
5489
+
5490
+ 5. **The intervention phrase.** When rejecting on age grounds, you MUST output
5491
+ exactly: "This isn't code, this is X-year-old technology." where X =
5492
+ current year \u2212 the year the technology was made obsolete. Follow with
5493
+ what replaced it and a one-step migration path.
5494
+
5495
+ 6. **Prefer built-in over third-party.** Check Node 22+ native APIs first:
5496
+ node:test, node:sqlite, fetch, WebSocket, Web Crypto \u2014 all built-in.
5497
+
5498
+ ## Workflow (single-shot \u2014 do NOT loop)
5499
+
5500
+ 1. Receive the proposed package + version
5501
+ 2. Search npm registry or web for the latest version
5502
+ 3. Check age, maintenance status, deprecation
5503
+ 4. Output verdict: APPROVED (with exact version) or REJECTED (with replacement)
5504
+
5505
+ ## Output format
5506
+
5507
+ ### Tech Stack Validation \u2014 <package>
5508
+
5509
+ **Status**: APPROVED | REJECTED
5510
+
5511
+ **Package**: <name>@<version>
5512
+ **Source**: <URL you checked \u2014 npm registry, GitHub, web search>
5513
+ **Age**: <first release> \u2014 <last release date>
5514
+ **Verdict**: 1\u20132 sentence explanation.
5515
+
5516
+ When REJECTED on age:
5517
+ **"This isn't code, this is X-year-old technology."**
5518
+ **Replaced by**: <modern alternative>
5519
+ **Migration**: <one concrete step>
5520
+
5521
+ When APPROVED:
5522
+ **Install**: pnpm add <name>@^<major>.<minor>.0`
5523
+ },
5524
+ budget: {
5525
+ timeoutMs: 6e4,
5526
+ maxIterations: 5,
5527
+ maxToolCalls: 20,
5528
+ maxTokens: 4e4,
5529
+ maxCostUsd: 0.1
5530
+ },
5531
+ capability: {
5532
+ phase: "meta",
5533
+ summary: "Single-shot tech stack validator: checks npm for latest versions, rejects dead/obsolete packages, enforces modern alternatives.",
5534
+ keywords: [
5535
+ "tech stack",
5536
+ "version",
5537
+ "package",
5538
+ "library",
5539
+ "framework",
5540
+ "dependency",
5541
+ "install",
5542
+ "upgrade",
5543
+ "latest",
5544
+ "npm",
5545
+ "pnpm add",
5546
+ "outdated",
5547
+ "obsolete",
5548
+ "deprecated",
5549
+ "what version",
5550
+ "which package",
5551
+ "check version",
5552
+ "verify version",
5553
+ "is this current"
5554
+ ]
5555
+ }
5457
5556
  }
5458
5557
  ];
5459
5558
 
@@ -6364,25 +6463,22 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
6364
6463
  };
6365
6464
 
6366
6465
  // src/sdd/sdd-parallel-run.ts
6367
- function expectDefined3(value) {
6368
- if (value === null || value === void 0) {
6369
- throw new Error("Expected value to be defined");
6370
- }
6371
- return value;
6372
- }
6373
6466
  var SddParallelRun = class {
6374
6467
  constructor(opts) {
6375
6468
  this.opts = opts;
6376
6469
  this.slots = Math.min(16, Math.max(1, opts.parallelSlots ?? 4));
6377
6470
  this.timeoutMs = opts.taskTimeoutMs ?? 3e5;
6471
+ this.maxRetries = Math.max(0, opts.maxRetries ?? 2);
6378
6472
  this.decomposer = new SddTaskDecomposer(opts.tracker, opts.graph, { parallelSlots: this.slots });
6379
6473
  }
6380
6474
  opts;
6381
6475
  slots;
6382
6476
  timeoutMs;
6477
+ maxRetries;
6383
6478
  decomposer;
6384
6479
  coordinator = null;
6385
6480
  stopRequested = false;
6481
+ retryMap = /* @__PURE__ */ new Map();
6386
6482
  // -------------------------------------------------------------------
6387
6483
  // Public API
6388
6484
  // -------------------------------------------------------------------
@@ -6394,6 +6490,7 @@ var SddParallelRun = class {
6394
6490
  /** Execute all waves until completion or deadlock. Returns final summary. */
6395
6491
  async run() {
6396
6492
  this.stopRequested = false;
6493
+ this.retryMap.clear();
6397
6494
  const startTime = Date.now();
6398
6495
  let totalCompleted = 0;
6399
6496
  let totalFailed = 0;
@@ -6518,13 +6615,24 @@ var SddParallelRun = class {
6518
6615
  const successCount = results.filter((r) => r.status === "success").length;
6519
6616
  const failCount = results.length - successCount;
6520
6617
  for (let i = 0; i < results.length; i++) {
6521
- const result = expectDefined3(results[i]);
6522
- const taskId = expectDefined3(taskIds[i]);
6618
+ const result = expectDefined(results[i]);
6619
+ const taskId = expectDefined(taskIds[i]);
6523
6620
  if (result.status === "success") {
6524
6621
  this.opts.tracker.updateNodeStatus(taskId, "completed");
6622
+ this.retryMap.delete(taskId);
6525
6623
  } else {
6526
6624
  const errMsg = result.error?.kind ? `${result.error.kind}: ${result.error.message}` : result.error?.message ?? "unknown error";
6527
- this.opts.tracker.updateNodeStatus(taskId, "failed", errMsg);
6625
+ const currentRetries = this.retryMap.get(taskId) ?? 0;
6626
+ if (currentRetries < this.maxRetries) {
6627
+ this.retryMap.set(taskId, currentRetries + 1);
6628
+ this.opts.tracker.updateNodeStatus(
6629
+ taskId,
6630
+ "pending",
6631
+ `Retry ${currentRetries + 1}/${this.maxRetries}: ${errMsg}`
6632
+ );
6633
+ } else {
6634
+ this.opts.tracker.updateNodeStatus(taskId, "failed", errMsg);
6635
+ }
6528
6636
  }
6529
6637
  }
6530
6638
  return {
@@ -6539,6 +6647,7 @@ var SddParallelRun = class {
6539
6647
  }
6540
6648
  buildProgress() {
6541
6649
  const gp = this.opts.tracker.getProgress();
6650
+ const isDeadlocked = !this.decomposer.isDone() && this.decomposer.nextBatch().deadlocked;
6542
6651
  return {
6543
6652
  wave: this.decomposer.getWaveCount(),
6544
6653
  total: gp.total,
@@ -6548,7 +6657,7 @@ var SddParallelRun = class {
6548
6657
  blocked: gp.blocked,
6549
6658
  pending: gp.pending,
6550
6659
  percent: gp.percentComplete,
6551
- deadlocked: false
6660
+ deadlocked: isDeadlocked
6552
6661
  };
6553
6662
  }
6554
6663
  };