@wirecat/tg-cli 0.113.0 → 0.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/bin/tg.js +6 -2
  2. package/dist/bin/tg.js.map +1 -1
  3. package/dist/bundle/{adapter-EQKEFGPB.js → adapter-ODK7R4LY.js} +56 -53
  4. package/dist/bundle/{all-profiles-TTBFF663.js → all-profiles-AQYM65BS.js} +9 -8
  5. package/dist/bundle/{anthropic-XPZS7267.js → anthropic-VBDSVNIM.js} +6 -5
  6. package/dist/bundle/{app-server-ZSZ7KRAY.js → app-server-YOIHLBNS.js} +47 -43
  7. package/dist/bundle/{bot-api-X7BOVNIO.js → bot-api-TRYLGQKK.js} +51 -47
  8. package/dist/bundle/{bot-history-DWIUIPN5.js → bot-history-7DTJLBBJ.js} +18 -16
  9. package/dist/bundle/{bun-ZGZVAJU2.js → bun-XIMM6EHD.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-UN2UJ6SI.js → bun-sqlite-6B3BL5IV.js} +5 -4
  11. package/dist/bundle/{chunk-K3F46QVN.js → chunk-2TC76TLJ.js} +4 -4
  12. package/dist/bundle/{chunk-JRTZ5I6M.js → chunk-5ROWSRK7.js} +2 -2
  13. package/dist/bundle/{chunk-PHYDBR5M.js → chunk-63YKD7YA.js} +2 -2
  14. package/dist/bundle/{chunk-PCRLXJRH.js → chunk-77M3IAVU.js} +193 -129
  15. package/dist/bundle/{chunk-VDATXIO4.js → chunk-A4BQGSKI.js} +9 -9
  16. package/dist/bundle/{chunk-HO53POQG.js → chunk-AICS3TSF.js} +8 -41
  17. package/dist/bundle/{chunk-AVUIWZTP.js → chunk-AVWPMJ6E.js} +2 -2
  18. package/dist/bundle/{chunk-G74QMORP.js → chunk-BEQPZA3S.js} +2 -2
  19. package/dist/bundle/{chunk-JO45BOYE.js → chunk-BIEBJLYO.js} +8 -3
  20. package/dist/bundle/{chunk-J6USEBA6.js → chunk-BPPRR7TV.js} +2200 -945
  21. package/dist/bundle/chunk-CCHHEMPM.js +71 -0
  22. package/dist/bundle/{chunk-T4TTRFP5.js → chunk-CNO3R4O4.js} +10 -8
  23. package/dist/bundle/{chunk-IDUYRTPF.js → chunk-D4E345BC.js} +2 -2
  24. package/dist/bundle/{chunk-OYNSFQ7K.js → chunk-D72URWJE.js} +1 -39
  25. package/dist/bundle/{chunk-T5RM4Y35.js → chunk-DIABP7ZP.js} +3 -3
  26. package/dist/bundle/chunk-EW3XTUPB.js +166 -0
  27. package/dist/bundle/{chunk-KOWQVHXI.js → chunk-GCFU6WBE.js} +3 -3
  28. package/dist/bundle/{chunk-6WJ5M2Q4.js → chunk-GWDMKEDY.js} +4 -4
  29. package/dist/bundle/{chunk-TQ6EA7TB.js → chunk-GX4DMI4H.js} +17 -16
  30. package/dist/bundle/{chunk-KK3JVOOV.js → chunk-HZKWB6WS.js} +36 -35
  31. package/dist/bundle/chunk-ILHTNOIV.js +23 -0
  32. package/dist/bundle/{chunk-JDQSX2JQ.js → chunk-IUDIRZVU.js} +8443 -7398
  33. package/dist/bundle/{chunk-TUD4MU7S.js → chunk-JZXQZW2D.js} +2 -2
  34. package/dist/bundle/{chunk-Q264PYGE.js → chunk-KDOBY524.js} +55 -20
  35. package/dist/bundle/{chunk-OQR442B6.js → chunk-KIZT2MI6.js} +1 -1
  36. package/dist/bundle/chunk-L4CMCC3V.js +34 -0
  37. package/dist/bundle/{chunk-IYKRHDX6.js → chunk-LUIPXRKN.js} +188 -57
  38. package/dist/bundle/{chunk-GX4LRLVD.js → chunk-M7B5IMH3.js} +5103 -937
  39. package/dist/bundle/{chunk-4GLMEES6.js → chunk-MUZ4KYGY.js} +4 -2
  40. package/dist/bundle/{chunk-KQ23JWLJ.js → chunk-NTW5ZE47.js} +164 -276
  41. package/dist/bundle/{chunk-UIVLDKWT.js → chunk-O7CBGHI7.js} +1 -1
  42. package/dist/bundle/{chunk-KVLCIZUK.js → chunk-OMP6ALBT.js} +3 -3
  43. package/dist/bundle/{chunk-VVA4555T.js → chunk-OSP335AJ.js} +8 -8
  44. package/dist/bundle/{chunk-EGR5IJCG.js → chunk-OUX3QMYI.js} +39 -31
  45. package/dist/bundle/{chunk-VDEXNNMH.js → chunk-PEJHI7QO.js} +6 -4
  46. package/dist/bundle/{chunk-6F6K3LWV.js → chunk-PEKTB3FQ.js} +18 -15
  47. package/dist/bundle/{chunk-Z6TRIW2O.js → chunk-POKTQZOM.js} +11 -9
  48. package/dist/bundle/chunk-PQLBPYJR.js +46 -0
  49. package/dist/bundle/{chunk-BI5YJZJB.js → chunk-PZAEI4NM.js} +115 -29
  50. package/dist/bundle/{chunk-HNN7EKIM.js → chunk-QK6VLKG5.js} +338 -169
  51. package/dist/bundle/{chunk-5NF7M4MN.js → chunk-RFRI2HFT.js} +1 -1
  52. package/dist/bundle/{chunk-OC4RRFKH.js → chunk-RHUNMU4Q.js} +6 -6
  53. package/dist/bundle/{chunk-PHPNA2HU.js → chunk-TMATSEP5.js} +14 -12
  54. package/dist/bundle/{chunk-JW7BMJ6O.js → chunk-TQYMLXDS.js} +5 -3
  55. package/dist/bundle/{chunk-MTX5EDYJ.js → chunk-U67TSAAO.js} +1136 -535
  56. package/dist/bundle/{chunk-7IWDS2CM.js → chunk-UBQ3LOF6.js} +4 -4
  57. package/dist/bundle/{chunk-UE75KPAC.js → chunk-UY7GJRGY.js} +4 -4
  58. package/dist/bundle/{chunk-OSBAISA5.js → chunk-VQCWVZWG.js} +8 -13
  59. package/dist/bundle/{chunk-XZ2ZHIAO.js → chunk-VVKEWWSO.js} +1 -1
  60. package/dist/bundle/{chunk-ENXO43TV.js → chunk-WDNNN3J4.js} +8 -8
  61. package/dist/bundle/{chunk-AGUCXSSM.js → chunk-WINKEV4F.js} +7 -20
  62. package/dist/bundle/{chunk-XXNJF3ZM.js → chunk-WMG4IGEB.js} +75 -33
  63. package/dist/bundle/{chunk-6OKGHHRL.js → chunk-WMRFAK5B.js} +35 -35
  64. package/dist/bundle/{chunk-4SQB5VKL.js → chunk-WOQGUIXE.js} +1 -1
  65. package/dist/bundle/{chunk-U3MJQLZQ.js → chunk-XIYRHIBK.js} +13 -13
  66. package/dist/bundle/{chunk-ZID2Y4XU.js → chunk-XY7IGVVS.js} +2 -2
  67. package/dist/bundle/{chunk-3MAYYFKY.js → chunk-Y3AQHPAJ.js} +1 -1
  68. package/dist/bundle/{chunk-WSAHUQ6K.js → chunk-YCUQKFGD.js} +3 -3
  69. package/dist/bundle/command-contract-YF4KGFXC.js +32 -0
  70. package/dist/bundle/{decode-AMQVTEMW.js → decode-2GATBZGH.js} +7 -6
  71. package/dist/bundle/dispatch-MJMW7WDH.js +411 -0
  72. package/dist/bundle/{echarts-ECYONFQJ.js → echarts-GKEZEAL7.js} +2 -2
  73. package/dist/bundle/{embed-VZYBZEWI.js → embed-TBQPLA4Y.js} +6 -5
  74. package/dist/bundle/{embedder-GSWBGHRK.js → embedder-B5DTNCRO.js} +11 -10
  75. package/dist/bundle/entry-A6DEW2TD.js +18 -0
  76. package/dist/bundle/failure-TLF3SISS.js +24 -0
  77. package/dist/bundle/first-run-3N5AABEY.js +27 -0
  78. package/dist/bundle/first-screen-HANARM67.js +30 -0
  79. package/dist/bundle/{instructions-AXLQQS3G.js → instructions-P5E34PQR.js} +1 -1
  80. package/dist/bundle/{mcp-VVMPUDSL.js → mcp-MNI62HHE.js} +5 -3
  81. package/dist/bundle/{node-7JHC5K77.js → node-GKPRXS5Y.js} +2 -2
  82. package/dist/bundle/{node-sqlite-LYJEK46T.js → node-sqlite-GIDPALK3.js} +11 -4
  83. package/dist/bundle/{oauth-BROPKI3K.js → oauth-C57W4IMD.js} +7 -6
  84. package/dist/bundle/{open-C6XQ46JK.js → open-E6Q4WRPU.js} +5 -3
  85. package/dist/bundle/{openai-VWSU7ZDD.js → openai-5WMXY2KP.js} +15 -14
  86. package/dist/bundle/{process-QKEFL5HL.js → process-U2P5Z6UF.js} +1 -1
  87. package/dist/bundle/{program-ACY7O33O.js → program-FEUDU6GF.js} +62 -57
  88. package/dist/bundle/{prompt-EGULVW2F.js → prompt-4NGAZGHE.js} +5 -4
  89. package/dist/bundle/{proxy-transport-KIMADLQ2.js → proxy-transport-MGCJ7JAW.js} +5 -4
  90. package/dist/bundle/{recognize-UMTKLWVR.js → recognize-EUHRBA7V.js} +4 -3
  91. package/dist/bundle/{remote-DABI7PSQ.js → remote-3JHLB2FV.js} +7 -6
  92. package/dist/bundle/{rerank-ZFATWWBE.js → rerank-ZZ45SZPC.js} +7 -6
  93. package/dist/bundle/{serve-B7YYCMGN.js → serve-XOGX5FC5.js} +12 -10
  94. package/dist/bundle/server-DRE5MJ76.js +59 -0
  95. package/dist/bundle/{server-DGKZISZH.js → server-I6O72XP5.js} +36 -34
  96. package/dist/bundle/{state-AQ2PABA5.js → state-BIUYTGH6.js} +6 -5
  97. package/dist/bundle/{store-46GJTFLJ.js → store-FOJFYOMR.js} +12 -10
  98. package/dist/bundle/store-maintenance-command-YKV2C34N.js +49 -0
  99. package/dist/bundle/tg.js +159 -14
  100. package/dist/commands/context.d.ts.map +1 -1
  101. package/dist/commands/context.js +6 -4
  102. package/dist/commands/context.js.map +1 -1
  103. package/dist/reasons.d.ts.map +1 -1
  104. package/dist/reasons.js +5 -0
  105. package/dist/reasons.js.map +1 -1
  106. package/dist/version.d.ts +1 -1
  107. package/dist/version.js +1 -1
  108. package/package.json +5 -4
  109. package/skills/tg-cli/SKILL.md +2 -0
  110. package/dist/bundle/chunk-452UZ2PU.js +0 -3603
  111. package/dist/bundle/command-contract-GV67H22L.js +0 -32
  112. package/dist/bundle/entry-LALZILY4.js +0 -14
  113. package/dist/bundle/first-run-LEAI623Q.js +0 -24
  114. package/dist/bundle/first-screen-MOCVLE23.js +0 -30
  115. package/dist/bundle/identity-54HA5GN6.js +0 -11
  116. package/dist/bundle/server-UC7UWUIS.js +0 -56
  117. package/dist/bundle/store-maintenance-command-FCFKHGRM.js +0 -45
  118. /package/dist/bundle/{chunk-HPXYN7F3.js → chunk-NUN6OGOV.js} +0 -0
@@ -1,20 +1,28 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
- BASE_REASONS,
5
- COMMON_DETAILS,
6
- CRASH_CODE,
7
- CRASH_REASON,
8
- CliError,
9
- LOG_ATTRIBUTE_KEYS,
10
- errorCodes,
4
+ array,
5
+ dottedId,
6
+ duplicates,
7
+ errorObjectOf,
11
8
  getDotPath,
12
- isCliError,
13
- isContentKey,
9
+ isoTime,
10
+ optional,
11
+ parseRegistry,
12
+ picklist,
13
+ pipe,
14
+ record,
15
+ regex,
14
16
  safeParse,
15
- stepOf,
16
- writes
17
- } from "./chunk-PCRLXJRH.js";
17
+ strictObject,
18
+ string,
19
+ text,
20
+ unknown
21
+ } from "./chunk-77M3IAVU.js";
22
+ import {
23
+ CliError,
24
+ visibleControls
25
+ } from "./chunk-CCHHEMPM.js";
18
26
  import {
19
27
  __commonJS,
20
28
  __name,
@@ -68,7 +76,7 @@ var require_strip_ansi = __commonJS({
68
76
  "node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module) {
69
77
  "use strict";
70
78
  var ansiRegex = require_ansi_regex();
71
- module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
79
+ module.exports = (string2) => typeof string2 === "string" ? string2.replace(ansiRegex(), "") : string2;
72
80
  }
73
81
  });
74
82
 
@@ -122,18 +130,18 @@ var require_string_width = __commonJS({
122
130
  var stripAnsi = require_strip_ansi();
123
131
  var isFullwidthCodePoint = require_is_fullwidth_code_point();
124
132
  var emojiRegex = require_emoji_regex();
125
- var stringWidth = /* @__PURE__ */ __name((string) => {
126
- if (typeof string !== "string" || string.length === 0) {
133
+ var stringWidth = /* @__PURE__ */ __name((string2) => {
134
+ if (typeof string2 !== "string" || string2.length === 0) {
127
135
  return 0;
128
136
  }
129
- string = stripAnsi(string);
130
- if (string.length === 0) {
137
+ string2 = stripAnsi(string2);
138
+ if (string2.length === 0) {
131
139
  return 0;
132
140
  }
133
- string = string.replace(emojiRegex(), " ");
141
+ string2 = string2.replace(emojiRegex(), " ");
134
142
  let width = 0;
135
- for (let i = 0; i < string.length; i++) {
136
- const code = string.codePointAt(i);
143
+ for (let i = 0; i < string2.length; i++) {
144
+ const code = string2.codePointAt(i);
137
145
  if (code <= 31 || code >= 127 && code <= 159) {
138
146
  continue;
139
147
  }
@@ -454,11 +462,11 @@ var require_utils = __commonJS({
454
462
  return output;
455
463
  }
456
464
  __name(colorizeLines, "colorizeLines");
457
- function hyperlink(url, text) {
465
+ function hyperlink(url, text2) {
458
466
  const OSC = "\x1B]";
459
467
  const BEL = "\x07";
460
468
  const SEP = ";";
461
- return [OSC, "8", SEP, SEP, url || text, BEL, text, OSC, "8", SEP, SEP, BEL].join("");
469
+ return [OSC, "8", SEP, SEP, url || text2, BEL, text2, OSC, "8", SEP, SEP, BEL].join("");
462
470
  }
463
471
  __name(hyperlink, "hyperlink");
464
472
  module.exports = {
@@ -657,10 +665,10 @@ var require_supports_colors = __commonJS({
657
665
  // node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/trap.js
658
666
  var require_trap = __commonJS({
659
667
  "node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/trap.js"(exports, module) {
660
- module["exports"] = /* @__PURE__ */ __name(function runTheTrap(text, options) {
668
+ module["exports"] = /* @__PURE__ */ __name(function runTheTrap(text2, options) {
661
669
  var result = "";
662
- text = text || "Run the trap, drop the bass";
663
- text = text.split("");
670
+ text2 = text2 || "Run the trap, drop the bass";
671
+ text2 = text2.split("");
664
672
  var trap = {
665
673
  a: ["@", "\u0104", "\u023A", "\u0245", "\u0394", "\u039B", "\u0414"],
666
674
  b: ["\xDF", "\u0181", "\u0243", "\u026E", "\u03B2", "\u0E3F"],
@@ -708,7 +716,7 @@ var require_trap = __commonJS({
708
716
  y: ["\xA5", "\u04B0", "\u04CB"],
709
717
  z: ["\u01B5", "\u0240"]
710
718
  };
711
- text.forEach(function(c) {
719
+ text2.forEach(function(c) {
712
720
  c = c.toLowerCase();
713
721
  var chars = trap[c] || [" "];
714
722
  var rand = Math.floor(Math.random() * chars.length);
@@ -726,8 +734,8 @@ var require_trap = __commonJS({
726
734
  // node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/zalgo.js
727
735
  var require_zalgo = __commonJS({
728
736
  "node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/zalgo.js"(exports, module) {
729
- module["exports"] = /* @__PURE__ */ __name(function zalgo(text, options) {
730
- text = text || " he is here ";
737
+ module["exports"] = /* @__PURE__ */ __name(function zalgo(text2, options) {
738
+ text2 = text2 || " he is here ";
731
739
  var soul = {
732
740
  "up": [
733
741
  "\u030D",
@@ -862,7 +870,7 @@ var require_zalgo = __commonJS({
862
870
  return bool;
863
871
  }
864
872
  __name(isChar, "isChar");
865
- function heComes(text2, options2) {
873
+ function heComes(text3, options2) {
866
874
  var result = "";
867
875
  var counts;
868
876
  var l;
@@ -871,12 +879,12 @@ var require_zalgo = __commonJS({
871
879
  options2["mid"] = typeof options2["mid"] !== "undefined" ? options2["mid"] : true;
872
880
  options2["down"] = typeof options2["down"] !== "undefined" ? options2["down"] : true;
873
881
  options2["size"] = typeof options2["size"] !== "undefined" ? options2["size"] : "maxi";
874
- text2 = text2.split("");
875
- for (l in text2) {
882
+ text3 = text3.split("");
883
+ for (l in text3) {
876
884
  if (isChar(l)) {
877
885
  continue;
878
886
  }
879
- result = result + text2[l];
887
+ result = result + text3[l];
880
888
  counts = { "up": 0, "down": 0, "mid": 0 };
881
889
  switch (options2.size) {
882
890
  case "mini":
@@ -908,7 +916,7 @@ var require_zalgo = __commonJS({
908
916
  return result;
909
917
  }
910
918
  __name(heComes, "heComes");
911
- return heComes(text, options);
919
+ return heComes(text2, options);
912
920
  }, "zalgo");
913
921
  }
914
922
  });
@@ -1822,17 +1830,17 @@ var require_table = __commonJS({
1822
1830
  }
1823
1831
  }
1824
1832
  toString() {
1825
- let array = this;
1833
+ let array2 = this;
1826
1834
  let headersPresent = this.options.head && this.options.head.length;
1827
1835
  if (headersPresent) {
1828
- array = [this.options.head];
1836
+ array2 = [this.options.head];
1829
1837
  if (this.length) {
1830
- array.push.apply(array, this);
1838
+ array2.push.apply(array2, this);
1831
1839
  }
1832
1840
  } else {
1833
1841
  this.options.style.head = [];
1834
1842
  }
1835
- let cells = tableLayout.makeTableLayout(array);
1843
+ let cells = tableLayout.makeTableLayout(array2);
1836
1844
  cells.forEach(function(row) {
1837
1845
  row.forEach(function(cell2) {
1838
1846
  cell2.mergeTableOptions(this.options, cells);
@@ -1887,198 +1895,7 @@ var require_cli_table3 = __commonJS({
1887
1895
  }
1888
1896
  });
1889
1897
 
1890
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
1891
- var EXIT_CODES = {
1892
- validation_error: 2,
1893
- configuration_error: 3,
1894
- authentication_error: 4,
1895
- permission_error: 5,
1896
- not_found: 6,
1897
- confirmation_required: 7,
1898
- rate_limited: 8,
1899
- timeout: 9,
1900
- network_error: 10,
1901
- provider_error: 11,
1902
- provider_unavailable: 12,
1903
- invalid_response: 13,
1904
- outcome_unknown: 14,
1905
- cancelled: 130
1906
- };
1907
- var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
1908
- var GENERIC_FAILURE = 1;
1909
-
1910
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
1911
- var CONTROL = (
1912
- // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
1913
- /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
1914
- );
1915
- var SUBDIVISION_FLAG = /\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}/gu;
1916
- var LINE_BREAKS = /[\t\n\u2028\u2029]/g;
1917
- var escaped = /* @__PURE__ */ __name((c) => {
1918
- const code = c.codePointAt(0) ?? 0;
1919
- if (code > 65535)
1920
- return `\\u{${code.toString(16)}}`;
1921
- return code > 255 ? `\\u${code.toString(16).padStart(4, "0")}` : `\\x${code.toString(16).padStart(2, "0")}`;
1922
- }, "escaped");
1923
- var visibleControls = /* @__PURE__ */ __name((text) => {
1924
- let at = 0;
1925
- let result = "";
1926
- for (const flag of text.matchAll(SUBDIVISION_FLAG)) {
1927
- result += text.slice(at, flag.index).replace(CONTROL, escaped) + flag[0];
1928
- at = flag.index + flag[0].length;
1929
- }
1930
- return result + text.slice(at).replace(CONTROL, escaped);
1931
- }, "visibleControls");
1932
- var singleLine = /* @__PURE__ */ __name((text) => visibleControls(text).replace(LINE_BREAKS, escaped), "singleLine");
1933
-
1934
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
1935
- var recognise = /* @__PURE__ */ __name((failure) => {
1936
- if (isCliError(failure))
1937
- return failure;
1938
- if (!(failure instanceof Error) || failure.name !== "CliError")
1939
- return void 0;
1940
- const { code, details } = failure;
1941
- if (!errorCodes.includes(code))
1942
- return void 0;
1943
- return {
1944
- code,
1945
- message: failure.message,
1946
- details: typeof details === "object" && details !== null ? details : {}
1947
- };
1948
- }, "recognise");
1949
- var reasonFor = /* @__PURE__ */ __name((code, named, reasons) => reasons.find((entry2) => entry2.reason === named && entry2.code === code) ?? BASE_REASONS.find((entry2) => entry2.reason === named && entry2.code === code) ?? // The first base reason for each code is its fallback.
1950
- BASE_REASONS.find((entry2) => entry2.code === code), "reasonFor");
1951
- var nextFor = /* @__PURE__ */ __name((reason, details, context) => {
1952
- const definition = reason.step ? context.steps?.find((step) => step.id === reason.step) : void 0;
1953
- if (!definition)
1954
- return [];
1955
- const known = new Set(definition.kind === "command" ? definition.args.map((arg) => arg.name) : []);
1956
- const args = Object.fromEntries(Object.entries(details).filter(([key, value]) => known.has(key) && value !== void 0));
1957
- try {
1958
- return [stepOf(definition, { args, ...context.targets ? { targets: context.targets } : {} })];
1959
- } catch {
1960
- return [];
1961
- }
1962
- }, "nextFor");
1963
- var TRANSIENT = [
1964
- "rate_limited",
1965
- "timeout",
1966
- "network_error",
1967
- "provider_unavailable"
1968
- ];
1969
- var retryOf = /* @__PURE__ */ __name((code, details, effects) => {
1970
- const transient = details.retryable !== false && (TRANSIENT.includes(code) || code === "provider_error" && details.retryable === true);
1971
- const safe = code !== "outcome_unknown" && transient && (!writes(effects) || details.sent === false);
1972
- const after = details.retry_after_ms;
1973
- return safe && typeof after === "number" && Number.isInteger(after) && after >= 0 ? { safe, after_ms: after } : { safe };
1974
- }, "retryOf");
1975
- var errorObjectOf = /* @__PURE__ */ __name((failure, context = {}) => {
1976
- const reasons = context.reasons ?? [];
1977
- const recognised = recognise(failure);
1978
- if (!recognised) {
1979
- const reason2 = reasonFor(CRASH_CODE, CRASH_REASON, reasons);
1980
- return {
1981
- error: {
1982
- code: CRASH_CODE,
1983
- reason: reason2.reason,
1984
- message: reason2.message,
1985
- retry: { safe: false },
1986
- ...context.runId ? { run_id: context.runId } : {}
1987
- }
1988
- };
1989
- }
1990
- const { code, message, details } = recognised;
1991
- const reason = reasonFor(code, details.reason, reasons);
1992
- const allowed = /* @__PURE__ */ new Set([...COMMON_DETAILS, ...context.details ?? [], ...reason.details]);
1993
- allowed.delete("cause");
1994
- const kept = Object.fromEntries(Object.entries(details).filter(([key, value]) => allowed.has(key) && value !== void 0));
1995
- const next = nextFor(reason, details, context);
1996
- const runId = context.runId ?? (typeof details.run_id === "string" ? details.run_id : void 0);
1997
- return {
1998
- error: {
1999
- code,
2000
- reason: reason.reason,
2001
- message,
2002
- ...typeof details.param === "string" ? { param: details.param } : {},
2003
- ...Object.keys(kept).length > 0 ? { details: kept } : {},
2004
- ...next.length > 0 ? { next } : {},
2005
- retry: retryOf(code, details, context.effects),
2006
- ...runId ? { run_id: runId } : {}
2007
- }
2008
- };
2009
- }, "errorObjectOf");
2010
- var exitCodeOfError = /* @__PURE__ */ __name(({ error }) => error.code === CRASH_CODE ? GENERIC_FAILURE : EXIT_CODES[error.code], "exitCodeOfError");
2011
- var exitCodeOfAnswer = /* @__PURE__ */ __name((meta, partial = false) => {
2012
- if (meta.complete || partial)
2013
- return 0;
2014
- const code = meta.issues?.[0]?.code;
2015
- return code === void 0 ? GENERIC_FAILURE : EXIT_CODES[code];
2016
- }, "exitCodeOfAnswer");
2017
- var kebab = /* @__PURE__ */ __name((name) => name.replaceAll("_", "-"), "kebab");
2018
- var commandLine = /* @__PURE__ */ __name((cli, step) => [
2019
- cli,
2020
- step.command,
2021
- ...Object.entries(step.args).map(([name, value]) => value === true ? `--${kebab(name)}` : `--${kebab(name)} ${JSON.stringify(value)}`)
2022
- ].join(" "), "commandLine");
2023
- var STACK_FRAMES = 10;
2024
- var errorRecordOf = /* @__PURE__ */ __name((failure, object2, options) => {
2025
- const thrown = failure instanceof Error ? failure : void 0;
2026
- const { cause, ...details } = recognise(failure)?.details ?? {};
2027
- const stack = thrown?.stack?.split("\n").slice(1, STACK_FRAMES + 1).map((line) => visibleControls(line.trim()));
2028
- const reason = thrown?.cause ?? cause;
2029
- return {
2030
- time: (options.time ?? /* @__PURE__ */ new Date()).toISOString(),
2031
- severity: "error",
2032
- body: "command.failed",
2033
- ...object2.error.run_id ? { run_id: object2.error.run_id } : {},
2034
- command: options.command,
2035
- attributes: {
2036
- code: object2.error.code,
2037
- reason: object2.error.reason,
2038
- message: object2.error.message,
2039
- ...Object.keys(details).length > 0 ? { details } : {},
2040
- ...thrown ? { name: thrown.name, thrown_message: visibleControls(thrown.message) } : { thrown: String(failure) },
2041
- ...reason === void 0 ? {} : { cause: visibleControls(reason instanceof Error ? reason.message : String(reason)) },
2042
- ...stack && stack.length > 0 ? { stack } : {}
2043
- },
2044
- resource: { service: options.service, version: options.version }
2045
- };
2046
- }, "errorRecordOf");
2047
- var renderError = /* @__PURE__ */ __name((object2, options) => {
2048
- if (!options.interactive)
2049
- return [JSON.stringify(object2), ...options.record ? [JSON.stringify(options.record)] : []].join("\n");
2050
- const { message, next, run_id: runId } = object2.error;
2051
- const step = next?.[0];
2052
- return [
2053
- `\u2717 ${visibleControls(message)}`,
2054
- ...step?.kind === "command" ? [`\u2192 ${visibleControls(step.why)}: ${visibleControls(step.line ?? commandLine(options.cli, step))}`] : step ? [`\u2192 ${visibleControls(step.why)}`] : [],
2055
- ...options.record ? [JSON.stringify(options.record, null, 2)] : runId ? [`details: ${options.cli} runs show ${runId}`] : []
2056
- ].join("\n");
2057
- }, "renderError");
2058
- var mcpErrorResult = /* @__PURE__ */ __name((object2) => ({
2059
- content: [{ type: "text", text: JSON.stringify(object2) }],
2060
- structuredContent: object2,
2061
- isError: true
2062
- }), "mcpErrorResult");
2063
- var catchCrashes = /* @__PURE__ */ __name((options) => {
2064
- const target = options.target ?? process;
2065
- const write = options.write ?? ((text) => process.stderr.write(`${text}
2066
- `));
2067
- const exit = options.exit ?? ((code) => process.exit(code));
2068
- const crashed = /* @__PURE__ */ __name((failure) => {
2069
- const object2 = errorObjectOf(failure, options);
2070
- write(renderError(object2, { cli: options.cli, interactive: options.interactive }));
2071
- exit(exitCodeOfError(object2));
2072
- }, "crashed");
2073
- target.on("uncaughtException", crashed);
2074
- target.on("unhandledRejection", crashed);
2075
- return () => {
2076
- target.off("uncaughtException", crashed);
2077
- target.off("unhandledRejection", crashed);
2078
- };
2079
- }, "catchCrashes");
2080
-
2081
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
1898
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
2082
1899
  var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2083
1900
  if (signal?.aborted)
2084
1901
  return Promise.reject(signal.reason);
@@ -2106,21 +1923,21 @@ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2106
1923
  });
2107
1924
  }, "waitForDrain");
2108
1925
 
2109
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
1926
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
2110
1927
  var processStreams = {
2111
1928
  drain: /* @__PURE__ */ __name(async (signal) => {
2112
1929
  await Promise.all([waitForDrain(process.stdout, signal), waitForDrain(process.stderr, signal)]);
2113
1930
  }, "drain"),
2114
- data: /* @__PURE__ */ __name((text) => {
2115
- process.stdout.write(`${text}
1931
+ data: /* @__PURE__ */ __name((text2) => {
1932
+ process.stdout.write(`${text2}
2116
1933
  `);
2117
1934
  }, "data"),
2118
- diagnostic: /* @__PURE__ */ __name((text) => {
2119
- process.stderr.write(`${text}
1935
+ diagnostic: /* @__PURE__ */ __name((text2) => {
1936
+ process.stderr.write(`${text2}
2120
1937
  `);
2121
1938
  }, "diagnostic"),
2122
- progress: /* @__PURE__ */ __name((text) => {
2123
- process.stderr.write(`\r${text.padEnd(72)}${text === "" ? "\r" : ""}`);
1939
+ progress: /* @__PURE__ */ __name((text2) => {
1940
+ process.stderr.write(`\r${text2.padEnd(72)}${text2 === "" ? "\r" : ""}`);
2124
1941
  }, "progress")
2125
1942
  };
2126
1943
  var captureStreams = /* @__PURE__ */ __name(() => {
@@ -2129,13 +1946,13 @@ var captureStreams = /* @__PURE__ */ __name(() => {
2129
1946
  return {
2130
1947
  stdout,
2131
1948
  stderr,
2132
- data: /* @__PURE__ */ __name((text) => stdout.push(text), "data"),
2133
- diagnostic: /* @__PURE__ */ __name((text) => stderr.push(text), "diagnostic"),
2134
- progress: /* @__PURE__ */ __name((text) => stderr.push(text), "progress")
1949
+ data: /* @__PURE__ */ __name((text2) => stdout.push(text2), "data"),
1950
+ diagnostic: /* @__PURE__ */ __name((text2) => stderr.push(text2), "diagnostic"),
1951
+ progress: /* @__PURE__ */ __name((text2) => stderr.push(text2), "progress")
2135
1952
  };
2136
1953
  }, "captureStreams");
2137
1954
 
2138
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/retry.js
1955
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/retry.js
2139
1956
  var DEFAULT_RETRY = {
2140
1957
  retries: 1,
2141
1958
  baseDelayMs: 250,
@@ -2147,7 +1964,7 @@ var backoffMs = /* @__PURE__ */ __name((attempt, config, random) => {
2147
1964
  return Math.round(random() * ceiling);
2148
1965
  }, "backoffMs");
2149
1966
 
2150
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
1967
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
2151
1968
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
2152
1969
  var validate = /* @__PURE__ */ __name((paths) => {
2153
1970
  if (paths.length === 0 || paths.length > 128 || paths.some((path) => path.length > 256 || !/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(path) || path.split(".").some((part) => forbidden.has(part))))
@@ -2212,14 +2029,14 @@ var projectFields = /* @__PURE__ */ __name((value, fields) => {
2212
2029
  return project(value, fields);
2213
2030
  }, "projectFields");
2214
2031
 
2215
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
2032
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
2216
2033
  var BATCH_LIMITS = Object.freeze({
2217
2034
  requests: 32,
2218
2035
  input_bytes: 262144,
2219
2036
  read_bytes: 67108864,
2220
2037
  output_bytes: 4194304
2221
2038
  });
2222
- var record = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "record");
2039
+ var record2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "record");
2223
2040
  function invalid(message) {
2224
2041
  throw new CliError("validation_error", message);
2225
2042
  }
@@ -2241,14 +2058,14 @@ var prepareBatch = /* @__PURE__ */ __name((input, handlers) => {
2241
2058
  } catch {
2242
2059
  invalid("batch input must be a JSON object with requests");
2243
2060
  }
2244
- if (!record(value) || Object.keys(value).some((key) => key !== "requests") || !Array.isArray(value.requests))
2061
+ if (!record2(value) || Object.keys(value).some((key) => key !== "requests") || !Array.isArray(value.requests))
2245
2062
  invalid("batch input must contain only a requests array");
2246
2063
  const requests = value.requests;
2247
2064
  if (requests.length < 1 || requests.length > BATCH_LIMITS.requests)
2248
2065
  invalid("batch takes 1\u201332 requests");
2249
2066
  const ids = /* @__PURE__ */ new Set();
2250
2067
  return requests.map((request) => {
2251
- if (!record(request) || Object.keys(request).some((key) => !["id", "command", "args"].includes(key)) || typeof request.id !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/.test(request.id) || ids.has(request.id) || !Array.isArray(request.command) || request.command.length < 1 || request.command.length > 8 || request.command.some((word) => typeof word !== "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(word)) || !Array.isArray(request.args) || request.args.length > 128 || request.args.some((arg) => typeof arg !== "string" || arg.includes("\0")))
2068
+ if (!record2(request) || Object.keys(request).some((key) => !["id", "command", "args"].includes(key)) || typeof request.id !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/.test(request.id) || ids.has(request.id) || !Array.isArray(request.command) || request.command.length < 1 || request.command.length > 8 || request.command.some((word) => typeof word !== "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(word)) || !Array.isArray(request.args) || request.args.length > 128 || request.args.some((arg) => typeof arg !== "string" || arg.includes("\0")))
2252
2069
  invalid("each batch request needs a unique id, registered command path and string args array");
2253
2070
  const id = request.id;
2254
2071
  const command = [...request.command];
@@ -2339,7 +2156,7 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
2339
2156
  };
2340
2157
  }, "runBatch");
2341
2158
 
2342
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
2159
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
2343
2160
  import { randomBytes } from "node:crypto";
2344
2161
  import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2345
2162
  import { dirname, join } from "node:path";
@@ -2356,9 +2173,9 @@ var writeSecurely = /* @__PURE__ */ __name((path, contents, mode) => {
2356
2173
  }
2357
2174
  }, "writeSecurely");
2358
2175
  var loadConfigFile = /* @__PURE__ */ __name((path, schema, fallback) => {
2359
- let text;
2176
+ let text2;
2360
2177
  try {
2361
- text = readFileSync(path, "utf8");
2178
+ text2 = readFileSync(path, "utf8");
2362
2179
  } catch (error) {
2363
2180
  if (error.code !== "ENOENT")
2364
2181
  throw error;
@@ -2366,7 +2183,7 @@ var loadConfigFile = /* @__PURE__ */ __name((path, schema, fallback) => {
2366
2183
  }
2367
2184
  let parsed;
2368
2185
  try {
2369
- parsed = JSON.parse(text);
2186
+ parsed = JSON.parse(text2);
2370
2187
  } catch {
2371
2188
  throw new Error(`${path} is not valid JSON`);
2372
2189
  }
@@ -2383,11 +2200,11 @@ var saveConfigFile = /* @__PURE__ */ __name((path, config) => {
2383
2200
  `, 384);
2384
2201
  }, "saveConfigFile");
2385
2202
 
2386
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2203
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2387
2204
  import { readFileSync as readFileSync2 } from "node:fs";
2388
2205
  import { join as join3, resolve } from "node:path";
2389
2206
 
2390
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
2207
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
2391
2208
  import { createRequire } from "node:module";
2392
2209
  var ENTRY_OPTIONS = { linux: { store: "secret-service" } };
2393
2210
  var require2 = createRequire(new URL("keyring.js", import.meta.resolve("@wirecat/cli-base")).href);
@@ -2407,7 +2224,7 @@ var systemKeyring = {
2407
2224
  delete: /* @__PURE__ */ __name((service, account) => entry(service, account).deletePassword(), "delete")
2408
2225
  };
2409
2226
 
2410
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
2227
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
2411
2228
  import { homedir, userInfo } from "node:os";
2412
2229
  import { join as join2, posix, win32 } from "node:path";
2413
2230
  var PATH_KINDS = ["config", "state", "cache"];
@@ -2459,7 +2276,7 @@ var homeIsMoved = /* @__PURE__ */ __name(({ env = process.env, platform = proces
2459
2276
  var isMovedRun = /* @__PURE__ */ __name((options) => pathsAreOverridden(options) || homeIsMoved(options), "isMovedRun");
2460
2277
  var configFilePath = /* @__PURE__ */ __name((configDir, fileName = "config.json") => join2(configDir, fileName), "configFilePath");
2461
2278
 
2462
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2279
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2463
2280
  var movedRunService = /* @__PURE__ */ __name((service, configDir) => `${service}:${resolve(configDir)}`, "movedRunService");
2464
2281
  var warnedRuns = /* @__PURE__ */ new WeakSet();
2465
2282
  var Credentials = class {
@@ -2560,16 +2377,16 @@ var Credentials = class {
2560
2377
  }
2561
2378
  /** `undefined` when the file exists but is not a store: writing would replace what it holds. */
2562
2379
  #readFile() {
2563
- let text;
2380
+ let text2;
2564
2381
  try {
2565
- text = readFileSync2(this.#path(), "utf8");
2382
+ text2 = readFileSync2(this.#path(), "utf8");
2566
2383
  } catch (error) {
2567
2384
  if (error.code === "ENOENT")
2568
2385
  return {};
2569
2386
  return void 0;
2570
2387
  }
2571
2388
  try {
2572
- const parsed = JSON.parse(text);
2389
+ const parsed = JSON.parse(text2);
2573
2390
  return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
2574
2391
  } catch {
2575
2392
  return void 0;
@@ -2594,7 +2411,7 @@ var Credentials = class {
2594
2411
  }
2595
2412
  };
2596
2413
 
2597
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
2414
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
2598
2415
  var abortError = /* @__PURE__ */ __name(() => new DOMException("The operation was aborted.", "AbortError"), "abortError");
2599
2416
  var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, reject) => {
2600
2417
  if (signal?.aborted) {
@@ -2608,8 +2425,88 @@ var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, re
2608
2425
  }, { once: true });
2609
2426
  }), "realSleep");
2610
2427
 
2611
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2428
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2612
2429
  import { appendFileSync } from "node:fs";
2430
+
2431
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
2432
+ var LOG_SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
2433
+ var logRecordSchema = strictObject({
2434
+ time: isoTime,
2435
+ severity: picklist(LOG_SEVERITIES),
2436
+ /** The registered event id, `provider.request.failed`: never a sentence, so never content. */
2437
+ body: string(),
2438
+ run_id: text,
2439
+ /** From an MCP caller's `_meta.traceparent`, when it sent one. */
2440
+ trace_id: optional(pipe(string(), regex(/^[0-9a-f]{32}$/, "32 lower-case hex digits"))),
2441
+ command: string(),
2442
+ attributes: record(string(), unknown()),
2443
+ resource: strictObject({ service: text, version: text })
2444
+ });
2445
+ var logEventSchema = strictObject({
2446
+ id: dottedId,
2447
+ meaning: text,
2448
+ /** Attribute keys every record of this event carries. */
2449
+ keys: array(string())
2450
+ });
2451
+ var defineLogEvents = /* @__PURE__ */ __name((input) => parseRegistry("log events", array(logEventSchema), input, (events) => [
2452
+ ...duplicates(events.map((event) => event.id)).map((id) => `"${id}" is listed twice`),
2453
+ ...events.flatMap((event) => duplicates(event.keys).map((key) => `${event.id}: key "${key}" is listed twice`))
2454
+ ]), "defineLogEvents");
2455
+ var LOG_EVENTS = defineLogEvents([
2456
+ { id: "command.failed", meaning: "a command ended with an error", keys: ["code", "reason"] }
2457
+ ]);
2458
+ var LOG_ATTRIBUTE_KEYS = [
2459
+ "code",
2460
+ "count",
2461
+ "durationMs",
2462
+ "errorClass",
2463
+ "errorCode",
2464
+ "event",
2465
+ "frames",
2466
+ "operation",
2467
+ "outcome",
2468
+ "reason",
2469
+ "status"
2470
+ ];
2471
+ var CONTENT_WORDS = /* @__PURE__ */ new Set([
2472
+ "authorization",
2473
+ "body",
2474
+ "caption",
2475
+ "content",
2476
+ "cookie",
2477
+ "credential",
2478
+ "credentials",
2479
+ "email",
2480
+ "password",
2481
+ "phone",
2482
+ "query",
2483
+ "secret",
2484
+ "text",
2485
+ "title",
2486
+ "token"
2487
+ ]);
2488
+ var CONTENT_LAST_WORDS = /* @__PURE__ */ new Set(["message", "name"]);
2489
+ var wordsOf = /* @__PURE__ */ __name((key) => key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_.-]+/).filter(Boolean).map((word) => word.toLowerCase()), "wordsOf");
2490
+ var isContentKey = /* @__PURE__ */ __name((key) => {
2491
+ const words = wordsOf(key);
2492
+ return words.some((word) => CONTENT_WORDS.has(word)) || CONTENT_LAST_WORDS.has(words.at(-1) ?? "");
2493
+ }, "isContentKey");
2494
+ var TRACEPARENT = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;
2495
+ var traceIdOf = /* @__PURE__ */ __name((traceparent) => {
2496
+ if (typeof traceparent !== "string")
2497
+ return void 0;
2498
+ const match = TRACEPARENT.exec(traceparent.trim());
2499
+ if (!match)
2500
+ return void 0;
2501
+ const [, version, traceId = "", parentId = "", , rest] = match;
2502
+ if (version === "ff" || version === "00" && rest !== void 0)
2503
+ return void 0;
2504
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentId))
2505
+ return void 0;
2506
+ return traceId;
2507
+ }, "traceIdOf");
2508
+
2509
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2613
2510
  var REDACTED_FIELDS = [
2614
2511
  "authorization",
2615
2512
  "Authorization",
@@ -2664,7 +2561,7 @@ var createRecordLog = /* @__PURE__ */ __name(({ to, runId, command, resource, tr
2664
2561
  const at = /* @__PURE__ */ __name((severity) => (
2665
2562
  // A message is a sentence, and a sentence can quote content; the record names its event instead.
2666
2563
  (event, _message) => {
2667
- const record2 = logRecordOf({
2564
+ const record3 = logRecordOf({
2668
2565
  severity,
2669
2566
  event,
2670
2567
  time: now().toISOString(),
@@ -2675,7 +2572,7 @@ var createRecordLog = /* @__PURE__ */ __name(({ to, runId, command, resource, tr
2675
2572
  allow,
2676
2573
  redact
2677
2574
  });
2678
- write(`${JSON.stringify(record2)}
2575
+ write(`${JSON.stringify(record3)}
2679
2576
  `);
2680
2577
  }
2681
2578
  ), "at");
@@ -2703,7 +2600,7 @@ var silent = {
2703
2600
  }, "error")
2704
2601
  };
2705
2602
 
2706
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
2603
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
2707
2604
  var import_cli_table3 = __toESM(require_cli_table3(), 1);
2708
2605
  import { styleText } from "node:util";
2709
2606
  var renderPretty = /* @__PURE__ */ __name((value, options) => {
@@ -2726,8 +2623,8 @@ ${renderFields(rest, paint2)}` : table;
2726
2623
  }
2727
2624
  return renderJson(value);
2728
2625
  }, "renderPretty");
2729
- var indent = /* @__PURE__ */ __name((text, spaces) => text.split("\n").map((line) => line === "" ? line : `${" ".repeat(spaces)}${line}`).join("\n"), "indent");
2730
- var paint = /* @__PURE__ */ __name((format, color) => (text) => color ? styleText(format, text, { validateStream: false }) : text, "paint");
2626
+ var indent = /* @__PURE__ */ __name((text2, spaces) => text2.split("\n").map((line) => line === "" ? line : `${" ".repeat(spaces)}${line}`).join("\n"), "indent");
2627
+ var paint = /* @__PURE__ */ __name((format, color) => (text2) => color ? styleText(format, text2, { validateStream: false }) : text2, "paint");
2731
2628
  var palette = /* @__PURE__ */ __name((color) => ({
2732
2629
  dim: paint("dim", color),
2733
2630
  bold: paint("bold", color),
@@ -2778,7 +2675,7 @@ var BORDERLESS = {
2778
2675
  middle: ""
2779
2676
  };
2780
2677
 
2781
- // node_modules/.pnpm/@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
2678
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
2782
2679
  var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processStreams, quiet = false }) => {
2783
2680
  const mark = /* @__PURE__ */ __name((symbol, message) => format === "pretty" ? `${symbol} ${visibleControls(message)}` : visibleControls(message), "mark");
2784
2681
  const say = /* @__PURE__ */ __name((symbol) => (message) => {
@@ -2816,18 +2713,6 @@ var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processS
2816
2713
  }, "createRenderer");
2817
2714
 
2818
2715
  export {
2819
- EXIT_CODES,
2820
- exitCodeFor,
2821
- GENERIC_FAILURE,
2822
- visibleControls,
2823
- singleLine,
2824
- errorObjectOf,
2825
- exitCodeOfError,
2826
- exitCodeOfAnswer,
2827
- errorRecordOf,
2828
- renderError,
2829
- mcpErrorResult,
2830
- catchCrashes,
2831
2716
  fieldsOf,
2832
2717
  projectFields,
2833
2718
  BATCH_LIMITS,
@@ -2842,6 +2727,9 @@ export {
2842
2727
  configFilePath,
2843
2728
  Credentials,
2844
2729
  realSleep,
2730
+ defineLogEvents,
2731
+ isContentKey,
2732
+ traceIdOf,
2845
2733
  logRecordOf,
2846
2734
  createRecordLog,
2847
2735
  renderPretty,