@wirecat/tg-cli 0.122.0 → 0.124.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 (132) hide show
  1. package/contracts/wirecat.json +62 -4
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-ZI57T2L5.js → adapter-GEIZVMWU.js} +55 -53
  4. package/dist/bundle/{all-profiles-7VXJF42C.js → all-profiles-EY4GJFWN.js} +10 -10
  5. package/dist/bundle/{anthropic-DKRXIWVV.js → anthropic-RIANJ7WM.js} +17 -10
  6. package/dist/bundle/{app-server-F5MKHZ7S.js → app-server-LW7WBFIF.js} +62 -52
  7. package/dist/bundle/{bot-api-F24NWJT3.js → bot-api-FHIQ66OM.js} +54 -52
  8. package/dist/bundle/{bot-history-U3WM3A7S.js → bot-history-O34YZEFH.js} +18 -18
  9. package/dist/bundle/{bun-OMTJAXGK.js → bun-MJWD4VGV.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-HSYLO46A.js → bun-sqlite-LCHVO3OB.js} +9 -5
  11. package/dist/bundle/{chunk-DCGGZUNJ.js → chunk-2GFGZDWS.js} +2 -2
  12. package/dist/bundle/{chunk-7FWU4RON.js → chunk-2NG4JPP7.js} +4 -4
  13. package/dist/bundle/{chunk-UGEYQWEO.js → chunk-2YLIVDWJ.js} +2 -2
  14. package/dist/bundle/chunk-3PLMMFP6.js +1068 -0
  15. package/dist/bundle/{chunk-27SVHRHV.js → chunk-3VVZFBE2.js} +23 -4
  16. package/dist/bundle/{chunk-FYHFAOPM.js → chunk-42R4YO4L.js} +12064 -9579
  17. package/dist/bundle/{chunk-U6HEZPCR.js → chunk-4CIVGT4P.js} +57 -28
  18. package/dist/bundle/{chunk-CB6AHU6H.js → chunk-4EGB7GSW.js} +96 -19
  19. package/dist/bundle/chunk-54JPEGQA.js +71 -0
  20. package/dist/bundle/chunk-5EL6E6PW.js +13 -0
  21. package/dist/bundle/{chunk-QROAXWDU.js → chunk-7AWJZ6NJ.js} +8 -8
  22. package/dist/bundle/{chunk-2UHANFLM.js → chunk-A5RWKKBZ.js} +3 -3
  23. package/dist/bundle/{chunk-7I6YVQHW.js → chunk-ASEBKZFY.js} +2 -2
  24. package/dist/bundle/{chunk-SODUFMDW.js → chunk-BV3HZYOX.js} +7435 -6559
  25. package/dist/bundle/{chunk-FHWUOFWX.js → chunk-CDSSKK5J.js} +3 -3
  26. package/dist/bundle/{chunk-6LMEIELG.js → chunk-DFSLHF46.js} +1 -1
  27. package/dist/bundle/{chunk-Y74WJL3M.js → chunk-E66JBGZZ.js} +6 -6
  28. package/dist/bundle/{chunk-VUBZFMGP.js → chunk-E6VSARSU.js} +2 -2
  29. package/dist/bundle/{chunk-MFWWZ6XL.js → chunk-F3GHTPAO.js} +4 -4
  30. package/dist/bundle/{chunk-NU4RMUMQ.js → chunk-GUL6QLNI.js} +40 -21
  31. package/dist/bundle/{chunk-E3MFMMVY.js → chunk-HEV23NIB.js} +6 -6
  32. package/dist/bundle/{chunk-FZKHFTKH.js → chunk-HSRO77SW.js} +35 -29
  33. package/dist/bundle/{chunk-FATTEYZH.js → chunk-I4JUKRW7.js} +2 -2
  34. package/dist/bundle/{chunk-YDMKP7PO.js → chunk-IK6XKMLL.js} +1 -1
  35. package/dist/bundle/{chunk-DDSAJKPO.js → chunk-ISGXVFA4.js} +4 -4
  36. package/dist/bundle/chunk-IVFUSI7G.js +53 -0
  37. package/dist/bundle/{chunk-DTTONQW7.js → chunk-KVJSCJGZ.js} +2 -2
  38. package/dist/bundle/{chunk-NE3EGYPD.js → chunk-LKMZ53GC.js} +4 -7
  39. package/dist/bundle/{chunk-YFEH7OWG.js → chunk-M4W4Y5YR.js} +132 -40
  40. package/dist/bundle/{chunk-R2IW6JBV.js → chunk-N5UM63JW.js} +343 -112
  41. package/dist/bundle/{chunk-V4BPS7MH.js → chunk-NL4COYPY.js} +9 -9
  42. package/dist/bundle/{chunk-ZNPRTCUO.js → chunk-NQXVZ5WT.js} +15 -117
  43. package/dist/bundle/{chunk-4MFMUBHH.js → chunk-OH3IZ6GW.js} +2395 -2369
  44. package/dist/bundle/{chunk-RX5CJ55S.js → chunk-OIF4B526.js} +1 -1
  45. package/dist/bundle/{chunk-4W4EVVL4.js → chunk-OK4M4MWI.js} +4 -4
  46. package/dist/bundle/{chunk-W34QQMBK.js → chunk-OVDB5CQM.js} +1 -1
  47. package/dist/bundle/{chunk-7GCVON7M.js → chunk-PI4XXMPG.js} +6 -6
  48. package/dist/bundle/{chunk-MCPOZNWG.js → chunk-PJGOQSE5.js} +1 -1
  49. package/dist/bundle/{chunk-D3ODL4P7.js → chunk-PP4ZBLS4.js} +69 -6
  50. package/dist/bundle/{chunk-LVGX7VTD.js → chunk-PZ6H65D6.js} +4 -4
  51. package/dist/bundle/{chunk-ARKB3M5X.js → chunk-QFV36CAH.js} +4 -4
  52. package/dist/bundle/{chunk-7X6YLKTK.js → chunk-QGCVQRHV.js} +1 -1
  53. package/dist/bundle/{chunk-O5A4IS2D.js → chunk-QK4T3VN7.js} +1 -1
  54. package/dist/bundle/{chunk-VC6J7X76.js → chunk-QWAMX6CN.js} +12 -12
  55. package/dist/bundle/{chunk-ALW7ROTM.js → chunk-RBV4M2TC.js} +1 -1
  56. package/dist/bundle/{chunk-GJBGZQHN.js → chunk-RHJHOOUL.js} +354 -184
  57. package/dist/bundle/{chunk-4N2WJYLE.js → chunk-SGBH3D5D.js} +3 -3
  58. package/dist/bundle/{chunk-N7WDVH2O.js → chunk-UII3D3HR.js} +51 -51
  59. package/dist/bundle/{chunk-HAR76KJG.js → chunk-UP3J3YXH.js} +6 -6
  60. package/dist/bundle/{chunk-WGGSFGNZ.js → chunk-UR62DZ7Q.js} +48 -9
  61. package/dist/bundle/{chunk-RFFU6KQ5.js → chunk-VAKSXD4F.js} +13 -13
  62. package/dist/bundle/{chunk-TKJZENAZ.js → chunk-VGUWIHXD.js} +1 -1
  63. package/dist/bundle/chunk-VIIIC5LU.js +32 -0
  64. package/dist/bundle/{chunk-VDFEWSCS.js → chunk-VMWJGUVV.js} +14 -5
  65. package/dist/bundle/{chunk-C5CB6RIX.js → chunk-W4LMTNN2.js} +2 -2
  66. package/dist/bundle/{chunk-33ELXJRR.js → chunk-WKOVQ4OU.js} +14 -12
  67. package/dist/bundle/{chunk-6DLRATDC.js → chunk-WSLIXJET.js} +3817 -3378
  68. package/dist/bundle/{chunk-LQRZUNYF.js → chunk-XDHGM2Z7.js} +3 -3
  69. package/dist/bundle/{chunk-7DPWVKYS.js → chunk-XSGUG5WG.js} +4 -4
  70. package/dist/bundle/{chunk-CW3C7FSO.js → chunk-YQFO7WXQ.js} +2 -2
  71. package/dist/bundle/{chunk-2FXA32RJ.js → chunk-ZL5YG2WK.js} +14 -9
  72. package/dist/bundle/{chunk-VQL4RVXZ.js → chunk-ZNICTHSC.js} +1 -1
  73. package/dist/bundle/{chunk-PG3V225O.js → chunk-ZTMV5M3D.js} +32 -27
  74. package/dist/bundle/command-contract-UKOL455D.js +34 -0
  75. package/dist/bundle/{command-server-entry-N32NX4QW.js → command-server-entry-K52OEKIO.js} +24 -22
  76. package/dist/bundle/{decode-ZKJWSFXF.js → decode-OAE25LEJ.js} +5 -5
  77. package/dist/bundle/{dispatch-U2DW6UI7.js → dispatch-6GVTXIZ2.js} +8 -8
  78. package/dist/bundle/{echarts-QLVLIP73.js → echarts-EO4ZGKMN.js} +2 -2
  79. package/dist/bundle/{embed-LC6K7P3S.js → embed-TB2AS4AT.js} +6 -6
  80. package/dist/bundle/{embedder-6C3OQBOV.js → embedder-YKC42G6L.js} +9 -9
  81. package/dist/bundle/{entry-5H6LB3MP.js → entry-AB6FU7BN.js} +9 -8
  82. package/dist/bundle/{failure-HJD7S5UA.js → failure-CY7ACT6V.js} +2 -2
  83. package/dist/bundle/{first-run-IOYQ4XQK.js → first-run-CMQZHDI5.js} +11 -11
  84. package/dist/bundle/first-screen-XZ73W3VE.js +32 -0
  85. package/dist/bundle/{instructions-SZUMEDY3.js → instructions-RM3IB6ID.js} +1 -1
  86. package/dist/bundle/{mcp-7KQUJNFN.js → mcp-M5YCSWJJ.js} +2 -2
  87. package/dist/bundle/{node-V76RRFIA.js → node-D2PM62TA.js} +2 -2
  88. package/dist/bundle/{node-sqlite-2DTVOT7L.js → node-sqlite-UK5DE525.js} +10 -6
  89. package/dist/bundle/{oauth-CT7EBDRY.js → oauth-SKRG67A2.js} +7 -7
  90. package/dist/bundle/{open-G3VHOOMV.js → open-XP3SY62D.js} +5 -5
  91. package/dist/bundle/{openai-F4K7MVTZ.js → openai-Q3U46UPA.js} +21 -17
  92. package/dist/bundle/{process-XH3KEHSF.js → process-YJ4LHMJB.js} +1 -1
  93. package/dist/bundle/{program-FLGIHTHM.js → program-EEPEFKTR.js} +80 -63
  94. package/dist/bundle/{prompt-JWQ6UQ6R.js → prompt-WYTODP4U.js} +5 -5
  95. package/dist/bundle/{proxy-transport-ENU2SJYT.js → proxy-transport-HJMQ5QFT.js} +5 -5
  96. package/dist/bundle/{recognize-Z26T3SYD.js → recognize-K2S5QQU2.js} +4 -4
  97. package/dist/bundle/{remote-7KHT6V3O.js → remote-7RSAJ3JC.js} +9 -7
  98. package/dist/bundle/{rerank-6QVI74QY.js → rerank-RJX77BKD.js} +7 -7
  99. package/dist/bundle/{serve-WYDZTONY.js → serve-3E7NN3VW.js} +14 -14
  100. package/dist/bundle/server-ITHYDPWQ.js +62 -0
  101. package/dist/bundle/{server-Y4J2NCFA.js → server-O3KU56A4.js} +36 -35
  102. package/dist/bundle/sqlite-runtime-RCS5WSG5.js +19 -0
  103. package/dist/bundle/{state-YCXBKOD2.js → state-PLWSPSAG.js} +6 -6
  104. package/dist/bundle/store-3FYLH53Z.js +276 -0
  105. package/dist/bundle/{store-QECSDJRP.js → store-DWMKCXYL.js} +15 -13
  106. package/dist/bundle/store-maintenance-command-3UEKINRB.js +52 -0
  107. package/dist/bundle/tg.js +13 -13
  108. package/dist/commands/account-removal.d.ts.map +1 -1
  109. package/dist/commands/account-removal.js +5 -3
  110. package/dist/commands/account-removal.js.map +1 -1
  111. package/dist/commands/session.d.ts.map +1 -1
  112. package/dist/commands/session.js +21 -3
  113. package/dist/commands/session.js.map +1 -1
  114. package/dist/paths.d.ts +6 -0
  115. package/dist/paths.d.ts.map +1 -1
  116. package/dist/paths.js +23 -2
  117. package/dist/paths.js.map +1 -1
  118. package/dist/program.d.ts +4 -1
  119. package/dist/program.d.ts.map +1 -1
  120. package/dist/program.js +5 -2
  121. package/dist/program.js.map +1 -1
  122. package/dist/version.d.ts +1 -1
  123. package/dist/version.js +1 -1
  124. package/package.json +4 -4
  125. package/dist/bundle/chunk-GJFICFQB.js +0 -27
  126. package/dist/bundle/chunk-Y52T5EMB.js +0 -35
  127. package/dist/bundle/chunk-ZKHXWSKD.js +0 -265
  128. package/dist/bundle/command-contract-247AKZTE.js +0 -33
  129. package/dist/bundle/first-screen-NVK7PFX4.js +0 -31
  130. package/dist/bundle/server-UXQT7LZT.js +0 -61
  131. package/dist/bundle/store-maintenance-command-5YW6TRJA.js +0 -49
  132. /package/dist/bundle/{chunk-YVNHQFLC.js → chunk-HVJJWJYQ.js} +0 -0
@@ -3,17 +3,22 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError,
5
5
  errorCodes
6
- } from "./chunk-VUBZFMGP.js";
6
+ } from "./chunk-E6VSARSU.js";
7
7
  import {
8
8
  __name
9
9
  } from "./chunk-ZVVMGPBJ.js";
10
10
 
11
- // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/errors/failures.js
11
+ // node_modules/.pnpm/@wirecat+cli-core@0.648.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.98.0_commander@15._22e948f6f1aa7f4572ea465a838ccfd1/node_modules/@wirecat/cli-core/dist/errors/failures.js
12
12
  var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
13
13
  var isCommanderFailure = /* @__PURE__ */ __name((value) => {
14
14
  const { code, exitCode } = value ?? {};
15
15
  return value instanceof Error && typeof code === "string" && code.startsWith("commander.") && typeof exitCode === "number";
16
16
  }, "isCommanderFailure");
17
+ var USAGE_REASONS = {
18
+ "commander.unknownCommand": "usage.unknown-command",
19
+ "commander.unknownOption": "usage.unknown-option"
20
+ };
21
+ var usageReason = /* @__PURE__ */ __name((code) => USAGE_REASONS[code], "usageReason");
17
22
  var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
18
23
  var SQLITE_CORRUPT = 11;
19
24
  var SQLITE_NOTADB = 26;
@@ -42,9 +47,20 @@ var wrapping = /* @__PURE__ */ __name((error, original) => {
42
47
  return error;
43
48
  }, "wrapping");
44
49
  var storeDamaged = /* @__PURE__ */ __name((error, next) => damageIn(error) ? wrapping(new CliError("configuration_error", `the store file is damaged${next ? `; \`${next}\` says what is damaged and what to do` : ""}`, { reason: "store.damaged" }), error) : error, "storeDamaged");
50
+ var damagedFile = /* @__PURE__ */ __name(async (files, work) => {
51
+ try {
52
+ return await work();
53
+ } catch (error) {
54
+ if (!damageIn(error))
55
+ throw error;
56
+ throw wrapping(new CliError("validation_error", `${files.join(" or ")} is damaged or not a database`, {
57
+ reason: "store.file-damaged"
58
+ }), error);
59
+ }
60
+ }, "damagedFile");
45
61
  var isStoreDamage = /* @__PURE__ */ __name((error) => damageIn(error) !== void 0, "isStoreDamage");
46
62
 
47
- // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/runs/secrets.js
63
+ // node_modules/.pnpm/@wirecat+cli-core@0.648.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.98.0_commander@15._22e948f6f1aa7f4572ea465a838ccfd1/node_modules/@wirecat/cli-core/dist/runs/secrets.js
48
64
  var SECRET_WORDS = /* @__PURE__ */ new Set([
49
65
  "authorization",
50
66
  "cookie",
@@ -87,6 +103,7 @@ var KNOWN_TOKENS = new RegExp(`${[
87
103
  "npm_[A-Za-z0-9]{36}",
88
104
  "eyJ[A-Za-z0-9_-]{5,}\\.eyJ[A-Za-z0-9_-]{5,}\\.[A-Za-z0-9_-]*"
89
105
  ].map((pattern) => `${START}${pattern}${END}`).join("|")}|(?<!\\d)\\d{8,10}:[A-Za-z0-9_-]{35}${END}`, "g");
106
+ var WEBHOOK_PATH = /(\/rest\/\d+\/)[^/\s?#"']+/g;
90
107
  var PRIVATE_KEY = /-----BEGIN[A-Z ]* PRIVATE KEY-----[\s\S]*?(?:-----END[A-Z ]* PRIVATE KEY-----|$)/g;
91
108
  var SCHEME = /(?<![A-Za-z])(Bearer|Basic)(\s+)(?![A-Z]?[a-z]+(?![A-Za-z0-9]))[A-Za-z0-9._~+/=-]{8,}/g;
92
109
  var NAMED_PAIR = /(?<![\p{L}\p{N}])([\p{L}\p{N}_.-]*(?:token|pass|pwd|pin|otp|2fa|secret|credential|cookie|authorization|key|contrase|clave|пароль|пин|код)[\p{L}\p{N}_.-]*)(["']?\s*(?:=>|[:=])\s*["']?|\s+(?![\p{L}]+(?![\p{L}\p{N}])))((?:Bearer\s+|Basic\s+)?)([^\s"'&,;]+)/giu;
@@ -118,7 +135,7 @@ var entropy = /* @__PURE__ */ __name((text) => {
118
135
  bits -= count / text.length * Math.log2(count / text.length);
119
136
  return bits;
120
137
  }, "entropy");
121
- var withoutSecrets = /* @__PURE__ */ __name((text, mark = "[redacted]") => text.replace(PRIVATE_KEY, mark).replace(KNOWN_TOKENS, mark).replace(SCHEME, `$1$2${mark}`).replace(NAMED_PAIR, (whole, name, separator, scheme) => secretNamed(name) ? `${name}${separator}${scheme}${mark}` : whole).replace(/[!-~]{20,}/g, (token) => (
138
+ var withoutSecrets = /* @__PURE__ */ __name((text, mark = "[redacted]") => text.replace(WEBHOOK_PATH, `$1${mark}`).replace(PRIVATE_KEY, mark).replace(KNOWN_TOKENS, mark).replace(SCHEME, `$1$2${mark}`).replace(NAMED_PAIR, (whole, name, separator, scheme) => secretNamed(name) ? `${name}${separator}${scheme}${mark}` : whole).replace(/[!-~]{20,}/g, (token) => (
122
139
  // A URL or a path is somebody's address, not a key; a credential in one is caught by the rules above.
123
140
  token.includes("://") || /^(?:\/|~\/|\.\.?\/)/.test(token) ? token : token.replace(RUN, (run) => looksRandom(run) ? mark : run.replace(HEX, (hex) => entropy(hex) >= 3 ? mark : hex))
124
141
  )), "withoutSecrets");
@@ -128,9 +145,11 @@ var HEX = /(?<![A-Za-z0-9])(?=[0-9]*[a-f])[0-9a-f]{20,}(?![A-Za-z0-9])/g;
128
145
  export {
129
146
  isCliFailure,
130
147
  isCommanderFailure,
148
+ usageReason,
131
149
  failureKey,
132
150
  sqliteCode,
133
151
  storeDamaged,
152
+ damagedFile,
134
153
  isStoreDamage,
135
154
  secretNamed,
136
155
  withoutSecrets