@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
@@ -2,16 +2,16 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  alive
5
- } from "./chunk-O5A4IS2D.js";
5
+ } from "./chunk-QK4T3VN7.js";
6
6
  import {
7
7
  resolvePaths,
8
8
  writeSecurely
9
- } from "./chunk-U6HEZPCR.js";
9
+ } from "./chunk-4CIVGT4P.js";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-ZVVMGPBJ.js";
13
13
 
14
- // 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/background/lock.js
14
+ // 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/background/lock.js
15
15
  import { existsSync, linkSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
16
16
  import { dirname, join } from "node:path";
17
17
  var lockPath = /* @__PURE__ */ __name((app, profile, env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "serve", `${profile}.lock`), "lockPath");
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // 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/mcp/instructions.js
7
+ // 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/mcp/instructions.js
8
8
  var instructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => {
9
9
  const all = typeof profile !== "string";
10
10
  const offers = /* @__PURE__ */ __name((key) => all || writes.includes(key), "offers");
@@ -1,19 +1,19 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
- import {
4
- ACCESS_SECONDS,
5
- REFRESH_SECONDS,
6
- readStored
7
- } from "./chunk-DDSAJKPO.js";
8
3
  import {
9
4
  OAuthError,
10
5
  OAuthErrorCode
11
6
  } from "./chunk-5D4AEUVA.js";
7
+ import {
8
+ ACCESS_SECONDS,
9
+ REFRESH_SECONDS,
10
+ readStored
11
+ } from "./chunk-ISGXVFA4.js";
12
12
  import {
13
13
  __name
14
14
  } from "./chunk-ZVVMGPBJ.js";
15
15
 
16
- // 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/mcp/http/oauth.js
16
+ // 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/mcp/http/oauth.js
17
17
  import { createHash, randomBytes, randomInt, timingSafeEqual } from "node:crypto";
18
18
  import { chmodSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
19
19
  import { dirname } from "node:path";
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // 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/errors.js
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
8
8
  var errorCodes = [
9
9
  "validation_error",
10
10
  "configuration_error",
@@ -39,7 +39,7 @@ var CliError = class extends Error {
39
39
  };
40
40
  var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
41
41
 
42
- // 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/sanitize.js
42
+ // node_modules/.pnpm/@wirecat+cli-base@0.98.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
43
43
  var CONTROL = (
44
44
  // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
45
45
  /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
@@ -7,18 +7,18 @@ import {
7
7
  describeOptions,
8
8
  keyForCommand,
9
9
  metaOf
10
- } from "./chunk-GJBGZQHN.js";
10
+ } from "./chunk-RHJHOOUL.js";
11
11
  import {
12
12
  jsonSchemaOf
13
- } from "./chunk-WGGSFGNZ.js";
13
+ } from "./chunk-UR62DZ7Q.js";
14
14
  import {
15
15
  CliError
16
- } from "./chunk-VUBZFMGP.js";
16
+ } from "./chunk-E6VSARSU.js";
17
17
  import {
18
18
  __name
19
19
  } from "./chunk-ZVVMGPBJ.js";
20
20
 
21
- // 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/cli/command-contract.js
21
+ // 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/cli/command-contract.js
22
22
  var SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
23
23
  var outputOf = /* @__PURE__ */ __name((command) => {
24
24
  const entity = answerEntitySchema(command);
@@ -13,51 +13,52 @@ import {
13
13
  privateFiles,
14
14
  providerRequest,
15
15
  withSqliteSidecars
16
- } from "./chunk-SODUFMDW.js";
17
- import {
18
- hostFetch
19
- } from "./chunk-LVGX7VTD.js";
16
+ } from "./chunk-BV3HZYOX.js";
20
17
  import {
21
18
  parseProxy,
22
19
  proxyAddress,
23
20
  proxyError,
24
21
  proxyLabel,
25
22
  proxySetting
26
- } from "./chunk-FATTEYZH.js";
23
+ } from "./chunk-I4JUKRW7.js";
24
+ import {
25
+ hostFetch
26
+ } from "./chunk-PZ6H65D6.js";
27
27
  import {
28
28
  messengerContext
29
- } from "./chunk-FZKHFTKH.js";
29
+ } from "./chunk-HSRO77SW.js";
30
30
  import {
31
31
  uploadBlob
32
- } from "./chunk-6DLRATDC.js";
32
+ } from "./chunk-WSLIXJET.js";
33
33
  import {
34
34
  DESKTOP,
35
35
  TG
36
- } from "./chunk-DTTONQW7.js";
36
+ } from "./chunk-KVJSCJGZ.js";
37
37
  import {
38
38
  asFirstWord,
39
39
  environmentOf,
40
40
  fromFile,
41
41
  settingsFor
42
- } from "./chunk-GJBGZQHN.js";
42
+ } from "./chunk-RHJHOOUL.js";
43
43
  import {
44
44
  currentAttempt
45
- } from "./chunk-4MFMUBHH.js";
45
+ } from "./chunk-OH3IZ6GW.js";
46
46
  import {
47
47
  Credentials,
48
+ isMovedRun,
48
49
  pathsAreOverridden,
49
50
  resolvePaths
50
- } from "./chunk-U6HEZPCR.js";
51
+ } from "./chunk-4CIVGT4P.js";
51
52
  import {
52
53
  optional
53
- } from "./chunk-WGGSFGNZ.js";
54
+ } from "./chunk-UR62DZ7Q.js";
54
55
  import {
55
56
  importFrom
56
57
  } from "./chunk-Y5E2WNWB.js";
57
58
  import {
58
59
  CliError,
59
60
  isCliError
60
- } from "./chunk-VUBZFMGP.js";
61
+ } from "./chunk-E6VSARSU.js";
61
62
  import {
62
63
  __name
63
64
  } from "./chunk-ZVVMGPBJ.js";
@@ -71,11 +72,26 @@ import { existsSync as existsSync2 } from "node:fs";
71
72
  import { dirname } from "node:path";
72
73
 
73
74
  // dist/paths.js
74
- import { join } from "node:path";
75
+ import { userInfo } from "node:os";
76
+ import { join, resolve } from "node:path";
75
77
  var APP = TG.appName;
76
78
  var pathsFor = /* @__PURE__ */ __name((env = process.env) => resolvePaths({ appName: TG.appName, prefix: TG.envPrefix, env }), "pathsFor");
77
79
  var isolated = /* @__PURE__ */ __name((env = process.env) => pathsAreOverridden({ appName: TG.appName, prefix: TG.envPrefix, env }), "isolated");
78
80
  var sessionFile = /* @__PURE__ */ __name((profile, env = process.env) => join(pathsFor(env).state, "sessions", `${profile}.session`), "sessionFile");
81
+ var accountHome = /* @__PURE__ */ __name(() => {
82
+ try {
83
+ return userInfo().homedir;
84
+ } catch {
85
+ return void 0;
86
+ }
87
+ }, "accountHome");
88
+ var usesOwnersSession = /* @__PURE__ */ __name((profile, env = process.env, home = accountHome()) => {
89
+ if (!isMovedRun({ appName: TG.appName, prefix: TG.envPrefix, env, home }))
90
+ return false;
91
+ if (home === void 0)
92
+ return true;
93
+ return resolve(sessionFile(profile, env)) === resolve(sessionFile(profile, { HOME: home, USERPROFILE: home }));
94
+ }, "usesOwnersSession");
79
95
  var botSessionFile = /* @__PURE__ */ __name((profile, botId, env = process.env) => join(pathsFor(env).state, "bots", profile, `mtproto-${botId}.session`), "botSessionFile");
80
96
 
81
97
  // dist/telegram/credentials.js
@@ -173,7 +189,7 @@ var logOut = /* @__PURE__ */ __name(async (profile, sessionPath, context) => {
173
189
  checks: checkWords("tg", profile),
174
190
  ...keyring ? { keyring } : {}
175
191
  });
176
- const { TelegramAdapter } = await import("./adapter-ZI57T2L5.js");
192
+ const { TelegramAdapter } = await import("./adapter-GEIZVMWU.js");
177
193
  const adapter = await TelegramAdapter.open({ credentials, sessionPath, ...through ? { proxy: through.proxy } : {} });
178
194
  try {
179
195
  await adapter.logout();
@@ -192,6 +208,8 @@ var TELEGRAM_REMOVAL = {
192
208
  const sessionPath = sessionFile(profile, context.env);
193
209
  if (!existsSync(sessionPath))
194
210
  return { revoked: null, removed: [] };
211
+ if (usesOwnersSession(profile, context.env))
212
+ return { revoked: false, removed: [] };
195
213
  const revoked = context.mayRevoke ? await logOut(profile, sessionPath, context) : false;
196
214
  for (const suffix of SUFFIXES)
197
215
  rmSync(`${sessionPath}${suffix}`, { force: true });
@@ -203,7 +221,7 @@ var TELEGRAM_REMOVAL = {
203
221
  accounts: [`${profile}:api`, `proxy:profile:${profile}`]
204
222
  }
205
223
  ], "secrets"),
206
- stateFiles: /* @__PURE__ */ __name((profile, { env }) => [join2(pathsFor(env).state, "bots", profile)], "stateFiles")
224
+ stateFiles: /* @__PURE__ */ __name((profile, { env }) => usesOwnersSession(profile, env) ? [] : [join2(pathsFor(env).state, "bots", profile)], "stateFiles")
207
225
  };
208
226
 
209
227
  // dist/commands/context.js
@@ -236,7 +254,7 @@ var telegramOf = /* @__PURE__ */ __name((command, base) => {
236
254
  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" } : {});
237
255
  }
238
256
  const options = { credentials: resolved, sessionPath, ...connecting };
239
- return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-ZI57T2L5.js")).TelegramAdapter.open({
257
+ return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-GEIZVMWU.js")).TelegramAdapter.open({
240
258
  ...options,
241
259
  ...proxyOption(proxy()),
242
260
  diagnostic: /* @__PURE__ */ __name((line) => base.streams.diagnostic(line), "diagnostic"),
@@ -331,9 +349,9 @@ var appCredentialsState = /* @__PURE__ */ __name((read, env) => {
331
349
  }
332
350
  }, "appCredentialsState");
333
351
  var proxyOption = /* @__PURE__ */ __name((through) => through ? { proxy: through.proxy } : {}, "proxyOption");
334
- var proxyState = /* @__PURE__ */ __name((resolve) => {
352
+ var proxyState = /* @__PURE__ */ __name((resolve2) => {
335
353
  try {
336
- const through = resolve();
354
+ const through = resolve2();
337
355
  if (!through)
338
356
  return null;
339
357
  return {
@@ -961,7 +979,7 @@ var TELEGRAM_BOT = {
961
979
  const botId = token.split(":", 1)[0] ?? "";
962
980
  if (!/^\d+$/.test(botId))
963
981
  throw new CliError("authentication_error", "the bot token has no valid bot id");
964
- const reader = await (environment.botHistory ?? (await import("./bot-history-U3WM3A7S.js")).openBotHistory)({
982
+ const reader = await (environment.botHistory ?? (await import("./bot-history-O34YZEFH.js")).openBotHistory)({
965
983
  credentials,
966
984
  sessionPath: botSessionFile(profile, botId, env),
967
985
  token,
@@ -981,7 +999,7 @@ var TELEGRAM_BOT = {
981
999
  return void 0;
982
1000
  let personal;
983
1001
  try {
984
- personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-ZI57T2L5.js")).TelegramAdapter.open({
1002
+ personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-GEIZVMWU.js")).TelegramAdapter.open({
985
1003
  credentials,
986
1004
  sessionPath: personalPath,
987
1005
  checks: words,
@@ -1010,6 +1028,7 @@ export {
1010
1028
  proxiedFetch,
1011
1029
  guardedFetch,
1012
1030
  pathsFor,
1031
+ usesOwnersSession,
1013
1032
  parseApiId,
1014
1033
  parseApiHash,
1015
1034
  proxySecrets,
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  PRAGMAS
5
- } from "./chunk-VQL4RVXZ.js";
5
+ } from "./chunk-ZNICTHSC.js";
6
6
  import {
7
7
  CliError
8
- } from "./chunk-VUBZFMGP.js";
8
+ } from "./chunk-E6VSARSU.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // 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/store/sqlite-warning.js
13
+ // 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/store/sqlite-warning.js
14
14
  var SQLITE_WARNING = "SQLite is an experimental feature";
15
15
  var quieted = /* @__PURE__ */ new WeakSet();
16
16
  var quietSqliteWarning = /* @__PURE__ */ __name((host = process) => {
@@ -31,7 +31,7 @@ var isSqliteWarning = /* @__PURE__ */ __name((warning, options) => {
31
31
  return name === "ExperimentalWarning" && message.startsWith(SQLITE_WARNING);
32
32
  }, "isSqliteWarning");
33
33
 
34
- // 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/store/open.js
34
+ // 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/store/open.js
35
35
  var openCache = /* @__PURE__ */ __name(async (path) => {
36
36
  const database = await openFile(path);
37
37
  try {
@@ -44,12 +44,12 @@ var openCache = /* @__PURE__ */ __name(async (path) => {
44
44
  }, "openCache");
45
45
  var openFile = /* @__PURE__ */ __name((path) => "Bun" in globalThis ? openUnderBun(path) : openUnderNode(path), "openFile");
46
46
  var openUnderBun = /* @__PURE__ */ __name(async (path) => {
47
- const { openWithBunSqlite } = await import("./bun-sqlite-HSYLO46A.js");
47
+ const { openWithBunSqlite } = await import("./bun-sqlite-LCHVO3OB.js");
48
48
  return await openWithBunSqlite(path);
49
49
  }, "openUnderBun");
50
50
  var openUnderNode = /* @__PURE__ */ __name(async (path) => {
51
51
  quietSqliteWarning();
52
- const { openWithNodeSqlite } = await import("./node-sqlite-2DTVOT7L.js");
52
+ const { openWithNodeSqlite } = await import("./node-sqlite-UK5DE525.js");
53
53
  return openWithNodeSqlite(path);
54
54
  }, "openUnderNode");
55
55
  var runtime = /* @__PURE__ */ __name(() => {
@@ -16,10 +16,10 @@ import {
16
16
  servicesFor,
17
17
  throughWrapper,
18
18
  withFileLockAsync
19
- } from "./chunk-6DLRATDC.js";
19
+ } from "./chunk-WSLIXJET.js";
20
20
  import {
21
21
  servingProfiles
22
- } from "./chunk-FHWUOFWX.js";
22
+ } from "./chunk-CDSSKK5J.js";
23
23
  import {
24
24
  chatReferenceOf,
25
25
  ensureAccount,
@@ -27,7 +27,7 @@ import {
27
27
  isId,
28
28
  openStore,
29
29
  pickPerson
30
- } from "./chunk-FYHFAOPM.js";
30
+ } from "./chunk-42R4YO4L.js";
31
31
  import {
32
32
  CEILING_KEY,
33
33
  WRITE_KEYS,
@@ -47,24 +47,24 @@ import {
47
47
  rememberAccount,
48
48
  rootOf2 as rootOf,
49
49
  skipFlagFor
50
- } from "./chunk-GJBGZQHN.js";
50
+ } from "./chunk-RHJHOOUL.js";
51
51
  import {
52
52
  providerErrorKey
53
- } from "./chunk-2FXA32RJ.js";
53
+ } from "./chunk-ZL5YG2WK.js";
54
54
  import {
55
55
  isCliFailure
56
- } from "./chunk-27SVHRHV.js";
56
+ } from "./chunk-3VVZFBE2.js";
57
57
  import {
58
58
  resolvePaths
59
- } from "./chunk-U6HEZPCR.js";
59
+ } from "./chunk-4CIVGT4P.js";
60
60
  import {
61
61
  CliError
62
- } from "./chunk-VUBZFMGP.js";
62
+ } from "./chunk-E6VSARSU.js";
63
63
  import {
64
64
  __name
65
65
  } from "./chunk-ZVVMGPBJ.js";
66
66
 
67
- // 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/cli/messenger/ask.js
67
+ // 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/cli/messenger/ask.js
68
68
  import { openSync } from "node:fs";
69
69
  import { createInterface } from "node:readline";
70
70
  import { ReadStream } from "node:tty";
@@ -119,7 +119,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
119
119
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
120
120
  }, "terminalAsker");
121
121
 
122
- // 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/sends/pace.js
122
+ // 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/sends/pace.js
123
123
  import { readFileSync, renameSync, writeFileSync } from "node:fs";
124
124
  import { join } from "node:path";
125
125
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
@@ -141,12 +141,12 @@ var Pacer = class {
141
141
  }
142
142
  /** When this call may go; reserved at once, so the next caller in any process lines up behind it. */
143
143
  async reserve() {
144
- const now = this.now();
145
144
  if (this.interval === 0)
146
- return now;
145
+ return this.now();
147
146
  return withFileLockAsync(this.path, "the request pace", () => {
148
- const tat = Math.max(this.read(), now);
149
- this.write(tat + this.interval);
147
+ const now = this.now();
148
+ const tat = Math.max(this.read(now), now);
149
+ this.write(tat + this.interval, now);
150
150
  return Math.max(now, tat - this.rate.burst * this.interval);
151
151
  });
152
152
  }
@@ -155,25 +155,30 @@ var Pacer = class {
155
155
  if (this.interval === 0)
156
156
  return;
157
157
  await withFileLockAsync(this.path, "the request pace", () => {
158
- const hold = this.now() + waitMs + this.rate.burst * this.interval;
159
- this.write(Math.max(this.read(), hold));
158
+ const now = this.now();
159
+ const hold = now + waitMs + this.rate.burst * this.interval;
160
+ this.write(Math.max(this.read(now), hold), now);
160
161
  });
161
162
  }
162
163
  /** The owner's `flood clear`: every process may go again at once. */
163
164
  async reset() {
164
- await withFileLockAsync(this.path, "the request pace", () => this.write(0));
165
+ await withFileLockAsync(this.path, "the request pace", () => this.write(0, this.now()));
165
166
  }
166
- read() {
167
+ read(now) {
167
168
  try {
168
- const tat = Number(JSON.parse(readFileSync(this.path, "utf8")).tat);
169
- return Number.isFinite(tat) ? tat : 0;
169
+ const file = JSON.parse(readFileSync(this.path, "utf8"));
170
+ const tat = Number(file.tat);
171
+ if (!Number.isFinite(tat))
172
+ return 0;
173
+ const at = Number(file.at);
174
+ return Number.isFinite(at) && at > now ? now + Math.max(0, tat - at) : tat;
170
175
  } catch {
171
176
  return 0;
172
177
  }
173
178
  }
174
- write(tat) {
179
+ write(tat, at) {
175
180
  const temporary = `${this.path}.${process.pid}.tmp`;
176
- writeFileSync(temporary, JSON.stringify({ tat }), { mode: 384 });
181
+ writeFileSync(temporary, JSON.stringify({ tat, at }), { mode: 384 });
177
182
  renameSync(temporary, this.path);
178
183
  }
179
184
  };
@@ -195,8 +200,8 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
195
200
  const waitMs = at - now();
196
201
  if (waitMs <= 0)
197
202
  return;
198
- if (waitMs > LONGEST_PACE_WAIT_MS)
199
- throw new CliError("rate_limited", `${name} asked this profile to wait, ${Math.ceil(waitMs / 1e3)} s are left \u2014 nothing was sent to ${name}`, { retry_after_ms: waitMs, retry_at: new Date(at).toISOString(), remembered: true });
203
+ if (waitMs > (options.longestWaitMs ?? LONGEST_PACE_WAIT_MS))
204
+ throw new CliError("rate_limited", `this profile's next request to ${name} has to wait ${Math.ceil(waitMs / 1e3)} s more \u2014 nothing was sent to ${name}`, { retry_after_ms: waitMs, retry_at: new Date(at).toISOString(), remembered: true });
200
205
  if (waitMs >= ANNOUNCE_WAIT_MS) {
201
206
  const seconds = Math.ceil(waitMs / 1e3);
202
207
  warn?.(`waiting ${seconds} s to keep this profile's pace with ${name}`, {
@@ -209,7 +214,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
209
214
  await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
210
215
  }, "waitForTurn");
211
216
 
212
- // 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/cli/permission-keys.js
217
+ // 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/cli/permission-keys.js
213
218
  var pathOf = /* @__PURE__ */ __name((command) => {
214
219
  const words = [];
215
220
  for (let at = command; at?.parent; at = at.parent)
@@ -269,7 +274,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
269
274
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
270
275
  }, "refuseUnknownPermissionKeys");
271
276
 
272
- // 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/cli/messenger/flooded.js
277
+ // 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/cli/messenger/flooded.js
273
278
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
274
279
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
275
280
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
@@ -366,7 +371,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
366
371
  });
367
372
  }, "flooded");
368
373
 
369
- // 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/cli/messenger/observed.js
374
+ // 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/cli/messenger/observed.js
370
375
  var observed = /* @__PURE__ */ __name((messenger, events) => {
371
376
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
372
377
  const write = currentOperation();
@@ -465,7 +470,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
465
470
  counts[part] = (counts[part] ?? 0) + items.length;
466
471
  }, "byPart");
467
472
 
468
- // 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/cli/messenger/stored.js
473
+ // 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/cli/messenger/stored.js
469
474
  var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
470
475
  var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false, historyLimits, command = "cli" }) => {
471
476
  let warned = false;
@@ -1041,7 +1046,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1041
1046
  }
1042
1047
  }, "keep");
1043
1048
 
1044
- // 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/cli/messenger/context.js
1049
+ // 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/cli/messenger/context.js
1045
1050
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1046
1051
  let opened;
1047
1052
  return {
@@ -1449,6 +1454,7 @@ export {
1449
1454
  knownBeside,
1450
1455
  unknownPermissionIssues,
1451
1456
  refuseUnknownPermissionKeys,
1457
+ fill,
1452
1458
  connectedFor,
1453
1459
  refuseLocalWrite,
1454
1460
  messengerContext
@@ -4,10 +4,10 @@ import {
4
4
  check,
5
5
  pipe,
6
6
  string
7
- } from "./chunk-WGGSFGNZ.js";
7
+ } from "./chunk-UR62DZ7Q.js";
8
8
  import {
9
9
  CliError
10
- } from "./chunk-VUBZFMGP.js";
10
+ } from "./chunk-E6VSARSU.js";
11
11
  import {
12
12
  __name
13
13
  } from "./chunk-ZVVMGPBJ.js";
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // 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/cli/stdin-field.js
7
+ // 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/cli/stdin-field.js
8
8
  var fields = /* @__PURE__ */ new WeakMap();
9
9
  var readsStdin = /* @__PURE__ */ __name((command, field) => {
10
10
  fields.set(command, field);
@@ -5,15 +5,15 @@ import {
5
5
  readLock,
6
6
  releaseLock,
7
7
  takeLock
8
- } from "./chunk-FHWUOFWX.js";
8
+ } from "./chunk-CDSSKK5J.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // 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/mcp/http/state.js
13
+ // 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/mcp/http/state.js
14
14
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
15
15
 
16
- // 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/mcp/http/activity.js
16
+ // 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/mcp/http/activity.js
17
17
  import { randomBytes } from "node:crypto";
18
18
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
19
19
  import { dirname } from "node:path";
@@ -86,7 +86,7 @@ var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
86
86
  };
87
87
  }, "activityRecorder");
88
88
 
89
- // 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/mcp/http/state.js
89
+ // 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/mcp/http/state.js
90
90
  var ACCESS_SECONDS = 60 * 60;
91
91
  var REFRESH_SECONDS = 30 * 24 * 60 * 60;
92
92
  var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
@@ -0,0 +1,53 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ resolvePaths
5
+ } from "./chunk-4CIVGT4P.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-ZVVMGPBJ.js";
9
+
10
+ // 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/store/path.js
11
+ import { realpathSync } from "node:fs";
12
+ import { userInfo } from "node:os";
13
+ import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
14
+ var wirecatDirectory = /* @__PURE__ */ __name((env = process.env, platform) => resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env, ...platform ? { platform } : {} }).state, "wirecatDirectory");
15
+ var storePath = /* @__PURE__ */ __name((env = process.env) => env.MESSAGING_STORE ?? join(wirecatDirectory(env), "wirecat.db"), "storePath");
16
+ var accountHome = /* @__PURE__ */ __name(() => {
17
+ try {
18
+ return userInfo().homedir;
19
+ } catch {
20
+ return void 0;
21
+ }
22
+ }, "accountHome");
23
+ var inOwnerFolder = /* @__PURE__ */ __name((file, home = accountHome()) => {
24
+ if (!home || file === ":memory:")
25
+ return false;
26
+ const owner = wirecatDirectory({ HOME: home, USERPROFILE: home });
27
+ const within = /* @__PURE__ */ __name((path, folder) => {
28
+ const inside = relative(folder, path);
29
+ return !(inside.startsWith("..") || isAbsolute(inside));
30
+ }, "within");
31
+ return within(resolve(file), owner) || within(settled(resolve(file)), settled(owner));
32
+ }, "inOwnerFolder");
33
+ var settled = /* @__PURE__ */ __name((path) => {
34
+ try {
35
+ return realpathSync(path);
36
+ } catch {
37
+ const parent = dirname(path);
38
+ return parent === path ? path : join(settled(parent), basename(path));
39
+ }
40
+ }, "settled");
41
+ var refuseOwnerStoreInTests = /* @__PURE__ */ __name((file, env = process.env, home = accountHome()) => {
42
+ if (!env.VITEST || !inOwnerFolder(file, home))
43
+ return;
44
+ throw new Error(`a test tried to open ${file}, in the owner's real WireCat folder; give it a MESSAGING_STORE or HOME of its own`);
45
+ }, "refuseOwnerStoreInTests");
46
+
47
+ export {
48
+ wirecatDirectory,
49
+ storePath,
50
+ accountHome,
51
+ inOwnerFolder,
52
+ refuseOwnerStoreInTests
53
+ };
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  defineReasons
5
- } from "./chunk-WGGSFGNZ.js";
5
+ } from "./chunk-UR62DZ7Q.js";
6
6
 
7
7
  // dist/reasons.js
8
8
  var REASONS = defineReasons([
@@ -26,7 +26,7 @@ var REASONS = defineReasons([
26
26
  ].map(([reason, code, message]) => ({ reason, code, message, details: [] })));
27
27
 
28
28
  // dist/version.js
29
- var VERSION = "0.122.0";
29
+ var VERSION = "0.124.0";
30
30
 
31
31
  // dist/identity.js
32
32
  var TG = {
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CAPABILITY_STATEMENTS,
5
5
  storeCapable
6
- } from "./chunk-E3MFMMVY.js";
6
+ } from "./chunk-HEV23NIB.js";
7
7
  import {
8
8
  importFrom
9
9
  } from "./chunk-Y5E2WNWB.js";
@@ -11,7 +11,7 @@ import {
11
11
  __name
12
12
  } from "./chunk-ZVVMGPBJ.js";
13
13
 
14
- // 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/sqlite-runtime.js
14
+ // 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/sqlite-runtime.js
15
15
  import { spawn, spawnSync } from "node:child_process";
16
16
  import { readFileSync } from "node:fs";
17
17
  import { dirname } from "node:path";
@@ -99,11 +99,8 @@ var relay = /* @__PURE__ */ __name((child, host = process) => new Promise(() =>
99
99
  });
100
100
  }), "relay");
101
101
 
102
- // 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/cli/command-server-argv.js
103
- var COMMAND_SERVER_ARGV = ["commands", "--serve"];
104
- var isCommandServer = /* @__PURE__ */ __name((args) => args.length === COMMAND_SERVER_ARGV.length && COMMAND_SERVER_ARGV.every((word, at) => args[at] === word), "isCommandServer");
105
-
106
102
  export {
107
103
  ensureSqlite,
108
- isCommandServer
104
+ nodeRuntime,
105
+ relay
109
106
  };