@wirecat/tg-cli 0.117.0 → 0.119.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 +7621 -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-VNQ72MBK.js → adapter-NEQQOANM.js} +47 -48
  7. package/dist/bundle/{all-profiles-3W2UQTCK.js → all-profiles-QFT46FTF.js} +10 -10
  8. package/dist/bundle/{anthropic-DFUW2KTG.js → anthropic-UJ4RYCWU.js} +10 -8
  9. package/dist/bundle/{app-server-5XJIMLHB.js → app-server-NE3EL5IK.js} +43 -43
  10. package/dist/bundle/{bot-api-HRRBF3W6.js → bot-api-D4H5SCP5.js} +49 -49
  11. package/dist/bundle/{bot-history-GBH5XE4N.js → bot-history-KF2PUMWA.js} +18 -18
  12. package/dist/bundle/{bun-ZMOYGG6F.js → bun-F7MH5YKA.js} +2 -2
  13. package/dist/bundle/{bun-sqlite-6FZFMA7K.js → bun-sqlite-FYDJXUHF.js} +5 -5
  14. package/dist/bundle/{chunk-HZZGOLGP.js → chunk-23JGV5FQ.js} +11 -11
  15. package/dist/bundle/{chunk-PTIB7NEE.js → chunk-2BAJ6ORN.js} +1 -1
  16. package/dist/bundle/{chunk-L5WNE4WS.js → chunk-3EQ7USKJ.js} +2 -2
  17. package/dist/bundle/{chunk-YIXXH74F.js → chunk-3K65KTXD.js} +16 -3
  18. package/dist/bundle/{chunk-66FZBLRJ.js → chunk-4AACB23H.js} +13 -13
  19. package/dist/bundle/{chunk-NUCDEOFC.js → chunk-5EHJWIW4.js} +2 -2
  20. package/dist/bundle/{chunk-VW6BF6M7.js → chunk-5FEEFXJA.js} +1 -1
  21. package/dist/bundle/{chunk-HWYSRB64.js → chunk-65BWMPCI.js} +2 -2
  22. package/dist/bundle/{chunk-Q7O4CQDO.js → chunk-6ERQJRL2.js} +2 -2
  23. package/dist/bundle/{chunk-3GRX7WP6.js → chunk-6K5R3YPN.js} +2 -2
  24. package/dist/bundle/{chunk-KVTLT4V7.js → chunk-6OE5I3PR.js} +6 -6
  25. package/dist/bundle/{chunk-B2YPB5AE.js → chunk-72QLHHSO.js} +93 -29
  26. package/dist/bundle/{chunk-FEKXHILZ.js → chunk-7C6POLLO.js} +1 -1
  27. package/dist/bundle/{chunk-F6KBVIJP.js → chunk-7VUNJDYU.js} +22 -14
  28. package/dist/bundle/{chunk-EZTYJ43A.js → chunk-BXIPT2BO.js} +1 -1
  29. package/dist/bundle/{chunk-GFHNQBD2.js → chunk-CIDFV3IT.js} +1 -1
  30. package/dist/bundle/{chunk-C6TUVV7E.js → chunk-CX2WCEQU.js} +552 -222
  31. package/dist/bundle/{chunk-UYK5AXSW.js → chunk-D4Y2KL5V.js} +4 -4
  32. package/dist/bundle/{chunk-EL6I4WTB.js → chunk-D6YTBJY6.js} +1 -1
  33. package/dist/bundle/{chunk-X3CD475M.js → chunk-DQELQ7BL.js} +419 -198
  34. package/dist/bundle/{chunk-4JDGN6OD.js → chunk-F223KYWG.js} +1 -1
  35. package/dist/bundle/{chunk-RDH2QBUE.js → chunk-FJKP6MMP.js} +5 -3
  36. package/dist/bundle/{chunk-2452HCIV.js → chunk-FQ3C6DFV.js} +3 -3
  37. package/dist/bundle/{chunk-7Y3RUEVY.js → chunk-FQZSS3AB.js} +6 -6
  38. package/dist/bundle/{chunk-V47NPSSV.js → chunk-FRW3CWC7.js} +31 -29
  39. package/dist/bundle/{chunk-AG6HWPQP.js → chunk-G3MQOH6Z.js} +3 -3
  40. package/dist/bundle/{chunk-RDSLSV4M.js → chunk-HGMMRT4G.js} +2 -2
  41. package/dist/bundle/{chunk-SQXB5ZUZ.js → chunk-HPQQ76WF.js} +23 -5
  42. package/dist/bundle/{chunk-3RJYLN5V.js → chunk-HV5YYAJX.js} +158 -20
  43. package/dist/bundle/{chunk-3MQOLYAN.js → chunk-IAGX5VFL.js} +4 -4
  44. package/dist/bundle/{chunk-TFBHDIGY.js → chunk-JKKEMVW3.js} +18 -4
  45. package/dist/bundle/{chunk-P3ASN72F.js → chunk-KBHK5UGL.js} +1 -1
  46. package/dist/bundle/{chunk-EPCFXKTX.js → chunk-KC4MQRAB.js} +34 -8
  47. package/dist/bundle/{chunk-VMCQGZIA.js → chunk-L33G5ARH.js} +2801 -718
  48. package/dist/bundle/{chunk-V2T7NYNU.js → chunk-MDLSI3EN.js} +25 -23
  49. package/dist/bundle/chunk-NDSRND3E.js +138 -0
  50. package/dist/bundle/{chunk-HORGORHK.js → chunk-OG2CG2GS.js} +12 -12
  51. package/dist/bundle/{chunk-ZPILMEFY.js → chunk-QD27C3BG.js} +8 -21
  52. package/dist/bundle/{chunk-QOGYHU3Q.js → chunk-QG5U6HCI.js} +61 -21
  53. package/dist/bundle/{chunk-TG6ZYL4B.js → chunk-QQ3QZFFD.js} +8 -8
  54. package/dist/bundle/{chunk-56Q5JV3Z.js → chunk-QTFXYR5W.js} +24 -2
  55. package/dist/bundle/{chunk-FAHHERJ7.js → chunk-RGU2G3KL.js} +4 -4
  56. package/dist/bundle/{chunk-Z4QKLHJW.js → chunk-ROOUBFUW.js} +10148 -3906
  57. package/dist/bundle/{chunk-MLHKQDUN.js → chunk-RUNFFBJU.js} +872 -562
  58. package/dist/bundle/{chunk-G7B5UIE7.js → chunk-S3HAFJVC.js} +37 -11
  59. package/dist/bundle/{chunk-BXTDAGM4.js → chunk-SMHLQEE2.js} +2 -2
  60. package/dist/bundle/{chunk-JWIUK3SK.js → chunk-TEZKCH5B.js} +2 -2
  61. package/dist/bundle/{chunk-VRDVXXXD.js → chunk-TKHEVAEG.js} +9 -8
  62. package/dist/bundle/{chunk-MP7M6FFU.js → chunk-TT4CIXVH.js} +6 -6
  63. package/dist/bundle/{chunk-M7V5XRM6.js → chunk-UBCLVM7C.js} +3 -3
  64. package/dist/bundle/{chunk-YHZFGUAP.js → chunk-V5Z2JO6X.js} +19 -19
  65. package/dist/bundle/{chunk-6GFUL4OU.js → chunk-W2BIBPRU.js} +237 -38
  66. package/dist/bundle/{chunk-6HRN7BW6.js → chunk-X5PDWCG7.js} +1 -1
  67. package/dist/bundle/{chunk-AUBRELCM.js → chunk-XDMJVWWR.js} +3 -3
  68. package/dist/bundle/{chunk-EA2PGDER.js → chunk-XM3P7LLT.js} +2 -2
  69. package/dist/bundle/{chunk-UGPZCNYC.js → chunk-YMWPRHXG.js} +1411 -809
  70. package/dist/bundle/{chunk-2XLKZL6K.js → chunk-Z4CGZAFQ.js} +65 -31
  71. package/dist/bundle/{chunk-XW5C4TI7.js → chunk-ZEQ7ONPZ.js} +47 -1
  72. package/dist/bundle/command-contract-7TGMZRBE.js +33 -0
  73. package/dist/bundle/{decode-YMSOY2AY.js → decode-5N4ERCHC.js} +5 -5
  74. package/dist/bundle/{dispatch-OP27MWX5.js → dispatch-TBGXBDHE.js} +10 -10
  75. package/dist/bundle/{echarts-7XS55TQY.js → echarts-YDEBAMXT.js} +2 -2
  76. package/dist/bundle/{embed-QTOE7NN3.js → embed-T7H62XFR.js} +6 -6
  77. package/dist/bundle/{embedder-KBBRYSNH.js → embedder-AW3O2TR3.js} +9 -9
  78. package/dist/bundle/{entry-HGEUYYMX.js → entry-L2LJ2VPY.js} +7 -7
  79. package/dist/bundle/{failure-4JUQFXJT.js → failure-AWHPW2HE.js} +2 -2
  80. package/dist/bundle/{first-run-CSGMEJXY.js → first-run-6PBZSRZU.js} +11 -11
  81. package/dist/bundle/first-screen-UKCD7D2R.js +31 -0
  82. package/dist/bundle/{instructions-S6ZXCTFH.js → instructions-C3NJERO7.js} +1 -1
  83. package/dist/bundle/{mcp-M4QN2E7R.js → mcp-CWLASTLV.js} +2 -2
  84. package/dist/bundle/{node-LCIUWXXG.js → node-P3CIIYWU.js} +2 -2
  85. package/dist/bundle/{node-sqlite-HL4WY4N2.js → node-sqlite-YVHMNRVA.js} +6 -6
  86. package/dist/bundle/{oauth-U4KIMDKG.js → oauth-5OQYA2SV.js} +7 -7
  87. package/dist/bundle/{open-EH7OS7M7.js → open-YGWUVSU7.js} +5 -5
  88. package/dist/bundle/{openai-W5TB3NA5.js → openai-U45JBQ6F.js} +16 -37
  89. package/dist/bundle/{process-3CVLTCTA.js → process-DCYX5EDG.js} +1 -1
  90. package/dist/bundle/{program-LOIZTK2P.js → program-UZBFH2EZ.js} +55 -52
  91. package/dist/bundle/{prompt-IDNH7N3W.js → prompt-HPVTPTFI.js} +7 -5
  92. package/dist/bundle/{proxy-transport-4DPZB2W2.js → proxy-transport-D7MCHGSV.js} +5 -5
  93. package/dist/bundle/{recognize-G5EWYXIF.js → recognize-IJCPFJ76.js} +4 -4
  94. package/dist/bundle/{remote-4XTBZVZD.js → remote-MWDYQWFW.js} +7 -7
  95. package/dist/bundle/{rerank-OWSTDLZN.js → rerank-SXG64475.js} +7 -7
  96. package/dist/bundle/{serve-YCPSEWP3.js → serve-KJQENHEH.js} +9 -9
  97. package/dist/bundle/{server-ODG4A2KK.js → server-MXVXZWN6.js} +35 -35
  98. package/dist/bundle/server-RTMCRKQF.js +60 -0
  99. package/dist/bundle/{state-OL2235G5.js → state-CKKJWH27.js} +6 -6
  100. package/dist/bundle/{store-5AACYNDM.js → store-R3BE4V56.js} +44 -13
  101. package/dist/bundle/store-maintenance-command-KDGBSBNU.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-7NBUT62O.js +0 -33
  133. package/dist/bundle/command-contract-KMMHARMR.js +0 -33
  134. package/dist/bundle/first-screen-K2PBNJNE.js +0 -31
  135. package/dist/bundle/server-KELKX6S3.js +0 -60
  136. package/dist/bundle/store-maintenance-command-3J7WZYVN.js +0 -50
  137. /package/dist/bundle/{chunk-VOXIGICJ.js → chunk-DWX4DE2I.js} +0 -0
@@ -13,7 +13,7 @@ import {
13
13
  refuseLacking,
14
14
  servicesFor,
15
15
  throughWrapper
16
- } from "./chunk-UGPZCNYC.js";
16
+ } from "./chunk-YMWPRHXG.js";
17
17
  import {
18
18
  CEILING_KEY,
19
19
  LOG_ATTRIBUTES,
@@ -38,35 +38,37 @@ import {
38
38
  rememberAccount,
39
39
  rootOf2 as rootOf,
40
40
  skipFlagFor
41
- } from "./chunk-X3CD475M.js";
41
+ } from "./chunk-DQELQ7BL.js";
42
42
  import {
43
- isCliFailure,
44
43
  providerErrorKey
45
- } from "./chunk-ZPILMEFY.js";
44
+ } from "./chunk-QD27C3BG.js";
46
45
  import {
47
46
  MESSENGER_CHANGE_REFUSAL,
48
47
  readOnlyRefusal
49
- } from "./chunk-Q7O4CQDO.js";
48
+ } from "./chunk-6ERQJRL2.js";
50
49
  import {
51
50
  servingProfiles
52
- } from "./chunk-AUBRELCM.js";
51
+ } from "./chunk-XDMJVWWR.js";
53
52
  import {
54
53
  openStore
55
- } from "./chunk-Z4QKLHJW.js";
54
+ } from "./chunk-ROOUBFUW.js";
55
+ import {
56
+ isCliFailure
57
+ } from "./chunk-ZEQ7ONPZ.js";
56
58
  import {
57
59
  logRecordOf,
58
60
  realSleep,
59
61
  resolvePaths,
60
62
  writeSecurely
61
- } from "./chunk-YHZFGUAP.js";
63
+ } from "./chunk-V5Z2JO6X.js";
62
64
  import {
63
65
  CliError
64
- } from "./chunk-BXTDAGM4.js";
66
+ } from "./chunk-SMHLQEE2.js";
65
67
  import {
66
68
  __name
67
69
  } from "./chunk-ZVVMGPBJ.js";
68
70
 
69
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
71
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
70
72
  import { openSync } from "node:fs";
71
73
  import { createInterface } from "node:readline";
72
74
  import { ReadStream } from "node:tty";
@@ -121,10 +123,10 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
121
123
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
122
124
  }, "terminalAsker");
123
125
 
124
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/guard.js
126
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/guard.js
125
127
  import { randomUUID } from "node:crypto";
126
128
 
127
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/flood.js
129
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/flood.js
128
130
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
129
131
  import { dirname, join } from "node:path";
130
132
  var MOST_DEADLINES = 50;
@@ -208,11 +210,11 @@ var FloodMemory = class {
208
210
  }
209
211
  };
210
212
 
211
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/journal.js
213
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/journal.js
212
214
  import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
213
215
  import { dirname as dirname3, join as join2 } from "node:path";
214
216
 
215
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
217
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
216
218
  import { closeSync, mkdirSync as mkdirSync2, openSync as openSync2, statSync, unlinkSync } from "node:fs";
217
219
  import { dirname as dirname2 } from "node:path";
218
220
  var LOCK_WAIT_MS = 5e3;
@@ -279,7 +281,7 @@ var lockTime = /* @__PURE__ */ __name((lock) => {
279
281
  }
280
282
  }, "lockTime");
281
283
 
282
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/journal.js
284
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/journal.js
283
285
  var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
284
286
  var SendJournal = class {
285
287
  static {
@@ -356,7 +358,7 @@ var withSendId = /* @__PURE__ */ __name((entry) => {
356
358
  return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
357
359
  }, "withSendId");
358
360
 
359
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/recipients.js
361
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/recipients.js
360
362
  import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
361
363
  import { join as join3 } from "node:path";
362
364
  var recipientsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join3(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.recipients.json`), "recipientsPathFor");
@@ -468,7 +470,7 @@ var RecipientList = class {
468
470
  }
469
471
  };
470
472
 
471
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/guard.js
473
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/guard.js
472
474
  var HOUR_MS = 60 * 60 * 1e3;
473
475
  var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
474
476
  "attachments.extract",
@@ -661,7 +663,7 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
661
663
  }), "guardFor");
662
664
  var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
663
665
 
664
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/pace.js
666
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/pace.js
665
667
  import { readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
666
668
  import { join as join4 } from "node:path";
667
669
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
@@ -751,7 +753,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
751
753
  await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
752
754
  }, "waitForTurn");
753
755
 
754
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
756
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
755
757
  var pathOf = /* @__PURE__ */ __name((command) => {
756
758
  const words = [];
757
759
  for (let at = command; at?.parent; at = at.parent)
@@ -811,7 +813,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
811
813
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
812
814
  }, "refuseUnknownPermissionKeys");
813
815
 
814
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
816
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
815
817
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
816
818
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
817
819
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
@@ -908,7 +910,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
908
910
  });
909
911
  }, "flooded");
910
912
 
911
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
913
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
912
914
  var observed = /* @__PURE__ */ __name((messenger, events) => {
913
915
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
914
916
  const write = currentOperation();
@@ -1007,7 +1009,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
1007
1009
  counts[part] = (counts[part] ?? 0) + items.length;
1008
1010
  }, "byPart");
1009
1011
 
1010
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
1012
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
1011
1013
  var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
1012
1014
  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" }) => {
1013
1015
  let warned = false;
@@ -1583,7 +1585,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1583
1585
  }
1584
1586
  }, "keep");
1585
1587
 
1586
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1588
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1587
1589
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1588
1590
  let opened;
1589
1591
  return {
@@ -0,0 +1,138 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CliError,
5
+ isCliError
6
+ } from "./chunk-SMHLQEE2.js";
7
+ import {
8
+ __name
9
+ } from "./chunk-ZVVMGPBJ.js";
10
+
11
+ // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/hosts.js
12
+ var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
13
+ var HOST_PATTERN = new RegExp(`^(?:${LABEL}(?:\\.${LABEL})*|\\*\\.${LABEL}(?:\\.${LABEL})+)$`);
14
+ var hostProblems = /* @__PURE__ */ __name((hosts) => [
15
+ ...hosts.filter((host) => !HOST_PATTERN.test(host) || host.length > 253).map((host) => `${JSON.stringify(host)} is not a host: a lower-case hostname with no scheme, port or path, or one leading *. before two labels or more`),
16
+ ...hosts.filter((host, at) => hosts.indexOf(host) !== at).map((host) => `${JSON.stringify(host)} is listed twice`)
17
+ ], "hostProblems");
18
+ var hostCovered = /* @__PURE__ */ __name((hostname, hosts) => {
19
+ const name = hostname.toLowerCase().replace(/\.$/, "");
20
+ return hosts.some((host) => host.startsWith("*.") ? name.endsWith(host.slice(1)) : name === host);
21
+ }, "hostCovered");
22
+
23
+ // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/fetch.js
24
+ var HOST_FETCH_TIMEOUT_MS = 3e4;
25
+ var REDIRECTS = 5;
26
+ var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
27
+ var CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
28
+ var NO_BODY = /* @__PURE__ */ new Set([204, 205, 304]);
29
+ var deadline = /* @__PURE__ */ __name((ms) => {
30
+ const controller = new AbortController();
31
+ const timer = setTimeout(() => controller.abort(new DOMException(`no answer within ${ms} ms`, "TimeoutError")), ms);
32
+ timer.unref?.();
33
+ return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
34
+ }, "deadline");
35
+ var released = /* @__PURE__ */ __name((response, clear) => {
36
+ if (!response.body || NO_BODY.has(response.status) || response.status < 200 || response.status > 599) {
37
+ clear();
38
+ return response;
39
+ }
40
+ const { status, statusText, headers, url, redirected } = response;
41
+ const wrapped = new Response(response.body.pipeThrough(new TransformStream({ flush: clear })), {
42
+ status,
43
+ statusText,
44
+ headers
45
+ });
46
+ return Object.defineProperties(wrapped, { url: { value: url }, redirected: { value: redirected } });
47
+ }, "released");
48
+ var undeclared = /* @__PURE__ */ __name((url) => new CliError("configuration_error", `${url.hostname} is not a host this CLI declares: add "${url.hostname}" to \`hosts\` in its WCAT identity and run cli-dev manifest`, { reason: "network.host-undeclared", sent: false }), "undeclared");
49
+ var checked = /* @__PURE__ */ __name((url, hosts) => {
50
+ if (url.protocol !== "https:" && url.protocol !== "http:")
51
+ throw new CliError("validation_error", `only http and https are fetched, not ${url.protocol.replace(/:$/, "")}`, {
52
+ sent: false
53
+ });
54
+ if (!hostCovered(url.hostname, hosts))
55
+ throw undeclared(url);
56
+ return url;
57
+ }, "checked");
58
+ var hostFetch = /* @__PURE__ */ __name((options) => {
59
+ const problems = hostProblems(options.hosts);
60
+ if (problems.length > 0)
61
+ throw new CliError("configuration_error", problems.join("; "));
62
+ const { hosts, fetch: send = globalThis.fetch, timeoutMs = HOST_FETCH_TIMEOUT_MS, redirects = REDIRECTS } = options;
63
+ return async (input, init = {}) => {
64
+ const request = input instanceof Request ? input : void 0;
65
+ let url = checked(new URL(request?.url ?? String(input)), hosts);
66
+ const caller = init.signal ?? request?.signal;
67
+ const timeout = deadline(timeoutMs);
68
+ const signal = caller ? AbortSignal.any([caller, timeout.signal]) : timeout.signal;
69
+ const follow = (init.redirect ?? request?.redirect ?? "follow") === "follow";
70
+ let method = (init.method ?? request?.method ?? "GET").toUpperCase();
71
+ let body = init.body ?? request?.body ?? void 0;
72
+ const headers = new Headers(init.headers ?? request?.headers);
73
+ try {
74
+ let response = await send(input, { ...init, signal, ...follow ? { redirect: "manual" } : {} });
75
+ for (let hop = 0; follow && REDIRECT_STATUSES.has(response.status); hop += 1) {
76
+ const location = response.headers.get("location");
77
+ if (!location)
78
+ return released(response, timeout.clear);
79
+ if (hop >= redirects)
80
+ throw new CliError("invalid_response", `more than ${redirects} redirects from ${url.hostname}`);
81
+ void response.body?.cancel().catch(() => {
82
+ });
83
+ const next = checked(new URL(location, url), hosts);
84
+ if (response.status === 303 || (response.status === 301 || response.status === 302) && method === "POST") {
85
+ method = method === "HEAD" ? "HEAD" : "GET";
86
+ body = void 0;
87
+ headers.delete("content-type");
88
+ headers.delete("content-length");
89
+ } else if (body instanceof ReadableStream)
90
+ throw new CliError("invalid_response", `${url.hostname} redirected a streamed body, which cannot be sent again`);
91
+ if (next.origin !== url.origin)
92
+ for (const name of CREDENTIAL_HEADERS)
93
+ headers.delete(name);
94
+ url = next;
95
+ response = await send(url, { ...init, method, headers, body, signal, redirect: "manual" });
96
+ }
97
+ return released(response, timeout.clear);
98
+ } catch (error) {
99
+ timeout.clear();
100
+ if (isCliError(error))
101
+ throw error;
102
+ if (caller?.aborted)
103
+ throw isCliError(caller.reason) ? caller.reason : new CliError("cancelled", "request cancelled");
104
+ if (timeout.signal.aborted)
105
+ throw new CliError("timeout", `${url.hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
106
+ throw new CliError("network_error", `${url.hostname} could not be reached`, { retryable: true });
107
+ }
108
+ };
109
+ }, "hostFetch");
110
+
111
+ // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/index.js
112
+ var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
113
+ if (!header)
114
+ return void 0;
115
+ const trimmed = header.trim();
116
+ if (/^\d+$/.test(trimmed))
117
+ return Number(trimmed) * 1e3;
118
+ const at = Date.parse(trimmed);
119
+ if (Number.isNaN(at))
120
+ return void 0;
121
+ const delta = at - now().getTime();
122
+ return delta > 0 ? delta : void 0;
123
+ }, "parseRetryAfter");
124
+ var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
125
+ if (!header)
126
+ return void 0;
127
+ const seconds = Number(header.trim());
128
+ if (!Number.isFinite(seconds))
129
+ return void 0;
130
+ const delta = seconds * 1e3 - now().getTime();
131
+ return delta > 0 ? delta : void 0;
132
+ }, "parseRateLimitReset");
133
+ var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
134
+
135
+ export {
136
+ hostFetch,
137
+ providerWaitMs
138
+ };
@@ -2,31 +2,31 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  updateCommand
5
- } from "./chunk-3MQOLYAN.js";
5
+ } from "./chunk-IAGX5VFL.js";
6
6
  import {
7
7
  QUESTIONS,
8
8
  readSetupAnswers,
9
9
  unanswered,
10
10
  writeSetupAnswers
11
- } from "./chunk-M7V5XRM6.js";
11
+ } from "./chunk-UBCLVM7C.js";
12
12
  import {
13
13
  DEFAULT_STEMMERS,
14
14
  LANGUAGES
15
- } from "./chunk-TG6ZYL4B.js";
15
+ } from "./chunk-QQ3QZFFD.js";
16
16
  import {
17
17
  sharedConfigPath
18
- } from "./chunk-7Y3RUEVY.js";
18
+ } from "./chunk-FQZSS3AB.js";
19
19
  import {
20
20
  storePath
21
- } from "./chunk-3GRX7WP6.js";
21
+ } from "./chunk-6K5R3YPN.js";
22
22
  import {
23
23
  installerOf
24
- } from "./chunk-P3ASN72F.js";
24
+ } from "./chunk-KBHK5UGL.js";
25
25
  import {
26
26
  __name
27
27
  } from "./chunk-ZVVMGPBJ.js";
28
28
 
29
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/first-run.js
29
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/first-run.js
30
30
  import { spawnSync } from "node:child_process";
31
31
  import { accessSync, constants, realpathSync } from "node:fs";
32
32
  import { delimiter, join } from "node:path";
@@ -84,7 +84,7 @@ var suggested = /* @__PURE__ */ __name((env, contentLanguages) => {
84
84
  return (own.length ? own : LANGUAGES.filter(({ code }) => code === "en" || code === system)).map(({ name }) => name);
85
85
  }, "suggested");
86
86
  var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLanguages }) => {
87
- const { openStore } = await import("./store-5AACYNDM.js");
87
+ const { openStore } = await import("./store-R3BE4V56.js");
88
88
  const store = await openStore({ env });
89
89
  let rebuild = false;
90
90
  try {
@@ -113,8 +113,8 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
113
113
  if (!rebuild)
114
114
  return;
115
115
  const [{ openCache }, { buildStems }] = await Promise.all([
116
- import("./open-EH7OS7M7.js"),
117
- import("./store-maintenance-command-3J7WZYVN.js")
116
+ import("./open-YGWUVSU7.js"),
117
+ import("./store-maintenance-command-KDGBSBNU.js")
118
118
  ]);
119
119
  const database = await openCache(storePath(env));
120
120
  try {
@@ -126,7 +126,7 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
126
126
  var askTools = /* @__PURE__ */ __name(async (run) => {
127
127
  const { command, env, io } = run;
128
128
  const installed = run.installed ?? ((name) => onPath(name, env));
129
- const { WIRECAT_TOOLS } = await import("./first-screen-K2PBNJNE.js");
129
+ const { WIRECAT_TOOLS } = await import("./first-screen-UKCD7D2R.js");
130
130
  const others = WIRECAT_TOOLS.filter((tool) => tool.command !== command);
131
131
  const missing = others.filter((tool) => !installed(tool.command));
132
132
  io.say("Other WireCat tools \u2014 they share this store, so one search finds everything:");
@@ -199,7 +199,7 @@ var setupAtStart = /* @__PURE__ */ __name(async (start) => {
199
199
  contentLanguages: start.contentLanguages,
200
200
  all: start.path[0] === "setup",
201
201
  io: {
202
- ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-IDNH7N3W.js")).readSecret(prompt, { input, echo: true }), "ask"),
202
+ ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-HPVTPTFI.js")).readSecret(prompt, { input, echo: true }), "ask"),
203
203
  say: /* @__PURE__ */ __name((text) => process.stderr.write(`${text}
204
204
  `), "say")
205
205
  }
@@ -1,35 +1,25 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
+ isCliFailure,
4
5
  secretNamed,
5
6
  withoutSecrets
6
- } from "./chunk-XW5C4TI7.js";
7
+ } from "./chunk-ZEQ7ONPZ.js";
7
8
  import {
8
9
  isContentKey
9
- } from "./chunk-YHZFGUAP.js";
10
- import {
11
- errorCodes
12
- } from "./chunk-BXTDAGM4.js";
10
+ } from "./chunk-V5Z2JO6X.js";
13
11
  import {
14
12
  __name
15
13
  } from "./chunk-ZVVMGPBJ.js";
16
14
 
17
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/runs/run-context.js
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/runs/run-context.js
18
16
  import { AsyncLocalStorage } from "node:async_hooks";
19
17
  import { createHash } from "node:crypto";
20
18
 
21
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
19
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
22
20
  import { homedir } from "node:os";
23
21
 
24
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/errors/failures.js
25
- var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
26
- var isCommanderFailure = /* @__PURE__ */ __name((value) => {
27
- const { code, exitCode } = value ?? {};
28
- return value instanceof Error && typeof code === "string" && code.startsWith("commander.") && typeof exitCode === "number";
29
- }, "isCommanderFailure");
30
- var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
31
-
32
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/runs/events.js
22
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/runs/events.js
33
23
  var providerErrorKey = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(value) ? value : void 0, "providerErrorKey");
34
24
  var renderEvent = /* @__PURE__ */ __name((event) => {
35
25
  if (event.event === "warning") {
@@ -77,7 +67,7 @@ var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!
77
67
  var age = /* @__PURE__ */ __name((ms) => ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`, "age");
78
68
  var size = /* @__PURE__ */ __name((bytes) => bytes < 1e3 ? `${bytes} B` : `${(bytes / 1e3).toFixed(1)} kB`, "size");
79
69
 
80
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
70
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
81
71
  var MESSAGE_AT_MOST = 500;
82
72
  var CAUSES_AT_MOST = 5;
83
73
  var FRAMES_AT_MOST = 15;
@@ -186,7 +176,7 @@ var redactText = /* @__PURE__ */ __name((text) => {
186
176
  return out.length > MESSAGE_AT_MOST ? `${out.slice(0, MESSAGE_AT_MOST)}\u2026` : out;
187
177
  }, "redactText");
188
178
 
189
- // node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/runs/run-context.js
179
+ // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/runs/run-context.js
190
180
  var REDACTED = "[redacted]";
191
181
  var keepsSuccess = /* @__PURE__ */ __name(({ record, fromFlag, env, caller, persistent = false }) => {
192
182
  if (!record)
@@ -349,9 +339,6 @@ var runContextOf = /* @__PURE__ */ __name(({ bin, command, program, argv, env, r
349
339
  }, "runContextOf");
350
340
 
351
341
  export {
352
- isCliFailure,
353
- isCommanderFailure,
354
- failureKey,
355
342
  providerErrorKey,
356
343
  renderEvent,
357
344
  errorDetailOf,
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  singleLine
5
- } from "./chunk-BXTDAGM4.js";
5
+ } from "./chunk-SMHLQEE2.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // 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/wcat/names.js
10
+ // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/names.js
11
11
  var FIRST_PARTY_TOOLS = [
12
12
  { name: "tg", package: "@wirecat/tg-cli" },
13
13
  { name: "max", package: "@wirecat/max-cli" },
@@ -28,17 +28,31 @@ var RESERVED_NAMES = [
28
28
  var TOOL_NAME = /^[a-z][a-z0-9-]{0,39}$/;
29
29
  var PROGRAM_PREFIX = "wcat-";
30
30
  var DESCRIBE_FLAG = "--wcat-describe";
31
+ var DESCRIBE_MAX_BYTES = 64 * 1024;
31
32
  var DISPATCH_FLAG = "--wcat-dispatch";
32
33
 
33
- // 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/wcat/describe.js
34
+ // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/describe.js
34
35
  var DESCRIBE_FORMAT = 1;
35
- var describeAnswer = /* @__PURE__ */ __name((tool) => ({
36
- wcat_describe: DESCRIBE_FORMAT,
37
- name: tool.command,
38
- version: tool.version,
39
- description: tool.description,
40
- ...tool.docs ? { docs_url: tool.docs } : {}
41
- }), "describeAnswer");
36
+ var DESCRIBE_MANIFEST_FORMAT = 2;
37
+ var describeAnswer = /* @__PURE__ */ __name((tool, manifest) => {
38
+ const answer = {
39
+ wcat_describe: DESCRIBE_FORMAT,
40
+ name: tool.command,
41
+ version: tool.version,
42
+ description: tool.description,
43
+ ...tool.docs ? { docs_url: tool.docs } : {}
44
+ };
45
+ if (!manifest)
46
+ return answer;
47
+ const full = {
48
+ ...answer,
49
+ wcat_describe: DESCRIBE_MANIFEST_FORMAT,
50
+ desktop: manifest.desktop,
51
+ manifest_sha256: manifest.sha256
52
+ };
53
+ return Buffer.byteLength(`${JSON.stringify(full)}
54
+ `) > DESCRIBE_MAX_BYTES ? answer : full;
55
+ }, "describeAnswer");
42
56
  var MAX_TEXT = 200;
43
57
  var clean = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" ? singleLine(value.trim()).slice(0, MAX_TEXT) : void 0, "clean");
44
58
  var parseDescribe = /* @__PURE__ */ __name((text) => {
@@ -50,25 +64,48 @@ var parseDescribe = /* @__PURE__ */ __name((text) => {
50
64
  }
51
65
  if (typeof answer !== "object" || answer === null || !("wcat_describe" in answer))
52
66
  return void 0;
53
- const { version, description, docs_url: docs } = answer;
67
+ const { version, description, docs_url: docs, manifest_sha256: sha } = answer;
54
68
  const url = clean(docs);
55
69
  return {
56
70
  version: clean(version) ?? "",
57
71
  description: clean(description) ?? "",
58
- ...url && /^https?:\/\//.test(url) ? { docs: url } : {}
72
+ ...url && /^https?:\/\//.test(url) ? { docs: url } : {},
73
+ ...typeof sha === "string" && /^[0-9a-f]{64}$/.test(sha) ? { manifestSha256: sha } : {}
59
74
  };
60
75
  }, "parseDescribe");
61
76
 
62
- // 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/wcat/shim.js
77
+ // node_modules/.pnpm/@wirecat+cli-base@0.87.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/shim.js
63
78
  import { lstatSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
64
79
  import { join } from "node:path";
65
- var SHIM_FORMAT = 1;
80
+ var SHIM_FORMAT = 2;
66
81
  var MARK = /^(?:#|REM) wirecat-shim (\d+) (launcher|shortcut) (\S+)\r?$/m;
67
82
  var NOTE = {
68
83
  launcher: "Written by @wirecat/cli-base. Any WireCat tool rewrites it when it breaks; it is safe to delete.",
69
84
  shortcut: "Made by `wcat shortcuts add`; `wcat shortcuts remove` takes it out."
70
85
  };
71
86
  var shellQuote = /* @__PURE__ */ __name((text) => `'${text.replaceAll("'", `'\\''`)}'`, "shellQuote");
87
+ var launcherBody = /* @__PURE__ */ __name((dir, target, name) => [
88
+ 'ok() { [ -f "$1" ] && [ -x "$1" ]; }',
89
+ `dir=${shellQuote(dir)}`,
90
+ `target=${shellQuote(join(dir, target))}`,
91
+ 'if ! ok "$target"; then',
92
+ ' for t in "$dir"/wcat-*; do',
93
+ ' if ok "$t"; then target=$t; break; fi',
94
+ " done",
95
+ "fi",
96
+ `if ok "$target"; then exec "$target" ${DISPATCH_FLAG} "$@"; fi`,
97
+ 'if [ -z "$WIRECAT_LAUNCHER_SKIP" ]; then',
98
+ " WIRECAT_LAUNCHER_SKIP=1; export WIRECAT_LAUNCHER_SKIP",
99
+ " set -f; oldifs=$IFS; IFS=:",
100
+ " for d in $PATH; do",
101
+ ` if [ -n "$d" ] && [ "$d" != "$dir" ] && ok "$d/${name}"; then IFS=$oldifs; exec "$d/${name}" "$@"; fi`,
102
+ " done",
103
+ " IFS=$oldifs; set +f",
104
+ "fi",
105
+ `printf '%s\\n' "${name}: $target is missing and no other ${name}-* program was found in $dir or on PATH." \\`,
106
+ ` "This launcher is safe to delete: $dir/${name}" >&2`,
107
+ "exit 127"
108
+ ], "launcherBody");
72
109
  var shimFiles = /* @__PURE__ */ __name((kind, { dir, name, target, platform }) => {
73
110
  const mark = `wirecat-shim ${SHIM_FORMAT} ${kind} ${target}`;
74
111
  const extra = kind === "launcher" ? ` ${DISPATCH_FLAG}` : "";
@@ -76,11 +113,13 @@ var shimFiles = /* @__PURE__ */ __name((kind, { dir, name, target, platform }) =
76
113
  return [
77
114
  {
78
115
  path: join(dir, name),
79
- text: `#!/bin/sh
80
- # ${mark}
81
- # ${NOTE[kind]}
82
- exec ${shellQuote(join(dir, target))}${extra} "$@"
83
- `
116
+ text: [
117
+ "#!/bin/sh",
118
+ `# ${mark}`,
119
+ `# ${NOTE[kind]}`,
120
+ ...kind === "launcher" ? launcherBody(dir, target, name) : [`exec ${shellQuote(join(dir, target))} "$@"`],
121
+ ""
122
+ ].join("\n")
84
123
  }
85
124
  ];
86
125
  return [
@@ -150,14 +189,15 @@ var writeShim = /* @__PURE__ */ __name(({ path, text }) => {
150
189
  }, "writeShim");
151
190
 
152
191
  export {
153
- describeAnswer,
154
- parseDescribe,
155
192
  FIRST_PARTY_TOOLS,
156
193
  BUILT_IN_COMMANDS,
157
194
  TOOL_NAME,
158
195
  PROGRAM_PREFIX,
159
196
  DESCRIBE_FLAG,
197
+ DESCRIBE_MAX_BYTES,
160
198
  DISPATCH_FLAG,
199
+ describeAnswer,
200
+ parseDescribe,
161
201
  SHIM_FORMAT,
162
202
  shimFiles,
163
203
  fileState,