@wrongstack/core 0.265.1 → 0.267.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 (69) hide show
  1. package/dist/{agent-bridge-DrkBxszZ.d.ts → agent-bridge-STJ3JwwK.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DM2pP-B6.d.ts → agent-subagent-runner-CzPGP3jA.d.ts} +25 -7
  3. package/dist/{brain-BXd_61kQ.d.ts → brain-Cdg77tVN.d.ts} +73 -1
  4. package/dist/{compactor-B8pOf45Y.d.ts → compactor-iMZ84CXq.d.ts} +19 -1
  5. package/dist/{config-BMCj_XDs.d.ts → config-Du3pYYln.d.ts} +54 -3
  6. package/dist/{context-MRk5PhNv.d.ts → context-dT5Ueund.d.ts} +65 -1
  7. package/dist/coordination/index.d.ts +17 -17
  8. package/dist/coordination/index.js +138 -114
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +25 -25
  11. package/dist/defaults/index.js +1729 -781
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +15 -15
  14. package/dist/execution/index.js +1119 -229
  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/{goal-preamble-DvHDSKSe.d.ts → goal-preamble-SulMTowG.d.ts} +28 -11
  19. package/dist/{goal-store-DtLMySNb.d.ts → goal-store-CABDwdFE.d.ts} +1 -1
  20. package/dist/{index-CEDeNodM.d.ts → index-Bms0m4oy.d.ts} +5 -5
  21. package/dist/{index-B-ch8K9C.d.ts → index-DtCVWel4.d.ts} +8 -8
  22. package/dist/index-IEuxQd-E.d.ts +82 -0
  23. package/dist/index.d.ts +118 -45
  24. package/dist/index.js +3083 -1602
  25. package/dist/index.js.map +1 -1
  26. package/dist/infrastructure/index.d.ts +6 -6
  27. package/dist/infrastructure/index.js +72 -1
  28. package/dist/infrastructure/index.js.map +1 -1
  29. package/dist/kernel/index.d.ts +9 -9
  30. package/dist/kernel/index.js.map +1 -1
  31. package/dist/{mcp-servers-2x4w6Jn9.d.ts → mcp-servers-C2cBTxUR.d.ts} +3 -3
  32. package/dist/models/index.d.ts +5 -5
  33. package/dist/models/index.js +30 -1
  34. package/dist/models/index.js.map +1 -1
  35. package/dist/{models-registry-DmJlKuNp.d.ts → models-registry-BqGZNJQ-.d.ts} +1 -1
  36. package/dist/{multi-agent-coordinator-DyCkCZnU.d.ts → multi-agent-coordinator-B8R43uPz.d.ts} +1 -1
  37. package/dist/{null-fleet-bus-CG9QY2aP.d.ts → null-fleet-bus-CnXa5oTH.d.ts} +14 -9
  38. package/dist/observability/index.d.ts +2 -2
  39. package/dist/{parallel-eternal-engine-Jw9uhEoT.d.ts → parallel-eternal-engine-DdNnw9BQ.d.ts} +11 -9
  40. package/dist/{path-resolver-Dy2ej-gE.d.ts → path-resolver-COIMLCQL.d.ts} +3 -3
  41. package/dist/{permission-B9SB45lp.d.ts → permission-B75JAi3-.d.ts} +1 -1
  42. package/dist/{permission-policy-CkjSXabK.d.ts → permission-policy-DlR9eJAM.d.ts} +2 -2
  43. package/dist/{pipeline-DPDxH_7m.d.ts → pipeline-BfD2k1rT.d.ts} +2 -2
  44. package/dist/{plan-templates-CzD9GnAU.d.ts → plan-templates-DSIKCXZN.d.ts} +5 -5
  45. package/dist/{llm-selector-C0tfTCUe.d.ts → provider-model-resolve-BNRsNuJx.d.ts} +40 -3
  46. package/dist/{provider-runner-DMa70ODu.d.ts → provider-runner-CX7iIvox.d.ts} +3 -3
  47. package/dist/{retry-policy-CN0khdlj.d.ts → retry-policy-BilV1ujH.d.ts} +1 -1
  48. package/dist/sdd/index.d.ts +8 -8
  49. package/dist/sdd/index.js +12 -12
  50. package/dist/sdd/index.js.map +1 -1
  51. package/dist/{secret-vault-B2yw84VT.d.ts → secret-vault-gkvEZZfE.d.ts} +2 -2
  52. package/dist/security/index.d.ts +5 -67
  53. package/dist/security/index.js +96 -76
  54. package/dist/security/index.js.map +1 -1
  55. package/dist/{selector-CzHh_igB.d.ts → selector-Bc7eWtT3.d.ts} +1 -1
  56. package/dist/{session-event-bridge-BUI6Jf-4.d.ts → session-event-bridge-D-araDEz.d.ts} +1 -1
  57. package/dist/{session-reader-CMgdMSRP.d.ts → session-reader-D7Dapswh.d.ts} +1 -1
  58. package/dist/storage/index.d.ts +11 -11
  59. package/dist/storage/index.js +81 -84
  60. package/dist/storage/index.js.map +1 -1
  61. package/dist/tools/index.d.ts +4 -2
  62. package/dist/tools/index.js.map +1 -1
  63. package/dist/types/index.d.ts +19 -19
  64. package/dist/types/index.js +1265 -400
  65. package/dist/types/index.js.map +1 -1
  66. package/dist/utils/index.d.ts +454 -406
  67. package/dist/utils/index.js +2191 -1201
  68. package/dist/utils/index.js.map +1 -1
  69. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
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-Dy2ej-gE.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-2x4w6Jn9.js';
2
+ export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-COIMLCQL.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-C2cBTxUR.js';
4
4
  import '../logger-B63L5bTg.js';
5
- import '../brain-BXd_61kQ.js';
6
- import '../context-MRk5PhNv.js';
7
- import '../config-BMCj_XDs.js';
5
+ import '../brain-Cdg77tVN.js';
6
+ import '../context-dT5Ueund.js';
7
+ import '../config-Du3pYYln.js';
8
8
  import '../path-resolver-CPRj4bFY.js';
9
- import '../compactor-B8pOf45Y.js';
9
+ import '../compactor-iMZ84CXq.js';
@@ -631,6 +631,76 @@ function isEmptyMessage(msg) {
631
631
  return msg.content.length === 0;
632
632
  }
633
633
 
634
+ // src/utils/tool-wire-compact.ts
635
+ var TOOL_DESCRIPTION_MAX_CHARS = 640;
636
+ var SCHEMA_DESCRIPTION_MAX_CHARS = 180;
637
+ var compactCache = /* @__PURE__ */ new WeakMap();
638
+ function compactToolDefinitionForWire(tool, opts = {}) {
639
+ const useDefaultOptions = opts.descriptionMaxChars === void 0 && opts.schemaDescriptionMaxChars === void 0;
640
+ if (useDefaultOptions && typeof tool === "object" && tool !== null) {
641
+ const cached = compactCache.get(tool);
642
+ if (cached) return cached;
643
+ }
644
+ const compact = {
645
+ name: tool.name,
646
+ description: compactDescription(
647
+ tool.description ?? "",
648
+ opts.descriptionMaxChars ?? TOOL_DESCRIPTION_MAX_CHARS
649
+ ),
650
+ inputSchema: compactSchemaDescriptions(
651
+ tool.inputSchema,
652
+ opts.schemaDescriptionMaxChars ?? SCHEMA_DESCRIPTION_MAX_CHARS
653
+ )
654
+ };
655
+ if (useDefaultOptions && typeof tool === "object" && tool !== null) {
656
+ compactCache.set(tool, compact);
657
+ }
658
+ return compact;
659
+ }
660
+ function compactSchemaDescriptions(schema, maxDescriptionChars = SCHEMA_DESCRIPTION_MAX_CHARS) {
661
+ const compact = compactSchemaNode(schema, maxDescriptionChars);
662
+ return isRecord(compact) ? compact : { type: "object", properties: {} };
663
+ }
664
+ function compactSchemaNode(node, maxDescriptionChars) {
665
+ if (Array.isArray(node)) {
666
+ return node.map((item) => compactSchemaNode(item, maxDescriptionChars));
667
+ }
668
+ if (!isRecord(node)) return node;
669
+ const out = {};
670
+ for (const [key, value] of Object.entries(node)) {
671
+ if (key === "description" && typeof value === "string") {
672
+ out[key] = compactDescription(value, maxDescriptionChars);
673
+ } else {
674
+ out[key] = compactSchemaNode(value, maxDescriptionChars);
675
+ }
676
+ }
677
+ return out;
678
+ }
679
+ function compactDescription(text, maxChars) {
680
+ const normalized = text.replace(/\s+/g, " ").trim();
681
+ if (normalized.length <= maxChars) return normalized;
682
+ if (maxChars <= 20) return normalized.slice(0, maxChars);
683
+ const hardLimit = maxChars - 12;
684
+ const boundary = findSemanticBoundary(normalized, hardLimit);
685
+ const head = normalized.slice(0, boundary > 0 ? boundary : hardLimit).trimEnd();
686
+ return `${head} ...`;
687
+ }
688
+ function findSemanticBoundary(text, limit) {
689
+ const punctuation = Math.max(
690
+ text.lastIndexOf(". ", limit),
691
+ text.lastIndexOf("; ", limit),
692
+ text.lastIndexOf(": ", limit)
693
+ );
694
+ if (punctuation >= Math.floor(limit * 0.45)) return punctuation + 1;
695
+ const comma = text.lastIndexOf(", ", limit);
696
+ if (comma >= Math.floor(limit * 0.6)) return comma + 1;
697
+ const space = text.lastIndexOf(" ", limit);
698
+ return space >= Math.floor(limit * 0.6) ? space : limit;
699
+ }
700
+ function isRecord(value) {
701
+ return !!value && typeof value === "object" && !Array.isArray(value);
702
+ }
703
+
634
704
  // src/utils/token-estimate.ts
635
705
  var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
636
706
  var CALIBRATION_GLOBAL_KEY = "__global__";
@@ -697,7 +767,8 @@ function estimateMessageTokens(messages) {
697
767
  function estimateToolDefTokens(tool) {
698
768
  const cached = tool._estDefTokens;
699
769
  if (typeof cached === "number" && cached > 0) return cached;
700
- return RoughTokenEstimate(tool.name) + RoughTokenEstimate(tool.description ?? "") + RoughTokenEstimate(JSON.stringify(tool.inputSchema));
770
+ const compact = compactToolDefinitionForWire(tool);
771
+ return RoughTokenEstimate(tool.name) + RoughTokenEstimate(compact.description) + RoughTokenEstimate(JSON.stringify(compact.inputSchema));
701
772
  }
702
773
  function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = CALIBRATION_GLOBAL_KEY) {
703
774
  let messagesTokens = 0;