@wirecat/cli-memo 0.131.70 → 0.131.72

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 (340) hide show
  1. package/README.md +3 -3
  2. package/THIRD_PARTY_NOTICES +2 -0
  3. package/dist/actions/actions.d.ts +2 -1
  4. package/dist/actions/actions.d.ts.map +1 -1
  5. package/dist/actions/actions.js +5 -3
  6. package/dist/actions/actions.js.map +1 -1
  7. package/dist/actions/command.d.ts.map +1 -1
  8. package/dist/actions/command.js +15 -6
  9. package/dist/actions/command.js.map +1 -1
  10. package/dist/answer.d.ts +1 -0
  11. package/dist/answer.d.ts.map +1 -1
  12. package/dist/answer.js +2 -1
  13. package/dist/answer.js.map +1 -1
  14. package/dist/bin/memo.js +2 -2
  15. package/dist/bin/memo.js.map +1 -1
  16. package/dist/bundle/{all-profiles-6JKSPBBO.js → all-profiles-G6S5HOBT.js} +5 -5
  17. package/dist/bundle/{anthropic-YA2N6EJ4.js → anthropic-LA6PXTPQ.js} +2 -2
  18. package/dist/bundle/{app-server-UP3AL2XQ.js → app-server-SESNZIAV.js} +35 -35
  19. package/dist/bundle/auto-WU47LYXJ.js +85 -0
  20. package/dist/bundle/{bun-OUFOAYV4.js → bun-PZNVNH4G.js} +2 -2
  21. package/dist/bundle/{bun-sqlite-5RZTFU2Q.js → bun-sqlite-VICDK5FS.js} +2 -2
  22. package/dist/bundle/{chunk-GVP6CAPH.js → chunk-2RNNWFU7.js} +33 -586
  23. package/dist/bundle/{chunk-OHA7HDPX.js → chunk-2VETW2QK.js} +1024 -676
  24. package/dist/bundle/{chunk-IHHXGTMX.js → chunk-3LS76TFB.js} +1 -1
  25. package/dist/bundle/{chunk-N73YBQ42.js → chunk-3ZSPTUG3.js} +9 -7
  26. package/dist/bundle/{chunk-7OXLZZ27.js → chunk-5XRCF57Z.js} +86 -2
  27. package/dist/bundle/{chunk-RHW3DDWI.js → chunk-6B3GQMR6.js} +1 -1
  28. package/dist/bundle/{chunk-EDPA54WQ.js → chunk-6Z62U7NY.js} +3 -3
  29. package/dist/bundle/{chunk-IJAILIZR.js → chunk-A4UQKFGY.js} +18 -18
  30. package/dist/bundle/{chunk-JMGQATR6.js → chunk-ASDOPGKC.js} +2 -2
  31. package/dist/bundle/{chunk-52F4LHCH.js → chunk-B7LGXY3S.js} +4 -4
  32. package/dist/bundle/{chunk-FQ54GW57.js → chunk-BD7AGXJJ.js} +8366 -8360
  33. package/dist/bundle/{chunk-FZHYGJQ2.js → chunk-CLQXHFKG.js} +5 -5
  34. package/dist/bundle/{chunk-VPKJZKXV.js → chunk-CPUQC7UF.js} +1 -1
  35. package/dist/bundle/{chunk-5OMM4CDT.js → chunk-ESYCZ575.js} +2 -2
  36. package/dist/bundle/{chunk-YXXAPVAZ.js → chunk-FDSM2TU6.js} +8 -8
  37. package/dist/bundle/{chunk-YBTUFOQG.js → chunk-FENNNSCI.js} +5 -5
  38. package/dist/bundle/{chunk-OBQ7TSUB.js → chunk-FHIGY5K6.js} +1 -1
  39. package/dist/bundle/{chunk-57SQU2YO.js → chunk-FOPDWCRG.js} +10 -6
  40. package/dist/bundle/{chunk-MK6SQ32Q.js → chunk-FPWF2XLH.js} +12 -12
  41. package/dist/bundle/{chunk-MYLNRBDF.js → chunk-FVJSDDSV.js} +46 -13
  42. package/dist/bundle/{chunk-EQKS6M52.js → chunk-FXZ7PQKG.js} +5 -5
  43. package/dist/bundle/{chunk-TV75OHKJ.js → chunk-G3FQTKHT.js} +7 -7
  44. package/dist/bundle/{chunk-WNA2WNDK.js → chunk-G7XOBQB5.js} +3 -3
  45. package/dist/bundle/{chunk-PSYQPO6D.js → chunk-H3LAORYX.js} +2 -2
  46. package/dist/bundle/{chunk-2DQYP2K3.js → chunk-HIHZNBR7.js} +1 -1
  47. package/dist/bundle/{chunk-22CDLXSR.js → chunk-I4HWKPQR.js} +4 -4
  48. package/dist/bundle/{chunk-QAXIZHK7.js → chunk-II2SXJEO.js} +33 -33
  49. package/dist/bundle/{chunk-2NFI7SDW.js → chunk-INQAQ55X.js} +2304 -1111
  50. package/dist/bundle/{chunk-LYAJUZM4.js → chunk-IRBYZUI7.js} +30 -30
  51. package/dist/bundle/{chunk-EO4JMJFZ.js → chunk-IXZWUHSG.js} +7 -7
  52. package/dist/bundle/{chunk-MWQI6FSU.js → chunk-K55WZ67L.js} +3 -3
  53. package/dist/bundle/{chunk-YTJWIJIG.js → chunk-KH43CUE2.js} +5 -5
  54. package/dist/bundle/{chunk-2C7Z7CKD.js → chunk-LIF2HXIQ.js} +1 -1
  55. package/dist/bundle/{chunk-3LGLKLBA.js → chunk-M2DAITNE.js} +2 -2
  56. package/dist/bundle/{chunk-OAO5UCPJ.js → chunk-MAGAWAPG.js} +1366 -1574
  57. package/dist/bundle/{chunk-7JFLHRQL.js → chunk-MKOQDN3I.js} +1 -1
  58. package/dist/bundle/{chunk-67VEVKMJ.js → chunk-MSTWHRLN.js} +1 -1
  59. package/dist/bundle/{chunk-GGFL64HF.js → chunk-NRLXWY4Q.js} +13170 -11987
  60. package/dist/bundle/{chunk-267N22E4.js → chunk-PGOMGFXA.js} +1 -1
  61. package/dist/bundle/{chunk-4HSWIXYE.js → chunk-PHL53ERQ.js} +4 -4
  62. package/dist/bundle/{chunk-53EAI4VZ.js → chunk-QUPPO7DB.js} +1 -1
  63. package/dist/bundle/{chunk-276KPJI5.js → chunk-RF6KPQWV.js} +2 -2
  64. package/dist/bundle/{chunk-3OEV7GNU.js → chunk-RGIS2DRA.js} +4 -4
  65. package/dist/bundle/{chunk-TXOXPQN2.js → chunk-SL2LXOCN.js} +2 -2
  66. package/dist/bundle/{chunk-QZU5IM5E.js → chunk-SR7C53CS.js} +2 -2
  67. package/dist/bundle/{chunk-ECHN36DC.js → chunk-STJWETNW.js} +4 -4
  68. package/dist/bundle/{chunk-BGWPKEKK.js → chunk-SVVSGUMU.js} +4 -4
  69. package/dist/bundle/{chunk-GVEY6743.js → chunk-THPGFRPZ.js} +9 -9
  70. package/dist/bundle/{chunk-V2YS63Z5.js → chunk-U3P5F57B.js} +1 -1
  71. package/dist/bundle/{chunk-PHSYMVYX.js → chunk-UCRR7R6Q.js} +2 -2
  72. package/dist/bundle/{chunk-2F35N6BI.js → chunk-UX52EWLQ.js} +1 -1
  73. package/dist/bundle/{chunk-XTEJXJJ3.js → chunk-WT2P44YD.js} +10 -10
  74. package/dist/bundle/{chunk-UEMI6FXR.js → chunk-XNX3U6GD.js} +6 -6
  75. package/dist/bundle/{chunk-3TFK7RBA.js → chunk-XXEHPPNS.js} +23908 -22107
  76. package/dist/bundle/{chunk-5EHUHZU5.js → chunk-YBL4QKLV.js} +80 -68
  77. package/dist/bundle/{chunk-7L4PBN5S.js → chunk-ZM6J47GY.js} +2 -2
  78. package/dist/bundle/{command-contract-OGW2DX4C.js → command-contract-7QECBB6M.js} +11 -11
  79. package/dist/bundle/{decode-IJMDTGTW.js → decode-WRWXOJML.js} +2 -2
  80. package/dist/bundle/{echarts-EHYUXOKP.js → echarts-MTCNTCST.js} +2 -2
  81. package/dist/bundle/{embed-RUY3UIVC.js → embed-PPPCHSTE.js} +3 -3
  82. package/dist/bundle/{embedder-P6WBMEGP.js → embedder-UJBIX6A2.js} +6 -6
  83. package/dist/bundle/{entry-7S2ONYSF.js → entry-W6SHKRBE.js} +4 -4
  84. package/dist/bundle/failure-NRJ3EPBO.js +65 -0
  85. package/dist/bundle/{first-run-MLIFZSVH.js → first-run-7HAWGQ3B.js} +5 -5
  86. package/dist/bundle/{first-screen-DGTTK6VK.js → first-screen-FRRTKWFB.js} +12 -12
  87. package/dist/bundle/{instructions-ZMG4FLGO.js → instructions-JKIO4JF7.js} +1 -1
  88. package/dist/bundle/{mcp-CFIL7WZU.js → mcp-OL6ZYF2T.js} +35 -35
  89. package/dist/bundle/memo.js +14 -11
  90. package/dist/bundle/{node-QYL4B7JS.js → node-3AIXDDDR.js} +2 -2
  91. package/dist/bundle/{node-sqlite-ESTT2OCF.js → node-sqlite-NX722DXD.js} +3 -3
  92. package/dist/bundle/{oauth-CFQFSIRQ.js → oauth-2NPSI7Q3.js} +4 -4
  93. package/dist/bundle/{open-3XO2HMIT.js → open-AFRN6Q36.js} +2 -2
  94. package/dist/bundle/{openai-STUNDBD6.js → openai-U5CQFLRU.js} +7 -7
  95. package/dist/bundle/{process-P4UAJCZX.js → process-J2IBN6X7.js} +1 -1
  96. package/dist/bundle/{program-RSUVU6HA.js → program-MRG4ZQQI.js} +2107 -516
  97. package/dist/bundle/{prompt-ZCYMFMIG.js → prompt-6XNKR4VQ.js} +2 -2
  98. package/dist/bundle/{recognize-V3BY33FK.js → recognize-G3GI32QS.js} +1 -1
  99. package/dist/bundle/{remote-IP4QR7SP.js → remote-DJO255PT.js} +4 -4
  100. package/dist/bundle/{rerank-VKUSF3DM.js → rerank-5SBZRIHF.js} +4 -4
  101. package/dist/bundle/{serve-VBIUARHJ.js → serve-BZVBKGU3.js} +6 -6
  102. package/dist/bundle/server-AEZPZ3ZD.js +48 -0
  103. package/dist/bundle/server-CIT5B2SV.js +61 -0
  104. package/dist/bundle/{server-BVRPQPGY.js → server-D5BJDKTJ.js} +62 -53
  105. package/dist/bundle/{state-UBAIZ2WP.js → state-A57F7T5D.js} +3 -3
  106. package/dist/bundle/{store-VQQVUA4W.js → store-JXD7SGIK.js} +9 -9
  107. package/dist/bundle/store-maintenance-command-5DG4SEQA.js +47 -0
  108. package/dist/bundle/update-NI24ED4V.js +68 -0
  109. package/dist/config.d.ts +5 -0
  110. package/dist/config.d.ts.map +1 -1
  111. package/dist/config.js +5 -0
  112. package/dist/config.js.map +1 -1
  113. package/dist/context/command.d.ts +2 -1
  114. package/dist/context/command.d.ts.map +1 -1
  115. package/dist/context/command.js +34 -12
  116. package/dist/context/command.js.map +1 -1
  117. package/dist/context/context.d.ts +20 -8
  118. package/dist/context/context.d.ts.map +1 -1
  119. package/dist/context/context.js +65 -40
  120. package/dist/context/context.js.map +1 -1
  121. package/dist/contract-overrides/search.js +1 -1
  122. package/dist/contract-overrides/search.js.map +1 -1
  123. package/dist/digest/digest.d.ts.map +1 -1
  124. package/dist/digest/digest.js +2 -1
  125. package/dist/digest/digest.js.map +1 -1
  126. package/dist/discovery/command.d.ts.map +1 -1
  127. package/dist/discovery/command.js +2 -0
  128. package/dist/discovery/command.js.map +1 -1
  129. package/dist/doctor/command.d.ts +22 -2
  130. package/dist/doctor/command.d.ts.map +1 -1
  131. package/dist/examples.d.ts.map +1 -1
  132. package/dist/examples.js +60 -10
  133. package/dist/examples.js.map +1 -1
  134. package/dist/facts/command.d.ts.map +1 -1
  135. package/dist/facts/command.js +7 -6
  136. package/dist/facts/command.js.map +1 -1
  137. package/dist/finance/deal-text.d.ts +4 -0
  138. package/dist/finance/deal-text.d.ts.map +1 -0
  139. package/dist/finance/deal-text.js +34 -0
  140. package/dist/finance/deal-text.js.map +1 -0
  141. package/dist/finance/deals-command.d.ts +1 -1
  142. package/dist/finance/deals-command.d.ts.map +1 -1
  143. package/dist/finance/deals-command.js +113 -13
  144. package/dist/finance/deals-command.js.map +1 -1
  145. package/dist/knowledge/business-text.d.ts +7 -0
  146. package/dist/knowledge/business-text.d.ts.map +1 -0
  147. package/dist/knowledge/business-text.js +19 -0
  148. package/dist/knowledge/business-text.js.map +1 -0
  149. package/dist/knowledge/command.d.ts +1 -1
  150. package/dist/knowledge/command.d.ts.map +1 -1
  151. package/dist/knowledge/command.js +131 -42
  152. package/dist/knowledge/command.js.map +1 -1
  153. package/dist/knowledge/money-text.d.ts +4 -0
  154. package/dist/knowledge/money-text.d.ts.map +1 -0
  155. package/dist/knowledge/money-text.js +16 -0
  156. package/dist/knowledge/money-text.js.map +1 -0
  157. package/dist/knowledge/organization-text.d.ts +7 -0
  158. package/dist/knowledge/organization-text.d.ts.map +1 -0
  159. package/dist/knowledge/organization-text.js +24 -0
  160. package/dist/knowledge/organization-text.js.map +1 -0
  161. package/dist/knowledge/project-actions-command.js +1 -1
  162. package/dist/knowledge/project-actions-command.js.map +1 -1
  163. package/dist/knowledge/project-actions.d.ts +1 -1
  164. package/dist/knowledge/project-actions.d.ts.map +1 -1
  165. package/dist/knowledge/project-actions.js +2 -2
  166. package/dist/knowledge/project-actions.js.map +1 -1
  167. package/dist/knowledge/project-context.d.ts +27 -1
  168. package/dist/knowledge/project-context.d.ts.map +1 -1
  169. package/dist/knowledge/project-context.js +9 -5
  170. package/dist/knowledge/project-context.js.map +1 -1
  171. package/dist/knowledge/project-status-command.d.ts.map +1 -1
  172. package/dist/knowledge/project-status-command.js +21 -5
  173. package/dist/knowledge/project-status-command.js.map +1 -1
  174. package/dist/knowledge/relationships.d.ts +27 -23
  175. package/dist/knowledge/relationships.d.ts.map +1 -1
  176. package/dist/knowledge/relationships.js +65 -52
  177. package/dist/knowledge/relationships.js.map +1 -1
  178. package/dist/knowledge/roles-command.d.ts +8 -0
  179. package/dist/knowledge/roles-command.d.ts.map +1 -0
  180. package/dist/knowledge/roles-command.js +65 -0
  181. package/dist/knowledge/roles-command.js.map +1 -0
  182. package/dist/mcp/catalogue.d.ts +19 -1
  183. package/dist/mcp/catalogue.d.ts.map +1 -1
  184. package/dist/mcp/catalogue.js +9 -1
  185. package/dist/mcp/catalogue.js.map +1 -1
  186. package/dist/mcp/server.js +1 -1
  187. package/dist/mcp/server.js.map +1 -1
  188. package/dist/memories/command.d.ts.map +1 -1
  189. package/dist/memories/command.js +6 -5
  190. package/dist/memories/command.js.map +1 -1
  191. package/dist/memories/sources.js +2 -2
  192. package/dist/memories/sources.js.map +1 -1
  193. package/dist/models/command.d.ts +1 -1
  194. package/dist/models/command.d.ts.map +1 -1
  195. package/dist/models/command.js +2 -1
  196. package/dist/models/command.js.map +1 -1
  197. package/dist/notes/command.d.ts.map +1 -1
  198. package/dist/notes/command.js +13 -8
  199. package/dist/notes/command.js.map +1 -1
  200. package/dist/notes/embed.d.ts +6 -1
  201. package/dist/notes/embed.d.ts.map +1 -1
  202. package/dist/notes/embed.js +17 -8
  203. package/dist/notes/embed.js.map +1 -1
  204. package/dist/people/command.d.ts.map +1 -1
  205. package/dist/people/command.js +7 -2
  206. package/dist/people/command.js.map +1 -1
  207. package/dist/people/identities-command.d.ts +5 -0
  208. package/dist/people/identities-command.d.ts.map +1 -0
  209. package/dist/people/identities-command.js +179 -0
  210. package/dist/people/identities-command.js.map +1 -0
  211. package/dist/people/identity.d.ts +5 -0
  212. package/dist/people/identity.d.ts.map +1 -1
  213. package/dist/people/identity.js +19 -2
  214. package/dist/people/identity.js.map +1 -1
  215. package/dist/program.d.ts +15 -1
  216. package/dist/program.d.ts.map +1 -1
  217. package/dist/program.js +191 -5
  218. package/dist/program.js.map +1 -1
  219. package/dist/reasons.d.ts.map +1 -1
  220. package/dist/reasons.js +84 -0
  221. package/dist/reasons.js.map +1 -1
  222. package/dist/review/command.js +2 -2
  223. package/dist/review/command.js.map +1 -1
  224. package/dist/review/kinds.d.ts +1 -1
  225. package/dist/review/kinds.d.ts.map +1 -1
  226. package/dist/review/kinds.js +1 -0
  227. package/dist/review/kinds.js.map +1 -1
  228. package/dist/review/review.d.ts +3 -3
  229. package/dist/review/review.d.ts.map +1 -1
  230. package/dist/review/review.js +6 -6
  231. package/dist/review/review.js.map +1 -1
  232. package/dist/review/status.d.ts.map +1 -1
  233. package/dist/review/status.js +5 -4
  234. package/dist/review/status.js.map +1 -1
  235. package/dist/run/import.d.ts +8 -2
  236. package/dist/run/import.d.ts.map +1 -1
  237. package/dist/run/import.js +31 -11
  238. package/dist/run/import.js.map +1 -1
  239. package/dist/search/command.d.ts.map +1 -1
  240. package/dist/search/command.js +21 -3
  241. package/dist/search/command.js.map +1 -1
  242. package/dist/search/denied.d.ts +10 -0
  243. package/dist/search/denied.d.ts.map +1 -0
  244. package/dist/search/denied.js +10 -0
  245. package/dist/search/denied.js.map +1 -0
  246. package/dist/search/people.d.ts.map +1 -1
  247. package/dist/search/people.js +11 -1
  248. package/dist/search/people.js.map +1 -1
  249. package/dist/search/search.d.ts +2 -0
  250. package/dist/search/search.d.ts.map +1 -1
  251. package/dist/search/search.js +37 -12
  252. package/dist/search/search.js.map +1 -1
  253. package/dist/sources/command.d.ts +3 -1
  254. package/dist/sources/command.d.ts.map +1 -1
  255. package/dist/sources/command.js +3 -1
  256. package/dist/sources/command.js.map +1 -1
  257. package/dist/sources/readers/api.d.ts +4 -0
  258. package/dist/sources/readers/api.d.ts.map +1 -0
  259. package/dist/sources/readers/api.js +48 -0
  260. package/dist/sources/readers/api.js.map +1 -0
  261. package/dist/sources/readers/claude-code.d.ts +7 -0
  262. package/dist/sources/readers/claude-code.d.ts.map +1 -0
  263. package/dist/sources/readers/claude-code.js +74 -0
  264. package/dist/sources/readers/claude-code.js.map +1 -0
  265. package/dist/sources/readers/codex.d.ts +7 -0
  266. package/dist/sources/readers/codex.d.ts.map +1 -0
  267. package/dist/sources/readers/codex.js +72 -0
  268. package/dist/sources/readers/codex.js.map +1 -0
  269. package/dist/sources/readers/index.d.ts +6 -0
  270. package/dist/sources/readers/index.d.ts.map +1 -0
  271. package/dist/sources/readers/index.js +8 -0
  272. package/dist/sources/readers/index.js.map +1 -0
  273. package/dist/sources/readers/keys.d.ts +13 -0
  274. package/dist/sources/readers/keys.d.ts.map +1 -0
  275. package/dist/sources/readers/keys.js +25 -0
  276. package/dist/sources/readers/keys.js.map +1 -0
  277. package/dist/sources/readers/ollama.d.ts +3 -0
  278. package/dist/sources/readers/ollama.d.ts.map +1 -0
  279. package/dist/sources/readers/ollama.js +60 -0
  280. package/dist/sources/readers/ollama.js.map +1 -0
  281. package/dist/sources/readers/process.d.ts +16 -0
  282. package/dist/sources/readers/process.d.ts.map +1 -0
  283. package/dist/sources/readers/process.js +49 -0
  284. package/dist/sources/readers/process.js.map +1 -0
  285. package/dist/sources/readers/types.d.ts +38 -0
  286. package/dist/sources/readers/types.d.ts.map +1 -0
  287. package/dist/sources/readers/types.js +2 -0
  288. package/dist/sources/readers/types.js.map +1 -0
  289. package/dist/sources/suggest-command.d.ts +9 -0
  290. package/dist/sources/suggest-command.d.ts.map +1 -0
  291. package/dist/sources/suggest-command.js +202 -0
  292. package/dist/sources/suggest-command.js.map +1 -0
  293. package/dist/sources/suggest.d.ts +56 -0
  294. package/dist/sources/suggest.d.ts.map +1 -0
  295. package/dist/sources/suggest.js +143 -0
  296. package/dist/sources/suggest.js.map +1 -0
  297. package/dist/store/group.d.ts +38 -0
  298. package/dist/store/group.d.ts.map +1 -0
  299. package/dist/store/group.js +112 -0
  300. package/dist/store/group.js.map +1 -0
  301. package/dist/store/groups-command.d.ts +10 -0
  302. package/dist/store/groups-command.d.ts.map +1 -0
  303. package/dist/store/groups-command.js +88 -0
  304. package/dist/store/groups-command.js.map +1 -0
  305. package/dist/store/guard.d.ts +29 -0
  306. package/dist/store/guard.d.ts.map +1 -0
  307. package/dist/store/guard.js +94 -0
  308. package/dist/store/guard.js.map +1 -0
  309. package/dist/store/scope.d.ts +3 -3
  310. package/dist/store/scope.d.ts.map +1 -1
  311. package/dist/store/scope.js +7 -6
  312. package/dist/store/scope.js.map +1 -1
  313. package/dist/store/source-list.d.ts +5 -1
  314. package/dist/store/source-list.d.ts.map +1 -1
  315. package/dist/store/source-list.js +30 -15
  316. package/dist/store/source-list.js.map +1 -1
  317. package/dist/tags/command.d.ts.map +1 -1
  318. package/dist/tags/command.js +3 -2
  319. package/dist/tags/command.js.map +1 -1
  320. package/dist/tasks/shared.d.ts.map +1 -1
  321. package/dist/tasks/shared.js +2 -1
  322. package/dist/tasks/shared.js.map +1 -1
  323. package/dist/tasks/tasks.js +3 -3
  324. package/dist/tasks/tasks.js.map +1 -1
  325. package/dist/version.d.ts +1 -1
  326. package/dist/version.js +1 -1
  327. package/package.json +5 -4
  328. package/skills/cli-memo/SKILL.md +9 -9
  329. package/skills/cli-memo/topics/mcp.md +9 -0
  330. package/skills/cli-memo/topics/money.md +14 -1
  331. package/skills/cli-memo/topics/projects.md +2 -1
  332. package/skills/cli-memo/topics/proposals.md +40 -1
  333. package/skills/cli-memo/topics/search.md +15 -5
  334. package/dist/bundle/auto-CVILDIC6.js +0 -85
  335. package/dist/bundle/failure-HM55W3NH.js +0 -65
  336. package/dist/bundle/server-AASCSGCI.js +0 -61
  337. package/dist/bundle/server-YQLPZK4Z.js +0 -48
  338. package/dist/bundle/store-maintenance-command-GCBABKEZ.js +0 -47
  339. package/dist/bundle/update-ZE53ASCW.js +0 -68
  340. /package/dist/bundle/{chunk-AWVQHWIS.js → chunk-YSYFOIW7.js} +0 -0
@@ -1,36 +1,39 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
+ FloodMemory,
4
5
  OFFLINE,
6
+ RecipientList,
5
7
  capability,
8
+ ceilingRefusal,
6
9
  chatIdIn,
7
10
  chatReferenceOf,
8
11
  ensureAccount,
12
+ floodPathFor,
9
13
  foldName,
14
+ guardFor,
15
+ holdEnd,
10
16
  isId,
11
17
  pickPerson,
12
18
  profilesOnAccount,
19
+ recipientsPathFor,
13
20
  refuseLacking,
14
21
  servicesFor,
15
- throughWrapper
16
- } from "./chunk-3TFK7RBA.js";
22
+ throughWrapper,
23
+ withFileLockAsync
24
+ } from "./chunk-XXEHPPNS.js";
17
25
  import {
18
26
  CEILING_KEY,
19
- LOG_ATTRIBUTES,
20
27
  WRITE_KEYS,
21
28
  asFirstWord,
22
29
  baseContext,
23
30
  codeOf,
24
31
  currentOperation,
25
- currentRun,
26
32
  environmentOf,
27
- fromLogAttributes,
28
33
  issueMessage,
29
34
  keyForCommand,
30
- keyForWrite,
31
35
  levelFor,
32
36
  limitBatch,
33
- logAttributes,
34
37
  permissionIssues,
35
38
  publicIssue,
36
39
  readKeysForCommand,
@@ -38,28 +41,21 @@ import {
38
41
  rememberAccount,
39
42
  rootOf2 as rootOf,
40
43
  skipFlagFor
41
- } from "./chunk-OAO5UCPJ.js";
44
+ } from "./chunk-MAGAWAPG.js";
42
45
  import {
43
46
  providerErrorKey
44
- } from "./chunk-N73YBQ42.js";
45
- import {
46
- MESSENGER_CHANGE_REFUSAL,
47
- readOnlyRefusal
48
- } from "./chunk-2DQYP2K3.js";
47
+ } from "./chunk-3ZSPTUG3.js";
49
48
  import {
50
49
  servingProfiles
51
- } from "./chunk-7L4PBN5S.js";
50
+ } from "./chunk-ZM6J47GY.js";
52
51
  import {
53
52
  openStore
54
- } from "./chunk-GGFL64HF.js";
53
+ } from "./chunk-NRLXWY4Q.js";
55
54
  import {
56
55
  isCliFailure
57
- } from "./chunk-3LGLKLBA.js";
56
+ } from "./chunk-M2DAITNE.js";
58
57
  import {
59
- logRecordOf,
60
- realSleep,
61
- resolvePaths,
62
- writeSecurely
58
+ resolvePaths
63
59
  } from "./chunk-UUBV5ATQ.js";
64
60
  import {
65
61
  CliError
@@ -68,7 +64,7 @@ import {
68
64
  __name
69
65
  } from "./chunk-ZVVMGPBJ.js";
70
66
 
71
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
67
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_25b690dd810be59ade44e4d26e61c9f5/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
72
68
  import { openSync } from "node:fs";
73
69
  import { createInterface } from "node:readline";
74
70
  import { ReadStream } from "node:tty";
@@ -123,551 +119,11 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
123
119
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
124
120
  }, "terminalAsker");
125
121
 
126
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/guard.js
127
- import { randomUUID } from "node:crypto";
128
-
129
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/flood.js
130
- import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
131
- import { dirname, join } from "node:path";
132
- var MOST_DEADLINES = 50;
133
- var LIMITED_HOLD_MS = 60 * 60 * 1e3;
134
- var FROZEN_HOLD_MS = 24 * 60 * 60 * 1e3;
135
- var NO_END = "9999-12-31T23:59:59.999Z";
136
- var holdEnd = /* @__PURE__ */ __name((block, show = (iso) => iso) => block.until === null ? "until lifted" : `until ${show(block.until)}`, "holdEnd");
137
- var floodPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "flood", `${profile}.json`), "floodPathFor");
138
- var FloodMemory = class {
139
- static {
140
- __name(this, "FloodMemory");
141
- }
142
- path;
143
- now;
144
- constructor(path, now = Date.now) {
145
- this.path = path;
146
- this.now = now;
147
- }
148
- /** What is still in force; anything expired is left out. */
149
- read() {
150
- const now = this.now();
151
- let raw;
152
- try {
153
- raw = JSON.parse(readFileSync(this.path, "utf8"));
154
- } catch {
155
- return { deadlines: [] };
156
- }
157
- const alive = /* @__PURE__ */ __name((until) => typeof until === "string" && Date.parse(until) > now, "alive");
158
- const deadlines = Array.isArray(raw.deadlines) ? raw.deadlines.filter((one) => typeof one?.operation === "string" && alive(one.until)) : [];
159
- const block = raw.sendBlock && (raw.sendBlock.until === NO_END ? { ...raw.sendBlock, until: null } : raw.sendBlock);
160
- const held = block && (block.until === null || alive(block.until));
161
- return { deadlines, ...held ? { sendBlock: block } : {} };
162
- }
163
- /** The deadline this call is still under: one for its chat, or one for the call in every chat. */
164
- owed(operation, chatId) {
165
- return this.read().deadlines.filter((one) => one.operation === operation && (one.chatId === void 0 || one.chatId === chatId)).sort((a, b) => b.until.localeCompare(a.until))[0];
166
- }
167
- remember(deadline) {
168
- const { waitMs, ...rest } = deadline;
169
- const kept = { ...rest, until: new Date(this.now() + waitMs).toISOString() };
170
- const state = this.read();
171
- const others = state.deadlines.filter((one) => one.operation !== kept.operation || one.chatId !== kept.chatId);
172
- const deadlines = [...others, kept].sort((a, b) => b.until.localeCompare(a.until)).slice(0, MOST_DEADLINES);
173
- this.#write({ ...state, deadlines });
174
- return kept;
175
- }
176
- sendBlock() {
177
- return this.read().sendBlock;
178
- }
179
- /** A ban the messenger gave no end for holds until lifted; a spam limit or a freeze without one, for a while. */
180
- block(block) {
181
- const now = this.now();
182
- const holdMs = { limited: LIMITED_HOLD_MS, frozen: FROZEN_HOLD_MS, banned: void 0 }[block.state];
183
- const kept = {
184
- ...block,
185
- since: new Date(now).toISOString(),
186
- until: block.until ?? (holdMs === void 0 ? null : new Date(now + holdMs).toISOString())
187
- };
188
- this.#write({ ...this.read(), sendBlock: kept });
189
- return kept;
190
- }
191
- /** Lifts only a block of this state: an account found not frozen may still be limited for spam. */
192
- unblock(state) {
193
- const { sendBlock, ...rest } = this.read();
194
- if (sendBlock?.state === state)
195
- this.#write(rest);
196
- }
197
- /** Forgets every wait and lifts the hold, and answers with what was still in force. */
198
- clear() {
199
- const cleared = this.read();
200
- this.#write({ deadlines: [] });
201
- return cleared;
202
- }
203
- #write({ sendBlock, ...rest }) {
204
- const state = sendBlock ? { ...rest, sendBlock: { ...sendBlock, until: sendBlock.until ?? NO_END } } : rest;
205
- mkdirSync(dirname(this.path), { recursive: true, mode: 448 });
206
- const temporary = `${this.path}.${process.pid}.tmp`;
207
- writeFileSync(temporary, `${JSON.stringify(state)}
208
- `, { mode: 384 });
209
- renameSync(temporary, this.path);
210
- }
211
- };
212
-
213
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/journal.js
214
- import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
215
- import { dirname as dirname3, join as join2 } from "node:path";
216
-
217
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
218
- import { closeSync, mkdirSync as mkdirSync2, openSync as openSync2, statSync, unlinkSync } from "node:fs";
219
- import { dirname as dirname2 } from "node:path";
220
- var LOCK_WAIT_MS = 5e3;
221
- var LOCK_STALE_MS = 3e4;
222
- var RETRY_MS = 20;
223
- var pause = new Int32Array(new SharedArrayBuffer(4));
224
- var withFileLock = /* @__PURE__ */ __name((path, what2, body, waitMs = LOCK_WAIT_MS) => {
225
- const lock = lockFor(path);
226
- const deadline = Date.now() + waitMs;
227
- while (!taken(lock)) {
228
- if (Date.now() >= deadline)
229
- throw lockTimeout(what2, waitMs, lock);
230
- Atomics.wait(pause, 0, 0, RETRY_MS);
231
- }
232
- return holding(lock, body);
233
- }, "withFileLock");
234
- var withFileLockAsync = /* @__PURE__ */ __name(async (path, what2, body, waitMs = LOCK_WAIT_MS, sleep = realSleep) => {
235
- const lock = lockFor(path);
236
- const deadline = Date.now() + waitMs;
237
- while (!taken(lock)) {
238
- if (Date.now() >= deadline)
239
- throw lockTimeout(what2, waitMs, lock);
240
- await sleep(RETRY_MS);
241
- }
242
- return holding(lock, body);
243
- }, "withFileLockAsync");
244
- var lockFor = /* @__PURE__ */ __name((path) => {
245
- mkdirSync2(dirname2(path), { recursive: true, mode: 448 });
246
- return `${path}.lock`;
247
- }, "lockFor");
248
- var taken = /* @__PURE__ */ __name((lock) => {
249
- for (; ; ) {
250
- try {
251
- closeSync(openSync2(lock, "wx", 384));
252
- return true;
253
- } catch (error) {
254
- if (error.code !== "EEXIST")
255
- throw error;
256
- if (Date.now() - lockTime(lock) <= LOCK_STALE_MS)
257
- return false;
258
- try {
259
- unlinkSync(lock);
260
- } catch {
261
- }
262
- }
263
- }
264
- }, "taken");
265
- var holding = /* @__PURE__ */ __name((lock, body) => {
266
- try {
267
- return body();
268
- } finally {
269
- try {
270
- unlinkSync(lock);
271
- } catch {
272
- }
273
- }
274
- }, "holding");
275
- var lockTimeout = /* @__PURE__ */ __name((what2, waitMs, lock) => new CliError("timeout", `${what2} stayed locked for ${waitMs / 1e3}s (${lock})`), "lockTimeout");
276
- var lockTime = /* @__PURE__ */ __name((lock) => {
277
- try {
278
- return statSync(lock).mtimeMs;
279
- } catch {
280
- return Date.now();
281
- }
282
- }, "lockTime");
283
-
284
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/journal.js
285
- var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
286
- var SendJournal = class {
287
- static {
288
- __name(this, "SendJournal");
289
- }
290
- path;
291
- resource;
292
- constructor(path, resource = { service: "unknown", version: "unknown" }) {
293
- this.path = path;
294
- this.resource = resource;
295
- }
296
- /**
297
- * Runs `body` with the journal to itself, across processes: two sends at the limit must not both
298
- * read "one left". A lock file opened with `wx`, because `flock` is not there on Windows.
299
- */
300
- locked(body) {
301
- return withFileLock(this.path, "the send journal", body);
302
- }
303
- /** `locked` without blocking the thread while another process holds the journal: what `serve` uses. */
304
- lockedAsync(body) {
305
- return withFileLockAsync(this.path, "the send journal", body);
306
- }
307
- append(entry) {
308
- const { at, ...attributes } = entry;
309
- const { runId, command, traceId } = currentRun();
310
- const record = logRecordOf({
311
- severity: entry.outcome === "sent" || entry.outcome === "reserved" ? "info" : "warn",
312
- event: logAttributes({ event: "send.recorded", ...attributes }),
313
- time: at,
314
- runId,
315
- ...traceId === void 0 ? {} : { traceId },
316
- command,
317
- resource: this.resource,
318
- allow: LOG_ATTRIBUTES
319
- });
320
- mkdirSync3(dirname3(this.path), { recursive: true, mode: 448 });
321
- appendFileSync(this.path, `${JSON.stringify(record)}
322
- `, { mode: 384 });
323
- }
324
- /**
325
- * Oldest first, each reservation folded into its outcome; one with no outcome yet is in flight,
326
- * or its process died. A line that does not parse is skipped: a torn last write must not block sending.
327
- */
328
- entries(filter) {
329
- const lines = this.#lines();
330
- const settled2 = new Set(lines.filter((entry) => entry.outcome !== "reserved").map((entry) => entry.reservation));
331
- const entries = lines.filter((entry) => entry.outcome !== "reserved" || !settled2.has(entry.reservation)).map(({ reservation, ...entry }) => entry.outcome === "reserved" ? { ...entry, reservation } : entry).map(withSendId);
332
- return filter === void 0 ? entries : entries.filter((entry) => (filter.outcome === void 0 || entry.outcome === filter.outcome) && (filter.chatId === void 0 || entry.chatId === filter.chatId) && (filter.operationId === void 0 || entry.operationId === filter.operationId) && (filter.errorCode === void 0 || entry.errorCode === filter.errorCode) && (filter.key === void 0 || entry.key === filter.key));
333
- }
334
- #lines() {
335
- let text;
336
- try {
337
- text = readFileSync2(this.path, "utf8");
338
- } catch {
339
- return [];
340
- }
341
- return text.split("\n").filter((line) => line.trim() !== "").flatMap((line) => {
342
- try {
343
- return [entryOf(JSON.parse(line))];
344
- } catch {
345
- return [];
346
- }
347
- });
348
- }
349
- };
350
- var entryOf = /* @__PURE__ */ __name((line) => {
351
- if (!("attributes" in line))
352
- return line;
353
- const { event: _, ...attributes } = line.attributes;
354
- return { at: line.time, ...fromLogAttributes(attributes) };
355
- }, "entryOf");
356
- var withSendId = /* @__PURE__ */ __name((entry) => {
357
- const { cid, ...rest } = entry;
358
- return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
359
- }, "withSendId");
360
-
361
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/recipients.js
362
- import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
363
- import { join as join3 } from "node:path";
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");
365
- var RecipientList = class {
366
- static {
367
- __name(this, "RecipientList");
368
- }
369
- path;
370
- command;
371
- lockWaitMs;
372
- /** `command` names the program in the hint that turns the list off. */
373
- constructor(path, command, lockWaitMs) {
374
- this.path = path;
375
- this.command = command;
376
- this.lockWaitMs = lockWaitMs;
377
- }
378
- /** `undefined` when the list is off. A file that cannot be read refuses rather than opening up. */
379
- read() {
380
- if (!existsSync(this.path))
381
- return void 0;
382
- try {
383
- const parsed = JSON.parse(readFileSync3(this.path, "utf8"));
384
- if (!Array.isArray(parsed.chats))
385
- throw new Error("no `chats` array");
386
- return parsed.chats;
387
- } catch (error) {
388
- throw new CliError("configuration_error", `the recipient list ${this.path} cannot be read (${error instanceof Error ? error.message : String(error)}) \u2014 fix the file or turn the list off with \`${this.command} recipients clear\``);
389
- }
390
- }
391
- list(filter = {}) {
392
- const chats = this.read();
393
- return {
394
- state: chats === void 0 ? "off" : chats.length === 0 ? "empty" : "on",
395
- items: (chats ?? []).filter((chat) => (filter.id === void 0 || chat.id === filter.id) && (filter.title === void 0 || chat.title?.toLocaleLowerCase() === filter.title.toLocaleLowerCase()))
396
- };
397
- }
398
- /** Whether it was new. Adding one again fills in a partner an older entry was stored without. */
399
- add(recipient) {
400
- return this.#locked(() => this.#added(recipient));
401
- }
402
- /** `add` waiting for the lock on timers: `recipients add` connects, so it runs inside `serve` when one holds the account. */
403
- addAsync(recipient) {
404
- return withFileLockAsync(this.path, "the recipient list", () => this.#added(recipient), this.lockWaitMs);
405
- }
406
- #added(recipient) {
407
- const chats = this.read() ?? [];
408
- const known = chats.find((chat) => chat.id === recipient.id);
409
- if (known) {
410
- if (recipient.partnerId && !known.partnerId) {
411
- this.#write(chats.map((chat) => chat === known ? { ...known, partnerId: recipient.partnerId } : chat));
412
- }
413
- return false;
414
- }
415
- this.#write([...chats, recipient]);
416
- return true;
417
- }
418
- /** The id or the title as it was stored; `undefined` when neither matched. */
419
- remove(reference) {
420
- return this.#locked(() => {
421
- const chats = this.read() ?? [];
422
- const wanted = reference.trim();
423
- const gone = chats.find((chat) => chat.id === wanted) ?? chats.find((chat) => chat.title?.toLocaleLowerCase() === wanted.toLocaleLowerCase());
424
- if (gone)
425
- this.#write(chats.filter((chat) => chat !== gone));
426
- return gone;
427
- });
428
- }
429
- /**
430
- * The chat the messenger now names `to`: its entry, and a partner of that id, follow it. Only an entry already there
431
- * changes, and no list is created, so the list never opens up. Whether anything changed.
432
- */
433
- async rekey(from, to) {
434
- if (from === to)
435
- return false;
436
- return withFileLockAsync(this.path, "the recipient list", () => {
437
- const chats = this.read();
438
- if (!chats?.some((chat) => chat.id === from || chat.partnerId === from))
439
- return false;
440
- const held = chats.some((chat) => chat.id === to);
441
- this.#write(chats.filter((chat) => !(held && chat.id === from)).map((chat) => ({
442
- ...chat,
443
- ...chat.id === from ? { id: to } : {},
444
- ...chat.partnerId === from ? { partnerId: to } : {}
445
- })));
446
- return true;
447
- }, this.lockWaitMs);
448
- }
449
- /** Whether there was a list to turn off. */
450
- off() {
451
- return this.#locked(() => {
452
- if (!existsSync(this.path))
453
- return false;
454
- rmSync(this.path);
455
- return true;
456
- });
457
- }
458
- /**
459
- * Every change reads and writes under one lock: a `serve` re-keying while the owner removes a chat must not write
460
- * the removed chat back. A lock held too long refuses the change and leaves the list as it was. Blocks the thread
461
- * while it waits: for callers that cannot be async, and `recipients remove` and `clear`, which never
462
- * connect and so never run inside `serve`.
463
- */
464
- #locked(body) {
465
- return withFileLock(this.path, "the recipient list", body, this.lockWaitMs);
466
- }
467
- #write(chats) {
468
- writeSecurely(this.path, `${JSON.stringify({ chats }, null, 2)}
469
- `, 384);
470
- }
471
- };
472
-
473
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/guard.js
474
- var HOUR_MS = 60 * 60 * 1e3;
475
- var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
476
- "attachments.extract",
477
- "conversations.embeddings",
478
- "conversations.links",
479
- "messages.server-search",
480
- "messages.sync-first",
481
- "stats.contacts.top.sync-first",
482
- "stats.messages.counters.sync",
483
- "stats.messages.show.sync-first",
484
- "stats.messages.top.sync-first",
485
- "store.gaps.repair"
486
- ]);
487
- var countsTowardLimit = /* @__PURE__ */ __name(({ kind = "message", action, notify }) => kind === "message" || kind === "forward" || kind === "edit" || kind === "delete" || kind === "pin" && notify === true || action === "create" || action === "members.add" || action === "requests.accept" || action === "join" || action === "contact-import", "countsTowardLimit");
488
- var weightOf = /* @__PURE__ */ __name(({ kind = "message", action, count, people }) => kind === "delete" || kind === "message" && action === void 0 ? Math.max(1, count ?? 1) : action === "create" || action === "members.add" || action === "requests.accept" || action === "contact-import" ? Math.max(1, people ?? count ?? 1) : 1, "weightOf");
489
- var timeOf = /* @__PURE__ */ __name((entry) => Date.parse(entry.scheduledFor ?? entry.at), "timeOf");
490
- var ceilingRefusal = /* @__PURE__ */ __name((key, command) => new CliError("permission_error", `${key} is not allowed: setup's answer keeps every WireCat tool read-only; the owner changes it at a terminal with \`${command} setup\``, { permission: key }), "ceilingRefusal");
491
- var levelRefusal = /* @__PURE__ */ __name((refused, fix = `${refused.command} ${refused.profile} config set permissions.${refused.key} allow`) => refused.named === CEILING_KEY ? ceilingRefusal(refused.key, refused.command) : new CliError("permission_error", `profile ${refused.profile} does not let ${refused.key} write (permissions.${refused.named} is ${refused.level}, from the ${refused.permissionSources[refused.named ?? ""] ?? "default"}); to allow it: ${fix}`, { permission: refused.key }), "levelRefusal");
492
- var sendGuard = /* @__PURE__ */ __name(({ profile, recipients, command = recipients.command, readOnlyLock, permissions, permissionSources = {}, permissionDefaults, permissionFix, ask = refuseToAsk, sendsPerHour, journal, flood, warn, now = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "now") }) => {
493
- const currentPermissions = /* @__PURE__ */ __name(() => typeof permissions === "function" ? permissions() : permissions, "currentPermissions");
494
- let reservation;
495
- const answered = /* @__PURE__ */ new WeakSet();
496
- const refuseReadOnly = /* @__PURE__ */ __name(() => {
497
- if (readOnlyLock)
498
- throw readOnlyRefusal(readOnlyLock, MESSENGER_CHANGE_REFUSAL);
499
- }, "refuseReadOnly");
500
- const refuseHeld = /* @__PURE__ */ __name(({ key }) => {
501
- if (key !== void 0 && READS_UNDER_HOLD.has(key))
502
- return;
503
- const block = flood?.sendBlock();
504
- if (!block)
505
- return;
506
- throw new CliError("permission_error", `profile ${profile} holds its writes ${holdEnd(block)}: ${block.hint} \u2014 reads still work; do not retry: the owner checks the account with \`${command} ${profile} doctor --online\`, and lifts the hold with \`${command} ${profile} flood clear\` once it is over`, { sendBlock: block, standing: { state: block.state, hint: block.hint } });
507
- }, "refuseHeld");
508
- const permitted = /* @__PURE__ */ __name((request) => {
509
- const { chatId, kind = "message", action, personIds } = request;
510
- refuseReadOnly();
511
- const levels = currentPermissions();
512
- if (levels !== void 0) {
513
- const key = request.key ?? keyForWrite(kind, action);
514
- const { level, key: named } = levelFor(levels, key, permissionDefaults);
515
- if (level === "deny" || level === "readonly")
516
- throw levelRefusal({ profile, command, key, level, named, permissionSources }, permissionFix?.(request, key));
517
- if (level === "ask" && !answered.has(request)) {
518
- throw new CliError("confirmation_required", `${key} asks before it acts, and it was not asked`);
519
- }
520
- }
521
- const allowed = recipients.read();
522
- if (chatId !== null && allowed && !allowed.some((chat) => chat.id === chatId)) {
523
- throw new CliError("confirmation_required", `chat ${chatId} is not on the recipient list of profile ${profile} \u2014 the owner adds it with \`${command} ${profile} recipients add ${chatId}\``, { chat_id: chatId });
524
- }
525
- const strangers = allowed ? (personIds ?? []).filter((id) => !allowed.some((chat) => chat.partnerId === id)) : [];
526
- if (strangers.length > 0) {
527
- throw new CliError("confirmation_required", `${strangers.join(", ")} ${strangers.length === 1 ? "is" : "are"} not on the recipient list of profile ${profile} \u2014 the owner adds the one-to-one chat with each person (\`${command} ${profile} recipients add <chat>\`); a chat added to the list earlier is added again to be recognised`, { person_ids: strangers });
528
- }
529
- }, "permitted");
530
- const withinLimit = /* @__PURE__ */ __name((request, entries) => {
531
- const { chatId, sendId } = request;
532
- const asked = { ...request, people: request.personIds?.length ?? request.count };
533
- const count = weightOf(asked);
534
- if (count > sendsPerHour) {
535
- throw new CliError("rate_limited", `${count} at once is more than the hourly limit of profile ${profile} (sendsPerHour ${sendsPerHour}) \u2014 do fewer at a time`);
536
- }
537
- const at = request.scheduledFor ? Date.parse(request.scheduledFor) : now().getTime();
538
- const counted = entries.filter(countsTowardLimit).filter((entry) => entry.outcome === "sent" || entry.outcome === "outcome_unknown" || entry.outcome === "reserved").filter((entry) => Math.abs(timeOf(entry) - at) < HOUR_MS);
539
- const unsure = /* @__PURE__ */ __name((entry) => entry.outcome === "outcome_unknown", "unsure");
540
- const same = /* @__PURE__ */ __name((a, b) => a.sendId !== void 0 && a.sendId === b.sendId && a.chatId === b.chatId, "same");
541
- const last = [...counted].reverse().find((entry) => same(entry, { chatId, sendId }));
542
- if (sendId !== void 0 && last && unsure(last)) {
543
- if (last.sendAs !== request.sendAs) {
544
- throw new CliError("validation_error", "this send id was tried under another identity; repeat it with the same --send-as, or it may post twice", { operation_id: sendId, retryable: false });
545
- }
546
- return false;
547
- }
548
- const recent = counted.filter((entry, index) => !(unsure(entry) && counted.slice(index + 1).some((later) => same(later, entry)))).map((entry) => ({ time: timeOf(entry), weight: weightOf(entry) })).sort((a, b) => a.time - b.time);
549
- const used = recent.reduce((sum, { weight }) => sum + weight, 0);
550
- if (used + count > sendsPerHour) {
551
- let freed = 0;
552
- const opening = recent.find(({ weight }) => {
553
- freed += weight;
554
- return used - freed + count <= sendsPerHour;
555
- });
556
- const nextMs = (opening?.time ?? 0) + HOUR_MS;
557
- const next = new Date(nextMs).toISOString();
558
- throw new CliError("rate_limited", `profile ${profile} has sent ${used} messages in the hour around ${new Date(at).toISOString()}, and its limit is ${sendsPerHour} (sendsPerHour) \u2014 the next send is possible at ${next}`, { retry_after_ms: nextMs - now().getTime(), retry_at: next });
559
- }
560
- return true;
561
- }, "withinLimit");
562
- const counting = /* @__PURE__ */ __name((request) => {
563
- permitted(request);
564
- refuseHeld(request);
565
- const asked = { ...request, people: request.personIds?.length ?? request.count };
566
- const creatingTopic = request.kind === "chat" && request.action === "topic-create";
567
- if (!countsTowardLimit(asked) && !creatingTopic)
568
- return void 0;
569
- const checked = /* @__PURE__ */ __name((entries) => {
570
- if (!creatingTopic)
571
- return withinLimit(request, entries);
572
- if (request.sendId === void 0)
573
- throw new CliError("validation_error", "a topic creation needs an attempt id");
574
- if (entries.some((entry) => entry.action === "topic-create" && entry.sendId === request.sendId && ["sent", "outcome_unknown", "reserved"].includes(entry.outcome))) {
575
- throw new CliError("validation_error", "this topic creation was already attempted; check topics list and do not repeat an unknown creation", { operation_id: request.sendId, retryable: false });
576
- }
577
- return true;
578
- }, "checked");
579
- const reserving = /* @__PURE__ */ __name(() => {
580
- if (!checked(journal.entries()))
581
- return;
582
- const id = randomUUID();
583
- const { chatId, kind, action, sendId, operationId, scheduledFor, notify } = request;
584
- journal.append({
585
- at: now().toISOString(),
586
- profile,
587
- chatId,
588
- outcome: "reserved",
589
- reservation: id,
590
- ...kind ? { kind } : {},
591
- ...action ? { action } : {},
592
- ...asked.people === void 0 ? {} : kind === "delete" || kind === "message" || kind === void 0 ? { count: asked.people } : { people: asked.people },
593
- ...sendId === void 0 ? {} : { sendId },
594
- ...operationId === void 0 ? {} : { operationId },
595
- ...scheduledFor ? { scheduledFor } : {},
596
- ...notify === void 0 ? {} : { notify }
597
- });
598
- reservation = id;
599
- }, "reserving");
600
- return { checked, reserving };
601
- }, "counting");
602
- return {
603
- ask: /* @__PURE__ */ __name(async (request) => {
604
- refuseReadOnly();
605
- const levels = currentPermissions();
606
- if (levels === void 0)
607
- return;
608
- const key = request.key ?? keyForWrite(request.kind ?? "message", request.action);
609
- if (levelFor(levels, key, permissionDefaults).level !== "ask")
610
- return;
611
- refuseHeld(request);
612
- await ask(key, request);
613
- answered.add(request);
614
- }, "ask"),
615
- check: /* @__PURE__ */ __name((request, { reserve = true } = {}) => {
616
- const counted = counting(request);
617
- if (!counted)
618
- return;
619
- if (reserve)
620
- journal.locked(counted.reserving);
621
- else
622
- counted.checked(journal.entries());
623
- }, "check"),
624
- reserve: /* @__PURE__ */ __name(async (request) => {
625
- const counted = counting(request);
626
- if (counted)
627
- await journal.lockedAsync(counted.reserving);
628
- }, "reserve"),
629
- // After a send, a failure to write here must not become the command's answer: the message is
630
- // already with a person, and an error would invite the caller to send it again.
631
- record: /* @__PURE__ */ __name((entry) => {
632
- const { personIds: _, ...kept } = entry;
633
- const settles = entry.outcome === "refused" ? void 0 : reservation;
634
- reservation = void 0;
635
- try {
636
- journal.append({ at: now().toISOString(), profile, ...kept, ...settles ? { reservation: settles } : {} });
637
- } catch (error) {
638
- warn(`this send is not in the send journal: ${journalFailure(error)}`, {
639
- event: "warning",
640
- code: "send_not_journaled",
641
- operation: "sends.journal"
642
- });
643
- }
644
- }, "record")
645
- };
646
- }, "sendGuard");
647
- var refuseToAsk = /* @__PURE__ */ __name(async (key) => {
648
- throw new CliError("confirmation_required", `${key} asks before it acts (its permission level is ask), and nobody is here to answer \u2014 add ${skipFlagFor(key)} to go ahead`);
649
- }, "refuseToAsk");
650
- var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, ask) => sendGuard({
651
- profile: settings.profile,
652
- command: app.command,
653
- ...settings.readOnlyLock ? { readOnlyLock: settings.readOnlyLock } : {},
654
- permissions: /* @__PURE__ */ __name(() => settings.permissions, "permissions"),
655
- permissionSources: settings.permissionSources,
656
- ...settings.permissionDefaults ? { permissionDefaults: settings.permissionDefaults } : {},
657
- ...ask ? { ask } : {},
658
- sendsPerHour: settings.sendsPerHour,
659
- journal: new SendJournal(sendsPathFor(app, settings.profile, env), { service: app.command, version: app.version }),
660
- recipients: new RecipientList(recipientsPathFor(app, settings.profile, env), app.command),
661
- flood: new FloodMemory(floodPathFor(app, settings.profile, env)),
662
- warn
663
- }), "guardFor");
664
- var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
665
-
666
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/sends/pace.js
667
- import { readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
668
- import { join as join4 } from "node:path";
122
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_25b690dd810be59ade44e4d26e61c9f5/node_modules/@wirecat/cli-core/dist/sends/pace.js
123
+ import { readFileSync, renameSync, writeFileSync } from "node:fs";
124
+ import { join } from "node:path";
669
125
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
670
- var pacePathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join4(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "pace", `${profile}.json`), "pacePathFor");
126
+ var pacePathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "pace", `${profile}.json`), "pacePathFor");
671
127
  var Pacer = class {
672
128
  static {
673
129
  __name(this, "Pacer");
@@ -709,7 +165,7 @@ var Pacer = class {
709
165
  }
710
166
  read() {
711
167
  try {
712
- const tat = Number(JSON.parse(readFileSync4(this.path, "utf8")).tat);
168
+ const tat = Number(JSON.parse(readFileSync(this.path, "utf8")).tat);
713
169
  return Number.isFinite(tat) ? tat : 0;
714
170
  } catch {
715
171
  return 0;
@@ -717,8 +173,8 @@ var Pacer = class {
717
173
  }
718
174
  write(tat) {
719
175
  const temporary = `${this.path}.${process.pid}.tmp`;
720
- writeFileSync2(temporary, JSON.stringify({ tat }), { mode: 384 });
721
- renameSync2(temporary, this.path);
176
+ writeFileSync(temporary, JSON.stringify({ tat }), { mode: 384 });
177
+ renameSync(temporary, this.path);
722
178
  }
723
179
  };
724
180
  var ANNOUNCE_WAIT_MS = 5e3;
@@ -753,7 +209,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
753
209
  await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
754
210
  }, "waitForTurn");
755
211
 
756
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
212
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_25b690dd810be59ade44e4d26e61c9f5/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
757
213
  var pathOf = /* @__PURE__ */ __name((command) => {
758
214
  const words = [];
759
215
  for (let at = command; at?.parent; at = at.parent)
@@ -813,7 +269,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
813
269
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
814
270
  }, "refuseUnknownPermissionKeys");
815
271
 
816
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
272
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_25b690dd810be59ade44e4d26e61c9f5/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
817
273
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
818
274
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
819
275
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
@@ -910,7 +366,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
910
366
  });
911
367
  }, "flooded");
912
368
 
913
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
369
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_25b690dd810be59ade44e4d26e61c9f5/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
914
370
  var observed = /* @__PURE__ */ __name((messenger, events) => {
915
371
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
916
372
  const write = currentOperation();
@@ -1009,7 +465,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
1009
465
  counts[part] = (counts[part] ?? 0) + items.length;
1010
466
  }, "byPart");
1011
467
 
1012
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
468
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_25b690dd810be59ade44e4d26e61c9f5/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
1013
469
  var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
1014
470
  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" }) => {
1015
471
  let warned = false;
@@ -1130,13 +586,13 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1130
586
  }
1131
587
  if (round !== rekeyRound)
1132
588
  return;
1133
- const taken2 = pass?.taken ?? rest.length;
1134
- rekeysQueued -= taken2;
589
+ const taken = pass?.taken ?? rest.length;
590
+ rekeysQueued -= taken;
1135
591
  for (const { from, to } of pass?.applied ?? [])
1136
592
  await Promise.resolve().then(() => rekeyed?.(from, to)).catch((error) => notWritten("history.rekey", error));
1137
593
  for (const { error } of pass?.refused ?? [])
1138
594
  notWritten("history.rekey", error);
1139
- rest = rest.slice(taken2);
595
+ rest = rest.slice(taken);
1140
596
  if (rest.length > 0)
1141
597
  await new Promise((resolve) => setTimeout(resolve, rekeyPacing.pauseMs));
1142
598
  }
@@ -1585,7 +1041,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1585
1041
  }
1586
1042
  }, "keep");
1587
1043
 
1588
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_a1c6dd927639f1a41fe5f9c53e24865e/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1044
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_25b690dd810be59ade44e4d26e61c9f5/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1589
1045
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1590
1046
  let opened;
1591
1047
  return {
@@ -1927,6 +1383,7 @@ var messengerContext = /* @__PURE__ */ __name((command, messenger, resolving = {
1927
1383
  history: base.settings.record,
1928
1384
  searchCatchUp: base.settings.searchCatchUp,
1929
1385
  ...base.settings.historyLimits ? { historyLimits: base.settings.historyLimits } : {},
1386
+ historyMuted: base.settings.historyMuted,
1930
1387
  pictures: base.settings.pictureSearch,
1931
1388
  reranker: base.settings.searchReranker,
1932
1389
  guard,
@@ -1985,16 +1442,6 @@ var messengerContext = /* @__PURE__ */ __name((command, messenger, resolving = {
1985
1442
  export {
1986
1443
  answerOf,
1987
1444
  terminalAsker,
1988
- holdEnd,
1989
- floodPathFor,
1990
- FloodMemory,
1991
- sendsPathFor,
1992
- SendJournal,
1993
- recipientsPathFor,
1994
- RecipientList,
1995
- levelRefusal,
1996
- sendGuard,
1997
- guardFor,
1998
1445
  DEFAULT_PACE,
1999
1446
  pacePathFor,
2000
1447
  Pacer,