@wirecat/drive-cli 0.57.0 → 0.59.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 (167) hide show
  1. package/dist/bin/drive.js +6 -2
  2. package/dist/bin/drive.js.map +1 -1
  3. package/dist/bundle/{all-profiles-7LSZ3CC3.js → all-profiles-CVISDGMF.js} +14 -9
  4. package/dist/bundle/{anthropic-3QRM4QXB.js → anthropic-WLNQC23G.js} +11 -7
  5. package/dist/bundle/{app-server-WWNMUHID.js → app-server-P2VOONXF.js} +61 -53
  6. package/dist/bundle/{bun-NIIYUR5F.js → bun-CDFBNTKV.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-GSLSN3OT.js → bun-sqlite-MNZICITP.js} +8 -4
  8. package/dist/bundle/chunk-2AXA5SKP.js +23 -0
  9. package/dist/bundle/{chunk-EFEI724Z.js → chunk-36B7AIGP.js} +1 -1
  10. package/dist/bundle/{chunk-Q3TMNETS.js → chunk-3KJTJDDT.js} +52 -39
  11. package/dist/bundle/{chunk-4F2VRJZE.js → chunk-3KNZADHJ.js} +5080 -626
  12. package/dist/bundle/{chunk-GIQFBXQN.js → chunk-3U22QTU6.js} +12 -125
  13. package/dist/bundle/chunk-3VSUT6BD.js +35 -0
  14. package/dist/bundle/{chunk-U2RSVKR5.js → chunk-5C7K6XIT.js} +1 -1
  15. package/dist/bundle/{chunk-6CFSDU56.js → chunk-6C6255U6.js} +16 -14
  16. package/dist/bundle/{chunk-EE7R457T.js → chunk-6CQO2FIN.js} +1569 -739
  17. package/dist/bundle/{chunk-KHNDZNQA.js → chunk-7QTVIZII.js} +5410 -3002
  18. package/dist/bundle/{chunk-HNUSPNUQ.js → chunk-A6EG7ZDS.js} +13 -13
  19. package/dist/bundle/{chunk-WBYCUBYM.js → chunk-A6SLYOP2.js} +49 -42
  20. package/dist/bundle/{chunk-TR5656OS.js → chunk-AD62XJKO.js} +162 -106
  21. package/dist/bundle/{chunk-TKVSJV5P.js → chunk-B5GBJ35N.js} +6 -4
  22. package/dist/bundle/{chunk-LSSIVBQI.js → chunk-BSGOM3BD.js} +1 -1
  23. package/dist/bundle/{chunk-XGNADVIA.js → chunk-CBM2XAEZ.js} +28 -229
  24. package/dist/bundle/{chunk-OYNSFQ7K.js → chunk-D72URWJE.js} +1 -39
  25. package/dist/bundle/{chunk-L4BBK7UX.js → chunk-DI5Z4SH5.js} +5 -3
  26. package/dist/bundle/chunk-EBLA7GXY.js +45 -0
  27. package/dist/bundle/{chunk-4UQLL6RJ.js → chunk-EHEZSV6I.js} +11 -88
  28. package/dist/bundle/{chunk-6ZA4NR5H.js → chunk-EORMZCVF.js} +3 -3
  29. package/dist/bundle/{chunk-W5FOPSJZ.js → chunk-EVETU3TF.js} +10 -8
  30. package/dist/bundle/{chunk-TZHCS5MG.js → chunk-F3FOL42A.js} +2 -2
  31. package/dist/bundle/{chunk-2QLLKDE5.js → chunk-FICVPYE4.js} +206 -73
  32. package/dist/bundle/{chunk-AKPFH3KC.js → chunk-FVQCM7IQ.js} +1 -1
  33. package/dist/bundle/{chunk-ADLS6FVG.js → chunk-FXBHOCJK.js} +1 -1
  34. package/dist/bundle/{chunk-WAVJWGUC.js → chunk-GI5JBGXH.js} +4611 -1530
  35. package/dist/bundle/{chunk-SRNXTXJN.js → chunk-GJ4ZCIOP.js} +3 -3
  36. package/dist/bundle/{chunk-GKHUHRSL.js → chunk-GT5KTGCN.js} +4 -4
  37. package/dist/bundle/{chunk-WJOKTIOJ.js → chunk-H2BKXPBL.js} +2 -2
  38. package/dist/bundle/chunk-HIOJRPCT.js +93 -0
  39. package/dist/bundle/chunk-HIP43OGZ.js +34 -0
  40. package/dist/bundle/{chunk-2ULJW5BA.js → chunk-HMZAMHKN.js} +2 -2
  41. package/dist/bundle/{chunk-64E6QXXQ.js → chunk-HWLLVLAB.js} +10 -10
  42. package/dist/bundle/{chunk-373WJIHE.js → chunk-IADOBOKB.js} +2 -2
  43. package/dist/bundle/{chunk-B3TPS7BW.js → chunk-IBZ3IBO4.js} +9 -7
  44. package/dist/bundle/{chunk-QAT6UXZZ.js → chunk-IGF6EXBR.js} +53 -48
  45. package/dist/bundle/{chunk-KYNTSA6K.js → chunk-II7LST64.js} +5 -5
  46. package/dist/bundle/{chunk-JLKNUFL2.js → chunk-IIP43FQJ.js} +2 -2
  47. package/dist/bundle/{chunk-ELIYJXIY.js → chunk-JSDVK3JA.js} +2 -2
  48. package/dist/bundle/{chunk-UKMFPBAO.js → chunk-JW2CVCUH.js} +4 -4
  49. package/dist/bundle/{chunk-O5KDIVGE.js → chunk-K4LXGZTE.js} +23 -21
  50. package/dist/bundle/{chunk-RB674T6L.js → chunk-KFZUODXB.js} +76 -20
  51. package/dist/bundle/chunk-KPRGTTJH.js +34 -0
  52. package/dist/bundle/{chunk-XJVK7ETL.js → chunk-L5SE2XZP.js} +23 -15
  53. package/dist/bundle/{chunk-OOR6PEHV.js → chunk-LJ7E4HLQ.js} +1 -1
  54. package/dist/bundle/{chunk-VTJF2L5E.js → chunk-LPHMAQJQ.js} +16 -16
  55. package/dist/bundle/{chunk-566W4Q6L.js → chunk-M6I2SQN7.js} +4 -4
  56. package/dist/bundle/{chunk-NLLWLCUZ.js → chunk-MEAPA4EZ.js} +2 -2
  57. package/dist/bundle/{chunk-J2HGHSLX.js → chunk-MKCNUI72.js} +4 -4
  58. package/dist/bundle/{chunk-CD736BG3.js → chunk-MUUHUHWC.js} +2 -1
  59. package/dist/bundle/{chunk-AHBUTDS7.js → chunk-OKXSTWKW.js} +8 -8
  60. package/dist/bundle/{chunk-W6FYYQ2J.js → chunk-OMMEQJOB.js} +3 -3
  61. package/dist/bundle/{chunk-EFX6FIDM.js → chunk-OZH4ALTI.js} +1 -1
  62. package/dist/bundle/{chunk-KM4Y55ZE.js → chunk-P3ZTW2ZM.js} +7 -7
  63. package/dist/bundle/{chunk-5KNIVHP6.js → chunk-P7WPYKSB.js} +7 -20
  64. package/dist/bundle/{chunk-RAEKC6TV.js → chunk-PAEVBAM3.js} +9 -42
  65. package/dist/bundle/{chunk-LBFFI6FE.js → chunk-PGKIOSN3.js} +9 -7
  66. package/dist/bundle/{chunk-WJPVGXKA.js → chunk-QTM7USFA.js} +8 -13
  67. package/dist/bundle/{chunk-EN7OZ5JH.js → chunk-TFH5X46A.js} +37 -22
  68. package/dist/bundle/{chunk-OZJMZSFB.js → chunk-TI55J3BA.js} +6 -4
  69. package/dist/bundle/{chunk-R5GJZPRF.js → chunk-TJXPJ3A5.js} +572 -366
  70. package/dist/bundle/chunk-UQPKAY6I.js +106 -0
  71. package/dist/bundle/{chunk-JUKVJ7M2.js → chunk-UWVNRPT7.js} +56 -40
  72. package/dist/bundle/chunk-V36RIXFA.js +201 -0
  73. package/dist/bundle/{chunk-JIGMCW4C.js → chunk-V42KAPU3.js} +6 -6
  74. package/dist/bundle/{chunk-7SNS443B.js → chunk-VT6GZAF4.js} +35 -35
  75. package/dist/bundle/{chunk-ISK4K7UE.js → chunk-VVCZS42A.js} +1 -1
  76. package/dist/bundle/chunk-W62CON5K.js +166 -0
  77. package/dist/bundle/{chunk-YZ6SYLDC.js → chunk-XCOCPXCM.js} +2 -2
  78. package/dist/bundle/{chunk-G34Y5RAC.js → chunk-YADXWQHV.js} +29 -29
  79. package/dist/bundle/{chunk-AL7MY7MW.js → chunk-YU3PTU3D.js} +1 -1
  80. package/dist/bundle/{chunk-IJ2S53WJ.js → chunk-YV4ABH6J.js} +7 -7
  81. package/dist/bundle/{chunk-B64EY2SC.js → chunk-ZSMCJKGP.js} +42 -41
  82. package/dist/bundle/chunk-ZYCLPJ7U.js +46 -0
  83. package/dist/bundle/command-contract-LQDNHZJU.js +39 -0
  84. package/dist/bundle/{decode-5MHMPYKE.js → decode-XTOMXMGN.js} +10 -6
  85. package/dist/bundle/dispatch-T6TW2JJB.js +412 -0
  86. package/dist/bundle/drive.js +40 -22
  87. package/dist/bundle/{echarts-CLB22SZS.js → echarts-RKKIOYVV.js} +2 -2
  88. package/dist/bundle/{embed-TF66ODAR.js → embed-STHKKA6G.js} +9 -5
  89. package/dist/bundle/{embedder-EDWOIAC2.js → embedder-3XZEWHRO.js} +14 -10
  90. package/dist/bundle/entry-CNOYSSSD.js +22 -0
  91. package/dist/bundle/failure-DNQYXP2T.js +26 -0
  92. package/dist/bundle/first-run-F2SI24PK.js +30 -0
  93. package/dist/bundle/first-screen-TYYF6VXY.js +37 -0
  94. package/dist/bundle/{google-A4F2WFO4.js → google-BYNSAIQI.js} +13 -9
  95. package/dist/bundle/{google-api-ZXGQOJUI.js → google-api-4VTZH7OP.js} +59 -52
  96. package/dist/bundle/grants-EUQXSICG.js +105 -0
  97. package/dist/bundle/{identity-4IO7WGG4.js → identity-ARDPFYV5.js} +6 -4
  98. package/dist/bundle/{instructions-BXZZNAMS.js → instructions-N3OH5X2Y.js} +1 -1
  99. package/dist/bundle/{login-A4QHJ5DA.js → login-4VQEC7VI.js} +65 -58
  100. package/dist/bundle/{mcp-VVMPUDSL.js → mcp-WBHKX5E3.js} +5 -3
  101. package/dist/bundle/{node-P4E63KXA.js → node-KM3CUABH.js} +9 -9
  102. package/dist/bundle/{node-R6ZNQ3NT.js → node-YU5JBNAA.js} +2 -2
  103. package/dist/bundle/{node-sqlite-AFQTE4XZ.js → node-sqlite-3C6PSBIW.js} +14 -4
  104. package/dist/bundle/oauth-D6NJFPYU.js +22 -0
  105. package/dist/bundle/{open-WJCRBIP7.js → open-M2V2VYXO.js} +8 -3
  106. package/dist/bundle/{openai-3TIBDWZA.js → openai-ST2IWNUX.js} +18 -14
  107. package/dist/bundle/{process-P36JP33R.js → process-PYNNBBTV.js} +1 -1
  108. package/dist/bundle/{program-AHZH65IT.js → program-Q4VWV2MR.js} +193 -147
  109. package/dist/bundle/prompt-MFIOJMAF.js +17 -0
  110. package/dist/bundle/{reasons-VHCVYH54.js → reasons-LOQ5J73F.js} +5 -3
  111. package/dist/bundle/{recognize-4EAKIMON.js → recognize-FBLMWXNE.js} +7 -3
  112. package/dist/bundle/{remote-HX3JP4EH.js → remote-XC3OXE4T.js} +10 -6
  113. package/dist/bundle/{rerank-BW3A4PUU.js → rerank-2XMKKF4S.js} +10 -6
  114. package/dist/bundle/{serve-YYOOLIBS.js → serve-Q2BQHNZB.js} +15 -10
  115. package/dist/bundle/{server-G6XTEEFI.js → server-42HPV3AH.js} +46 -39
  116. package/dist/bundle/server-EWZYN323.js +70 -0
  117. package/dist/bundle/{services-OAPILZOW.js → services-WU22S2MU.js} +100 -26
  118. package/dist/bundle/{sqlite-runtime-GTXDK4PE.js → sqlite-runtime-CSO6K6B2.js} +9 -4
  119. package/dist/bundle/start-TZWKM4AH.js +138 -0
  120. package/dist/bundle/{state-XG335LGZ.js → state-FLUT7U7R.js} +9 -5
  121. package/dist/bundle/{store-N53SJOPS.js → store-HDWMJ44E.js} +42 -17
  122. package/dist/bundle/{store-7KOXJNQP.js → store-TG6622NG.js} +20 -12
  123. package/dist/bundle/store-maintenance-command-RHWRUREJ.js +60 -0
  124. package/dist/bundle/tokens-TXYURU4S.js +103 -0
  125. package/dist/commands/documents.d.ts +1 -0
  126. package/dist/commands/documents.d.ts.map +1 -1
  127. package/dist/commands/documents.js +14 -1
  128. package/dist/commands/documents.js.map +1 -1
  129. package/dist/commands/knowledge.d.ts +4 -0
  130. package/dist/commands/knowledge.d.ts.map +1 -1
  131. package/dist/commands/knowledge.js +8 -7
  132. package/dist/commands/knowledge.js.map +1 -1
  133. package/dist/contract-overrides.js +5 -5
  134. package/dist/contract-overrides.js.map +1 -1
  135. package/dist/knowledge-query.d.ts +2 -0
  136. package/dist/knowledge-query.d.ts.map +1 -1
  137. package/dist/program.d.ts.map +1 -1
  138. package/dist/program.js +8 -3
  139. package/dist/program.js.map +1 -1
  140. package/dist/provider-json.d.ts +2 -0
  141. package/dist/provider-json.d.ts.map +1 -1
  142. package/dist/provider-json.js +13 -0
  143. package/dist/provider-json.js.map +1 -1
  144. package/dist/reasons.d.ts.map +1 -1
  145. package/dist/reasons.js +1 -0
  146. package/dist/reasons.js.map +1 -1
  147. package/dist/store.d.ts +2 -0
  148. package/dist/store.d.ts.map +1 -1
  149. package/dist/store.js +9 -0
  150. package/dist/store.js.map +1 -1
  151. package/dist/version.d.ts +1 -1
  152. package/dist/version.js +1 -1
  153. package/package.json +5 -4
  154. package/skills/drive-cli/SKILL.md +2 -1
  155. package/dist/bundle/chunk-3BXSLNWW.js +0 -3607
  156. package/dist/bundle/chunk-CGCQNYB3.js +0 -18
  157. package/dist/bundle/command-contract-XIACCAZL.js +0 -35
  158. package/dist/bundle/entry-CWYCQ53A.js +0 -17
  159. package/dist/bundle/first-run-YIH7EHJI.js +0 -24
  160. package/dist/bundle/first-screen-THH3XD5Y.js +0 -33
  161. package/dist/bundle/grants-3Z7DG3W3.js +0 -98
  162. package/dist/bundle/oauth-46XBJBML.js +0 -18
  163. package/dist/bundle/prompt-FFGBIT4A.js +0 -13
  164. package/dist/bundle/server-YKYEUIJT.js +0 -63
  165. package/dist/bundle/store-maintenance-command-W3TI52X2.js +0 -52
  166. package/dist/bundle/tokens-P7TEHKDD.js +0 -96
  167. /package/dist/bundle/{chunk-HPXYN7F3.js → chunk-LK2E2ELG.js} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  commandPathOf,
8
8
  findCommand,
9
9
  outputOf
10
- } from "./chunk-RAEKC6TV.js";
10
+ } from "./chunk-PAEVBAM3.js";
11
11
  import {
12
12
  Command,
13
13
  Help,
@@ -18,16 +18,18 @@ import {
18
18
  environmentOf,
19
19
  metaOf,
20
20
  takesProfile
21
- } from "./chunk-4F2VRJZE.js";
21
+ } from "./chunk-3KNZADHJ.js";
22
22
  import {
23
- CliError,
24
23
  writes
25
- } from "./chunk-GIQFBXQN.js";
24
+ } from "./chunk-3U22QTU6.js";
25
+ import {
26
+ CliError
27
+ } from "./chunk-EBLA7GXY.js";
26
28
  import {
27
29
  __name
28
30
  } from "./chunk-ZVVMGPBJ.js";
29
31
 
30
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/help/sections.js
32
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/help/sections.js
31
33
  var SECTIONS = {
32
34
  read: "Read",
33
35
  write: "Write",
@@ -92,7 +94,7 @@ var CORE_SECTIONS = {
92
94
  upgrade: "setup"
93
95
  };
94
96
 
95
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/help/commands-text.js
97
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/help/commands-text.js
96
98
  var DESCRIPTION = 90;
97
99
  var COLUMN = 52;
98
100
  var short = /* @__PURE__ */ __name((text) => {
@@ -131,7 +133,7 @@ var commandsText = /* @__PURE__ */ __name((root, commands, scope) => {
131
133
  `;
132
134
  }, "commandsText");
133
135
 
134
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
136
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
135
137
  var ARGUMENT_KINDS = {
136
138
  chat: "chat",
137
139
  chats: "chat",
@@ -323,7 +325,7 @@ var installCommandHelp = /* @__PURE__ */ __name((program, { profile = true } = {
323
325
  command.addHelpText("after", () => commandHelpText(command));
324
326
  }, "installCommandHelp");
325
327
 
326
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
328
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
327
329
  var WIRECAT_TOOLS = [
328
330
  {
329
331
  command: "tg",
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-GIQFBXQN.js";
5
+ } from "./chunk-EBLA7GXY.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/input-policy.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/input-policy.js
11
11
  var MAX_BUFFERED_INPUT = 16 * 1024 * 1024;
12
12
  var MAX_SECRET_INPUT = 64 * 1024;
13
13
  var policies = /* @__PURE__ */ new WeakMap();
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  answerOf,
5
5
  messengerContext
6
- } from "./chunk-B64EY2SC.js";
6
+ } from "./chunk-ZSMCJKGP.js";
7
7
  import {
8
8
  chatEventAnswer,
9
9
  memberAnswer,
@@ -12,24 +12,7 @@ import {
12
12
  serveRelay,
13
13
  typedQuery,
14
14
  withQuery
15
- } from "./chunk-EN7OZ5JH.js";
16
- import {
17
- holdLock,
18
- lockPath,
19
- releaseLock,
20
- servingProfiles,
21
- takeLock
22
- } from "./chunk-SRNXTXJN.js";
23
- import {
24
- RULES_VERSION,
25
- applyTaskRulesOnArrival,
26
- newSendId,
27
- onlineDeps,
28
- openRequestTask,
29
- senderIsMe,
30
- servicesFor,
31
- syncsOneChat
32
- } from "./chunk-KHNDZNQA.js";
15
+ } from "./chunk-TFH5X46A.js";
33
16
  import {
34
17
  stringWidth,
35
18
  wrapAnsi
@@ -57,33 +40,51 @@ import {
57
40
  snakeKeys,
58
41
  storeTable,
59
42
  withoutProviderRefs
60
- } from "./chunk-4F2VRJZE.js";
43
+ } from "./chunk-3KNZADHJ.js";
44
+ import {
45
+ envName
46
+ } from "./chunk-IIP43FQJ.js";
47
+ import {
48
+ holdLock,
49
+ lockPath,
50
+ releaseLock,
51
+ servingProfiles,
52
+ takeLock
53
+ } from "./chunk-GJ4ZCIOP.js";
61
54
  import {
62
55
  holdersOf
63
- } from "./chunk-U2RSVKR5.js";
56
+ } from "./chunk-5C7K6XIT.js";
57
+ import {
58
+ checkedOptions,
59
+ range
60
+ } from "./chunk-DI5Z4SH5.js";
61
+ import {
62
+ FETCHING,
63
+ RULES_VERSION,
64
+ applyTaskRulesOnArrival,
65
+ capability,
66
+ newSendId,
67
+ onlineDeps,
68
+ openRequestTask,
69
+ patiently,
70
+ senderIsMe,
71
+ servicesFor,
72
+ syncsOneChat
73
+ } from "./chunk-7QTVIZII.js";
64
74
  import {
65
75
  codeOf,
66
76
  currentRun,
67
- levelFor
68
- } from "./chunk-TR5656OS.js";
77
+ levelFor,
78
+ parseDuration
79
+ } from "./chunk-AD62XJKO.js";
69
80
  import {
70
81
  failureKey
71
- } from "./chunk-2ULJW5BA.js";
72
- import {
73
- envName
74
- } from "./chunk-JLKNUFL2.js";
75
- import {
76
- readSecret
77
- } from "./chunk-W6FYYQ2J.js";
78
- import {
79
- checkedOptions,
80
- range
81
- } from "./chunk-L4BBK7UX.js";
82
+ } from "./chunk-HMZAMHKN.js";
82
83
  import {
83
84
  messagesFor,
84
85
  systemFor,
85
86
  validateImages
86
- } from "./chunk-ELIYJXIY.js";
87
+ } from "./chunk-JSDVK3JA.js";
87
88
  import {
88
89
  MIGRATIONS,
89
90
  drainNoteIndex,
@@ -112,26 +113,30 @@ import {
112
113
  storeClients,
113
114
  storeContents,
114
115
  vectorIndexCounts
115
- } from "./chunk-WAVJWGUC.js";
116
+ } from "./chunk-GI5JBGXH.js";
116
117
  import {
117
118
  queryFieldsOf
118
- } from "./chunk-XJVK7ETL.js";
119
+ } from "./chunk-L5SE2XZP.js";
119
120
  import {
120
121
  storePath
121
- } from "./chunk-CGCQNYB3.js";
122
+ } from "./chunk-3VSUT6BD.js";
122
123
  import {
123
124
  openCache
124
- } from "./chunk-WJPVGXKA.js";
125
+ } from "./chunk-QTM7USFA.js";
126
+ import {
127
+ readSecret
128
+ } from "./chunk-OMMEQJOB.js";
125
129
  import {
126
130
  Credentials,
127
131
  pathsAreOverridden,
128
132
  resolvePaths,
129
- singleLine,
130
- visibleControls,
131
133
  writeSecurely
132
- } from "./chunk-XGNADVIA.js";
134
+ } from "./chunk-CBM2XAEZ.js";
135
+ import {
136
+ singleLine,
137
+ visibleControls
138
+ } from "./chunk-HIP43OGZ.js";
133
139
  import {
134
- CliError,
135
140
  array,
136
141
  boolean,
137
142
  check,
@@ -154,7 +159,10 @@ import {
154
159
  transform,
155
160
  trim,
156
161
  union
157
- } from "./chunk-GIQFBXQN.js";
162
+ } from "./chunk-3U22QTU6.js";
163
+ import {
164
+ CliError
165
+ } from "./chunk-EBLA7GXY.js";
158
166
  import {
159
167
  __commonJS,
160
168
  __name,
@@ -5494,11 +5502,11 @@ var require_liquid_node = __commonJS({
5494
5502
  }
5495
5503
  });
5496
5504
 
5497
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5505
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
5498
5506
  import { chmodSync, constants, copyFileSync, existsSync as existsSync7, mkdirSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync3, writeFileSync } from "node:fs";
5499
5507
  import { dirname, resolve } from "node:path";
5500
5508
 
5501
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/sealed.js
5509
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/sealed.js
5502
5510
  import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
5503
5511
  import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
5504
5512
  import { Transform } from "node:stream";
@@ -5605,7 +5613,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
5605
5613
  renameSync(pending, to);
5606
5614
  }, "unsealFile");
5607
5615
 
5608
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5616
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/store/compatibility.js
5609
5617
  var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
5610
5618
  var fileSchemaOf = /* @__PURE__ */ __name((database) => {
5611
5619
  const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
@@ -5629,7 +5637,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
5629
5637
  };
5630
5638
  }, "compatibilityOf");
5631
5639
 
5632
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/store/repair.js
5640
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/store/repair.js
5633
5641
  import { createHash as createHash2 } from "node:crypto";
5634
5642
  var COPY_MARK = "__repair_";
5635
5643
  var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
@@ -5883,7 +5891,7 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
5883
5891
  return found;
5884
5892
  }, "deleteCopy");
5885
5893
 
5886
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5894
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/store-info.js
5887
5895
  import { existsSync as existsSync2, statSync as statSync2 } from "node:fs";
5888
5896
  var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
5889
5897
  var bytesOf = /* @__PURE__ */ __name((path) => existsSync2(path) ? statSync2(path).size : 0, "bytesOf");
@@ -5930,7 +5938,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
5930
5938
  renderAnswer(this, outputFor(this), itemOf(answer));
5931
5939
  }), "storeInfoCommand");
5932
5940
 
5933
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
5941
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
5934
5942
  var ENCRYPT_OPTION = [
5935
5943
  "--encrypt",
5936
5944
  "compress and encrypt with a password, typed at a hidden prompt or piped on stdin; it is never kept \u2014 lose it and the file cannot be opened"
@@ -5949,7 +5957,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
5949
5957
  return password;
5950
5958
  }, "passwordOf");
5951
5959
 
5952
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/rules.js
5960
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/rules.js
5953
5961
  import { existsSync as existsSync3, readFileSync } from "node:fs";
5954
5962
  import { join } from "node:path";
5955
5963
  var REPLY_ACTIONS = ["reply", "task"];
@@ -6120,7 +6128,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
6120
6128
  }, "problem");
6121
6129
  var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
6122
6130
 
6123
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/state.js
6131
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/state.js
6124
6132
  import { existsSync as existsSync4, readFileSync as readFileSync2 } from "node:fs";
6125
6133
  import { join as join2 } from "node:path";
6126
6134
  var ANSWERED_KEPT = 1e3;
@@ -6173,7 +6181,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
6173
6181
  }, "recordReply");
6174
6182
  var broken2 = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply state ${path} cannot be read (${why}) \u2014 fix or move the file`), "broken");
6175
6183
 
6176
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/decide.js
6184
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/decide.js
6177
6185
  var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
6178
6186
  var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
6179
6187
  const { message, chat, owner, sender } = incoming;
@@ -6279,7 +6287,7 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
6279
6287
  return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
6280
6288
  }, "filled");
6281
6289
 
6282
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/template.js
6290
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/template.js
6283
6291
  var import_liquidjs = __toESM(require_liquid_node(), 1);
6284
6292
  var TEMPLATE_LIMITS = {
6285
6293
  parse: 32768,
@@ -6439,7 +6447,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
6439
6447
  }
6440
6448
  }, "renderReplyTemplate");
6441
6449
 
6442
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
6450
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
6443
6451
  var DRY_RUN_DAYS = 7;
6444
6452
  var PAGE = 500;
6445
6453
  var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
@@ -6553,7 +6561,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
6553
6561
  }
6554
6562
  }, "storedSince");
6555
6563
 
6556
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
6564
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
6557
6565
  var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
6558
6566
  const host = new URL(baseUrl).host;
6559
6567
  return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
@@ -6584,7 +6592,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
6584
6592
  };
6585
6593
  }, "embeddingKeys");
6586
6594
 
6587
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/models/openai.js
6595
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/models/openai.js
6588
6596
  var options = strictObject({
6589
6597
  temperature: range(0, 2),
6590
6598
  top_p: range(0, 1),
@@ -6633,7 +6641,7 @@ var openai = {
6633
6641
  }, "complete")
6634
6642
  };
6635
6643
 
6636
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/models/index.js
6644
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/models/index.js
6637
6645
  var modelGateway = /* @__PURE__ */ __name((deps) => ({
6638
6646
  complete: /* @__PURE__ */ __name(async (request) => {
6639
6647
  if (deps.signal?.aborted)
@@ -6648,7 +6656,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
6648
6656
  if (!adapter && target.provider === "openai")
6649
6657
  adapter = openai;
6650
6658
  if (!adapter && target.provider === "anthropic")
6651
- adapter = (await import("./anthropic-3QRM4QXB.js")).anthropic;
6659
+ adapter = (await import("./anthropic-WLNQC23G.js")).anthropic;
6652
6660
  if (!adapter)
6653
6661
  throw new CliError("validation_error", `no model adapter for ${target.provider}`);
6654
6662
  if (request.images !== void 0 && adapter.images !== true)
@@ -6689,7 +6697,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
6689
6697
  }, "complete")
6690
6698
  }), "modelGateway");
6691
6699
 
6692
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/consents.js
6700
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/consents.js
6693
6701
  import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
6694
6702
  import { join as join3 } from "node:path";
6695
6703
  var shape = strictObject({
@@ -6714,7 +6722,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
6714
6722
  return consent.provider === provider && !consent.deniedChats.includes(chat);
6715
6723
  }, "mayModelReply");
6716
6724
 
6717
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/rendering.js
6725
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/rendering.js
6718
6726
  var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options2 = {
6719
6727
  ai: true
6720
6728
  }) => async (rule2, message, chat, now) => {
@@ -6761,7 +6769,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
6761
6769
  return result2;
6762
6770
  }, "replyRenderer");
6763
6771
 
6764
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/replies/serve.js
6772
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/replies/serve.js
6765
6773
  var NOT_ALLOWED = "replies.send is not allow";
6766
6774
  var NO_RULES = "no rules";
6767
6775
  var ONLY_TASK = "opened a task, sent nothing";
@@ -6854,7 +6862,84 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
6854
6862
  return { skip: why };
6855
6863
  }, "replyTo");
6856
6864
 
6857
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
6865
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
6866
+ var START_SYNC_DELAY_MS = 3e4;
6867
+ var START_SYNC_BUDGET_MS = 5 * 6e4;
6868
+ var START_SYNC_WINDOW_MS = 7 * 864e5;
6869
+ var START_SYNC_PER_CHAT = 500;
6870
+ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note, warn, delayMs = START_SYNC_DELAY_MS, budgetMs = START_SYNC_BUDGET_MS, windowMs = START_SYNC_WINDOW_MS, now = Date.now }) => {
6871
+ const controller = new AbortController();
6872
+ let timer;
6873
+ let pass = Promise.resolve();
6874
+ let started = false;
6875
+ let done;
6876
+ const run = /* @__PURE__ */ __name(async () => {
6877
+ const stop = AbortSignal.any([controller.signal, AbortSignal.timeout(budgetMs)]);
6878
+ const floor = now() - windowMs;
6879
+ const moved = [];
6880
+ for (const chat of await chats(stop)) {
6881
+ const lastAt = Date.parse(chat.lastMessageAt ?? "");
6882
+ if (Number.isNaN(lastAt) || lastAt < floor)
6883
+ continue;
6884
+ moved.push({ chat, lastAt, held: await newestHeld(chat.id) });
6885
+ }
6886
+ const anywhere = moved.reduce((top, { held }) => held === void 0 ? top : Math.max(top, held), -Infinity);
6887
+ if (!Number.isFinite(anywhere))
6888
+ return;
6889
+ const behind = moved.filter(({ lastAt, held }) => lastAt > (held ?? anywhere)).sort((one, other) => other.lastAt - one.lastAt);
6890
+ if (behind.length === 0)
6891
+ return;
6892
+ const summary = { chats: 0, fetched: 0, failed: 0, stopped: false };
6893
+ done = summary;
6894
+ for (const { chat, held } of behind) {
6895
+ if (stop.aborted)
6896
+ break;
6897
+ try {
6898
+ summary.fetched += (await fetch2(chat.id, Math.max(held ?? anywhere, floor), stop)).fetched;
6899
+ summary.chats += 1;
6900
+ } catch (error) {
6901
+ if (stop.aborted)
6902
+ break;
6903
+ summary.failed += 1;
6904
+ const errorCode = failureKey(error);
6905
+ warn({
6906
+ code: "start_sync_chat_failed",
6907
+ chatId: chat.id,
6908
+ errorCode,
6909
+ text: `what ${chat.id} received while serve was down was not fetched: ${errorCode}`
6910
+ });
6911
+ }
6912
+ }
6913
+ summary.stopped = stop.aborted && summary.chats + summary.failed < behind.length;
6914
+ note({
6915
+ code: "start_sync",
6916
+ text: `caught up ${summary.fetched} message(s) in ${summary.chats} chat(s) that moved while serve was down` + (summary.stopped ? ` \u2014 stopped at the time limit, ${behind.length - summary.chats - summary.failed} left` : "")
6917
+ });
6918
+ }, "run");
6919
+ return {
6920
+ start: /* @__PURE__ */ __name(() => {
6921
+ if (started || controller.signal.aborted)
6922
+ return;
6923
+ started = true;
6924
+ timer = setTimeout(() => {
6925
+ pass = run().catch((error) => {
6926
+ if (controller.signal.aborted)
6927
+ return;
6928
+ const errorCode = failureKey(error);
6929
+ warn({ code: "start_sync_failed", errorCode, text: `the catch-up on start failed: ${errorCode}` });
6930
+ });
6931
+ }, delayMs);
6932
+ }, "start"),
6933
+ stop: /* @__PURE__ */ __name(async () => {
6934
+ controller.abort();
6935
+ clearTimeout(timer);
6936
+ await pass;
6937
+ }, "stop"),
6938
+ summary: /* @__PURE__ */ __name(() => done, "summary")
6939
+ };
6940
+ }, "startSync");
6941
+
6942
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
6858
6943
  var FIRST_FETCH_MS = 6e4;
6859
6944
  var DAY_MS = 864e5;
6860
6945
  var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
@@ -6908,7 +6993,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
6908
6993
  };
6909
6994
  }, "memberFetches");
6910
6995
 
6911
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
6996
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
6912
6997
  var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
6913
6998
  var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
6914
6999
  if (context.format === "pretty") {
@@ -6941,7 +7026,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
6941
7026
  return context;
6942
7027
  }, "recordDiagnostics");
6943
7028
 
6944
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
7029
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
6945
7030
  var STEMS_EVERY_MS = 3e4;
6946
7031
  var STEMS_SLICE_MS = 2e3;
6947
7032
  var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
@@ -6981,7 +7066,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
6981
7066
  };
6982
7067
  }, "stemFills");
6983
7068
 
6984
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/render/messages.js
7069
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/render/messages.js
6985
7070
  import { styleText } from "node:util";
6986
7071
  var TIME_WIDTH = 8;
6987
7072
  var INDENT = " ".repeat(TIME_WIDTH + 2);
@@ -7157,7 +7242,7 @@ var editedAt = /* @__PURE__ */ __name((message, options2) => {
7157
7242
  return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
7158
7243
  }, "editedAt");
7159
7244
 
7160
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7245
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
7161
7246
  var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
7162
7247
  var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
7163
7248
  kind: attachment.kind,
@@ -7252,7 +7337,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
7252
7337
  locale: messenger.app.locale
7253
7338
  }), "viewOf");
7254
7339
 
7255
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7340
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
7256
7341
  var observed = /* @__PURE__ */ __name((value) => ({
7257
7342
  value: value.value,
7258
7343
  observed_at: value.observedAt,
@@ -7319,7 +7404,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
7319
7404
  }
7320
7405
  }, "watchEventItem");
7321
7406
 
7322
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7407
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
7323
7408
  var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
7324
7409
  output: { entity: "watch_item" },
7325
7410
  effects: REMOTE_READ,
@@ -7474,7 +7559,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
7474
7559
  }
7475
7560
  }, "describe");
7476
7561
 
7477
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
7562
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
7478
7563
  var serveCommand = /* @__PURE__ */ __name((messenger) => {
7479
7564
  const command = annotate(new Command("serve"), {
7480
7565
  output: { entity: "serve_summary" },
@@ -7517,7 +7602,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
7517
7602
  const counts = {};
7518
7603
  const rules = replying(context, messenger, Date.parse(startedAt));
7519
7604
  const tasks = tasking(context, warn);
7520
- const { handled } = environmentOf(this);
7605
+ const { handled, startSyncDelayMs } = environmentOf(this);
7521
7606
  const count3 = /* @__PURE__ */ __name((event) => {
7522
7607
  counts[event.event] = (counts[event.event] ?? 0) + 1;
7523
7608
  if (event.event === "message") {
@@ -7541,6 +7626,50 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
7541
7626
  }).chats.fetchMembers(chatId, {}), "fetch"),
7542
7627
  warn
7543
7628
  });
7629
+ const fetching = messenger.fetching ?? FETCHING;
7630
+ const catchingUp = startSync({
7631
+ chats: /* @__PURE__ */ __name(async (stop) => {
7632
+ const list = capability(connection, "chats", "list its chats");
7633
+ const all = [];
7634
+ for (let offset = 0; ; ) {
7635
+ const page = await patiently(() => list({ offset, limit: 100 }), context.renderer.note, stop);
7636
+ for (const chat of page.items)
7637
+ all.push(chat);
7638
+ offset += page.items.length;
7639
+ if (!page.hasMore || page.items.length === 0)
7640
+ return all;
7641
+ }
7642
+ }, "chats"),
7643
+ newestHeld: /* @__PURE__ */ __name((chatId) => context.withStore(async (store, account) => {
7644
+ const [newest] = await store.messages.messagesWindow(account, chatId, {
7645
+ at: startedAt,
7646
+ before: 1,
7647
+ after: 0
7648
+ });
7649
+ return newest ? Date.parse(newest.timestamp) : void 0;
7650
+ }, { name: "serve catch-up" }), "newestHeld"),
7651
+ fetch: /* @__PURE__ */ __name((chatId, sinceMs, stop) => context.withStore((store, account) => servicesFor({
7652
+ ...onlineDeps(messenger, connection, context.guard, {
7653
+ profile: context.profile,
7654
+ env: context.env
7655
+ }),
7656
+ store: /* @__PURE__ */ __name(async () => store, "store"),
7657
+ account: /* @__PURE__ */ __name(async () => account, "account")
7658
+ }).archive.fetch(chatId, {
7659
+ limit: START_SYNC_PER_CHAT,
7660
+ pageSize: fetching.page,
7661
+ pauseMs: parseDuration(fetching.pause, "pause"),
7662
+ sinceMs,
7663
+ catchUp: false,
7664
+ note: context.renderer.note,
7665
+ stop,
7666
+ onPage: /* @__PURE__ */ __name(() => {
7667
+ }, "onPage")
7668
+ }), { name: "serve catch-up" }), "fetch"),
7669
+ note,
7670
+ warn,
7671
+ ...startSyncDelayMs === void 0 ? {} : { delayMs: startSyncDelayMs }
7672
+ });
7544
7673
  const stems = stemFills({
7545
7674
  withStore: /* @__PURE__ */ __name((work) => context.withStore((store) => work(store), { name: "serve stems" }), "withStore"),
7546
7675
  warn
@@ -7555,12 +7684,15 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
7555
7684
  rules.connected(open);
7556
7685
  members.start();
7557
7686
  stems.start();
7687
+ if (messenger.history !== "store" && typeof open.chats === "function")
7688
+ catchingUp.start();
7558
7689
  }, "connected")
7559
7690
  });
7560
7691
  } finally {
7561
7692
  await relaying;
7562
7693
  await relay?.close();
7563
7694
  rules.stop();
7695
+ await catchingUp.stop();
7564
7696
  await members.stop();
7565
7697
  await stems.stop();
7566
7698
  await rules.settled();
@@ -7575,6 +7707,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
7575
7707
  ...rules.summary(),
7576
7708
  ...members.summary().fetched + members.summary().failed > 0 ? { members: members.summary() } : {},
7577
7709
  ...stems.summary().stemmed > 0 ? { stems: stems.summary() } : {},
7710
+ ...catchingUp.summary() ? { caught_up: catchingUp.summary() } : {},
7578
7711
  ...tasks.summary()
7579
7712
  }));
7580
7713
  });
@@ -7690,7 +7823,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
7690
7823
  };
7691
7824
  }, "tasking");
7692
7825
 
7693
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
7826
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
7694
7827
  import { existsSync as existsSync6 } from "node:fs";
7695
7828
  var PATH = "store tables list";
7696
7829
  var STORE_TABLES_QUERY = {
@@ -7733,7 +7866,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
7733
7866
  return tables;
7734
7867
  }, "storeTablesCommand");
7735
7868
 
7736
- // node_modules/.pnpm/@wirecat+cli-core@0.546.0_@wirecat+cli-base@0.73.0_commander@15.0.0_esbuild@0.28.2_type_6245070bff0a7c29971e74a96fde145c/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
7869
+ // node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
7737
7870
  var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
7738
7871
  var WORD_INDEX = "message_words";
7739
7872
  var schemaOf = /* @__PURE__ */ __name((database) => {
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError,
5
5
  isCliError
6
- } from "./chunk-GIQFBXQN.js";
6
+ } from "./chunk-EBLA7GXY.js";
7
7
  import {
8
8
  __name
9
9
  } from "./chunk-ZVVMGPBJ.js";
@@ -9424,7 +9424,7 @@ var EnvironmentWorker = /* @__PURE__ */ (() => {
9424
9424
  const ctrl = new AbortController();
9425
9425
  const detachExternal = linkAbort(externalSignal, ctrl);
9426
9426
  const lease = new Lease(ctrl);
9427
- const agentToolset = await import("./node-P4E63KXA.js");
9427
+ const agentToolset = await import("./node-KM3CUABH.js");
9428
9428
  let leaseTtlMs;
9429
9429
  let runner;
9430
9430
  const heartbeatPromise = heartbeatLoop(sessionClient, work, lease, log, this.requestOptions, (ttlMs) => {