@wrongstack/core 0.148.0 → 0.236.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 (82) hide show
  1. package/dist/{agent-bridge-r9y6gdn4.d.ts → agent-bridge-Cimv7bK7.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-1GeQE_L0.d.ts → agent-subagent-runner-C658wj_c.d.ts} +9 -8
  3. package/dist/{brain-Cp_3GIS2.d.ts → brain-sCZ3lCjq.d.ts} +28 -2
  4. package/dist/{compactor-BueGt7LG.d.ts → compactor-BRfg3QPd.d.ts} +1 -1
  5. package/dist/{config-BaVThgnT.d.ts → config-Koq6f3fs.d.ts} +2 -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 +2126 -151
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +27 -27
  11. package/dist/defaults/index.js +1328 -354
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +45 -16
  14. package/dist/execution/index.js +367 -59
  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-CYJLg0wk.d.ts → goal-preamble-CnbzyVvl.d.ts} +19 -10
  23. package/dist/{index-BZdezm3g.d.ts → index-BlMqh5GO.d.ts} +8 -8
  24. package/dist/{index-CPweVoFM.d.ts → index-C2eSNPsB.d.ts} +7 -5
  25. package/dist/index.d.ts +439 -129
  26. package/dist/index.js +5206 -905
  27. package/dist/index.js.map +1 -1
  28. package/dist/infrastructure/index.d.ts +7 -7
  29. package/dist/infrastructure/index.js +72 -15
  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-Bl5LTvQg.d.ts → mcp-servers-DFbirBv6.d.ts} +11 -4
  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-CnJRjTXc.d.ts} +1 -1
  41. package/dist/{multi-agent-coordinator-QWEzJDlm.d.ts → multi-agent-coordinator-60weDZoA.d.ts} +8 -8
  42. package/dist/{null-fleet-bus-BUyfqh23.d.ts → null-fleet-bus-1068dEnr.d.ts} +7 -7
  43. package/dist/observability/index.d.ts +2 -2
  44. package/dist/package-outdated-watcher-pzJ5w7y8.d.ts +560 -0
  45. package/dist/{parallel-eternal-engine-C75QuhAI.d.ts → parallel-eternal-engine-DtG1fjc9.d.ts} +13 -9
  46. package/dist/{path-resolver-DRjQBkoO.d.ts → path-resolver-CA1ULU0J.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-DsmlwTXu.d.ts +493 -0
  50. package/dist/{plan-templates-CkKNPU3I.d.ts → plan-templates-DPABrDvy.d.ts} +19 -8
  51. package/dist/{provider-runner-BNpuIyOL.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 +358 -85
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/{secret-vault-DoISxaKO.d.ts → secret-vault-BJDY28ev.d.ts} +7 -1
  57. package/dist/{secret-vault-BTcC_T5v.d.ts → secret-vault-CeVNiy_f.d.ts} +4 -3
  58. package/dist/security/index.d.ts +6 -5
  59. package/dist/security/index.js +214 -35
  60. package/dist/security/index.js.map +1 -1
  61. package/dist/{selector-4vDFZKt3.d.ts → selector-Cb4_9-hf.d.ts} +1 -1
  62. package/dist/{session-event-bridge-DWlvglC2.d.ts → session-event-bridge-BhtkkFFy.d.ts} +4 -2
  63. package/dist/{session-reader-BAtCxdaw.d.ts → session-reader-CCOssnBS.d.ts} +1 -1
  64. package/dist/skills/index.js +171 -21
  65. package/dist/skills/index.js.map +1 -1
  66. package/dist/storage/index.d.ts +151 -13
  67. package/dist/storage/index.js +1117 -256
  68. package/dist/storage/index.js.map +1 -1
  69. package/dist/types/index.d.ts +68 -21
  70. package/dist/types/index.js +616 -74
  71. package/dist/types/index.js.map +1 -1
  72. package/dist/utils/expect-defined.js +3 -1
  73. package/dist/utils/expect-defined.js.map +1 -1
  74. package/dist/utils/index.d.ts +80 -4
  75. package/dist/utils/index.js +100 -15
  76. package/dist/utils/index.js.map +1 -1
  77. package/dist/{wstack-paths-DD50Omgn.d.ts → wstack-paths-CJjEwPXn.d.ts} +14 -1
  78. package/package.json +7 -3
  79. package/skills/chimera/SKILL.md +105 -0
  80. package/skills/research-web/SKILL.md +342 -0
  81. package/dist/logger-B9J5puGM.d.ts +0 -32
  82. 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-DRjQBkoO.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, s as sentinelServer, p as slackServer, z as zaiVisionServer } from '../mcp-servers-Bl5LTvQg.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-CA1ULU0J.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-DFbirBv6.js';
4
4
  import '../logger-B63L5bTg.js';
5
- import '../brain-Cp_3GIS2.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-Koq6f3fs.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);
@@ -447,6 +479,14 @@ var zaiVisionServer = () => ({
447
479
  ],
448
480
  permission: "auto"
449
481
  });
482
+ var playwrightServer = () => ({
483
+ name: "playwright",
484
+ description: "Browser automation \u2014 navigate, screenshot, click, type, evaluate JS (headless Chromium)",
485
+ transport: "stdio",
486
+ command: "npx",
487
+ args: ["-y", "@modelcontextprotocol/server-playwright"],
488
+ permission: "confirm"
489
+ });
450
490
  var miniMaxVisionServer = () => ({
451
491
  name: "minimax-vision",
452
492
  description: "MiniMax MCP \u2014 image understanding via understand_image",
@@ -473,13 +513,16 @@ var allServers = () => ({
473
513
  "google-maps": { ...googleMapsServer(), enabled: false },
474
514
  sentinel: { ...sentinelServer(), enabled: false },
475
515
  "zai-vision": { ...zaiVisionServer(), enabled: false },
476
- "minimax-vision": { ...miniMaxVisionServer(), enabled: false }
516
+ "minimax-vision": { ...miniMaxVisionServer(), enabled: false },
517
+ playwright: { ...playwrightServer(), enabled: false }
477
518
  });
478
519
 
479
520
  // src/utils/expect-defined.ts
480
521
  function expectDefined(value, label) {
481
522
  if (value === null || value === void 0) {
482
- 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;
483
526
  }
484
527
  return value;
485
528
  }
@@ -619,22 +662,31 @@ function estimateToolResultTokens(content) {
619
662
  function estimateTextTokens(text) {
620
663
  return RoughTokenEstimate(text);
621
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
+ }
622
676
  function estimateMessageTokens(messages) {
623
677
  let total = 0;
624
678
  for (const m of messages) {
625
- if (typeof m.content === "string") {
626
- total += estimateTextTokens(m.content);
627
- } else {
628
- for (const b of m.content) {
629
- if (b.type === "text") total += estimateTextTokens(b.text);
630
- else if (b.type === "tool_use") total += estimateToolInputTokens(b.input);
631
- else if (b.type === "tool_result") total += estimateToolResultTokens(b.content);
632
- }
679
+ if (typeof m._estTokens === "number" && m._estTokens > 0) {
680
+ total += m._estTokens;
681
+ continue;
633
682
  }
683
+ total += computeMessageTokens(m);
634
684
  }
635
685
  return total;
636
686
  }
637
687
  function estimateToolDefTokens(tool) {
688
+ const cached = tool._estDefTokens;
689
+ if (typeof cached === "number" && cached > 0) return cached;
638
690
  return RoughTokenEstimate(tool.name) + RoughTokenEstimate(tool.description ?? "") + RoughTokenEstimate(JSON.stringify(tool.inputSchema));
639
691
  }
640
692
  function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = CALIBRATION_GLOBAL_KEY) {
@@ -644,6 +696,11 @@ function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = C
644
696
  } else if (Array.isArray(messages)) {
645
697
  for (const m of messages) {
646
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
+ }
647
704
  const content = m.content;
648
705
  if (typeof content === "string") {
649
706
  messagesTokens += RoughTokenEstimate(content);
@@ -935,6 +992,6 @@ function createContextManagerTool(opts = {}) {
935
992
  }
936
993
  var contextManagerTool = createContextManagerTool();
937
994
 
938
- export { DefaultLogger, DefaultPathResolver, DefaultTokenCounter, allServers, awsServer, blockServer, braveSearchServer, context7Server, contextManagerTool, createContextManagerTool, everArtServer, filesystemServer, githubServer, googleMapsServer, miniMaxVisionServer, sentinelServer, slackServer, zaiVisionServer };
995
+ export { DefaultLogger, DefaultPathResolver, DefaultTokenCounter, allServers, awsServer, blockServer, braveSearchServer, context7Server, contextManagerTool, createContextManagerTool, everArtServer, filesystemServer, githubServer, googleMapsServer, miniMaxVisionServer, playwrightServer, sentinelServer, slackServer, zaiVisionServer };
939
996
  //# sourceMappingURL=index.js.map
940
997
  //# sourceMappingURL=index.js.map