@wrongstack/core 0.155.0 → 0.250.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 (81) hide show
  1. package/dist/{agent-bridge-BbZU5TPN.d.ts → agent-bridge-4gc0vfW2.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-Bsueu0J2.d.ts → agent-subagent-runner-Dz-9kiE6.d.ts} +9 -8
  3. package/dist/{brain-CS_B0vIE.d.ts → brain-sCZ3lCjq.d.ts} +26 -2
  4. package/dist/{compactor-BueGt7LG.d.ts → compactor-BRfg3QPd.d.ts} +1 -1
  5. package/dist/{config-BaVThgnT.d.ts → config-eSsrto5d.d.ts} +8 -2
  6. package/dist/{context-C7G_MtLV.d.ts → context-CLz3z_E8.d.ts} +126 -2
  7. package/dist/coordination/index.d.ts +70 -13
  8. package/dist/coordination/index.js +1986 -146
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -26
  11. package/dist/defaults/index.js +1110 -296
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +45 -16
  14. package/dist/execution/index.js +229 -56
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +86 -0
  17. package/dist/execution/prompt-enhancer.js +125 -0
  18. package/dist/execution/prompt-enhancer.js.map +1 -0
  19. package/dist/extension/index.d.ts +6 -6
  20. package/dist/extension/index.js +3 -1
  21. package/dist/extension/index.js.map +1 -1
  22. package/dist/{goal-preamble-CbV8pXLD.d.ts → goal-preamble-BjJpnLW4.d.ts} +19 -10
  23. package/dist/{index-CI1hRfPt.d.ts → index-Dy8OwfBD.d.ts} +8 -8
  24. package/dist/{index-B5wz-GXm.d.ts → index-IehiNryU.d.ts} +7 -5
  25. package/dist/index.d.ts +438 -128
  26. package/dist/index.js +4989 -849
  27. package/dist/index.js.map +1 -1
  28. package/dist/infrastructure/index.d.ts +7 -7
  29. package/dist/infrastructure/index.js +61 -13
  30. package/dist/infrastructure/index.js.map +1 -1
  31. package/dist/kernel/index.d.ts +9 -9
  32. package/dist/kernel/index.js +7 -1
  33. package/dist/kernel/index.js.map +1 -1
  34. package/dist/{llm-selector-CP72f1lC.d.ts → llm-selector-D22R4AFz.d.ts} +2 -2
  35. package/dist/logger-DmmQhf4P.d.ts +65 -0
  36. package/dist/{mcp-servers-CPERR2De.d.ts → mcp-servers-DfXxCASH.d.ts} +3 -3
  37. package/dist/models/index.d.ts +5 -5
  38. package/dist/models/index.js +89 -9
  39. package/dist/models/index.js.map +1 -1
  40. package/dist/{models-registry-D90K9UnM.d.ts → models-registry-DpanBg8D.d.ts} +1 -1
  41. package/dist/{multi-agent-coordinator-BSKSFNhv.d.ts → multi-agent-coordinator-CnbEqpv0.d.ts} +8 -8
  42. package/dist/{null-fleet-bus-CGOez8Le.d.ts → null-fleet-bus-Do1OLYpj.d.ts} +7 -7
  43. package/dist/observability/index.d.ts +2 -2
  44. package/dist/package-outdated-watcher-CA5GGB4C.d.ts +560 -0
  45. package/dist/{parallel-eternal-engine-CYoTKjsz.d.ts → parallel-eternal-engine-UZg1xOzE.d.ts} +13 -9
  46. package/dist/{path-resolver-DuhlmPil.d.ts → path-resolver-BaP06Owy.d.ts} +3 -3
  47. package/dist/{permission-B7nKnEvQ.d.ts → permission-DbWPbuoA.d.ts} +1 -1
  48. package/dist/{permission-policy-8-6zBmfA.d.ts → permission-policy-AOk0LVsV.d.ts} +2 -2
  49. package/dist/pipeline-D1n-gQI-.d.ts +493 -0
  50. package/dist/{plan-templates-DbH7lg-t.d.ts → plan-templates-BUVRY0pU.d.ts} +18 -7
  51. package/dist/{provider-runner-Cocq0O9E.d.ts → provider-runner-D0HgUqwV.d.ts} +3 -3
  52. package/dist/{retry-policy-rutAfVeR.d.ts → retry-policy-BVnkbMET.d.ts} +1 -1
  53. package/dist/sdd/index.d.ts +8 -8
  54. package/dist/sdd/index.js +221 -87
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/{secret-vault-w8MbUe2Q.d.ts → secret-vault-CeVNiy_f.d.ts} +3 -2
  57. package/dist/security/index.d.ts +5 -4
  58. package/dist/security/index.js +155 -13
  59. package/dist/security/index.js.map +1 -1
  60. package/dist/{selector-4vDFZKt3.d.ts → selector-Cb4_9-hf.d.ts} +1 -1
  61. package/dist/{session-event-bridge-DWlvglC2.d.ts → session-event-bridge-BhtkkFFy.d.ts} +4 -2
  62. package/dist/{session-reader-BAtCxdaw.d.ts → session-reader-CCOssnBS.d.ts} +1 -1
  63. package/dist/skills/index.js +171 -21
  64. package/dist/skills/index.js.map +1 -1
  65. package/dist/storage/index.d.ts +150 -12
  66. package/dist/storage/index.js +1041 -214
  67. package/dist/storage/index.js.map +1 -1
  68. package/dist/types/index.d.ts +67 -20
  69. package/dist/types/index.js +562 -55
  70. package/dist/types/index.js.map +1 -1
  71. package/dist/utils/expect-defined.js +3 -1
  72. package/dist/utils/expect-defined.js.map +1 -1
  73. package/dist/utils/index.d.ts +25 -4
  74. package/dist/utils/index.js +45 -14
  75. package/dist/utils/index.js.map +1 -1
  76. package/dist/{wstack-paths-DD50Omgn.d.ts → wstack-paths-CJjEwPXn.d.ts} +14 -1
  77. package/package.json +7 -3
  78. package/skills/chimera/SKILL.md +105 -0
  79. package/skills/research-web/SKILL.md +342 -0
  80. package/dist/logger-B9J5puGM.d.ts +0 -32
  81. package/dist/pipeline-BG7UgbDc.d.ts +0 -239
@@ -1,9 +1,9 @@
1
- export { D as DefaultLogger, a as DefaultLoggerOptions } from '../logger-B9J5puGM.js';
2
- export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-DuhlmPil.js';
3
- export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, p as playwrightServer, s as sentinelServer, q as slackServer, z as zaiVisionServer } from '../mcp-servers-CPERR2De.js';
1
+ export { D as DefaultLogger, a as DefaultLoggerOptions, L as LogFormat } from '../logger-DmmQhf4P.js';
2
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-BaP06Owy.js';
3
+ export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, o as miniMaxVisionServer, p as playwrightServer, s as sentinelServer, q as slackServer, z as zaiVisionServer } from '../mcp-servers-DfXxCASH.js';
4
4
  import '../logger-B63L5bTg.js';
5
- import '../brain-CS_B0vIE.js';
6
- import '../context-C7G_MtLV.js';
7
- import '../config-BaVThgnT.js';
5
+ import '../brain-sCZ3lCjq.js';
6
+ import '../context-CLz3z_E8.js';
7
+ import '../config-eSsrto5d.js';
8
8
  import '../path-resolver-CPRj4bFY.js';
9
- import '../compactor-BueGt7LG.js';
9
+ import '../compactor-BRfg3QPd.js';
@@ -68,18 +68,24 @@ var COLORS = {
68
68
  trace: color.dim
69
69
  };
70
70
  var LOG_LEVELS = /* @__PURE__ */ new Set(["error", "warn", "info", "debug", "trace"]);
71
+ var LOG_FORMATS = /* @__PURE__ */ new Set(["pretty", "json"]);
71
72
  var DefaultLogger = class _DefaultLogger {
73
+ /** How many file writes between rotation size checks (statSync is not free). */
74
+ static ROTATE_CHECK_EVERY = 100;
72
75
  level;
73
76
  file;
74
77
  bindings;
75
- pretty;
78
+ format;
76
79
  stderr;
80
+ maxFileBytes;
81
+ writesSinceRotateCheck = 0;
77
82
  constructor(opts = {}) {
78
83
  this.level = opts.level ?? parseLogLevel(process.env.WRONGSTACK_LOG_LEVEL);
79
84
  this.file = opts.file;
80
85
  this.bindings = opts.bindings ?? {};
81
- this.pretty = opts.pretty ?? true;
86
+ this.format = opts.format ?? parseLogFormat(process.env.WRONGSTACK_LOG_FORMAT);
82
87
  this.stderr = opts.stderr !== false;
88
+ this.maxFileBytes = opts.maxFileBytes ?? 10 * 1024 * 1024;
83
89
  if (this.file) {
84
90
  try {
85
91
  fs.mkdirSync(path2.dirname(this.file), { recursive: true });
@@ -106,11 +112,30 @@ var DefaultLogger = class _DefaultLogger {
106
112
  return new _DefaultLogger({
107
113
  level: this.level,
108
114
  file: this.file,
109
- pretty: this.pretty,
115
+ format: this.format,
110
116
  stderr: this.stderr,
117
+ maxFileBytes: this.maxFileBytes,
111
118
  bindings: { ...this.bindings, ...bindings }
112
119
  });
113
120
  }
121
+ /**
122
+ * Size-based rotation: when the file outgrows `maxFileBytes`, rename it to
123
+ * `<file>.1` (dropping the previous `.1`) so the live file restarts empty.
124
+ * Checked on the first write and every ROTATE_CHECK_EVERY writes after.
125
+ * Best-effort: a rename can fail on Windows while another process holds
126
+ * the file — the next check retries. Multiple processes appending to the
127
+ * same log all run this check; whoever crosses the threshold first wins.
128
+ */
129
+ maybeRotate(file) {
130
+ if (this.writesSinceRotateCheck++ % _DefaultLogger.ROTATE_CHECK_EVERY !== 0) return;
131
+ try {
132
+ const st = fs.statSync(file);
133
+ if (st.size < this.maxFileBytes) return;
134
+ fs.rmSync(`${file}.1`, { force: true });
135
+ fs.renameSync(file, `${file}.1`);
136
+ } catch {
137
+ }
138
+ }
114
139
  log(level, msg, ctx) {
115
140
  const r = LEVEL_RANK[level];
116
141
  const allowed = LEVEL_RANK[this.level];
@@ -122,13 +147,17 @@ var DefaultLogger = class _DefaultLogger {
122
147
  }
123
148
  if (this.file) {
124
149
  try {
150
+ this.maybeRotate(this.file);
125
151
  fs.appendFileSync(this.file, `${JSON.stringify(entry)}
126
152
  `);
127
153
  } catch {
128
154
  }
129
155
  }
130
156
  if (!this.stderr) return;
131
- if (r <= LEVEL_RANK.warn || this.level === "debug" || this.level === "trace") {
157
+ if (this.format === "json") {
158
+ writeErr(`${JSON.stringify(entry)}
159
+ `);
160
+ } else {
132
161
  const head = `${color.dim(ts)} ${COLORS[level](level.toUpperCase().padEnd(5))} ${msg}`;
133
162
  if (ctx !== void 0) {
134
163
  writeErr(`${head} ${formatCtx(ctx)}
@@ -143,6 +172,9 @@ var DefaultLogger = class _DefaultLogger {
143
172
  function parseLogLevel(raw) {
144
173
  return raw && LOG_LEVELS.has(raw) ? raw : "info";
145
174
  }
175
+ function parseLogFormat(raw) {
176
+ return raw && LOG_FORMATS.has(raw) ? raw : "pretty";
177
+ }
146
178
  function formatCtx(ctx) {
147
179
  if (ctx instanceof Error) return color.dim(ctx.message);
148
180
  if (typeof ctx === "string") return color.dim(ctx);
@@ -488,7 +520,9 @@ var allServers = () => ({
488
520
  // src/utils/expect-defined.ts
489
521
  function expectDefined(value, label) {
490
522
  if (value === null || value === void 0) {
491
- throw new Error("Expected value to be defined");
523
+ const err = new Error("Expected value to be defined");
524
+ err.name = "ExpectDefinedError";
525
+ throw err;
492
526
  }
493
527
  return value;
494
528
  }
@@ -628,22 +662,31 @@ function estimateToolResultTokens(content) {
628
662
  function estimateTextTokens(text) {
629
663
  return RoughTokenEstimate(text);
630
664
  }
665
+ function computeMessageTokens(msg) {
666
+ if (typeof msg.content === "string") return estimateTextTokens(msg.content);
667
+ let total = 0;
668
+ for (const b of msg.content) {
669
+ if (b.type === "text") total += estimateTextTokens(b.text);
670
+ else if (b.type === "tool_use") total += estimateToolInputTokens(b.input);
671
+ else if (b.type === "tool_result") total += estimateToolResultTokens(b.content);
672
+ else total += RoughTokenEstimate(JSON.stringify(b));
673
+ }
674
+ return total;
675
+ }
631
676
  function estimateMessageTokens(messages) {
632
677
  let total = 0;
633
678
  for (const m of messages) {
634
- if (typeof m.content === "string") {
635
- total += estimateTextTokens(m.content);
636
- } else {
637
- for (const b of m.content) {
638
- if (b.type === "text") total += estimateTextTokens(b.text);
639
- else if (b.type === "tool_use") total += estimateToolInputTokens(b.input);
640
- else if (b.type === "tool_result") total += estimateToolResultTokens(b.content);
641
- }
679
+ if (typeof m._estTokens === "number" && m._estTokens > 0) {
680
+ total += m._estTokens;
681
+ continue;
642
682
  }
683
+ total += computeMessageTokens(m);
643
684
  }
644
685
  return total;
645
686
  }
646
687
  function estimateToolDefTokens(tool) {
688
+ const cached = tool._estDefTokens;
689
+ if (typeof cached === "number" && cached > 0) return cached;
647
690
  return RoughTokenEstimate(tool.name) + RoughTokenEstimate(tool.description ?? "") + RoughTokenEstimate(JSON.stringify(tool.inputSchema));
648
691
  }
649
692
  function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = CALIBRATION_GLOBAL_KEY) {
@@ -653,6 +696,11 @@ function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = C
653
696
  } else if (Array.isArray(messages)) {
654
697
  for (const m of messages) {
655
698
  if (typeof m === "object" && m !== null && "content" in m) {
699
+ const cached = m._estTokens;
700
+ if (typeof cached === "number" && cached > 0) {
701
+ messagesTokens += cached;
702
+ continue;
703
+ }
656
704
  const content = m.content;
657
705
  if (typeof content === "string") {
658
706
  messagesTokens += RoughTokenEstimate(content);