@wirecat/tg-cli 0.100.0 → 0.102.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 (117) hide show
  1. package/README.md +3 -3
  2. package/dist/bin/tg.js +1 -1
  3. package/dist/bot/transport.d.ts.map +1 -1
  4. package/dist/bot/transport.js +14 -17
  5. package/dist/bot/transport.js.map +1 -1
  6. package/dist/bundle/{adapter-2LVPMFKF.js → adapter-M2HRSFFL.js} +95 -33
  7. package/dist/bundle/{all-profiles-BLTK2AAB.js → all-profiles-GOD2QNTK.js} +42 -12
  8. package/dist/bundle/{anthropic-RJE4XEOO.js → anthropic-LKU7RWMA.js} +5 -5
  9. package/dist/bundle/{bot-api-4XM3NVWG.js → bot-api-X3MPFVPL.js} +49 -53
  10. package/dist/bundle/{bot-history-WVM5GEQN.js → bot-history-OUMVVG22.js} +15 -15
  11. package/dist/bundle/{bun-UZXO2LRQ.js → bun-LIZ6MKFS.js} +2 -2
  12. package/dist/bundle/{bun-sqlite-GJLGSQIT.js → bun-sqlite-2IFQYQ44.js} +4 -4
  13. package/dist/bundle/chunk-264DAFJV.js +161 -0
  14. package/dist/bundle/{chunk-ASDZHG5I.js → chunk-2SUTCDGO.js} +2 -2
  15. package/dist/bundle/{chunk-2IM4M7Q2.js → chunk-2XBSVRT2.js} +1 -1
  16. package/dist/bundle/{chunk-Q26JMPBP.js → chunk-334UBWOB.js} +11 -11
  17. package/dist/bundle/{chunk-MQNFEVAH.js → chunk-4PDEQL6T.js} +2 -2
  18. package/dist/bundle/chunk-4QB4WDLT.js +922 -0
  19. package/dist/bundle/{chunk-66E5QDLH.js → chunk-5D6OJREA.js} +1 -1
  20. package/dist/bundle/{chunk-RDQMV6EU.js → chunk-5DFGJPT6.js} +4 -4
  21. package/dist/bundle/{chunk-GTURDJJD.js → chunk-5KU4UQBM.js} +1 -1
  22. package/dist/bundle/{chunk-JSKT5UZX.js → chunk-5VSR5ENL.js} +8 -8
  23. package/dist/bundle/{chunk-DN4QUTWU.js → chunk-AUOXTGTU.js} +1 -1
  24. package/dist/bundle/{chunk-X4Y2ROJI.js → chunk-BBC546ZA.js} +91 -2
  25. package/dist/bundle/{chunk-RER6DAHP.js → chunk-BQYTIYGB.js} +171 -148
  26. package/dist/bundle/{chunk-3S5CL55R.js → chunk-CLWYQNSC.js} +6 -6
  27. package/dist/bundle/{chunk-I6WZJVRT.js → chunk-CRZPQQHE.js} +59 -46
  28. package/dist/bundle/chunk-DE7LFMY2.js +440 -0
  29. package/dist/bundle/{chunk-GYEOQS2D.js → chunk-DG62L57H.js} +17 -17
  30. package/dist/bundle/{chunk-QU2FJMFB.js → chunk-ENE5CSVY.js} +2903 -1490
  31. package/dist/bundle/{chunk-P26LWFNZ.js → chunk-ERQDBK5I.js} +1 -1
  32. package/dist/bundle/{chunk-UD4DOZCN.js → chunk-F2TG3BA2.js} +6 -6
  33. package/dist/bundle/{chunk-4U7QOFDA.js → chunk-FBWOQMPE.js} +1698 -816
  34. package/dist/bundle/{chunk-JFJVS5JC.js → chunk-FOUE7XLK.js} +2 -2
  35. package/dist/bundle/{chunk-3QDPV34J.js → chunk-GSKFAE3I.js} +1297 -518
  36. package/dist/bundle/{chunk-BAIZAZ6Q.js → chunk-HLAZ65AW.js} +2 -2
  37. package/dist/bundle/{chunk-LI7TXFLS.js → chunk-JFSVXMN6.js} +3 -3
  38. package/dist/bundle/{chunk-6VEOR6GD.js → chunk-M5UH5CF3.js} +6 -8
  39. package/dist/bundle/{chunk-HXTTDIL7.js → chunk-MGG7JSNO.js} +3 -3
  40. package/dist/bundle/{chunk-6YLT4YVJ.js → chunk-OCWARAFE.js} +2 -2
  41. package/dist/bundle/{chunk-WE3LBRMB.js → chunk-OEJ5DMCX.js} +7 -7
  42. package/dist/bundle/{chunk-SGJYU3SB.js → chunk-OHBHHBYL.js} +3 -3
  43. package/dist/bundle/{chunk-2MXQ2EUN.js → chunk-PSH7K6TL.js} +617 -57
  44. package/dist/bundle/{chunk-H3X5LS6U.js → chunk-PYTOIDSM.js} +4 -4
  45. package/dist/bundle/{chunk-ATZ44Z77.js → chunk-Q2NYEX4A.js} +150 -52
  46. package/dist/bundle/{chunk-KE6L2UEG.js → chunk-QEPZUFPL.js} +70 -61
  47. package/dist/bundle/{chunk-CV5ASHTW.js → chunk-QL7CQ6VZ.js} +255 -80
  48. package/dist/bundle/{chunk-THVNP6S6.js → chunk-SRU3OF4R.js} +2 -2
  49. package/dist/bundle/{chunk-OOOV3JBZ.js → chunk-TV5DGHBT.js} +953 -677
  50. package/dist/bundle/{chunk-A7OBVRJV.js → chunk-TXBUDJ3P.js} +3 -3
  51. package/dist/bundle/{chunk-OW3COBN5.js → chunk-U4RRZUNP.js} +9 -9
  52. package/dist/bundle/{chunk-WKOY3POD.js → chunk-UK3GAN7Q.js} +7 -7
  53. package/dist/bundle/{chunk-BL36RR34.js → chunk-UR6ASUSG.js} +10 -7
  54. package/dist/bundle/{chunk-4VBDVZNE.js → chunk-V52SBQYF.js} +242 -19
  55. package/dist/bundle/{chunk-4YCLWWZ3.js → chunk-VUJ34PEQ.js} +11 -11
  56. package/dist/bundle/{chunk-2XUGPE5W.js → chunk-W5EB4JLV.js} +3 -3
  57. package/dist/bundle/{chunk-3KHKYYCR.js → chunk-WMOEOVWZ.js} +1 -0
  58. package/dist/bundle/{chunk-UMLPXNJI.js → chunk-WVEHUKCZ.js} +1 -1
  59. package/dist/bundle/{chunk-SYPL4PHV.js → chunk-XXTJUZMB.js} +1 -1
  60. package/dist/bundle/{chunk-SMJTL5U7.js → chunk-Y4XSWI22.js} +6 -4
  61. package/dist/bundle/{chunk-HKT5EOT5.js → chunk-YHB57PFN.js} +1 -1
  62. package/dist/bundle/{chunk-BZANDKWT.js → chunk-ZJVZXJOG.js} +2 -2
  63. package/dist/bundle/{chunk-QY3YOOTP.js → chunk-ZRNRQFTF.js} +2 -2
  64. package/dist/bundle/command-contract-A6VZN3ZR.js +31 -0
  65. package/dist/bundle/{echarts-YHSYUWLY.js → echarts-27W2CIBD.js} +2 -2
  66. package/dist/bundle/{embed-3HGI2XIW.js → embed-FGJ273X2.js} +4 -4
  67. package/dist/bundle/{embedder-2CJMZETJ.js → embedder-7ELL3CQ3.js} +7 -7
  68. package/dist/bundle/{entry-UVE53OV3.js → entry-SEE5YWIX.js} +5 -5
  69. package/dist/bundle/{first-run-6GYC2QS3.js → first-run-BD7FEC3W.js} +9 -9
  70. package/dist/bundle/first-screen-ASZV6LSA.js +29 -0
  71. package/dist/bundle/{identity-HEV5E57G.js → identity-QR4F42T6.js} +3 -3
  72. package/dist/bundle/{instructions-5UVAXSQV.js → instructions-L74K64PV.js} +1 -1
  73. package/dist/bundle/{mcp-NWXBVNUA.js → mcp-4Y37G2UY.js} +2 -2
  74. package/dist/bundle/{node-YHYEGYVE.js → node-RSL3HANO.js} +2 -2
  75. package/dist/bundle/{node-sqlite-CQ33A3R2.js → node-sqlite-7R3PYQGJ.js} +4 -4
  76. package/dist/bundle/{oauth-OB3JFAD7.js → oauth-4ESGXF6U.js} +7 -7
  77. package/dist/bundle/{open-JHGZIXU2.js → open-DFYEUGTA.js} +3 -3
  78. package/dist/bundle/{process-PSKS3N5B.js → process-RMV3AKLB.js} +1 -1
  79. package/dist/bundle/{program-RPYVPNRX.js → program-PIUYQHBF.js} +62 -67
  80. package/dist/bundle/{prompt-7BXUMJGG.js → prompt-H7GYQQLL.js} +4 -4
  81. package/dist/bundle/{proxy-transport-3EEMW2HW.js → proxy-transport-G4MA6BGU.js} +4 -4
  82. package/dist/bundle/{recognize-YMZPL47R.js → recognize-3GMOLZF4.js} +5 -5
  83. package/dist/bundle/{remote-LQ3Q22NG.js → remote-IRWTCI2B.js} +5 -5
  84. package/dist/bundle/{rerank-SM7IYVXJ.js → rerank-W3OSXXBN.js} +5 -5
  85. package/dist/bundle/{serve-GHUEP5H5.js → serve-ZCPO44NO.js} +24 -9
  86. package/dist/bundle/{server-A45HVXQY.js → server-FXU4QFRB.js} +42 -39
  87. package/dist/bundle/{server-K2BQPPHN.js → server-YWL4HDOP.js} +77 -68
  88. package/dist/bundle/{state-WIOL52GZ.js → state-MJPTDIB5.js} +9 -5
  89. package/dist/bundle/{store-XE5AKUJZ.js → store-6VNQG56O.js} +10 -10
  90. package/dist/bundle/store-maintenance-command-62TQTMER.js +43 -0
  91. package/dist/bundle/tg.js +4 -4
  92. package/dist/commands/context.d.ts.map +1 -1
  93. package/dist/commands/context.js +2 -0
  94. package/dist/commands/context.js.map +1 -1
  95. package/dist/program.js +1 -1
  96. package/dist/program.js.map +1 -1
  97. package/dist/telegram/errors.js +1 -1
  98. package/dist/telegram/errors.js.map +1 -1
  99. package/dist/telegram/sending.d.ts.map +1 -1
  100. package/dist/telegram/sending.js +52 -3
  101. package/dist/telegram/sending.js.map +1 -1
  102. package/dist/version.d.ts +1 -1
  103. package/dist/version.js +1 -1
  104. package/install/windows.ps1 +1 -1
  105. package/package.json +3 -3
  106. package/skills/tg-cli/SKILL.md +4 -4
  107. package/dist/bundle/chunk-3N6LXAPE.js +0 -724
  108. package/dist/bundle/chunk-DVOUKGFK.js +0 -1950
  109. package/dist/bundle/chunk-MUEXF4ME.js +0 -582
  110. package/dist/bundle/chunk-U7LXA4SO.js +0 -1007
  111. package/dist/bundle/chunk-V4JSVH4M.js +0 -190
  112. package/dist/bundle/chunk-YG7PNCSW.js +0 -230
  113. package/dist/bundle/chunk-Z2FHEIXN.js +0 -63
  114. package/dist/bundle/command-contract-AIVKJYIR.js +0 -31
  115. package/dist/bundle/first-screen-HRRLVLOG.js +0 -29
  116. package/dist/bundle/store-maintenance-command-YS5E7VUN.js +0 -46
  117. /package/dist/bundle/{chunk-3MVHRZWR.js → chunk-2SJOUK6J.js} +0 -0
@@ -1,73 +1,69 @@
1
1
  import { createRequire as __tgRequire } from "node:module";
2
2
  const require = __tgRequire(import.meta.url);
3
+ import {
4
+ TELEGRAM_BOT
5
+ } from "./chunk-4QB4WDLT.js";
3
6
  import {
4
7
  BotTokenStore,
5
8
  ChatRegistry,
6
- TELEGRAM_BOT,
7
9
  apiPlainJson,
8
10
  botContext,
9
11
  checkApiBody,
10
12
  checkApiParameter,
11
13
  generatedApiCommand,
12
14
  prepareRpcApiBody
13
- } from "./chunk-QU2FJMFB.js";
14
- import "./chunk-DVOUKGFK.js";
15
- import "./chunk-2IM4M7Q2.js";
16
- import "./chunk-DN4QUTWU.js";
17
- import "./chunk-I6WZJVRT.js";
18
- import "./chunk-66E5QDLH.js";
19
- import "./chunk-4VBDVZNE.js";
20
- import "./chunk-YG7PNCSW.js";
21
- import "./chunk-CV5ASHTW.js";
22
- import "./chunk-V4JSVH4M.js";
23
- import "./chunk-2MXQ2EUN.js";
24
- import "./chunk-MUEXF4ME.js";
25
- import "./chunk-4U7QOFDA.js";
15
+ } from "./chunk-ENE5CSVY.js";
16
+ import "./chunk-2XBSVRT2.js";
17
+ import "./chunk-AUOXTGTU.js";
18
+ import "./chunk-CRZPQQHE.js";
19
+ import "./chunk-5D6OJREA.js";
20
+ import "./chunk-V52SBQYF.js";
21
+ import "./chunk-QL7CQ6VZ.js";
22
+ import "./chunk-PSH7K6TL.js";
26
23
  import {
27
24
  newOperationId,
28
25
  readUpload,
29
26
  uploadBytes
30
- } from "./chunk-3N6LXAPE.js";
31
- import "./chunk-RDQMV6EU.js";
32
- import "./chunk-WKOY3POD.js";
27
+ } from "./chunk-FBWOQMPE.js";
28
+ import "./chunk-5DFGJPT6.js";
29
+ import "./chunk-UK3GAN7Q.js";
33
30
  import "./chunk-ZZLKX62Z.js";
34
- import "./chunk-6VEOR6GD.js";
35
- import "./chunk-RER6DAHP.js";
36
- import {
37
- overrideSharedContract,
38
- ownerOnlyOption
39
- } from "./chunk-3QDPV34J.js";
31
+ import "./chunk-M5UH5CF3.js";
32
+ import "./chunk-BQYTIYGB.js";
40
33
  import {
41
34
  DEFAULT_PERMISSIONS,
42
35
  guardedWrite,
43
- levelFor
44
- } from "./chunk-U7LXA4SO.js";
45
- import "./chunk-SMJTL5U7.js";
46
- import "./chunk-Q26JMPBP.js";
47
- import "./chunk-H3X5LS6U.js";
48
- import "./chunk-GTURDJJD.js";
49
- import "./chunk-SGJYU3SB.js";
50
- import "./chunk-4YCLWWZ3.js";
51
- import "./chunk-ASDZHG5I.js";
52
- import "./chunk-JFJVS5JC.js";
53
- import "./chunk-Z2FHEIXN.js";
54
- import "./chunk-2XUGPE5W.js";
55
- import "./chunk-UMLPXNJI.js";
56
- import "./chunk-THVNP6S6.js";
57
- import "./chunk-6YLT4YVJ.js";
58
- import "./chunk-LI7TXFLS.js";
59
- import "./chunk-OW3COBN5.js";
60
- import "./chunk-OOOV3JBZ.js";
61
- import "./chunk-KE6L2UEG.js";
62
- import "./chunk-JSKT5UZX.js";
63
- import "./chunk-UD4DOZCN.js";
64
- import "./chunk-3MVHRZWR.js";
65
- import "./chunk-QY3YOOTP.js";
66
- import "./chunk-3S5CL55R.js";
67
- import "./chunk-HKT5EOT5.js";
68
- import "./chunk-HXTTDIL7.js";
69
- import "./chunk-BAIZAZ6Q.js";
70
- import "./chunk-GYEOQS2D.js";
36
+ levelFor,
37
+ overrideSharedContract,
38
+ ownerOnlyOption
39
+ } from "./chunk-GSKFAE3I.js";
40
+ import "./chunk-Y4XSWI22.js";
41
+ import "./chunk-DE7LFMY2.js";
42
+ import "./chunk-334UBWOB.js";
43
+ import "./chunk-PYTOIDSM.js";
44
+ import "./chunk-5KU4UQBM.js";
45
+ import "./chunk-OHBHHBYL.js";
46
+ import "./chunk-VUJ34PEQ.js";
47
+ import "./chunk-2SUTCDGO.js";
48
+ import "./chunk-FOUE7XLK.js";
49
+ import "./chunk-264DAFJV.js";
50
+ import "./chunk-W5EB4JLV.js";
51
+ import "./chunk-WVEHUKCZ.js";
52
+ import "./chunk-SRU3OF4R.js";
53
+ import "./chunk-OCWARAFE.js";
54
+ import "./chunk-JFSVXMN6.js";
55
+ import "./chunk-U4RRZUNP.js";
56
+ import "./chunk-TV5DGHBT.js";
57
+ import "./chunk-QEPZUFPL.js";
58
+ import "./chunk-5VSR5ENL.js";
59
+ import "./chunk-F2TG3BA2.js";
60
+ import "./chunk-2SJOUK6J.js";
61
+ import "./chunk-ZRNRQFTF.js";
62
+ import "./chunk-CLWYQNSC.js";
63
+ import "./chunk-YHB57PFN.js";
64
+ import "./chunk-MGG7JSNO.js";
65
+ import "./chunk-HLAZ65AW.js";
66
+ import "./chunk-DG62L57H.js";
71
67
  import {
72
68
  CliError,
73
69
  array,
@@ -83,7 +79,7 @@ import {
83
79
  string,
84
80
  transform,
85
81
  union
86
- } from "./chunk-WE3LBRMB.js";
82
+ } from "./chunk-OEJ5DMCX.js";
87
83
  import "./chunk-BJG6JA5U.js";
88
84
  import {
89
85
  __name
@@ -34548,7 +34544,7 @@ If you'd like to make sure that the webhook was set by you, you can specify secr
34548
34544
  }
34549
34545
  ];
34550
34546
 
34551
- // node_modules/.pnpm/@wirecat+cli-base@0.63.0_commander@15.0.0_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/codegen/runtime.js
34547
+ // node_modules/.pnpm/@wirecat+cli-base@0.64.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/codegen/runtime.js
34552
34548
  var isLossless = /* @__PURE__ */ __name((input) => typeof input === "object" && input !== null && input.isLosslessNumber === true && typeof input.value === "string", "isLossless");
34553
34549
  var INTEGER = /^-?\d+$/;
34554
34550
  var INT64_MIN = -(2n ** 63n);
@@ -5,26 +5,26 @@ import {
5
5
  toCliError,
6
6
  toHistoryChannel,
7
7
  toHistoryMessages
8
- } from "./chunk-A7OBVRJV.js";
8
+ } from "./chunk-TXBUDJ3P.js";
9
9
  import {
10
10
  proxiedTransport
11
- } from "./chunk-BZANDKWT.js";
12
- import "./chunk-2IM4M7Q2.js";
13
- import "./chunk-RDQMV6EU.js";
14
- import "./chunk-SMJTL5U7.js";
15
- import "./chunk-OOOV3JBZ.js";
16
- import "./chunk-KE6L2UEG.js";
17
- import "./chunk-JSKT5UZX.js";
18
- import "./chunk-UD4DOZCN.js";
19
- import "./chunk-3MVHRZWR.js";
20
- import "./chunk-QY3YOOTP.js";
21
- import "./chunk-3S5CL55R.js";
22
- import "./chunk-HKT5EOT5.js";
23
- import "./chunk-GYEOQS2D.js";
11
+ } from "./chunk-ZJVZXJOG.js";
12
+ import "./chunk-2XBSVRT2.js";
13
+ import "./chunk-5DFGJPT6.js";
14
+ import "./chunk-Y4XSWI22.js";
15
+ import "./chunk-TV5DGHBT.js";
16
+ import "./chunk-QEPZUFPL.js";
17
+ import "./chunk-5VSR5ENL.js";
18
+ import "./chunk-F2TG3BA2.js";
19
+ import "./chunk-2SJOUK6J.js";
20
+ import "./chunk-ZRNRQFTF.js";
21
+ import "./chunk-CLWYQNSC.js";
22
+ import "./chunk-YHB57PFN.js";
23
+ import "./chunk-DG62L57H.js";
24
24
  import {
25
25
  CliError,
26
26
  isCliError
27
- } from "./chunk-WE3LBRMB.js";
27
+ } from "./chunk-OEJ5DMCX.js";
28
28
  import "./chunk-BJG6JA5U.js";
29
29
  import {
30
30
  __name
@@ -18,12 +18,12 @@ import {
18
18
  jitCompatCheck,
19
19
  refineSqliteCodecs,
20
20
  sql
21
- } from "./chunk-HKT5EOT5.js";
21
+ } from "./chunk-YHB57PFN.js";
22
22
  import {
23
23
  __name
24
24
  } from "./chunk-AFV74GK3.js";
25
25
 
26
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
26
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
27
27
  import { Database } from "bun:sqlite";
28
28
  var bunSQLiteCodecs = refineSqliteCodecs({
29
29
  "integer:boolean": { normalize: booleanFromInteger },
@@ -3,9 +3,9 @@ const require = __tgRequire(import.meta.url);
3
3
  import {
4
4
  loadVectorExtension,
5
5
  vectorExtension
6
- } from "./chunk-MQNFEVAH.js";
7
- import "./chunk-GYEOQS2D.js";
8
- import "./chunk-WE3LBRMB.js";
6
+ } from "./chunk-4PDEQL6T.js";
7
+ import "./chunk-DG62L57H.js";
8
+ import "./chunk-OEJ5DMCX.js";
9
9
  import {
10
10
  importFrom
11
11
  } from "./chunk-BJG6JA5U.js";
@@ -13,7 +13,7 @@ import {
13
13
  __name
14
14
  } from "./chunk-AFV74GK3.js";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
17
17
  var customised = false;
18
18
  var ownLibrary = /* @__PURE__ */ __name(async () => {
19
19
  try {
@@ -0,0 +1,161 @@
1
+ import { createRequire as __tgRequire } from "node:module";
2
+ const require = __tgRequire(import.meta.url);
3
+ import {
4
+ holdLock,
5
+ readLock,
6
+ releaseLock,
7
+ takeLock
8
+ } from "./chunk-W5EB4JLV.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-AFV74GK3.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
14
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
15
+
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
17
+ import { randomBytes } from "node:crypto";
18
+ import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
19
+ import { dirname } from "node:path";
20
+ var WRITE_EVERY_MS = 2e3;
21
+ var TOOL_NAME = /^[A-Za-z0-9_.-]{1,64}$/;
22
+ var httpActivityFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.activity.json`, "httpActivityFile");
23
+ var localDay = /* @__PURE__ */ __name((ms) => {
24
+ const d = new Date(ms);
25
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
26
+ }, "localDay");
27
+ var readActivity = /* @__PURE__ */ __name((path) => {
28
+ if (!existsSync(path))
29
+ return {};
30
+ try {
31
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
32
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
33
+ } catch {
34
+ return {};
35
+ }
36
+ }, "readActivity");
37
+ var calledTools = /* @__PURE__ */ __name((body) => (Array.isArray(body) ? body : [body]).flatMap((message) => {
38
+ if (!message || typeof message !== "object")
39
+ return [];
40
+ const { method, params } = message;
41
+ const name = params?.name;
42
+ return method === "tools/call" && typeof name === "string" && TOOL_NAME.test(name) ? [name] : [];
43
+ }), "calledTools");
44
+ var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
45
+ const activity = readActivity(path);
46
+ let timer;
47
+ const write = /* @__PURE__ */ __name(() => {
48
+ timer = void 0;
49
+ try {
50
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
51
+ const temporary = `${path}.${randomBytes(8).toString("hex")}.tmp`;
52
+ writeFileSync(temporary, JSON.stringify(activity), { mode: 384, flag: "wx" });
53
+ chmodSync(temporary, 384);
54
+ renameSync(temporary, path);
55
+ } catch {
56
+ }
57
+ }, "write");
58
+ return {
59
+ record: /* @__PURE__ */ __name((clientId, tools) => {
60
+ const at = now();
61
+ const iso = new Date(at).toISOString();
62
+ const day = localDay(at);
63
+ const before = activity[clientId];
64
+ const counted = before?.day === day ? before.toolCalls : 0;
65
+ const last = tools.at(-1);
66
+ activity[clientId] = {
67
+ lastRequestAt: iso,
68
+ day,
69
+ toolCalls: counted + tools.length,
70
+ ...last ? { lastTool: last, lastToolAt: iso } : before?.lastTool ? { lastTool: before.lastTool, ...before.lastToolAt ? { lastToolAt: before.lastToolAt } : {} } : {}
71
+ };
72
+ if (last) {
73
+ clearTimeout(timer);
74
+ write();
75
+ } else if (!timer) {
76
+ timer = setTimeout(write, WRITE_EVERY_MS);
77
+ timer.unref();
78
+ }
79
+ }, "record"),
80
+ flush: /* @__PURE__ */ __name(() => {
81
+ if (!timer)
82
+ return;
83
+ clearTimeout(timer);
84
+ write();
85
+ }, "flush")
86
+ };
87
+ }, "activityRecorder");
88
+
89
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
90
+ var ACCESS_SECONDS = 60 * 60;
91
+ var REFRESH_SECONDS = 30 * 24 * 60 * 60;
92
+ var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
93
+ var mcpHttpMarker = /* @__PURE__ */ __name((envPrefix) => `${envPrefix}_MCP_HTTP`, "mcpHttpMarker");
94
+ var httpLogFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.log`, "httpLogFile");
95
+ var httpLockFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.lock`, "httpLockFile");
96
+ var httpLaunchFile = /* @__PURE__ */ __name((lockFile) => `${lockFile.replace(/\.lock$/, "")}.launch.json`, "httpLaunchFile");
97
+ var readHttpLaunch = /* @__PURE__ */ __name((path) => {
98
+ try {
99
+ const launch = JSON.parse(readFileSync2(path, "utf8"));
100
+ return typeof launch.invocation === "string" && Array.isArray(launch.argv) && launch.argv.every((word) => typeof word === "string") && typeof launch.env === "object" && launch.env !== null ? launch : void 0;
101
+ } catch {
102
+ return void 0;
103
+ }
104
+ }, "readHttpLaunch");
105
+ var readHttpLock = /* @__PURE__ */ __name((path) => {
106
+ const lock = readLock(path);
107
+ return lock && typeof lock.port === "number" && typeof lock.publicUrl === "string" ? lock : void 0;
108
+ }, "readHttpLock");
109
+ var httpLock = /* @__PURE__ */ __name((path, first) => {
110
+ let current = first;
111
+ const held = takeLock(path, current);
112
+ return {
113
+ held,
114
+ update: /* @__PURE__ */ __name((change) => {
115
+ current = { ...current, ...change };
116
+ holdLock(path, current);
117
+ }, "update"),
118
+ release: /* @__PURE__ */ __name(() => releaseLock(path), "release")
119
+ };
120
+ }, "httpLock");
121
+ var signedInClients = /* @__PURE__ */ __name((tokenFile, now = Date.now()) => {
122
+ const seconds = Math.floor(now / 1e3);
123
+ const { clients, tokens } = readStored(tokenFile);
124
+ const activity = readActivity(httpActivityFile(tokenFile));
125
+ const today = localDay(now);
126
+ const last = /* @__PURE__ */ new Map();
127
+ for (const token of tokens) {
128
+ if (token.expiresAt <= seconds)
129
+ continue;
130
+ const issued = token.expiresAt - (token.kind === "access" ? ACCESS_SECONDS : REFRESH_SECONDS);
131
+ last.set(token.clientId, Math.max(last.get(token.clientId) ?? 0, issued));
132
+ }
133
+ return clients.filter((client) => last.has(client.id)).map((client) => {
134
+ const did = activity[client.id];
135
+ return {
136
+ claimedName: client.name ?? null,
137
+ lastLoginAt: new Date((last.get(client.id) ?? 0) * 1e3).toISOString(),
138
+ lastRequestAt: did?.lastRequestAt ?? null,
139
+ lastTool: did?.lastTool ?? null,
140
+ lastToolAt: did?.lastToolAt ?? null,
141
+ toolCallsToday: did?.day === today ? did.toolCalls : 0
142
+ };
143
+ }).sort((a, b) => b.lastLoginAt.localeCompare(a.lastLoginAt));
144
+ }, "signedInClients");
145
+
146
+ export {
147
+ httpActivityFile,
148
+ calledTools,
149
+ activityRecorder,
150
+ ACCESS_SECONDS,
151
+ REFRESH_SECONDS,
152
+ readStored,
153
+ mcpHttpMarker,
154
+ httpLogFile,
155
+ httpLockFile,
156
+ httpLaunchFile,
157
+ readHttpLaunch,
158
+ readHttpLock,
159
+ httpLock,
160
+ signedInClients
161
+ };
@@ -2,12 +2,12 @@ import { createRequire as __tgRequire } from "node:module";
2
2
  const require = __tgRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-WE3LBRMB.js";
5
+ } from "./chunk-OEJ5DMCX.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-AFV74GK3.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/ports/app.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/ports/app.js
11
11
  var envName = /* @__PURE__ */ __name((app, name) => `${app.envPrefix}_${name}`, "envName");
12
12
  var readOnlyLockOf = /* @__PURE__ */ __name((app, env) => {
13
13
  const name = envName(app, "READ_ONLY");
@@ -5,7 +5,7 @@ import {
5
5
  check,
6
6
  pipe,
7
7
  string
8
- } from "./chunk-WE3LBRMB.js";
8
+ } from "./chunk-OEJ5DMCX.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-AFV74GK3.js";
@@ -3,28 +3,28 @@ const require = __tgRequire(import.meta.url);
3
3
  import {
4
4
  installerOf,
5
5
  updateCommand
6
- } from "./chunk-H3X5LS6U.js";
6
+ } from "./chunk-PYTOIDSM.js";
7
7
  import {
8
8
  QUESTIONS,
9
9
  readSetupAnswers,
10
10
  unanswered,
11
11
  writeSetupAnswers
12
- } from "./chunk-SGJYU3SB.js";
12
+ } from "./chunk-OHBHHBYL.js";
13
13
  import {
14
14
  DEFAULT_STEMMERS,
15
15
  LANGUAGES
16
- } from "./chunk-JSKT5UZX.js";
16
+ } from "./chunk-5VSR5ENL.js";
17
17
  import {
18
18
  sharedConfigPath
19
- } from "./chunk-UD4DOZCN.js";
19
+ } from "./chunk-F2TG3BA2.js";
20
20
  import {
21
21
  storePath
22
- } from "./chunk-QY3YOOTP.js";
22
+ } from "./chunk-ZRNRQFTF.js";
23
23
  import {
24
24
  __name
25
25
  } from "./chunk-AFV74GK3.js";
26
26
 
27
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/cli/first-run.js
27
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/cli/first-run.js
28
28
  import { spawnSync } from "node:child_process";
29
29
  import { accessSync, constants, realpathSync } from "node:fs";
30
30
  import { delimiter, join } from "node:path";
@@ -82,7 +82,7 @@ var suggested = /* @__PURE__ */ __name((env, contentLanguages) => {
82
82
  return (own.length ? own : LANGUAGES.filter(({ code }) => code === "en" || code === system)).map(({ name }) => name);
83
83
  }, "suggested");
84
84
  var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLanguages }) => {
85
- const { openStore } = await import("./store-XE5AKUJZ.js");
85
+ const { openStore } = await import("./store-6VNQG56O.js");
86
86
  const store = await openStore({ env });
87
87
  let rebuild = false;
88
88
  try {
@@ -111,8 +111,8 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
111
111
  if (!rebuild)
112
112
  return;
113
113
  const [{ openCache }, { buildStems }] = await Promise.all([
114
- import("./open-JHGZIXU2.js"),
115
- import("./store-maintenance-command-YS5E7VUN.js")
114
+ import("./open-DFYEUGTA.js"),
115
+ import("./store-maintenance-command-62TQTMER.js")
116
116
  ]);
117
117
  const database = await openCache(storePath(env));
118
118
  try {
@@ -124,7 +124,7 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
124
124
  var askTools = /* @__PURE__ */ __name(async (run) => {
125
125
  const { command, env, io } = run;
126
126
  const installed = run.installed ?? ((name) => onPath(name, env));
127
- const { WIRECAT_TOOLS } = await import("./first-screen-HRRLVLOG.js");
127
+ const { WIRECAT_TOOLS } = await import("./first-screen-ASZV6LSA.js");
128
128
  const others = WIRECAT_TOOLS.filter((tool) => tool.command !== command);
129
129
  const missing = others.filter((tool) => !installed(tool.command));
130
130
  io.say("Other WireCat tools \u2014 they share this store, so one search finds everything:");
@@ -197,7 +197,7 @@ var setupAtStart = /* @__PURE__ */ __name(async (start) => {
197
197
  contentLanguages: start.contentLanguages,
198
198
  all: start.path[0] === "setup",
199
199
  io: {
200
- ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-7BXUMJGG.js")).readSecret(prompt, { input, echo: true }), "ask"),
200
+ ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-H7GYQQLL.js")).readSecret(prompt, { input, echo: true }), "ask"),
201
201
  say: /* @__PURE__ */ __name((text) => process.stderr.write(`${text}
202
202
  `), "say")
203
203
  }
@@ -2,7 +2,7 @@ import { createRequire as __tgRequire } from "node:module";
2
2
  const require = __tgRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-WE3LBRMB.js";
5
+ } from "./chunk-OEJ5DMCX.js";
6
6
  import {
7
7
  importFrom
8
8
  } from "./chunk-BJG6JA5U.js";
@@ -10,7 +10,7 @@ import {
10
10
  __name
11
11
  } from "./chunk-AFV74GK3.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.452.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.63.0_commander@15._e609b9d6c8060966368a91e843fe8bd2/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
14
14
  import { readFileSync } from "node:fs";
15
15
  var musl = /* @__PURE__ */ __name(() => {
16
16
  if (process.platform !== "linux")