@wirecat/tg-cli 0.118.0 → 0.120.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 (137) hide show
  1. package/contracts/wirecat.json +7623 -0
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bot/transport.d.ts.map +1 -1
  4. package/dist/bot/transport.js +15 -8
  5. package/dist/bot/transport.js.map +1 -1
  6. package/dist/bundle/{adapter-4YNP6VCO.js → adapter-OJKHXGBC.js} +49 -50
  7. package/dist/bundle/{all-profiles-MIQDYAGO.js → all-profiles-URIWNL23.js} +10 -10
  8. package/dist/bundle/{anthropic-NTASPJYE.js → anthropic-YUKNB63B.js} +10 -8
  9. package/dist/bundle/{app-server-UJZBJ2SK.js → app-server-H5QNHGH4.js} +43 -43
  10. package/dist/bundle/{bot-api-JZAD4L3N.js → bot-api-27GN4Y3D.js} +49 -49
  11. package/dist/bundle/{bot-history-OUDHH3NU.js → bot-history-VVSWLVZM.js} +18 -18
  12. package/dist/bundle/{bun-EC4HDIRD.js → bun-PAAJX3GU.js} +2 -2
  13. package/dist/bundle/{bun-sqlite-A4HJR6KO.js → bun-sqlite-TPEBWFZH.js} +5 -5
  14. package/dist/bundle/{chunk-KEDHX6XG.js → chunk-34DSPJNN.js} +2 -2
  15. package/dist/bundle/{chunk-JZETEZHC.js → chunk-3FPFRDG2.js} +10 -8
  16. package/dist/bundle/{chunk-2KQHUBTV.js → chunk-3GLLWDM6.js} +12 -12
  17. package/dist/bundle/{chunk-NMT2VGEI.js → chunk-3SANNNWS.js} +3 -3
  18. package/dist/bundle/{chunk-65XV5PPI.js → chunk-4JATS2J5.js} +3 -3
  19. package/dist/bundle/{chunk-OTQDJUES.js → chunk-4OWY7QBE.js} +6 -6
  20. package/dist/bundle/{chunk-QOGYHU3Q.js → chunk-4W4EVVL4.js} +61 -21
  21. package/dist/bundle/{chunk-BNEP5EOV.js → chunk-6XHZV7AQ.js} +4 -4
  22. package/dist/bundle/{chunk-3MQOLYAN.js → chunk-7DPWVKYS.js} +4 -4
  23. package/dist/bundle/{chunk-NUCDEOFC.js → chunk-7I6YVQHW.js} +2 -2
  24. package/dist/bundle/{chunk-HJNRIK5X.js → chunk-7N4IUEX3.js} +9 -8
  25. package/dist/bundle/{chunk-RG2E7ZQZ.js → chunk-7VNV426X.js} +85 -17
  26. package/dist/bundle/{chunk-DSZJREEO.js → chunk-7WS3ULOO.js} +2205 -911
  27. package/dist/bundle/{chunk-TMTEWOQS.js → chunk-B7B65ZLU.js} +5 -3
  28. package/dist/bundle/{chunk-EPXVRJAX.js → chunk-CGUDXNJE.js} +2 -2
  29. package/dist/bundle/{chunk-EQJ6NLF5.js → chunk-CLTMVPGT.js} +13 -13
  30. package/dist/bundle/{chunk-6ZMTEUVU.js → chunk-CLURRDNU.js} +6 -6
  31. package/dist/bundle/{chunk-ZXXTJF4Z.js → chunk-CYWV2RLN.js} +4 -4
  32. package/dist/bundle/{chunk-5IIU7X4S.js → chunk-D2WNQJUQ.js} +1 -1
  33. package/dist/bundle/{chunk-PB252TT3.js → chunk-DDKFAUQD.js} +2 -2
  34. package/dist/bundle/{chunk-5LDWBEWU.js → chunk-DE7QIEUP.js} +53 -35
  35. package/dist/bundle/{chunk-JPVFYMSQ.js → chunk-DH7VKHTZ.js} +4 -4
  36. package/dist/bundle/{chunk-GXCJ47SJ.js → chunk-DQTQO6PB.js} +3265 -1034
  37. package/dist/bundle/{chunk-JWIUK3SK.js → chunk-FATTEYZH.js} +2 -2
  38. package/dist/bundle/{chunk-I4TI5HDJ.js → chunk-FPWXG53C.js} +11 -11
  39. package/dist/bundle/{chunk-PO74BDER.js → chunk-H5XC2WYO.js} +35 -589
  40. package/dist/bundle/{chunk-ZMUC3UQO.js → chunk-HDSKBXAF.js} +3 -3
  41. package/dist/bundle/{chunk-PWCQC56A.js → chunk-HIBYYKGO.js} +1 -1
  42. package/dist/bundle/{chunk-GLRRCKP6.js → chunk-JJY3TQTM.js} +23 -5
  43. package/dist/bundle/{chunk-YPRUWRKE.js → chunk-JQLGS3SG.js} +1 -1
  44. package/dist/bundle/{chunk-MBH7IKLT.js → chunk-JSEIT2WO.js} +1 -1
  45. package/dist/bundle/{chunk-57LKX6N2.js → chunk-KLHOQ6XQ.js} +1 -1
  46. package/dist/bundle/{chunk-4BV4UMBB.js → chunk-KP26Y5OA.js} +1628 -367
  47. package/dist/bundle/{chunk-MZNOASAW.js → chunk-KRCMKFUV.js} +16 -3
  48. package/dist/bundle/{chunk-6AXUEJGL.js → chunk-KTV5Y5EX.js} +2 -2
  49. package/dist/bundle/{chunk-YEOSV6JC.js → chunk-KW6JZGG3.js} +1 -1
  50. package/dist/bundle/{chunk-H6S3C3MH.js → chunk-LLCGOZ44.js} +4 -4
  51. package/dist/bundle/{chunk-CEY43D3A.js → chunk-LS72R7DN.js} +34 -34
  52. package/dist/bundle/chunk-LVGX7VTD.js +138 -0
  53. package/dist/bundle/{chunk-VW6BF6M7.js → chunk-MCPOZNWG.js} +1 -1
  54. package/dist/bundle/{chunk-G3RT2EQI.js → chunk-MMPISXSU.js} +2 -2
  55. package/dist/bundle/{chunk-6RI4TEIC.js → chunk-MTD6WZKV.js} +2 -2
  56. package/dist/bundle/{chunk-JLJKGKU2.js → chunk-PDYTNTQI.js} +6 -6
  57. package/dist/bundle/{chunk-P3ASN72F.js → chunk-RX5CJ55S.js} +1 -1
  58. package/dist/bundle/{chunk-76EKXFX2.js → chunk-S6OC367D.js} +24 -2
  59. package/dist/bundle/{chunk-PW3HFIJA.js → chunk-THJHYMFR.js} +1489 -1548
  60. package/dist/bundle/{chunk-5QYU7B27.js → chunk-U2TPRUWK.js} +689 -482
  61. package/dist/bundle/{chunk-YHZFGUAP.js → chunk-U6HEZPCR.js} +19 -19
  62. package/dist/bundle/{chunk-BXTDAGM4.js → chunk-VUBZFMGP.js} +2 -2
  63. package/dist/bundle/{chunk-2NA5KVP6.js → chunk-VUUR2SRS.js} +264 -45
  64. package/dist/bundle/{chunk-EPCFXKTX.js → chunk-WGGSFGNZ.js} +34 -8
  65. package/dist/bundle/{chunk-Y64SI2RO.js → chunk-WLBPNLDF.js} +3 -3
  66. package/dist/bundle/{chunk-GI4MTNA2.js → chunk-WQ55F4Y3.js} +8 -8
  67. package/dist/bundle/{chunk-FHMK6OK4.js → chunk-YBOVL25O.js} +96 -30
  68. package/dist/bundle/{chunk-DKFC5ZZ3.js → chunk-YDROJG2Y.js} +86 -29
  69. package/dist/bundle/{chunk-NKFTZVQU.js → chunk-YQKEPT22.js} +1 -1
  70. package/dist/bundle/{chunk-GIM37COQ.js → chunk-ZON7K5QE.js} +3 -3
  71. package/dist/bundle/{chunk-JWPSVS6C.js → chunk-ZRRZTPSB.js} +19059 -17055
  72. package/dist/bundle/command-contract-KW6FNOJO.js +33 -0
  73. package/dist/bundle/{decode-NMNPLKNR.js → decode-RVWSCZW4.js} +5 -5
  74. package/dist/bundle/{dispatch-OP27MWX5.js → dispatch-U2DW6UI7.js} +10 -10
  75. package/dist/bundle/{echarts-S46LEIPS.js → echarts-6VNUD3JF.js} +2 -2
  76. package/dist/bundle/{embed-I5ZYHGYC.js → embed-LWLCQKIK.js} +6 -6
  77. package/dist/bundle/{embedder-LTJI67N2.js → embedder-CXKHLRJT.js} +9 -9
  78. package/dist/bundle/{entry-O6BUPXF7.js → entry-HV4NSX3Z.js} +7 -7
  79. package/dist/bundle/{failure-4JUQFXJT.js → failure-HJD7S5UA.js} +2 -2
  80. package/dist/bundle/{first-run-PMZNCDGD.js → first-run-OPI6NIWQ.js} +11 -11
  81. package/dist/bundle/first-screen-BVQLF4LN.js +31 -0
  82. package/dist/bundle/{instructions-AUEGY3VO.js → instructions-TK4HXL3A.js} +1 -1
  83. package/dist/bundle/{mcp-M4QN2E7R.js → mcp-7KQUJNFN.js} +2 -2
  84. package/dist/bundle/{node-XRA7RBCQ.js → node-WFPNBUCU.js} +2 -2
  85. package/dist/bundle/{node-sqlite-DEZO6LRS.js → node-sqlite-L5BRGJLK.js} +6 -6
  86. package/dist/bundle/{oauth-DAVC7WCD.js → oauth-CGVWL35B.js} +7 -7
  87. package/dist/bundle/{open-DE2YO4T7.js → open-HLL55C5S.js} +5 -5
  88. package/dist/bundle/{openai-5BKGAULH.js → openai-YFCNXIJ4.js} +16 -37
  89. package/dist/bundle/{process-4ZHPNUIQ.js → process-4A5JP5LO.js} +1 -1
  90. package/dist/bundle/{program-EGTKSNB4.js → program-IFGQGSUF.js} +56 -53
  91. package/dist/bundle/{prompt-HWCWHHPE.js → prompt-B5FYE2DQ.js} +7 -5
  92. package/dist/bundle/{proxy-transport-4DPZB2W2.js → proxy-transport-ENU2SJYT.js} +5 -5
  93. package/dist/bundle/{recognize-NG6RXNGF.js → recognize-ZHMHGIV3.js} +4 -4
  94. package/dist/bundle/{remote-ZKXIIGYH.js → remote-A3W5HE52.js} +7 -7
  95. package/dist/bundle/{rerank-TX5QFURV.js → rerank-HWJAQOZM.js} +7 -7
  96. package/dist/bundle/{serve-XAS6DECW.js → serve-PP326Q2F.js} +9 -9
  97. package/dist/bundle/{server-CNPIWBYU.js → server-MV6CL63L.js} +35 -35
  98. package/dist/bundle/server-TZGGOJ26.js +60 -0
  99. package/dist/bundle/{state-3HTUETTS.js → state-Y3RJ7ZXB.js} +6 -6
  100. package/dist/bundle/{store-B5VZWJHN.js → store-EVNI2MHZ.js} +36 -13
  101. package/dist/bundle/store-maintenance-command-XPQE47RE.js +49 -0
  102. package/dist/bundle/tg.js +38 -14
  103. package/dist/commands/account-removal.d.ts +3 -0
  104. package/dist/commands/account-removal.d.ts.map +1 -0
  105. package/dist/commands/account-removal.js +57 -0
  106. package/dist/commands/account-removal.js.map +1 -0
  107. package/dist/commands/context.d.ts.map +1 -1
  108. package/dist/commands/context.js +2 -0
  109. package/dist/commands/context.js.map +1 -1
  110. package/dist/http.d.ts +6 -0
  111. package/dist/http.d.ts.map +1 -0
  112. package/dist/http.js +8 -0
  113. package/dist/http.js.map +1 -0
  114. package/dist/identity.d.ts +4 -0
  115. package/dist/identity.d.ts.map +1 -1
  116. package/dist/identity.js +14 -0
  117. package/dist/identity.js.map +1 -1
  118. package/dist/telegram/map.d.ts.map +1 -1
  119. package/dist/telegram/map.js +3 -0
  120. package/dist/telegram/map.js.map +1 -1
  121. package/dist/telegram/registration.d.ts +1 -1
  122. package/dist/telegram/registration.d.ts.map +1 -1
  123. package/dist/telegram/registration.js +4 -1
  124. package/dist/telegram/registration.js.map +1 -1
  125. package/dist/version.d.ts +1 -1
  126. package/dist/version.js +1 -1
  127. package/dist/wcat.d.ts +3 -0
  128. package/dist/wcat.d.ts.map +1 -0
  129. package/dist/wcat.js +4 -0
  130. package/dist/wcat.js.map +1 -0
  131. package/package.json +7 -6
  132. package/dist/bundle/chunk-TSTEZNSX.js +0 -33
  133. package/dist/bundle/command-contract-7GZ6HAA6.js +0 -33
  134. package/dist/bundle/first-screen-BGML5DSO.js +0 -31
  135. package/dist/bundle/server-FRTKLHZF.js +0 -60
  136. package/dist/bundle/store-maintenance-command-VG3CLELA.js +0 -50
  137. /package/dist/bundle/{chunk-VOXIGICJ.js → chunk-YVNHQFLC.js} +0 -0
@@ -4,12 +4,12 @@ import {
4
4
  errorCodes,
5
5
  isCliError,
6
6
  visibleControls
7
- } from "./chunk-BXTDAGM4.js";
7
+ } from "./chunk-VUBZFMGP.js";
8
8
  import {
9
9
  __name
10
10
  } from "./chunk-ZVVMGPBJ.js";
11
11
 
12
- // node_modules/.pnpm/@wirecat+cli-base@0.80.8_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
12
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.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
13
13
  var EXIT_CODES = {
14
14
  validation_error: 2,
15
15
  configuration_error: 3,
@@ -434,6 +434,31 @@ function trim() {
434
434
  };
435
435
  }
436
436
  __name(trim, "trim");
437
+ // @__NO_SIDE_EFFECTS__
438
+ function url(message$1) {
439
+ return {
440
+ kind: "validation",
441
+ type: "url",
442
+ reference: url,
443
+ async: false,
444
+ expects: null,
445
+ requirement(input) {
446
+ try {
447
+ if (URL.canParse) return URL.canParse(input);
448
+ new URL(input);
449
+ return true;
450
+ } catch {
451
+ return false;
452
+ }
453
+ },
454
+ message: message$1,
455
+ "~run"(dataset, config$1) {
456
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
457
+ return dataset;
458
+ }
459
+ };
460
+ }
461
+ __name(url, "url");
437
462
  var ABORT_EARLY_CONFIG = { abortEarly: true };
438
463
  // @__NO_SIDE_EFFECTS__
439
464
  function getFallback(schema, dataset, config$1) {
@@ -1281,7 +1306,7 @@ function unwrap(schema) {
1281
1306
  }
1282
1307
  __name(unwrap, "unwrap");
1283
1308
 
1284
- // node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
1309
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
1285
1310
  var EFFECT_LEVELS = ["none", "read", "write"];
1286
1311
  var effectsSchema = strictObject({
1287
1312
  remote: picklist(EFFECT_LEVELS),
@@ -1918,7 +1943,7 @@ function toStandardJsonSchema(schema) {
1918
1943
  }
1919
1944
  __name(toStandardJsonSchema, "toStandardJsonSchema");
1920
1945
 
1921
- // node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/registry.js
1946
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/registry.js
1922
1947
  var word = pipe(string(), regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, "a lower-case word, words joined by -"));
1923
1948
  var SNAKE_CASE = /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/;
1924
1949
  var text = pipe(string(), regex(/\S/, "must not be empty"));
@@ -1960,7 +1985,7 @@ var fill = /* @__PURE__ */ __name((template, values) => template.replace(PLACEHO
1960
1985
  return String(value);
1961
1986
  }), "fill");
1962
1987
 
1963
- // node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/output.js
1988
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/output.js
1964
1989
  var MAX_NEXT_STEPS = 2;
1965
1990
  var COMPACT_FLAG = "--compact";
1966
1991
  var isoTime = pipe(string(), isoTimestamp("an ISO 8601 time in UTC"), endsWith("Z", "an ISO 8601 time in UTC, ending in `Z`"));
@@ -2072,7 +2097,7 @@ var jsonlOf = /* @__PURE__ */ __name(({ items, page, meta }) => [
2072
2097
  JSON.stringify({ type: "end", complete: meta.complete, ...meta.issues ? { issues: meta.issues } : {}, page })
2073
2098
  ].join("\n"), "jsonlOf");
2074
2099
 
2075
- // node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/errors.js
2100
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/errors.js
2076
2101
  var CRASH_CODE = "internal_error";
2077
2102
  var CRASH_REASON = "command.crashed";
2078
2103
  var errorObjectSchema = strictObject({
@@ -2165,7 +2190,7 @@ var BASE_REASONS = defineReasons([
2165
2190
  { reason: CRASH_REASON, code: CRASH_CODE, message: "the command failed; this is a bug", details: [] }
2166
2191
  ]);
2167
2192
 
2168
- // node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/steps.js
2193
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/steps.js
2169
2194
  var SAME_COMMAND = "*";
2170
2195
  var commandPath = pipe(string(), regex(/^[a-z][a-z0-9-]*( [a-z][a-z0-9-]*)*$/, "a command path such as `messages sync`"));
2171
2196
  var stepSchema = union([
@@ -2244,7 +2269,7 @@ var STEPS = defineSteps([
2244
2269
  }
2245
2270
  ]);
2246
2271
 
2247
- // node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
2272
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.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
2248
2273
  var recognise = /* @__PURE__ */ __name((failure) => {
2249
2274
  if (isCliError(failure))
2250
2275
  return failure;
@@ -2412,6 +2437,7 @@ export {
2412
2437
  startsWith,
2413
2438
  transform,
2414
2439
  trim,
2440
+ url,
2415
2441
  forward,
2416
2442
  array,
2417
2443
  boolean,
@@ -3,12 +3,12 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError,
5
5
  errorCodes
6
- } from "./chunk-BXTDAGM4.js";
6
+ } from "./chunk-VUBZFMGP.js";
7
7
  import {
8
8
  __name
9
9
  } from "./chunk-ZVVMGPBJ.js";
10
10
 
11
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/errors/failures.js
11
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/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 ?? {};
@@ -44,7 +44,7 @@ var wrapping = /* @__PURE__ */ __name((error, original) => {
44
44
  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");
45
45
  var isStoreDamage = /* @__PURE__ */ __name((error) => damageIn(error) !== void 0, "isStoreDamage");
46
46
 
47
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/runs/secrets.js
47
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/runs/secrets.js
48
48
  var SECRET_WORDS = /* @__PURE__ */ new Set([
49
49
  "authorization",
50
50
  "cookie",
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-BXTDAGM4.js";
5
+ } from "./chunk-VUBZFMGP.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/search/languages.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/languages.js
11
11
  var LANGUAGES = [
12
12
  { name: "russian", code: "ru", label: "Russian", script: "cyrillic", dictionary: "dictionary-ru" },
13
13
  { name: "english", code: "en", label: "English", script: "latin", dictionary: "dictionary-en" },
@@ -15,12 +15,12 @@ var LANGUAGES = [
15
15
  ];
16
16
  var languagesOf = /* @__PURE__ */ __name((script) => LANGUAGES.filter((one) => one.script === script).map(({ name }) => name), "languagesOf");
17
17
 
18
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/store/normalize.js
18
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/store/normalize.js
19
19
  var NORMALIZER_VERSION = 1;
20
20
  var fold = /* @__PURE__ */ __name((text) => text.normalize("NFKD").replace(new RegExp("\\p{M}+", "gu"), "").normalize("NFC").toLowerCase(), "fold");
21
21
  var normalize = /* @__PURE__ */ __name((text) => fold(text).replace(new RegExp("\\p{Cc}", "gu"), " ").replace(/\s+/gu, " ").trim(), "normalize");
22
22
 
23
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
23
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
24
24
  var BaseStemmer = class {
25
25
  static {
26
26
  __name(this, "BaseStemmer");
@@ -395,7 +395,7 @@ var BaseStemmer = class {
395
395
  }
396
396
  };
397
397
 
398
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
398
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
399
399
  var a_0 = [
400
400
  ["arsen", -1],
401
401
  ["commun", -1],
@@ -1096,7 +1096,7 @@ var english_stemmer_default = class extends BaseStemmer {
1096
1096
  stemWord = this.stem;
1097
1097
  };
1098
1098
 
1099
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1099
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1100
1100
  var a_02 = [
1101
1101
  ["\u0432", 1],
1102
1102
  ["\u0438\u0432", 2, 1],
@@ -1519,7 +1519,7 @@ var russian_stemmer_default = class extends BaseStemmer {
1519
1519
  stemWord = this.stem;
1520
1520
  };
1521
1521
 
1522
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1522
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1523
1523
  var a_03 = [
1524
1524
  ["", 6],
1525
1525
  ["\xE1", 1, 1],
@@ -2195,7 +2195,7 @@ var spanish_stemmer_default = class extends BaseStemmer {
2195
2195
  stemWord = this.stem;
2196
2196
  };
2197
2197
 
2198
- // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._981e87e6afb3f510e9b2b59ded3c7286/node_modules/@wirecat/cli-core/dist/search/stem.js
2198
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/stem.js
2199
2199
  var SNOWBALL_VERSION = "3.1.1";
2200
2200
  var CYRILLIC_STEMMERS = [...languagesOf("cyrillic"), "none"];
2201
2201
  var LATIN_STEMMERS = [...languagesOf("latin"), "none"];
@@ -1,5 +1,8 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ hostFetch
5
+ } from "./chunk-LVGX7VTD.js";
3
6
  import {
4
7
  ADMIN_RIGHTS,
5
8
  BotTokenStore,
@@ -13,45 +16,48 @@ import {
13
16
  privateFiles,
14
17
  providerRequest,
15
18
  withSqliteSidecars
16
- } from "./chunk-GXCJ47SJ.js";
19
+ } from "./chunk-DQTQO6PB.js";
17
20
  import {
18
21
  parseProxy,
19
22
  proxyAddress,
20
23
  proxyError,
21
24
  proxyLabel,
22
25
  proxySetting
23
- } from "./chunk-JWIUK3SK.js";
26
+ } from "./chunk-FATTEYZH.js";
24
27
  import {
25
28
  messengerContext
26
- } from "./chunk-PO74BDER.js";
29
+ } from "./chunk-H5XC2WYO.js";
27
30
  import {
28
31
  uploadBlob
29
- } from "./chunk-DSZJREEO.js";
32
+ } from "./chunk-7WS3ULOO.js";
30
33
  import {
31
34
  asFirstWord,
32
- currentAttempt,
33
35
  environmentOf,
34
36
  fromFile,
35
37
  settingsFor
36
- } from "./chunk-PW3HFIJA.js";
38
+ } from "./chunk-THJHYMFR.js";
39
+ import {
40
+ currentAttempt
41
+ } from "./chunk-KP26Y5OA.js";
37
42
  import {
43
+ DESKTOP,
38
44
  TG
39
- } from "./chunk-MZNOASAW.js";
45
+ } from "./chunk-KRCMKFUV.js";
40
46
  import {
41
47
  Credentials,
42
48
  pathsAreOverridden,
43
49
  resolvePaths
44
- } from "./chunk-YHZFGUAP.js";
50
+ } from "./chunk-U6HEZPCR.js";
45
51
  import {
46
52
  optional
47
- } from "./chunk-EPCFXKTX.js";
53
+ } from "./chunk-WGGSFGNZ.js";
48
54
  import {
49
55
  importFrom
50
56
  } from "./chunk-Y5E2WNWB.js";
51
57
  import {
52
58
  CliError,
53
59
  isCliError
54
- } from "./chunk-BXTDAGM4.js";
60
+ } from "./chunk-VUBZFMGP.js";
55
61
  import {
56
62
  __name
57
63
  } from "./chunk-ZVVMGPBJ.js";
@@ -61,7 +67,7 @@ var CONFIG = settingsFor(TG, { profile: { proxy: optional(proxySetting) } });
61
67
  var { resolveSettings, configuredProfiles, changeSetting } = CONFIG;
62
68
 
63
69
  // dist/commands/context.js
64
- import { existsSync } from "node:fs";
70
+ import { existsSync as existsSync2 } from "node:fs";
65
71
  import { dirname } from "node:path";
66
72
 
67
73
  // dist/paths.js
@@ -151,6 +157,55 @@ var resolveProxy = /* @__PURE__ */ __name((settings, { env = process.env, keyrin
151
157
  return { proxy: secret ? { ...proxy, secret } : proxy, from };
152
158
  }, "resolveProxy");
153
159
 
160
+ // dist/commands/account-removal.js
161
+ import { existsSync, rmSync } from "node:fs";
162
+ import { join as join2 } from "node:path";
163
+ var SUFFIXES = ["", "-wal", "-shm"];
164
+ var alreadyEnded = /* @__PURE__ */ __name((error) => error instanceof CliError && error.details?.reason === "login.revoked", "alreadyEnded");
165
+ var logOut = /* @__PURE__ */ __name(async (profile, sessionPath, context) => {
166
+ const { env, keyring } = context;
167
+ const credentials = apiCredentials({ profile, env, ...keyring ? { keyring } : {} }).read();
168
+ if (!credentials)
169
+ return false;
170
+ const settings = resolveSettings({ profile }, { env });
171
+ const through = resolveProxy(settings, {
172
+ env,
173
+ checks: checkWords("tg", profile),
174
+ ...keyring ? { keyring } : {}
175
+ });
176
+ const { TelegramAdapter } = await import("./adapter-OJKHXGBC.js");
177
+ const adapter = await TelegramAdapter.open({ credentials, sessionPath, ...through ? { proxy: through.proxy } : {} });
178
+ try {
179
+ await adapter.logout();
180
+ return true;
181
+ } catch (error) {
182
+ if (alreadyEnded(error))
183
+ return true;
184
+ throw error;
185
+ } finally {
186
+ await adapter.close().catch(() => {
187
+ });
188
+ }
189
+ }, "logOut");
190
+ var TELEGRAM_REMOVAL = {
191
+ signOut: /* @__PURE__ */ __name(async (profile, context) => {
192
+ const sessionPath = sessionFile(profile, context.env);
193
+ if (!existsSync(sessionPath))
194
+ return { revoked: null, removed: [] };
195
+ const revoked = context.mayRevoke ? await logOut(profile, sessionPath, context) : false;
196
+ for (const suffix of SUFFIXES)
197
+ rmSync(`${sessionPath}${suffix}`, { force: true });
198
+ return { revoked, removed: ["the Telegram session"] };
199
+ }, "signOut"),
200
+ secrets: /* @__PURE__ */ __name((profile, { env }) => [
201
+ {
202
+ credentials: { configDir: pathsFor(env).config, service: APP, isolated: isolated(env), env },
203
+ accounts: [`${profile}:api`, `proxy:profile:${profile}`]
204
+ }
205
+ ], "secrets"),
206
+ stateFiles: /* @__PURE__ */ __name((profile, { env }) => [join2(pathsFor(env).state, "bots", profile)], "stateFiles")
207
+ };
208
+
154
209
  // dist/commands/context.js
155
210
  var sessionFiles = /* @__PURE__ */ __name((sessionPath) => privateFiles({ files: withSqliteSidecars(sessionPath), dirs: [dirname(sessionPath)] }), "sessionFiles");
156
211
  var telegramOf = /* @__PURE__ */ __name((command, base) => {
@@ -175,13 +230,13 @@ var telegramOf = /* @__PURE__ */ __name((command, base) => {
175
230
  const open = /* @__PURE__ */ __name(async (given, connecting = {}) => {
176
231
  const resolved = given ?? credentials.read();
177
232
  if (!resolved) {
178
- const loggedIn = existsSync(sessionPath);
233
+ const loggedIn = existsSync2(sessionPath);
179
234
  const background = command.name() === "serve" || base.env.TG_SCHEDULED !== void 0;
180
235
  const temporary = loggedIn && background;
181
236
  throw new CliError(temporary ? "provider_unavailable" : "authentication_error", loggedIn ? `no Telegram app credentials found for profile "${profile}", although it has logged in on this machine \u2014 the keyring is probably out of reach (cron, ssh, an MCP client that trims the environment: set XDG_RUNTIME_DIR); \`tg ${asFirstWord(profile)}doctor\` shows it. Log in again only if they were removed` : `no Telegram app credentials for profile "${profile}" \u2014 run ${setup} in a local terminal first, or sign in from ${desktop}; agents: read \`tg skill show\``, temporary ? { reason: "credentials.unreachable" } : {});
182
237
  }
183
238
  const options = { credentials: resolved, sessionPath, ...connecting };
184
- return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-4YNP6VCO.js")).TelegramAdapter.open({
239
+ return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-OJKHXGBC.js")).TelegramAdapter.open({
185
240
  ...options,
186
241
  ...proxyOption(proxy()),
187
242
  diagnostic: /* @__PURE__ */ __name((line) => base.streams.diagnostic(line), "diagnostic"),
@@ -192,7 +247,7 @@ var telegramOf = /* @__PURE__ */ __name((command, base) => {
192
247
  });
193
248
  }, "open");
194
249
  const connect = /* @__PURE__ */ __name(async (options = {}) => {
195
- if (!environment.adapter && !existsSync(sessionPath)) {
250
+ if (!environment.adapter && !existsSync2(sessionPath)) {
196
251
  throw new CliError("authentication_error", `no session for profile "${profile}" \u2014 run ${setup} in a local terminal, or sign in from ${desktop}`);
197
252
  }
198
253
  return open(void 0, options);
@@ -209,7 +264,7 @@ var TELEGRAM = {
209
264
  resolveSettings,
210
265
  connect: /* @__PURE__ */ __name((command, base, options) => telegramOf(command, base).connect(options), "connect"),
211
266
  // Bots sign in on a personal profile and keep their own session, so a tg profile is never a bot alone.
212
- profileState: /* @__PURE__ */ __name((profile, env) => existsSync(sessionFile(profile, env)) ? "signed-in" : "signed-out", "profileState"),
267
+ profileState: /* @__PURE__ */ __name((profile, env) => existsSync2(sessionFile(profile, env)) ? "signed-in" : "signed-out", "profileState"),
213
268
  chatArgument: "a chat: its title or part of it, its id, @username, or `me` for Saved Messages",
214
269
  groupSettings: GROUP_SETTINGS,
215
270
  mediaOptions: ["spoiler", "captionAbove", "fileName"],
@@ -239,7 +294,7 @@ var TELEGRAM = {
239
294
  diagnose: /* @__PURE__ */ __name(async (command, base) => {
240
295
  const { sessionPath, credentials, proxy } = telegramOf(command, base);
241
296
  return {
242
- session: { path: sessionPath, exists: existsSync(sessionPath), files: sessionFiles(sessionPath) },
297
+ session: { path: sessionPath, exists: existsSync2(sessionPath), files: sessionFiles(sessionPath) },
243
298
  proxy: proxyState(proxy),
244
299
  app_credentials: appCredentialsState(() => credentials.read(), base.env),
245
300
  // The one failure with no other symptom: a login made without these variables is invisible with them.
@@ -251,7 +306,8 @@ var TELEGRAM = {
251
306
  // Telegram names a deletion without its chat only where ids count per account. A chat stored by
252
307
  // its id alone has no kind yet, but `-100…` marks a channel's or a supergroup's.
253
308
  deletedWithoutChat: /* @__PURE__ */ __name((chat) => chat.kind !== "channel" && !(chat.kind === "unknown" && chat.id.startsWith("-100")) && !OWN_NUMBERING.includes(String(chat.providerMetadata?.chatType ?? "")), "deletedWithoutChat"),
254
- skill: SKILL
309
+ skill: SKILL,
310
+ accountRemoval: TELEGRAM_REMOVAL
255
311
  };
256
312
  var forCommand = /* @__PURE__ */ __name((command) => {
257
313
  const context = messengerContext(command, TELEGRAM);
@@ -291,7 +347,7 @@ var proxyState = /* @__PURE__ */ __name((resolve) => {
291
347
  }, "proxyState");
292
348
 
293
349
  // dist/commands/bot.js
294
- import { existsSync as existsSync2 } from "node:fs";
350
+ import { existsSync as existsSync3 } from "node:fs";
295
351
 
296
352
  // dist/bot/map.js
297
353
  var KINDS = {
@@ -692,9 +748,17 @@ var proxyRefusal = /* @__PURE__ */ __name((proxy, error) => {
692
748
  return void 0;
693
749
  }, "proxyRefusal");
694
750
 
751
+ // dist/http.js
752
+ var guardedFetch = /* @__PURE__ */ __name((hosts, send, timeoutMs) => hostFetch({
753
+ hosts,
754
+ ...send ? { fetch: /* @__PURE__ */ __name((input, init) => send(input instanceof Request ? input.url : String(input), init ?? {}), "fetch") } : {},
755
+ ...timeoutMs === void 0 ? {} : { timeoutMs }
756
+ }), "guardedFetch");
757
+
695
758
  // dist/bot/transport.js
696
759
  var API = "https://api.telegram.org";
697
760
  var DEFAULT_TIMEOUT_MS = 3e4;
761
+ var GUARD_MARGIN_MS = 5e3;
698
762
  var TelegramBotTransport = class {
699
763
  static {
700
764
  __name(this, "TelegramBotTransport");
@@ -708,7 +772,7 @@ var TelegramBotTransport = class {
708
772
  constructor(options) {
709
773
  this.#token = options.token;
710
774
  this.#baseUrl = options.baseUrl ?? API;
711
- this.#fetch = options.fetch ?? fetch;
775
+ this.#fetch = options.fetch;
712
776
  this.#timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
713
777
  this.#signal = options.signal;
714
778
  this.#events = options.events;
@@ -741,7 +805,8 @@ var TelegramBotTransport = class {
741
805
  const signals = [deadline, ...this.#signal ? [this.#signal] : []];
742
806
  let response;
743
807
  try {
744
- response = await this.#fetch(`${this.#baseUrl}/bot${this.#token}/${method}`, {
808
+ const send = guardedFetch(DESKTOP.hosts, this.#fetch, timeoutMs + GUARD_MARGIN_MS);
809
+ response = await send(`${this.#baseUrl}/bot${this.#token}/${method}`, {
745
810
  method: "POST",
746
811
  ...file || files.length ? {
747
812
  headers: { Accept: "application/json" },
@@ -753,7 +818,7 @@ var TelegramBotTransport = class {
753
818
  signal: AbortSignal.any(signals)
754
819
  });
755
820
  } catch (error) {
756
- const failure = this.#unanswered(method, error, reads, timeoutMs);
821
+ const failure = this.#unanswered(method, error, reads, timeoutMs, deadline);
757
822
  end({ errorCode: failure.code });
758
823
  throw failure;
759
824
  }
@@ -761,7 +826,7 @@ var TelegramBotTransport = class {
761
826
  try {
762
827
  text = await response.text();
763
828
  } catch (error) {
764
- const failure = this.#unanswered(method, error, reads, timeoutMs);
829
+ const failure = this.#unanswered(method, error, reads, timeoutMs, deadline);
765
830
  end({ status: response.status, errorCode: failure.code });
766
831
  throw failure;
767
832
  }
@@ -798,8 +863,8 @@ var TelegramBotTransport = class {
798
863
  return refusal;
799
864
  return new CliError("outcome_unknown", `Telegram failed on ${method}; it may or may not have carried it out \u2014 check before repeating it`, { ...refusal.details, retryable: false });
800
865
  }
801
- #unanswered(method, error, reads, timeoutMs) {
802
- if (isCliError(error) && error.details.proxy !== void 0)
866
+ #unanswered(method, error, reads, timeoutMs, deadline) {
867
+ if (isCliError(error) && (error.details.proxy !== void 0 || error.details.sent === false))
803
868
  return error;
804
869
  if (!reads) {
805
870
  return new CliError("outcome_unknown", `${method} got no answer; Telegram may or may not have carried it out \u2014 check before repeating it`, { operation: method, retryable: false });
@@ -807,7 +872,7 @@ var TelegramBotTransport = class {
807
872
  if (this.#signal?.aborted && this.#signal.reason?.name !== "TimeoutError") {
808
873
  return new CliError("cancelled", `${method} was cancelled`, { operation: method });
809
874
  }
810
- const timedOut = error?.name === "TimeoutError";
875
+ const timedOut = deadline.aborted || error?.name === "TimeoutError";
811
876
  return new CliError(timedOut ? "timeout" : "network_error", timedOut ? `${method} got no answer within ${timeoutMs} ms` : `${method} could not reach Telegram`, { operation: method, retryable: true });
812
877
  }
813
878
  };
@@ -880,10 +945,10 @@ var TELEGRAM_BOT = {
880
945
  checks: words,
881
946
  ...environment.keyring ? { keyring: environment.keyring } : {}
882
947
  });
883
- const fetch2 = environment.botFetch ?? (through ? proxiedFetch(through.proxy) : void 0);
948
+ const fetch = environment.botFetch ?? (through ? proxiedFetch(through.proxy) : void 0);
884
949
  const adapter = telegramBotAdapter(new TelegramBotTransport({
885
950
  token,
886
- ...fetch2 ? { fetch: fetch2 } : {},
951
+ ...fetch ? { fetch } : {},
887
952
  ...stop ? { signal: stop } : {},
888
953
  ...events ? { events } : {}
889
954
  }));
@@ -896,7 +961,7 @@ var TELEGRAM_BOT = {
896
961
  const botId = token.split(":", 1)[0] ?? "";
897
962
  if (!/^\d+$/.test(botId))
898
963
  throw new CliError("authentication_error", "the bot token has no valid bot id");
899
- const reader = await (environment.botHistory ?? (await import("./bot-history-OUDHH3NU.js")).openBotHistory)({
964
+ const reader = await (environment.botHistory ?? (await import("./bot-history-VVSWLVZM.js")).openBotHistory)({
900
965
  credentials,
901
966
  sessionPath: botSessionFile(profile, botId, env),
902
967
  token,
@@ -912,11 +977,11 @@ var TELEGRAM_BOT = {
912
977
  if (known.items[0])
913
978
  return known.items[0].id;
914
979
  const personalPath = sessionFile(profile, env);
915
- if (!existsSync2(personalPath) && !environment.adapter)
980
+ if (!existsSync3(personalPath) && !environment.adapter)
916
981
  return void 0;
917
982
  let personal;
918
983
  try {
919
- personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-4YNP6VCO.js")).TelegramAdapter.open({
984
+ personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-OJKHXGBC.js")).TelegramAdapter.open({
920
985
  credentials,
921
986
  sessionPath: personalPath,
922
987
  checks: words,
@@ -943,6 +1008,7 @@ export {
943
1008
  CONFIG,
944
1009
  resolveSettings,
945
1010
  proxiedFetch,
1011
+ guardedFetch,
946
1012
  pathsFor,
947
1013
  parseApiId,
948
1014
  parseApiHash,