@wrongstack/core 0.260.0 → 0.265.1

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 (99) hide show
  1. package/dist/{agent-bridge-BbskZ7HH.d.ts → agent-bridge-DrkBxszZ.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-BNIGZx18.d.ts → agent-subagent-runner-DM2pP-B6.d.ts} +116 -12
  3. package/dist/{brain-C2yDd7Lw.d.ts → brain-BXd_61kQ.d.ts} +32 -3
  4. package/dist/{compactor-t0R_AIt_.d.ts → compactor-B8pOf45Y.d.ts} +1 -1
  5. package/dist/{config-FG6As4H5.d.ts → config-BMCj_XDs.d.ts} +86 -12
  6. package/dist/{context-JFOVvu6z.d.ts → context-MRk5PhNv.d.ts} +26 -1
  7. package/dist/coordination/index.d.ts +1737 -15
  8. package/dist/coordination/index.js +3152 -494
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/{default-config-CXsDvOmP.d.ts → default-config-B0cj-Hry.d.ts} +11 -1
  11. package/dist/defaults/index.d.ts +28 -28
  12. package/dist/defaults/index.js +1804 -1363
  13. package/dist/defaults/index.js.map +1 -1
  14. package/dist/dispatcher-types.d-BBeXBQgS.d.ts +66 -0
  15. package/dist/execution/index.d.ts +16 -16
  16. package/dist/execution/index.js +933 -672
  17. package/dist/execution/index.js.map +1 -1
  18. package/dist/execution/prompt-enhancer.d.ts +1 -1
  19. package/dist/execution/prompt-enhancer.js +7 -1
  20. package/dist/execution/prompt-enhancer.js.map +1 -1
  21. package/dist/extension/index.d.ts +6 -6
  22. package/dist/extension/index.js.map +1 -1
  23. package/dist/{goal-preamble-B1IXJtLX.d.ts → goal-preamble-DvHDSKSe.d.ts} +26 -10
  24. package/dist/{goal-store-CPXz6Mml.d.ts → goal-store-DtLMySNb.d.ts} +1 -1
  25. package/dist/{index-CebbJB94.d.ts → index-B-ch8K9C.d.ts} +8 -8
  26. package/dist/{index-BPcg4N3M.d.ts → index-CEDeNodM.d.ts} +5 -5
  27. package/dist/index.d.ts +189 -104
  28. package/dist/index.js +24693 -21162
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +12 -8
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +9 -9
  34. package/dist/kernel/index.js +7 -2
  35. package/dist/kernel/index.js.map +1 -1
  36. package/dist/{llm-selector-DXxI2tlu.d.ts → llm-selector-C0tfTCUe.d.ts} +14 -2
  37. package/dist/{mcp-servers-OwNHo43-.d.ts → mcp-servers-2x4w6Jn9.d.ts} +3 -3
  38. package/dist/models/index.d.ts +5 -5
  39. package/dist/models/index.js +80 -31
  40. package/dist/models/index.js.map +1 -1
  41. package/dist/{models-registry-Djlmq4uB.d.ts → models-registry-DmJlKuNp.d.ts} +1 -1
  42. package/dist/{multi-agent-coordinator-CEmrSCMJ.d.ts → multi-agent-coordinator-DyCkCZnU.d.ts} +2 -2
  43. package/dist/{null-fleet-bus-DT92xqgJ.d.ts → null-fleet-bus-CG9QY2aP.d.ts} +6 -6
  44. package/dist/observability/index.d.ts +2 -2
  45. package/dist/observability/index.js +8 -3
  46. package/dist/observability/index.js.map +1 -1
  47. package/dist/{parallel-eternal-engine-0SItuq5r.d.ts → parallel-eternal-engine-Jw9uhEoT.d.ts} +9 -9
  48. package/dist/{path-resolver-DKBh6Jlo.d.ts → path-resolver-Dy2ej-gE.d.ts} +3 -3
  49. package/dist/{permission-BJ7eO9Vl.d.ts → permission-B9SB45lp.d.ts} +1 -1
  50. package/dist/{permission-policy-DEXOfnpm.d.ts → permission-policy-CkjSXabK.d.ts} +2 -2
  51. package/dist/{pipeline-zflkI2dp.d.ts → pipeline-DPDxH_7m.d.ts} +59 -4
  52. package/dist/{plan-templates-BFXyRkEK.d.ts → plan-templates-CzD9GnAU.d.ts} +32 -8
  53. package/dist/{provider-runner-BC-uywtT.d.ts → provider-runner-DMa70ODu.d.ts} +3 -3
  54. package/dist/{retry-policy-Cavrzmtk.d.ts → retry-policy-CN0khdlj.d.ts} +1 -1
  55. package/dist/sdd/index.d.ts +8 -8
  56. package/dist/sdd/index.js +313 -122
  57. package/dist/sdd/index.js.map +1 -1
  58. package/dist/{secret-vault-CDvDYXWX.d.ts → secret-vault-B2yw84VT.d.ts} +43 -4
  59. package/dist/secret-vault-BAKpgFw_.d.ts +57 -0
  60. package/dist/security/index.d.ts +5 -5
  61. package/dist/security/index.js +411 -225
  62. package/dist/security/index.js.map +1 -1
  63. package/dist/{selector-B7AivHsu.d.ts → selector-CzHh_igB.d.ts} +1 -1
  64. package/dist/{session-event-bridge-BmIDxdJd.d.ts → session-event-bridge-BUI6Jf-4.d.ts} +8 -2
  65. package/dist/{session-reader-DtofsB-2.d.ts → session-reader-CMgdMSRP.d.ts} +1 -1
  66. package/dist/skills/index.js +67 -64
  67. package/dist/skills/index.js.map +1 -1
  68. package/dist/storage/index.d.ts +132 -16
  69. package/dist/storage/index.js +851 -432
  70. package/dist/storage/index.js.map +1 -1
  71. package/dist/tools/index.d.ts +57 -0
  72. package/dist/tools/index.js +411 -0
  73. package/dist/tools/index.js.map +1 -0
  74. package/dist/types/index.d.ts +21 -21
  75. package/dist/types/index.js +928 -711
  76. package/dist/types/index.js.map +1 -1
  77. package/dist/utils/error.d.ts +7 -0
  78. package/dist/utils/error.js +8 -0
  79. package/dist/utils/error.js.map +1 -0
  80. package/dist/utils/index.d.ts +8 -68
  81. package/dist/utils/index.js +20 -10
  82. package/dist/utils/index.js.map +1 -1
  83. package/dist/{wstack-paths-CJjEwPXn.d.ts → wstack-paths-hOpNLmvf.d.ts} +2 -0
  84. package/package.json +5 -1
  85. package/skills/api-design/SKILL.md +1 -1
  86. package/skills/audit-log/SKILL.md +6 -6
  87. package/skills/bug-hunter/SKILL.md +5 -5
  88. package/skills/chimera/SKILL.md +4 -4
  89. package/skills/docker-deploy/SKILL.md +1 -1
  90. package/skills/git-flow/SKILL.md +3 -3
  91. package/skills/multi-agent/SKILL.md +3 -3
  92. package/skills/node-modern/SKILL.md +1 -0
  93. package/skills/observability/SKILL.md +2 -2
  94. package/skills/output-standards/SKILL.md +51 -28
  95. package/skills/refactor-planner/SKILL.md +3 -3
  96. package/skills/security-scanner/SKILL.md +4 -3
  97. package/skills/tech-stack/SKILL.md +1 -2
  98. package/dist/package-outdated-watcher-C70ag2G9.d.ts +0 -581
  99. package/dist/secret-vault-BJDY28ev.d.ts +0 -25
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Converts an unknown error value to a human-readable string.
3
+ * Used in 40+ files across the codebase to normalize error messaging.
4
+ */
5
+ declare function toErrorMessage(err: unknown): string;
6
+
7
+ export { toErrorMessage };
@@ -0,0 +1,8 @@
1
+ // src/utils/error.ts
2
+ function toErrorMessage(err) {
3
+ return err instanceof Error ? err.message : String(err);
4
+ }
5
+
6
+ export { toErrorMessage };
7
+ //# sourceMappingURL=error.js.map
8
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/error.ts"],"names":[],"mappings":";AAIO,SAAS,eAAe,GAAA,EAAsB;AACnD,EAAA,OAAO,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AACxD","file":"error.js","sourcesContent":["/**\n * Converts an unknown error value to a human-readable string.\n * Used in 40+ files across the codebase to normalize error messaging.\n */\nexport function toErrorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n"]}
@@ -1,11 +1,13 @@
1
- import { s as TodoItem, M as Message, J as JSONSchema } from '../context-JFOVvu6z.js';
1
+ import { s as TodoItem, M as Message, J as JSONSchema } from '../context-MRk5PhNv.js';
2
2
  export { T as TaskItem, c as computeTaskItemProgress, f as formatTaskList, a as formatTaskProgress } from '../task-format-vGOIftmK.js';
3
- export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from '../wstack-paths-CJjEwPXn.js';
3
+ export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from '../wstack-paths-hOpNLmvf.js';
4
4
  export { expectDefined } from './expect-defined.js';
5
- import { a as ModelsDevPayload, t as CustomModelDefinition } from '../config-FG6As4H5.js';
6
- import * as https from 'node:https';
7
- import { Dispatcher } from 'undici';
5
+ export { toErrorMessage } from './error.js';
6
+ import { a as ModelsDevPayload, u as CustomModelDefinition } from '../config-BMCj_XDs.js';
7
+ export { H as HttpDispatcher, a as HttpsAgentAsDispatcher } from '../dispatcher-types.d-BBeXBQgS.js';
8
8
  export { a as TaskPriority, b as TaskStatus, T as TaskType } from '../task-graph-u1q9Jkyk.js';
9
+ import 'node:https';
10
+ import 'undici';
9
11
 
10
12
  interface AtomicWriteOptions {
11
13
  mode?: number | undefined;
@@ -638,66 +640,4 @@ declare function expandIPv6(addr: string): number[] | null;
638
640
  */
639
641
  declare function assertNotPrivateHost(hostname: string): Promise<void>;
640
642
 
641
- /**
642
- * `dispatcher-types.d.ts` — Unify `https.Agent` and `undici.Dispatcher` types.
643
- *
644
- * Problem: `https.Agent` (Node.js built-in) and `undici.Dispatcher` implement the
645
- * same interface at runtime — `fetch`'s `RequestInit.dispatcher` accepts anything
646
- * with a `dispatch(req, opts)` method. However, TypeScript's type definitions
647
- * treat them as unrelated types because they come from different `@types/*` packages
648
- * (or undici@7 bundles its own Dispatcher type that conflicts with @types/node's
649
- * copy of the same concept via undici-types).
650
- *
651
- * Solution: This module augments the global `RequestInit` type so that
652
- * `https.Agent` is accepted as a valid `dispatcher` value without a cast.
653
- *
654
- * Usage:
655
- * import '@wrongstack/core/utils/dispatcher-types';
656
- * const agent = new https.Agent({ rejectUnauthorized: false });
657
- * fetch(url, { dispatcher: agent }); // ✅ no cast needed
658
- *
659
- * Alternatively, use `as HttpsAgentAsDispatcher` to silence any remaining
660
- * conflicts at the call site.
661
- *
662
- * Verified at runtime: `https.Agent` has a `dispatch(req, opts)` method and
663
- * is callable by the built-in fetch implementation — this shim is a type-level
664
- * correction only, not a runtime polyfill.
665
- */
666
-
667
-
668
-
669
- /**
670
- * Marker type: a value that fetch's `RequestInit.dispatcher` accepts at runtime.
671
- * Both `https.Agent` and `undici.Dispatcher` satisfy this structural interface.
672
- */
673
- type HttpDispatcher = Pick<Dispatcher, 'dispatch'>;
674
-
675
- /**
676
- * Augment `RequestInit` so that `https.Agent` is a valid dispatcher type.
677
- * Without this, TypeScript rejects `https.Agent` for `dispatcher` because the
678
- * two agent types are not structurally compatible in the installed @types set.
679
- */
680
- declare global {
681
- interface RequestInit {
682
- /**
683
- * Accepts `https.Agent` in addition to `undici.Dispatcher`.
684
- * Runtime type-check is performed by Node.js / undici — this declaration
685
- * only tells TypeScript the same thing.
686
- */
687
- dispatcher?: HttpDispatcher | undefined;
688
- }
689
- }
690
-
691
- /**
692
- * Use this cast at call sites where `https.Agent` must be passed to a function
693
- * typed for `undici.Dispatcher`. Documents the trust boundary: the cast is safe
694
- * because both types share a `dispatch(req, opts)` method at runtime.
695
- *
696
- * @example
697
- * import type { HttpsAgentAsDispatcher } from '@wrongstack/core';
698
- * const agent = new https.Agent({ rejectUnauthorized: false });
699
- * fetch(url, { dispatcher: agent as HttpsAgentAsDispatcher });
700
- */
701
- type HttpsAgentAsDispatcher = https.Agent;
702
-
703
- export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type HttpDispatcher, type HttpsAgentAsDispatcher, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, truncate, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
643
+ export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, truncate, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
@@ -62,7 +62,12 @@ async function withFileLock(targetPath, fn, opts = {}) {
62
62
  await handle.writeFile(`${process.pid}:${Date.now()}`);
63
63
  break;
64
64
  } catch (err) {
65
- if (err.code !== "EEXIST") throw err;
65
+ const code = err.code;
66
+ if (code === "ENOENT") {
67
+ await fs.mkdir(dir, { recursive: true });
68
+ continue;
69
+ }
70
+ if (code !== "EEXIST") throw err;
66
71
  try {
67
72
  const stat3 = await fs.stat(lockPath);
68
73
  if (Date.now() - stat3.mtimeMs > staleMs) {
@@ -115,6 +120,11 @@ async function renameWithRetry(from, to) {
115
120
  throw lastErr;
116
121
  }
117
122
 
123
+ // src/utils/error.ts
124
+ function toErrorMessage(err) {
125
+ return err instanceof Error ? err.message : String(err);
126
+ }
127
+
118
128
  // src/utils/safe-json.ts
119
129
  function safeParse(input, maxBytes = 5e6) {
120
130
  if (input.length > maxBytes) {
@@ -125,7 +135,7 @@ function safeParse(input, maxBytes = 5e6) {
125
135
  } catch (err) {
126
136
  return {
127
137
  ok: false,
128
- error: err instanceof Error ? err.message : String(err)
138
+ error: toErrorMessage(err)
129
139
  };
130
140
  }
131
141
  }
@@ -146,7 +156,7 @@ function safeStringify(value, pretty = false) {
146
156
  return JSON.stringify(value, replacer, pretty ? 2 : void 0) ?? "null";
147
157
  } catch (err) {
148
158
  return JSON.stringify({
149
- __serialization_error: err instanceof Error ? err.message : String(err)
159
+ __serialization_error: toErrorMessage(err)
150
160
  });
151
161
  }
152
162
  }
@@ -770,7 +780,8 @@ function resolveWstackPaths(opts) {
770
780
  projectSddSession: path2.join(projectDir, "sdd-session.json"),
771
781
  projectPlan: path2.join(projectDir, "plan.json"),
772
782
  projectAutophase: path2.join(projectDir, "autophase"),
773
- syncConfig: path2.join(globalRoot, "sync.json")
783
+ syncConfig: path2.join(globalRoot, "sync.json"),
784
+ projectStatus: (projectHash2) => path2.join(globalRoot, "projects", projectHash2, "status.json")
774
785
  };
775
786
  }
776
787
 
@@ -1006,12 +1017,9 @@ function getCachedEstimate(key, compute) {
1006
1017
  const existing = ESTIMATE_CACHE.get(key);
1007
1018
  if (existing !== void 0) return existing;
1008
1019
  if (ESTIMATE_CACHE.size >= ESTIMATE_CACHE_MAX_SIZE) {
1009
- let evicted = 0;
1010
- const maxEvict = Math.floor(ESTIMATE_CACHE_MAX_SIZE / 4);
1011
1020
  for (const k of ESTIMATE_CACHE.keys()) {
1012
- if (evicted >= maxEvict) break;
1021
+ if (ESTIMATE_CACHE.size <= Math.floor(ESTIMATE_CACHE_MAX_SIZE / 2)) break;
1013
1022
  ESTIMATE_CACHE.delete(k);
1014
- evicted++;
1015
1023
  }
1016
1024
  }
1017
1025
  const estimate = compute(key);
@@ -1288,7 +1296,9 @@ function walk(value, schema, path3, errors) {
1288
1296
  }
1289
1297
  }
1290
1298
  if (schema.type === "array" && Array.isArray(value) && schema.items) {
1291
- value.forEach((item, i) => walk(item, schema.items, `${path3}[${i}]`, errors));
1299
+ for (let i = 0; i < value.length; i++) {
1300
+ walk(value[i], schema.items, `${path3}[${i}]`, errors);
1301
+ }
1292
1302
  }
1293
1303
  }
1294
1304
  function checkType(value, type) {
@@ -1753,6 +1763,6 @@ async function assertNotPrivateHost(hostname) {
1753
1763
  }
1754
1764
  }
1755
1765
 
1756
- export { FORBIDDEN_PROTO_KEYS, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, computeTaskItemProgress, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, projectHash, projectSlug, recordActualUsage, repairToolUseAdjacency, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, truncate, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut, wstackGlobalRoot };
1766
+ export { FORBIDDEN_PROTO_KEYS, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, computeTaskItemProgress, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, projectHash, projectSlug, recordActualUsage, repairToolUseAdjacency, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toErrorMessage, toStyle, truncate, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut, wstackGlobalRoot };
1757
1767
  //# sourceMappingURL=index.js.map
1758
1768
  //# sourceMappingURL=index.js.map