@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
@@ -2,15 +2,9 @@ import { randomUUID, randomBytes } from 'crypto';
2
2
  import * as fsp6 from 'fs/promises';
3
3
  import * as path4 from 'path';
4
4
  import { isAbsolute, resolve } from 'path';
5
+ import { hostname } from 'os';
5
6
  import { EventEmitter } from 'events';
6
7
 
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
-
14
8
  // src/coordination/brain.ts
15
9
  var ObservableBrainArbiter = class {
16
10
  constructor(inner, events) {
@@ -236,7 +230,7 @@ async function acquireDirectorStateLock(lockPath, processId = process.pid) {
236
230
  }
237
231
  const lock = {
238
232
  pid: processId,
239
- hostname: __require("os").hostname(),
233
+ hostname: hostname(),
240
234
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
241
235
  };
242
236
  await atomicWrite(lockPath, JSON.stringify(lock), { mode: 384 });
@@ -543,7 +537,9 @@ function createMessage(type, from, payload, to) {
543
537
  priority: "normal"
544
538
  };
545
539
  }
546
- function expectDefined(value) {
540
+
541
+ // src/utils/expect-defined.ts
542
+ function expectDefined(value, label) {
547
543
  if (value === null || value === void 0) {
548
544
  throw new Error("Expected value to be defined");
549
545
  }
@@ -688,6 +684,7 @@ var CollabSession = class extends EventEmitter {
688
684
  settled = false;
689
685
  timeoutMs;
690
686
  cancelled = false;
687
+ _raceResolved = false;
691
688
  alerts = [];
692
689
  snapshotWarnings = [];
693
690
  /** Tracks tool call counts per subagent for progress-based timeout decisions. */
@@ -784,7 +781,7 @@ var CollabSession = class extends EventEmitter {
784
781
  * Safe to call multiple times (idempotent after first call).
785
782
  */
786
783
  cancel(reason = "Director cancelled collab session") {
787
- if (this.settled) return;
784
+ if (this.cancelled) return;
788
785
  this.cancelled = true;
789
786
  if (this._timeoutTimer) {
790
787
  clearTimeout(this._timeoutTimer);
@@ -822,6 +819,7 @@ var CollabSession = class extends EventEmitter {
822
819
  this.subagentIds.set("critic", criticId);
823
820
  const timeout = new Promise((_, reject) => {
824
821
  this._timeoutTimer = setTimeout(() => {
822
+ if (this._raceResolved) return;
825
823
  this.cancel("Session-level timeout reached");
826
824
  reject(new Error(`CollabSession timed out after ${this.timeoutMs}ms`));
827
825
  }, this.timeoutMs);
@@ -837,6 +835,7 @@ var CollabSession = class extends EventEmitter {
837
835
  timeout
838
836
  ]);
839
837
  } catch (err) {
838
+ this._raceResolved = true;
840
839
  if (this._timeoutTimer) {
841
840
  clearTimeout(this._timeoutTimer);
842
841
  this._timeoutTimer = void 0;
@@ -851,6 +850,7 @@ var CollabSession = class extends EventEmitter {
851
850
  }
852
851
  this.snapshotWarnings = await this.checkSnapshotFreshness();
853
852
  const report = this.assembleReport();
853
+ this._raceResolved = true;
854
854
  this.cleanup();
855
855
  this.emit("session.done", report);
856
856
  return report;
@@ -3487,6 +3487,109 @@ Working rules:
3487
3487
  "cloud cost"
3488
3488
  ]
3489
3489
  }
3490
+ },
3491
+ {
3492
+ config: {
3493
+ id: "tech-stack",
3494
+ name: "Tech Stack Validator",
3495
+ role: "tech-stack",
3496
+ tools: ["search", "fetch", "read", "grep", "glob", "outdated", "audit", "json"],
3497
+ prompt: `You are the Tech Stack Validator \u2014 a single-shot validation agent that fires
3498
+ before any package, library, or framework choice is committed.
3499
+
3500
+ Your ONLY job: verify that a technology choice is current, real, and not obsolete.
3501
+ You are the "this isn't code, this is 10-year-old technology" agent. Intervene
3502
+ hard when the LLM hallucinates a version number or suggests dead tech.
3503
+
3504
+ ## Critical rules
3505
+
3506
+ 1. **Verify existence.** Search npm registry (fetch https://registry.npmjs.org/<pkg>/latest)
3507
+ or web search. A package that doesn't exist = hallucination.
3508
+
3509
+ 2. **Check latest version.** Never trust any version number from the model. Always
3510
+ fetch the actual latest stable version from npm or the project's release page.
3511
+
3512
+ 3. **Reject dead packages.** No release in >2 years + unresolved critical issues =
3513
+ dead. Suggest a maintained replacement.
3514
+
3515
+ 4. **Reject prehistoric tech.** Any package/pattern superseded \u22655 years ago is
3516
+ REJECTED. Key blocklist:
3517
+ - axios / node-fetch / got / request \u2192 native fetch (Node 18+)
3518
+ - moment \u2192 date-fns / luxon / Temporal
3519
+ - jQuery (new projects) \u2192 vanilla DOM / React
3520
+ - Gulp / Grunt \u2192 tsup / esbuild / vite
3521
+ - CoffeeScript / Flow \u2192 TypeScript
3522
+ - Bluebird \u2192 native Promises
3523
+ - crypto-js \u2192 node:crypto / Web Crypto
3524
+ - Bower \u2192 npm/pnpm
3525
+ - underscore \u2192 lodash or native ES2020+
3526
+
3527
+ 5. **The intervention phrase.** When rejecting on age grounds, you MUST output
3528
+ exactly: "This isn't code, this is X-year-old technology." where X =
3529
+ current year \u2212 the year the technology was made obsolete. Follow with
3530
+ what replaced it and a one-step migration path.
3531
+
3532
+ 6. **Prefer built-in over third-party.** Check Node 22+ native APIs first:
3533
+ node:test, node:sqlite, fetch, WebSocket, Web Crypto \u2014 all built-in.
3534
+
3535
+ ## Workflow (single-shot \u2014 do NOT loop)
3536
+
3537
+ 1. Receive the proposed package + version
3538
+ 2. Search npm registry or web for the latest version
3539
+ 3. Check age, maintenance status, deprecation
3540
+ 4. Output verdict: APPROVED (with exact version) or REJECTED (with replacement)
3541
+
3542
+ ## Output format
3543
+
3544
+ ### Tech Stack Validation \u2014 <package>
3545
+
3546
+ **Status**: APPROVED | REJECTED
3547
+
3548
+ **Package**: <name>@<version>
3549
+ **Source**: <URL you checked \u2014 npm registry, GitHub, web search>
3550
+ **Age**: <first release> \u2014 <last release date>
3551
+ **Verdict**: 1\u20132 sentence explanation.
3552
+
3553
+ When REJECTED on age:
3554
+ **"This isn't code, this is X-year-old technology."**
3555
+ **Replaced by**: <modern alternative>
3556
+ **Migration**: <one concrete step>
3557
+
3558
+ When APPROVED:
3559
+ **Install**: pnpm add <name>@^<major>.<minor>.0`
3560
+ },
3561
+ budget: {
3562
+ timeoutMs: 6e4,
3563
+ maxIterations: 5,
3564
+ maxToolCalls: 20,
3565
+ maxTokens: 4e4,
3566
+ maxCostUsd: 0.1
3567
+ },
3568
+ capability: {
3569
+ phase: "meta",
3570
+ summary: "Single-shot tech stack validator: checks npm for latest versions, rejects dead/obsolete packages, enforces modern alternatives.",
3571
+ keywords: [
3572
+ "tech stack",
3573
+ "version",
3574
+ "package",
3575
+ "library",
3576
+ "framework",
3577
+ "dependency",
3578
+ "install",
3579
+ "upgrade",
3580
+ "latest",
3581
+ "npm",
3582
+ "pnpm add",
3583
+ "outdated",
3584
+ "obsolete",
3585
+ "deprecated",
3586
+ "what version",
3587
+ "which package",
3588
+ "check version",
3589
+ "verify version",
3590
+ "is this current"
3591
+ ]
3592
+ }
3490
3593
  }
3491
3594
  ];
3492
3595
 
@@ -7598,15 +7701,7 @@ function makeAgentSubagentRunner(opts) {
7598
7701
  let budgetError = null;
7599
7702
  const onBudgetError = (err) => {
7600
7703
  if (err instanceof BudgetThresholdSignal) {
7601
- err.decision.then((decision) => {
7602
- if (decision === "stop") {
7603
- budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
7604
- aborter.abort();
7605
- }
7606
- }).catch(() => {
7607
- budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
7608
- aborter.abort();
7609
- });
7704
+ budgetError = err;
7610
7705
  return;
7611
7706
  }
7612
7707
  aborter.abort();
@@ -7714,15 +7809,23 @@ function makeAgentSubagentRunner(opts) {
7714
7809
  }
7715
7810
  if (budgetError) {
7716
7811
  if ("decision" in budgetError) {
7717
- const decision = await budgetError.decision;
7718
- if (decision === "stop") {
7812
+ try {
7813
+ const decision = await budgetError.decision;
7814
+ if (decision === "stop") {
7815
+ budgetError = new BudgetExceededError(
7816
+ budgetError.kind,
7817
+ budgetError.limit,
7818
+ budgetError.used
7819
+ );
7820
+ } else {
7821
+ budgetError = null;
7822
+ }
7823
+ } catch {
7719
7824
  budgetError = new BudgetExceededError(
7720
7825
  budgetError.kind,
7721
7826
  budgetError.limit,
7722
7827
  budgetError.used
7723
7828
  );
7724
- } else {
7725
- budgetError = null;
7726
7829
  }
7727
7830
  }
7728
7831
  if (budgetError) throw budgetError;
@@ -7756,12 +7859,6 @@ function defaultFormatTaskInput(task) {
7756
7859
  }
7757
7860
 
7758
7861
  // src/utils/message-invariants.ts
7759
- function expectDefined2(value) {
7760
- if (value === null || value === void 0) {
7761
- throw new Error("Expected value to be defined");
7762
- }
7763
- return value;
7764
- }
7765
7862
  function repairToolUseAdjacency(messages) {
7766
7863
  const removedToolUses = [];
7767
7864
  const removedToolResults = [];
@@ -7769,7 +7866,7 @@ function repairToolUseAdjacency(messages) {
7769
7866
  let changed = false;
7770
7867
  const out = [];
7771
7868
  for (let i = 0; i < messages.length; i++) {
7772
- const original = expectDefined2(messages[i]);
7869
+ const original = expectDefined(messages[i]);
7773
7870
  let msg = original;
7774
7871
  if (hasToolUse(msg)) {
7775
7872
  const nextIds = toolResultIds(messages[i + 1]);
@@ -7854,12 +7951,6 @@ function isEmptyMessage(msg) {
7854
7951
  }
7855
7952
 
7856
7953
  // src/storage/session-store.ts
7857
- function expectDefined3(value) {
7858
- if (value === null || value === void 0) {
7859
- throw new Error("Expected value to be defined");
7860
- }
7861
- return value;
7862
- }
7863
7954
  function sanitizeModel(model) {
7864
7955
  return model.replace(/[^a-zA-Z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
7865
7956
  }
@@ -8570,7 +8661,7 @@ var FileSessionWriter = class {
8570
8661
  let targetCheckpointLine = -1;
8571
8662
  let afterTarget = false;
8572
8663
  for (let i = 0; i < lines.length; i++) {
8573
- const line = expectDefined3(lines[i]);
8664
+ const line = expectDefined(lines[i]);
8574
8665
  if (!line.trim()) continue;
8575
8666
  let event;
8576
8667
  try {