@wirecat/cli-template 0.15.0 → 0.17.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 (170) hide show
  1. package/.github/workflows/ci.yml +35 -0
  2. package/.github/workflows/release-pr.yml +37 -0
  3. package/AGENTS.md +56 -2
  4. package/CHANGELOG.md +50 -0
  5. package/README.md +12 -4
  6. package/bin/release +10 -3
  7. package/biome.json +8 -2
  8. package/contracts/mcp-tools.json +2 -2
  9. package/contracts/plan.json +2 -1
  10. package/dist/bin/clidev.js +2 -2
  11. package/dist/bundle/{chunk-LU4A2T7Y.js → all-profiles-CCT2XPJL.js} +10 -7
  12. package/dist/bundle/{anthropic-ICTW7CNQ.js → anthropic-QLLP7EE4.js} +4 -4
  13. package/dist/bundle/{app-server-OW5LT5XV.js → app-server-ELI5TGL7.js} +36 -37
  14. package/dist/bundle/{bun-ILPS6AYA.js → bun-C7JS2V7G.js} +2 -2
  15. package/dist/bundle/{bun-sqlite-JE6FJFQT.js → bun-sqlite-OM72TCYT.js} +3 -3
  16. package/dist/bundle/{chunk-7F5VMLVK.js → chunk-2Y5NBD7U.js} +4 -4
  17. package/dist/bundle/chunk-33JGD2CR.js +141 -0
  18. package/dist/bundle/{chunk-F34HGYWF.js → chunk-3VVIEZRY.js} +2 -2
  19. package/dist/bundle/{chunk-CGFQT3LQ.js → chunk-6PHTRAZA.js} +1 -1
  20. package/dist/bundle/{chunk-VS5LGSTM.js → chunk-6VCFDEHT.js} +1 -1
  21. package/dist/bundle/{chunk-NENYWEXF.js → chunk-7OQF5ZMN.js} +1 -1
  22. package/dist/bundle/{chunk-62JRF2JA.js → chunk-AKUMR7PE.js} +2 -2
  23. package/dist/bundle/{chunk-7UPBPE3Z.js → chunk-ASO23RNM.js} +152 -79
  24. package/dist/bundle/{chunk-VOTEB3AN.js → chunk-AUVPTFUS.js} +1 -1
  25. package/dist/bundle/{chunk-KLFYY7KC.js → chunk-BOCIYBBO.js} +53 -44
  26. package/dist/bundle/{chunk-TJJ2XSJP.js → chunk-BXZRTMXA.js} +5 -5
  27. package/dist/bundle/{chunk-66VMJGV6.js → chunk-DVLM23HB.js} +2 -2
  28. package/dist/bundle/{chunk-YIVY2WI3.js → chunk-E4KQOKQ5.js} +1 -1
  29. package/dist/bundle/{chunk-GHF72SHT.js → chunk-EQDVQN4E.js} +306 -258
  30. package/dist/bundle/{chunk-NH6LZ3H3.js → chunk-FF3AGTHY.js} +6 -6
  31. package/dist/bundle/{chunk-NG7MOJBT.js → chunk-GG5PXNMH.js} +61 -21
  32. package/dist/bundle/{chunk-LFLSV353.js → chunk-GUCMIUNB.js} +2 -2
  33. package/dist/bundle/{chunk-R5RYPD23.js → chunk-HVAEHUSZ.js} +2 -2
  34. package/dist/bundle/{chunk-PIJUGF5F.js → chunk-ITPFCKCL.js} +13 -13
  35. package/dist/bundle/{chunk-DQIBGCF3.js → chunk-J2RUBXCI.js} +6 -6
  36. package/dist/bundle/{chunk-7Z4HR6GO.js → chunk-KRXN3FV3.js} +1 -1
  37. package/dist/bundle/{chunk-45244QQ6.js → chunk-LFLN6PVS.js} +4 -4
  38. package/dist/bundle/{chunk-MWUHBEDN.js → chunk-LN53L2V5.js} +11 -11
  39. package/dist/bundle/{chunk-IOJ2DTCY.js → chunk-MLSN3UP4.js} +28 -26
  40. package/dist/bundle/{chunk-3MDNAYQA.js → chunk-O6PBO4BU.js} +1 -1
  41. package/dist/bundle/{chunk-YOJLIVGO.js → chunk-QJS4WWYK.js} +63 -63
  42. package/dist/bundle/{chunk-NVNUUHT5.js → chunk-QLBS6OC2.js} +2362 -1225
  43. package/dist/bundle/{chunk-2DAXUNTS.js → chunk-QVPTZDRA.js} +2 -2
  44. package/dist/bundle/{chunk-4MU2UM4C.js → chunk-R5CPFSPI.js} +7 -7
  45. package/dist/bundle/{chunk-AS2PJNQ2.js → chunk-R5IY4O25.js} +4 -4
  46. package/dist/bundle/{chunk-DZLHY4IA.js → chunk-RGKXMVOZ.js} +3 -3
  47. package/dist/bundle/{chunk-G45R7M42.js → chunk-RT46AWIH.js} +1 -1
  48. package/dist/bundle/{chunk-NRZV7K4M.js → chunk-RUHNHEAF.js} +3 -3
  49. package/dist/bundle/{chunk-VXOR76ZL.js → chunk-S465TCR3.js} +8 -8
  50. package/dist/bundle/{chunk-NVGOHYTE.js → chunk-SQKP6V4S.js} +27 -13
  51. package/dist/bundle/{chunk-FC53WQHG.js → chunk-SQOXYNKF.js} +1 -1
  52. package/dist/bundle/{chunk-R2JKPHH5.js → chunk-URPKIONS.js} +8 -8
  53. package/dist/bundle/{chunk-VVGPAHUN.js → chunk-UW4PJZVJ.js} +298 -170
  54. package/dist/bundle/{chunk-EX2FV7YJ.js → chunk-WKUJCPSP.js} +89 -45
  55. package/dist/bundle/{chunk-LATYBJ4T.js → chunk-WQBBSVZM.js} +2 -2
  56. package/dist/bundle/{chunk-G7W53MQP.js → chunk-WRLOK7XC.js} +3 -3
  57. package/dist/bundle/{chunk-SOYOOU2D.js → chunk-X44ZT64I.js} +3 -3
  58. package/dist/bundle/{chunk-U6QD3J3F.js → chunk-XKL5FRH3.js} +3 -3
  59. package/dist/bundle/{chunk-6AW4DDK4.js → chunk-XS56LIQ7.js} +4 -4
  60. package/dist/bundle/{chunk-3WDYHOAF.js → chunk-YIH3PYWJ.js} +1 -1
  61. package/dist/bundle/{chunk-5GTMQTQH.js → chunk-ZRNBKTPP.js} +27 -29
  62. package/dist/bundle/clidev.js +3 -3
  63. package/dist/bundle/{command-contract-3MPKXBVL.js → command-contract-RV5ZOEAT.js} +11 -11
  64. package/dist/bundle/{decode-NXB5UKMO.js → decode-V7HNHZBC.js} +3 -3
  65. package/dist/bundle/{echarts-DRDGGHJT.js → echarts-Y42YP2OL.js} +2 -2
  66. package/dist/bundle/{embed-IKZ24BMC.js → embed-JSQZL7JF.js} +4 -4
  67. package/dist/bundle/{embedder-GMQ24DOQ.js → embedder-7BHRCXWL.js} +7 -7
  68. package/dist/bundle/{first-run-PURIGDLD.js → first-run-BJ36KGST.js} +8 -8
  69. package/dist/bundle/first-screen-5YHQVNY4.js +26 -0
  70. package/dist/bundle/{instructions-EOQOXY6V.js → instructions-UWERND54.js} +1 -1
  71. package/dist/bundle/{mcp-7HBLFGCW.js → mcp-P4FSBSRS.js} +2 -2
  72. package/dist/bundle/{node-52WF2326.js → node-PZDNPKN7.js} +2 -2
  73. package/dist/bundle/{node-sqlite-73Z4SFOA.js → node-sqlite-4F5NLRNT.js} +4 -4
  74. package/dist/bundle/{oauth-EVTPAMZP.js → oauth-VDXNA3DK.js} +5 -5
  75. package/dist/bundle/{open-46WZAPJ3.js → open-EUJRQQNS.js} +3 -3
  76. package/dist/bundle/{openai-GWRDAHDU.js → openai-EIBV2K72.js} +14 -35
  77. package/dist/bundle/{process-YIQPKLZI.js → process-XD5ZIFIL.js} +1 -1
  78. package/dist/bundle/{program-37NVH5YJ.js → program-TJTVMIOX.js} +3067 -736
  79. package/dist/bundle/{prompt-IVEYRLS5.js → prompt-LYUZNHDK.js} +3 -3
  80. package/dist/bundle/{recognize-WVEKHODM.js → recognize-LQMHLOD5.js} +2 -2
  81. package/dist/bundle/{remote-4K5VPMC7.js → remote-34HUWSZI.js} +5 -5
  82. package/dist/bundle/{rerank-V24UJZYJ.js → rerank-ONBASQ5Z.js} +5 -5
  83. package/dist/bundle/{chunk-EMHCXXNJ.js → serve-UJ7FDYAM.js} +8 -6
  84. package/dist/bundle/{chunk-KJ3UADR3.js → server-GNT76BXM.js} +29 -9
  85. package/dist/bundle/server-J4YIXKMI.js +52 -0
  86. package/dist/bundle/{state-ZPYGECVP.js → state-IW5OO6IZ.js} +4 -4
  87. package/dist/bundle/{store-6JQCLPQF.js → store-55UB27H2.js} +12 -10
  88. package/dist/bundle/store-maintenance-command-BLDKUZ3L.js +42 -0
  89. package/dist/commands/comments.d.ts +3 -0
  90. package/dist/commands/comments.d.ts.map +1 -0
  91. package/dist/commands/comments.js +114 -0
  92. package/dist/commands/comments.js.map +1 -0
  93. package/dist/commands/session.d.ts +3 -0
  94. package/dist/commands/session.d.ts.map +1 -0
  95. package/dist/commands/session.js +96 -0
  96. package/dist/commands/session.js.map +1 -0
  97. package/dist/context.d.ts +83 -0
  98. package/dist/context.d.ts.map +1 -0
  99. package/dist/context.js +58 -0
  100. package/dist/context.js.map +1 -0
  101. package/dist/program.d.ts.map +1 -1
  102. package/dist/program.js +25 -4
  103. package/dist/program.js.map +1 -1
  104. package/dist/sample/comments.d.ts +61 -0
  105. package/dist/sample/comments.d.ts.map +1 -0
  106. package/dist/sample/comments.js +39 -0
  107. package/dist/sample/comments.js.map +1 -0
  108. package/dist/sample/transport.d.ts +42 -0
  109. package/dist/sample/transport.d.ts.map +1 -0
  110. package/dist/sample/transport.js +152 -0
  111. package/dist/sample/transport.js.map +1 -0
  112. package/dist/token.d.ts +16 -0
  113. package/dist/token.d.ts.map +1 -0
  114. package/dist/token.js +32 -0
  115. package/dist/token.js.map +1 -0
  116. package/dist/version.d.ts +1 -1
  117. package/dist/version.js +1 -1
  118. package/docs/commands.md +234 -12
  119. package/docs/configuration.md +1 -1
  120. package/docs/dev/reference-clis.md +3 -2
  121. package/docs/dev/skills/release/SKILL.md +9 -3
  122. package/docs/dev/skills/release/fresh-audit.md +1 -1
  123. package/docs/dev/test-matrix.md +36 -5
  124. package/docs/index.md +4 -3
  125. package/docs/security.md +4 -2
  126. package/kit/dist/new.js +7 -3
  127. package/lint/overrides.json +9 -1
  128. package/package.json +6 -7
  129. package/scripts/test-matrix-untested.ts +19 -0
  130. package/skills/clidev-cli/SKILL.md +1 -1
  131. package/src/commands/comments.ts +167 -0
  132. package/src/commands/session.ts +144 -0
  133. package/src/comments.test.ts +258 -0
  134. package/src/context.ts +78 -0
  135. package/src/mcp.test.ts +71 -76
  136. package/src/program.test.ts +9 -16
  137. package/src/program.ts +29 -4
  138. package/src/sample/comments.ts +51 -0
  139. package/src/sample/transport.test.ts +117 -0
  140. package/src/sample/transport.ts +184 -0
  141. package/src/testing/fake-comments.ts +167 -0
  142. package/src/testing/harness.ts +51 -0
  143. package/src/token.ts +42 -0
  144. package/src/version.ts +1 -1
  145. package/dist/bundle/all-profiles-NVB2HT2S.js +0 -24
  146. package/dist/bundle/chunk-GUFPQZUA.js +0 -48
  147. package/dist/bundle/chunk-NL2DQPT7.js +0 -2
  148. package/dist/bundle/first-screen-B2CF2CET.js +0 -26
  149. package/dist/bundle/mcp-ASNYBQ5B.js +0 -152
  150. package/dist/bundle/mcp-EY2NUYDQ.js +0 -82
  151. package/dist/bundle/serve-PJWSOV7F.js +0 -19
  152. package/dist/bundle/server-3TPCEZ6P.js +0 -40
  153. package/dist/bundle/server-GQX5MZTT.js +0 -53
  154. package/dist/bundle/store-maintenance-command-ND4ADMGC.js +0 -42
  155. package/dist/commands/doctor.d.ts +0 -77
  156. package/dist/commands/doctor.d.ts.map +0 -1
  157. package/dist/commands/doctor.js +0 -74
  158. package/dist/commands/doctor.js.map +0 -1
  159. package/dist/commands/mcp.d.ts +0 -3
  160. package/dist/commands/mcp.d.ts.map +0 -1
  161. package/dist/commands/mcp.js +0 -97
  162. package/dist/commands/mcp.js.map +0 -1
  163. package/dist/mcp.d.ts +0 -29
  164. package/dist/mcp.d.ts.map +0 -1
  165. package/dist/mcp.js +0 -98
  166. package/dist/mcp.js.map +0 -1
  167. package/src/commands/doctor.ts +0 -86
  168. package/src/commands/mcp.ts +0 -130
  169. package/src/mcp-http.test.ts +0 -172
  170. package/src/mcp.ts +0 -140
@@ -13,10 +13,10 @@ import {
13
13
  refuseLacking,
14
14
  servicesFor,
15
15
  throughWrapper
16
- } from "./chunk-GHF72SHT.js";
16
+ } from "./chunk-EQDVQN4E.js";
17
17
  import {
18
18
  servingProfiles
19
- } from "./chunk-DZLHY4IA.js";
19
+ } from "./chunk-RGKXMVOZ.js";
20
20
  import {
21
21
  AUTHORITY_KEY,
22
22
  CEILING_KEY,
@@ -45,29 +45,29 @@ import {
45
45
  rememberAccount,
46
46
  rootOf2 as rootOf,
47
47
  skipFlagFor
48
- } from "./chunk-VVGPAHUN.js";
48
+ } from "./chunk-UW4PJZVJ.js";
49
49
  import {
50
50
  isCliFailure,
51
51
  providerErrorKey
52
- } from "./chunk-VXOR76ZL.js";
52
+ } from "./chunk-S465TCR3.js";
53
53
  import {
54
54
  openStore
55
- } from "./chunk-NVNUUHT5.js";
55
+ } from "./chunk-QLBS6OC2.js";
56
56
  import {
57
57
  CliError,
58
58
  logRecordOf,
59
59
  realSleep,
60
60
  resolvePaths,
61
61
  writeSecurely
62
- } from "./chunk-IOJ2DTCY.js";
62
+ } from "./chunk-MLSN3UP4.js";
63
63
  import {
64
64
  __name
65
65
  } from "./chunk-ZVVMGPBJ.js";
66
66
 
67
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/guard.js
67
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/guard.js
68
68
  import { randomUUID } from "node:crypto";
69
69
 
70
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/flood.js
70
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/flood.js
71
71
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
72
72
  import { dirname, join } from "node:path";
73
73
  var MOST_DEADLINES = 50;
@@ -151,11 +151,11 @@ var FloodMemory = class {
151
151
  }
152
152
  };
153
153
 
154
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/journal.js
154
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/journal.js
155
155
  import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
156
156
  import { dirname as dirname3, join as join2 } from "node:path";
157
157
 
158
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
158
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
159
159
  import { closeSync, mkdirSync as mkdirSync2, openSync, statSync, unlinkSync } from "node:fs";
160
160
  import { dirname as dirname2 } from "node:path";
161
161
  var LOCK_WAIT_MS = 5e3;
@@ -222,7 +222,7 @@ var lockTime = /* @__PURE__ */ __name((lock) => {
222
222
  }
223
223
  }, "lockTime");
224
224
 
225
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/journal.js
225
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/journal.js
226
226
  var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
227
227
  var SendJournal = class {
228
228
  static {
@@ -299,7 +299,7 @@ var withSendId = /* @__PURE__ */ __name((entry) => {
299
299
  return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
300
300
  }, "withSendId");
301
301
 
302
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/recipients.js
302
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/recipients.js
303
303
  import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
304
304
  import { join as join3 } from "node:path";
305
305
  var recipientsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join3(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.recipients.json`), "recipientsPathFor");
@@ -411,7 +411,7 @@ var RecipientList = class {
411
411
  }
412
412
  };
413
413
 
414
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/guard.js
414
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/guard.js
415
415
  var HOUR_MS = 60 * 60 * 1e3;
416
416
  var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
417
417
  "attachments.extract",
@@ -604,7 +604,7 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
604
604
  }), "guardFor");
605
605
  var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
606
606
 
607
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
607
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
608
608
  import { openSync as openSync2 } from "node:fs";
609
609
  import { createInterface } from "node:readline";
610
610
  import { ReadStream } from "node:tty";
@@ -659,7 +659,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
659
659
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
660
660
  }, "terminalAsker");
661
661
 
662
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/pace.js
662
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/sends/pace.js
663
663
  import { readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
664
664
  import { join as join4 } from "node:path";
665
665
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
@@ -717,8 +717,39 @@ var Pacer = class {
717
717
  renameSync2(temporary, this.path);
718
718
  }
719
719
  };
720
+ var ANNOUNCE_WAIT_MS = 5e3;
721
+ var LONGEST_PACE_WAIT_MS = 5 * 6e4;
722
+ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
723
+ const { name, operation, warn } = options;
724
+ const now = options.now ?? Date.now;
725
+ let at = now();
726
+ try {
727
+ at = await pacer.reserve();
728
+ } catch (error) {
729
+ warn?.(`could not remember ${name}'s wait (${error instanceof Error ? error.message : String(error)})`, {
730
+ event: "warning",
731
+ code: "wait_not_remembered",
732
+ operation
733
+ });
734
+ }
735
+ const waitMs = at - now();
736
+ if (waitMs <= 0)
737
+ return;
738
+ if (waitMs > LONGEST_PACE_WAIT_MS)
739
+ 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 });
740
+ if (waitMs >= ANNOUNCE_WAIT_MS) {
741
+ const seconds = Math.ceil(waitMs / 1e3);
742
+ warn?.(`waiting ${seconds} s to keep this profile's pace with ${name}`, {
743
+ event: "warning",
744
+ code: "pace_wait",
745
+ operation,
746
+ counts: { seconds }
747
+ });
748
+ }
749
+ await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
750
+ }, "waitForTurn");
720
751
 
721
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
752
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
722
753
  var HOUSEKEEPING = /* @__PURE__ */ new Set([
723
754
  "help",
724
755
  "guide",
@@ -798,12 +829,10 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
798
829
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
799
830
  }, "refuseUnknownPermissionKeys");
800
831
 
801
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
832
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
802
833
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
803
834
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
804
835
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
805
- var ANNOUNCE_WAIT_MS = 5e3;
806
- var LONGEST_PACE_WAIT_MS = 5 * 6e4;
807
836
  var chatOf = /* @__PURE__ */ __name((args) => typeof args[0] === "string" && /^-?\d+$/.test(args[0]) ? args[0] : void 0, "chatOf");
808
837
  var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer }) => {
809
838
  const kept = /* @__PURE__ */ __name(async (operation, what2) => {
@@ -859,28 +888,8 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
859
888
  await kept(operation, () => pacer.holdFor(waitMs));
860
889
  }, "noted");
861
890
  const turn = /* @__PURE__ */ __name(async (operation) => {
862
- if (!pacer)
863
- return;
864
- let at = Date.now();
865
- await kept(operation, async () => {
866
- at = await pacer.reserve();
867
- });
868
- const waitMs = at - Date.now();
869
- if (waitMs <= 0)
870
- return;
871
- if (waitMs > LONGEST_PACE_WAIT_MS) {
872
- 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 });
873
- }
874
- if (waitMs >= ANNOUNCE_WAIT_MS) {
875
- const seconds = Math.ceil(waitMs / 1e3);
876
- warn(`waiting ${seconds} s to keep this profile's pace with ${name}`, {
877
- event: "warning",
878
- code: "pace_wait",
879
- operation,
880
- counts: { seconds }
881
- });
882
- }
883
- await new Promise((resolve) => setTimeout(resolve, waitMs));
891
+ if (pacer)
892
+ await waitForTurn(pacer, { name, operation, warn });
884
893
  }, "turn");
885
894
  return throughWrapper(messenger, {}, (operation, call) => {
886
895
  if (LONG_LIVED.has(operation))
@@ -917,7 +926,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
917
926
  });
918
927
  }, "flooded");
919
928
 
920
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
929
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
921
930
  var observed = /* @__PURE__ */ __name((messenger, events) => {
922
931
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
923
932
  const write = currentOperation();
@@ -1016,7 +1025,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
1016
1025
  counts[part] = (counts[part] ?? 0) + items.length;
1017
1026
  }, "byPart");
1018
1027
 
1019
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
1028
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
1020
1029
  var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
1021
1030
  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" }) => {
1022
1031
  let warned = false;
@@ -1592,7 +1601,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1592
1601
  }
1593
1602
  }, "keep");
1594
1603
 
1595
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1604
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1596
1605
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1597
1606
  let opened;
1598
1607
  return {
@@ -2,21 +2,21 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  storePath
5
- } from "./chunk-62JRF2JA.js";
5
+ } from "./chunk-AKUMR7PE.js";
6
6
  import {
7
7
  CliError,
8
8
  resolvePaths,
9
9
  singleLine
10
- } from "./chunk-IOJ2DTCY.js";
10
+ } from "./chunk-MLSN3UP4.js";
11
11
  import {
12
12
  __name
13
13
  } from "./chunk-ZVVMGPBJ.js";
14
14
 
15
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/store/shared-config.js
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/store/shared-config.js
16
16
  import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
17
17
  import { dirname, join, resolve } from "node:path";
18
18
 
19
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/domain/task-categories.js
19
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/domain/task-categories.js
20
20
  var DEFAULT_TASK_CATEGORIES = [
21
21
  {
22
22
  name: "taxes",
@@ -771,7 +771,7 @@ var storedTaskCategories = /* @__PURE__ */ __name((json) => {
771
771
  }
772
772
  }, "storedTaskCategories");
773
773
 
774
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/store/shared-config.js
774
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/store/shared-config.js
775
775
  var SECTION = "task_categories";
776
776
  var sharedConfigPath = /* @__PURE__ */ __name((store, env = process.env) => {
777
777
  const paths = resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env });
@@ -8,12 +8,12 @@ import {
8
8
  ACCESS_SECONDS,
9
9
  REFRESH_SECONDS,
10
10
  readStored
11
- } from "./chunk-6AW4DDK4.js";
11
+ } from "./chunk-XS56LIQ7.js";
12
12
  import {
13
13
  __name
14
14
  } from "./chunk-ZVVMGPBJ.js";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/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-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.595.0_@wirecat+cli-base@0.80.3_commander@15.0.0_esbuild@0.28.2_type_2c96d170c489856a39cafd5889a9e4ba/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
8
8
  var botInstructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => [
9
9
  `The owner's ${name} bot "${profile}", through the official Bot API \u2014 not the owner's personal account. What it writes, people see as the bot.`,
10
10
  "Use these tools to read the chats this bot is in, find a message or a person, and \u2014 when the profile allows \u2014 write as the bot.",