@wirecat/tg-cli 0.114.0 → 0.116.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 (123) hide show
  1. package/dist/bin/tg.js +2 -2
  2. package/dist/bin/tg.js.map +1 -1
  3. package/dist/bot/transport.d.ts +10 -8
  4. package/dist/bot/transport.d.ts.map +1 -1
  5. package/dist/bot/transport.js +16 -2
  6. package/dist/bot/transport.js.map +1 -1
  7. package/dist/bundle/{adapter-YAEHX3QB.js → adapter-6CLMTQOV.js} +85 -56
  8. package/dist/bundle/{all-profiles-R5CW42HQ.js → all-profiles-R2UZMH24.js} +10 -8
  9. package/dist/bundle/{anthropic-F25RHYV2.js → anthropic-QKIPHV2Z.js} +6 -5
  10. package/dist/bundle/{app-server-FAG6FNXR.js → app-server-AZB2MFK6.js} +47 -43
  11. package/dist/bundle/{bot-api-KOIAXTQR.js → bot-api-2IM243J4.js} +53 -48
  12. package/dist/bundle/{bot-history-PRAOZEWC.js → bot-history-G6CRVCL2.js} +19 -17
  13. package/dist/bundle/{bun-XIMM6EHD.js → bun-JDKPISPX.js} +2 -2
  14. package/dist/bundle/{bun-sqlite-DSUCO4TR.js → bun-sqlite-X5PY5IQT.js} +5 -4
  15. package/dist/bundle/{chunk-CDCBFMEI.js → chunk-42GK3XRS.js} +2 -2
  16. package/dist/bundle/{chunk-YQ64ZNLD.js → chunk-4D5AUWAY.js} +28 -15
  17. package/dist/bundle/{chunk-IN25CJ3D.js → chunk-4IQZRW4O.js} +13 -13
  18. package/dist/bundle/{chunk-Y4LCSCSH.js → chunk-577MFPCP.js} +3 -3
  19. package/dist/bundle/{chunk-O7CBGHI7.js → chunk-5FCONCJO.js} +1 -1
  20. package/dist/bundle/{chunk-CS5DQ6KM.js → chunk-5VFPUOJO.js} +17 -14
  21. package/dist/bundle/{chunk-ZFMOPKPT.js → chunk-5ZIBAYIZ.js} +2 -2
  22. package/dist/bundle/{chunk-EARO464A.js → chunk-76CX2YPT.js} +210 -129
  23. package/dist/bundle/{chunk-E2IRSRTB.js → chunk-B4UOCWM4.js} +4 -2
  24. package/dist/bundle/{chunk-Y3AQHPAJ.js → chunk-BGMV66FC.js} +1 -1
  25. package/dist/bundle/{chunk-LPUFOWL3.js → chunk-D72URWJE.js} +1 -39
  26. package/dist/bundle/{chunk-WOQGUIXE.js → chunk-DP5LRU7K.js} +1 -1
  27. package/dist/bundle/chunk-EB2IULWB.js +72 -0
  28. package/dist/bundle/{chunk-4JOKO4IW.js → chunk-FDI4GOIP.js} +912 -493
  29. package/dist/bundle/{chunk-P4YBABUC.js → chunk-GV7ZJ33M.js} +6 -4
  30. package/dist/bundle/{chunk-C7K7AP6G.js → chunk-H72UEHNG.js} +69 -36
  31. package/dist/bundle/{chunk-2PAKHXIV.js → chunk-HBUJNNZD.js} +35 -35
  32. package/dist/bundle/{chunk-NTF34HJP.js → chunk-HK6SIIGG.js} +3 -3
  33. package/dist/bundle/{chunk-NUVBC3LJ.js → chunk-HLNYJPAB.js} +2 -2
  34. package/dist/bundle/{chunk-WIRDTH3J.js → chunk-HUOXUI2M.js} +22 -22
  35. package/dist/bundle/{chunk-RBC7JQ4Y.js → chunk-I6JF43YP.js} +5 -3
  36. package/dist/bundle/{chunk-OFDMD3YF.js → chunk-IR4S7POE.js} +8 -8
  37. package/dist/bundle/{chunk-3R43O3GG.js → chunk-JFTCOV37.js} +80 -24
  38. package/dist/bundle/{chunk-YPABTT7A.js → chunk-JJMQA272.js} +14 -89
  39. package/dist/bundle/{chunk-DQQEN3X4.js → chunk-K2RYCCTP.js} +4 -4
  40. package/dist/bundle/{chunk-OWHF6BON.js → chunk-K62YATVD.js} +6 -6
  41. package/dist/bundle/{chunk-6SPLZI5P.js → chunk-KA6EGOJY.js} +4 -4
  42. package/dist/bundle/chunk-KV4267S4.js +23 -0
  43. package/dist/bundle/{chunk-AL36NHO6.js → chunk-LFKEKSI5.js} +1043 -307
  44. package/dist/bundle/{chunk-7FOT4XD2.js → chunk-LSKGCJWD.js} +3426 -1298
  45. package/dist/bundle/{chunk-M3IWROIF.js → chunk-LXH3SKY3.js} +10 -8
  46. package/dist/bundle/{chunk-QCXYJKPF.js → chunk-MQ7MCVZV.js} +2 -2
  47. package/dist/bundle/{chunk-EQJG44KE.js → chunk-N42VUNTO.js} +2 -2
  48. package/dist/bundle/{chunk-KIZT2MI6.js → chunk-N6TIFJHW.js} +1 -1
  49. package/dist/bundle/{chunk-MQTTVQ3V.js → chunk-NL3PAFAE.js} +8 -8
  50. package/dist/bundle/{chunk-ULFTCR5W.js → chunk-NUYRMU56.js} +2 -2
  51. package/dist/bundle/{chunk-34USFPBF.js → chunk-OX6EWGSG.js} +185 -291
  52. package/dist/bundle/{chunk-KZQXOZFC.js → chunk-PPLFOIYX.js} +7 -20
  53. package/dist/bundle/{chunk-TTTDZOBW.js → chunk-PPSUA3IZ.js} +3 -3
  54. package/dist/bundle/{chunk-ALHKUQDZ.js → chunk-PXMHBTK3.js} +4 -4
  55. package/dist/bundle/{chunk-VVKEWWSO.js → chunk-QAKL3GXB.js} +1 -1
  56. package/dist/bundle/{chunk-I6BKSGZQ.js → chunk-QGL2UGML.js} +306 -190
  57. package/dist/bundle/{chunk-J5U2HKGZ.js → chunk-QHBVGKC3.js} +51 -30
  58. package/dist/bundle/{chunk-NJ2I4KFZ.js → chunk-R52RMHWF.js} +2 -2
  59. package/dist/bundle/chunk-RSDIPQXP.js +35 -0
  60. package/dist/bundle/{chunk-XDOPONC3.js → chunk-RSNGMNU5.js} +6 -6
  61. package/dist/bundle/{chunk-NKP3RUM4.js → chunk-SD5PUYKF.js} +14 -12
  62. package/dist/bundle/chunk-SKZ2E3WC.js +91 -0
  63. package/dist/bundle/{chunk-HA35XN2Z.js → chunk-T7CDLV33.js} +4 -4
  64. package/dist/bundle/{chunk-C34IDOA5.js → chunk-TZVL4U7U.js} +2 -2
  65. package/dist/bundle/{chunk-3EZ43DAF.js → chunk-UCSFO5GW.js} +3 -3
  66. package/dist/bundle/{chunk-NMVFFWF2.js → chunk-VQPLHOVQ.js} +9 -9
  67. package/dist/bundle/chunk-XBIPSSKI.js +166 -0
  68. package/dist/bundle/{chunk-VHO66SMY.js → chunk-XQUTJITP.js} +59 -57
  69. package/dist/bundle/{chunk-L4CMCC3V.js → chunk-Y6VWGJ4Q.js} +1 -1
  70. package/dist/bundle/{chunk-RFRI2HFT.js → chunk-YLRTLZF6.js} +1 -1
  71. package/dist/bundle/chunk-YPF6OS37.js +46 -0
  72. package/dist/bundle/{chunk-TKNCJMYN.js → chunk-YYKJN6H5.js} +946 -589
  73. package/dist/bundle/{chunk-5HKMEXVQ.js → chunk-ZDIAPICE.js} +4 -4
  74. package/dist/bundle/command-contract-DPXM4SZT.js +33 -0
  75. package/dist/bundle/{decode-7U4SXPAN.js → decode-W6YPTGJA.js} +7 -6
  76. package/dist/bundle/dispatch-H7EFNBEH.js +411 -0
  77. package/dist/bundle/{echarts-GKEZEAL7.js → echarts-YAWDIC5D.js} +2 -2
  78. package/dist/bundle/{embed-IDZDQMSW.js → embed-EN4UTLV5.js} +6 -5
  79. package/dist/bundle/{embedder-RY5R2PGO.js → embedder-HEKHRL7E.js} +11 -10
  80. package/dist/bundle/{entry-P6YZ3ZV6.js → entry-2KB6MTCG.js} +7 -6
  81. package/dist/bundle/failure-3DU3HLBQ.js +24 -0
  82. package/dist/bundle/first-run-LBG26WWO.js +27 -0
  83. package/dist/bundle/first-screen-TGTSLUI6.js +31 -0
  84. package/dist/bundle/{instructions-P5E34PQR.js → instructions-HA62QNPR.js} +1 -1
  85. package/dist/bundle/{mcp-FUSDPAOL.js → mcp-PPVOM4SE.js} +5 -3
  86. package/dist/bundle/{node-GKPRXS5Y.js → node-MZ2VWSQQ.js} +2 -2
  87. package/dist/bundle/{node-sqlite-VUXFVPJ6.js → node-sqlite-KNNS6DCM.js} +6 -5
  88. package/dist/bundle/{oauth-7SQIPMOY.js → oauth-KWUABBSQ.js} +7 -6
  89. package/dist/bundle/{open-W3BN2SIO.js → open-JXMCYCIV.js} +5 -4
  90. package/dist/bundle/{openai-LQTK3ZMC.js → openai-HL3IR4VT.js} +15 -14
  91. package/dist/bundle/{process-U2P5Z6UF.js → process-K2FICLWY.js} +1 -1
  92. package/dist/bundle/{program-DIPSLR6O.js → program-IFOMT4JS.js} +70 -57
  93. package/dist/bundle/{prompt-GESHKSM5.js → prompt-HVD3Q77P.js} +5 -4
  94. package/dist/bundle/{proxy-transport-C2EUUT32.js → proxy-transport-PA5SGMRY.js} +5 -4
  95. package/dist/bundle/{recognize-FEQTIJET.js → recognize-HHLVETKI.js} +4 -3
  96. package/dist/bundle/{remote-UXOPBPKS.js → remote-HUAKXJCS.js} +7 -6
  97. package/dist/bundle/{rerank-L4JM4REK.js → rerank-NWFIV7OF.js} +7 -6
  98. package/dist/bundle/{serve-DDWW44DB.js → serve-ANUKAJJN.js} +10 -9
  99. package/dist/bundle/{server-UTWBIZHB.js → server-7Q7WAOHO.js} +37 -34
  100. package/dist/bundle/server-HCQS4YDQ.js +60 -0
  101. package/dist/bundle/{state-EV7FGEK4.js → state-Y2AJ5XTP.js} +6 -5
  102. package/dist/bundle/{store-EXBUF4OG.js → store-S3IG5KWL.js} +15 -11
  103. package/dist/bundle/store-maintenance-command-V2WC4G6J.js +50 -0
  104. package/dist/bundle/tg.js +159 -14
  105. package/dist/commands/session.d.ts.map +1 -1
  106. package/dist/commands/session.js +7 -0
  107. package/dist/commands/session.js.map +1 -1
  108. package/dist/telegram/login.d.ts +2 -0
  109. package/dist/telegram/login.d.ts.map +1 -1
  110. package/dist/telegram/login.js +31 -2
  111. package/dist/telegram/login.js.map +1 -1
  112. package/dist/version.d.ts +1 -1
  113. package/dist/version.js +1 -1
  114. package/package.json +5 -4
  115. package/skills/tg-cli/SKILL.md +2 -0
  116. package/dist/bundle/chunk-TRRRRGMI.js +0 -18
  117. package/dist/bundle/command-contract-SOTDPG22.js +0 -31
  118. package/dist/bundle/first-run-66KTCVQK.js +0 -24
  119. package/dist/bundle/first-screen-NY46X6QU.js +0 -29
  120. package/dist/bundle/identity-GXVKGCNU.js +0 -11
  121. package/dist/bundle/server-ZI7WDAW6.js +0 -56
  122. package/dist/bundle/store-maintenance-command-UBZE2Z6T.js +0 -46
  123. /package/dist/bundle/{chunk-NUN6OGOV.js → chunk-LU3WKZBA.js} +0 -0
@@ -1,20 +1,29 @@
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
+ object,
11
+ optional,
12
+ parseRegistry,
13
+ picklist,
14
+ pipe,
15
+ record,
16
+ regex,
14
17
  safeParse,
15
- stepOf,
16
- writes
17
- } from "./chunk-EARO464A.js";
18
+ strictObject,
19
+ string,
20
+ text,
21
+ unknown
22
+ } from "./chunk-76CX2YPT.js";
23
+ import {
24
+ CliError,
25
+ visibleControls
26
+ } from "./chunk-EB2IULWB.js";
18
27
  import {
19
28
  __commonJS,
20
29
  __name,
@@ -68,7 +77,7 @@ var require_strip_ansi = __commonJS({
68
77
  "node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module) {
69
78
  "use strict";
70
79
  var ansiRegex = require_ansi_regex();
71
- module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
80
+ module.exports = (string2) => typeof string2 === "string" ? string2.replace(ansiRegex(), "") : string2;
72
81
  }
73
82
  });
74
83
 
@@ -122,18 +131,18 @@ var require_string_width = __commonJS({
122
131
  var stripAnsi = require_strip_ansi();
123
132
  var isFullwidthCodePoint = require_is_fullwidth_code_point();
124
133
  var emojiRegex = require_emoji_regex();
125
- var stringWidth = /* @__PURE__ */ __name((string) => {
126
- if (typeof string !== "string" || string.length === 0) {
134
+ var stringWidth = /* @__PURE__ */ __name((string2) => {
135
+ if (typeof string2 !== "string" || string2.length === 0) {
127
136
  return 0;
128
137
  }
129
- string = stripAnsi(string);
130
- if (string.length === 0) {
138
+ string2 = stripAnsi(string2);
139
+ if (string2.length === 0) {
131
140
  return 0;
132
141
  }
133
- string = string.replace(emojiRegex(), " ");
142
+ string2 = string2.replace(emojiRegex(), " ");
134
143
  let width = 0;
135
- for (let i = 0; i < string.length; i++) {
136
- const code = string.codePointAt(i);
144
+ for (let i = 0; i < string2.length; i++) {
145
+ const code = string2.codePointAt(i);
137
146
  if (code <= 31 || code >= 127 && code <= 159) {
138
147
  continue;
139
148
  }
@@ -454,11 +463,11 @@ var require_utils = __commonJS({
454
463
  return output;
455
464
  }
456
465
  __name(colorizeLines, "colorizeLines");
457
- function hyperlink(url, text) {
466
+ function hyperlink(url, text2) {
458
467
  const OSC = "\x1B]";
459
468
  const BEL = "\x07";
460
469
  const SEP = ";";
461
- return [OSC, "8", SEP, SEP, url || text, BEL, text, OSC, "8", SEP, SEP, BEL].join("");
470
+ return [OSC, "8", SEP, SEP, url || text2, BEL, text2, OSC, "8", SEP, SEP, BEL].join("");
462
471
  }
463
472
  __name(hyperlink, "hyperlink");
464
473
  module.exports = {
@@ -657,10 +666,10 @@ var require_supports_colors = __commonJS({
657
666
  // node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/trap.js
658
667
  var require_trap = __commonJS({
659
668
  "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) {
669
+ module["exports"] = /* @__PURE__ */ __name(function runTheTrap(text2, options) {
661
670
  var result = "";
662
- text = text || "Run the trap, drop the bass";
663
- text = text.split("");
671
+ text2 = text2 || "Run the trap, drop the bass";
672
+ text2 = text2.split("");
664
673
  var trap = {
665
674
  a: ["@", "\u0104", "\u023A", "\u0245", "\u0394", "\u039B", "\u0414"],
666
675
  b: ["\xDF", "\u0181", "\u0243", "\u026E", "\u03B2", "\u0E3F"],
@@ -708,7 +717,7 @@ var require_trap = __commonJS({
708
717
  y: ["\xA5", "\u04B0", "\u04CB"],
709
718
  z: ["\u01B5", "\u0240"]
710
719
  };
711
- text.forEach(function(c) {
720
+ text2.forEach(function(c) {
712
721
  c = c.toLowerCase();
713
722
  var chars = trap[c] || [" "];
714
723
  var rand = Math.floor(Math.random() * chars.length);
@@ -726,8 +735,8 @@ var require_trap = __commonJS({
726
735
  // node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/custom/zalgo.js
727
736
  var require_zalgo = __commonJS({
728
737
  "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 ";
738
+ module["exports"] = /* @__PURE__ */ __name(function zalgo(text2, options) {
739
+ text2 = text2 || " he is here ";
731
740
  var soul = {
732
741
  "up": [
733
742
  "\u030D",
@@ -862,7 +871,7 @@ var require_zalgo = __commonJS({
862
871
  return bool;
863
872
  }
864
873
  __name(isChar, "isChar");
865
- function heComes(text2, options2) {
874
+ function heComes(text3, options2) {
866
875
  var result = "";
867
876
  var counts;
868
877
  var l;
@@ -871,12 +880,12 @@ var require_zalgo = __commonJS({
871
880
  options2["mid"] = typeof options2["mid"] !== "undefined" ? options2["mid"] : true;
872
881
  options2["down"] = typeof options2["down"] !== "undefined" ? options2["down"] : true;
873
882
  options2["size"] = typeof options2["size"] !== "undefined" ? options2["size"] : "maxi";
874
- text2 = text2.split("");
875
- for (l in text2) {
883
+ text3 = text3.split("");
884
+ for (l in text3) {
876
885
  if (isChar(l)) {
877
886
  continue;
878
887
  }
879
- result = result + text2[l];
888
+ result = result + text3[l];
880
889
  counts = { "up": 0, "down": 0, "mid": 0 };
881
890
  switch (options2.size) {
882
891
  case "mini":
@@ -908,7 +917,7 @@ var require_zalgo = __commonJS({
908
917
  return result;
909
918
  }
910
919
  __name(heComes, "heComes");
911
- return heComes(text, options);
920
+ return heComes(text2, options);
912
921
  }, "zalgo");
913
922
  }
914
923
  });
@@ -1822,17 +1831,17 @@ var require_table = __commonJS({
1822
1831
  }
1823
1832
  }
1824
1833
  toString() {
1825
- let array = this;
1834
+ let array2 = this;
1826
1835
  let headersPresent = this.options.head && this.options.head.length;
1827
1836
  if (headersPresent) {
1828
- array = [this.options.head];
1837
+ array2 = [this.options.head];
1829
1838
  if (this.length) {
1830
- array.push.apply(array, this);
1839
+ array2.push.apply(array2, this);
1831
1840
  }
1832
1841
  } else {
1833
1842
  this.options.style.head = [];
1834
1843
  }
1835
- let cells = tableLayout.makeTableLayout(array);
1844
+ let cells = tableLayout.makeTableLayout(array2);
1836
1845
  cells.forEach(function(row) {
1837
1846
  row.forEach(function(cell2) {
1838
1847
  cell2.mergeTableOptions(this.options, cells);
@@ -1887,198 +1896,7 @@ var require_cli_table3 = __commonJS({
1887
1896
  }
1888
1897
  });
1889
1898
 
1890
- // 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/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.75.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.75.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.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
1899
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
1900
  var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2083
1901
  if (signal?.aborted)
2084
1902
  return Promise.reject(signal.reason);
@@ -2106,21 +1924,21 @@ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2106
1924
  });
2107
1925
  }, "waitForDrain");
2108
1926
 
2109
- // 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
1927
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
1928
  var processStreams = {
2111
1929
  drain: /* @__PURE__ */ __name(async (signal) => {
2112
1930
  await Promise.all([waitForDrain(process.stdout, signal), waitForDrain(process.stderr, signal)]);
2113
1931
  }, "drain"),
2114
- data: /* @__PURE__ */ __name((text) => {
2115
- process.stdout.write(`${text}
1932
+ data: /* @__PURE__ */ __name((text2) => {
1933
+ process.stdout.write(`${text2}
2116
1934
  `);
2117
1935
  }, "data"),
2118
- diagnostic: /* @__PURE__ */ __name((text) => {
2119
- process.stderr.write(`${text}
1936
+ diagnostic: /* @__PURE__ */ __name((text2) => {
1937
+ process.stderr.write(`${text2}
2120
1938
  `);
2121
1939
  }, "diagnostic"),
2122
- progress: /* @__PURE__ */ __name((text) => {
2123
- process.stderr.write(`\r${text.padEnd(72)}${text === "" ? "\r" : ""}`);
1940
+ progress: /* @__PURE__ */ __name((text2) => {
1941
+ process.stderr.write(`\r${text2.padEnd(72)}${text2 === "" ? "\r" : ""}`);
2124
1942
  }, "progress")
2125
1943
  };
2126
1944
  var captureStreams = /* @__PURE__ */ __name(() => {
@@ -2129,13 +1947,13 @@ var captureStreams = /* @__PURE__ */ __name(() => {
2129
1947
  return {
2130
1948
  stdout,
2131
1949
  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")
1950
+ data: /* @__PURE__ */ __name((text2) => stdout.push(text2), "data"),
1951
+ diagnostic: /* @__PURE__ */ __name((text2) => stderr.push(text2), "diagnostic"),
1952
+ progress: /* @__PURE__ */ __name((text2) => stderr.push(text2), "progress")
2135
1953
  };
2136
1954
  }, "captureStreams");
2137
1955
 
2138
- // 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
1956
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
1957
  var DEFAULT_RETRY = {
2140
1958
  retries: 1,
2141
1959
  baseDelayMs: 250,
@@ -2147,7 +1965,7 @@ var backoffMs = /* @__PURE__ */ __name((attempt, config, random) => {
2147
1965
  return Math.round(random() * ceiling);
2148
1966
  }, "backoffMs");
2149
1967
 
2150
- // 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
1968
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
1969
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
2152
1970
  var validate = /* @__PURE__ */ __name((paths) => {
2153
1971
  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))))
@@ -2158,14 +1976,14 @@ var fieldsOf = /* @__PURE__ */ __name((value) => {
2158
1976
  validate(paths);
2159
1977
  return [...new Set(paths)];
2160
1978
  }, "fieldsOf");
2161
- var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "object");
1979
+ var object2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "object");
2162
1980
  var retained = /* @__PURE__ */ new Set(["operation_id", "page", "next", "missing", "meta", "coverage"]);
2163
1981
  var itemPaths = /* @__PURE__ */ __name((paths) => paths.map((path) => path.startsWith("items.") ? path.slice(6) : path), "itemPaths");
2164
1982
  var onePaths = /* @__PURE__ */ __name((paths) => paths.map((path) => path.startsWith("item.") ? path.slice(5) : path), "onePaths");
2165
1983
  var select = /* @__PURE__ */ __name((value, paths) => {
2166
1984
  if (Array.isArray(value))
2167
1985
  return value.map((item) => select(item, paths));
2168
- if (!object(value))
1986
+ if (!object2(value))
2169
1987
  return value;
2170
1988
  const result = {};
2171
1989
  const groups = /* @__PURE__ */ new Map();
@@ -2183,9 +2001,9 @@ var select = /* @__PURE__ */ __name((value, paths) => {
2183
2001
  const found = value[key];
2184
2002
  if (children.includes(""))
2185
2003
  result[key] = found;
2186
- else if (object(found) || Array.isArray(found)) {
2004
+ else if (object2(found) || Array.isArray(found)) {
2187
2005
  const selected = select(found, children);
2188
- if (Array.isArray(selected) || object(selected) && Object.keys(selected).length > 0)
2006
+ if (Array.isArray(selected) || object2(selected) && Object.keys(selected).length > 0)
2189
2007
  result[key] = selected;
2190
2008
  }
2191
2009
  }
@@ -2197,29 +2015,29 @@ var select = /* @__PURE__ */ __name((value, paths) => {
2197
2015
  var project = /* @__PURE__ */ __name((value, fields) => {
2198
2016
  if (Array.isArray(value))
2199
2017
  return value.map((item) => select(item, itemPaths(fields)));
2200
- if (object(value) && Object.hasOwn(value, "type") && value.type === "item" && Object.hasOwn(value, "data") && Object.keys(value).every((key) => ["type", "data"].includes(key)))
2018
+ if (object2(value) && Object.hasOwn(value, "type") && value.type === "item" && Object.hasOwn(value, "data") && Object.keys(value).every((key) => ["type", "data"].includes(key)))
2201
2019
  return { ...value, data: project(value.data, fields) };
2202
- if (object(value) && Object.hasOwn(value, "type") && value.type === "end" && Object.hasOwn(value, "complete") && typeof value.complete === "boolean")
2020
+ if (object2(value) && Object.hasOwn(value, "type") && value.type === "end" && Object.hasOwn(value, "complete") && typeof value.complete === "boolean")
2203
2021
  return value;
2204
- if (object(value) && Object.hasOwn(value, "item") && (Object.hasOwn(value, "meta") || Object.keys(value).every((key) => ["item", "next", "missing"].includes(key))))
2022
+ if (object2(value) && Object.hasOwn(value, "item") && (Object.hasOwn(value, "meta") || Object.keys(value).every((key) => ["item", "next", "missing"].includes(key))))
2205
2023
  return { ...value, item: project(value.item, onePaths(fields)) };
2206
- if (object(value) && Array.isArray(value.items))
2024
+ if (object2(value) && Array.isArray(value.items))
2207
2025
  return { ...value, items: value.items.map((item) => select(item, itemPaths(fields))) };
2208
- return select(value, object(value) && !Object.hasOwn(value, "items") ? itemPaths(fields) : fields);
2026
+ return select(value, object2(value) && !Object.hasOwn(value, "items") ? itemPaths(fields) : fields);
2209
2027
  }, "project");
2210
2028
  var projectFields = /* @__PURE__ */ __name((value, fields) => {
2211
2029
  validate(fields);
2212
2030
  return project(value, fields);
2213
2031
  }, "projectFields");
2214
2032
 
2215
- // 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
2033
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2034
  var BATCH_LIMITS = Object.freeze({
2217
2035
  requests: 32,
2218
2036
  input_bytes: 262144,
2219
2037
  read_bytes: 67108864,
2220
2038
  output_bytes: 4194304
2221
2039
  });
2222
- var record = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "record");
2040
+ var record2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "record");
2223
2041
  function invalid(message) {
2224
2042
  throw new CliError("validation_error", message);
2225
2043
  }
@@ -2241,14 +2059,14 @@ var prepareBatch = /* @__PURE__ */ __name((input, handlers) => {
2241
2059
  } catch {
2242
2060
  invalid("batch input must be a JSON object with requests");
2243
2061
  }
2244
- if (!record(value) || Object.keys(value).some((key) => key !== "requests") || !Array.isArray(value.requests))
2062
+ if (!record2(value) || Object.keys(value).some((key) => key !== "requests") || !Array.isArray(value.requests))
2245
2063
  invalid("batch input must contain only a requests array");
2246
2064
  const requests = value.requests;
2247
2065
  if (requests.length < 1 || requests.length > BATCH_LIMITS.requests)
2248
2066
  invalid("batch takes 1\u201332 requests");
2249
2067
  const ids = /* @__PURE__ */ new Set();
2250
2068
  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")))
2069
+ 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
2070
  invalid("each batch request needs a unique id, registered command path and string args array");
2253
2071
  const id = request.id;
2254
2072
  const command = [...request.command];
@@ -2270,10 +2088,10 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
2270
2088
  if (maxOutputBytes < 8192 + requests.length * 2048)
2271
2089
  invalid("batch output budget cannot hold its result framing");
2272
2090
  const errorOf = /* @__PURE__ */ __name((error) => {
2273
- const object2 = errorObjectOf(error, options.failureContext).error;
2091
+ const object3 = errorObjectOf(error, options.failureContext).error;
2274
2092
  try {
2275
- if (Buffer.byteLength(JSON.stringify(object2), "utf8") <= 512)
2276
- return object2;
2093
+ if (Buffer.byteLength(JSON.stringify(object3), "utf8") <= 512)
2094
+ return object3;
2277
2095
  } catch {
2278
2096
  }
2279
2097
  const fallback = errorObjectOf(error).error;
@@ -2318,11 +2136,11 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
2318
2136
  }
2319
2137
  } catch (error) {
2320
2138
  options.signal?.throwIfAborted();
2321
- const object2 = errorOf(error);
2139
+ const object3 = errorOf(error);
2322
2140
  result = {
2323
2141
  ...framing,
2324
- status: object2.reason === "batch.read-budget" ? "not_run" : "error",
2325
- error: object2,
2142
+ status: object3.reason === "batch.read-budget" ? "not_run" : "error",
2143
+ error: object3,
2326
2144
  complete: false
2327
2145
  };
2328
2146
  }
@@ -2339,7 +2157,7 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
2339
2157
  };
2340
2158
  }, "runBatch");
2341
2159
 
2342
- // 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
2160
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2161
  import { randomBytes } from "node:crypto";
2344
2162
  import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2345
2163
  import { dirname, join } from "node:path";
@@ -2356,9 +2174,9 @@ var writeSecurely = /* @__PURE__ */ __name((path, contents, mode) => {
2356
2174
  }
2357
2175
  }, "writeSecurely");
2358
2176
  var loadConfigFile = /* @__PURE__ */ __name((path, schema, fallback) => {
2359
- let text;
2177
+ let text2;
2360
2178
  try {
2361
- text = readFileSync(path, "utf8");
2179
+ text2 = readFileSync(path, "utf8");
2362
2180
  } catch (error) {
2363
2181
  if (error.code !== "ENOENT")
2364
2182
  throw error;
@@ -2366,7 +2184,7 @@ var loadConfigFile = /* @__PURE__ */ __name((path, schema, fallback) => {
2366
2184
  }
2367
2185
  let parsed;
2368
2186
  try {
2369
- parsed = JSON.parse(text);
2187
+ parsed = JSON.parse(text2);
2370
2188
  } catch {
2371
2189
  throw new Error(`${path} is not valid JSON`);
2372
2190
  }
@@ -2383,11 +2201,16 @@ var saveConfigFile = /* @__PURE__ */ __name((path, config) => {
2383
2201
  `, 384);
2384
2202
  }, "saveConfigFile");
2385
2203
 
2386
- // 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
2204
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/constants.js
2205
+ var BASE_CONSTANTS = new URL("../constants.json", new URL("constants.js", import.meta.resolve("@wirecat/cli-base")).href);
2206
+ var baseConstantsSchema = object({});
2207
+ var LayerSchema = record(string(), unknown());
2208
+
2209
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2210
  import { readFileSync as readFileSync2 } from "node:fs";
2388
2211
  import { join as join3, resolve } from "node:path";
2389
2212
 
2390
- // 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
2213
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2214
  import { createRequire } from "node:module";
2392
2215
  var ENTRY_OPTIONS = { linux: { store: "secret-service" } };
2393
2216
  var require2 = createRequire(new URL("keyring.js", import.meta.resolve("@wirecat/cli-base")).href);
@@ -2407,7 +2230,7 @@ var systemKeyring = {
2407
2230
  delete: /* @__PURE__ */ __name((service, account) => entry(service, account).deletePassword(), "delete")
2408
2231
  };
2409
2232
 
2410
- // 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
2233
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2234
  import { homedir, userInfo } from "node:os";
2412
2235
  import { join as join2, posix, win32 } from "node:path";
2413
2236
  var PATH_KINDS = ["config", "state", "cache"];
@@ -2459,7 +2282,7 @@ var homeIsMoved = /* @__PURE__ */ __name(({ env = process.env, platform = proces
2459
2282
  var isMovedRun = /* @__PURE__ */ __name((options) => pathsAreOverridden(options) || homeIsMoved(options), "isMovedRun");
2460
2283
  var configFilePath = /* @__PURE__ */ __name((configDir, fileName = "config.json") => join2(configDir, fileName), "configFilePath");
2461
2284
 
2462
- // 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
2285
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2286
  var movedRunService = /* @__PURE__ */ __name((service, configDir) => `${service}:${resolve(configDir)}`, "movedRunService");
2464
2287
  var warnedRuns = /* @__PURE__ */ new WeakSet();
2465
2288
  var Credentials = class {
@@ -2560,16 +2383,16 @@ var Credentials = class {
2560
2383
  }
2561
2384
  /** `undefined` when the file exists but is not a store: writing would replace what it holds. */
2562
2385
  #readFile() {
2563
- let text;
2386
+ let text2;
2564
2387
  try {
2565
- text = readFileSync2(this.#path(), "utf8");
2388
+ text2 = readFileSync2(this.#path(), "utf8");
2566
2389
  } catch (error) {
2567
2390
  if (error.code === "ENOENT")
2568
2391
  return {};
2569
2392
  return void 0;
2570
2393
  }
2571
2394
  try {
2572
- const parsed = JSON.parse(text);
2395
+ const parsed = JSON.parse(text2);
2573
2396
  return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
2574
2397
  } catch {
2575
2398
  return void 0;
@@ -2594,7 +2417,7 @@ var Credentials = class {
2594
2417
  }
2595
2418
  };
2596
2419
 
2597
- // 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
2420
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2421
  var abortError = /* @__PURE__ */ __name(() => new DOMException("The operation was aborted.", "AbortError"), "abortError");
2599
2422
  var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, reject) => {
2600
2423
  if (signal?.aborted) {
@@ -2608,8 +2431,88 @@ var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, re
2608
2431
  }, { once: true });
2609
2432
  }), "realSleep");
2610
2433
 
2611
- // 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
2434
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2435
  import { appendFileSync } from "node:fs";
2436
+
2437
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2438
+ var LOG_SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
2439
+ var logRecordSchema = strictObject({
2440
+ time: isoTime,
2441
+ severity: picklist(LOG_SEVERITIES),
2442
+ /** The registered event id, `provider.request.failed`: never a sentence, so never content. */
2443
+ body: string(),
2444
+ run_id: text,
2445
+ /** From an MCP caller's `_meta.traceparent`, when it sent one. */
2446
+ trace_id: optional(pipe(string(), regex(/^[0-9a-f]{32}$/, "32 lower-case hex digits"))),
2447
+ command: string(),
2448
+ attributes: record(string(), unknown()),
2449
+ resource: strictObject({ service: text, version: text })
2450
+ });
2451
+ var logEventSchema = strictObject({
2452
+ id: dottedId,
2453
+ meaning: text,
2454
+ /** Attribute keys every record of this event carries. */
2455
+ keys: array(string())
2456
+ });
2457
+ var defineLogEvents = /* @__PURE__ */ __name((input) => parseRegistry("log events", array(logEventSchema), input, (events) => [
2458
+ ...duplicates(events.map((event) => event.id)).map((id) => `"${id}" is listed twice`),
2459
+ ...events.flatMap((event) => duplicates(event.keys).map((key) => `${event.id}: key "${key}" is listed twice`))
2460
+ ]), "defineLogEvents");
2461
+ var LOG_EVENTS = defineLogEvents([
2462
+ { id: "command.failed", meaning: "a command ended with an error", keys: ["code", "reason"] }
2463
+ ]);
2464
+ var LOG_ATTRIBUTE_KEYS = [
2465
+ "code",
2466
+ "count",
2467
+ "durationMs",
2468
+ "errorClass",
2469
+ "errorCode",
2470
+ "event",
2471
+ "frames",
2472
+ "operation",
2473
+ "outcome",
2474
+ "reason",
2475
+ "status"
2476
+ ];
2477
+ var CONTENT_WORDS = /* @__PURE__ */ new Set([
2478
+ "authorization",
2479
+ "body",
2480
+ "caption",
2481
+ "content",
2482
+ "cookie",
2483
+ "credential",
2484
+ "credentials",
2485
+ "email",
2486
+ "password",
2487
+ "phone",
2488
+ "query",
2489
+ "secret",
2490
+ "text",
2491
+ "title",
2492
+ "token"
2493
+ ]);
2494
+ var CONTENT_LAST_WORDS = /* @__PURE__ */ new Set(["message", "name"]);
2495
+ var wordsOf = /* @__PURE__ */ __name((key) => key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_.-]+/).filter(Boolean).map((word) => word.toLowerCase()), "wordsOf");
2496
+ var isContentKey = /* @__PURE__ */ __name((key) => {
2497
+ const words = wordsOf(key);
2498
+ return words.some((word) => CONTENT_WORDS.has(word)) || CONTENT_LAST_WORDS.has(words.at(-1) ?? "");
2499
+ }, "isContentKey");
2500
+ var TRACEPARENT = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;
2501
+ var traceIdOf = /* @__PURE__ */ __name((traceparent) => {
2502
+ if (typeof traceparent !== "string")
2503
+ return void 0;
2504
+ const match = TRACEPARENT.exec(traceparent.trim());
2505
+ if (!match)
2506
+ return void 0;
2507
+ const [, version, traceId = "", parentId = "", , rest] = match;
2508
+ if (version === "ff" || version === "00" && rest !== void 0)
2509
+ return void 0;
2510
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentId))
2511
+ return void 0;
2512
+ return traceId;
2513
+ }, "traceIdOf");
2514
+
2515
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2516
  var REDACTED_FIELDS = [
2614
2517
  "authorization",
2615
2518
  "Authorization",
@@ -2664,7 +2567,7 @@ var createRecordLog = /* @__PURE__ */ __name(({ to, runId, command, resource, tr
2664
2567
  const at = /* @__PURE__ */ __name((severity) => (
2665
2568
  // A message is a sentence, and a sentence can quote content; the record names its event instead.
2666
2569
  (event, _message) => {
2667
- const record2 = logRecordOf({
2570
+ const record3 = logRecordOf({
2668
2571
  severity,
2669
2572
  event,
2670
2573
  time: now().toISOString(),
@@ -2675,7 +2578,7 @@ var createRecordLog = /* @__PURE__ */ __name(({ to, runId, command, resource, tr
2675
2578
  allow,
2676
2579
  redact
2677
2580
  });
2678
- write(`${JSON.stringify(record2)}
2581
+ write(`${JSON.stringify(record3)}
2679
2582
  `);
2680
2583
  }
2681
2584
  ), "at");
@@ -2703,7 +2606,7 @@ var silent = {
2703
2606
  }, "error")
2704
2607
  };
2705
2608
 
2706
- // 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
2609
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2610
  var import_cli_table3 = __toESM(require_cli_table3(), 1);
2708
2611
  import { styleText } from "node:util";
2709
2612
  var renderPretty = /* @__PURE__ */ __name((value, options) => {
@@ -2726,8 +2629,8 @@ ${renderFields(rest, paint2)}` : table;
2726
2629
  }
2727
2630
  return renderJson(value);
2728
2631
  }, "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");
2632
+ var indent = /* @__PURE__ */ __name((text2, spaces) => text2.split("\n").map((line) => line === "" ? line : `${" ".repeat(spaces)}${line}`).join("\n"), "indent");
2633
+ var paint = /* @__PURE__ */ __name((format, color) => (text2) => color ? styleText(format, text2, { validateStream: false }) : text2, "paint");
2731
2634
  var palette = /* @__PURE__ */ __name((color) => ({
2732
2635
  dim: paint("dim", color),
2733
2636
  bold: paint("bold", color),
@@ -2778,7 +2681,7 @@ var BORDERLESS = {
2778
2681
  middle: ""
2779
2682
  };
2780
2683
 
2781
- // 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
2684
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_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
2685
  var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processStreams, quiet = false }) => {
2783
2686
  const mark = /* @__PURE__ */ __name((symbol, message) => format === "pretty" ? `${symbol} ${visibleControls(message)}` : visibleControls(message), "mark");
2784
2687
  const say = /* @__PURE__ */ __name((symbol) => (message) => {
@@ -2816,18 +2719,6 @@ var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processS
2816
2719
  }, "createRenderer");
2817
2720
 
2818
2721
  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
2722
  fieldsOf,
2832
2723
  projectFields,
2833
2724
  BATCH_LIMITS,
@@ -2842,6 +2733,9 @@ export {
2842
2733
  configFilePath,
2843
2734
  Credentials,
2844
2735
  realSleep,
2736
+ defineLogEvents,
2737
+ isContentKey,
2738
+ traceIdOf,
2845
2739
  logRecordOf,
2846
2740
  createRecordLog,
2847
2741
  renderPretty,