@wrongstack/core 0.268.0 → 0.270.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 (75) hide show
  1. package/dist/{agent-bridge-UhojbpWx.d.ts → agent-bridge-PcHQl_UQ.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-Bvtf1o9K.d.ts → agent-subagent-runner-SHJW7t8q.d.ts} +8 -8
  3. package/dist/{brain-69wzMKp1.d.ts → brain-BYcK__Ym.d.ts} +1 -1
  4. package/dist/{compactor-CBQAJoDc.d.ts → compactor-C2RKEBtC.d.ts} +1 -1
  5. package/dist/{config-VKfOZ-6X.d.ts → config-C_ae2k86.d.ts} +11 -2
  6. package/dist/{context-C0U8B9NF.d.ts → context-Dp87Bcaq.d.ts} +24 -1
  7. package/dist/coordination/index.d.ts +22 -16
  8. package/dist/coordination/index.js +233 -86
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +25 -25
  11. package/dist/defaults/index.js +272 -69
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +15 -15
  14. package/dist/execution/index.js +116 -19
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +1 -1
  17. package/dist/extension/index.d.ts +6 -6
  18. package/dist/{global-mailbox-KByEFFBa.d.ts → global-mailbox-Bvrz1P3f.d.ts} +2 -1
  19. package/dist/{goal-preamble-CrYjmdw4.d.ts → goal-preamble-CA_4yiGQ.d.ts} +9 -9
  20. package/dist/{goal-store-Y_zdLZ3q.d.ts → goal-store-DhuJoUNG.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +15 -6
  22. package/dist/hq/index.js +58 -11
  23. package/dist/hq/index.js.map +1 -1
  24. package/dist/{index-CtQnmkaS.d.ts → index-CZQ6Pwbs.d.ts} +8 -8
  25. package/dist/{index-gCv830d7.d.ts → index-W4VJCzHa.d.ts} +5 -5
  26. package/dist/{index-BfaS-f_m.d.ts → index-whDfTANu.d.ts} +2 -2
  27. package/dist/index.d.ts +41 -41
  28. package/dist/index.js +534 -170
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +3 -3
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +9 -9
  34. package/dist/{mcp-servers-HT3Fi7Bl.d.ts → mcp-servers-DJdZiRcv.d.ts} +3 -3
  35. package/dist/models/index.d.ts +5 -5
  36. package/dist/models/index.js +1 -1
  37. package/dist/models/index.js.map +1 -1
  38. package/dist/{models-registry-Bvcl3Vaa.d.ts → models-registry-C3a-2-Yd.d.ts} +1 -1
  39. package/dist/{multi-agent-coordinator-BACjsmkC.d.ts → multi-agent-coordinator-CJSpTe5O.d.ts} +1 -1
  40. package/dist/{null-fleet-bus-DA7fvhUg.d.ts → null-fleet-bus-QVshIsDx.d.ts} +6 -6
  41. package/dist/observability/index.d.ts +2 -2
  42. package/dist/{parallel-eternal-engine-Ci71gYu_.d.ts → parallel-eternal-engine-D9y5Pkcc.d.ts} +9 -9
  43. package/dist/{path-resolver-O1IJnmKE.d.ts → path-resolver-CnQ8SIfh.d.ts} +3 -3
  44. package/dist/{permission-Bd-57Lbl.d.ts → permission-CvYQNUqZ.d.ts} +1 -1
  45. package/dist/{permission-policy-uNXC6Kge.d.ts → permission-policy-D5Ss8j4B.d.ts} +2 -2
  46. package/dist/{pipeline-BDNvENyV.d.ts → pipeline-l_zzFRh3.d.ts} +2 -2
  47. package/dist/{plan-templates-EMsalEtN.d.ts → plan-templates-NtPgyeJA.d.ts} +6 -5
  48. package/dist/{provider-model-resolve-CEb9x886.d.ts → provider-model-resolve-d5poT5y0.d.ts} +3 -3
  49. package/dist/{provider-runner-DWJbpo70.d.ts → provider-runner-gkctlQV_.d.ts} +3 -3
  50. package/dist/{retry-policy-C3s_lvdK.d.ts → retry-policy-CtFhfwa8.d.ts} +1 -1
  51. package/dist/sdd/index.d.ts +8 -8
  52. package/dist/sdd/index.js +1 -1
  53. package/dist/sdd/index.js.map +1 -1
  54. package/dist/{secret-vault-Cgduf5xL.d.ts → secret-vault-BLsVmTIK.d.ts} +1 -1
  55. package/dist/security/index.d.ts +5 -5
  56. package/dist/security/index.js.map +1 -1
  57. package/dist/{selector-47LBnBVk.d.ts → selector-CXl2_y9W.d.ts} +1 -1
  58. package/dist/{session-event-bridge-Cw7oqmW2.d.ts → session-event-bridge-Ccud20CC.d.ts} +1 -1
  59. package/dist/{session-reader-DD4v2Obw.d.ts → session-reader-ZeXQmsmE.d.ts} +1 -1
  60. package/dist/skills/index.js.map +1 -1
  61. package/dist/storage/index.d.ts +13 -11
  62. package/dist/storage/index.js +210 -64
  63. package/dist/storage/index.js.map +1 -1
  64. package/dist/tools/index.d.ts +2 -2
  65. package/dist/tools/index.js.map +1 -1
  66. package/dist/types/index.d.ts +21 -21
  67. package/dist/types/index.js +110 -19
  68. package/dist/types/index.js.map +1 -1
  69. package/dist/utils/index.d.ts +2 -2
  70. package/dist/utils/index.js +58 -24
  71. package/dist/utils/index.js.map +1 -1
  72. package/package.json +1 -1
  73. package/skills/chimera/SKILL.md +1 -1
  74. package/skills/typescript-strict/SKILL.md +3 -3
  75. package/skills/typescript-strict/SKILL.save.md +1 -1
@@ -1,8 +1,8 @@
1
- import { C as Context, z as ContextEvidenceState, k as ToolOutputMetadata, J as JSONSchema, M as Message, w as TodoItem } from '../context-C0U8B9NF.js';
1
+ import { C as Context, z as ContextEvidenceState, k as ToolOutputMetadata, J as JSONSchema, M as Message, w as TodoItem } from '../context-Dp87Bcaq.js';
2
2
  export { H as HttpDispatcher, a as HttpsAgentAsDispatcher } from '../dispatcher-types.d-BBeXBQgS.js';
3
3
  export { toErrorMessage } from './error.js';
4
4
  export { expectDefined } from './expect-defined.js';
5
- import { v as CustomModelDefinition, a as ModelsDevPayload } from '../config-VKfOZ-6X.js';
5
+ import { v as CustomModelDefinition, a as ModelsDevPayload } from '../config-C_ae2k86.js';
6
6
  export { T as TaskItem, c as computeTaskItemProgress, f as formatTaskList, a as formatTaskProgress } from '../task-format-vGOIftmK.js';
7
7
  export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from '../wstack-paths-hOpNLmvf.js';
8
8
  export { a as TaskPriority, b as TaskStatus, T as TaskType } from '../task-graph-u1q9Jkyk.js';
@@ -256,7 +256,7 @@ function onResize(cb, stream = process.stdout) {
256
256
  };
257
257
  }
258
258
  function setRawMode(input, mode) {
259
- if (!input || input.isTTY !== true) return false;
259
+ if (input?.isTTY !== true) return false;
260
260
  if (typeof input.setRawMode !== "function") return false;
261
261
  input.setRawMode(mode);
262
262
  return true;
@@ -316,11 +316,7 @@ var color = {
316
316
  bgGreen: wrap("42", "49")
317
317
  };
318
318
  function stripAnsi(s) {
319
- return s.replace(
320
- // biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape regex
321
- /\x1b\[[0-9;]*[A-Za-z]/g,
322
- ""
323
- );
319
+ return s.replace(/\x1b\[[0-9;]*[A-Za-z]/g, "");
324
320
  }
325
321
  async function readJsonObjectFile(filePath) {
326
322
  try {
@@ -1217,7 +1213,7 @@ function expandIPv6(addr) {
1217
1213
  };
1218
1214
  if (parts.length === 1) {
1219
1215
  const groups = parseGroups(parts[0] ?? "");
1220
- if (!groups || groups.length !== 8) return null;
1216
+ if (groups?.length !== 8) return null;
1221
1217
  return groups;
1222
1218
  }
1223
1219
  const head = parseGroups(parts[0] ?? "");
@@ -1586,7 +1582,7 @@ function hasToolResult(msg) {
1586
1582
  }
1587
1583
  function toolUseIds(msg) {
1588
1584
  const ids = /* @__PURE__ */ new Set();
1589
- if (!msg || msg.role !== "assistant") return ids;
1585
+ if (msg?.role !== "assistant") return ids;
1590
1586
  for (const block of contentBlocks(msg)) {
1591
1587
  if (block.type === "tool_use") ids.add(block.id);
1592
1588
  }
@@ -1594,7 +1590,7 @@ function toolUseIds(msg) {
1594
1590
  }
1595
1591
  function toolResultIds(msg) {
1596
1592
  const ids = /* @__PURE__ */ new Set();
1597
- if (!msg || msg.role !== "user") return ids;
1593
+ if (msg?.role !== "user") return ids;
1598
1594
  for (const block of contentBlocks(msg)) {
1599
1595
  if (block.type === "tool_result") ids.add(block.tool_use_id);
1600
1596
  }
@@ -2040,8 +2036,19 @@ function calState(key) {
2040
2036
  return state;
2041
2037
  }
2042
2038
  var MIN_SAMPLES_FOR_CALIBRATION = 3;
2039
+ var MODEL_FAMILY_RATIO = {
2040
+ // Anthropic: ~3.8-4.0 chars/token depending on model
2041
+ claude: 3.8,
2042
+ // OpenAI: ~4.0 chars/token
2043
+ "gpt-4": 4,
2044
+ "gpt-3.5": 4,
2045
+ // Google: ~3.5 chars/token
2046
+ gemini: 3.5,
2047
+ // DeepSeek: ~3.5 chars/token
2048
+ deepseek: 3.5
2049
+ };
2043
2050
  var ESTIMATE_CACHE = /* @__PURE__ */ new Map();
2044
- var ESTIMATE_CACHE_MAX_SIZE = 1e4;
2051
+ var ESTIMATE_CACHE_MAX_SIZE = 5e4;
2045
2052
  function getCachedEstimate(key, compute) {
2046
2053
  const existing = ESTIMATE_CACHE.get(key);
2047
2054
  if (existing !== void 0) return existing;
@@ -2183,8 +2190,24 @@ function estimateRequestTokensCalibrated(messages, systemPrompt, tools, calibrat
2183
2190
  total: Math.round(result.total * safeRatio)
2184
2191
  };
2185
2192
  }
2193
+ const fallbackRatio = getModelFamilyRatio(calibrationKey);
2194
+ if (fallbackRatio !== null) {
2195
+ return {
2196
+ messages: Math.round(result.messages * fallbackRatio),
2197
+ systemPrompt: Math.round(result.systemPrompt * fallbackRatio),
2198
+ tools: Math.round(result.tools * fallbackRatio),
2199
+ total: Math.round(result.total * fallbackRatio)
2200
+ };
2201
+ }
2186
2202
  return result;
2187
2203
  }
2204
+ function getModelFamilyRatio(calibrationKey) {
2205
+ const lower = calibrationKey.toLowerCase();
2206
+ for (const [family, ratio] of Object.entries(MODEL_FAMILY_RATIO)) {
2207
+ if (lower.includes(family)) return ratio / 3.5;
2208
+ }
2209
+ return null;
2210
+ }
2188
2211
  function resetCalibration(calibrationKey) {
2189
2212
  if (calibrationKey === void 0) {
2190
2213
  _cals.clear();
@@ -2202,6 +2225,7 @@ var GREP_MATCHES_PER_FILE = 3;
2202
2225
  var DIFF_INLINE_LINE_LIMIT = 260;
2203
2226
  var DIFF_HUNK_LIMIT = 8;
2204
2227
  var DIFF_HUNK_CONTEXT = 14;
2228
+ var GREP_LINE_RE = /^(.+?):(\d+):(.*)$/;
2205
2229
  function createToolOutputSerializer(opts = {}) {
2206
2230
  const capBytes = opts.perIterationOutputCapBytes ?? 1e5;
2207
2231
  function serialize(value, context = {}) {
@@ -2587,7 +2611,7 @@ ${renderStringList(passthrough, "", 50)}`);
2587
2611
  return sections.join("\n");
2588
2612
  }
2589
2613
  function parseGrepContentLine(line) {
2590
- const match = /^(.+?):(\d+):(.*)$/.exec(line);
2614
+ const match = GREP_LINE_RE.exec(line);
2591
2615
  if (!match?.[1] || !match[2]) return void 0;
2592
2616
  return { file: match[1], line: match[2], text: match[3] ?? "" };
2593
2617
  }
@@ -2605,22 +2629,20 @@ function compactDiff(diff) {
2605
2629
  const hunks = lines.filter((line) => line.startsWith("@@")).length;
2606
2630
  const added = lines.filter((line) => line.startsWith("+") && !line.startsWith("+++")).length;
2607
2631
  const removed = lines.filter((line) => line.startsWith("-") && !line.startsWith("---")).length;
2608
- const selected = /* @__PURE__ */ new Set();
2632
+ const intervals = [];
2609
2633
  let hunkCount = 0;
2610
2634
  for (let i = 0; i < lines.length; i++) {
2611
2635
  const line = lines[i] ?? "";
2612
2636
  if (line.startsWith("diff --git") || line.startsWith("--- ") || line.startsWith("+++ ")) {
2613
- selected.add(i);
2637
+ intervals.push([i, i]);
2614
2638
  continue;
2615
2639
  }
2616
2640
  if (!line.startsWith("@@")) continue;
2617
2641
  if (hunkCount >= DIFF_HUNK_LIMIT) continue;
2618
2642
  hunkCount++;
2619
- for (let j = i; j <= Math.min(lines.length - 1, i + DIFF_HUNK_CONTEXT); j++) {
2620
- selected.add(j);
2621
- }
2643
+ intervals.push([i, Math.min(lines.length - 1, i + DIFF_HUNK_CONTEXT)]);
2622
2644
  }
2623
- if (selected.size === 0) {
2645
+ if (intervals.length === 0) {
2624
2646
  return joinSections([
2625
2647
  renderHeader("diff_summary", {
2626
2648
  files: fileCount,
@@ -2633,17 +2655,29 @@ function compactDiff(diff) {
2633
2655
  `[serializer omitted ${Math.max(0, lines.length - DIFF_INLINE_LINE_LIMIT)} diff line(s)]`
2634
2656
  ]);
2635
2657
  }
2658
+ const merged = [intervals[0]];
2659
+ for (let i = 1; i < intervals.length; i++) {
2660
+ const last = merged[merged.length - 1];
2661
+ const current = intervals[i];
2662
+ if (current[0] <= last[1] + 1) {
2663
+ last[1] = Math.max(last[1], current[1]);
2664
+ } else {
2665
+ merged.push(current);
2666
+ }
2667
+ }
2636
2668
  const excerpt = [];
2637
- let previous = -1;
2638
- for (const index of [...selected].sort((a, b) => a - b)) {
2639
- if (index > previous + 1) {
2640
- const omitted = previous === -1 ? index : index - previous - 1;
2669
+ let prevLine = -1;
2670
+ for (const [start, end] of merged) {
2671
+ if (start > prevLine + 1) {
2672
+ const omitted = prevLine === -1 ? start : start - prevLine - 1;
2641
2673
  excerpt.push(`[serializer omitted ${omitted} diff line(s)]`);
2642
2674
  }
2643
- excerpt.push(lines[index] ?? "");
2644
- previous = index;
2675
+ for (let j = start; j <= end; j++) {
2676
+ excerpt.push(lines[j] ?? "");
2677
+ }
2678
+ prevLine = end;
2645
2679
  }
2646
- const trailing = lines.length - previous - 1;
2680
+ const trailing = lines.length - prevLine - 1;
2647
2681
  if (trailing > 0) excerpt.push(`[serializer omitted ${trailing} trailing diff line(s)]`);
2648
2682
  return joinSections([
2649
2683
  renderHeader("diff_summary", {