@hamak/smart-data-dico 1.24.4 → 1.24.6

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 (96) hide show
  1. package/backend/dist/server.mjs +733 -503
  2. package/frontend/dist/assets/{abnfDiagram-VRR7QNED-1a1a0182.js → abnfDiagram-VRR7QNED-1ac4ac09.js} +1 -1
  3. package/frontend/dist/assets/{arc-fe172bfc.js → arc-3ae26e11.js} +1 -1
  4. package/frontend/dist/assets/architecture-TIHT7OUA-df38565f.js +1 -0
  5. package/frontend/dist/assets/{architectureDiagram-ZJ3FMSHR-aec5255a.js → architectureDiagram-ZJ3FMSHR-b3b10999.js} +1 -1
  6. package/frontend/dist/assets/{blockDiagram-677ZJIJ3-88a8ff2a.js → blockDiagram-677ZJIJ3-a9c6d500.js} +1 -1
  7. package/frontend/dist/assets/{c4Diagram-LMCZKHZV-26d629d9.js → c4Diagram-LMCZKHZV-0d6e31ec.js} +1 -1
  8. package/frontend/dist/assets/channel-254433c0.js +1 -0
  9. package/frontend/dist/assets/{chunk-2Q5K7J3B-d7e8f636.js → chunk-2Q5K7J3B-1bf25556.js} +1 -1
  10. package/frontend/dist/assets/{chunk-32BRIVSS-95c9713d.js → chunk-32BRIVSS-dd1657ef.js} +1 -1
  11. package/frontend/dist/assets/{chunk-5VM5RSS4-74afac14.js → chunk-5VM5RSS4-7c52339a.js} +1 -1
  12. package/frontend/dist/assets/{chunk-EX3LRPZG-04391ccd.js → chunk-EX3LRPZG-df1e795c.js} +1 -1
  13. package/frontend/dist/assets/{chunk-JWPE2WC7-2899e5e3.js → chunk-JWPE2WC7-70a42b42.js} +1 -1
  14. package/frontend/dist/assets/{chunk-MOJQB5TN-ae1ecffc.js → chunk-MOJQB5TN-5c44f824.js} +1 -1
  15. package/frontend/dist/assets/{chunk-PUDLZKDR-24dca4b5.js → chunk-PUDLZKDR-23b0a6e3.js} +1 -1
  16. package/frontend/dist/assets/{chunk-RYQCIY6F-e05ca676.js → chunk-RYQCIY6F-249010cc.js} +1 -1
  17. package/frontend/dist/assets/{chunk-V7JOEXUC-0e4194c9.js → chunk-V7JOEXUC-dd86c2ff.js} +1 -1
  18. package/frontend/dist/assets/{chunk-VR4S4FIN-0e7c1293.js → chunk-VR4S4FIN-8b06fb56.js} +1 -1
  19. package/frontend/dist/assets/{chunk-XXDRQBXY-6470c009.js → chunk-XXDRQBXY-39da8a47.js} +1 -1
  20. package/frontend/dist/assets/classDiagram-OUVF2IWQ-7ece20ed.js +1 -0
  21. package/frontend/dist/assets/classDiagram-v2-EOCWNBFH-7ece20ed.js +1 -0
  22. package/frontend/dist/assets/{cose-bilkent-JH36ORCC-20010dd8.js → cose-bilkent-JH36ORCC-d3c69454.js} +1 -1
  23. package/frontend/dist/assets/cynefin-VYW2F7L2-5a01171d.js +1 -0
  24. package/frontend/dist/assets/{cynefinDiagram-TSTJHNR4-b1beb031.js → cynefinDiagram-TSTJHNR4-3a7797a0.js} +1 -1
  25. package/frontend/dist/assets/{dagre-VKFMJZFB-cb9ac263.js → dagre-VKFMJZFB-d5cef451.js} +1 -1
  26. package/frontend/dist/assets/{diagram-FQU43EPY-c2bd7d7a.js → diagram-FQU43EPY-4c8edea0.js} +1 -1
  27. package/frontend/dist/assets/{diagram-G47NLZAW-93eaf843.js → diagram-G47NLZAW-560ab6da.js} +1 -1
  28. package/frontend/dist/assets/{diagram-NH7WQ7WH-8d554909.js → diagram-NH7WQ7WH-97ef586e.js} +1 -1
  29. package/frontend/dist/assets/{diagram-OA4YK3LP-4ee27e54.js → diagram-OA4YK3LP-f42e2ff5.js} +1 -1
  30. package/frontend/dist/assets/{diagram-WEI45ONY-a1ee152c.js → diagram-WEI45ONY-54d3e8ad.js} +1 -1
  31. package/frontend/dist/assets/{ebnfDiagram-CCIWWBDH-4583b8a8.js → ebnfDiagram-CCIWWBDH-fc5b1100.js} +1 -1
  32. package/frontend/dist/assets/{erDiagram-Q63AITRT-6f81cb12.js → erDiagram-Q63AITRT-a20ccda1.js} +1 -1
  33. package/frontend/dist/assets/eventmodeling-45OFAUF4-22c14824.js +1 -0
  34. package/frontend/dist/assets/flowDiagram-23GEKE2U-32449f05.js +1 -0
  35. package/frontend/dist/assets/{ganttDiagram-NO4QXBWP-993cd575.js → ganttDiagram-NO4QXBWP-21e9f3d7.js} +1 -1
  36. package/frontend/dist/assets/gitGraph-TEB2WS4Q-17d6e4af.js +1 -0
  37. package/frontend/dist/assets/{gitGraphDiagram-IHSO6WYX-ee36722e.js → gitGraphDiagram-IHSO6WYX-a4ef9947.js} +1 -1
  38. package/frontend/dist/assets/{index-072fdcaa.js → index-02f83d95.js} +28 -27
  39. package/frontend/dist/assets/info-DKCQHKI2-ac7cfe65.js +1 -0
  40. package/frontend/dist/assets/{infoDiagram-FWYZ7A6U-6bf63009.js → infoDiagram-FWYZ7A6U-0ddf01b3.js} +1 -1
  41. package/frontend/dist/assets/{ishikawaDiagram-FXEZZL3T-812fbe54.js → ishikawaDiagram-FXEZZL3T-b100c8bf.js} +1 -1
  42. package/frontend/dist/assets/{journeyDiagram-5HDEW3XC-9c3f4252.js → journeyDiagram-5HDEW3XC-277cde84.js} +1 -1
  43. package/frontend/dist/assets/{kanban-definition-HUTT4EX6-2b515039.js → kanban-definition-HUTT4EX6-0493c7ae.js} +1 -1
  44. package/frontend/dist/assets/{linear-8c16d76e.js → linear-38755882.js} +1 -1
  45. package/frontend/dist/assets/{mermaid-parser.core-a1a90c48.js → mermaid-parser.core-432f6fdd.js} +2 -2
  46. package/frontend/dist/assets/{mermaid.core-e609abc8.js → mermaid.core-6a67b6b8.js} +3 -3
  47. package/frontend/dist/assets/{mindmap-definition-LN4V7U3C-a3d0643d.js → mindmap-definition-LN4V7U3C-087cb2dc.js} +1 -1
  48. package/frontend/dist/assets/packet-7NZHBO7P-36f37972.js +1 -0
  49. package/frontend/dist/assets/{pegDiagram-2B236MQR-a2d96c45.js → pegDiagram-2B236MQR-d0c9d90f.js} +1 -1
  50. package/frontend/dist/assets/pie-RZYD4A2V-61794516.js +1 -0
  51. package/frontend/dist/assets/{pieDiagram-ENE6RG2P-7c68a3bd.js → pieDiagram-ENE6RG2P-83755113.js} +1 -1
  52. package/frontend/dist/assets/{quadrantDiagram-ABIIQ3AL-afba166e.js → quadrantDiagram-ABIIQ3AL-5f18b4fd.js} +1 -1
  53. package/frontend/dist/assets/radar-I7S5WNFK-034b88d9.js +1 -0
  54. package/frontend/dist/assets/railroad-3IZDKUUU-a4892ed9.js +1 -0
  55. package/frontend/dist/assets/railroad-abnf-AHOZXSZD-1dfb3444.js +1 -0
  56. package/frontend/dist/assets/railroad-ebnf-EBAXGLYW-877c30ab.js +1 -0
  57. package/frontend/dist/assets/railroad-peg-LSFZ7HO6-3e0fcace.js +1 -0
  58. package/frontend/dist/assets/{railroadDiagram-RFXS5EU6-52e9e397.js → railroadDiagram-RFXS5EU6-2268aa66.js} +1 -1
  59. package/frontend/dist/assets/{requirementDiagram-TGXJPOKE-4e4ad2d6.js → requirementDiagram-TGXJPOKE-942a8f35.js} +1 -1
  60. package/frontend/dist/assets/{sankeyDiagram-HTMAVEWB-59433ed0.js → sankeyDiagram-HTMAVEWB-504dd8aa.js} +1 -1
  61. package/frontend/dist/assets/{sequenceDiagram-DBY2YBRQ-d80ec509.js → sequenceDiagram-DBY2YBRQ-a402da2a.js} +1 -1
  62. package/frontend/dist/assets/{sizeCapture-X5ZJPWSS-1c45120f.js → sizeCapture-X5ZJPWSS-2776eb4d.js} +1 -1
  63. package/frontend/dist/assets/{stateDiagram-2N3HPSRC-204251c3.js → stateDiagram-2N3HPSRC-1b9cfcbe.js} +1 -1
  64. package/frontend/dist/assets/stateDiagram-v2-6OUMAXLB-f1a8ebdf.js +1 -0
  65. package/frontend/dist/assets/{swimlanes-5IMT3BWC-49473fe2.js → swimlanes-5IMT3BWC-7a3d33f8.js} +1 -1
  66. package/frontend/dist/assets/swimlanesDiagram-G3AALYLV-2e2afd36.js +8 -0
  67. package/frontend/dist/assets/{timeline-definition-FHXFAJF6-f4f9276e.js → timeline-definition-FHXFAJF6-9c4d37aa.js} +1 -1
  68. package/frontend/dist/assets/treeView-QDETBFTQ-fa371c45.js +1 -0
  69. package/frontend/dist/assets/treemap-6X3UGDF4-d781249a.js +1 -0
  70. package/frontend/dist/assets/{vennDiagram-L72KCM5P-dd390ddd.js → vennDiagram-L72KCM5P-b7968cac.js} +1 -1
  71. package/frontend/dist/assets/wardley-OPB4EBWU-b96ca787.js +1 -0
  72. package/frontend/dist/assets/{wardleyDiagram-EHGQE667-d9939a34.js → wardleyDiagram-EHGQE667-b1013425.js} +1 -1
  73. package/frontend/dist/assets/{xychartDiagram-FW5EYKEG-41316f0a.js → xychartDiagram-FW5EYKEG-da024ff1.js} +1 -1
  74. package/frontend/dist/index.html +1 -1
  75. package/package.json +1 -1
  76. package/frontend/dist/assets/architecture-TIHT7OUA-d693a817.js +0 -1
  77. package/frontend/dist/assets/channel-6410e473.js +0 -1
  78. package/frontend/dist/assets/classDiagram-OUVF2IWQ-4c410cb6.js +0 -1
  79. package/frontend/dist/assets/classDiagram-v2-EOCWNBFH-4c410cb6.js +0 -1
  80. package/frontend/dist/assets/cynefin-VYW2F7L2-5e26aaa6.js +0 -1
  81. package/frontend/dist/assets/eventmodeling-45OFAUF4-4fde353a.js +0 -1
  82. package/frontend/dist/assets/flowDiagram-23GEKE2U-614c4178.js +0 -1
  83. package/frontend/dist/assets/gitGraph-TEB2WS4Q-6b1ac379.js +0 -1
  84. package/frontend/dist/assets/info-DKCQHKI2-3d895d13.js +0 -1
  85. package/frontend/dist/assets/packet-7NZHBO7P-920badc5.js +0 -1
  86. package/frontend/dist/assets/pie-RZYD4A2V-b244da15.js +0 -1
  87. package/frontend/dist/assets/radar-I7S5WNFK-5d641e70.js +0 -1
  88. package/frontend/dist/assets/railroad-3IZDKUUU-c6aa8307.js +0 -1
  89. package/frontend/dist/assets/railroad-abnf-AHOZXSZD-ee3ed9b2.js +0 -1
  90. package/frontend/dist/assets/railroad-ebnf-EBAXGLYW-86b4539a.js +0 -1
  91. package/frontend/dist/assets/railroad-peg-LSFZ7HO6-19e88030.js +0 -1
  92. package/frontend/dist/assets/stateDiagram-v2-6OUMAXLB-f361b657.js +0 -1
  93. package/frontend/dist/assets/swimlanesDiagram-G3AALYLV-34315d98.js +0 -8
  94. package/frontend/dist/assets/treeView-QDETBFTQ-58f41f68.js +0 -1
  95. package/frontend/dist/assets/treemap-6X3UGDF4-29c5bf00.js +0 -1
  96. package/frontend/dist/assets/wardley-OPB4EBWU-21473c57.js +0 -1
@@ -694,17 +694,17 @@ var require_statuses = __commonJS({
694
694
  };
695
695
  function createMessageToStatusCodeMap(codes2) {
696
696
  var map2 = {};
697
- Object.keys(codes2).forEach(/* @__PURE__ */ __name(function forEachCode(code) {
698
- var message = codes2[code];
699
- var status2 = Number(code);
697
+ Object.keys(codes2).forEach(/* @__PURE__ */ __name(function forEachCode(code2) {
698
+ var message = codes2[code2];
699
+ var status2 = Number(code2);
700
700
  map2[message.toLowerCase()] = status2;
701
701
  }, "forEachCode"));
702
702
  return map2;
703
703
  }
704
704
  __name(createMessageToStatusCodeMap, "createMessageToStatusCodeMap");
705
705
  function createStatusCodeList(codes2) {
706
- return Object.keys(codes2).map(/* @__PURE__ */ __name(function mapCode(code) {
707
- return Number(code);
706
+ return Object.keys(codes2).map(/* @__PURE__ */ __name(function mapCode(code2) {
707
+ return Number(code2);
708
708
  }, "mapCode"));
709
709
  }
710
710
  __name(createStatusCodeList, "createStatusCodeList");
@@ -716,25 +716,25 @@ var require_statuses = __commonJS({
716
716
  return status.code[msg];
717
717
  }
718
718
  __name(getStatusCode, "getStatusCode");
719
- function getStatusMessage(code) {
720
- if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
721
- throw new Error("invalid status code: " + code);
719
+ function getStatusMessage(code2) {
720
+ if (!Object.prototype.hasOwnProperty.call(status.message, code2)) {
721
+ throw new Error("invalid status code: " + code2);
722
722
  }
723
- return status.message[code];
723
+ return status.message[code2];
724
724
  }
725
725
  __name(getStatusMessage, "getStatusMessage");
726
- function status(code) {
727
- if (typeof code === "number") {
728
- return getStatusMessage(code);
726
+ function status(code2) {
727
+ if (typeof code2 === "number") {
728
+ return getStatusMessage(code2);
729
729
  }
730
- if (typeof code !== "string") {
730
+ if (typeof code2 !== "string") {
731
731
  throw new TypeError("code must be a number or string");
732
732
  }
733
- var n = parseInt(code, 10);
733
+ var n = parseInt(code2, 10);
734
734
  if (!isNaN(n)) {
735
735
  return getStatusMessage(n);
736
736
  }
737
- return getStatusCode(code);
737
+ return getStatusCode(code2);
738
738
  }
739
739
  __name(status, "status");
740
740
  }
@@ -870,10 +870,10 @@ var require_http_errors = __commonJS({
870
870
  return HttpError;
871
871
  }
872
872
  __name(createHttpErrorConstructor, "createHttpErrorConstructor");
873
- function createClientErrorConstructor(HttpError, name21, code) {
873
+ function createClientErrorConstructor(HttpError, name21, code2) {
874
874
  var className = toClassName(name21);
875
875
  function ClientError(message) {
876
- var msg = message != null ? message : statuses.message[code];
876
+ var msg = message != null ? message : statuses.message[code2];
877
877
  var err = new Error(msg);
878
878
  Error.captureStackTrace(err, ClientError);
879
879
  setPrototypeOf(err, ClientError.prototype);
@@ -894,8 +894,8 @@ var require_http_errors = __commonJS({
894
894
  __name(ClientError, "ClientError");
895
895
  inherits(ClientError, HttpError);
896
896
  nameFunc(ClientError, className);
897
- ClientError.prototype.status = code;
898
- ClientError.prototype.statusCode = code;
897
+ ClientError.prototype.status = code2;
898
+ ClientError.prototype.statusCode = code2;
899
899
  ClientError.prototype.expose = true;
900
900
  return ClientError;
901
901
  }
@@ -912,10 +912,10 @@ var require_http_errors = __commonJS({
912
912
  }, "isHttpError");
913
913
  }
914
914
  __name(createIsHttpErrorFunction, "createIsHttpErrorFunction");
915
- function createServerErrorConstructor(HttpError, name21, code) {
915
+ function createServerErrorConstructor(HttpError, name21, code2) {
916
916
  var className = toClassName(name21);
917
917
  function ServerError2(message) {
918
- var msg = message != null ? message : statuses.message[code];
918
+ var msg = message != null ? message : statuses.message[code2];
919
919
  var err = new Error(msg);
920
920
  Error.captureStackTrace(err, ServerError2);
921
921
  setPrototypeOf(err, ServerError2.prototype);
@@ -936,8 +936,8 @@ var require_http_errors = __commonJS({
936
936
  __name(ServerError2, "ServerError");
937
937
  inherits(ServerError2, HttpError);
938
938
  nameFunc(ServerError2, className);
939
- ServerError2.prototype.status = code;
940
- ServerError2.prototype.statusCode = code;
939
+ ServerError2.prototype.status = code2;
940
+ ServerError2.prototype.statusCode = code2;
941
941
  ServerError2.prototype.expose = false;
942
942
  return ServerError2;
943
943
  }
@@ -951,19 +951,19 @@ var require_http_errors = __commonJS({
951
951
  }
952
952
  __name(nameFunc, "nameFunc");
953
953
  function populateConstructorExports(exports3, codes, HttpError) {
954
- codes.forEach(/* @__PURE__ */ __name(function forEachCode(code) {
954
+ codes.forEach(/* @__PURE__ */ __name(function forEachCode(code2) {
955
955
  var CodeError;
956
- var name21 = toIdentifier(statuses.message[code]);
957
- switch (codeClass(code)) {
956
+ var name21 = toIdentifier(statuses.message[code2]);
957
+ switch (codeClass(code2)) {
958
958
  case 400:
959
- CodeError = createClientErrorConstructor(HttpError, name21, code);
959
+ CodeError = createClientErrorConstructor(HttpError, name21, code2);
960
960
  break;
961
961
  case 500:
962
- CodeError = createServerErrorConstructor(HttpError, name21, code);
962
+ CodeError = createServerErrorConstructor(HttpError, name21, code2);
963
963
  break;
964
964
  }
965
965
  if (CodeError) {
966
- exports3[code] = CodeError;
966
+ exports3[code2] = CodeError;
967
967
  exports3[name21] = CodeError;
968
968
  }
969
969
  }, "forEachCode"));
@@ -2876,22 +2876,22 @@ var require_dbcs_codec = __commonJS({
2876
2876
  var part = chunk[k];
2877
2877
  if (typeof part === "string") {
2878
2878
  for (var l = 0; l < part.length; ) {
2879
- var code = part.charCodeAt(l++);
2880
- if (55296 <= code && code < 56320) {
2879
+ var code2 = part.charCodeAt(l++);
2880
+ if (55296 <= code2 && code2 < 56320) {
2881
2881
  var codeTrail = part.charCodeAt(l++);
2882
2882
  if (56320 <= codeTrail && codeTrail < 57344)
2883
- writeTable[curAddr++] = 65536 + (code - 55296) * 1024 + (codeTrail - 56320);
2883
+ writeTable[curAddr++] = 65536 + (code2 - 55296) * 1024 + (codeTrail - 56320);
2884
2884
  else
2885
2885
  throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
2886
- } else if (4080 < code && code <= 4095) {
2887
- var len = 4095 - code + 2;
2886
+ } else if (4080 < code2 && code2 <= 4095) {
2887
+ var len = 4095 - code2 + 2;
2888
2888
  var seq = [];
2889
2889
  for (var m = 0; m < len; m++)
2890
2890
  seq.push(part.charCodeAt(l++));
2891
2891
  writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
2892
2892
  this.decodeTableSeq.push(seq);
2893
2893
  } else
2894
- writeTable[curAddr++] = code;
2894
+ writeTable[curAddr++] = code2;
2895
2895
  }
2896
2896
  } else if (typeof part === "number") {
2897
2897
  var charCode = writeTable[curAddr - 1] + 1;
@@ -14604,8 +14604,8 @@ var require_text = __commonJS({
14604
14604
  var debug2 = require_src()("body-parser:text");
14605
14605
  var read = require_read();
14606
14606
  var typeis = require_type_is();
14607
- module.exports = text2;
14608
- function text2(options2) {
14607
+ module.exports = text3;
14608
+ function text3(options2) {
14609
14609
  var opts = options2 || {};
14610
14610
  var defaultCharset = opts.defaultCharset || "utf-8";
14611
14611
  var inflate = opts.inflate !== false;
@@ -14647,7 +14647,7 @@ var require_text = __commonJS({
14647
14647
  });
14648
14648
  }, "textParser");
14649
14649
  }
14650
- __name(text2, "text");
14650
+ __name(text3, "text");
14651
14651
  function getCharset(req) {
14652
14652
  try {
14653
14653
  return (contentType.parse(req).parameters.charset || "").toLowerCase();
@@ -23409,16 +23409,16 @@ var require_cookie = __commonJS({
23409
23409
  __name(parse6, "parse");
23410
23410
  function startIndex(str2, index2, max) {
23411
23411
  do {
23412
- var code = str2.charCodeAt(index2);
23413
- if (code !== 32 && code !== 9) return index2;
23412
+ var code2 = str2.charCodeAt(index2);
23413
+ if (code2 !== 32 && code2 !== 9) return index2;
23414
23414
  } while (++index2 < max);
23415
23415
  return max;
23416
23416
  }
23417
23417
  __name(startIndex, "startIndex");
23418
23418
  function endIndex(str2, index2, min) {
23419
23419
  while (index2 > min) {
23420
- var code = str2.charCodeAt(--index2);
23421
- if (code !== 32 && code !== 9) return index2 + 1;
23420
+ var code2 = str2.charCodeAt(--index2);
23421
+ if (code2 !== 32 && code2 !== 9) return index2 + 1;
23422
23422
  }
23423
23423
  return min;
23424
23424
  }
@@ -23634,11 +23634,11 @@ var require_response = __commonJS({
23634
23634
  var res = Object.create(http.ServerResponse.prototype);
23635
23635
  module.exports = res;
23636
23636
  var charsetRegExp = /;\s*charset\s*=/;
23637
- res.status = /* @__PURE__ */ __name(function status(code) {
23638
- if ((typeof code === "string" || Math.floor(code) !== code) && code > 99 && code < 1e3) {
23639
- deprecate("res.status(" + JSON.stringify(code) + "): use res.status(" + Math.floor(code) + ") instead");
23637
+ res.status = /* @__PURE__ */ __name(function status(code2) {
23638
+ if ((typeof code2 === "string" || Math.floor(code2) !== code2) && code2 > 99 && code2 < 1e3) {
23639
+ deprecate("res.status(" + JSON.stringify(code2) + "): use res.status(" + Math.floor(code2) + ") instead");
23640
23640
  }
23641
- this.statusCode = code;
23641
+ this.statusCode = code2;
23642
23642
  return this;
23643
23643
  }, "status");
23644
23644
  res.links = function(links) {
@@ -29829,14 +29829,14 @@ var require_foldFlowLines = __commonJS({
29829
29829
  var FOLD_FLOW = "flow";
29830
29830
  var FOLD_BLOCK = "block";
29831
29831
  var FOLD_QUOTED = "quoted";
29832
- function foldFlowLines(text2, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
29832
+ function foldFlowLines(text3, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
29833
29833
  if (!lineWidth || lineWidth < 0)
29834
- return text2;
29834
+ return text3;
29835
29835
  if (lineWidth < minContentWidth)
29836
29836
  minContentWidth = 0;
29837
29837
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
29838
- if (text2.length <= endStep)
29839
- return text2;
29838
+ if (text3.length <= endStep)
29839
+ return text3;
29840
29840
  const folds = [];
29841
29841
  const escapedFolds = {};
29842
29842
  let end = lineWidth - indent.length;
@@ -29853,14 +29853,14 @@ var require_foldFlowLines = __commonJS({
29853
29853
  let escStart = -1;
29854
29854
  let escEnd = -1;
29855
29855
  if (mode === FOLD_BLOCK) {
29856
- i = consumeMoreIndentedLines(text2, i, indent.length);
29856
+ i = consumeMoreIndentedLines(text3, i, indent.length);
29857
29857
  if (i !== -1)
29858
29858
  end = i + endStep;
29859
29859
  }
29860
- for (let ch; ch = text2[i += 1]; ) {
29860
+ for (let ch; ch = text3[i += 1]; ) {
29861
29861
  if (mode === FOLD_QUOTED && ch === "\\") {
29862
29862
  escStart = i;
29863
- switch (text2[i + 1]) {
29863
+ switch (text3[i + 1]) {
29864
29864
  case "x":
29865
29865
  i += 3;
29866
29866
  break;
@@ -29877,12 +29877,12 @@ var require_foldFlowLines = __commonJS({
29877
29877
  }
29878
29878
  if (ch === "\n") {
29879
29879
  if (mode === FOLD_BLOCK)
29880
- i = consumeMoreIndentedLines(text2, i, indent.length);
29880
+ i = consumeMoreIndentedLines(text3, i, indent.length);
29881
29881
  end = i + indent.length + endStep;
29882
29882
  split = void 0;
29883
29883
  } else {
29884
29884
  if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
29885
- const next = text2[i + 1];
29885
+ const next = text3[i + 1];
29886
29886
  if (next && next !== " " && next !== "\n" && next !== " ")
29887
29887
  split = i;
29888
29888
  }
@@ -29894,12 +29894,12 @@ var require_foldFlowLines = __commonJS({
29894
29894
  } else if (mode === FOLD_QUOTED) {
29895
29895
  while (prev === " " || prev === " ") {
29896
29896
  prev = ch;
29897
- ch = text2[i += 1];
29897
+ ch = text3[i += 1];
29898
29898
  overflow = true;
29899
29899
  }
29900
29900
  const j = i > escEnd + 1 ? i - 2 : escStart - 1;
29901
29901
  if (escapedFolds[j])
29902
- return text2;
29902
+ return text3;
29903
29903
  folds.push(j);
29904
29904
  escapedFolds[j] = true;
29905
29905
  end = j + endStep;
@@ -29914,40 +29914,40 @@ var require_foldFlowLines = __commonJS({
29914
29914
  if (overflow && onOverflow)
29915
29915
  onOverflow();
29916
29916
  if (folds.length === 0)
29917
- return text2;
29917
+ return text3;
29918
29918
  if (onFold)
29919
29919
  onFold();
29920
- let res = text2.slice(0, folds[0]);
29920
+ let res = text3.slice(0, folds[0]);
29921
29921
  for (let i2 = 0; i2 < folds.length; ++i2) {
29922
29922
  const fold = folds[i2];
29923
- const end2 = folds[i2 + 1] || text2.length;
29923
+ const end2 = folds[i2 + 1] || text3.length;
29924
29924
  if (fold === 0)
29925
29925
  res = `
29926
- ${indent}${text2.slice(0, end2)}`;
29926
+ ${indent}${text3.slice(0, end2)}`;
29927
29927
  else {
29928
29928
  if (mode === FOLD_QUOTED && escapedFolds[fold])
29929
- res += `${text2[fold]}\\`;
29929
+ res += `${text3[fold]}\\`;
29930
29930
  res += `
29931
- ${indent}${text2.slice(fold + 1, end2)}`;
29931
+ ${indent}${text3.slice(fold + 1, end2)}`;
29932
29932
  }
29933
29933
  }
29934
29934
  return res;
29935
29935
  }
29936
29936
  __name(foldFlowLines, "foldFlowLines");
29937
- function consumeMoreIndentedLines(text2, i, indent) {
29937
+ function consumeMoreIndentedLines(text3, i, indent) {
29938
29938
  let end = i;
29939
29939
  let start = i + 1;
29940
- let ch = text2[start];
29940
+ let ch = text3[start];
29941
29941
  while (ch === " " || ch === " ") {
29942
29942
  if (i < start + indent) {
29943
- ch = text2[++i];
29943
+ ch = text3[++i];
29944
29944
  } else {
29945
29945
  do {
29946
- ch = text2[++i];
29946
+ ch = text3[++i];
29947
29947
  } while (ch && ch !== "\n");
29948
29948
  end = i;
29949
29949
  start = i + 1;
29950
- ch = text2[start];
29950
+ ch = text3[start];
29951
29951
  }
29952
29952
  }
29953
29953
  return end;
@@ -30012,8 +30012,8 @@ var require_stringifyString = __commonJS({
30012
30012
  case "u":
30013
30013
  {
30014
30014
  str2 += json3.slice(start, i);
30015
- const code = json3.substr(i + 2, 4);
30016
- switch (code) {
30015
+ const code2 = json3.substr(i + 2, 4);
30016
+ switch (code2) {
30017
30017
  case "0000":
30018
30018
  str2 += "\\0";
30019
30019
  break;
@@ -30039,8 +30039,8 @@ var require_stringifyString = __commonJS({
30039
30039
  str2 += "\\P";
30040
30040
  break;
30041
30041
  default:
30042
- if (code.substr(0, 2) === "00")
30043
- str2 += "\\x" + code.substr(2);
30042
+ if (code2.substr(0, 2) === "00")
30043
+ str2 += "\\x" + code2.substr(2);
30044
30044
  else
30045
30045
  str2 += json3.substr(i, 6);
30046
30046
  }
@@ -32597,10 +32597,10 @@ var require_errors = __commonJS({
32597
32597
  static {
32598
32598
  __name(this, "YAMLError");
32599
32599
  }
32600
- constructor(name21, pos, code, message) {
32600
+ constructor(name21, pos, code2, message) {
32601
32601
  super();
32602
32602
  this.name = name21;
32603
- this.code = code;
32603
+ this.code = code2;
32604
32604
  this.message = message;
32605
32605
  this.pos = pos;
32606
32606
  }
@@ -32609,16 +32609,16 @@ var require_errors = __commonJS({
32609
32609
  static {
32610
32610
  __name(this, "YAMLParseError");
32611
32611
  }
32612
- constructor(pos, code, message) {
32613
- super("YAMLParseError", pos, code, message);
32612
+ constructor(pos, code2, message) {
32613
+ super("YAMLParseError", pos, code2, message);
32614
32614
  }
32615
32615
  };
32616
32616
  var YAMLWarning = class extends YAMLError {
32617
32617
  static {
32618
32618
  __name(this, "YAMLWarning");
32619
32619
  }
32620
- constructor(pos, code, message) {
32621
- super("YAMLWarning", pos, code, message);
32620
+ constructor(pos, code2, message) {
32621
+ super("YAMLWarning", pos, code2, message);
32622
32622
  }
32623
32623
  };
32624
32624
  var prettifyError2 = /* @__PURE__ */ __name((src, lc) => (error48) => {
@@ -33540,7 +33540,7 @@ var require_resolve_flow_scalar = __commonJS({
33540
33540
  const { offset, type, source, end } = scalar;
33541
33541
  let _type;
33542
33542
  let value;
33543
- const _onError = /* @__PURE__ */ __name((rel, code, msg) => onError2(offset + rel, code, msg), "_onError");
33543
+ const _onError = /* @__PURE__ */ __name((rel, code2, msg) => onError2(offset + rel, code2, msg), "_onError");
33544
33544
  switch (type) {
33545
33545
  case "scalar":
33546
33546
  _type = Scalar.Scalar.PLAIN;
@@ -33743,13 +33743,13 @@ var require_resolve_flow_scalar = __commonJS({
33743
33743
  function parseCharCode(source, offset, length, onError2) {
33744
33744
  const cc = source.substr(offset, length);
33745
33745
  const ok2 = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
33746
- const code = ok2 ? parseInt(cc, 16) : NaN;
33747
- if (isNaN(code)) {
33746
+ const code2 = ok2 ? parseInt(cc, 16) : NaN;
33747
+ if (isNaN(code2)) {
33748
33748
  const raw = source.substr(offset - 2, length + 2);
33749
33749
  onError2(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
33750
33750
  return raw;
33751
33751
  }
33752
- return String.fromCodePoint(code);
33752
+ return String.fromCodePoint(code2);
33753
33753
  }
33754
33754
  __name(parseCharCode, "parseCharCode");
33755
33755
  exports2.resolveFlowScalar = resolveFlowScalar;
@@ -34080,12 +34080,12 @@ var require_composer = __commonJS({
34080
34080
  this.prelude = [];
34081
34081
  this.errors = [];
34082
34082
  this.warnings = [];
34083
- this.onError = (source, code, message, warning) => {
34083
+ this.onError = (source, code2, message, warning) => {
34084
34084
  const pos = getErrorPos(source);
34085
34085
  if (warning)
34086
- this.warnings.push(new errors.YAMLWarning(pos, code, message));
34086
+ this.warnings.push(new errors.YAMLWarning(pos, code2, message));
34087
34087
  else
34088
- this.errors.push(new errors.YAMLParseError(pos, code, message));
34088
+ this.errors.push(new errors.YAMLParseError(pos, code2, message));
34089
34089
  };
34090
34090
  this.directives = new directives.Directives({ version: options2.version || "1.2" });
34091
34091
  this.options = options2;
@@ -34245,12 +34245,12 @@ var require_cst_scalar = __commonJS({
34245
34245
  var stringifyString = require_stringifyString();
34246
34246
  function resolveAsScalar(token, strict = true, onError2) {
34247
34247
  if (token) {
34248
- const _onError = /* @__PURE__ */ __name((pos, code, message) => {
34248
+ const _onError = /* @__PURE__ */ __name((pos, code2, message) => {
34249
34249
  const offset = typeof pos === "number" ? pos : Array.isArray(pos) ? pos[0] : pos.offset;
34250
34250
  if (onError2)
34251
- onError2(offset, code, message);
34251
+ onError2(offset, code2, message);
34252
34252
  else
34253
- throw new errors.YAMLParseError([offset, offset + 1], code, message);
34253
+ throw new errors.YAMLParseError([offset, offset + 1], code2, message);
34254
34254
  }, "_onError");
34255
34255
  switch (token.type) {
34256
34256
  case "scalar":
@@ -38968,8 +38968,8 @@ function callTaskParser(parser4, streams) {
38968
38968
  return parser4(streams.stdOut, streams.stdErr);
38969
38969
  }
38970
38970
  function parseStringResponse(result, parsers12, texts, trim = true) {
38971
- asArray(texts).forEach((text2) => {
38972
- for (let lines = toLinesWithContent(text2, trim), i = 0, max = lines.length; i < max; i++) {
38971
+ asArray(texts).forEach((text3) => {
38972
+ for (let lines = toLinesWithContent(text3, trim), i = 0, max = lines.length; i < max; i++) {
38973
38973
  const line = /* @__PURE__ */ __name((offset = 0) => {
38974
38974
  if (i + offset >= max) {
38975
38975
  return;
@@ -39019,10 +39019,10 @@ function checkIsBareRepoTask() {
39019
39019
  function isNotRepoMessage(error48) {
39020
39020
  return /(Not a git repository|Kein Git-Repository)/i.test(String(error48));
39021
39021
  }
39022
- function cleanSummaryParser(dryRun, text2) {
39022
+ function cleanSummaryParser(dryRun, text3) {
39023
39023
  const summary = new CleanResponse(dryRun);
39024
39024
  const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
39025
- toLinesWithContent(text2).forEach((line) => {
39025
+ toLinesWithContent(text3).forEach((line) => {
39026
39026
  const removed = line.replace(regexp, "");
39027
39027
  summary.paths.push(removed);
39028
39028
  (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
@@ -39049,8 +39049,8 @@ function straightThroughStringTask(commands, trimmed2 = false) {
39049
39049
  return {
39050
39050
  commands,
39051
39051
  format: "utf-8",
39052
- parser(text2) {
39053
- return trimmed2 ? String(text2).trim() : text2;
39052
+ parser(text3) {
39053
+ return trimmed2 ? String(text3).trim() : text3;
39054
39054
  }
39055
39055
  };
39056
39056
  }
@@ -39088,8 +39088,8 @@ function cleanTask(mode, customArgs) {
39088
39088
  return {
39089
39089
  commands,
39090
39090
  format: "utf-8",
39091
- parser(text2) {
39092
- return cleanSummaryParser(mode === "n", text2);
39091
+ parser(text3) {
39092
+ return cleanSummaryParser(mode === "n", text3);
39093
39093
  }
39094
39094
  };
39095
39095
  }
@@ -39126,18 +39126,18 @@ function isInteractiveMode(option) {
39126
39126
  }
39127
39127
  return option === "--interactive";
39128
39128
  }
39129
- function configListParser(text2) {
39129
+ function configListParser(text3) {
39130
39130
  const config3 = new ConfigList();
39131
- for (const item of configParser(text2)) {
39131
+ for (const item of configParser(text3)) {
39132
39132
  config3.addValue(item.file, String(item.key), item.value);
39133
39133
  }
39134
39134
  return config3;
39135
39135
  }
39136
- function configGetParser(text2, key2) {
39136
+ function configGetParser(text3, key2) {
39137
39137
  let value = null;
39138
39138
  const values = [];
39139
39139
  const scopes = /* @__PURE__ */ new Map();
39140
- for (const item of configParser(text2, key2)) {
39140
+ for (const item of configParser(text3, key2)) {
39141
39141
  if (item.key !== key2) {
39142
39142
  continue;
39143
39143
  }
@@ -39158,8 +39158,8 @@ function configGetParser(text2, key2) {
39158
39158
  function configFilePath(filePath) {
39159
39159
  return filePath.replace(/^(file):/, "");
39160
39160
  }
39161
- function* configParser(text2, requestedKey = null) {
39162
- const lines = text2.split("\0");
39161
+ function* configParser(text3, requestedKey = null) {
39162
+ const lines = text3.split("\0");
39163
39163
  for (let i = 0, max = lines.length - 1; i < max; ) {
39164
39164
  const file2 = configFilePath(lines[i++]);
39165
39165
  let value = lines[i++];
@@ -39187,8 +39187,8 @@ function addConfigTask(key2, value, append2, scope) {
39187
39187
  return {
39188
39188
  commands,
39189
39189
  format: "utf-8",
39190
- parser(text2) {
39191
- return text2;
39190
+ parser(text3) {
39191
+ return text3;
39192
39192
  }
39193
39193
  };
39194
39194
  }
@@ -39200,8 +39200,8 @@ function getConfigTask(key2, scope) {
39200
39200
  return {
39201
39201
  commands,
39202
39202
  format: "utf-8",
39203
- parser(text2) {
39204
- return configGetParser(text2, key2);
39203
+ parser(text3) {
39204
+ return configGetParser(text3, key2);
39205
39205
  }
39206
39206
  };
39207
39207
  }
@@ -39213,8 +39213,8 @@ function listConfigTask(scope) {
39213
39213
  return {
39214
39214
  commands,
39215
39215
  format: "utf-8",
39216
- parser(text2) {
39217
- return configListParser(text2);
39216
+ parser(text3) {
39217
+ return configListParser(text3);
39218
39218
  }
39219
39219
  };
39220
39220
  }
@@ -39564,8 +39564,8 @@ function hashObjectTask(filePath, write) {
39564
39564
  }
39565
39565
  return straightThroughStringTask(commands, true);
39566
39566
  }
39567
- function parseInit(bare, path25, text2) {
39568
- const response = String(text2).trim();
39567
+ function parseInit(bare, path25, text3) {
39568
+ const response = String(text3).trim();
39569
39569
  let result;
39570
39570
  if (result = initResponseRegex.exec(response)) {
39571
39571
  return new InitSummary(bare, path25, false, result[1]);
@@ -39595,8 +39595,8 @@ function initTask(bare = false, path25, customArgs) {
39595
39595
  return {
39596
39596
  commands,
39597
39597
  format: "utf-8",
39598
- parser(text2) {
39599
- return parseInit(commands.includes("--bare"), path25, text2);
39598
+ parser(text3) {
39599
+ return parseInit(commands.includes("--bare"), path25, text3);
39600
39600
  }
39601
39601
  };
39602
39602
  }
@@ -39901,8 +39901,8 @@ function statusTask(customArgs) {
39901
39901
  return {
39902
39902
  format: "utf-8",
39903
39903
  commands,
39904
- parser(text2) {
39905
- return parseStatusSummary(text2);
39904
+ parser(text3) {
39905
+ return parseStatusSummary(text3);
39906
39906
  }
39907
39907
  };
39908
39908
  }
@@ -40144,14 +40144,14 @@ function pullTask(remote, branch, customArgs) {
40144
40144
  }
40145
40145
  };
40146
40146
  }
40147
- function parseGetRemotes(text2) {
40147
+ function parseGetRemotes(text3) {
40148
40148
  const remotes = {};
40149
- forEach(text2, ([name21]) => remotes[name21] = { name: name21 });
40149
+ forEach(text3, ([name21]) => remotes[name21] = { name: name21 });
40150
40150
  return Object.values(remotes);
40151
40151
  }
40152
- function parseGetRemotesVerbose(text2) {
40152
+ function parseGetRemotesVerbose(text3) {
40153
40153
  const remotes = {};
40154
- forEach(text2, ([name21, url2, purpose]) => {
40154
+ forEach(text3, ([name21, url2, purpose]) => {
40155
40155
  if (!Object.hasOwn(remotes, name21)) {
40156
40156
  remotes[name21] = {
40157
40157
  name: name21,
@@ -40164,8 +40164,8 @@ function parseGetRemotesVerbose(text2) {
40164
40164
  });
40165
40165
  return Object.values(remotes);
40166
40166
  }
40167
- function forEach(text2, handler) {
40168
- forEachLineWithContent(text2, (line) => handler(line.split(/\s+/)));
40167
+ function forEach(text3, handler) {
40168
+ forEachLineWithContent(text3, (line) => handler(line.split(/\s+/)));
40169
40169
  }
40170
40170
  function addRemoteTask(remoteName, remoteRepo, customArgs) {
40171
40171
  return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]);
@@ -40253,8 +40253,8 @@ function tagListTask(customArgs = []) {
40253
40253
  return {
40254
40254
  format: "utf-8",
40255
40255
  commands: ["tag", "-l", ...customArgs],
40256
- parser(text2) {
40257
- return parseTagList(text2, hasCustomSort);
40256
+ parser(text3) {
40257
+ return parseTagList(text3, hasCustomSort);
40258
40258
  }
40259
40259
  };
40260
40260
  }
@@ -40390,12 +40390,12 @@ function completionDetectionPlugin({
40390
40390
  configureTimeout(onClose, events.close, events.closeTimeout);
40391
40391
  configureTimeout(onExit, events.exit, events.exitTimeout);
40392
40392
  return {
40393
- close(code) {
40394
- exitCode = code;
40393
+ close(code2) {
40394
+ exitCode = code2;
40395
40395
  events.close.done();
40396
40396
  },
40397
- exit(code) {
40398
- exitCode = code;
40397
+ exit(code2) {
40398
+ exitCode = code2;
40399
40399
  events.exit.done();
40400
40400
  },
40401
40401
  get exitCode() {
@@ -40421,8 +40421,8 @@ function completionDetectionPlugin({
40421
40421
  spawned.stdout?.on("data", quickClose);
40422
40422
  spawned.stderr?.on("data", quickClose);
40423
40423
  spawned.on("error", quickClose);
40424
- spawned.on("close", (code) => events.close(code));
40425
- spawned.on("exit", (code) => events.exit(code));
40424
+ spawned.on("close", (code2) => events.close(code2));
40425
+ spawned.on("exit", (code2) => events.exit(code2));
40426
40426
  try {
40427
40427
  await events.result;
40428
40428
  if (deferClose) {
@@ -40985,8 +40985,8 @@ var init_esm = __esm({
40985
40985
  }
40986
40986
  fail4(error48);
40987
40987
  }, "onError");
40988
- parser = /* @__PURE__ */ __name((text2) => {
40989
- return text2.trim() === "true";
40988
+ parser = /* @__PURE__ */ __name((text3) => {
40989
+ return text3.trim() === "true";
40990
40990
  }, "parser");
40991
40991
  }
40992
40992
  });
@@ -42019,8 +42019,8 @@ var init_esm = __esm({
42019
42019
  init_utils();
42020
42020
  init_parse_remote_objects();
42021
42021
  parsers2 = [
42022
- new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text2]) => {
42023
- result.remoteMessages.all.push(text2.trim());
42022
+ new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text3]) => {
42023
+ result.remoteMessages.all.push(text3.trim());
42024
42024
  return false;
42025
42025
  }),
42026
42026
  ...remoteMessagesObjectParsers,
@@ -42384,8 +42384,8 @@ var init_esm = __esm({
42384
42384
  }
42385
42385
  ]
42386
42386
  ]);
42387
- parseStatusSummary = /* @__PURE__ */ __name(function(text2) {
42388
- const lines = text2.split(NULL);
42387
+ parseStatusSummary = /* @__PURE__ */ __name(function(text3) {
42388
+ const lines = text3.split(NULL);
42389
42389
  const status = new StatusSummary();
42390
42390
  for (let i = 0, l = lines.length; i < l; ) {
42391
42391
  let line = lines[i++].trim();
@@ -42798,8 +42798,8 @@ var init_esm = __esm({
42798
42798
  init_CheckIgnore = __esm2({
42799
42799
  "src/lib/responses/CheckIgnore.ts"() {
42800
42800
  "use strict";
42801
- parseCheckIgnore = /* @__PURE__ */ __name((text2) => {
42802
- return text2.split(/\n/g).map(toPath).filter(Boolean);
42801
+ parseCheckIgnore = /* @__PURE__ */ __name((text3) => {
42802
+ return text3.split(/\n/g).map(toPath).filter(Boolean);
42803
42803
  }, "parseCheckIgnore");
42804
42804
  }
42805
42805
  });
@@ -43541,8 +43541,8 @@ var init_git_service = __esm({
43541
43541
  /**
43542
43542
  * Create a standardized error object
43543
43543
  */
43544
- createError(code, message, params) {
43545
- return { code, message, params };
43544
+ createError(code2, message, params) {
43545
+ return { code: code2, message, params };
43546
43546
  }
43547
43547
  /**
43548
43548
  * Map git status codes to status type
@@ -47519,9 +47519,9 @@ function splitIdentifier(name21) {
47519
47519
  const joined = parts.join(" ").toLowerCase();
47520
47520
  return joined && joined !== name21.toLowerCase() ? joined : "";
47521
47521
  }
47522
- function packageToSearchDocs(pkg) {
47522
+ function packageToSearchDocs(pkg, packagePath = pkg.name) {
47523
47523
  const docs = [];
47524
- const service = pkg.name;
47524
+ const service = packagePath;
47525
47525
  docs.push({
47526
47526
  id: `package:${service}`,
47527
47527
  kind: "package",
@@ -47607,6 +47607,9 @@ function packageToSearchDocs(pkg) {
47607
47607
  route: `/cases/${c.uuid}`
47608
47608
  });
47609
47609
  }
47610
+ for (const subPackage of pkg.subPackages ?? []) {
47611
+ docs.push(...packageToSearchDocs(subPackage, `${packagePath}/${subPackage.name}`));
47612
+ }
47610
47613
  return docs;
47611
47614
  }
47612
47615
  var KIND_TIER, documentationFacets, entityRoute, withSplit;
@@ -47780,7 +47783,9 @@ var init_searchIndex = __esm({
47780
47783
  if (!this.ready) return;
47781
47784
  this.db.exec("BEGIN");
47782
47785
  try {
47783
- this.db.prepare("DELETE FROM docs WHERE package = ? AND kind NOT IN ('document','documentation-chunk')").run(pkg.name);
47786
+ this.db.prepare(
47787
+ "DELETE FROM docs WHERE (package = ? OR instr(package, ? || '/') = 1) AND kind NOT IN ('document','documentation-chunk')"
47788
+ ).run(pkg.name, pkg.name);
47784
47789
  this.db.prepare(`DELETE FROM documentation_search_meta WHERE search_doc_id NOT IN (SELECT id FROM docs)`).run();
47785
47790
  this.insertDocs(packageToSearchDocs(pkg));
47786
47791
  this.db.exec("COMMIT");
@@ -47806,7 +47811,7 @@ var init_searchIndex = __esm({
47806
47811
  /** Drop every doc for a package (on package delete). */
47807
47812
  removePackage(name21) {
47808
47813
  if (!this.ready) return;
47809
- this.db.prepare("DELETE FROM docs WHERE package = ?").run(name21);
47814
+ this.db.prepare("DELETE FROM docs WHERE package = ? OR instr(package, ? || '/') = 1").run(name21, name21);
47810
47815
  }
47811
47816
  /** Total indexed docs (test/health). */
47812
47817
  count() {
@@ -47814,6 +47819,12 @@ var init_searchIndex = __esm({
47814
47819
  const r = this.db.prepare("SELECT count(*) AS c FROM docs").get();
47815
47820
  return r.c;
47816
47821
  }
47822
+ /** Indexed document counts by kind, used by health diagnostics. */
47823
+ countsByKind() {
47824
+ if (!this.ready) return {};
47825
+ const rows = this.db.prepare("SELECT kind, count(*) AS count FROM docs GROUP BY kind").all();
47826
+ return Object.fromEntries(rows.map((row) => [row.kind, row.count]));
47827
+ }
47817
47828
  /**
47818
47829
  * Ranked full-text search. Blends FTS5 BM25 (name weighted highest, then
47819
47830
  * keywords, then description) with the per-kind tier so entities/attributes
@@ -47910,21 +47921,21 @@ function splitSections(document2) {
47910
47921
  if (current && contentOf(current.lines)) sections.push(current);
47911
47922
  current = void 0;
47912
47923
  }, "flush");
47913
- lines.forEach((text2, index2) => {
47924
+ lines.forEach((text3, index2) => {
47914
47925
  const line = index2 + 1;
47915
- const fence = text2.match(/^\s*(`{3,}|~{3,})/);
47926
+ const fence = text3.match(/^\s*(`{3,}|~{3,})/);
47916
47927
  if (fence) {
47917
47928
  const character = fence[1][0];
47918
47929
  if (!fenceCharacter) fenceCharacter = character;
47919
47930
  else if (fenceCharacter === character) fenceCharacter = void 0;
47920
47931
  }
47921
47932
  if (!fenceCharacter) {
47922
- const marker21 = text2.match(/^\s*<!--\s*chunk:\s*([a-zA-Z0-9][\w.-]*)\s*-->\s*$/);
47933
+ const marker21 = text3.match(/^\s*<!--\s*chunk:\s*([a-zA-Z0-9][\w.-]*)\s*-->\s*$/);
47923
47934
  if (marker21) {
47924
47935
  pendingAnchor = slug(marker21[1]);
47925
47936
  return;
47926
47937
  }
47927
- const heading = text2.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);
47938
+ const heading = text3.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);
47928
47939
  if (heading) {
47929
47940
  flush();
47930
47941
  const level = heading[1].length;
@@ -47933,14 +47944,14 @@ function splitSections(document2) {
47933
47944
  current = {
47934
47945
  headings: [...path25].filter(Boolean),
47935
47946
  anchor: pendingAnchor,
47936
- lines: [{ text: text2, line }]
47947
+ lines: [{ text: text3, line }]
47937
47948
  };
47938
47949
  pendingAnchor = void 0;
47939
47950
  return;
47940
47951
  }
47941
47952
  }
47942
47953
  if (!current) current = { headings: [], anchor: pendingAnchor, lines: [] };
47943
- current.lines.push({ text: text2, line });
47954
+ current.lines.push({ text: text3, line });
47944
47955
  });
47945
47956
  flush();
47946
47957
  return sections;
@@ -48033,9 +48044,9 @@ function boundedParts(section, targetCharacters, hardLimitCharacters) {
48033
48044
  return parts;
48034
48045
  }
48035
48046
  function descriptorsFor(headings, content) {
48036
- const text2 = `${headings.join(" ")} ${content.slice(0, 1200)}`.replace(/```[\s\S]*?```/g, " ").replace(/<[^>]+>|[^\p{L}\p{N}\s-]/gu, " ").toLowerCase();
48047
+ const text3 = `${headings.join(" ")} ${content.slice(0, 1200)}`.replace(/```[\s\S]*?```/g, " ").replace(/<[^>]+>|[^\p{L}\p{N}\s-]/gu, " ").toLowerCase();
48037
48048
  const descriptors = [];
48038
- for (const word of text2.match(/[\p{L}\p{N}][\p{L}\p{N}-]{2,}/gu) ?? []) {
48049
+ for (const word of text3.match(/[\p{L}\p{N}][\p{L}\p{N}-]{2,}/gu) ?? []) {
48039
48050
  if (DESCRIPTOR_STOP_WORDS.has(word) || descriptors.includes(word)) continue;
48040
48051
  descriptors.push(word);
48041
48052
  if (descriptors.length === 12) break;
@@ -48256,8 +48267,8 @@ var init_documentationRepository = __esm({
48256
48267
  init_documentationValidation();
48257
48268
  SAFE_SEGMENT = /^[A-Za-z0-9._-]+$/;
48258
48269
  isNotFound = /* @__PURE__ */ __name((error48) => {
48259
- const code = error48.code;
48260
- return code === "not-found" || code === "ENOENT";
48270
+ const code2 = error48.code;
48271
+ return code2 === "not-found" || code2 === "ENOENT";
48261
48272
  }, "isNotFound");
48262
48273
  DocumentationRepository = class {
48263
48274
  constructor(storage, ws = wsId("dictionaries")) {
@@ -48571,6 +48582,7 @@ var searchIndexService_exports = {};
48571
48582
  __export(searchIndexService_exports, {
48572
48583
  __setSearchIndexForTest: () => __setSearchIndexForTest,
48573
48584
  getSearchIndex: () => getSearchIndex,
48585
+ getSearchIndexHealth: () => getSearchIndexHealth,
48574
48586
  initSearchIndex: () => initSearchIndex,
48575
48587
  packageOfEvent: () => packageOfEvent,
48576
48588
  reindexDocumentation: () => reindexDocumentation,
@@ -48582,6 +48594,18 @@ __export(searchIndexService_exports, {
48582
48594
  function getSearchIndex() {
48583
48595
  return index && index.isReady() ? index : null;
48584
48596
  }
48597
+ function getSearchIndexHealth() {
48598
+ const live = getSearchIndex();
48599
+ return {
48600
+ ready: live !== null && lastBuildError === null,
48601
+ documentCount: live?.count() ?? 0,
48602
+ countsByKind: live?.countsByKind() ?? {},
48603
+ indexedRootPackages,
48604
+ lastBuildAt,
48605
+ lastBuildError,
48606
+ nodeVersion: process.version
48607
+ };
48608
+ }
48585
48609
  function searchModel(query, opts) {
48586
48610
  return getSearchIndex()?.search(query, opts) ?? [];
48587
48611
  }
@@ -48602,16 +48626,23 @@ async function loadDocumentationSearchDocs() {
48602
48626
  async function initSearchIndex() {
48603
48627
  if (!index) index = new SearchIndex(searchIndexPathFor(config.dataDir));
48604
48628
  const ok2 = await index.open();
48605
- if (!ok2) return false;
48629
+ if (!ok2) {
48630
+ lastBuildError = `FTS5 index unavailable on ${process.version}; Node 22.5+ with node:sqlite is required.`;
48631
+ return false;
48632
+ }
48606
48633
  try {
48607
48634
  const packages = await loadAllPackages();
48608
48635
  index.rebuildFrom(packages);
48609
48636
  index.reindexDocumentation(await loadDocumentationSearchDocs());
48637
+ indexedRootPackages = packages.length;
48638
+ lastBuildAt = (/* @__PURE__ */ new Date()).toISOString();
48639
+ lastBuildError = null;
48610
48640
  logger.info(`SearchIndex: built (${index.count()} docs from ${packages.length} packages)`);
48611
48641
  } catch (e) {
48612
- logger.warn(`SearchIndex: initial build failed \u2014 ${e instanceof Error ? e.message : String(e)}`);
48642
+ lastBuildError = e instanceof Error ? e.message : String(e);
48643
+ logger.warn(`SearchIndex: initial build failed \u2014 ${lastBuildError}`);
48613
48644
  }
48614
- return index.isReady();
48645
+ return index.isReady() && lastBuildError === null;
48615
48646
  }
48616
48647
  async function reindexPackageByName(name21) {
48617
48648
  const idx = getSearchIndex();
@@ -48669,16 +48700,7 @@ function subscribeSearchIndex(projection) {
48669
48700
  if (rebuildTimer) return;
48670
48701
  rebuildTimer = setTimeout(() => {
48671
48702
  rebuildTimer = null;
48672
- void (async () => {
48673
- const idx = getSearchIndex();
48674
- if (!idx) return;
48675
- try {
48676
- idx.rebuildFrom(await loadAllPackages());
48677
- idx.reindexDocumentation(await loadDocumentationSearchDocs());
48678
- } catch (e) {
48679
- logger.warn(`SearchIndex: full rebuild failed \u2014 ${e instanceof Error ? e.message : String(e)}`);
48680
- }
48681
- })();
48703
+ void initSearchIndex();
48682
48704
  }, 250);
48683
48705
  }, "scheduleFullRebuild");
48684
48706
  return projection.onInvalidate((event) => {
@@ -48695,11 +48717,14 @@ function subscribeSearchIndex(projection) {
48695
48717
  function resetSearchIndexForTest() {
48696
48718
  index?.close();
48697
48719
  index = null;
48720
+ lastBuildAt = null;
48721
+ lastBuildError = null;
48722
+ indexedRootPackages = 0;
48698
48723
  }
48699
48724
  function __setSearchIndexForTest(idx) {
48700
48725
  index = idx;
48701
48726
  }
48702
- var RESERVED_DIRS2, index;
48727
+ var RESERVED_DIRS2, index, lastBuildAt, lastBuildError, indexedRootPackages;
48703
48728
  var init_searchIndexService = __esm({
48704
48729
  "backend/src/services/search/searchIndexService.ts"() {
48705
48730
  "use strict";
@@ -48709,7 +48734,11 @@ var init_searchIndexService = __esm({
48709
48734
  init_searchDocuments();
48710
48735
  RESERVED_DIRS2 = /* @__PURE__ */ new Set([".dico", ".git", "node_modules"]);
48711
48736
  index = null;
48737
+ lastBuildAt = null;
48738
+ lastBuildError = null;
48739
+ indexedRootPackages = 0;
48712
48740
  __name(getSearchIndex, "getSearchIndex");
48741
+ __name(getSearchIndexHealth, "getSearchIndexHealth");
48713
48742
  __name(searchModel, "searchModel");
48714
48743
  __name(loadAllPackages, "loadAllPackages");
48715
48744
  __name(loadOnePackage, "loadOnePackage");
@@ -49759,9 +49788,9 @@ var init_serviceService = __esm({
49759
49788
  }
49760
49789
  return [];
49761
49790
  }
49762
- calculateMatchScore(text2, searchTerms) {
49763
- if (!text2) return 0;
49764
- const normalizedText = text2.toLowerCase();
49791
+ calculateMatchScore(text3, searchTerms) {
49792
+ if (!text3) return 0;
49793
+ const normalizedText = text3.toLowerCase();
49765
49794
  let score = 0;
49766
49795
  for (const term of searchTerms) {
49767
49796
  if (normalizedText.includes(term)) {
@@ -57048,8 +57077,8 @@ var capitalizeFirstCharacter, error26;
57048
57077
  var init_lt = __esm({
57049
57078
  "backend/node_modules/zod/v4/locales/lt.js"() {
57050
57079
  init_util2();
57051
- capitalizeFirstCharacter = /* @__PURE__ */ __name((text2) => {
57052
- return text2.charAt(0).toUpperCase() + text2.slice(1);
57080
+ capitalizeFirstCharacter = /* @__PURE__ */ __name((text3) => {
57081
+ return text3.charAt(0).toUpperCase() + text3.slice(1);
57053
57082
  }, "capitalizeFirstCharacter");
57054
57083
  __name(getUnitTypeFromNumber, "getUnitTypeFromNumber");
57055
57084
  error26 = /* @__PURE__ */ __name(() => {
@@ -66041,15 +66070,15 @@ var init_dist2 = __esm({
66041
66070
  static {
66042
66071
  __name(this, "JSONParseError");
66043
66072
  }
66044
- constructor({ text: text2, cause }) {
66073
+ constructor({ text: text3, cause }) {
66045
66074
  super({
66046
66075
  name: name6,
66047
- message: `JSON parsing failed: Text: ${text2}.
66076
+ message: `JSON parsing failed: Text: ${text3}.
66048
66077
  Error message: ${getErrorMessage2(cause)}`,
66049
66078
  cause
66050
66079
  });
66051
66080
  this[_a7] = true;
66052
- this.text = text2;
66081
+ this.text = text3;
66053
66082
  }
66054
66083
  static isInstance(error48) {
66055
66084
  return AISDKError.hasMarker(error48, marker7);
@@ -70790,8 +70819,8 @@ function isBunNetworkError(error48) {
70790
70819
  if (!(error48 instanceof Error)) {
70791
70820
  return false;
70792
70821
  }
70793
- const code = error48.code;
70794
- if (typeof code === "string" && BUN_ERROR_CODES.includes(code)) {
70822
+ const code2 = error48.code;
70823
+ if (typeof code2 === "string" && BUN_ERROR_CODES.includes(code2)) {
70795
70824
  return true;
70796
70825
  }
70797
70826
  return false;
@@ -70948,12 +70977,12 @@ function mediaTypeToExtension(mediaType) {
70948
70977
  "x-m4a": "m4a"
70949
70978
  }[subtype]) != null ? _a25 : subtype;
70950
70979
  }
70951
- function _parse2(text2) {
70952
- const obj = JSON.parse(text2);
70980
+ function _parse2(text3) {
70981
+ const obj = JSON.parse(text3);
70953
70982
  if (obj === null || typeof obj !== "object") {
70954
70983
  return obj;
70955
70984
  }
70956
- if (suspectProtoRx.test(text2) === false && suspectConstructorRx.test(text2) === false) {
70985
+ if (suspectProtoRx.test(text3) === false && suspectConstructorRx.test(text3) === false) {
70957
70986
  return obj;
70958
70987
  }
70959
70988
  return filter(obj);
@@ -70980,15 +71009,15 @@ function filter(obj) {
70980
71009
  }
70981
71010
  return obj;
70982
71011
  }
70983
- function secureJsonParse(text2) {
71012
+ function secureJsonParse(text3) {
70984
71013
  const { stackTraceLimit } = Error;
70985
71014
  try {
70986
71015
  Error.stackTraceLimit = 0;
70987
71016
  } catch (e) {
70988
- return _parse2(text2);
71017
+ return _parse2(text3);
70989
71018
  }
70990
71019
  try {
70991
- return _parse2(text2);
71020
+ return _parse2(text3);
70992
71021
  } finally {
70993
71022
  Error.stackTraceLimit = stackTraceLimit;
70994
71023
  }
@@ -71927,11 +71956,11 @@ async function safeValidateTypes({
71927
71956
  }
71928
71957
  }
71929
71958
  async function parseJSON({
71930
- text: text2,
71959
+ text: text3,
71931
71960
  schema
71932
71961
  }) {
71933
71962
  try {
71934
- const value = secureJsonParse(text2);
71963
+ const value = secureJsonParse(text3);
71935
71964
  if (schema == null) {
71936
71965
  return value;
71937
71966
  }
@@ -71940,15 +71969,15 @@ async function parseJSON({
71940
71969
  if (JSONParseError.isInstance(error48) || TypeValidationError.isInstance(error48)) {
71941
71970
  throw error48;
71942
71971
  }
71943
- throw new JSONParseError({ text: text2, cause: error48 });
71972
+ throw new JSONParseError({ text: text3, cause: error48 });
71944
71973
  }
71945
71974
  }
71946
71975
  async function safeParseJSON({
71947
- text: text2,
71976
+ text: text3,
71948
71977
  schema
71949
71978
  }) {
71950
71979
  try {
71951
- const value = secureJsonParse(text2);
71980
+ const value = secureJsonParse(text3);
71952
71981
  if (schema == null) {
71953
71982
  return { success: true, value, rawValue: value };
71954
71983
  }
@@ -71956,7 +71985,7 @@ async function safeParseJSON({
71956
71985
  } catch (error48) {
71957
71986
  return {
71958
71987
  success: false,
71959
- error: JSONParseError.isInstance(error48) ? error48 : new JSONParseError({ text: text2, cause: error48 }),
71988
+ error: JSONParseError.isInstance(error48) ? error48 : new JSONParseError({ text: text3, cause: error48 }),
71960
71989
  rawValue: void 0
71961
71990
  };
71962
71991
  }
@@ -80543,7 +80572,7 @@ function streamText({
80543
80572
  }
80544
80573
  function createOutputTransformStream(output) {
80545
80574
  let firstTextChunkId = void 0;
80546
- let text2 = "";
80575
+ let text22 = "";
80547
80576
  let textChunk = "";
80548
80577
  let textProviderMetadata = void 0;
80549
80578
  let lastPublishedJson = "";
@@ -80590,10 +80619,10 @@ function createOutputTransformStream(output) {
80590
80619
  controller.enqueue({ part: chunk, partialOutput: void 0 });
80591
80620
  return;
80592
80621
  }
80593
- text2 += chunk.text;
80622
+ text22 += chunk.text;
80594
80623
  textChunk += chunk.text;
80595
80624
  textProviderMetadata = (_a21 = chunk.providerMetadata) != null ? _a21 : textProviderMetadata;
80596
- const result = await output.parsePartialOutput({ text: text2 });
80625
+ const result = await output.parsePartialOutput({ text: text22 });
80597
80626
  if (result !== void 0) {
80598
80627
  const currentJson = JSON.stringify(result.partial);
80599
80628
  if (currentJson !== lastPublishedJson) {
@@ -81035,14 +81064,14 @@ var init_dist6 = __esm({
81035
81064
  constructor({
81036
81065
  message = "No object generated.",
81037
81066
  cause,
81038
- text: text2,
81067
+ text: text22,
81039
81068
  response,
81040
81069
  usage,
81041
81070
  finishReason
81042
81071
  }) {
81043
81072
  super({ name: name82, message, cause });
81044
81073
  this[_a83] = true;
81045
- this.text = text2;
81074
+ this.text = text22;
81046
81075
  this.response = response;
81047
81076
  this.usage = usage;
81048
81077
  this.finishReason = finishReason;
@@ -81768,11 +81797,11 @@ var init_dist6 = __esm({
81768
81797
  text = /* @__PURE__ */ __name(() => ({
81769
81798
  name: "text",
81770
81799
  responseFormat: Promise.resolve({ type: "text" }),
81771
- async parseCompleteOutput({ text: text2 }) {
81772
- return text2;
81800
+ async parseCompleteOutput({ text: text22 }) {
81801
+ return text22;
81773
81802
  },
81774
- async parsePartialOutput({ text: text2 }) {
81775
- return { partial: text2 };
81803
+ async parsePartialOutput({ text: text22 }) {
81804
+ return { partial: text22 };
81776
81805
  },
81777
81806
  createElementStreamTransform() {
81778
81807
  return void 0;
@@ -81792,13 +81821,13 @@ var init_dist6 = __esm({
81792
81821
  ...name21 != null && { name: name21 },
81793
81822
  ...description != null && { description }
81794
81823
  })),
81795
- async parseCompleteOutput({ text: text2 }, context2) {
81796
- const parseResult = await safeParseJSON({ text: text2 });
81824
+ async parseCompleteOutput({ text: text22 }, context2) {
81825
+ const parseResult = await safeParseJSON({ text: text22 });
81797
81826
  if (!parseResult.success) {
81798
81827
  throw new NoObjectGeneratedError({
81799
81828
  message: "No object generated: could not parse the response.",
81800
81829
  cause: parseResult.error,
81801
- text: text2,
81830
+ text: text22,
81802
81831
  response: context2.response,
81803
81832
  usage: context2.usage,
81804
81833
  finishReason: context2.finishReason
@@ -81812,7 +81841,7 @@ var init_dist6 = __esm({
81812
81841
  throw new NoObjectGeneratedError({
81813
81842
  message: "No object generated: response did not match schema.",
81814
81843
  cause: validationResult.error,
81815
- text: text2,
81844
+ text: text22,
81816
81845
  response: context2.response,
81817
81846
  usage: context2.usage,
81818
81847
  finishReason: context2.finishReason
@@ -81820,8 +81849,8 @@ var init_dist6 = __esm({
81820
81849
  }
81821
81850
  return validationResult.value;
81822
81851
  },
81823
- async parsePartialOutput({ text: text2 }) {
81824
- const result = await parsePartialJson(text2);
81852
+ async parsePartialOutput({ text: text22 }) {
81853
+ const result = await parsePartialJson(text22);
81825
81854
  switch (result.state) {
81826
81855
  case "failed-parse":
81827
81856
  case "undefined-input": {
@@ -81867,13 +81896,13 @@ var init_dist6 = __esm({
81867
81896
  ...description != null && { description }
81868
81897
  };
81869
81898
  }),
81870
- async parseCompleteOutput({ text: text2 }, context2) {
81871
- const parseResult = await safeParseJSON({ text: text2 });
81899
+ async parseCompleteOutput({ text: text22 }, context2) {
81900
+ const parseResult = await safeParseJSON({ text: text22 });
81872
81901
  if (!parseResult.success) {
81873
81902
  throw new NoObjectGeneratedError({
81874
81903
  message: "No object generated: could not parse the response.",
81875
81904
  cause: parseResult.error,
81876
- text: text2,
81905
+ text: text22,
81877
81906
  response: context2.response,
81878
81907
  usage: context2.usage,
81879
81908
  finishReason: context2.finishReason
@@ -81887,7 +81916,7 @@ var init_dist6 = __esm({
81887
81916
  value: outerValue,
81888
81917
  cause: "response must be an object with an elements array"
81889
81918
  }),
81890
- text: text2,
81919
+ text: text22,
81891
81920
  response: context2.response,
81892
81921
  usage: context2.usage,
81893
81922
  finishReason: context2.finishReason
@@ -81902,7 +81931,7 @@ var init_dist6 = __esm({
81902
81931
  throw new NoObjectGeneratedError({
81903
81932
  message: "No object generated: response did not match schema.",
81904
81933
  cause: validationResult.error,
81905
- text: text2,
81934
+ text: text22,
81906
81935
  response: context2.response,
81907
81936
  usage: context2.usage,
81908
81937
  finishReason: context2.finishReason
@@ -81911,8 +81940,8 @@ var init_dist6 = __esm({
81911
81940
  }
81912
81941
  return outerValue.elements;
81913
81942
  },
81914
- async parsePartialOutput({ text: text2 }) {
81915
- const result = await parsePartialJson(text2);
81943
+ async parsePartialOutput({ text: text22 }) {
81944
+ const result = await parsePartialJson(text22);
81916
81945
  switch (result.state) {
81917
81946
  case "failed-parse":
81918
81947
  case "undefined-input": {
@@ -81975,13 +82004,13 @@ var init_dist6 = __esm({
81975
82004
  ...name21 != null && { name: name21 },
81976
82005
  ...description != null && { description }
81977
82006
  }),
81978
- async parseCompleteOutput({ text: text2 }, context2) {
81979
- const parseResult = await safeParseJSON({ text: text2 });
82007
+ async parseCompleteOutput({ text: text22 }, context2) {
82008
+ const parseResult = await safeParseJSON({ text: text22 });
81980
82009
  if (!parseResult.success) {
81981
82010
  throw new NoObjectGeneratedError({
81982
82011
  message: "No object generated: could not parse the response.",
81983
82012
  cause: parseResult.error,
81984
- text: text2,
82013
+ text: text22,
81985
82014
  response: context2.response,
81986
82015
  usage: context2.usage,
81987
82016
  finishReason: context2.finishReason
@@ -81995,7 +82024,7 @@ var init_dist6 = __esm({
81995
82024
  value: outerValue,
81996
82025
  cause: "response must be an object that contains a choice value."
81997
82026
  }),
81998
- text: text2,
82027
+ text: text22,
81999
82028
  response: context2.response,
82000
82029
  usage: context2.usage,
82001
82030
  finishReason: context2.finishReason
@@ -82003,8 +82032,8 @@ var init_dist6 = __esm({
82003
82032
  }
82004
82033
  return outerValue.result;
82005
82034
  },
82006
- async parsePartialOutput({ text: text2 }) {
82007
- const result = await parsePartialJson(text2);
82035
+ async parsePartialOutput({ text: text22 }) {
82036
+ const result = await parsePartialJson(text22);
82008
82037
  switch (result.state) {
82009
82038
  case "failed-parse":
82010
82039
  case "undefined-input": {
@@ -82043,13 +82072,13 @@ var init_dist6 = __esm({
82043
82072
  ...name21 != null && { name: name21 },
82044
82073
  ...description != null && { description }
82045
82074
  }),
82046
- async parseCompleteOutput({ text: text2 }, context2) {
82047
- const parseResult = await safeParseJSON({ text: text2 });
82075
+ async parseCompleteOutput({ text: text22 }, context2) {
82076
+ const parseResult = await safeParseJSON({ text: text22 });
82048
82077
  if (!parseResult.success) {
82049
82078
  throw new NoObjectGeneratedError({
82050
82079
  message: "No object generated: could not parse the response.",
82051
82080
  cause: parseResult.error,
82052
- text: text2,
82081
+ text: text22,
82053
82082
  response: context2.response,
82054
82083
  usage: context2.usage,
82055
82084
  finishReason: context2.finishReason
@@ -82057,8 +82086,8 @@ var init_dist6 = __esm({
82057
82086
  }
82058
82087
  return parseResult.value;
82059
82088
  },
82060
- async parsePartialOutput({ text: text2 }) {
82061
- const result = await parsePartialJson(text2);
82089
+ async parsePartialOutput({ text: text22 }) {
82090
+ const result = await parsePartialJson(text22);
82062
82091
  switch (result.state) {
82063
82092
  case "failed-parse":
82064
82093
  case "undefined-input": {
@@ -86390,23 +86419,23 @@ var init_types4 = __esm({
86390
86419
  static {
86391
86420
  __name(this, "McpError");
86392
86421
  }
86393
- constructor(code, message, data) {
86394
- super(`MCP error ${code}: ${message}`);
86395
- this.code = code;
86422
+ constructor(code2, message, data) {
86423
+ super(`MCP error ${code2}: ${message}`);
86424
+ this.code = code2;
86396
86425
  this.data = data;
86397
86426
  this.name = "McpError";
86398
86427
  }
86399
86428
  /**
86400
86429
  * Factory method to create the appropriate error type based on the error code and data
86401
86430
  */
86402
- static fromError(code, message, data) {
86403
- if (code === ErrorCode.UrlElicitationRequired && data) {
86431
+ static fromError(code2, message, data) {
86432
+ if (code2 === ErrorCode.UrlElicitationRequired && data) {
86404
86433
  const errorData = data;
86405
86434
  if (errorData.elicitations) {
86406
86435
  return new UrlElicitationRequiredError(errorData.elicitations, message);
86407
86436
  }
86408
86437
  }
86409
- return new _McpError(code, message, data);
86438
+ return new _McpError(code2, message, data);
86410
86439
  }
86411
86440
  };
86412
86441
  UrlElicitationRequiredError = class extends McpError {
@@ -87822,9 +87851,9 @@ var require_code = __commonJS({
87822
87851
  static {
87823
87852
  __name(this, "_Code");
87824
87853
  }
87825
- constructor(code) {
87854
+ constructor(code2) {
87826
87855
  super();
87827
- this._items = typeof code === "string" ? [code] : code;
87856
+ this._items = typeof code2 === "string" ? [code2] : code2;
87828
87857
  }
87829
87858
  toString() {
87830
87859
  return this.str;
@@ -87851,13 +87880,13 @@ var require_code = __commonJS({
87851
87880
  exports2._Code = _Code;
87852
87881
  exports2.nil = new _Code("");
87853
87882
  function _(strs, ...args) {
87854
- const code = [strs[0]];
87883
+ const code2 = [strs[0]];
87855
87884
  let i = 0;
87856
87885
  while (i < args.length) {
87857
- addCodeArg(code, args[i]);
87858
- code.push(strs[++i]);
87886
+ addCodeArg(code2, args[i]);
87887
+ code2.push(strs[++i]);
87859
87888
  }
87860
- return new _Code(code);
87889
+ return new _Code(code2);
87861
87890
  }
87862
87891
  __name(_, "_");
87863
87892
  exports2._ = _;
@@ -87875,13 +87904,13 @@ var require_code = __commonJS({
87875
87904
  }
87876
87905
  __name(str2, "str");
87877
87906
  exports2.str = str2;
87878
- function addCodeArg(code, arg) {
87907
+ function addCodeArg(code2, arg) {
87879
87908
  if (arg instanceof _Code)
87880
- code.push(...arg._items);
87909
+ code2.push(...arg._items);
87881
87910
  else if (arg instanceof Name)
87882
- code.push(arg);
87911
+ code2.push(arg);
87883
87912
  else
87884
- code.push(interpolate(arg));
87913
+ code2.push(interpolate(arg));
87885
87914
  }
87886
87915
  __name(addCodeArg, "addCodeArg");
87887
87916
  exports2.addCodeArg = addCodeArg;
@@ -88087,7 +88116,7 @@ var require_scope = __commonJS({
88087
88116
  }, usedValues, getCode);
88088
88117
  }
88089
88118
  _reduceValues(values, valueCode, usedValues = {}, getCode) {
88090
- let code = code_1.nil;
88119
+ let code2 = code_1.nil;
88091
88120
  for (const prefix in values) {
88092
88121
  const vs = values[prefix];
88093
88122
  if (!vs)
@@ -88100,16 +88129,16 @@ var require_scope = __commonJS({
88100
88129
  let c = valueCode(name21);
88101
88130
  if (c) {
88102
88131
  const def = this.opts.es5 ? exports2.varKinds.var : exports2.varKinds.const;
88103
- code = (0, code_1._)`${code}${def} ${name21} = ${c};${this.opts._n}`;
88132
+ code2 = (0, code_1._)`${code2}${def} ${name21} = ${c};${this.opts._n}`;
88104
88133
  } else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name21)) {
88105
- code = (0, code_1._)`${code}${c}${this.opts._n}`;
88134
+ code2 = (0, code_1._)`${code2}${c}${this.opts._n}`;
88106
88135
  } else {
88107
88136
  throw new ValueError(name21);
88108
88137
  }
88109
88138
  nameSet.set(name21, UsedValueState.Completed);
88110
88139
  });
88111
88140
  }
88112
- return code;
88141
+ return code2;
88113
88142
  }
88114
88143
  };
88115
88144
  exports2.ValueScope = ValueScope;
@@ -88293,9 +88322,9 @@ var require_codegen = __commonJS({
88293
88322
  static {
88294
88323
  __name(this, "AnyCode");
88295
88324
  }
88296
- constructor(code) {
88325
+ constructor(code2) {
88297
88326
  super();
88298
- this.code = code;
88327
+ this.code = code2;
88299
88328
  }
88300
88329
  render({ _n }) {
88301
88330
  return `${this.code};` + _n;
@@ -88320,7 +88349,7 @@ var require_codegen = __commonJS({
88320
88349
  this.nodes = nodes;
88321
88350
  }
88322
88351
  render(opts) {
88323
- return this.nodes.reduce((code, n) => code + n.render(opts), "");
88352
+ return this.nodes.reduce((code2, n) => code2 + n.render(opts), "");
88324
88353
  }
88325
88354
  optimizeNodes() {
88326
88355
  const { nodes } = this;
@@ -88380,10 +88409,10 @@ var require_codegen = __commonJS({
88380
88409
  this.condition = condition;
88381
88410
  }
88382
88411
  render(opts) {
88383
- let code = `if(${this.condition})` + super.render(opts);
88412
+ let code2 = `if(${this.condition})` + super.render(opts);
88384
88413
  if (this.else)
88385
- code += "else " + this.else.render(opts);
88386
- return code;
88414
+ code2 += "else " + this.else.render(opts);
88415
+ return code2;
88387
88416
  }
88388
88417
  optimizeNodes() {
88389
88418
  super.optimizeNodes();
@@ -88525,12 +88554,12 @@ var require_codegen = __commonJS({
88525
88554
  __name(this, "Try");
88526
88555
  }
88527
88556
  render(opts) {
88528
- let code = "try" + super.render(opts);
88557
+ let code2 = "try" + super.render(opts);
88529
88558
  if (this.catch)
88530
- code += this.catch.render(opts);
88559
+ code2 += this.catch.render(opts);
88531
88560
  if (this.finally)
88532
- code += this.finally.render(opts);
88533
- return code;
88561
+ code2 += this.finally.render(opts);
88562
+ return code2;
88534
88563
  }
88535
88564
  optimizeNodes() {
88536
88565
  var _a21, _b17;
@@ -88656,18 +88685,18 @@ var require_codegen = __commonJS({
88656
88685
  }
88657
88686
  // returns code for object literal for the passed argument list of key-value pairs
88658
88687
  object(...keyValues) {
88659
- const code = ["{"];
88688
+ const code2 = ["{"];
88660
88689
  for (const [key2, value] of keyValues) {
88661
- if (code.length > 1)
88662
- code.push(",");
88663
- code.push(key2);
88690
+ if (code2.length > 1)
88691
+ code2.push(",");
88692
+ code2.push(key2);
88664
88693
  if (key2 !== value || this.opts.es5) {
88665
- code.push(":");
88666
- (0, code_1.addCodeArg)(code, value);
88694
+ code2.push(":");
88695
+ (0, code_1.addCodeArg)(code2, value);
88667
88696
  }
88668
88697
  }
88669
- code.push("}");
88670
- return new code_1._Code(code);
88698
+ code2.push("}");
88699
+ return new code_1._Code(code2);
88671
88700
  }
88672
88701
  // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
88673
88702
  if(condition, thenBody, elseBody) {
@@ -91126,22 +91155,22 @@ var require_utils3 = __commonJS({
91126
91155
  var isIPv42 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
91127
91156
  function stringArrayToHexStripped(input) {
91128
91157
  let acc = "";
91129
- let code = 0;
91158
+ let code2 = 0;
91130
91159
  let i = 0;
91131
91160
  for (i = 0; i < input.length; i++) {
91132
- code = input[i].charCodeAt(0);
91133
- if (code === 48) {
91161
+ code2 = input[i].charCodeAt(0);
91162
+ if (code2 === 48) {
91134
91163
  continue;
91135
91164
  }
91136
- if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
91165
+ if (!(code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 70 || code2 >= 97 && code2 <= 102)) {
91137
91166
  return "";
91138
91167
  }
91139
91168
  acc += input[i];
91140
91169
  break;
91141
91170
  }
91142
91171
  for (i += 1; i < input.length; i++) {
91143
- code = input[i].charCodeAt(0);
91144
- if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
91172
+ code2 = input[i].charCodeAt(0);
91173
+ if (!(code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 70 || code2 >= 97 && code2 <= 102)) {
91145
91174
  return "";
91146
91175
  }
91147
91176
  acc += input[i];
@@ -92279,7 +92308,7 @@ var require_core = __commonJS({
92279
92308
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
92280
92309
  if (!errors || errors.length === 0)
92281
92310
  return "No errors";
92282
- return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text2, msg) => text2 + separator + msg);
92311
+ return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text3, msg) => text3 + separator + msg);
92283
92312
  }
92284
92313
  $dataMetaSchema(metaSchema, keywordsJsonPointers) {
92285
92314
  const rules = this.RULES.all;
@@ -94174,8 +94203,8 @@ var require_format = __commonJS({
94174
94203
  }
94175
94204
  __name(unknownFormat, "unknownFormat");
94176
94205
  function getFormat(fmtDef) {
94177
- const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0;
94178
- const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
94206
+ const code2 = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0;
94207
+ const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code: code2 });
94179
94208
  if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
94180
94209
  return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
94181
94210
  }
@@ -94867,9 +94896,9 @@ var require_code3 = __commonJS({
94867
94896
  static {
94868
94897
  __name(this, "_Code");
94869
94898
  }
94870
- constructor(code) {
94899
+ constructor(code2) {
94871
94900
  super();
94872
- this._items = typeof code === "string" ? [code] : code;
94901
+ this._items = typeof code2 === "string" ? [code2] : code2;
94873
94902
  }
94874
94903
  toString() {
94875
94904
  return this.str;
@@ -94896,13 +94925,13 @@ var require_code3 = __commonJS({
94896
94925
  exports2._Code = _Code;
94897
94926
  exports2.nil = new _Code("");
94898
94927
  function _(strs, ...args) {
94899
- const code = [strs[0]];
94928
+ const code2 = [strs[0]];
94900
94929
  let i = 0;
94901
94930
  while (i < args.length) {
94902
- addCodeArg(code, args[i]);
94903
- code.push(strs[++i]);
94931
+ addCodeArg(code2, args[i]);
94932
+ code2.push(strs[++i]);
94904
94933
  }
94905
- return new _Code(code);
94934
+ return new _Code(code2);
94906
94935
  }
94907
94936
  __name(_, "_");
94908
94937
  exports2._ = _;
@@ -94920,13 +94949,13 @@ var require_code3 = __commonJS({
94920
94949
  }
94921
94950
  __name(str2, "str");
94922
94951
  exports2.str = str2;
94923
- function addCodeArg(code, arg) {
94952
+ function addCodeArg(code2, arg) {
94924
94953
  if (arg instanceof _Code)
94925
- code.push(...arg._items);
94954
+ code2.push(...arg._items);
94926
94955
  else if (arg instanceof Name)
94927
- code.push(arg);
94956
+ code2.push(arg);
94928
94957
  else
94929
- code.push(interpolate(arg));
94958
+ code2.push(interpolate(arg));
94930
94959
  }
94931
94960
  __name(addCodeArg, "addCodeArg");
94932
94961
  exports2.addCodeArg = addCodeArg;
@@ -95132,7 +95161,7 @@ var require_scope2 = __commonJS({
95132
95161
  }, usedValues, getCode);
95133
95162
  }
95134
95163
  _reduceValues(values, valueCode, usedValues = {}, getCode) {
95135
- let code = code_1.nil;
95164
+ let code2 = code_1.nil;
95136
95165
  for (const prefix in values) {
95137
95166
  const vs = values[prefix];
95138
95167
  if (!vs)
@@ -95145,16 +95174,16 @@ var require_scope2 = __commonJS({
95145
95174
  let c = valueCode(name21);
95146
95175
  if (c) {
95147
95176
  const def = this.opts.es5 ? exports2.varKinds.var : exports2.varKinds.const;
95148
- code = (0, code_1._)`${code}${def} ${name21} = ${c};${this.opts._n}`;
95177
+ code2 = (0, code_1._)`${code2}${def} ${name21} = ${c};${this.opts._n}`;
95149
95178
  } else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name21)) {
95150
- code = (0, code_1._)`${code}${c}${this.opts._n}`;
95179
+ code2 = (0, code_1._)`${code2}${c}${this.opts._n}`;
95151
95180
  } else {
95152
95181
  throw new ValueError(name21);
95153
95182
  }
95154
95183
  nameSet.set(name21, UsedValueState.Completed);
95155
95184
  });
95156
95185
  }
95157
- return code;
95186
+ return code2;
95158
95187
  }
95159
95188
  };
95160
95189
  exports2.ValueScope = ValueScope;
@@ -95338,9 +95367,9 @@ var require_codegen2 = __commonJS({
95338
95367
  static {
95339
95368
  __name(this, "AnyCode");
95340
95369
  }
95341
- constructor(code) {
95370
+ constructor(code2) {
95342
95371
  super();
95343
- this.code = code;
95372
+ this.code = code2;
95344
95373
  }
95345
95374
  render({ _n }) {
95346
95375
  return `${this.code};` + _n;
@@ -95365,7 +95394,7 @@ var require_codegen2 = __commonJS({
95365
95394
  this.nodes = nodes;
95366
95395
  }
95367
95396
  render(opts) {
95368
- return this.nodes.reduce((code, n) => code + n.render(opts), "");
95397
+ return this.nodes.reduce((code2, n) => code2 + n.render(opts), "");
95369
95398
  }
95370
95399
  optimizeNodes() {
95371
95400
  const { nodes } = this;
@@ -95425,10 +95454,10 @@ var require_codegen2 = __commonJS({
95425
95454
  this.condition = condition;
95426
95455
  }
95427
95456
  render(opts) {
95428
- let code = `if(${this.condition})` + super.render(opts);
95457
+ let code2 = `if(${this.condition})` + super.render(opts);
95429
95458
  if (this.else)
95430
- code += "else " + this.else.render(opts);
95431
- return code;
95459
+ code2 += "else " + this.else.render(opts);
95460
+ return code2;
95432
95461
  }
95433
95462
  optimizeNodes() {
95434
95463
  super.optimizeNodes();
@@ -95570,12 +95599,12 @@ var require_codegen2 = __commonJS({
95570
95599
  __name(this, "Try");
95571
95600
  }
95572
95601
  render(opts) {
95573
- let code = "try" + super.render(opts);
95602
+ let code2 = "try" + super.render(opts);
95574
95603
  if (this.catch)
95575
- code += this.catch.render(opts);
95604
+ code2 += this.catch.render(opts);
95576
95605
  if (this.finally)
95577
- code += this.finally.render(opts);
95578
- return code;
95606
+ code2 += this.finally.render(opts);
95607
+ return code2;
95579
95608
  }
95580
95609
  optimizeNodes() {
95581
95610
  var _a21, _b17;
@@ -95701,18 +95730,18 @@ var require_codegen2 = __commonJS({
95701
95730
  }
95702
95731
  // returns code for object literal for the passed argument list of key-value pairs
95703
95732
  object(...keyValues) {
95704
- const code = ["{"];
95733
+ const code2 = ["{"];
95705
95734
  for (const [key2, value] of keyValues) {
95706
- if (code.length > 1)
95707
- code.push(",");
95708
- code.push(key2);
95735
+ if (code2.length > 1)
95736
+ code2.push(",");
95737
+ code2.push(key2);
95709
95738
  if (key2 !== value || this.opts.es5) {
95710
- code.push(":");
95711
- (0, code_1.addCodeArg)(code, value);
95739
+ code2.push(":");
95740
+ (0, code_1.addCodeArg)(code2, value);
95712
95741
  }
95713
95742
  }
95714
- code.push("}");
95715
- return new code_1._Code(code);
95743
+ code2.push("}");
95744
+ return new code_1._Code(code2);
95716
95745
  }
95717
95746
  // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
95718
95747
  if(condition, thenBody, elseBody) {
@@ -98541,7 +98570,7 @@ var require_core3 = __commonJS({
98541
98570
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
98542
98571
  if (!errors || errors.length === 0)
98543
98572
  return "No errors";
98544
- return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text2, msg) => text2 + separator + msg);
98573
+ return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text3, msg) => text3 + separator + msg);
98545
98574
  }
98546
98575
  $dataMetaSchema(metaSchema, keywordsJsonPointers) {
98547
98576
  const rules = this.RULES.all;
@@ -100436,8 +100465,8 @@ var require_format3 = __commonJS({
100436
100465
  }
100437
100466
  __name(unknownFormat, "unknownFormat");
100438
100467
  function getFormat(fmtDef) {
100439
- const code = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0;
100440
- const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
100468
+ const code2 = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` : void 0;
100469
+ const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code: code2 });
100441
100470
  if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
100442
100471
  return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
100443
100472
  }
@@ -103561,9 +103590,9 @@ var init_streamableHttp = __esm({
103561
103590
  static {
103562
103591
  __name(this, "StreamableHTTPError");
103563
103592
  }
103564
- constructor(code, message) {
103593
+ constructor(code2, message) {
103565
103594
  super(`Streamable HTTP error: ${message}`);
103566
- this.code = code;
103595
+ this.code = code2;
103567
103596
  }
103568
103597
  };
103569
103598
  StreamableHTTPClientTransport = class {
@@ -103813,7 +103842,7 @@ var init_streamableHttp = __esm({
103813
103842
  this._sessionId = sessionId;
103814
103843
  }
103815
103844
  if (!response.ok) {
103816
- const text2 = await response.text().catch(() => null);
103845
+ const text3 = await response.text().catch(() => null);
103817
103846
  if (response.status === 401 && this._authProvider) {
103818
103847
  if (this._hasCompletedAuthFlow) {
103819
103848
  throw new StreamableHTTPError(401, "Server returned 401 after successful authentication");
@@ -103859,7 +103888,7 @@ var init_streamableHttp = __esm({
103859
103888
  return this.send(message);
103860
103889
  }
103861
103890
  }
103862
- throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text2}`);
103891
+ throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text3}`);
103863
103892
  }
103864
103893
  this._hasCompletedAuthFlow = false;
103865
103894
  this._lastUpscopingHeader = void 0;
@@ -105408,10 +105437,10 @@ function stateDiagram(sm) {
105408
105437
  function flowDiagram(actions, events, actionNameByUuid) {
105409
105438
  const lines = ["flowchart LR"];
105410
105439
  const declared = /* @__PURE__ */ new Set();
105411
- const declare = /* @__PURE__ */ __name((id, text2, kind) => {
105440
+ const declare = /* @__PURE__ */ __name((id, text3, kind) => {
105412
105441
  if (declared.has(id)) return;
105413
105442
  declared.add(id);
105414
- lines.push(kind === "action" ? ` ${id}["${text2}"]` : ` ${id}(["${text2}"])`);
105443
+ lines.push(kind === "action" ? ` ${id}["${text3}"]` : ` ${id}(["${text3}"])`);
105415
105444
  }, "declare");
105416
105445
  for (const a of actions) {
105417
105446
  const aid = "A_" + sid(a.name);
@@ -105517,6 +105546,102 @@ var init_aiMermaid = __esm({
105517
105546
  }
105518
105547
  });
105519
105548
 
105549
+ // backend/src/services/ai/compactMarkdown.ts
105550
+ function entityDetailsToMarkdown(details) {
105551
+ if (details.error) return `> Error: ${text2(details.error)}`;
105552
+ if (details.ambiguous) {
105553
+ const rows = (details.candidates ?? []).map((candidate) => `| ${code(candidate.entityName)} | ${code(candidate.packageName)} | ${text2(candidate.description) || "\u2014"} |`);
105554
+ return [
105555
+ `# Ambiguous entity: ${code(details.candidates?.[0]?.entityName ?? "unknown")}`,
105556
+ "",
105557
+ "| Entity | Package | Description |",
105558
+ "|---|---|---|",
105559
+ ...rows,
105560
+ "",
105561
+ `> ${text2(details.note)}`
105562
+ ].join("\n");
105563
+ }
105564
+ const physical = details.physical;
105565
+ const attrs = (details.attributes ?? []).map((attribute) => {
105566
+ const flags = [attribute.primaryKey ? "PK" : "", attribute.required ? "required" : "optional"].filter(Boolean).join(", ");
105567
+ const mapping = attribute.physical ? [attribute.physical.columnName, attribute.physical.dbType].filter(Boolean).join(" : ") : "\u2014";
105568
+ return `| ${code(attribute.name)} | ${code(attribute.type)} | ${flags} | ${text2(mapping)} | ${compactJson(attribute.validation)} | ${text2(attribute.description) || "\u2014"} |`;
105569
+ });
105570
+ const lines = [
105571
+ `# ${text2(details.name)}${details.packageName ? ` \u2014 ${code(details.packageName)}` : ""}`,
105572
+ "",
105573
+ text2(details.description) || "_No description._"
105574
+ ];
105575
+ if (details.stereotype) lines.push("", `Stereotype: ${code(details.stereotype)}`);
105576
+ if (physical) {
105577
+ const qualified = [physical.schema, physical.tableName].filter(Boolean).join(".");
105578
+ lines.push("", `Physical table: ${code(qualified)}`);
105579
+ }
105580
+ lines.push(
105581
+ "",
105582
+ `## Attributes (${attrs.length})`,
105583
+ "",
105584
+ "| Attribute | Type | Flags | Physical column/type | Validation | Description |",
105585
+ "|---|---|---|---|---|---|",
105586
+ ...attrs.length ? attrs : ["| \u2014 | \u2014 | \u2014 | \u2014 | \u2014 | \u2014 |"]
105587
+ );
105588
+ if (details.constraints?.length) {
105589
+ lines.push("", "## Constraints", "", ...details.constraints.map((constraint) => `- ${compactJson(constraint)}`));
105590
+ }
105591
+ if (details.rules?.length) {
105592
+ lines.push("", "## Rules", "", ...details.rules.map((rule) => `- **${text2(rule.name)}**${rule.severity ? ` [${text2(rule.severity)}]` : ""}${rule.description ? `: ${text2(rule.description)}` : ""}`));
105593
+ }
105594
+ return lines.join("\n");
105595
+ }
105596
+ function sqlSchemaToMarkdown(schema) {
105597
+ if (schema.error) return `> Error: ${text2(schema.error)}`;
105598
+ const lines = [
105599
+ "# Physical SQL schema",
105600
+ "",
105601
+ `Dialect: ${code(schema.dialect)} `,
105602
+ `Scope: ${text2(schema.scope)}`
105603
+ ];
105604
+ for (const table of schema.tables ?? []) {
105605
+ lines.push(
105606
+ "",
105607
+ `## ${text2(table.entity)} \u2014 ${code(table.qualifiedName ?? table.table)}`,
105608
+ "",
105609
+ `Package: ${code(table.package)}`,
105610
+ "",
105611
+ "| Attribute | Column | DB type | Flags |",
105612
+ "|---|---|---|---|",
105613
+ ...table.columns?.length ? table.columns.map((column) => {
105614
+ const flags = [column.primaryKey ? "PK" : "", column.nullable ? "nullable" : "required", column.physicalMappingMissing ? "derived mapping" : ""].filter(Boolean).join(", ");
105615
+ return `| ${code(column.attribute)} | ${code(column.column)} | ${code(column.dbType)} | ${flags} |`;
105616
+ }) : ["| \u2014 | \u2014 | \u2014 | \u2014 |"]
105617
+ );
105618
+ }
105619
+ if (schema.relationships?.length) {
105620
+ lines.push("", "## Relationships", "", "| From | Cardinality | To | Cardinality | Description |", "|---|---|---|---|---|");
105621
+ lines.push(...schema.relationships.map((relationship) => `| ${code(relationship.from)} | ${text2(relationship.fromCardinality)} | ${code(relationship.to)} | ${text2(relationship.toCardinality)} | ${text2(relationship.description) || "\u2014"} |`));
105622
+ }
105623
+ if (schema.unresolvedEntityNames?.length) {
105624
+ lines.push("", `> Unresolved entities: ${schema.unresolvedEntityNames.map(code).join(", ")}`);
105625
+ }
105626
+ if (schema.note) lines.push("", `> ${text2(schema.note)}`);
105627
+ return lines.join("\n");
105628
+ }
105629
+ var text2, code, compactJson;
105630
+ var init_compactMarkdown = __esm({
105631
+ "backend/src/services/ai/compactMarkdown.ts"() {
105632
+ "use strict";
105633
+ text2 = /* @__PURE__ */ __name((value) => String(value ?? "").replace(/\r?\n/g, "<br>").replace(/\|/g, "\\|"), "text");
105634
+ code = /* @__PURE__ */ __name((value) => value == null || value === "" ? "\u2014" : `\`${String(value).replace(/\r?\n/g, "<br>").replace(/\|/g, "\\|").replace(/`/g, "\\`")}\``, "code");
105635
+ compactJson = /* @__PURE__ */ __name((value) => {
105636
+ if (value == null) return "\u2014";
105637
+ const serialized = JSON.stringify(value);
105638
+ return serialized === "{}" || serialized === "[]" ? "\u2014" : code(serialized);
105639
+ }, "compactJson");
105640
+ __name(entityDetailsToMarkdown, "entityDetailsToMarkdown");
105641
+ __name(sqlSchemaToMarkdown, "sqlSchemaToMarkdown");
105642
+ }
105643
+ });
105644
+
105520
105645
  // backend/src/controllers/aiSql.ts
105521
105646
  function nameList(names, max = 8) {
105522
105647
  if (!names.length) return "";
@@ -105600,6 +105725,18 @@ async function buildSqlSchema(input, services, opts) {
105600
105725
  if (!relsByPkg.has(p)) relsByPkg.set(p, await services.serviceService.getPackageRelationships(p).catch(() => []));
105601
105726
  return relsByPkg.get(p);
105602
105727
  }, "relsFor");
105728
+ if (!requestedNames?.length) {
105729
+ const scopePackages = input.packageName ? [input.packageName] : allPkgs;
105730
+ const entityCount = scopePackages.reduce((sum, pkg) => sum + (entitiesByPkg.get(pkg)?.length ?? 0), 0);
105731
+ if (entityCount > MAX_UNSCOPED_SQL_SCHEMA_ENTITIES) {
105732
+ return {
105733
+ error: `Refusing an unscoped SQL schema dump of ${entityCount} entities; the safe limit is ${MAX_UNSCOPED_SQL_SCHEMA_ENTITIES}. Call searchModel({ query: '<entity or business term>' }) to locate targets, then retry with entityNames: ['<EntityName>'].`,
105734
+ entityCount,
105735
+ limit: MAX_UNSCOPED_SQL_SCHEMA_ENTITIES,
105736
+ scope: input.packageName ?? "all packages"
105737
+ };
105738
+ }
105739
+ }
105603
105740
  let pkgs;
105604
105741
  let include = null;
105605
105742
  let scope;
@@ -105695,30 +105832,39 @@ async function buildSqlSchema(input, services, opts) {
105695
105832
  note: "Use these PHYSICAL table/column names and dbTypes when writing SQL. " + (opts?.schemaQualifyTables ? "Schema-qualify every table (use each table's qualifiedName). " : "") + (missing > 0 ? `${missing} column(s) in table(s) ${nameList(fallbackTables, 6)} have no explicit physical mapping \u2014 their column names/dbTypes are derived from the logical model; WARN the user before relying on them.` : "All columns have an explicit physical mapping.") + (unresolved.length ? ` Requested entities not found: ${unresolved.join(", ")} \u2014 call searchModel({ query: '<name>' }) to locate them.` : "")
105696
105833
  };
105697
105834
  }
105698
- var getSqlSchemaInputSchema, getSqlSchemaParameters;
105835
+ async function executeGetSqlSchema(input, services, opts) {
105836
+ const schema = await buildSqlSchema(input, services, opts);
105837
+ return input.format === "json" ? schema : sqlSchemaToMarkdown(schema);
105838
+ }
105839
+ var getSqlSchemaInputSchema, getSqlSchemaParameters, MAX_UNSCOPED_SQL_SCHEMA_ENTITIES;
105699
105840
  var init_aiSql = __esm({
105700
105841
  "backend/src/controllers/aiSql.ts"() {
105701
105842
  "use strict";
105702
105843
  init_zod();
105703
105844
  init_physicalMapping();
105845
+ init_compactMarkdown();
105704
105846
  getSqlSchemaInputSchema = external_exports.object({
105705
105847
  packageName: external_exports.string().optional().describe("Scope to one package (omit for the whole model)"),
105706
105848
  entityNames: external_exports.array(external_exports.string()).optional().describe("PREFERRED scope on large models: the target entity names (resolved across all packages). Their directly-related entities are included automatically so JOINs can be derived."),
105707
- dialect: external_exports.enum(["generic", "postgres", "mysql", "mssql", "oracle", "sqlite"]).optional().describe("Target SQL dialect \u2014 tunes fallback column types (default generic)")
105849
+ dialect: external_exports.enum(["generic", "postgres", "mysql", "mssql", "oracle", "sqlite"]).optional().describe("Target SQL dialect \u2014 tunes fallback column types (default generic)"),
105850
+ format: external_exports.enum(["markdown", "json"]).optional().describe("Result format (default markdown; use json for structured compatibility)")
105708
105851
  });
105709
105852
  getSqlSchemaParameters = {
105710
105853
  type: "object",
105711
105854
  properties: {
105712
105855
  packageName: { type: "string", description: "Scope to one package (omit for the whole model)" },
105713
105856
  entityNames: { type: "array", items: { type: "string" }, description: "PREFERRED scope on large models: target entity names, resolved across all packages; directly-related entities are included automatically for JOINs" },
105714
- dialect: { type: "string", enum: ["generic", "postgres", "mysql", "mssql", "oracle", "sqlite"], description: "Target SQL dialect (default generic)" }
105857
+ dialect: { type: "string", enum: ["generic", "postgres", "mysql", "mssql", "oracle", "sqlite"], description: "Target SQL dialect (default generic)" },
105858
+ format: { type: "string", enum: ["markdown", "json"], description: "Result format (default markdown)" }
105715
105859
  }
105716
105860
  };
105717
105861
  __name(nameList, "nameList");
105718
105862
  __name(resolveBase, "resolveBase");
105719
105863
  __name(sqlType, "sqlType");
105720
105864
  __name(columnFor, "columnFor");
105865
+ MAX_UNSCOPED_SQL_SCHEMA_ENTITIES = 250;
105721
105866
  __name(buildSqlSchema, "buildSqlSchema");
105867
+ __name(executeGetSqlSchema, "executeGetSqlSchema");
105722
105868
  }
105723
105869
  });
105724
105870
 
@@ -111009,12 +111155,12 @@ function convertToOpenAIChatMessages({
111009
111155
  break;
111010
111156
  }
111011
111157
  case "assistant": {
111012
- let text2 = "";
111158
+ let text3 = "";
111013
111159
  const toolCalls = [];
111014
111160
  for (const part of content) {
111015
111161
  switch (part.type) {
111016
111162
  case "text": {
111017
- text2 += part.text;
111163
+ text3 += part.text;
111018
111164
  break;
111019
111165
  }
111020
111166
  case "tool-call": {
@@ -111032,7 +111178,7 @@ function convertToOpenAIChatMessages({
111032
111178
  }
111033
111179
  messages.push({
111034
111180
  role: "assistant",
111035
- content: text2,
111181
+ content: text3,
111036
111182
  tool_calls: toolCalls.length > 0 ? toolCalls : void 0
111037
111183
  });
111038
111184
  break;
@@ -111199,9 +111345,9 @@ function convertToOpenAICompletionPrompt({
111199
111345
  user = "user",
111200
111346
  assistant = "assistant"
111201
111347
  }) {
111202
- let text2 = "";
111348
+ let text3 = "";
111203
111349
  if (prompt[0].role === "system") {
111204
- text2 += `${prompt[0].content}
111350
+ text3 += `${prompt[0].content}
111205
111351
 
111206
111352
  `;
111207
111353
  prompt = prompt.slice(1);
@@ -111222,7 +111368,7 @@ function convertToOpenAICompletionPrompt({
111222
111368
  }
111223
111369
  }
111224
111370
  }).filter(Boolean).join("");
111225
- text2 += `${user}:
111371
+ text3 += `${user}:
111226
111372
  ${userMessage}
111227
111373
 
111228
111374
  `;
@@ -111241,7 +111387,7 @@ ${userMessage}
111241
111387
  }
111242
111388
  }
111243
111389
  }).join("");
111244
- text2 += `${assistant}:
111390
+ text3 += `${assistant}:
111245
111391
  ${assistantMessage}
111246
111392
 
111247
111393
  `;
@@ -111258,10 +111404,10 @@ ${assistantMessage}
111258
111404
  }
111259
111405
  }
111260
111406
  }
111261
- text2 += `${assistant}:
111407
+ text3 += `${assistant}:
111262
111408
  `;
111263
111409
  return {
111264
- prompt: text2,
111410
+ prompt: text3,
111265
111411
  stopSequences: [`
111266
111412
  ${user}:`]
111267
111413
  };
@@ -112990,9 +113136,9 @@ var init_dist8 = __esm({
112990
113136
  });
112991
113137
  const choice2 = response.choices[0];
112992
113138
  const content = [];
112993
- const text2 = choice2.message.content;
112994
- if (text2 != null && text2.length > 0) {
112995
- content.push({ type: "text", text: text2 });
113139
+ const text3 = choice2.message.content;
113140
+ if (text3 != null && text3.length > 0) {
113141
+ content.push({ type: "text", text: text3 });
112996
113142
  }
112997
113143
  for (const toolCall of (_a21 = choice2.message.tool_calls) != null ? _a21 : []) {
112998
113144
  content.push({
@@ -117197,7 +117343,7 @@ var init_dist8 = __esm({
117197
117343
  return this.config.provider;
117198
117344
  }
117199
117345
  async getArgs({
117200
- text: text2,
117346
+ text: text3,
117201
117347
  voice = "alloy",
117202
117348
  outputFormat = "mp3",
117203
117349
  speed,
@@ -117213,7 +117359,7 @@ var init_dist8 = __esm({
117213
117359
  });
117214
117360
  const requestBody = {
117215
117361
  model: this.modelId,
117216
- input: text2,
117362
+ input: text3,
117217
117363
  voice,
117218
117364
  response_format: "mp3",
117219
117365
  speed,
@@ -117522,8 +117668,21 @@ var init_dist8 = __esm({
117522
117668
  var aiDirectClient_exports = {};
117523
117669
  __export(aiDirectClient_exports, {
117524
117670
  AbortError: () => AbortError,
117671
+ LIVE_TOOL_RESULT_MAX_CHARS: () => LIVE_TOOL_RESULT_MAX_CHARS,
117672
+ boundLiveToolResult: () => boundLiveToolResult,
117525
117673
  callWithTools: () => callWithTools
117526
117674
  });
117675
+ function boundLiveToolResult(result, maxChars = LIVE_TOOL_RESULT_MAX_CHARS) {
117676
+ const serialized = JSON.stringify(result ?? {});
117677
+ if (serialized.length <= maxChars) return result;
117678
+ const previewBudget = Math.max(maxChars - 500, 0);
117679
+ return {
117680
+ truncated: true,
117681
+ originalChars: serialized.length,
117682
+ preview: serialized.slice(0, previewBudget),
117683
+ note: "Tool result exceeded the live AI context budget. Retry with a narrower query, packageName, or entityNames scope."
117684
+ };
117685
+ }
117527
117686
  async function callWithTools(config3, messages, tools, executeToolFn, maxSteps = 10, onEvent, signal) {
117528
117687
  const currentMessages = [...messages];
117529
117688
  const allToolCalls = [];
@@ -117633,14 +117792,15 @@ async function callWithTools(config3, messages, tools, executeToolFn, maxSteps =
117633
117792
  onEvent({ type: "tool-start", name: toolName, toolCallId, input: toolArgs });
117634
117793
  }
117635
117794
  const result = await executeToolFn(toolName, toolArgs, toolCallId);
117636
- allToolCalls.push({ name: toolName, input: toolArgs, output: result });
117795
+ const boundedResult = boundLiveToolResult(result);
117796
+ allToolCalls.push({ name: toolName, input: toolArgs, output: boundedResult });
117637
117797
  if (onEvent) {
117638
- onEvent({ type: "tool-end", name: toolName, toolCallId, input: toolArgs, output: result });
117798
+ onEvent({ type: "tool-end", name: toolName, toolCallId, input: toolArgs, output: boundedResult });
117639
117799
  }
117640
117800
  currentMessages.push({
117641
117801
  role: "tool",
117642
117802
  tool_call_id: tc.id,
117643
- content: JSON.stringify(result)
117803
+ content: JSON.stringify(boundedResult)
117644
117804
  });
117645
117805
  }
117646
117806
  continue;
@@ -117706,7 +117866,7 @@ async function callWithTools(config3, messages, tools, executeToolFn, maxSteps =
117706
117866
  }
117707
117867
  return { text: finalText, toolCalls: allToolCalls, usage, stoppedAtStepLimit };
117708
117868
  }
117709
- var AbortError;
117869
+ var AbortError, LIVE_TOOL_RESULT_MAX_CHARS;
117710
117870
  var init_aiDirectClient = __esm({
117711
117871
  "backend/src/utils/aiDirectClient.ts"() {
117712
117872
  "use strict";
@@ -117721,6 +117881,8 @@ var init_aiDirectClient = __esm({
117721
117881
  this.name = "AbortError";
117722
117882
  }
117723
117883
  };
117884
+ LIVE_TOOL_RESULT_MAX_CHARS = 5e4;
117885
+ __name(boundLiveToolResult, "boundLiveToolResult");
117724
117886
  __name(callWithTools, "callWithTools");
117725
117887
  }
117726
117888
  });
@@ -117784,9 +117946,9 @@ __export(contextCondensing_exports, {
117784
117946
  estimateTokens: () => estimateTokens,
117785
117947
  maybeCondense: () => maybeCondense
117786
117948
  });
117787
- function estimateTokens(text2) {
117788
- if (!text2) return 0;
117789
- return Math.ceil(text2.length / 4);
117949
+ function estimateTokens(text3) {
117950
+ if (!text3) return 0;
117951
+ return Math.ceil(text3.length / 4);
117790
117952
  }
117791
117953
  function estimateMessageTokens(messages) {
117792
117954
  let total = 0;
@@ -117921,7 +118083,7 @@ function buildAiErrorDiagnostics(req, cfg, diagnosticId, rawMessages, pageContex
117921
118083
  provider: cfg.provider,
117922
118084
  model: cfg.model,
117923
118085
  incomingRequest: {
117924
- contentLengthHeader: req.get("content-length") ?? null,
118086
+ contentLengthHeader: typeof req.get === "function" ? req.get("content-length") ?? null : null,
117925
118087
  parsedBodyBytes: jsonByteLength(req.body),
117926
118088
  messageHistoryBytes: jsonByteLength(rawMessages),
117927
118089
  messageCount: rawMessages.length,
@@ -117934,10 +118096,10 @@ function buildAiErrorDiagnostics(req, cfg, diagnosticId, rawMessages, pageContex
117934
118096
  providerRequest: getProviderRequestMeasurement(diagnosticId) ?? null
117935
118097
  };
117936
118098
  }
117937
- function claimsMutation(text2) {
117938
- if (!text2) return false;
117939
- if (/✅|☑|\bdone!/i.test(text2)) return true;
117940
- const prose = text2.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ");
118099
+ function claimsMutation(text3) {
118100
+ if (!text3) return false;
118101
+ if (/✅|☑|\bdone!/i.test(text3)) return true;
118102
+ const prose = text3.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ");
117941
118103
  const VERB = "(created|added|inserted|updated|modified|deleted|removed|renamed|saved|persisted|applied|wired up)";
117942
118104
  const agentive = new RegExp(`\\b(i|i've|i have|we|we've|successfully|now)\\b[^.\\n]{0,40}\\b${VERB}\\b`, "i");
117943
118105
  const successCue = new RegExp(`\\b${VERB}\\b[^.\\n]{0,30}\\b(successfully|now)\\b`, "i");
@@ -117991,13 +118153,14 @@ function buildEntityDetails(entity, packageName) {
117991
118153
  };
117992
118154
  }
117993
118155
  async function executeGetEntityDetails(args, services) {
117994
- if (!args?.entityName) return { error: "entityName is required." };
118156
+ const render = /* @__PURE__ */ __name((result) => args?.format === "json" ? result : entityDetailsToMarkdown(result), "render");
118157
+ if (!args?.entityName) return render({ error: "entityName is required." });
117995
118158
  const matches = await services.serviceService.findEntityMatches(args.entityName, args.packageName || void 0);
117996
118159
  if (matches.length === 1) {
117997
- return buildEntityDetails(matches[0].entity, matches[0].packageName);
118160
+ return render(buildEntityDetails(matches[0].entity, matches[0].packageName));
117998
118161
  }
117999
118162
  if (matches.length > 1) {
118000
- return {
118163
+ return render({
118001
118164
  summary: `'${args.entityName}' matches ${matches.length} entities \u2014 specify packageName`,
118002
118165
  ambiguous: true,
118003
118166
  candidates: matches.map((m) => ({
@@ -118006,11 +118169,11 @@ async function executeGetEntityDetails(args, services) {
118006
118169
  ...m.entity.description ? { description: m.entity.description } : {}
118007
118170
  })),
118008
118171
  note: "Several packages define an entity with this name. Call getEntityDetails again with the intended packageName."
118009
- };
118172
+ });
118010
118173
  }
118011
- return {
118174
+ return render({
118012
118175
  error: `Entity '${args.entityName}' not found in ${args.packageName ? `package '${args.packageName}' or ` : ""}any package. Call searchModel({ query: '${args.entityName}' }) to locate it by full-text search \u2014 the model may use a different name.`
118013
- };
118176
+ });
118014
118177
  }
118015
118178
  async function executeListEntities(args, services) {
118016
118179
  const { listMicroservices: listMicroservices2 } = await Promise.resolve().then(() => (init_fileOperations(), fileOperations_exports));
@@ -118022,9 +118185,20 @@ async function executeListEntities(args, services) {
118022
118185
  };
118023
118186
  }
118024
118187
  const entities = await services.serviceService.getServiceEntities(args.packageName);
118188
+ const query = String(args.query ?? "").trim().toLowerCase();
118189
+ const filtered = query ? entities.filter((entity) => `${entity.name ?? ""} ${entity.description ?? ""}`.toLowerCase().includes(query)) : entities;
118190
+ const limit = Math.min(Math.max(Number(args.limit) || 50, 1), 100);
118191
+ const selected2 = filtered.slice(0, limit);
118192
+ const truncated = selected2.length < filtered.length;
118025
118193
  return {
118026
- summary: `${args.packageName}: ${nameList2(entities.map((e) => e.name)) || "no entities"}`,
118027
- entities: entities.map((e) => ({ name: e.name, description: e.description, attrCount: e.attributes?.length || 0 }))
118194
+ summary: `${args.packageName}: ${filtered.length} matching entit${filtered.length === 1 ? "y" : "ies"}${truncated ? ` (showing ${selected2.length})` : ""}`,
118195
+ total: filtered.length,
118196
+ count: selected2.length,
118197
+ truncated,
118198
+ entities: selected2.map((e) => ({ name: e.name, description: e.description, attrCount: e.attributes?.length || 0 })),
118199
+ ...truncated ? {
118200
+ note: "Result bounded for a large package. Use searchModel with a business term, or retry listEntities with query and limit."
118201
+ } : {}
118028
118202
  };
118029
118203
  }
118030
118204
  const packages = await listMicroservices2();
@@ -118112,6 +118286,23 @@ ${banner}
118112
118286
  Packages:
118113
118287
  ${lines.join("\n")}`;
118114
118288
  }
118289
+ function modelOverviewForAgent(overview) {
118290
+ if (overview.totals.entities <= MODEL_OVERVIEW_TOOL_MAX_ENTITIES) return overview;
118291
+ return {
118292
+ summary: overview.summary,
118293
+ totals: overview.totals,
118294
+ packages: overview.packages.map((pkg) => ({
118295
+ name: pkg.name,
118296
+ entityCount: pkg.entities.length,
118297
+ relationships: pkg.relationships
118298
+ })),
118299
+ stereotypes: overview.stereotypes,
118300
+ derivedTypes: overview.derivedTypes,
118301
+ caseCount: overview.cases.length,
118302
+ omittedEntityLists: true,
118303
+ note: `Entity names omitted because the model has ${overview.totals.entities} entities. Use searchModel to locate candidates, then getEntityDetails for exact definitions.`
118304
+ };
118305
+ }
118115
118306
  async function safeModelOutline(services) {
118116
118307
  try {
118117
118308
  return formatModelOutlineWithinBudget(
@@ -118298,15 +118489,26 @@ Page context: ${trimmed2.slice(0, 500)}`;
118298
118489
  }
118299
118490
  return out;
118300
118491
  }
118492
+ function boundedToolResult(output, maxChars = DIRECT_TOOL_RESULT_MAX_CHARS) {
118493
+ const serialized = JSON.stringify(output ?? {});
118494
+ if (serialized.length <= maxChars) return output;
118495
+ const previewBudget = Math.max(maxChars - 500, 0);
118496
+ return {
118497
+ truncated: true,
118498
+ originalChars: serialized.length,
118499
+ preview: serialized.slice(0, previewBudget),
118500
+ note: "Tool result exceeded the AI context budget. Retry with a narrower scope such as query, packageName, or entityNames."
118501
+ };
118502
+ }
118301
118503
  function buildDirectChatMessages(rawMessages, maxToolResultChars = DIRECT_TOOL_RESULT_MAX_CHARS) {
118302
118504
  const out = [];
118303
118505
  for (const msg of rawMessages) {
118304
- const text2 = msg.parts?.find((p) => p.type === "text")?.text || msg.content || "";
118506
+ const text3 = msg.parts?.find((p) => p.type === "text")?.text || msg.content || "";
118305
118507
  const toolCalls = msg.role === "assistant" && Array.isArray(msg.toolCalls) ? msg.toolCalls.filter((tc) => tc && tc.id && tc.name && tc.output !== void 0) : [];
118306
118508
  if (toolCalls.length) {
118307
118509
  out.push({
118308
118510
  role: "assistant",
118309
- content: text2 || "",
118511
+ content: text3 || "",
118310
118512
  tool_calls: toolCalls.map((tc) => ({
118311
118513
  id: String(tc.id),
118312
118514
  type: "function",
@@ -118323,8 +118525,8 @@ function buildDirectChatMessages(rawMessages, maxToolResultChars = DIRECT_TOOL_R
118323
118525
  content: serialized.length > maxToolResultChars ? serialized.slice(0, maxToolResultChars) + TOOL_RESULT_TRUNCATION_MARKER : serialized
118324
118526
  });
118325
118527
  }
118326
- } else if (text2) {
118327
- out.push({ role: msg.role, content: text2 });
118528
+ } else if (text3) {
118529
+ out.push({ role: msg.role, content: text3 });
118328
118530
  }
118329
118531
  }
118330
118532
  return out;
@@ -118340,7 +118542,7 @@ function buildUiMessagesWithToolParts(rawMessages) {
118340
118542
  toolCallId: String(tc.id),
118341
118543
  state: "output-available",
118342
118544
  input: tc.input ?? {},
118343
- output: tc.output
118545
+ output: boundedToolResult(tc.output)
118344
118546
  }));
118345
118547
  return { ...rest, parts: [...baseParts, ...toolParts] };
118346
118548
  });
@@ -118374,11 +118576,11 @@ async function handleDirectChat(req, res, cfg, rawMessages, services, pageContex
118374
118576
  { type: "function", function: { name: "createEvent", description: "Create a domain Event (PascalCase, past tense, e.g. OrderPlaced) emitted by an aggregate entity (ownerEntityName). Optional payload fields.", parameters: createEventParameters } },
118375
118577
  { type: "function", function: { name: "createAction", description: "Create an Action/command (e.g. PlaceOrder) on an aggregate entity (ownerEntityName), optionally CQRS-classified, with an optional flow of steps. Use flow steps emitEvent {name} and wait {for} to wire a saga/process across actions+events.", parameters: createActionParameters } },
118376
118578
  { type: "function", function: { name: "createStateMachine", description: "Create a state machine on an entity (ownerEntityName) \u2014 its states, initialState, and transitions (from/to/on). Model an entity lifecycle, e.g. Order PENDING\u2192PAID\u2192SHIPPED.", parameters: createStateMachineParameters } },
118377
- { type: "function", function: { name: "listEntities", description: "List packages or entities in a package", parameters: { type: "object", properties: { packageName: { type: "string", description: "Package name (omit to list all)" } } } } },
118378
- { type: "function", function: { name: "getEntityDetails", description: "Get full detail for one entity: attributes with type/required/primaryKey AND field validation, the PHYSICAL mapping (entity table name + schema, each attribute physical column name + DB type), physical constraints, and inline business rules. packageName is OPTIONAL \u2014 omit it and the entity name is resolved across every package (ambiguous names return a candidate list). Call this before writing SQL/DDL so you use the real physical names and types.", parameters: { type: "object", required: ["entityName"], properties: { packageName: { type: "string", description: "Owning package if known (optional \u2014 resolved across packages when omitted)" }, entityName: { type: "string" } } } } },
118379
- { type: "function", function: { name: "getModelOverview", description: "Get a whole-model outline: every package with its entity names, and a count of each concept (entities, relationships, cases, rules, events, actions, state machines, derived types, stereotypes). A snapshot is already in your context; call this to refresh after changes.", parameters: { type: "object", properties: {} } } },
118579
+ { type: "function", function: { name: "listEntities", description: "List packages, or a bounded entity page within one package. Prefer searchModel for discovery in large projects.", parameters: { type: "object", properties: { packageName: { type: "string", description: "Package name (omit to list packages)" }, query: { type: "string", description: "Optional name/description filter" }, limit: { type: "number", description: "Maximum entities returned (default 50, max 100)" } } } } },
118580
+ { type: "function", function: { name: "getEntityDetails", description: "Get full detail for one entity as compact Markdown by default: attributes, validation, physical mapping, constraints, and rules. Set format=json only when structured data is required. packageName is optional and resolves across packages when omitted.", parameters: { type: "object", required: ["entityName"], properties: { packageName: { type: "string", description: "Owning package if known (optional \u2014 resolved across packages when omitted)" }, entityName: { type: "string" }, format: { type: "string", enum: ["markdown", "json"], description: "Result format (default markdown)" } } } } },
118581
+ { type: "function", function: { name: "getModelOverview", description: "Get whole-model counts and package summaries. Large projects omit entity names by design; use searchModel to locate candidates. A snapshot is already in your context, so call this only to refresh after changes.", parameters: { type: "object", properties: {} } } },
118380
118582
  { type: "function", function: { name: "generateMermaid", description: 'Convert the model to Mermaid diagram source. diagram: "er" (entity-relationship of a package, or all), "class" (class diagram), "state" (a single entity state machine \u2014 pass entityName), "flow" (actions+events saga). Returns { mermaid }. Present it inside a ```mermaid code block.', parameters: generateMermaidParameters } },
118381
- { type: "function", function: { name: "getSqlSchema", description: "Get the PHYSICAL relational schema for writing SQL: per-entity table name + schema, each column (physical name, dbType, nullable, primaryKey), and relationships as join hints. PREFER scoping with entityNames (target entities, resolved across packages; directly-related entities are included automatically for JOINs) or packageName \u2014 an unscoped call on a large model returns a huge result that may be truncated. Optional dialect. Call this before writing any SQL query or DDL so you use real physical names/types, not the conceptual (logical) names.", parameters: getSqlSchemaParameters } },
118583
+ { type: "function", function: { name: "getSqlSchema", description: "Get the PHYSICAL relational schema as compact Markdown by default: table/schema, columns, types, flags, and relationship join hints. Set format=json only when structured data is required. Prefer entityNames or packageName scope; oversized unscoped requests are refused.", parameters: getSqlSchemaParameters } },
118382
118584
  { type: "function", function: { name: "listStereotypes", description: "List available stereotypes", parameters: { type: "object", properties: {} } } },
118383
118585
  { type: "function", function: { name: "navigateTo", description: 'Navigate user to a page. The path MUST be an absolute URL beginning with "/" that matches one of the patterns returned by listRoutes \u2014 call listRoutes first if you are unsure of the exact shape.', parameters: { type: "object", required: ["path", "reason"], properties: { path: { type: "string" }, reason: { type: "string" } } } } },
118384
118586
  { type: "function", function: { name: "listRoutes", description: "List every valid URL pattern in the app with a short description and (where useful) a concrete example. Call this BEFORE navigateTo if you are unsure of the exact path shape \u2014 e.g. plural vs singular, where attribute pages live, what the case route is.", parameters: { type: "object", properties: {} } } }
@@ -118446,13 +118648,13 @@ async function handleDirectChat(req, res, cfg, rawMessages, services, pageContex
118446
118648
  return await executeGetEntityDetails(args, services);
118447
118649
  }
118448
118650
  if (name21 === "getModelOverview") {
118449
- return await getModelOverviewCached(() => buildModelOverview(services));
118651
+ return modelOverviewForAgent(await getModelOverviewCached(() => buildModelOverview(services)));
118450
118652
  }
118451
118653
  if (name21 === "generateMermaid") {
118452
118654
  return await generateMermaidDiagram(args, services);
118453
118655
  }
118454
118656
  if (name21 === "getSqlSchema") {
118455
- return await buildSqlSchema(args, services, cfg.sql);
118657
+ return await executeGetSqlSchema(args, services, cfg.sql);
118456
118658
  }
118457
118659
  if (name21 === "listStereotypes") {
118458
118660
  const stereotypes = await services.stereotypeService.getAllStereotypes();
@@ -118596,8 +118798,8 @@ async function handleDirectChat(req, res, cfg, rawMessages, services, pageContex
118596
118798
  async function buildMentionsContext(rawMessages) {
118597
118799
  const lastUser = [...rawMessages].reverse().find((m) => m.role === "user");
118598
118800
  if (!lastUser) return "";
118599
- const text2 = lastUser.parts?.find((p) => p.type === "text")?.text || lastUser.content || "";
118600
- const tokens = Array.from(new Set((text2.match(/@[A-Za-z][\w-]*/g) || []).map((t) => t.slice(1)))).slice(0, 6);
118801
+ const text3 = lastUser.parts?.find((p) => p.type === "text")?.text || lastUser.content || "";
118802
+ const tokens = Array.from(new Set((text3.match(/@[A-Za-z][\w-]*/g) || []).map((t) => t.slice(1)))).slice(0, 6);
118601
118803
  if (tokens.length === 0) return "";
118602
118804
  try {
118603
118805
  const { listPackages: listPackages3, listAllEntities: listAllEntities2 } = await Promise.resolve().then(() => (init_fileOperations(), fileOperations_exports));
@@ -118624,7 +118826,7 @@ ${lines.join("\n")}` : "";
118624
118826
  return "";
118625
118827
  }
118626
118828
  }
118627
- var TOOL_CATEGORY_MAP, READ_ONLY_TOOLS, MODE_SYSTEM_SUFFIX, GATED_CATEGORIES, MODEL_OUTLINE_MAX_CHARS, DENIED_RESULT, SYSTEM_PROMPT, DIRECT_TOOL_RESULT_MAX_CHARS, TOOL_RESULT_TRUNCATION_MARKER, aiChat, aiChatApprove, aiStatus, aiGetConfig, aiSaveConfig, aiTestTools, aiTools, aiMentionsSearch, listConversations, getConversation, saveConversation, patchConversation, deleteConversation, getSystemPromptByDigest, listPrompts, getPrompt, createPrompt, updatePrompt, deletePrompt;
118829
+ var TOOL_CATEGORY_MAP, READ_ONLY_TOOLS, MODE_SYSTEM_SUFFIX, GATED_CATEGORIES, MODEL_OUTLINE_MAX_CHARS, MODEL_OVERVIEW_TOOL_MAX_ENTITIES, DENIED_RESULT, SYSTEM_PROMPT, DIRECT_TOOL_RESULT_MAX_CHARS, TOOL_RESULT_TRUNCATION_MARKER, aiChat, aiChatApprove, aiStatus, aiGetConfig, aiSaveConfig, aiTestTools, aiTools, aiMentionsSearch, listConversations, getConversation, saveConversation, patchConversation, deleteConversation, getSystemPromptByDigest, listPrompts, getPrompt, createPrompt, updatePrompt, deletePrompt;
118628
118830
  var init_aiController = __esm({
118629
118831
  "backend/src/controllers/aiController.ts"() {
118630
118832
  "use strict";
@@ -118647,6 +118849,7 @@ var init_aiController = __esm({
118647
118849
  init_aiConceptTools();
118648
118850
  init_aiMermaid();
118649
118851
  init_aiSql();
118852
+ init_compactMarkdown();
118650
118853
  TOOL_CATEGORY_MAP = {
118651
118854
  // read
118652
118855
  listEntities: "read",
@@ -118716,7 +118919,9 @@ For a complete documentation review, never load a large document body in one cal
118716
118919
  __name(buildModelOverview, "buildModelOverview");
118717
118920
  __name(formatModelOutline, "formatModelOutline");
118718
118921
  MODEL_OUTLINE_MAX_CHARS = 4e3;
118922
+ MODEL_OVERVIEW_TOOL_MAX_ENTITIES = 250;
118719
118923
  __name(formatModelOutlineWithinBudget, "formatModelOutlineWithinBudget");
118924
+ __name(modelOverviewForAgent, "modelOverviewForAgent");
118720
118925
  __name(safeModelOutline, "safeModelOutline");
118721
118926
  __name(isGatedCategory, "isGatedCategory");
118722
118927
  __name(resolveToolCategory, "resolveToolCategory");
@@ -118742,20 +118947,20 @@ This system models a RICH domain \u2014 not just entities. You can author all of
118742
118947
  - Events \u2014 domain events emitted by aggregates, e.g. OrderPlaced (createEvent)
118743
118948
  - Actions \u2014 commands/queries on aggregates with a flow; emitEvent/wait steps wire a saga/process (createAction)
118744
118949
  - State machines \u2014 entity lifecycles: states + transitions, e.g. Order PENDING\u2192PAID\u2192SHIPPED (createStateMachine)
118745
- - Read/inspect: searchModel (full-text search across the whole dictionary \u2014 use it to LOCATE an entity/attribute/rule when you don't know its exact name, then drill in), getModelOverview (whole-model outline \u2014 packages, entities, and concept counts; a current snapshot is already shown to you below), getEntityDetails (one entity in full incl. physical mapping; packageName optional \u2014 the name resolves across packages), listEntities, listStereotypes; navigate with navigateTo (call listRoutes first if unsure)
118950
+ - Read/inspect: searchModel (full-text search across the whole dictionary \u2014 ALWAYS use it to LOCATE an entity/attribute/rule when you don't know its exact name, then drill in), getSearchIndexStatus (verify index coverage when search results look incomplete), getModelOverview (counts and bounded package summaries; a current snapshot is already shown below), getEntityDetails (one entity in full incl. physical mapping; packageName optional \u2014 the name resolves across packages), listEntities (bounded), listStereotypes; navigate with navigateTo (call listRoutes first if unsure)
118746
118951
  - Diagram: generateMermaid converts the model to Mermaid source \u2014 diagram: "er" (entity-relationship of a package/all), "class" (class diagram), "state" (an entity's state machine, needs entityName), or "flow" (actions+events saga). Use it when the user asks for a diagram, ERD, or visualization, and present the result in a fenced mermaid code block.
118747
118952
 
118748
118953
  A "process" or "saga" is NOT a separate object \u2014 it is the graph that emerges from Actions (with emitEvent/wait flow steps) and Events. To model a process, create the Actions and Events; the saga view is derived automatically.
118749
118954
 
118750
118955
  CONCEPTUAL vs PHYSICAL model \u2014 keep these two layers distinct:
118751
118956
  - CONCEPTUAL / LOGICAL is the business model: entity names (PascalCase, e.g. Order), attribute names (camelCase, e.g. orderNumber), and logical or derived types (e.g. money, email, currency-code). This is what you author and what users discuss.
118752
- - PHYSICAL is how it is persisted in a database: a table name (physical.tableName) in a schema, per-column physical names (physical.columnName) and DB types (physical.dbType), plus constraints. The two layers can differ completely (logical Order.orderNumber \u2192 physical orders.order_no VARCHAR). getEntityDetails returns the physical mapping for one entity; getSqlSchema returns the physical relational schema (scope it with entityNames or packageName on anything but a small model).
118957
+ - PHYSICAL is how it is persisted in a database: a table name (physical.tableName) in a schema, per-column physical names (physical.columnName) and DB types (physical.dbType), plus constraints. The two layers can differ completely (logical Order.orderNumber \u2192 physical orders.order_no VARCHAR). getEntityDetails returns the physical mapping for one entity; getSqlSchema returns the physical relational schema (scope it with entityNames or packageName on anything but a small model). Both return compact Markdown by default; request format=json only when structured output is necessary.
118753
118958
  - A logical/derived type (money, email) is NOT a DB type \u2014 it maps to a physical dbType (money \u2192 DECIMAL(12,2), email \u2192 VARCHAR(254)).
118754
118959
  - NEVER write DDL or SQL using conceptual names. Always resolve to the physical table/column names and dbTypes first. If an element has no physical mapping yet, getSqlSchema returns a fallback dbType derived from the logical type and flags it \u2014 pass that flag on to the user.
118755
118960
 
118756
118961
  Generating database queries: when the user asks for a SQL query (SELECT / INSERT / UPDATE / DELETE), a report, or DDL \u2014
118757
118962
  1. LOCATE the entity first. Unless you already know its owning package (from the snapshot, page context, or an @mention), call searchModel with the entity name or business term to resolve entity \u2192 package. NEVER guess a package, entity, or table name \u2014 the snapshot above may not list every entity.
118758
- 2. Call getSqlSchema scoped NARROWLY: pass entityNames: [...] for the target entities (their directly-related entities are included automatically so you can derive JOINs), or a packageName; pass the target dialect. Do not call it unscoped on a large model \u2014 the result gets truncated and misleads you.
118963
+ 2. Call getSqlSchema scoped NARROWLY: pass entityNames: [...] for the target entities (their directly-related entities are included automatically so you can derive JOINs), or a packageName; pass the target dialect. Do not call it unscoped on a large model \u2014 the tool refuses oversized unscoped results.
118759
118964
  3. Write the query using ONLY the physical names returned by the tool; derive JOINs from the relationships (join the PK of the "one" side to the FK on the "many" side) and respect the requested dialect.
118760
118965
  4. If any column is flagged physicalMappingMissing, tell the user those column names/types are unverified fallbacks derived from the logical model \u2014 do not silently pass them off as real.
118761
118966
  5. Present the query in a fenced sql code block, and briefly note any assumption (an inferred join column, a missing physical mapping). You generate queries for the user to run \u2014 you do NOT execute them against a live database.
@@ -118792,6 +118997,7 @@ Be concise in your responses. Show a summary of what you created.`;
118792
118997
  __name(buildSystemPrompt, "buildSystemPrompt");
118793
118998
  DIRECT_TOOL_RESULT_MAX_CHARS = 2e4;
118794
118999
  TOOL_RESULT_TRUNCATION_MARKER = "\u2026[truncated \u2014 result too large; retry with a narrower scope, e.g. packageName or entityNames filter]";
119000
+ __name(boundedToolResult, "boundedToolResult");
118795
119001
  __name(buildDirectChatMessages, "buildDirectChatMessages");
118796
119002
  __name(buildUiMessagesWithToolParts, "buildUiMessagesWithToolParts");
118797
119003
  __name(handleDirectChat, "handleDirectChat");
@@ -118814,7 +119020,7 @@ Be concise in your responses. Show a summary of what you created.`;
118814
119020
  provider: cfg.provider,
118815
119021
  model: cfg.model,
118816
119022
  mode,
118817
- contentLengthHeader: req.get("content-length") ?? null,
119023
+ contentLengthHeader: typeof req.get === "function" ? req.get("content-length") ?? null : null,
118818
119024
  parsedRequestBodyBytes: jsonByteLength(req.body),
118819
119025
  messageHistoryBytes: jsonByteLength(rawMessages),
118820
119026
  messageCount: rawMessages.length,
@@ -119038,9 +119244,11 @@ Be concise in your responses. Show a summary of what you created.`;
119038
119244
  }), "execute")
119039
119245
  }),
119040
119246
  listEntities: tool({
119041
- description: "List all entities in a package or all packages",
119247
+ description: "List packages, or a bounded entity page within one package. Prefer searchModel for discovery in large projects.",
119042
119248
  inputSchema: external_exports.object({
119043
- packageName: external_exports.string().optional().describe("Package name, or omit to list all packages")
119249
+ packageName: external_exports.string().optional().describe("Package name, or omit to list packages"),
119250
+ query: external_exports.string().optional().describe("Optional name/description filter"),
119251
+ limit: external_exports.number().optional().describe("Maximum entities returned (default 50, max 100)")
119044
119252
  }),
119045
119253
  execute: /* @__PURE__ */ __name(async (params) => {
119046
119254
  try {
@@ -119051,10 +119259,11 @@ Be concise in your responses. Show a summary of what you created.`;
119051
119259
  }, "execute")
119052
119260
  }),
119053
119261
  getEntityDetails: tool({
119054
- description: "Get full detail for an entity: attributes with type/required/primaryKey AND field validation, the PHYSICAL mapping (entity table name + schema, each attribute physical column name + DB type), physical constraints, and inline business rules. packageName is OPTIONAL \u2014 omit it and the entity name is resolved across every package (ambiguous names return a candidate list). Use this before writing SQL/DDL so you use the real physical names and types.",
119262
+ description: "Get full detail for an entity as compact Markdown by default: attributes, validation, physical mapping, constraints, and rules. Set format=json only when structured data is required. packageName is optional and resolves across packages when omitted.",
119055
119263
  inputSchema: external_exports.object({
119056
119264
  packageName: external_exports.string().optional().describe("Owning package if known (optional \u2014 resolved across packages when omitted)"),
119057
- entityName: external_exports.string()
119265
+ entityName: external_exports.string(),
119266
+ format: external_exports.enum(["markdown", "json"]).optional().describe("Result format (default markdown)")
119058
119267
  }),
119059
119268
  execute: /* @__PURE__ */ __name(async (params) => {
119060
119269
  try {
@@ -119065,11 +119274,11 @@ Be concise in your responses. Show a summary of what you created.`;
119065
119274
  }, "execute")
119066
119275
  }),
119067
119276
  getModelOverview: tool({
119068
- description: "Get a whole-model outline: every package with its entity names, and a count of each concept (entities, relationships, cases, rules, events, actions, state machines, derived types, stereotypes). Use to orient yourself before answering; a snapshot is already in your system context, so only call this to refresh after changes.",
119277
+ description: "Get whole-model counts and package summaries. Large projects omit entity names by design; use searchModel to locate candidates. A snapshot is already in your context, so call this only to refresh after changes.",
119069
119278
  inputSchema: external_exports.object({}),
119070
119279
  execute: /* @__PURE__ */ __name(async () => {
119071
119280
  try {
119072
- return await getModelOverviewCached(() => buildModelOverview(services));
119281
+ return modelOverviewForAgent(await getModelOverviewCached(() => buildModelOverview(services)));
119073
119282
  } catch (err) {
119074
119283
  return { error: err.message };
119075
119284
  }
@@ -119087,11 +119296,11 @@ Be concise in your responses. Show a summary of what you created.`;
119087
119296
  }, "execute")
119088
119297
  }),
119089
119298
  getSqlSchema: tool({
119090
- description: "Get the PHYSICAL relational schema for writing SQL: per-entity table name + schema, each column (physical name, dbType, nullable, primaryKey), and relationships as join hints. PREFER scoping with entityNames (target entities, resolved across packages; directly-related entities are included automatically for JOINs) or packageName \u2014 an unscoped call on a large model returns a huge result that may be truncated. Optional dialect. Call this before writing any SQL query or DDL so you use real physical names/types, not the conceptual (logical) names.",
119299
+ description: "Get the PHYSICAL relational schema as compact Markdown by default: table/schema, columns, types, flags, and relationship join hints. Set format=json only when structured data is required. Prefer entityNames or packageName scope; oversized unscoped requests are refused.",
119091
119300
  inputSchema: getSqlSchemaInputSchema,
119092
119301
  execute: /* @__PURE__ */ __name(async (params) => {
119093
119302
  try {
119094
- return await buildSqlSchema(params, services, cfg.sql);
119303
+ return await executeGetSqlSchema(params, services, cfg.sql);
119095
119304
  } catch (err) {
119096
119305
  return { error: err.message };
119097
119306
  }
@@ -119288,8 +119497,8 @@ Be concise in your responses. Show a summary of what you created.`;
119288
119497
  cleanup();
119289
119498
  break;
119290
119499
  }
119291
- const text2 = decoder.decode(value, { stream: true });
119292
- const lines = text2.split("\n");
119500
+ const text3 = decoder.decode(value, { stream: true });
119501
+ const lines = text3.split("\n");
119293
119502
  const output = [];
119294
119503
  for (const line of lines) {
119295
119504
  if (line.startsWith("data: ")) {
@@ -119538,24 +119747,27 @@ Be concise in your responses. Show a summary of what you created.`;
119538
119747
  },
119539
119748
  {
119540
119749
  name: "listEntities",
119541
- description: "List all entities in a package or all packages",
119750
+ description: "List packages, or a bounded entity page within one package. Prefer searchModel for discovery in large projects.",
119542
119751
  source: "builtin",
119543
119752
  parameters: [
119544
- { name: "packageName", type: "string", required: false, description: "Package name (omit to list all packages)" }
119753
+ { name: "packageName", type: "string", required: false, description: "Package name (omit to list packages)" },
119754
+ { name: "query", type: "string", required: false, description: "Optional name/description filter" },
119755
+ { name: "limit", type: "number", required: false, description: "Maximum entities returned (default 50, max 100)" }
119545
119756
  ]
119546
119757
  },
119547
119758
  {
119548
119759
  name: "getEntityDetails",
119549
- description: "Get full entity detail: attributes + validation, the physical mapping (table/schema, column names, DB types), constraints, and inline rules. Use before writing SQL/DDL.",
119760
+ description: "Get full entity detail as compact Markdown by default: attributes, validation, physical mapping, constraints, and rules. Set format=json for structured compatibility.",
119550
119761
  source: "builtin",
119551
119762
  parameters: [
119552
119763
  { name: "packageName", type: "string", required: false, description: "Owning package if known (omit to resolve the entity name across all packages)" },
119553
- { name: "entityName", type: "string", required: true, description: "Entity name" }
119764
+ { name: "entityName", type: "string", required: true, description: "Entity name" },
119765
+ { name: "format", type: "markdown|json", required: false, description: "Result format (default markdown)" }
119554
119766
  ]
119555
119767
  },
119556
119768
  {
119557
119769
  name: "getModelOverview",
119558
- description: "Whole-model outline: every package with its entities, and a count of each concept (entities, relationships, cases, rules, events, actions, state machines, derived types, stereotypes). A snapshot is also injected into the system prompt each turn.",
119770
+ description: "Whole-model counts and package summary. Entity names are omitted automatically for large projects; use searchModel to locate them.",
119559
119771
  source: "builtin",
119560
119772
  parameters: []
119561
119773
  },
@@ -119571,12 +119783,13 @@ Be concise in your responses. Show a summary of what you created.`;
119571
119783
  },
119572
119784
  {
119573
119785
  name: "getSqlSchema",
119574
- description: "Physical relational schema for writing SQL: tables, columns (physical name + dbType + nullable + PK), and relationships as join hints. Use before generating any SQL query/DDL. Prefer scoping with entityNames or packageName on large models.",
119786
+ description: "Physical relational schema as compact Markdown by default: tables, columns, flags, and relationship join hints. Set format=json for structured compatibility.",
119575
119787
  source: "builtin",
119576
119788
  parameters: [
119577
119789
  { name: "packageName", type: "string", required: false, description: "Scope to one package (omit for all)" },
119578
119790
  { name: "entityNames", type: "string[]", required: false, description: "Preferred scope: target entity names, resolved across packages; directly-related entities are included automatically for JOINs" },
119579
- { name: "dialect", type: "generic|postgres|mysql|mssql|oracle|sqlite", required: false, description: "Target SQL dialect (default generic)" }
119791
+ { name: "dialect", type: "generic|postgres|mysql|mssql|oracle|sqlite", required: false, description: "Target SQL dialect (default generic)" },
119792
+ { name: "format", type: "markdown|json", required: false, description: "Result format (default markdown)" }
119580
119793
  ]
119581
119794
  },
119582
119795
  {
@@ -120736,7 +120949,7 @@ var require_keyword3 = __commonJS({
120736
120949
  "backend/node_modules/esutils/lib/keyword.js"(exports2, module) {
120737
120950
  (function() {
120738
120951
  "use strict";
120739
- var code = require_code5();
120952
+ var code2 = require_code5();
120740
120953
  function isStrictModeReservedWordES6(id) {
120741
120954
  switch (id) {
120742
120955
  case "implements":
@@ -120804,12 +121017,12 @@ var require_keyword3 = __commonJS({
120804
121017
  return false;
120805
121018
  }
120806
121019
  ch = id.charCodeAt(0);
120807
- if (!code.isIdentifierStartES5(ch)) {
121020
+ if (!code2.isIdentifierStartES5(ch)) {
120808
121021
  return false;
120809
121022
  }
120810
121023
  for (i = 1, iz = id.length; i < iz; ++i) {
120811
121024
  ch = id.charCodeAt(i);
120812
- if (!code.isIdentifierPartES5(ch)) {
121025
+ if (!code2.isIdentifierPartES5(ch)) {
120813
121026
  return false;
120814
121027
  }
120815
121028
  }
@@ -120825,7 +121038,7 @@ var require_keyword3 = __commonJS({
120825
121038
  if (id.length === 0) {
120826
121039
  return false;
120827
121040
  }
120828
- check2 = code.isIdentifierStartES6;
121041
+ check2 = code2.isIdentifierStartES6;
120829
121042
  for (i = 0, iz = id.length; i < iz; ++i) {
120830
121043
  ch = id.charCodeAt(i);
120831
121044
  if (55296 <= ch && ch <= 56319) {
@@ -120842,7 +121055,7 @@ var require_keyword3 = __commonJS({
120842
121055
  if (!check2(ch)) {
120843
121056
  return false;
120844
121057
  }
120845
- check2 = code.isIdentifierPartES6;
121058
+ check2 = code2.isIdentifierPartES6;
120846
121059
  }
120847
121060
  return true;
120848
121061
  }
@@ -121086,21 +121299,21 @@ var require_typed = __commonJS({
121086
121299
  }
121087
121300
  __name(advance, "advance");
121088
121301
  function scanHexEscape(prefix) {
121089
- var i, len, ch, code = 0;
121302
+ var i, len, ch, code2 = 0;
121090
121303
  len = prefix === "u" ? 4 : 2;
121091
121304
  for (i = 0; i < len; ++i) {
121092
121305
  if (index2 < length && esutils.code.isHexDigit(source.charCodeAt(index2))) {
121093
121306
  ch = advance();
121094
- code = code * 16 + "0123456789abcdef".indexOf(ch.toLowerCase());
121307
+ code2 = code2 * 16 + "0123456789abcdef".indexOf(ch.toLowerCase());
121095
121308
  } else {
121096
121309
  return "";
121097
121310
  }
121098
121311
  }
121099
- return String.fromCharCode(code);
121312
+ return String.fromCharCode(code2);
121100
121313
  }
121101
121314
  __name(scanHexEscape, "scanHexEscape");
121102
121315
  function scanString() {
121103
- var str2 = "", quote, ch, code, unescaped, restore;
121316
+ var str2 = "", quote, ch, code2, unescaped, restore;
121104
121317
  quote = source.charAt(index2);
121105
121318
  ++index2;
121106
121319
  while (index2 < length) {
@@ -121143,14 +121356,14 @@ var require_typed = __commonJS({
121143
121356
  break;
121144
121357
  default:
121145
121358
  if (esutils.code.isOctalDigit(ch.charCodeAt(0))) {
121146
- code = "01234567".indexOf(ch);
121359
+ code2 = "01234567".indexOf(ch);
121147
121360
  if (index2 < length && esutils.code.isOctalDigit(source.charCodeAt(index2))) {
121148
- code = code * 8 + "01234567".indexOf(advance());
121361
+ code2 = code2 * 8 + "01234567".indexOf(advance());
121149
121362
  if ("0123".indexOf(ch) >= 0 && index2 < length && esutils.code.isOctalDigit(source.charCodeAt(index2))) {
121150
- code = code * 8 + "01234567".indexOf(advance());
121363
+ code2 = code2 * 8 + "01234567".indexOf(advance());
121151
121364
  }
121152
121365
  }
121153
- str2 += String.fromCharCode(code);
121366
+ str2 += String.fromCharCode(code2);
121154
121367
  } else {
121155
121368
  str2 += ch;
121156
121369
  }
@@ -121406,8 +121619,8 @@ var require_typed = __commonJS({
121406
121619
  }
121407
121620
  }
121408
121621
  __name(next, "next");
121409
- function consume(target, text2) {
121410
- utility.assert(token === target, text2 || "consumed token not matched");
121622
+ function consume(target, text3) {
121623
+ utility.assert(token === target, text3 || "consumed token not matched");
121411
121624
  next();
121412
121625
  }
121413
121626
  __name(consume, "consume");
@@ -122496,12 +122709,12 @@ var require_doctrine = __commonJS({
122496
122709
  }
122497
122710
  }, "parseThis");
122498
122711
  TagParser.prototype.parseVariation = /* @__PURE__ */ __name(function parseVariation() {
122499
- var variation, text2;
122500
- text2 = sliceSource(source, index2, this._last).trim();
122501
- variation = parseFloat(text2, 10);
122712
+ var variation, text3;
122713
+ text3 = sliceSource(source, index2, this._last).trim();
122714
+ variation = parseFloat(text3, 10);
122502
122715
  this._tag.variation = variation;
122503
122716
  if (isNaN(variation)) {
122504
- if (!this.addError("Invalid variation '%0'", text2)) {
122717
+ if (!this.addError("Invalid variation '%0'", text3)) {
122505
122718
  return false;
122506
122719
  }
122507
122720
  }
@@ -127387,8 +127600,8 @@ var require_isIdentityCard = __commonJS({
127387
127600
  if (!/^[A-Z][0-9]{9}$/.test(sanitized)) return false;
127388
127601
  return Array.from(sanitized).reduce(function(sum, number4, index2) {
127389
127602
  if (index2 === 0) {
127390
- var code = ALPHABET_CODES[number4];
127391
- return code % 10 * 9 + Math.floor(code / 10);
127603
+ var code2 = ALPHABET_CODES[number4];
127604
+ return code2 % 10 * 9 + Math.floor(code2 / 10);
127392
127605
  }
127393
127606
  if (index2 === 9) {
127394
127607
  return (10 - sum % 10 - Number(number4)) % 10 === 0;
@@ -138770,9 +138983,9 @@ var require_spec = __commonJS({
138770
138983
  }
138771
138984
  }
138772
138985
  __name(checkForDuplicates, "checkForDuplicates");
138773
- function validateResponse(code, response, responseId) {
138774
- if (code !== "default" && (code < 100 || code > 599)) {
138775
- throw ono.syntax(`Validation failed. ${responseId} has an invalid response code (${code})`);
138986
+ function validateResponse(code2, response, responseId) {
138987
+ if (code2 !== "default" && (code2 < 100 || code2 > 599)) {
138988
+ throw ono.syntax(`Validation failed. ${responseId} has an invalid response code (${code2})`);
138776
138989
  }
138777
138990
  let headers = Object.keys(response.headers || {});
138778
138991
  for (let headerName of headers) {
@@ -139964,11 +140177,11 @@ var require_binary2 = __commonJS({
139964
140177
  var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
139965
140178
  function resolveYamlBinary(data) {
139966
140179
  if (data === null) return false;
139967
- var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
140180
+ var code2, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
139968
140181
  for (idx = 0; idx < max; idx++) {
139969
- code = map2.indexOf(data.charAt(idx));
139970
- if (code > 64) continue;
139971
- if (code < 0) return false;
140182
+ code2 = map2.indexOf(data.charAt(idx));
140183
+ if (code2 > 64) continue;
140184
+ if (code2 < 0) return false;
139972
140185
  bitlen += 6;
139973
140186
  }
139974
140187
  return bitlen % 8 === 0;
@@ -145657,12 +145870,12 @@ var require_parse_3997f544 = __commonJS({
145657
145870
  } = this.context;
145658
145871
  const cc = src.substr(offset, length);
145659
145872
  const ok2 = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
145660
- const code = ok2 ? parseInt(cc, 16) : NaN;
145661
- if (isNaN(code)) {
145873
+ const code2 = ok2 ? parseInt(cc, 16) : NaN;
145874
+ if (isNaN(code2)) {
145662
145875
  errors.push(new _rollupPluginBabelHelpers.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`));
145663
145876
  return src.substr(offset - 2, length + 2);
145664
145877
  }
145665
- return String.fromCodePoint(code);
145878
+ return String.fromCodePoint(code2);
145666
145879
  }
145667
145880
  /**
145668
145881
  * Parses a "double quoted" value from the source
@@ -146658,26 +146871,26 @@ ${ctx.indent}`;
146658
146871
  var FOLD_FLOW = "flow";
146659
146872
  var FOLD_BLOCK = "block";
146660
146873
  var FOLD_QUOTED = "quoted";
146661
- var consumeMoreIndentedLines = /* @__PURE__ */ __name((text2, i) => {
146662
- let ch = text2[i + 1];
146874
+ var consumeMoreIndentedLines = /* @__PURE__ */ __name((text3, i) => {
146875
+ let ch = text3[i + 1];
146663
146876
  while (ch === " " || ch === " ") {
146664
146877
  do {
146665
- ch = text2[i += 1];
146878
+ ch = text3[i += 1];
146666
146879
  } while (ch && ch !== "\n");
146667
- ch = text2[i + 1];
146880
+ ch = text3[i + 1];
146668
146881
  }
146669
146882
  return i;
146670
146883
  }, "consumeMoreIndentedLines");
146671
- function foldFlowLines(text2, indent, mode, {
146884
+ function foldFlowLines(text3, indent, mode, {
146672
146885
  indentAtStart,
146673
146886
  lineWidth = 80,
146674
146887
  minContentWidth = 20,
146675
146888
  onFold,
146676
146889
  onOverflow
146677
146890
  }) {
146678
- if (!lineWidth || lineWidth < 0) return text2;
146891
+ if (!lineWidth || lineWidth < 0) return text3;
146679
146892
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
146680
- if (text2.length <= endStep) return text2;
146893
+ if (text3.length <= endStep) return text3;
146681
146894
  const folds = [];
146682
146895
  const escapedFolds = {};
146683
146896
  let end = lineWidth - indent.length;
@@ -146690,12 +146903,12 @@ ${ctx.indent}`;
146690
146903
  let overflow = false;
146691
146904
  let i = -1;
146692
146905
  if (mode === FOLD_BLOCK) {
146693
- i = consumeMoreIndentedLines(text2, i);
146906
+ i = consumeMoreIndentedLines(text3, i);
146694
146907
  if (i !== -1) end = i + endStep;
146695
146908
  }
146696
- for (let ch; ch = text2[i += 1]; ) {
146909
+ for (let ch; ch = text3[i += 1]; ) {
146697
146910
  if (mode === FOLD_QUOTED && ch === "\\") {
146698
- switch (text2[i + 1]) {
146911
+ switch (text3[i + 1]) {
146699
146912
  case "x":
146700
146913
  i += 3;
146701
146914
  break;
@@ -146710,12 +146923,12 @@ ${ctx.indent}`;
146710
146923
  }
146711
146924
  }
146712
146925
  if (ch === "\n") {
146713
- if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text2, i);
146926
+ if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text3, i);
146714
146927
  end = i + endStep;
146715
146928
  split = void 0;
146716
146929
  } else {
146717
146930
  if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
146718
- const next = text2[i + 1];
146931
+ const next = text3[i + 1];
146719
146932
  if (next && next !== " " && next !== "\n" && next !== " ") split = i;
146720
146933
  }
146721
146934
  if (i >= end) {
@@ -146726,7 +146939,7 @@ ${ctx.indent}`;
146726
146939
  } else if (mode === FOLD_QUOTED) {
146727
146940
  while (prev === " " || prev === " ") {
146728
146941
  prev = ch;
146729
- ch = text2[i += 1];
146942
+ ch = text3[i += 1];
146730
146943
  overflow = true;
146731
146944
  }
146732
146945
  folds.push(i - 2);
@@ -146741,18 +146954,18 @@ ${ctx.indent}`;
146741
146954
  prev = ch;
146742
146955
  }
146743
146956
  if (overflow && onOverflow) onOverflow();
146744
- if (folds.length === 0) return text2;
146957
+ if (folds.length === 0) return text3;
146745
146958
  if (onFold) onFold();
146746
- let res = text2.slice(0, folds[0]);
146959
+ let res = text3.slice(0, folds[0]);
146747
146960
  for (let i2 = 0; i2 < folds.length; ++i2) {
146748
146961
  const fold = folds[i2];
146749
- const end2 = folds[i2 + 1] || text2.length;
146962
+ const end2 = folds[i2 + 1] || text3.length;
146750
146963
  if (fold === 0) res = `
146751
- ${indent}${text2.slice(0, end2)}`;
146964
+ ${indent}${text3.slice(0, end2)}`;
146752
146965
  else {
146753
- if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text2[fold]}\\`;
146966
+ if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text3[fold]}\\`;
146754
146967
  res += `
146755
- ${indent}${text2.slice(fold + 1, end2)}`;
146968
+ ${indent}${text3.slice(fold + 1, end2)}`;
146756
146969
  }
146757
146970
  }
146758
146971
  return res;
@@ -146801,8 +147014,8 @@ ${indent}${text2.slice(fold + 1, end2)}`;
146801
147014
  case "u":
146802
147015
  {
146803
147016
  str2 += json3.slice(start, i);
146804
- const code = json3.substr(i + 2, 4);
146805
- switch (code) {
147017
+ const code2 = json3.substr(i + 2, 4);
147018
+ switch (code2) {
146806
147019
  case "0000":
146807
147020
  str2 += "\\0";
146808
147021
  break;
@@ -146828,7 +147041,7 @@ ${indent}${text2.slice(fold + 1, end2)}`;
146828
147041
  str2 += "\\P";
146829
147042
  break;
146830
147043
  default:
146831
- if (code.substr(0, 2) === "00") str2 += "\\x" + code.substr(2);
147044
+ if (code2.substr(0, 2) === "00") str2 += "\\x" + code2.substr(2);
146832
147045
  else str2 += json3.substr(i, 6);
146833
147046
  }
146834
147047
  i += 5;
@@ -154799,8 +155012,8 @@ var require_scan2 = __commonJS({
154799
155012
  CHAR_RIGHT_SQUARE_BRACKET
154800
155013
  /* ] */
154801
155014
  } = require_constants2();
154802
- var isPathSeparator = /* @__PURE__ */ __name((code) => {
154803
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
155015
+ var isPathSeparator = /* @__PURE__ */ __name((code2) => {
155016
+ return code2 === CHAR_FORWARD_SLASH || code2 === CHAR_BACKWARD_SLASH;
154804
155017
  }, "isPathSeparator");
154805
155018
  var depth = /* @__PURE__ */ __name((token) => {
154806
155019
  if (token.isPrefix !== true) {
@@ -154830,38 +155043,38 @@ var require_scan2 = __commonJS({
154830
155043
  let finished = false;
154831
155044
  let braces = 0;
154832
155045
  let prev;
154833
- let code;
155046
+ let code2;
154834
155047
  let token = { value: "", depth: 0, isGlob: false };
154835
155048
  const eos = /* @__PURE__ */ __name(() => index2 >= length, "eos");
154836
155049
  const peek = /* @__PURE__ */ __name(() => str2.charCodeAt(index2 + 1), "peek");
154837
155050
  const advance = /* @__PURE__ */ __name(() => {
154838
- prev = code;
155051
+ prev = code2;
154839
155052
  return str2.charCodeAt(++index2);
154840
155053
  }, "advance");
154841
155054
  while (index2 < length) {
154842
- code = advance();
155055
+ code2 = advance();
154843
155056
  let next;
154844
- if (code === CHAR_BACKWARD_SLASH) {
155057
+ if (code2 === CHAR_BACKWARD_SLASH) {
154845
155058
  backslashes = token.backslashes = true;
154846
- code = advance();
154847
- if (code === CHAR_LEFT_CURLY_BRACE) {
155059
+ code2 = advance();
155060
+ if (code2 === CHAR_LEFT_CURLY_BRACE) {
154848
155061
  braceEscaped = true;
154849
155062
  }
154850
155063
  continue;
154851
155064
  }
154852
- if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
155065
+ if (braceEscaped === true || code2 === CHAR_LEFT_CURLY_BRACE) {
154853
155066
  braces++;
154854
- while (eos() !== true && (code = advance())) {
154855
- if (code === CHAR_BACKWARD_SLASH) {
155067
+ while (eos() !== true && (code2 = advance())) {
155068
+ if (code2 === CHAR_BACKWARD_SLASH) {
154856
155069
  backslashes = token.backslashes = true;
154857
155070
  advance();
154858
155071
  continue;
154859
155072
  }
154860
- if (code === CHAR_LEFT_CURLY_BRACE) {
155073
+ if (code2 === CHAR_LEFT_CURLY_BRACE) {
154861
155074
  braces++;
154862
155075
  continue;
154863
155076
  }
154864
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
155077
+ if (braceEscaped !== true && code2 === CHAR_DOT && (code2 = advance()) === CHAR_DOT) {
154865
155078
  isBrace = token.isBrace = true;
154866
155079
  isGlob = token.isGlob = true;
154867
155080
  finished = true;
@@ -154870,7 +155083,7 @@ var require_scan2 = __commonJS({
154870
155083
  }
154871
155084
  break;
154872
155085
  }
154873
- if (braceEscaped !== true && code === CHAR_COMMA) {
155086
+ if (braceEscaped !== true && code2 === CHAR_COMMA) {
154874
155087
  isBrace = token.isBrace = true;
154875
155088
  isGlob = token.isGlob = true;
154876
155089
  finished = true;
@@ -154879,7 +155092,7 @@ var require_scan2 = __commonJS({
154879
155092
  }
154880
155093
  break;
154881
155094
  }
154882
- if (code === CHAR_RIGHT_CURLY_BRACE) {
155095
+ if (code2 === CHAR_RIGHT_CURLY_BRACE) {
154883
155096
  braces--;
154884
155097
  if (braces === 0) {
154885
155098
  braceEscaped = false;
@@ -154894,7 +155107,7 @@ var require_scan2 = __commonJS({
154894
155107
  }
154895
155108
  break;
154896
155109
  }
154897
- if (code === CHAR_FORWARD_SLASH) {
155110
+ if (code2 === CHAR_FORWARD_SLASH) {
154898
155111
  slashes.push(index2);
154899
155112
  tokens.push(token);
154900
155113
  token = { value: "", depth: 0, isGlob: false };
@@ -154907,22 +155120,22 @@ var require_scan2 = __commonJS({
154907
155120
  continue;
154908
155121
  }
154909
155122
  if (opts.noext !== true) {
154910
- const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
155123
+ const isExtglobChar = code2 === CHAR_PLUS || code2 === CHAR_AT || code2 === CHAR_ASTERISK || code2 === CHAR_QUESTION_MARK || code2 === CHAR_EXCLAMATION_MARK;
154911
155124
  if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
154912
155125
  isGlob = token.isGlob = true;
154913
155126
  isExtglob = token.isExtglob = true;
154914
155127
  finished = true;
154915
- if (code === CHAR_EXCLAMATION_MARK && index2 === start) {
155128
+ if (code2 === CHAR_EXCLAMATION_MARK && index2 === start) {
154916
155129
  negatedExtglob = true;
154917
155130
  }
154918
155131
  if (scanToEnd === true) {
154919
- while (eos() !== true && (code = advance())) {
154920
- if (code === CHAR_BACKWARD_SLASH) {
155132
+ while (eos() !== true && (code2 = advance())) {
155133
+ if (code2 === CHAR_BACKWARD_SLASH) {
154921
155134
  backslashes = token.backslashes = true;
154922
- code = advance();
155135
+ code2 = advance();
154923
155136
  continue;
154924
155137
  }
154925
- if (code === CHAR_RIGHT_PARENTHESES) {
155138
+ if (code2 === CHAR_RIGHT_PARENTHESES) {
154926
155139
  isGlob = token.isGlob = true;
154927
155140
  finished = true;
154928
155141
  break;
@@ -154933,7 +155146,7 @@ var require_scan2 = __commonJS({
154933
155146
  break;
154934
155147
  }
154935
155148
  }
154936
- if (code === CHAR_ASTERISK) {
155149
+ if (code2 === CHAR_ASTERISK) {
154937
155150
  if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
154938
155151
  isGlob = token.isGlob = true;
154939
155152
  finished = true;
@@ -154942,7 +155155,7 @@ var require_scan2 = __commonJS({
154942
155155
  }
154943
155156
  break;
154944
155157
  }
154945
- if (code === CHAR_QUESTION_MARK) {
155158
+ if (code2 === CHAR_QUESTION_MARK) {
154946
155159
  isGlob = token.isGlob = true;
154947
155160
  finished = true;
154948
155161
  if (scanToEnd === true) {
@@ -154950,7 +155163,7 @@ var require_scan2 = __commonJS({
154950
155163
  }
154951
155164
  break;
154952
155165
  }
154953
- if (code === CHAR_LEFT_SQUARE_BRACKET) {
155166
+ if (code2 === CHAR_LEFT_SQUARE_BRACKET) {
154954
155167
  while (eos() !== true && (next = advance())) {
154955
155168
  if (next === CHAR_BACKWARD_SLASH) {
154956
155169
  backslashes = token.backslashes = true;
@@ -154969,21 +155182,21 @@ var require_scan2 = __commonJS({
154969
155182
  }
154970
155183
  break;
154971
155184
  }
154972
- if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index2 === start) {
155185
+ if (opts.nonegate !== true && code2 === CHAR_EXCLAMATION_MARK && index2 === start) {
154973
155186
  negated = token.negated = true;
154974
155187
  start++;
154975
155188
  continue;
154976
155189
  }
154977
- if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
155190
+ if (opts.noparen !== true && code2 === CHAR_LEFT_PARENTHESES) {
154978
155191
  isGlob = token.isGlob = true;
154979
155192
  if (scanToEnd === true) {
154980
- while (eos() !== true && (code = advance())) {
154981
- if (code === CHAR_LEFT_PARENTHESES) {
155193
+ while (eos() !== true && (code2 = advance())) {
155194
+ if (code2 === CHAR_LEFT_PARENTHESES) {
154982
155195
  backslashes = token.backslashes = true;
154983
- code = advance();
155196
+ code2 = advance();
154984
155197
  continue;
154985
155198
  }
154986
- if (code === CHAR_RIGHT_PARENTHESES) {
155199
+ if (code2 === CHAR_RIGHT_PARENTHESES) {
154987
155200
  finished = true;
154988
155201
  break;
154989
155202
  }
@@ -155048,7 +155261,7 @@ var require_scan2 = __commonJS({
155048
155261
  };
155049
155262
  if (opts.tokens === true) {
155050
155263
  state.maxDepth = 0;
155051
- if (!isPathSeparator(code)) {
155264
+ if (!isPathSeparator(code2)) {
155052
155265
  tokens.push(token);
155053
155266
  }
155054
155267
  state.tokens = tokens;
@@ -159587,8 +159800,8 @@ var require_chokidar = __commonJS({
159587
159800
  * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
159588
159801
  */
159589
159802
  _handleError(error48) {
159590
- const code = error48 && error48.code;
159591
- if (error48 && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) {
159803
+ const code2 = error48 && error48.code;
159804
+ if (error48 && code2 !== "ENOENT" && code2 !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code2 !== "EPERM" && code2 !== "EACCES")) {
159592
159805
  this.emit(EV_ERROR, error48);
159593
159806
  }
159594
159807
  return error48 || this.closed;
@@ -160888,6 +161101,9 @@ var searchEntities = /* @__PURE__ */ __name(async (req, res) => {
160888
161101
  res.status(500).json({ message: "Error searching entities", error: error48 });
160889
161102
  }
160890
161103
  }, "searchEntities");
161104
+ var getSearchStatus = /* @__PURE__ */ __name((_req, res) => {
161105
+ res.json({ message: "Success", data: getSearchIndexHealth() });
161106
+ }, "getSearchStatus");
160891
161107
  var suggestSearch = /* @__PURE__ */ __name(async (req, res) => {
160892
161108
  try {
160893
161109
  const q = typeof req.query.q === "string" ? req.query.q : "";
@@ -163560,27 +163776,27 @@ function splitColumnList(inside) {
163560
163776
  return inside.split(",").map((c) => unquoteIdent(c)).filter(Boolean);
163561
163777
  }
163562
163778
  __name(splitColumnList, "splitColumnList");
163563
- function readParenBody(text2, start) {
163779
+ function readParenBody(text3, start) {
163564
163780
  let i = start;
163565
- while (i < text2.length && text2[i] !== "(") i++;
163566
- if (i >= text2.length) return null;
163781
+ while (i < text3.length && text3[i] !== "(") i++;
163782
+ if (i >= text3.length) return null;
163567
163783
  let depth = 0;
163568
163784
  const bodyStart = i + 1;
163569
- for (; i < text2.length; i++) {
163570
- if (text2[i] === "(") depth++;
163571
- else if (text2[i] === ")") {
163785
+ for (; i < text3.length; i++) {
163786
+ if (text3[i] === "(") depth++;
163787
+ else if (text3[i] === ")") {
163572
163788
  depth--;
163573
- if (depth === 0) return { body: text2.slice(bodyStart, i), end: i + 1 };
163789
+ if (depth === 0) return { body: text3.slice(bodyStart, i), end: i + 1 };
163574
163790
  }
163575
163791
  }
163576
163792
  return null;
163577
163793
  }
163578
163794
  __name(readParenBody, "readParenBody");
163579
- function parseReferentialActions(text2) {
163795
+ function parseReferentialActions(text3) {
163580
163796
  const result = {};
163581
163797
  const actionPattern = /ON\s+(DELETE|UPDATE)\s+(CASCADE|SET\s+NULL|SET\s+DEFAULT|RESTRICT|NO\s+ACTION)/gi;
163582
163798
  let m;
163583
- while ((m = actionPattern.exec(text2)) !== null) {
163799
+ while ((m = actionPattern.exec(text3)) !== null) {
163584
163800
  const trigger = m[1].toUpperCase();
163585
163801
  const action = m[2].toUpperCase().replace(/\s+/g, " ");
163586
163802
  if (trigger === "DELETE") result.onDelete = action;
@@ -163699,8 +163915,8 @@ function extractTableComments(sql) {
163699
163915
  let m;
163700
163916
  while ((m = regex.exec(sql)) !== null) {
163701
163917
  const tableName = m[2].toLowerCase();
163702
- const text2 = m[3].replace(/''/g, "'");
163703
- map2.set(tableName, text2);
163918
+ const text3 = m[3].replace(/''/g, "'");
163919
+ map2.set(tableName, text3);
163704
163920
  }
163705
163921
  return map2;
163706
163922
  }
@@ -163712,8 +163928,8 @@ function extractColumnComments(sql) {
163712
163928
  while ((m = regex.exec(sql)) !== null) {
163713
163929
  const tableName = m[2].toLowerCase();
163714
163930
  const colName = m[3].toLowerCase();
163715
- const text2 = m[4].replace(/''/g, "'");
163716
- map2.set(`${tableName}.${colName}`, text2);
163931
+ const text3 = m[4].replace(/''/g, "'");
163932
+ map2.set(`${tableName}.${colName}`, text3);
163717
163933
  }
163718
163934
  return map2;
163719
163935
  }
@@ -166672,7 +166888,7 @@ function registerSearchAgentTools() {
166672
166888
  registerAgentTool({
166673
166889
  name: "searchModel",
166674
166890
  category: "read",
166675
- description: `Full-text search across the whole data dictionary \u2014 entities, attributes, packages, relationships, rules, entity metadata and cases. Fuzzy + prefix matching (e.g. "iban", "order tot", "payment"). Use this to LOCATE elements when you don't already know the exact package/entity name; then call getEntityDetails for the full definition. Returns ranked hits with the owning package and entity.`,
166891
+ description: `Full-text search across the whole data dictionary \u2014 entities, attributes, packages, relationships, rules, entity metadata and cases. Ranked prefix matching supports queries such as "iban", "order tot", and "payment". Use this to LOCATE elements when you don't already know the exact package/entity name; then call getEntityDetails for the full definition. Returns ranked hits with the owning package and entity.`,
166676
166892
  jsonSchema: {
166677
166893
  type: "object",
166678
166894
  required: ["query"],
@@ -166692,7 +166908,11 @@ function registerSearchAgentTools() {
166692
166908
  execute: /* @__PURE__ */ __name((args) => {
166693
166909
  const idx = getSearchIndex();
166694
166910
  if (!idx) {
166695
- return { success: false, error: "Search index is not available. Use listEntities / getModelOverview instead." };
166911
+ return {
166912
+ success: false,
166913
+ error: "Search index is not available. Check getSearchIndexStatus, then use narrowly scoped entity tools.",
166914
+ index: getSearchIndexHealth()
166915
+ };
166696
166916
  }
166697
166917
  const query = String(args.query ?? "").trim();
166698
166918
  if (!query) return { success: true, count: 0, results: [] };
@@ -166705,6 +166925,7 @@ function registerSearchAgentTools() {
166705
166925
  return {
166706
166926
  success: true,
166707
166927
  count: hits.length,
166928
+ index: getSearchIndexHealth(),
166708
166929
  results: hits.map((h) => ({
166709
166930
  kind: h.kind,
166710
166931
  name: h.name,
@@ -166716,6 +166937,14 @@ function registerSearchAgentTools() {
166716
166937
  };
166717
166938
  }, "execute")
166718
166939
  });
166940
+ registerAgentTool({
166941
+ name: "getSearchIndexStatus",
166942
+ category: "read",
166943
+ description: "Check whether the full-text model index is ready and how many entities, attributes, packages and other records it contains. Use this when searchModel returns no results unexpectedly or before reviewing a very large project.",
166944
+ jsonSchema: { type: "object", properties: {} },
166945
+ inputSchema: external_exports.object({}),
166946
+ execute: /* @__PURE__ */ __name(() => ({ success: true, ...getSearchIndexHealth() }), "execute")
166947
+ });
166719
166948
  }
166720
166949
  __name(registerSearchAgentTools, "registerSearchAgentTools");
166721
166950
 
@@ -166724,6 +166953,7 @@ registerSearchAgentTools();
166724
166953
  var router24 = (0, import_express25.Router)();
166725
166954
  router24.get("/api/entities/flat", getFlatEntitiesAndAttributes);
166726
166955
  router24.get("/api/search/suggest", suggestSearch);
166956
+ router24.get("/api/search/status", getSearchStatus);
166727
166957
  router24.get("/api/search", searchEntities);
166728
166958
  var search_routes_default = router24;
166729
166959
 
@@ -167312,8 +167542,8 @@ function num(v, d) {
167312
167542
  }
167313
167543
  __name(num, "num");
167314
167544
  function isNotFound2(e) {
167315
- const code = e?.code;
167316
- return code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND";
167545
+ const code2 = e?.code;
167546
+ return code2 === "ERR_MODULE_NOT_FOUND" || code2 === "MODULE_NOT_FOUND";
167317
167547
  }
167318
167548
  __name(isNotFound2, "isNotFound");
167319
167549
  var globalRoot;
@@ -168670,10 +168900,10 @@ function validateAmpersand(xmlData, i) {
168670
168900
  return i;
168671
168901
  }
168672
168902
  __name(validateAmpersand, "validateAmpersand");
168673
- function getErrorObject(code, message, lineNumber) {
168903
+ function getErrorObject(code2, message, lineNumber) {
168674
168904
  return {
168675
168905
  err: {
168676
- code,
168906
+ code: code2,
168677
168907
  msg: message,
168678
168908
  line: lineNumber.line || lineNumber,
168679
168909
  col: lineNumber.col
@@ -173156,12 +173386,12 @@ function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
173156
173386
  let result = "";
173157
173387
  let segmentStart = i;
173158
173388
  for (let index2 = i; index2 < len; index2++) {
173159
- const code = xmlData.charCodeAt(index2);
173389
+ const code2 = xmlData.charCodeAt(index2);
173160
173390
  if (attrBoundary) {
173161
- if (code === attrBoundary) attrBoundary = 0;
173162
- } else if (code === 34 || code === 39) {
173163
- attrBoundary = code;
173164
- } else if (code === closeCode0) {
173391
+ if (code2 === attrBoundary) attrBoundary = 0;
173392
+ } else if (code2 === 34 || code2 === 39) {
173393
+ attrBoundary = code2;
173394
+ } else if (code2 === closeCode0) {
173165
173395
  if (closeCode1 !== -1) {
173166
173396
  if (xmlData.charCodeAt(index2 + 1) === closeCode1) {
173167
173397
  result += xmlData.substring(segmentStart, index2);
@@ -173171,7 +173401,7 @@ function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
173171
173401
  result += xmlData.substring(segmentStart, index2);
173172
173402
  return { data: result, index: index2 };
173173
173403
  }
173174
- } else if (code === 9 && !attrBoundary) {
173404
+ } else if (code2 === 9 && !attrBoundary) {
173175
173405
  result += xmlData.substring(segmentStart, index2) + " ";
173176
173406
  segmentStart = index2 + 1;
173177
173407
  }
@@ -173324,7 +173554,7 @@ function prettify(node, options2, matcher, readonlyMatcher) {
173324
173554
  }
173325
173555
  __name(prettify, "prettify");
173326
173556
  function compress(arr, options2, matcher, readonlyMatcher) {
173327
- let text2;
173557
+ let text3;
173328
173558
  const compressedObj = {};
173329
173559
  for (let i = 0; i < arr.length; i++) {
173330
173560
  const tagObj = arr[i];
@@ -173337,8 +173567,8 @@ function compress(arr, options2, matcher, readonlyMatcher) {
173337
173567
  matcher.push(property, rawAttrs);
173338
173568
  }
173339
173569
  if (property === options2.textNodeName) {
173340
- if (text2 === void 0) text2 = tagObj[property];
173341
- else text2 += "" + tagObj[property];
173570
+ if (text3 === void 0) text3 = tagObj[property];
173571
+ else text3 += "" + tagObj[property];
173342
173572
  } else if (property === void 0) {
173343
173573
  continue;
173344
173574
  } else if (tagObj[property]) {
@@ -173376,9 +173606,9 @@ function compress(arr, options2, matcher, readonlyMatcher) {
173376
173606
  }
173377
173607
  }
173378
173608
  }
173379
- if (typeof text2 === "string") {
173380
- if (text2.length > 0) compressedObj[options2.textNodeName] = text2;
173381
- } else if (text2 !== void 0) compressedObj[options2.textNodeName] = text2;
173609
+ if (typeof text3 === "string") {
173610
+ if (text3.length > 0) compressedObj[options2.textNodeName] = text3;
173611
+ } else if (text3 !== void 0) compressedObj[options2.textNodeName] = text3;
173382
173612
  return compressedObj;
173383
173613
  }
173384
173614
  __name(compress, "compress");
@@ -174369,8 +174599,8 @@ function readConfluence(dir) {
174369
174599
  for (const f of fs9.readdirSync(dir).filter((f2) => f2.endsWith(".md"))) {
174370
174600
  const raw = fs9.readFileSync(path17.join(dir, f), "utf-8");
174371
174601
  const title = raw.match(/^title:\s*"?(.+?)"?\s*$/m)?.[1] ?? f;
174372
- const text2 = raw.replace(/^---[\s\S]*?---\n/, "").trim();
174373
- out.push({ title, text: text2 });
174602
+ const text3 = raw.replace(/^---[\s\S]*?---\n/, "").trim();
174603
+ out.push({ title, text: text3 });
174374
174604
  }
174375
174605
  return out;
174376
174606
  }
@@ -175526,9 +175756,9 @@ var IN_MEMORY_CAPABILITIES = {
175526
175756
 
175527
175757
  // backend/src/storage/contract/errors.ts
175528
175758
  var BackendError = class extends Error {
175529
- constructor(message, code, cause) {
175759
+ constructor(message, code2, cause) {
175530
175760
  super(message);
175531
- this.code = code;
175761
+ this.code = code2;
175532
175762
  this.cause = cause;
175533
175763
  this.name = "BackendError";
175534
175764
  }