@wrongstack/core 0.264.0 → 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 (90) hide show
  1. package/dist/{agent-bridge-D8sa1vtv.d.ts → agent-bridge-STJ3JwwK.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-c9DLkaas.d.ts → agent-subagent-runner-CzPGP3jA.d.ts} +131 -11
  3. package/dist/{brain-O1IdKPaK.d.ts → brain-Cdg77tVN.d.ts} +103 -2
  4. package/dist/{compactor-BBy0rCtB.d.ts → compactor-iMZ84CXq.d.ts} +19 -1
  5. package/dist/{config-Dz2F3H2K.d.ts → config-Du3pYYln.d.ts} +132 -13
  6. package/dist/{context-BGSpZNSE.d.ts → context-dT5Ueund.d.ts} +90 -12
  7. package/dist/coordination/index.d.ts +78 -22
  8. package/dist/coordination/index.js +695 -273
  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 +2327 -965
  13. package/dist/defaults/index.js.map +1 -1
  14. package/dist/execution/index.d.ts +16 -16
  15. package/dist/execution/index.js +1500 -371
  16. package/dist/execution/index.js.map +1 -1
  17. package/dist/execution/prompt-enhancer.d.ts +2 -2
  18. package/dist/execution/prompt-enhancer.js +1 -1
  19. package/dist/execution/prompt-enhancer.js.map +1 -1
  20. package/dist/extension/index.d.ts +6 -6
  21. package/dist/{goal-preamble-DzjFuN3p.d.ts → goal-preamble-SulMTowG.d.ts} +33 -12
  22. package/dist/{goal-store-CxWmCGbH.d.ts → goal-store-CABDwdFE.d.ts} +1 -1
  23. package/dist/{index-CbLSI66_.d.ts → index-Bms0m4oy.d.ts} +5 -5
  24. package/dist/{index-CYIQrXVF.d.ts → index-DtCVWel4.d.ts} +8 -8
  25. package/dist/index-IEuxQd-E.d.ts +82 -0
  26. package/dist/index.d.ts +261 -57
  27. package/dist/index.js +4799 -2212
  28. package/dist/index.js.map +1 -1
  29. package/dist/infrastructure/index.d.ts +6 -6
  30. package/dist/infrastructure/index.js +84 -9
  31. package/dist/infrastructure/index.js.map +1 -1
  32. package/dist/kernel/index.d.ts +9 -9
  33. package/dist/kernel/index.js +1 -1
  34. package/dist/kernel/index.js.map +1 -1
  35. package/dist/{mcp-servers-DC4QRPUI.d.ts → mcp-servers-C2cBTxUR.d.ts} +3 -3
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +104 -31
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-B_siPxqN.d.ts → models-registry-BqGZNJQ-.d.ts} +1 -1
  40. package/dist/{multi-agent-coordinator-CK5Jdj9K.d.ts → multi-agent-coordinator-B8R43uPz.d.ts} +1 -1
  41. package/dist/{null-fleet-bus-DgvD4SCO.d.ts → null-fleet-bus-CnXa5oTH.d.ts} +14 -9
  42. package/dist/observability/index.d.ts +2 -2
  43. package/dist/{parallel-eternal-engine-bK0JQBR_.d.ts → parallel-eternal-engine-DdNnw9BQ.d.ts} +11 -9
  44. package/dist/{path-resolver-BPEDlN38.d.ts → path-resolver-COIMLCQL.d.ts} +3 -3
  45. package/dist/{permission-4yvGmMRB.d.ts → permission-B75JAi3-.d.ts} +1 -1
  46. package/dist/{permission-policy-C6XpsBOy.d.ts → permission-policy-DlR9eJAM.d.ts} +2 -2
  47. package/dist/{pipeline-CXCeMz8J.d.ts → pipeline-BfD2k1rT.d.ts} +3 -3
  48. package/dist/{plan-templates-BvzRBkJc.d.ts → plan-templates-DSIKCXZN.d.ts} +32 -8
  49. package/dist/provider-model-resolve-BNRsNuJx.d.ts +107 -0
  50. package/dist/{provider-runner-C5aQpDWE.d.ts → provider-runner-CX7iIvox.d.ts} +3 -3
  51. package/dist/{retry-policy-CFhdtRzz.d.ts → retry-policy-BilV1ujH.d.ts} +1 -1
  52. package/dist/sdd/index.d.ts +8 -8
  53. package/dist/sdd/index.js +286 -105
  54. package/dist/sdd/index.js.map +1 -1
  55. package/dist/secret-vault-BAKpgFw_.d.ts +57 -0
  56. package/dist/{secret-vault-CxiVLbt1.d.ts → secret-vault-gkvEZZfE.d.ts} +43 -4
  57. package/dist/security/index.d.ts +6 -68
  58. package/dist/security/index.js +296 -95
  59. package/dist/security/index.js.map +1 -1
  60. package/dist/{selector-gIuhRTkN.d.ts → selector-Bc7eWtT3.d.ts} +1 -1
  61. package/dist/{session-event-bridge-DkvvrpDt.d.ts → session-event-bridge-D-araDEz.d.ts} +1 -1
  62. package/dist/{session-reader-KdfVwkKP.d.ts → session-reader-D7Dapswh.d.ts} +1 -1
  63. package/dist/storage/index.d.ts +112 -15
  64. package/dist/storage/index.js +491 -156
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/tools/index.d.ts +4 -2
  67. package/dist/tools/index.js.map +1 -1
  68. package/dist/types/index.d.ts +21 -21
  69. package/dist/types/index.js +1523 -450
  70. package/dist/types/index.js.map +1 -1
  71. package/dist/utils/index.d.ts +455 -407
  72. package/dist/utils/index.js +2191 -1203
  73. package/dist/utils/index.js.map +1 -1
  74. package/dist/{wstack-paths-CJjEwPXn.d.ts → wstack-paths-hOpNLmvf.d.ts} +2 -0
  75. package/package.json +1 -1
  76. package/skills/api-design/SKILL.md +1 -1
  77. package/skills/audit-log/SKILL.md +6 -6
  78. package/skills/bug-hunter/SKILL.md +5 -5
  79. package/skills/chimera/SKILL.md +4 -4
  80. package/skills/docker-deploy/SKILL.md +1 -1
  81. package/skills/git-flow/SKILL.md +3 -3
  82. package/skills/multi-agent/SKILL.md +3 -3
  83. package/skills/node-modern/SKILL.md +1 -0
  84. package/skills/observability/SKILL.md +2 -2
  85. package/skills/output-standards/SKILL.md +51 -28
  86. package/skills/refactor-planner/SKILL.md +3 -3
  87. package/skills/security-scanner/SKILL.md +4 -3
  88. package/skills/tech-stack/SKILL.md +1 -2
  89. package/dist/llm-selector-DzxuZnNz.d.ts +0 -58
  90. package/dist/secret-vault-BJDY28ev.d.ts +0 -25
@@ -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-BPEDlN38.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-DC4QRPUI.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-O1IdKPaK.js';
6
- import '../context-BGSpZNSE.js';
7
- import '../config-Dz2F3H2K.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-BBy0rCtB.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__";
@@ -649,12 +719,9 @@ function getCachedEstimate(key, compute) {
649
719
  const existing = ESTIMATE_CACHE.get(key);
650
720
  if (existing !== void 0) return existing;
651
721
  if (ESTIMATE_CACHE.size >= ESTIMATE_CACHE_MAX_SIZE) {
652
- let evicted = 0;
653
- const maxEvict = Math.floor(ESTIMATE_CACHE_MAX_SIZE / 4);
654
722
  for (const k of ESTIMATE_CACHE.keys()) {
655
- if (evicted >= maxEvict) break;
723
+ if (ESTIMATE_CACHE.size <= Math.floor(ESTIMATE_CACHE_MAX_SIZE / 2)) break;
656
724
  ESTIMATE_CACHE.delete(k);
657
- evicted++;
658
725
  }
659
726
  }
660
727
  const estimate = compute(key);
@@ -700,7 +767,8 @@ function estimateMessageTokens(messages) {
700
767
  function estimateToolDefTokens(tool) {
701
768
  const cached = tool._estDefTokens;
702
769
  if (typeof cached === "number" && cached > 0) return cached;
703
- 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));
704
772
  }
705
773
  function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = CALIBRATION_GLOBAL_KEY) {
706
774
  let messagesTokens = 0;
@@ -804,11 +872,12 @@ function createContextManagerTool(opts = {}) {
804
872
  const applyMessages = (next) => {
805
873
  const repaired = repairToolUseAdjacency(next);
806
874
  const finalMessages = repaired.messages;
875
+ if (finalMessages === messages) return repaired.report;
807
876
  if (ctx.state) {
808
877
  ctx.state.replaceMessages(finalMessages);
809
878
  } else {
810
879
  messages.length = 0;
811
- messages.splice(0, 0, ...finalMessages);
880
+ messages.push(...finalMessages);
812
881
  }
813
882
  return repaired.report;
814
883
  };
@@ -883,9 +952,15 @@ function createContextManagerTool(opts = {}) {
883
952
  }
884
953
  const report = await opts.compactor.compact(ctx);
885
954
  ctx.clearFileTracking();
886
- const repair = applyMessages([...ctx.messages]);
887
- const afterTokens = repair.changed ? roughEstimate(ctx.messages) : report.after;
888
- const repaired = report.repaired ?? (repair.changed ? repair : void 0);
955
+ let repaired = report.repaired;
956
+ let afterTokens;
957
+ if (!ctx.state) {
958
+ const repair = applyMessages([...ctx.messages]);
959
+ repaired = report.repaired ?? (repair.changed ? repair : void 0);
960
+ afterTokens = repair.changed ? roughEstimate(ctx.messages) : report.after;
961
+ } else {
962
+ afterTokens = report.after;
963
+ }
889
964
  const reduced = report.fullRequestTokensBefore > report.fullRequestTokensAfter;
890
965
  const repairedSomething = !!report.repaired;
891
966
  if (reduced || repairedSomething) {