@wirecat/cli-memo 0.131.69 → 0.131.71

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 (289) 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-W622CBPF.js} +35 -35
  19. package/dist/bundle/auto-WUU2MYGS.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-3TFK7RBA.js → chunk-2LTQ6ZBS.js} +23908 -22107
  23. package/dist/bundle/{chunk-IHHXGTMX.js → chunk-3LS76TFB.js} +1 -1
  24. package/dist/bundle/{chunk-IJAILIZR.js → chunk-3PIKTX3U.js} +18 -18
  25. package/dist/bundle/{chunk-N73YBQ42.js → chunk-3ZSPTUG3.js} +9 -7
  26. package/dist/bundle/{chunk-RHW3DDWI.js → chunk-6B3GQMR6.js} +1 -1
  27. package/dist/bundle/{chunk-LYAJUZM4.js → chunk-6EIWRE6E.js} +30 -30
  28. package/dist/bundle/{chunk-EDPA54WQ.js → chunk-6Z62U7NY.js} +3 -3
  29. package/dist/bundle/{chunk-JMGQATR6.js → chunk-ASDOPGKC.js} +2 -2
  30. package/dist/bundle/{chunk-EKSOPEFQ.js → chunk-BE22RDTR.js} +4 -4
  31. package/dist/bundle/{chunk-FZHYGJQ2.js → chunk-CLQXHFKG.js} +5 -5
  32. package/dist/bundle/{chunk-VPKJZKXV.js → chunk-CPUQC7UF.js} +1 -1
  33. package/dist/bundle/{chunk-GGFL64HF.js → chunk-CZUAGRL7.js} +13168 -11987
  34. package/dist/bundle/{chunk-GVP6CAPH.js → chunk-DW6CDBXA.js} +33 -586
  35. package/dist/bundle/{chunk-5MUR6D2G.js → chunk-DXWDHC2K.js} +44 -2
  36. package/dist/bundle/{chunk-5OMM4CDT.js → chunk-ESYCZ575.js} +2 -2
  37. package/dist/bundle/{chunk-OBQ7TSUB.js → chunk-FHIGY5K6.js} +1 -1
  38. package/dist/bundle/{chunk-MK6SQ32Q.js → chunk-FPWF2XLH.js} +12 -12
  39. package/dist/bundle/{chunk-MYLNRBDF.js → chunk-FVJSDDSV.js} +46 -13
  40. package/dist/bundle/{chunk-TV75OHKJ.js → chunk-G3FQTKHT.js} +7 -7
  41. package/dist/bundle/{chunk-WNA2WNDK.js → chunk-G7XOBQB5.js} +3 -3
  42. package/dist/bundle/{chunk-PSYQPO6D.js → chunk-H3LAORYX.js} +2 -2
  43. package/dist/bundle/{chunk-2DQYP2K3.js → chunk-HIHZNBR7.js} +1 -1
  44. package/dist/bundle/{chunk-QAXIZHK7.js → chunk-HNQGX4AG.js} +33 -33
  45. package/dist/bundle/{chunk-22CDLXSR.js → chunk-I4HWKPQR.js} +4 -4
  46. package/dist/bundle/{chunk-2NFI7SDW.js → chunk-INQAQ55X.js} +2304 -1111
  47. package/dist/bundle/{chunk-XTEJXJJ3.js → chunk-IP5CA3CW.js} +10 -10
  48. package/dist/bundle/{chunk-EO4JMJFZ.js → chunk-IXZWUHSG.js} +7 -7
  49. package/dist/bundle/{chunk-MWQI6FSU.js → chunk-K55WZ67L.js} +3 -3
  50. package/dist/bundle/{chunk-YTJWIJIG.js → chunk-KH43CUE2.js} +5 -5
  51. package/dist/bundle/{chunk-2C7Z7CKD.js → chunk-LIF2HXIQ.js} +1 -1
  52. package/dist/bundle/{chunk-GVEY6743.js → chunk-LRS5X7G3.js} +9 -9
  53. package/dist/bundle/{chunk-3LGLKLBA.js → chunk-M2DAITNE.js} +2 -2
  54. package/dist/bundle/{chunk-OAO5UCPJ.js → chunk-MAGAWAPG.js} +1366 -1574
  55. package/dist/bundle/{chunk-7JFLHRQL.js → chunk-MKOQDN3I.js} +1 -1
  56. package/dist/bundle/{chunk-67VEVKMJ.js → chunk-MSTWHRLN.js} +1 -1
  57. package/dist/bundle/{chunk-YXXAPVAZ.js → chunk-NLRPCKUS.js} +8 -8
  58. package/dist/bundle/{chunk-W2FFA7T5.js → chunk-NNUS57F4.js} +5 -5
  59. package/dist/bundle/{chunk-3YVLNOPE.js → chunk-OHBP2KPQ.js} +4 -4
  60. package/dist/bundle/{chunk-BJJULUUC.js → chunk-OWFC6BAF.js} +5 -5
  61. package/dist/bundle/{chunk-267N22E4.js → chunk-PGOMGFXA.js} +1 -1
  62. package/dist/bundle/{chunk-4HSWIXYE.js → chunk-PHL53ERQ.js} +4 -4
  63. package/dist/bundle/{chunk-5EHUHZU5.js → chunk-QNJ4EKKW.js} +80 -68
  64. package/dist/bundle/{chunk-53EAI4VZ.js → chunk-QUPPO7DB.js} +1 -1
  65. package/dist/bundle/{chunk-276KPJI5.js → chunk-RF6KPQWV.js} +2 -2
  66. package/dist/bundle/{chunk-TXOXPQN2.js → chunk-SL2LXOCN.js} +2 -2
  67. package/dist/bundle/{chunk-QZU5IM5E.js → chunk-SR7C53CS.js} +2 -2
  68. package/dist/bundle/{chunk-ECHN36DC.js → chunk-STJWETNW.js} +4 -4
  69. package/dist/bundle/{chunk-BGWPKEKK.js → chunk-SVVSGUMU.js} +4 -4
  70. package/dist/bundle/{chunk-FQ54GW57.js → chunk-TG3XWDFI.js} +8360 -8360
  71. package/dist/bundle/{chunk-V2YS63Z5.js → chunk-U3P5F57B.js} +1 -1
  72. package/dist/bundle/{chunk-PHSYMVYX.js → chunk-UCRR7R6Q.js} +2 -2
  73. package/dist/bundle/{chunk-2F35N6BI.js → chunk-UX52EWLQ.js} +1 -1
  74. package/dist/bundle/{chunk-OHA7HDPX.js → chunk-V6BJM3XW.js} +1024 -676
  75. package/dist/bundle/{chunk-TVZXLAID.js → chunk-X337K4BD.js} +10 -6
  76. package/dist/bundle/{chunk-UEMI6FXR.js → chunk-XNX3U6GD.js} +6 -6
  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-4P5556KI.js} +4 -4
  84. package/dist/bundle/failure-3F3YHF7G.js +65 -0
  85. package/dist/bundle/{first-run-MLIFZSVH.js → first-run-EKRDZLLY.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-FQPK2KAF.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-BXL5ZOVQ.js → program-L5IM35PO.js} +1433 -531
  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-GCESLOOF.js +48 -0
  103. package/dist/bundle/server-JUSMYLIQ.js +61 -0
  104. package/dist/bundle/{server-JLPZUC42.js → server-LWQAHDBH.js} +55 -52
  105. package/dist/bundle/{state-UBAIZ2WP.js → state-A57F7T5D.js} +3 -3
  106. package/dist/bundle/{store-VQQVUA4W.js → store-WG2GYWTG.js} +9 -9
  107. package/dist/bundle/store-maintenance-command-GTY6VU76.js +47 -0
  108. package/dist/bundle/update-LICMP7UR.js +68 -0
  109. package/dist/context/command.d.ts +2 -1
  110. package/dist/context/command.d.ts.map +1 -1
  111. package/dist/context/command.js +34 -12
  112. package/dist/context/command.js.map +1 -1
  113. package/dist/context/context.d.ts +20 -8
  114. package/dist/context/context.d.ts.map +1 -1
  115. package/dist/context/context.js +65 -40
  116. package/dist/context/context.js.map +1 -1
  117. package/dist/contract-overrides/search.js +1 -1
  118. package/dist/contract-overrides/search.js.map +1 -1
  119. package/dist/contract-overrides/skill.d.ts.map +1 -1
  120. package/dist/contract-overrides/skill.js +5 -10
  121. package/dist/contract-overrides/skill.js.map +1 -1
  122. package/dist/digest/backfill.d.ts.map +1 -1
  123. package/dist/digest/backfill.js +4 -2
  124. package/dist/digest/backfill.js.map +1 -1
  125. package/dist/digest/brief.d.ts +14 -0
  126. package/dist/digest/brief.d.ts.map +1 -0
  127. package/dist/digest/brief.js +143 -0
  128. package/dist/digest/brief.js.map +1 -0
  129. package/dist/digest/digest.d.ts.map +1 -1
  130. package/dist/digest/digest.js +2 -1
  131. package/dist/digest/digest.js.map +1 -1
  132. package/dist/discovery/command.d.ts.map +1 -1
  133. package/dist/discovery/command.js +2 -0
  134. package/dist/discovery/command.js.map +1 -1
  135. package/dist/doctor/command.d.ts +22 -2
  136. package/dist/doctor/command.d.ts.map +1 -1
  137. package/dist/examples.d.ts.map +1 -1
  138. package/dist/examples.js +51 -10
  139. package/dist/examples.js.map +1 -1
  140. package/dist/facts/command.d.ts.map +1 -1
  141. package/dist/facts/command.js +7 -6
  142. package/dist/facts/command.js.map +1 -1
  143. package/dist/finance/deal-text.d.ts +4 -0
  144. package/dist/finance/deal-text.d.ts.map +1 -0
  145. package/dist/finance/deal-text.js +34 -0
  146. package/dist/finance/deal-text.js.map +1 -0
  147. package/dist/finance/deals-command.d.ts +1 -1
  148. package/dist/finance/deals-command.d.ts.map +1 -1
  149. package/dist/finance/deals-command.js +113 -13
  150. package/dist/finance/deals-command.js.map +1 -1
  151. package/dist/knowledge/business-text.d.ts +7 -0
  152. package/dist/knowledge/business-text.d.ts.map +1 -0
  153. package/dist/knowledge/business-text.js +19 -0
  154. package/dist/knowledge/business-text.js.map +1 -0
  155. package/dist/knowledge/command.d.ts +1 -1
  156. package/dist/knowledge/command.d.ts.map +1 -1
  157. package/dist/knowledge/command.js +131 -42
  158. package/dist/knowledge/command.js.map +1 -1
  159. package/dist/knowledge/money-text.d.ts +4 -0
  160. package/dist/knowledge/money-text.d.ts.map +1 -0
  161. package/dist/knowledge/money-text.js +16 -0
  162. package/dist/knowledge/money-text.js.map +1 -0
  163. package/dist/knowledge/organization-text.d.ts +7 -0
  164. package/dist/knowledge/organization-text.d.ts.map +1 -0
  165. package/dist/knowledge/organization-text.js +24 -0
  166. package/dist/knowledge/organization-text.js.map +1 -0
  167. package/dist/knowledge/project-actions-command.js +1 -1
  168. package/dist/knowledge/project-actions-command.js.map +1 -1
  169. package/dist/knowledge/project-actions.d.ts +1 -1
  170. package/dist/knowledge/project-actions.d.ts.map +1 -1
  171. package/dist/knowledge/project-actions.js +2 -2
  172. package/dist/knowledge/project-actions.js.map +1 -1
  173. package/dist/knowledge/project-context.d.ts +27 -1
  174. package/dist/knowledge/project-context.d.ts.map +1 -1
  175. package/dist/knowledge/project-context.js +9 -5
  176. package/dist/knowledge/project-context.js.map +1 -1
  177. package/dist/knowledge/project-status-command.d.ts.map +1 -1
  178. package/dist/knowledge/project-status-command.js +21 -5
  179. package/dist/knowledge/project-status-command.js.map +1 -1
  180. package/dist/knowledge/relationships.d.ts +27 -23
  181. package/dist/knowledge/relationships.d.ts.map +1 -1
  182. package/dist/knowledge/relationships.js +65 -52
  183. package/dist/knowledge/relationships.js.map +1 -1
  184. package/dist/knowledge/roles-command.d.ts +8 -0
  185. package/dist/knowledge/roles-command.d.ts.map +1 -0
  186. package/dist/knowledge/roles-command.js +65 -0
  187. package/dist/knowledge/roles-command.js.map +1 -0
  188. package/dist/mcp/catalogue.d.ts +1 -1
  189. package/dist/mcp/catalogue.d.ts.map +1 -1
  190. package/dist/mcp/catalogue.js +3 -1
  191. package/dist/mcp/catalogue.js.map +1 -1
  192. package/dist/mcp/server.js +1 -1
  193. package/dist/mcp/server.js.map +1 -1
  194. package/dist/memories/command.d.ts.map +1 -1
  195. package/dist/memories/command.js +6 -5
  196. package/dist/memories/command.js.map +1 -1
  197. package/dist/memories/sources.js +2 -2
  198. package/dist/memories/sources.js.map +1 -1
  199. package/dist/models/command.d.ts +1 -1
  200. package/dist/models/command.d.ts.map +1 -1
  201. package/dist/models/command.js +2 -1
  202. package/dist/models/command.js.map +1 -1
  203. package/dist/notes/command.d.ts.map +1 -1
  204. package/dist/notes/command.js +13 -8
  205. package/dist/notes/command.js.map +1 -1
  206. package/dist/notes/embed.d.ts +6 -1
  207. package/dist/notes/embed.d.ts.map +1 -1
  208. package/dist/notes/embed.js +17 -8
  209. package/dist/notes/embed.js.map +1 -1
  210. package/dist/people/command.d.ts.map +1 -1
  211. package/dist/people/command.js +2 -1
  212. package/dist/people/command.js.map +1 -1
  213. package/dist/program.d.ts +13 -1
  214. package/dist/program.d.ts.map +1 -1
  215. package/dist/program.js +173 -11
  216. package/dist/program.js.map +1 -1
  217. package/dist/reasons.d.ts.map +1 -1
  218. package/dist/reasons.js +42 -0
  219. package/dist/reasons.js.map +1 -1
  220. package/dist/review/command.js +2 -2
  221. package/dist/review/command.js.map +1 -1
  222. package/dist/review/review.d.ts +3 -3
  223. package/dist/review/review.d.ts.map +1 -1
  224. package/dist/review/review.js +6 -6
  225. package/dist/review/review.js.map +1 -1
  226. package/dist/review/status.d.ts.map +1 -1
  227. package/dist/review/status.js +5 -4
  228. package/dist/review/status.js.map +1 -1
  229. package/dist/run/import.d.ts +2 -2
  230. package/dist/run/import.d.ts.map +1 -1
  231. package/dist/run/import.js +9 -3
  232. package/dist/run/import.js.map +1 -1
  233. package/dist/search/command.d.ts.map +1 -1
  234. package/dist/search/command.js +21 -3
  235. package/dist/search/command.js.map +1 -1
  236. package/dist/search/denied.d.ts +10 -0
  237. package/dist/search/denied.d.ts.map +1 -0
  238. package/dist/search/denied.js +10 -0
  239. package/dist/search/denied.js.map +1 -0
  240. package/dist/search/people.d.ts.map +1 -1
  241. package/dist/search/people.js +11 -1
  242. package/dist/search/people.js.map +1 -1
  243. package/dist/search/search.d.ts +2 -0
  244. package/dist/search/search.d.ts.map +1 -1
  245. package/dist/search/search.js +37 -12
  246. package/dist/search/search.js.map +1 -1
  247. package/dist/store/group.d.ts +38 -0
  248. package/dist/store/group.d.ts.map +1 -0
  249. package/dist/store/group.js +112 -0
  250. package/dist/store/group.js.map +1 -0
  251. package/dist/store/groups-command.d.ts +10 -0
  252. package/dist/store/groups-command.d.ts.map +1 -0
  253. package/dist/store/groups-command.js +88 -0
  254. package/dist/store/groups-command.js.map +1 -0
  255. package/dist/store/guard.d.ts +29 -0
  256. package/dist/store/guard.d.ts.map +1 -0
  257. package/dist/store/guard.js +94 -0
  258. package/dist/store/guard.js.map +1 -0
  259. package/dist/store/scope.d.ts +3 -3
  260. package/dist/store/scope.d.ts.map +1 -1
  261. package/dist/store/scope.js +7 -6
  262. package/dist/store/scope.js.map +1 -1
  263. package/dist/store/source-list.d.ts +5 -1
  264. package/dist/store/source-list.d.ts.map +1 -1
  265. package/dist/store/source-list.js +30 -15
  266. package/dist/store/source-list.js.map +1 -1
  267. package/dist/tags/command.d.ts.map +1 -1
  268. package/dist/tags/command.js +3 -2
  269. package/dist/tags/command.js.map +1 -1
  270. package/dist/tasks/shared.d.ts.map +1 -1
  271. package/dist/tasks/shared.js +2 -1
  272. package/dist/tasks/shared.js.map +1 -1
  273. package/dist/tasks/tasks.js +3 -3
  274. package/dist/tasks/tasks.js.map +1 -1
  275. package/dist/version.d.ts +1 -1
  276. package/dist/version.js +1 -1
  277. package/package.json +5 -4
  278. package/skills/cli-memo/SKILL.md +7 -7
  279. package/skills/cli-memo/topics/mcp.md +9 -0
  280. package/skills/cli-memo/topics/money.md +14 -1
  281. package/skills/cli-memo/topics/projects.md +2 -1
  282. package/skills/cli-memo/topics/search.md +12 -4
  283. package/dist/bundle/auto-IKZIROGF.js +0 -85
  284. package/dist/bundle/failure-NRZUB77S.js +0 -65
  285. package/dist/bundle/server-AASCSGCI.js +0 -61
  286. package/dist/bundle/server-YQLPZK4Z.js +0 -48
  287. package/dist/bundle/store-maintenance-command-GCBABKEZ.js +0 -47
  288. package/dist/bundle/update-M54Z3SEU.js +0 -68
  289. /package/dist/bundle/{chunk-AWVQHWIS.js → chunk-YSYFOIW7.js} +0 -0
@@ -3,10 +3,16 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  isCliFailure,
5
5
  isStoreDamage
6
- } from "./chunk-3LGLKLBA.js";
6
+ } from "./chunk-M2DAITNE.js";
7
7
  import {
8
8
  refuseOwnerStoreInTests
9
- } from "./chunk-V2YS63Z5.js";
9
+ } from "./chunk-U3P5F57B.js";
10
+ import {
11
+ createRecordLog,
12
+ resolvePaths,
13
+ traceIdOf,
14
+ writeSecurely
15
+ } from "./chunk-UUBV5ATQ.js";
10
16
  import {
11
17
  RegistryError,
12
18
  SNAKE_CASE,
@@ -51,258 +57,6 @@ import {
51
57
  __name
52
58
  } from "./chunk-ZVVMGPBJ.js";
53
59
 
54
- // 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/domain/money.js
55
- var CURRENCY_SCALES = {
56
- AED: 2,
57
- AMD: 2,
58
- AUD: 2,
59
- BHD: 3,
60
- BYN: 2,
61
- CAD: 2,
62
- CHF: 2,
63
- CLP: 0,
64
- CNY: 2,
65
- CZK: 2,
66
- DKK: 2,
67
- EUR: 2,
68
- GBP: 2,
69
- GEL: 2,
70
- HUF: 2,
71
- ILS: 2,
72
- INR: 2,
73
- ISK: 0,
74
- JPY: 0,
75
- KGS: 2,
76
- KRW: 0,
77
- KWD: 3,
78
- KZT: 2,
79
- NOK: 2,
80
- PLN: 2,
81
- RSD: 2,
82
- RUB: 2,
83
- SEK: 2,
84
- THB: 2,
85
- TRY: 2,
86
- UAH: 2,
87
- USD: 2,
88
- UZS: 2,
89
- VND: 0
90
- };
91
- var refuse = /* @__PURE__ */ __name((message, reason) => {
92
- throw new CliError("validation_error", message, { reason });
93
- }, "refuse");
94
- var DECIMAL = /^(\d{1,15})(?:\.(\d+))?$/;
95
- var parseDecimal = /* @__PURE__ */ __name((text6, scale) => {
96
- const match = DECIMAL.exec(text6.trim());
97
- if (!match || (match[2] ?? "").length > scale)
98
- return void 0;
99
- return BigInt(`${match[1]}${(match[2] ?? "").padEnd(scale, "0")}`);
100
- }, "parseDecimal");
101
- var formatDecimal = /* @__PURE__ */ __name((units, scale) => {
102
- const value = BigInt(units);
103
- if (value < 0n)
104
- return `-${formatDecimal(-value, scale)}`;
105
- const digits = value.toString().padStart(scale + 1, "0");
106
- return scale === 0 ? digits : `${digits.slice(0, -scale)}.${digits.slice(-scale)}`;
107
- }, "formatDecimal");
108
- var groupDigits = /* @__PURE__ */ __name((decimal) => {
109
- const [whole = "0", fraction] = decimal.split(".");
110
- const grouped2 = whole.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
111
- return fraction === void 0 ? grouped2 : `${grouped2}.${fraction}`;
112
- }, "groupDigits");
113
- var currencyOf = /* @__PURE__ */ __name((text6) => {
114
- const code = typeof text6 === "string" ? text6.trim().toUpperCase() : "";
115
- if (CURRENCY_SCALES[code] === void 0)
116
- return refuse(`${typeof text6 === "string" && text6.trim() ? text6.trim() : "an empty currency"} is not a currency the store keeps; use one of ${Object.keys(CURRENCY_SCALES).join(", ")}`, "money.currency");
117
- return code;
118
- }, "currencyOf");
119
- var scaleOf = /* @__PURE__ */ __name((currency) => CURRENCY_SCALES[currencyOf(currency)], "scaleOf");
120
- var minorUnits = /* @__PURE__ */ __name((amount, currency, what = "an amount") => {
121
- const scale = scaleOf(currency);
122
- const units = typeof amount === "string" ? parseDecimal(amount, scale) : void 0;
123
- if (units === void 0 || units > BigInt(Number.MAX_SAFE_INTEGER))
124
- return refuse(`${what} is a decimal string with at most ${scale} decimal${scale === 1 ? "" : "s"} for ${currency}, such as "${formatDecimal(5e3 * 10 ** scale, scale)}"`, "money.amount");
125
- return Number(units);
126
- }, "minorUnits");
127
- var signedMinorUnits = /* @__PURE__ */ __name((amount, currency, what = "an amount") => {
128
- if (typeof amount !== "string" || !amount.trim().startsWith("-"))
129
- return minorUnits(amount, currency, what);
130
- const units = minorUnits(amount.trim().slice(1), currency, what);
131
- return units === 0 ? 0 : -units;
132
- }, "signedMinorUnits");
133
- var moneyOf = /* @__PURE__ */ __name((units, currency) => ({
134
- amount: formatDecimal(units, scaleOf(currency)),
135
- currency
136
- }), "moneyOf");
137
- var moneyLabel = /* @__PURE__ */ __name((units, currency) => `${groupDigits(formatDecimal(units, scaleOf(currency)))} ${currency}`, "moneyLabel");
138
- var QUANTITY_SCALE = 3;
139
- var quantityOf = /* @__PURE__ */ __name((text6) => {
140
- const thousandths = typeof text6 === "string" ? parseDecimal(text6, QUANTITY_SCALE) : void 0;
141
- if (thousandths === void 0 || thousandths === 0n)
142
- return refuse('a quantity is a decimal string above 0 with at most 3 decimals, such as "1.5"', "money.quantity");
143
- const plain = formatDecimal(thousandths, QUANTITY_SCALE).replace(/\.?0+$/, "");
144
- return { text: plain, thousandths };
145
- }, "quantityOf");
146
- var lineUnits = /* @__PURE__ */ __name((thousandths, unitPrice) => Number((thousandths * BigInt(unitPrice) + 500n) / 1000n), "lineUnits");
147
-
148
- // 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/domain/finance.js
149
- var INVOICE_DIRECTIONS = ["receivable", "payable"];
150
- var INVOICE_STATUSES = ["draft", "issued", "partly_paid", "paid", "void"];
151
- var MONEY_DIRECTIONS = ["in", "out"];
152
- var FINANCE_REVIEWS = ["proposed", "confirmed", "rejected"];
153
- var settledStatus = /* @__PURE__ */ __name((current, total, paid) => {
154
- if (current === "draft" || current === "void")
155
- return current;
156
- if (paid <= 0)
157
- return "issued";
158
- return paid < total ? "partly_paid" : "paid";
159
- }, "settledStatus");
160
- var dayMonth = /* @__PURE__ */ __name((date) => date === null ? null : `${date.slice(8, 10)}.${date.slice(5, 7)}`, "dayMonth");
161
- var notes = /* @__PURE__ */ __name((...words2) => {
162
- const kept = words2.filter((word) => word !== null);
163
- return kept.length === 0 ? "" : ` (${kept.join(", ")})`;
164
- }, "notes");
165
- var invoiceLine = /* @__PURE__ */ __name((invoice) => {
166
- const party = invoice.counterpartyName === null ? "" : `${invoice.direction === "receivable" ? " to" : " from"} ${invoice.counterpartyName}`;
167
- const due = invoice.dueDate === null ? "" : `, due ${dayMonth(invoice.dueDate)}`;
168
- return `${invoice.number ?? `#${invoice.id}`} \xB7 ${moneyLabel(invoice.total, invoice.currency)}${party}${due}` + notes(invoice.status.replace("_", " "), invoice.review === "confirmed" ? null : invoice.review);
169
- }, "invoiceLine");
170
- var paymentLine = /* @__PURE__ */ __name((payment) => {
171
- const party = payment.partyName === null ? "" : `${payment.direction === "in" ? " from" : " to"} ${payment.partyName}`;
172
- return `${moneyLabel(payment.amount, payment.currency)}${party}, ${dayMonth(payment.date)}` + notes(payment.review === "confirmed" ? null : payment.review);
173
- }, "paymentLine");
174
- var invoiceTitle = /* @__PURE__ */ __name((invoice) => `Invoice ${invoiceLine(invoice)}`, "invoiceTitle");
175
- var paymentEntryTitle = /* @__PURE__ */ __name((payment) => `Payment \xB7 ${paymentLine(payment)}`, "paymentEntryTitle");
176
-
177
- // 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/domain/business.js
178
- var CATALOG_KINDS = ["product", "service"];
179
- var BUSINESS_KINDS = ["invoice", "payment", "order", "contract", "subscription", "product", "wallet"];
180
- var CONTRACT_KINDS = ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
181
- var CONTRACT_STATUSES = ["draft", "active", "ended", "terminated"];
182
- var SUBSCRIPTION_STATUSES = ["trial", "active", "paused", "cancelled", "ended"];
183
- var WALLET_KINDS = ["bank", "card", "cash", "wallet", "other"];
184
- var TRANSACTION_STATUSES = ["pending", "booked"];
185
- var ORDER_DIRECTIONS = ["purchase", "sale"];
186
- var intervalOf = /* @__PURE__ */ __name((text6, reason = "subscription.interval") => {
187
- const match = typeof text6 === "string" ? /^(?:([1-9]\d{0,2})-)?(day|week|month|year)$/.exec(text6.trim()) : null;
188
- if (!match)
189
- throw new CliError("validation_error", "an interval is a count and a unit, such as 1-month or 2-week", { reason });
190
- return { count: match[1] === void 0 ? 1 : Number(match[1]), unit: match[2] };
191
- }, "intervalOf");
192
- var intervalText = /* @__PURE__ */ __name(({ count: count7, unit }) => `${count7}-${unit}`, "intervalText");
193
- var priced = /* @__PURE__ */ __name((units, currency) => units === null || currency === null ? "" : `, ${moneyLabel(units, currency)}`, "priced");
194
- var pending = /* @__PURE__ */ __name((review) => review === "confirmed" ? null : review, "pending");
195
- var productLine = /* @__PURE__ */ __name((product) => {
196
- const price = product.unitPrice === null || product.currency === null ? "" : moneyLabel(product.unitPrice, product.currency);
197
- const per = price && product.unit !== null ? ` per ${product.unit}` : "";
198
- return `${product.name}${price ? ` \xB7 ${price}${per}` : ""}${notes(product.kind, product.archived ? "archived" : null)}`;
199
- }, "productLine");
200
- var contractLine = /* @__PURE__ */ __name((contract) => `${contract.number ?? `#${contract.id}`} \xB7 ${contract.name}${priced(contract.value, contract.currency)}` + notes(contract.status, pending(contract.review)), "contractLine");
201
- var subscriptionLine = /* @__PURE__ */ __name((subscription) => `${subscription.name}${priced(subscription.price, subscription.currency)} every ${intervalText(subscription.interval)}` + notes(subscription.status, pending(subscription.review)), "subscriptionLine");
202
- var walletLine = /* @__PURE__ */ __name((wallet) => `${wallet.name} \xB7 ${wallet.kind}, ${wallet.currency}${wallet.numberHint === null ? "" : `, \u2026${wallet.numberHint}`}` + notes(wallet.closed ? "closed" : null), "walletLine");
203
- var transactionLine = /* @__PURE__ */ __name((transaction) => `${moneyLabel(transaction.amount, transaction.currency)} ${transaction.direction}${transaction.label === null ? "" : ` \xB7 ${transaction.label}`}, ${dayMonth(transaction.date)}` + notes(transaction.status === "pending" ? "pending" : null, pending(transaction.review)), "transactionLine");
204
-
205
- // 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/store/marks.js
206
- import { readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
207
- var damageMarkPath = /* @__PURE__ */ __name((store) => `${store}.damaged.json`, "damageMarkPath");
208
- var healthMarkPath = /* @__PURE__ */ __name((store) => `${store}.health.json`, "healthMarkPath");
209
- var inodeOf = /* @__PURE__ */ __name((store) => statSync(store, { throwIfNoEntry: false })?.ino, "inodeOf");
210
- var readJson = /* @__PURE__ */ __name((path) => {
211
- try {
212
- return JSON.parse(readFileSync(path, "utf8"));
213
- } catch (error) {
214
- if (error.code === "ENOENT")
215
- return null;
216
- throw error;
217
- }
218
- }, "readJson");
219
- var ownerStoreInTests = /* @__PURE__ */ __name((store) => {
220
- try {
221
- refuseOwnerStoreInTests(store);
222
- return false;
223
- } catch {
224
- return true;
225
- }
226
- }, "ownerStoreInTests");
227
- var sqliteFailure = /* @__PURE__ */ __name((error) => isCliFailure(error) && error.details?.reason === "store.damaged" ? error.cause : error, "sqliteFailure");
228
- var markStoreDamaged = /* @__PURE__ */ __name((error, { store, command, version, runId, now = Date.now }) => {
229
- const failure = sqliteFailure(error);
230
- if (!isStoreDamage(failure) || ownerStoreInTests(store))
231
- return false;
232
- const inode = inodeOf(store);
233
- if (inode === void 0)
234
- return false;
235
- const mark = {
236
- at: new Date(now()).toISOString(),
237
- command,
238
- ...version ? { cli_version: version } : {},
239
- ...runId ? { run_id: runId } : {},
240
- error: failure.message.slice(0, 500),
241
- inode
242
- };
243
- try {
244
- writeFileSync(damageMarkPath(store), `${JSON.stringify(mark, null, 2)}
245
- `, { flag: "wx", mode: 384 });
246
- return true;
247
- } catch {
248
- return false;
249
- }
250
- }, "markStoreDamaged");
251
- var readDamageMark = /* @__PURE__ */ __name((store) => {
252
- const path = damageMarkPath(store);
253
- let mark;
254
- try {
255
- mark = readJson(path);
256
- } catch {
257
- return { at: "unknown", command: "unknown", error: `${path} cannot be read`, inode: inodeOf(store) ?? 0 };
258
- }
259
- if (mark === null)
260
- return null;
261
- if (mark.inode !== inodeOf(store)) {
262
- clearDamageMark(store);
263
- return null;
264
- }
265
- return mark;
266
- }, "readDamageMark");
267
- var clearDamageMark = /* @__PURE__ */ __name((store) => rmSync(damageMarkPath(store), { force: true }), "clearDamageMark");
268
- var refuseDamagedStore = /* @__PURE__ */ __name((store, cli) => {
269
- const mark = readDamageMark(store);
270
- if (!mark)
271
- return;
272
- throw new CliError("configuration_error", `the store was found damaged at ${mark.at} by \`${mark.command}\` (${mark.error}), so nothing writes to it until it is recovered; \`${cli ?? "<cli>"} store recover\` says what is damaged and what to do`, { reason: "store.damaged" });
273
- }, "refuseDamagedStore");
274
- var readHealthMark = /* @__PURE__ */ __name((store) => {
275
- try {
276
- return readJson(healthMarkPath(store));
277
- } catch {
278
- return null;
279
- }
280
- }, "readHealthMark");
281
- var recordDeepCheck = /* @__PURE__ */ __name((store, health, { cli, version, schema, now = Date.now }) => {
282
- const previous = readHealthMark(store);
283
- if (ownerStoreInTests(store))
284
- return { previous, cleared: null };
285
- const checkedAt = new Date(now()).toISOString();
286
- const mark = {
287
- checked_at: checkedAt,
288
- ok: health.ok,
289
- problems: health.problems ?? 0,
290
- schema,
291
- cli,
292
- ...version ? { cli_version: version } : {},
293
- last_ok_at: health.ok ? checkedAt : previous?.last_ok_at ?? null
294
- };
295
- const cleared = health.ok ? readDamageMark(store) : null;
296
- try {
297
- writeFileSync(healthMarkPath(store), `${JSON.stringify(mark, null, 2)}
298
- `, { mode: 384 });
299
- } catch {
300
- }
301
- if (cleared)
302
- clearDamageMark(store);
303
- return { previous, cleared };
304
- }, "recordDeepCheck");
305
-
306
60
  // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
307
61
  var QUERY_LIMITS = {
308
62
  bytes: 8192,
@@ -360,11 +114,11 @@ var timezoneOf = /* @__PURE__ */ __name((given) => {
360
114
  var calendar = /* @__PURE__ */ __name((value, span) => {
361
115
  if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
362
116
  queryError("query.invalid-date", span, "use an ISO date or a quoted timestamp with offset");
363
- const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
117
+ const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day2 = Number(value.slice(8, 10));
364
118
  const date = /* @__PURE__ */ new Date(0);
365
- date.setUTCFullYear(year, month - 1, day);
119
+ date.setUTCFullYear(year, month - 1, day2);
366
120
  date.setUTCHours(0, 0, 0, 0);
367
- if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
121
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day2)
368
122
  queryError("query.invalid-date", span);
369
123
  return date;
370
124
  }, "calendar");
@@ -381,9 +135,9 @@ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
381
135
  era: "short"
382
136
  });
383
137
  const dayAt = /* @__PURE__ */ __name((time2) => {
384
- const parts = formatter.formatToParts(time2);
385
- const value2 = /* @__PURE__ */ __name((name) => Number(parts.find((p) => p.type === name)?.value), "value");
386
- const year = parts.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
138
+ const parts2 = formatter.formatToParts(time2);
139
+ const value2 = /* @__PURE__ */ __name((name) => Number(parts2.find((p) => p.type === name)?.value), "value");
140
+ const year = parts2.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
387
141
  return year * 1e4 + value2("month") * 100 + value2("day");
388
142
  }, "dayAt");
389
143
  let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
@@ -400,12 +154,12 @@ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
400
154
  }, "dayBoundary");
401
155
  var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
402
156
  var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
403
- const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
157
+ const [, year, month, day2, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
404
158
  if (year === void 0)
405
159
  queryError("query.invalid-date", span, "use YYYY-MM-DDTHH:mm, with optional seconds");
406
- const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
160
+ const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day2), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
407
161
  const check = new Date(wanted);
408
- if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
162
+ if (check.getUTCDate() !== Number(day2) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
409
163
  queryError("query.invalid-date", span);
410
164
  const formatter = new Intl.DateTimeFormat("en-CA", {
411
165
  timeZone: zone,
@@ -418,8 +172,8 @@ var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
418
172
  hourCycle: "h23"
419
173
  });
420
174
  const shown = /* @__PURE__ */ __name((instant) => {
421
- const parts = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
422
- return Date.UTC(parts.year ?? 0, (parts.month ?? 1) - 1, parts.day, parts.hour, parts.minute, parts.second) + (instant % 1e3 + 1e3) % 1e3;
175
+ const parts2 = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
176
+ return Date.UTC(parts2.year ?? 0, (parts2.month ?? 1) - 1, parts2.day, parts2.hour, parts2.minute, parts2.second) + (instant % 1e3 + 1e3) % 1e3;
423
177
  }, "shown");
424
178
  const found = /* @__PURE__ */ new Set();
425
179
  for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
@@ -492,13 +246,68 @@ var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclu
492
246
  };
493
247
  }, "dateRange");
494
248
 
495
- // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
496
- var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
497
- var OPERATORS_BY_TYPE = {
498
- kw: ["term", "phrase", "wildcard"],
499
- txt: ["term", "phrase", "wildcard"],
500
- enum: ["term"],
501
- num: ["term", "range"],
249
+ // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
250
+ var wordsOf = /* @__PURE__ */ __name((text6) => text6.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
251
+ var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
252
+ var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
253
+ var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
254
+ if (!present(value))
255
+ return false;
256
+ if (node.operator === "wildcard" && node.value === "*")
257
+ return true;
258
+ const text6 = String(value);
259
+ switch (field.type) {
260
+ case "txt": {
261
+ const words2 = wordsOf(text6);
262
+ if (node.operator === "wildcard")
263
+ return words2.some((word) => pattern(node.value).test(word));
264
+ const wanted = wordsOf(node.value);
265
+ return words2.some((_, at) => wanted.every((word, offset) => words2[at + offset] === word));
266
+ }
267
+ case "num": {
268
+ const number2 = Number(value);
269
+ if (node.operator !== "range")
270
+ return number2 === Number(node.value);
271
+ const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
272
+ return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
273
+ }
274
+ case "time": {
275
+ const time2 = Date.parse(text6);
276
+ const [lower, upper, lowerInclusive, upperInclusive] = node.operator === "range" ? [node.value, node.upper ?? "*", node.lower_inclusive ?? true, node.upper_inclusive ?? true] : [node.value, node.value, true, true];
277
+ const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
278
+ return (range.lower === void 0 || (range.lower_inclusive ? time2 >= range.lower : time2 > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time2 <= range.upper : time2 < range.upper));
279
+ }
280
+ default:
281
+ return node.operator === "wildcard" ? pattern(node.value).test(text6) : text6.toLowerCase() === node.value.toLowerCase();
282
+ }
283
+ }, "matchOne");
284
+ var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
285
+ if (node.kind === "boolean") {
286
+ const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
287
+ const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
288
+ const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
289
+ return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
290
+ }
291
+ const field = byName.get(node.field);
292
+ if (!field)
293
+ throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
294
+ if (field.relation !== void 0) {
295
+ if (!options.relation)
296
+ throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
297
+ return options.relation(node, item);
298
+ }
299
+ const value = item[node.field];
300
+ return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
301
+ }, "matches");
302
+ var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
303
+
304
+ // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
305
+ var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
306
+ var OPERATORS_BY_TYPE = {
307
+ kw: ["term", "phrase", "wildcard"],
308
+ txt: ["term", "phrase", "wildcard"],
309
+ enum: ["term"],
310
+ num: ["term", "range"],
502
311
  time: ["term", "range"],
503
312
  bool: ["term"],
504
313
  ref: ["term", "phrase"]
@@ -572,7 +381,7 @@ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
572
381
  }, "queryFieldsOf");
573
382
 
574
383
  // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
575
- var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
384
+ var shownOf = /* @__PURE__ */ __name((registry3) => registry3.backend === "native" ? registry3.fields.filter((field) => field.native) : registry3.fields, "shownOf");
576
385
  var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
577
386
  var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
578
387
  var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
@@ -583,28 +392,28 @@ var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
583
392
  ...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
584
393
  ].join(" \xB7 "), "syntaxOf");
585
394
  var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
586
- var fieldsHelp = /* @__PURE__ */ __name((registry, guide) => {
587
- const shown = shownOf(registry);
395
+ var fieldsHelp = /* @__PURE__ */ __name((registry3, guide) => {
396
+ const shown = shownOf(registry3);
588
397
  const negatable = leftOut(shown);
589
398
  const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
590
399
  const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
591
400
  return [
592
401
  "Fields:",
593
- ...rows.map(([name = "", kind = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
594
- ...registry.defaults && registry.defaults.length > 0 ? [`Defaults: ${registry.defaults.join(" ")} \u2014 name the field to change it`] : [],
402
+ ...rows.map(([name = "", kind2 = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind2.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
403
+ ...registry3.defaults && registry3.defaults.length > 0 ? [`Defaults: ${registry3.defaults.join(" ")} \u2014 name the field to change it`] : [],
595
404
  ...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
596
- `Syntax: ${syntaxOf(shown, registry.backend)}`,
405
+ `Syntax: ${syntaxOf(shown, registry3.backend)}`,
597
406
  ...guide ? [`Guide: ${guide}`] : []
598
407
  ].join("\n");
599
408
  }, "fieldsHelp");
600
- var queryDescription = /* @__PURE__ */ __name((registry) => {
601
- const shown = shownOf(registry);
409
+ var queryDescription = /* @__PURE__ */ __name((registry3) => {
410
+ const shown = shownOf(registry3);
602
411
  if (shown.length === 0)
603
412
  return "field:value terms; this list filters by none yet, so any term is refused";
604
413
  const negatable = leftOut(shown);
605
- const terms = registry.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
414
+ const terms = registry3.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
606
415
  const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
607
- const defaults = registry.defaults?.length ? `; unless named: ${registry.defaults.join(" ")}` : "";
416
+ const defaults = registry3.defaults?.length ? `; unless named: ${registry3.defaults.join(" ")}` : "";
608
417
  return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
609
418
  }, "queryDescription");
610
419
 
@@ -631,7 +440,7 @@ var reserved = /* @__PURE__ */ new Set([
631
440
  "\\",
632
441
  "/"
633
442
  ]);
634
- var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
443
+ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail3) => {
635
444
  let out = "";
636
445
  for (let at = 0; at < raw.length; at++) {
637
446
  if (raw[at] !== "\\") {
@@ -639,11 +448,11 @@ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
639
448
  continue;
640
449
  }
641
450
  if (++at >= raw.length)
642
- fail("query.invalid-escape", span);
451
+ fail3("query.invalid-escape", span);
643
452
  if (raw[at] === "u") {
644
453
  const hex = raw.slice(at + 1, at + 5);
645
454
  if (!/^[0-9a-fA-F]{4}$/.test(hex))
646
- fail("query.invalid-escape", span);
455
+ fail3("query.invalid-escape", span);
647
456
  out += String.fromCharCode(Number.parseInt(hex, 16));
648
457
  at += 4;
649
458
  } else
@@ -651,7 +460,7 @@ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
651
460
  }
652
461
  return out;
653
462
  }, "decodeEscapes");
654
- var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
463
+ var tokensOf = /* @__PURE__ */ __name((text6, fail3 = queryError) => {
655
464
  const tokens = [];
656
465
  let at = 0;
657
466
  let range = false;
@@ -662,7 +471,7 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
662
471
  at++;
663
472
  continue;
664
473
  }
665
- let kind = c;
474
+ let kind2 = c;
666
475
  if (c === '"' || !range && c === "/") {
667
476
  at++;
668
477
  while (at < text6.length && text6[at] !== c) {
@@ -671,26 +480,26 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
671
480
  at++;
672
481
  }
673
482
  if (at >= text6.length)
674
- fail("query.unclosed-literal", { start, end: at }, c === "/" ? regexHint(text6, start) : void 0);
483
+ fail3("query.unclosed-literal", { start, end: at }, c === "/" ? regexHint(text6, start) : void 0);
675
484
  at++;
676
485
  if (c === "/" && /^[dgimsuvy]+(?:$|[ \t\n\r)])/.test(text6.slice(at)))
677
- fail("query.unsupported-regex-flags", { start: at, end: at + 1 }, "Lucene regex does not take JavaScript flags");
678
- kind = c === '"' ? "quoted" : "regex";
486
+ fail3("query.unsupported-regex-flags", { start: at, end: at + 1 }, "Lucene regex does not take JavaScript flags");
487
+ kind2 = c === '"' ? "quoted" : "regex";
679
488
  } else if (range && c !== "]" && c !== "}") {
680
489
  while (at < text6.length && !whitespace(text6[at] ?? "") && !["]", "}"].includes(text6[at] ?? ""))
681
490
  at++;
682
- kind = "rangeValue";
491
+ kind2 = "rangeValue";
683
492
  } else if (reserved.has(c)) {
684
493
  if (c === "\\") {
685
494
  at += 2;
686
495
  while (at < text6.length && !whitespace(text6[at] ?? "") && (!reserved.has(text6[at] ?? "") || ["+", "-"].includes(text6[at] ?? "")))
687
496
  at++;
688
- kind = "term";
497
+ kind2 = "term";
689
498
  } else {
690
499
  at++;
691
500
  if ((c === "<" || c === ">") && text6[at] === "=") {
692
501
  at++;
693
- kind += "=";
502
+ kind2 += "=";
694
503
  }
695
504
  if (c === "[" || c === "{")
696
505
  range = true;
@@ -703,7 +512,7 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
703
512
  const next = text6[at] ?? "";
704
513
  if (next === "\\") {
705
514
  if (at + 1 >= text6.length)
706
- fail("query.invalid-escape", { start: at, end: at + 1 });
515
+ fail3("query.invalid-escape", { start: at, end: at + 1 });
707
516
  at += 2;
708
517
  continue;
709
518
  }
@@ -720,9 +529,9 @@ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
720
529
  while (at < text6.length && !whitespace(text6[at] ?? "") && !["(", ")", '"'].includes(text6[at] ?? ""))
721
530
  at++;
722
531
  const raw = text6.slice(start, at);
723
- kind = { AND: "AND", OR: "OR", NOT: "NOT", "&&": "AND", "||": "OR" }[raw] ?? (/^\d+(?:\.\d+)?$/u.test(raw) ? "number" : "term");
532
+ kind2 = { AND: "AND", OR: "OR", NOT: "NOT", "&&": "AND", "||": "OR" }[raw] ?? (/^\d+(?:\.\d+)?$/u.test(raw) ? "number" : "term");
724
533
  }
725
- tokens.push({ kind, raw: text6.slice(start, at), span: { start, end: at } });
534
+ tokens.push({ kind: kind2, raw: text6.slice(start, at), span: { start, end: at } });
726
535
  }
727
536
  tokens.push({ kind: "EOF", raw: "", span: { start: at, end: at } });
728
537
  return tokens;
@@ -741,30 +550,30 @@ var regexHint = /* @__PURE__ */ __name((text6, at) => {
741
550
  return quoteHint(text6, at) ?? `/ starts a regular expression; put the value in quotes: "${word}"`;
742
551
  }, "regexHint");
743
552
  var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proximity = false, ...context3 } = {}) => {
744
- const fail = /* @__PURE__ */ __name((reason, span, alternative) => queryError(reason, span, alternative ?? quoteHint(text6, span.start), context3), "fail");
553
+ const fail3 = /* @__PURE__ */ __name((reason, span, alternative) => queryError(reason, span, alternative ?? quoteHint(text6, span.start), context3), "fail");
745
554
  if (text6.length > QUERY_LIMITS.bytes || new TextEncoder().encode(text6).length > QUERY_LIMITS.bytes)
746
- fail("query.too-large", { start: 0, end: text6.length });
747
- const tokens = tokensOf(text6, fail);
555
+ fail3("query.too-large", { start: 0, end: text6.length });
556
+ const tokens = tokensOf(text6, fail3);
748
557
  let at = 0;
749
558
  let count7 = 0;
750
559
  let depth = 0;
751
560
  const peek = /* @__PURE__ */ __name(() => tokens[at], "peek");
752
561
  const take = /* @__PURE__ */ __name(() => tokens[at++], "take");
753
- const expect = /* @__PURE__ */ __name((kind) => {
754
- if (peek().kind !== kind)
755
- fail("query.invalid-syntax", peek().span);
562
+ const expect = /* @__PURE__ */ __name((kind2) => {
563
+ if (peek().kind !== kind2)
564
+ fail3("query.invalid-syntax", peek().span);
756
565
  return take();
757
566
  }, "expect");
758
567
  const built = /* @__PURE__ */ __name((node) => {
759
568
  if (++count7 > QUERY_LIMITS.nodes)
760
- fail("query.too-large", node.span);
569
+ fail3("query.too-large", node.span);
761
570
  return node;
762
571
  }, "built");
763
572
  const combine = /* @__PURE__ */ __name((clauses, occur) => {
764
573
  const first = clauses[0];
765
574
  const last = clauses.at(-1);
766
575
  if (!first || !last)
767
- fail("query.invalid-syntax", peek().span);
576
+ fail3("query.invalid-syntax", peek().span);
768
577
  if (clauses.length === 1)
769
578
  return first;
770
579
  return {
@@ -777,7 +586,7 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
777
586
  }, "combine");
778
587
  const query = /* @__PURE__ */ __name((field, implicit = false) => {
779
588
  if (++depth > QUERY_LIMITS.depth)
780
- fail("query.too-large", peek().span);
589
+ fail3("query.too-large", peek().span);
781
590
  const clauses = [];
782
591
  do {
783
592
  clauses.push(disjunction(field, implicit));
@@ -813,7 +622,7 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
813
622
  let implicit = inheritedImplicit;
814
623
  if (peek().kind === "term" && [":", "=", "<", ">", "<=", ">="].includes(tokens[at + 1]?.kind ?? "")) {
815
624
  const token = take();
816
- field = decodeEscapes(token.raw, token.span, fail);
625
+ field = decodeEscapes(token.raw, token.span, fail3);
817
626
  start = token.span.start;
818
627
  implicit = false;
819
628
  let operator = take();
@@ -822,8 +631,8 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
822
631
  if (["<", ">", "<=", ">="].includes(operator.kind)) {
823
632
  const value = take();
824
633
  if (!["term", "number", "quoted"].includes(value.kind))
825
- fail("query.invalid-syntax", value.span);
826
- const decoded = decodeEscapes(value.kind === "quoted" ? value.raw.slice(1, -1) : value.raw, value.span, fail);
634
+ fail3("query.invalid-syntax", value.span);
635
+ const decoded = decodeEscapes(value.kind === "quoted" ? value.raw.slice(1, -1) : value.raw, value.span, fail3);
827
636
  const lower = operator.kind.startsWith(">");
828
637
  const node2 = built({
829
638
  kind: "predicate",
@@ -848,17 +657,17 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
848
657
  const opening = take();
849
658
  const lower = take();
850
659
  if (!["rangeValue", "quoted"].includes(lower.kind))
851
- fail("query.invalid-syntax", lower.span);
660
+ fail3("query.invalid-syntax", lower.span);
852
661
  const separator = take();
853
662
  if (separator.raw !== "TO")
854
- fail("query.invalid-syntax", separator.span);
663
+ fail3("query.invalid-syntax", separator.span);
855
664
  const upper = take();
856
665
  if (!["rangeValue", "quoted"].includes(upper.kind))
857
- fail("query.invalid-syntax", upper.span);
666
+ fail3("query.invalid-syntax", upper.span);
858
667
  const closing = take();
859
668
  if (!["]", "}"].includes(closing.kind))
860
- fail("query.invalid-syntax", closing.span);
861
- const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail), "decode");
669
+ fail3("query.invalid-syntax", closing.span);
670
+ const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail3), "decode");
862
671
  node = built({
863
672
  kind: "predicate",
864
673
  field,
@@ -872,31 +681,31 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
872
681
  } else {
873
682
  const token = take();
874
683
  if (!["term", "number", "quoted", "regex"].includes(token.kind))
875
- fail("query.invalid-syntax", token.span);
684
+ fail3("query.invalid-syntax", token.span);
876
685
  const raw = ["term", "number"].includes(token.kind) ? token.raw : token.raw.slice(1, -1);
877
686
  if (field === "fn")
878
- fail("query.unsupported-operator", token.span, "interval functions are not supported");
687
+ fail3("query.unsupported-operator", token.span, "interval functions are not supported");
879
688
  const wildcard = ["term", "number"].includes(token.kind) && /(?<!\\)[*?]/u.test(raw);
880
689
  node = built({
881
690
  kind: "predicate",
882
691
  field,
883
692
  operator: token.kind === "regex" ? "regex" : token.kind === "quoted" ? "phrase" : wildcard ? "wildcard" : "term",
884
- value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail),
693
+ value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail3),
885
694
  span: { start: start ?? token.span.start, end: token.span.end },
886
695
  ...implicit ? { implicit: true } : {}
887
696
  });
888
697
  }
889
698
  if (proximity && peek().kind === "~" && node.kind === "predicate" && node.operator === "phrase") {
890
699
  take();
891
- const distance = take();
892
- if (distance.kind !== "number" || !/^\d+$/u.test(distance.raw))
893
- fail("query.invalid-syntax", distance.span, 'write the distance as a whole number: "a b"~3');
894
- node = { ...node, slop: Number(distance.raw), span: { start: node.span.start, end: distance.span.end } };
700
+ const distance2 = take();
701
+ if (distance2.kind !== "number" || !/^\d+$/u.test(distance2.raw))
702
+ fail3("query.invalid-syntax", distance2.span, 'write the distance as a whole number: "a b"~3');
703
+ node = { ...node, slop: Number(distance2.raw), span: { start: node.span.start, end: distance2.span.end } };
895
704
  }
896
705
  if (peek().kind === "~")
897
- fail("query.unsupported-operator", peek().span, node.kind === "predicate" && node.operator === "phrase" ? "proximity (~) is not supported \u2014 drop the ~ for the exact phrase, or join the words with AND" : "fuzzy matching (~) is not supported \u2014 use a prefix such as word* to catch word forms");
706
+ fail3("query.unsupported-operator", peek().span, node.kind === "predicate" && node.operator === "phrase" ? "proximity (~) is not supported \u2014 drop the ~ for the exact phrase, or join the words with AND" : "fuzzy matching (~) is not supported \u2014 use a prefix such as word* to catch word forms");
898
707
  if (["^", "@"].includes(peek().kind))
899
- fail("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
708
+ fail3("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
900
709
  return { node, ...modifier ? { modifier } : {} };
901
710
  }, "clause");
902
711
  const root = query(defaultField, true);
@@ -912,7 +721,7 @@ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proxim
912
721
  }, "parseLucene");
913
722
  var implicitTextTerms = /* @__PURE__ */ __name((text6) => {
914
723
  const tokens = tokensOf(text6);
915
- if (tokens.some(({ kind }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind)))
724
+ if (tokens.some(({ kind: kind2 }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind2)))
916
725
  return /* @__PURE__ */ new Set();
917
726
  return new Set(tokens.flatMap((token, index) => (token.kind === "term" || token.kind === "number") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index - 1]?.kind ?? "") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index + 1]?.kind ?? "") ? [token.span.start] : []));
918
727
  }, "implicitTextTerms");
@@ -930,24 +739,24 @@ var inContext = /* @__PURE__ */ __name((context3, run2) => {
930
739
  }, "inContext");
931
740
  var bounds = /* @__PURE__ */ __name((node) => node.operator === "range" ? [node.value, node.upper ?? "*"].filter((bound) => bound !== "*") : [node.value], "bounds");
932
741
  var checkValue = /* @__PURE__ */ __name((field, node, options) => {
933
- const fail = /* @__PURE__ */ __name((reason, alternative) => queryError(reason, node.span, alternative, options), "fail");
742
+ const fail3 = /* @__PURE__ */ __name((reason, alternative) => queryError(reason, node.span, alternative, options), "fail");
934
743
  if (node.value === "" && field.type !== "txt")
935
- fail("query.missing-value");
744
+ fail3("query.missing-value");
936
745
  if (node.operator === "wildcard")
937
746
  return;
938
747
  switch (field.type) {
939
748
  case "enum":
940
749
  if (!field.values?.includes(node.value.toLowerCase()))
941
- fail("query.unknown-value", `${field.name} takes ${field.values?.join(", ")}`);
750
+ fail3("query.unknown-value", `${field.name} takes ${field.values?.join(", ")}`);
942
751
  return;
943
752
  case "bool":
944
753
  if (!["true", "false"].includes(node.value.toLowerCase()))
945
- fail("query.unknown-value", `${field.name} takes true, false`);
754
+ fail3("query.unknown-value", `${field.name} takes true, false`);
946
755
  return;
947
756
  case "num":
948
757
  for (const bound of bounds(node))
949
758
  if (!Number.isFinite(Number(bound)) || bound.trim() === "")
950
- fail("query.invalid-number", `${field.name} takes a number`);
759
+ fail3("query.invalid-number", `${field.name} takes a number`);
951
760
  return;
952
761
  case "time":
953
762
  inContext(options, () => {
@@ -959,8 +768,8 @@ var checkValue = /* @__PURE__ */ __name((field, node, options) => {
959
768
  return;
960
769
  }
961
770
  }, "checkValue");
962
- var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
963
- const byName = new Map(registry.fields.map((field) => [field.name, field]));
771
+ var validateQuery = /* @__PURE__ */ __name((ast, registry3, options = {}) => {
772
+ const byName = new Map(registry3.fields.map((field) => [field.name, field]));
964
773
  const visit = /* @__PURE__ */ __name((node, required) => {
965
774
  if (node.kind === "boolean") {
966
775
  for (const clause of node.clauses)
@@ -970,11 +779,11 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
970
779
  const field = byName.get(node.field);
971
780
  if (!field)
972
781
  queryError("query.unknown-field", node.span, `no field "${node.field}"`, options, {
973
- fields: registry.fields.map((one) => one.name)
782
+ fields: registry3.fields.map((one) => one.name)
974
783
  });
975
- if (registry.backend === "native" && !field.native)
784
+ if (registry3.backend === "native" && !field.native)
976
785
  queryError("query.unsupported-field", node.span, `the source cannot filter by ${field.name}`, options, {
977
- supported: registry.fields.filter((one) => one.native).map((one) => one.name)
786
+ supported: registry3.fields.filter((one) => one.native).map((one) => one.name)
978
787
  });
979
788
  const presence = node.operator === "wildcard" && node.value === "*";
980
789
  if (!presence && !field.operators.includes(node.operator))
@@ -993,14 +802,14 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
993
802
  var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
994
803
 
995
804
  // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/registry.js
996
- var describeQuery = /* @__PURE__ */ __name((registry) => ({
997
- entity: registry.entity,
998
- backend: registry.backend,
999
- fields: registry.fields.map(({ validate: _, ...field }) => field),
1000
- ...registry.defaults && registry.defaults.length > 0 ? { defaults: [...registry.defaults] } : {}
805
+ var describeQuery = /* @__PURE__ */ __name((registry3) => ({
806
+ entity: registry3.entity,
807
+ backend: registry3.backend,
808
+ fields: registry3.fields.map(({ validate: _, ...field }) => field),
809
+ ...registry3.defaults && registry3.defaults.length > 0 ? { defaults: [...registry3.defaults] } : {}
1001
810
  }), "describeQuery");
1002
- var exampleProblems = /* @__PURE__ */ __name((registry) => {
1003
- const syntaxOnly = { ...registry, backend: "sql" };
811
+ var exampleProblems = /* @__PURE__ */ __name((registry3) => {
812
+ const syntaxOnly = { ...registry3, backend: "sql" };
1004
813
  const problem = /* @__PURE__ */ __name((text6, field) => {
1005
814
  try {
1006
815
  const named = walkQuery(validateQuery(parseLucene(text6, { defaultField: "none" }), syntaxOnly).root);
@@ -1011,29 +820,29 @@ var exampleProblems = /* @__PURE__ */ __name((registry) => {
1011
820
  return `"${text6}": ${failure.message}`;
1012
821
  }
1013
822
  }, "problem");
1014
- const defaults = (registry.defaults ?? []).map((term) => {
823
+ const defaults = (registry3.defaults ?? []).map((term) => {
1015
824
  const field = term.replace(/^-/, "").split(/[:<>=]/)[0] ?? "";
1016
825
  return { field, problem: problem(term.replace(/^-/, ""), field) };
1017
826
  });
1018
827
  return [
1019
- ...registry.fields.map((field) => ({ field: field.name, problem: problem(field.example, field.name) })),
828
+ ...registry3.fields.map((field) => ({ field: field.name, problem: problem(field.example, field.name) })),
1020
829
  ...defaults
1021
830
  ].filter((entry) => entry.problem !== void 0);
1022
831
  }, "exampleProblems");
1023
832
  var checked = /* @__PURE__ */ new WeakSet();
1024
- var defineQuery = /* @__PURE__ */ __name((registry) => {
1025
- if (checked.has(registry))
1026
- return registry;
1027
- const names = registry.fields.map((field) => field.name);
833
+ var defineQuery = /* @__PURE__ */ __name((registry3) => {
834
+ if (checked.has(registry3))
835
+ return registry3;
836
+ const names = registry3.fields.map((field) => field.name);
1028
837
  const problems = [
1029
838
  ...duplicates(names).map((name) => `"${name}" is listed twice`),
1030
839
  ...names.filter((name) => !SNAKE_CASE.test(name)).map((name) => `"${name}" is not snake_case`),
1031
- ...exampleProblems(registry).map(({ field, problem }) => `${field}: ${problem}`)
840
+ ...exampleProblems(registry3).map(({ field, problem }) => `${field}: ${problem}`)
1032
841
  ];
1033
842
  if (problems.length > 0)
1034
- throw new RegistryError(`${registry.entity} query`, problems);
1035
- checked.add(registry);
1036
- return registry;
843
+ throw new RegistryError(`${registry3.entity} query`, problems);
844
+ checked.add(registry3);
845
+ return registry3;
1037
846
  }, "defineQuery");
1038
847
  var SPAN = ["span", "alternative", "guide"];
1039
848
  var QUERY_REASONS = defineReasons([
@@ -1063,62 +872,7 @@ var QUERY_REASONS = defineReasons([
1063
872
  details: [...SPAN, ...details]
1064
873
  })));
1065
874
 
1066
- // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
1067
- var wordsOf = /* @__PURE__ */ __name((text6) => text6.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
1068
- var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
1069
- var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
1070
- var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
1071
- if (!present(value))
1072
- return false;
1073
- if (node.operator === "wildcard" && node.value === "*")
1074
- return true;
1075
- const text6 = String(value);
1076
- switch (field.type) {
1077
- case "txt": {
1078
- const words2 = wordsOf(text6);
1079
- if (node.operator === "wildcard")
1080
- return words2.some((word) => pattern(node.value).test(word));
1081
- const wanted = wordsOf(node.value);
1082
- return words2.some((_, at) => wanted.every((word, offset) => words2[at + offset] === word));
1083
- }
1084
- case "num": {
1085
- const number2 = Number(value);
1086
- if (node.operator !== "range")
1087
- return number2 === Number(node.value);
1088
- const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
1089
- return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
1090
- }
1091
- case "time": {
1092
- const time2 = Date.parse(text6);
1093
- const [lower, upper, lowerInclusive, upperInclusive] = node.operator === "range" ? [node.value, node.upper ?? "*", node.lower_inclusive ?? true, node.upper_inclusive ?? true] : [node.value, node.value, true, true];
1094
- const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
1095
- return (range.lower === void 0 || (range.lower_inclusive ? time2 >= range.lower : time2 > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time2 <= range.upper : time2 < range.upper));
1096
- }
1097
- default:
1098
- return node.operator === "wildcard" ? pattern(node.value).test(text6) : text6.toLowerCase() === node.value.toLowerCase();
1099
- }
1100
- }, "matchOne");
1101
- var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
1102
- if (node.kind === "boolean") {
1103
- const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
1104
- const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
1105
- const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
1106
- return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
1107
- }
1108
- const field = byName.get(node.field);
1109
- if (!field)
1110
- throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
1111
- if (field.relation !== void 0) {
1112
- if (!options.relation)
1113
- throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
1114
- return options.relation(node, item);
1115
- }
1116
- const value = item[node.field];
1117
- return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
1118
- }, "matches");
1119
- var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
1120
-
1121
- // 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/meetings/reference.js
875
+ // 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/meetings/reference.js
1122
876
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "expected meeting:<accountId>/<meetingId>[/<transcriptId>[/<cuePosition>]] with safe integer IDs"), "invalid");
1123
877
  var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
1124
878
  if (!Number.isSafeInteger(value) || value < minimum)
@@ -1126,24 +880,24 @@ var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
1126
880
  return value;
1127
881
  }, "integer");
1128
882
  var formatMeetingReference = /* @__PURE__ */ __name((reference2) => {
1129
- const parts = [integer2(reference2.accountId), integer2(reference2.meetingId)];
883
+ const parts2 = [integer2(reference2.accountId), integer2(reference2.meetingId)];
1130
884
  if (reference2.transcriptId !== void 0)
1131
- parts.push(integer2(reference2.transcriptId));
885
+ parts2.push(integer2(reference2.transcriptId));
1132
886
  if (reference2.cuePosition !== void 0) {
1133
887
  if (reference2.transcriptId === void 0)
1134
888
  throw invalid();
1135
- parts.push(integer2(reference2.cuePosition, 0));
889
+ parts2.push(integer2(reference2.cuePosition, 0));
1136
890
  }
1137
- return `meeting:${parts.join("/")}`;
891
+ return `meeting:${parts2.join("/")}`;
1138
892
  }, "formatMeetingReference");
1139
893
  var parseMeetingReference = /* @__PURE__ */ __name((text6) => {
1140
894
  const value = text6.trim();
1141
895
  if (!value.startsWith("meeting:"))
1142
896
  throw invalid();
1143
- const parts = value.slice(8).split("/");
1144
- if (parts.length < 2 || parts.length > 4 || parts.some((part) => !/^\d+$/.test(part)))
897
+ const parts2 = value.slice(8).split("/");
898
+ if (parts2.length < 2 || parts2.length > 4 || parts2.some((part) => !/^\d+$/.test(part)))
1145
899
  throw invalid();
1146
- const ids2 = parts.map(Number);
900
+ const ids2 = parts2.map(Number);
1147
901
  const reference2 = {
1148
902
  type: "meeting",
1149
903
  accountId: integer2(ids2[0]),
@@ -1155,7 +909,7 @@ var parseMeetingReference = /* @__PURE__ */ __name((text6) => {
1155
909
  }, "parseMeetingReference");
1156
910
  var canonicalMeetingReference = /* @__PURE__ */ __name((text6) => formatMeetingReference(parseMeetingReference(text6)), "canonicalMeetingReference");
1157
911
 
1158
- // 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/meetings/item.js
912
+ // 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/meetings/item.js
1159
913
  var text = string();
1160
914
  var count = pipe(number(), integer(), minValue(0));
1161
915
  var MEETING_ISSUES = ["time_without_zone"];
@@ -1220,115 +974,7 @@ var MEETING_QUERY = {
1220
974
  })
1221
975
  };
1222
976
 
1223
- // 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/meetings/join-key.js
1224
- var joinKeyOf = /* @__PURE__ */ __name((url) => {
1225
- const parsed = urlOf(url);
1226
- if (!parsed)
1227
- return null;
1228
- const host = parsed.hostname.toLowerCase().replace(/^www\./u, "");
1229
- const path = parsed.pathname.replace(/\/+$/u, "");
1230
- if (host === "zoom.us" || host.endsWith(".zoom.us") || host === "zoomgov.com" || host.endsWith(".zoomgov.com")) {
1231
- const number2 = /^\/(?:j|w|s|wc\/join|wc)\/(\d{9,12})(?:\/|$)/u.exec(path)?.[1];
1232
- if (number2)
1233
- return `zoom:${number2}`;
1234
- }
1235
- if (host === "meet.google.com") {
1236
- const code = /^\/([a-z]{3}-[a-z]{4}-[a-z]{3})$/iu.exec(path)?.[1];
1237
- if (code)
1238
- return `meet:${code.toLowerCase()}`;
1239
- }
1240
- return `${host}${path}`;
1241
- }, "joinKeyOf");
1242
- var joinUrlWithoutQuery = /* @__PURE__ */ __name((url) => {
1243
- const parsed = urlOf(url);
1244
- return parsed ? `${parsed.origin}${parsed.pathname}` : null;
1245
- }, "joinUrlWithoutQuery");
1246
- var urlOf = /* @__PURE__ */ __name((url) => {
1247
- if (!url?.trim())
1248
- return null;
1249
- try {
1250
- const parsed = new URL(url.trim());
1251
- return parsed.protocol === "https:" || parsed.protocol === "http:" ? parsed : null;
1252
- } catch {
1253
- return null;
1254
- }
1255
- }, "urlOf");
1256
-
1257
- // 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/meetings/calendar-text.js
1258
- var ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'", apos: "'", nbsp: " " };
1259
- var SECRET_LINE = /(?<![\p{L}\p{N}])(pass ?codes?|passwords?|pwd|pins?|access ?codes?|meeting ?codes?|kennwort|пароль|пин-?код|код доступа)(?![\p{L}\p{N}])|pwd=/iu;
1260
- var htmlToText = /* @__PURE__ */ __name((html) => html.replace(/<\s*br\s*\/?>/giu, "\n").replace(/<\/\s*(p|div|li|tr|h[1-6])\s*>/giu, "\n").replace(/<a\s[^>]*href\s*=\s*"([^"]*)"[^>]*>/giu, " $1 ").replace(/<[^>]+>/gu, "").replace(/&(amp|lt|gt|quot|#39|apos|nbsp);/gu, (_, name) => ENTITIES[name] ?? ""), "htmlToText");
1261
- var withoutLinkQueries = /* @__PURE__ */ __name((text6) => text6.replace(/https?:\/\/[^\s<>"')\]]+/giu, (url) => joinUrlWithoutQuery(url) ?? ""), "withoutLinkQueries");
1262
- var calendarText = /* @__PURE__ */ __name((text6, { dropSecretLines = true } = {}) => {
1263
- if (!text6)
1264
- return null;
1265
- const kept = htmlToText(text6).split(/\r?\n/u).map((line2) => withoutLinkQueries(line2).replace(/[ \t]+/gu, " ").trim()).filter((line2) => !dropSecretLines || !SECRET_LINE.test(line2));
1266
- const joined = kept.join("\n").replace(/\n{3,}/gu, "\n\n").trim();
1267
- return joined || null;
1268
- }, "calendarText");
1269
- var ENTRY_METADATA_KEYS = [
1270
- "colorId",
1271
- "guestsCanInviteOthers",
1272
- "guestsCanModify",
1273
- "guestsCanSeeOtherGuests",
1274
- "hangoutLink",
1275
- "locked",
1276
- "privateCopy",
1277
- // A phone call's, from a records import: the entry's other columns have no place for them.
1278
- "callDirection",
1279
- "callSeconds",
1280
- "callNumber"
1281
- ];
1282
- var entryMetadata = /* @__PURE__ */ __name((metadata) => {
1283
- const kept = {};
1284
- for (const key of ENTRY_METADATA_KEYS) {
1285
- const value = metadata?.[key];
1286
- if (typeof value === "string")
1287
- kept[key] = withoutLinkQueries(value);
1288
- else if (typeof value === "number" || typeof value === "boolean")
1289
- kept[key] = value;
1290
- }
1291
- return kept;
1292
- }, "entryMetadata");
1293
-
1294
- // 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/meetings/cue-fingerprint.js
1295
- import { createHash } from "node:crypto";
1296
- var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256").update(JSON.stringify({
1297
- reference: cue2.reference,
1298
- transcriptId: cue2.transcriptId,
1299
- contentHash: cue2.contentHash,
1300
- position: cue2.position,
1301
- startMs: cue2.startMs,
1302
- endMs: cue2.endMs,
1303
- speakerParticipantId: cue2.speakerParticipantId,
1304
- speakerName: cue2.speakerName,
1305
- text: cue2.text
1306
- })).digest("hex"), "meetingCueFingerprint");
1307
-
1308
- // 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/meetings/event-store.js
1309
- var UNTIL = /(?:^|;)UNTIL=(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?(?:;|$)/iu;
1310
- var seriesEnd = /* @__PURE__ */ __name((entry) => {
1311
- if (entry.recurrenceEndsAt !== null)
1312
- return entry.recurrenceEndsAt;
1313
- const rule = entry.recurrence?.find((line2) => /^RRULE:/iu.test(line2));
1314
- const until = rule === void 0 ? null : UNTIL.exec(rule.slice("RRULE:".length));
1315
- if (!until)
1316
- return Number.POSITIVE_INFINITY;
1317
- const [, year, month, day, hour = "23", minute = "59", second = "59"] = until;
1318
- return Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second)) + 864e5;
1319
- }, "seriesEnd");
1320
- var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
1321
- if (entry.kind === "occurrence" && !entry.exception)
1322
- return entry.originalStartsAt !== null && entry.originalStartsAt >= window.from && entry.originalStartsAt < window.to;
1323
- const start = entry.startsAt ?? (entry.kind === "occurrence" ? entry.originalStartsAt : null);
1324
- if (start === null || start >= window.to)
1325
- return false;
1326
- if (entry.kind === "series")
1327
- return seriesEnd(entry) >= window.from;
1328
- return Math.max(entry.endsAt ?? start, start + 1) > window.from;
1329
- }, "entryInWindow");
1330
-
1331
- // 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/meetings/answers.js
977
+ // 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/meetings/answers.js
1332
978
  var text2 = string();
1333
979
  var count2 = pipe(number(), integer(), minValue(0));
1334
980
  var iso2 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
@@ -1563,37 +1209,204 @@ var meetingHitsList = /* @__PURE__ */ __name((found, limit, command = "search me
1563
1209
  };
1564
1210
  }, "meetingHitsList");
1565
1211
 
1566
- // 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/meetings/participant-search.js
1567
- var normalizeMeetingParticipantQuery = /* @__PURE__ */ __name((text6) => text6.normalize("NFKC").toLowerCase(), "normalizeMeetingParticipantQuery");
1568
- var validateMeetingParticipantQuery = /* @__PURE__ */ __name((query) => {
1569
- if (typeof query !== "string" || !query.trim() || query.length > 500 || query.includes("\0"))
1570
- throw new CliError("validation_error", "participant query must contain 1\u2013500 characters without NUL");
1571
- return normalizeMeetingParticipantQuery(query.trim());
1572
- }, "validateMeetingParticipantQuery");
1573
- var validateMeetingParticipantSearch = /* @__PURE__ */ __name((query, input) => {
1574
- input.signal?.throwIfAborted();
1575
- const normalized = validateMeetingParticipantQuery(query);
1576
- const bounded = /* @__PURE__ */ __name((value, maximum, name) => {
1577
- if (!Number.isSafeInteger(value) || value < 1 || value > maximum)
1578
- throw new CliError("validation_error", `${name} must be an integer from 1 through ${maximum}`);
1579
- return value;
1580
- }, "bounded");
1581
- return {
1582
- query: normalized,
1583
- accountId: bounded(input.accountId, Number.MAX_SAFE_INTEGER, "accountId"),
1584
- limit: bounded(input.limit ?? 50, 1e3, "limit"),
1585
- scanLimit: bounded(input.scanLimit ?? 1e3, 1e4, "scanLimit"),
1586
- maxReadBytes: bounded(input.maxReadBytes ?? 1024 ** 2, 64 * 1024 ** 2, "maxReadBytes")
1587
- };
1588
- }, "validateMeetingParticipantSearch");
1589
-
1590
- // 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/meetings/reads.js
1591
- var MeetingError = class extends CliError {
1592
- static {
1593
- __name(this, "MeetingError");
1594
- }
1595
- constructor(code, message) {
1596
- super(code, message);
1212
+ // 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/meetings/join-key.js
1213
+ var joinKeyOf = /* @__PURE__ */ __name((url) => {
1214
+ const parsed = urlOf(url);
1215
+ if (!parsed)
1216
+ return null;
1217
+ const host = parsed.hostname.toLowerCase().replace(/^www\./u, "");
1218
+ const path = parsed.pathname.replace(/\/+$/u, "");
1219
+ if (host === "zoom.us" || host.endsWith(".zoom.us") || host === "zoomgov.com" || host.endsWith(".zoomgov.com")) {
1220
+ const number2 = /^\/(?:j|w|s|wc\/join|wc)\/(\d{9,12})(?:\/|$)/u.exec(path)?.[1];
1221
+ if (number2)
1222
+ return `zoom:${number2}`;
1223
+ }
1224
+ if (host === "meet.google.com") {
1225
+ const code = /^\/([a-z]{3}-[a-z]{4}-[a-z]{3})$/iu.exec(path)?.[1];
1226
+ if (code)
1227
+ return `meet:${code.toLowerCase()}`;
1228
+ }
1229
+ return `${host}${path}`;
1230
+ }, "joinKeyOf");
1231
+ var joinUrlWithoutQuery = /* @__PURE__ */ __name((url) => {
1232
+ const parsed = urlOf(url);
1233
+ return parsed ? `${parsed.origin}${parsed.pathname}` : null;
1234
+ }, "joinUrlWithoutQuery");
1235
+ var urlOf = /* @__PURE__ */ __name((url) => {
1236
+ if (!url?.trim())
1237
+ return null;
1238
+ try {
1239
+ const parsed = new URL(url.trim());
1240
+ return parsed.protocol === "https:" || parsed.protocol === "http:" ? parsed : null;
1241
+ } catch {
1242
+ return null;
1243
+ }
1244
+ }, "urlOf");
1245
+
1246
+ // 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/meetings/calendar-text.js
1247
+ var ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'", apos: "'", nbsp: " " };
1248
+ var SECRET_LINE = /(?<![\p{L}\p{N}])(pass ?codes?|passwords?|pwd|pins?|access ?codes?|meeting ?codes?|kennwort|пароль|пин-?код|код доступа)(?![\p{L}\p{N}])|pwd=/iu;
1249
+ var htmlToText = /* @__PURE__ */ __name((html) => html.replace(/<\s*br\s*\/?>/giu, "\n").replace(/<\/\s*(p|div|li|tr|h[1-6])\s*>/giu, "\n").replace(/<a\s[^>]*href\s*=\s*"([^"]*)"[^>]*>/giu, " $1 ").replace(/<[^>]+>/gu, "").replace(/&(amp|lt|gt|quot|#39|apos|nbsp);/gu, (_, name) => ENTITIES[name] ?? ""), "htmlToText");
1250
+ var withoutLinkQueries = /* @__PURE__ */ __name((text6) => text6.replace(/https?:\/\/[^\s<>"')\]]+/giu, (url) => joinUrlWithoutQuery(url) ?? ""), "withoutLinkQueries");
1251
+ var calendarText = /* @__PURE__ */ __name((text6, { dropSecretLines = true } = {}) => {
1252
+ if (!text6)
1253
+ return null;
1254
+ const kept = htmlToText(text6).split(/\r?\n/u).map((line2) => withoutLinkQueries(line2).replace(/[ \t]+/gu, " ").trim()).filter((line2) => !dropSecretLines || !SECRET_LINE.test(line2));
1255
+ const joined2 = kept.join("\n").replace(/\n{3,}/gu, "\n\n").trim();
1256
+ return joined2 || null;
1257
+ }, "calendarText");
1258
+ var ENTRY_METADATA_KEYS = [
1259
+ "colorId",
1260
+ "guestsCanInviteOthers",
1261
+ "guestsCanModify",
1262
+ "guestsCanSeeOtherGuests",
1263
+ "hangoutLink",
1264
+ "locked",
1265
+ "privateCopy",
1266
+ // A phone call's, from a records import: the entry's other columns have no place for them.
1267
+ "callDirection",
1268
+ "callSeconds",
1269
+ "callNumber"
1270
+ ];
1271
+ var entryMetadata = /* @__PURE__ */ __name((metadata) => {
1272
+ const kept = {};
1273
+ for (const key of ENTRY_METADATA_KEYS) {
1274
+ const value = metadata?.[key];
1275
+ if (typeof value === "string")
1276
+ kept[key] = withoutLinkQueries(value);
1277
+ else if (typeof value === "number" || typeof value === "boolean")
1278
+ kept[key] = value;
1279
+ }
1280
+ return kept;
1281
+ }, "entryMetadata");
1282
+
1283
+ // 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/meetings/cue-fingerprint.js
1284
+ import { createHash } from "node:crypto";
1285
+ var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256").update(JSON.stringify({
1286
+ reference: cue2.reference,
1287
+ transcriptId: cue2.transcriptId,
1288
+ contentHash: cue2.contentHash,
1289
+ position: cue2.position,
1290
+ startMs: cue2.startMs,
1291
+ endMs: cue2.endMs,
1292
+ speakerParticipantId: cue2.speakerParticipantId,
1293
+ speakerName: cue2.speakerName,
1294
+ text: cue2.text
1295
+ })).digest("hex"), "meetingCueFingerprint");
1296
+
1297
+ // 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/meetings/event-query.js
1298
+ var EVENT_QUERY = defineQuery({
1299
+ entity: "event",
1300
+ backend: "sql",
1301
+ fields: [
1302
+ { name: "id", type: "num", operators: ["term", "range"], example: "id:1" },
1303
+ { name: "origin", type: "enum", operators: ["term"], values: ["auto", "owner"], example: "origin:owner" },
1304
+ ...["starts_at", "ends_at", "created_at", "updated_at"].map((name) => ({
1305
+ name,
1306
+ type: "time",
1307
+ operators: ["term", "range"],
1308
+ example: `${name}>=2026-01-01`
1309
+ }))
1310
+ ]
1311
+ });
1312
+
1313
+ // 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/meetings/event-store.js
1314
+ var UNTIL = /(?:^|;)UNTIL=(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?(?:;|$)/iu;
1315
+ var seriesEnd = /* @__PURE__ */ __name((entry) => {
1316
+ if (entry.recurrenceEndsAt !== null)
1317
+ return entry.recurrenceEndsAt;
1318
+ const rule = entry.recurrence?.find((line2) => /^RRULE:/iu.test(line2));
1319
+ const until = rule === void 0 ? null : UNTIL.exec(rule.slice("RRULE:".length));
1320
+ if (!until)
1321
+ return Number.POSITIVE_INFINITY;
1322
+ const [, year, month, day2, hour = "23", minute = "59", second = "59"] = until;
1323
+ return Date.UTC(Number(year), Number(month) - 1, Number(day2), Number(hour), Number(minute), Number(second)) + 864e5;
1324
+ }, "seriesEnd");
1325
+ var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
1326
+ if (entry.kind === "occurrence" && !entry.exception)
1327
+ return entry.originalStartsAt !== null && entry.originalStartsAt >= window.from && entry.originalStartsAt < window.to;
1328
+ const start = entry.startsAt ?? (entry.kind === "occurrence" ? entry.originalStartsAt : null);
1329
+ if (start === null || start >= window.to)
1330
+ return false;
1331
+ if (entry.kind === "series")
1332
+ return seriesEnd(entry) >= window.from;
1333
+ return Math.max(entry.endsAt ?? start, start + 1) > window.from;
1334
+ }, "entryInWindow");
1335
+
1336
+ // 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/meetings/events.js
1337
+ var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now()) => {
1338
+ const current = await store.meeting(details.meeting.id);
1339
+ if (!current)
1340
+ return null;
1341
+ const { meeting: meeting2, series } = current;
1342
+ if (meeting2.eventId !== null)
1343
+ return (await store.events()).find((e) => e.id === meeting2.eventId) ?? null;
1344
+ const candidates = meeting2.startedAt === null ? [] : await store.eventCandidates({
1345
+ meetingSeriesId: meeting2.meetingSeriesId,
1346
+ joinUrl: meeting2.joinUrl,
1347
+ startsAt: meeting2.startedAt,
1348
+ endsAt: meeting2.endedAt ?? meeting2.startedAt
1349
+ });
1350
+ if (candidates.length > 1) {
1351
+ await store.reviewMeetingLink?.(meeting2.id, candidates.map(({ id: id4 }) => id4), now);
1352
+ return null;
1353
+ }
1354
+ let event2 = candidates[0];
1355
+ if (!event2) {
1356
+ let eventSeriesId = series?.eventSeriesId ?? null;
1357
+ if (series?.kind === "recurring" && eventSeriesId === null) {
1358
+ const created = await store.createEventSeries({ title: series.title, recurrence: null, origin: "auto" }, now);
1359
+ eventSeriesId = created.id;
1360
+ await store.setEventSeries(series.id, eventSeriesId, now);
1361
+ }
1362
+ event2 = await store.createEvent({
1363
+ eventSeriesId,
1364
+ title: meeting2.title,
1365
+ description: meeting2.description,
1366
+ location: meeting2.location,
1367
+ startsAt: meeting2.startedAt,
1368
+ endsAt: meeting2.endedAt,
1369
+ timezone: meeting2.timezone,
1370
+ origin: "auto",
1371
+ deletedAt: null
1372
+ }, now);
1373
+ }
1374
+ await store.linkMeeting(meeting2.id, event2.id, now);
1375
+ const linked = await store.meeting(meeting2.id);
1376
+ return (await store.events()).find((e) => e.id === linked?.meeting.eventId) ?? null;
1377
+ }, "linkEvent");
1378
+
1379
+ // 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/meetings/participant-search.js
1380
+ var normalizeMeetingParticipantQuery = /* @__PURE__ */ __name((text6) => text6.normalize("NFKC").toLowerCase(), "normalizeMeetingParticipantQuery");
1381
+ var validateMeetingParticipantQuery = /* @__PURE__ */ __name((query) => {
1382
+ if (typeof query !== "string" || !query.trim() || query.length > 500 || query.includes("\0"))
1383
+ throw new CliError("validation_error", "participant query must contain 1\u2013500 characters without NUL");
1384
+ return normalizeMeetingParticipantQuery(query.trim());
1385
+ }, "validateMeetingParticipantQuery");
1386
+ var validateMeetingParticipantSearch = /* @__PURE__ */ __name((query, input) => {
1387
+ input.signal?.throwIfAborted();
1388
+ const normalized = validateMeetingParticipantQuery(query);
1389
+ const bounded = /* @__PURE__ */ __name((value, maximum, name) => {
1390
+ if (!Number.isSafeInteger(value) || value < 1 || value > maximum)
1391
+ throw new CliError("validation_error", `${name} must be an integer from 1 through ${maximum}`);
1392
+ return value;
1393
+ }, "bounded");
1394
+ return {
1395
+ query: normalized,
1396
+ accountId: bounded(input.accountId, Number.MAX_SAFE_INTEGER, "accountId"),
1397
+ limit: bounded(input.limit ?? 50, 1e3, "limit"),
1398
+ scanLimit: bounded(input.scanLimit ?? 1e3, 1e4, "scanLimit"),
1399
+ maxReadBytes: bounded(input.maxReadBytes ?? 1024 ** 2, 64 * 1024 ** 2, "maxReadBytes")
1400
+ };
1401
+ }, "validateMeetingParticipantSearch");
1402
+
1403
+ // 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/meetings/reads.js
1404
+ var MeetingError = class extends CliError {
1405
+ static {
1406
+ __name(this, "MeetingError");
1407
+ }
1408
+ constructor(code, message) {
1409
+ super(code, message);
1597
1410
  }
1598
1411
  };
1599
1412
  var positiveInteger = /* @__PURE__ */ __name((value) => {
@@ -1719,7 +1532,7 @@ var meetingSummaryAnswer = /* @__PURE__ */ __name(async (store, id4, accountId)
1719
1532
  return wholeList(details.summaries.map((one) => meetingSummaryItem(details.meeting.accountId, one)));
1720
1533
  }, "meetingSummaryAnswer");
1721
1534
 
1722
- // 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/meetings/export.js
1535
+ // 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/meetings/export.js
1723
1536
  var timestamp = /* @__PURE__ */ __name((milliseconds) => {
1724
1537
  if (!Number.isSafeInteger(milliseconds) || milliseconds < 0)
1725
1538
  throw new MeetingError("validation_error", "transcript times must be nonnegative integer milliseconds");
@@ -1781,30 +1594,30 @@ var exportMeeting = /* @__PURE__ */ __name(async (store, id4, options) => {
1781
1594
  text: row.text
1782
1595
  })));
1783
1596
  } else {
1784
- const parts = [`# ${heading(details.meeting.title ?? "Untitled meeting")}`, `Meeting ID: ${details.meeting.id}`];
1597
+ const parts2 = [`# ${heading(details.meeting.title ?? "Untitled meeting")}`, `Meeting ID: ${details.meeting.id}`];
1785
1598
  if (details.meeting.description !== null)
1786
- parts.push("## Description", quote(details.meeting.description));
1599
+ parts2.push("## Description", quote(details.meeting.description));
1787
1600
  for (const summary of details.summaries) {
1788
- parts.push(`## ${heading(summary.title ?? "Summary")}`);
1601
+ parts2.push(`## ${heading(summary.title ?? "Summary")}`);
1789
1602
  if (summary.content !== null)
1790
- parts.push(quote(summary.content));
1603
+ parts2.push(quote(summary.content));
1791
1604
  else {
1792
1605
  if (summary.overview !== null)
1793
- parts.push(quote(summary.overview));
1606
+ parts2.push(quote(summary.overview));
1794
1607
  for (const section of summary.sections)
1795
- parts.push(`### ${heading(section.label)}`, quote(section.text));
1608
+ parts2.push(`### ${heading(section.label)}`, quote(section.text));
1796
1609
  if (summary.nextSteps.length > 0)
1797
- parts.push("### Next steps", summary.nextSteps.map((step) => `- ${markdown(step)}`).join("\n"));
1610
+ parts2.push("### Next steps", summary.nextSteps.map((step) => `- ${markdown(step)}`).join("\n"));
1798
1611
  }
1799
1612
  }
1800
1613
  for (const part of transcripts) {
1801
- parts.push(`## Transcript ${part.transcript.id}`, `Source: ${heading(part.transcript.source)}`);
1614
+ parts2.push(`## Transcript ${part.transcript.id}`, `Source: ${heading(part.transcript.source)}`);
1802
1615
  if (part.transcript.supersededAt !== null)
1803
- parts.push("Version: superseded");
1616
+ parts2.push("Version: superseded");
1804
1617
  for (const row of [...part.rows].sort((a, b) => a.position - b.position))
1805
- parts.push(`[${timestamp(row.startMs)} \u2013 ${timestamp(row.endMs)}]${row.speakerName === null ? "" : ` ${heading(row.speakerName)}`}`, quote(row.text));
1618
+ parts2.push(`[${timestamp(row.startMs)} \u2013 ${timestamp(row.endMs)}]${row.speakerName === null ? "" : ` ${heading(row.speakerName)}`}`, quote(row.text));
1806
1619
  }
1807
- content = `${parts.join("\n\n")}
1620
+ content = `${parts2.join("\n\n")}
1808
1621
  `;
1809
1622
  }
1810
1623
  return {
@@ -1815,7 +1628,10 @@ var exportMeeting = /* @__PURE__ */ __name(async (store, id4, options) => {
1815
1628
  };
1816
1629
  }, "exportMeeting");
1817
1630
 
1818
- // 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/meetings/payment.js
1631
+ // 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/meetings/findings-rules.js
1632
+ import { createHash as createHash2 } from "node:crypto";
1633
+
1634
+ // 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/meetings/payment.js
1819
1635
  var FACT_TYPES = ["fact", "statement", "question", "decision", "promise"];
1820
1636
  var PAYMENT_DIRECTIONS = ["to_us", "from_us"];
1821
1637
  var PAYMENT_STATES = ["expected", "paid", "cancelled"];
@@ -1909,10 +1725,7 @@ var paymentTitle = /* @__PURE__ */ __name((fact) => {
1909
1725
  return `${grouped(payment.amount)} ${payment.currency} ${way}${party}${item}${due} (${payment.state})`;
1910
1726
  }, "paymentTitle");
1911
1727
 
1912
- // 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/meetings/findings-rules.js
1913
- import { createHash as createHash2 } from "node:crypto";
1914
-
1915
- // 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/meetings/timestamp.js
1728
+ // 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/meetings/timestamp.js
1916
1729
  var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
1917
1730
  if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T.+(?:Z|[+-]\d{2}:\d{2})$/i.test(value) || !Number.isFinite(Date.parse(value)))
1918
1731
  throw new CliError("validation_error", `${name} must be an ISO timestamp with a timezone, such as 2026-11-09T09:00:00Z`);
@@ -1923,7 +1736,7 @@ var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
1923
1736
  return new Date(value).toISOString();
1924
1737
  }, "meetingTimestamp");
1925
1738
 
1926
- // 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/meetings/findings-rules.js
1739
+ // 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/meetings/findings-rules.js
1927
1740
  var TASK_TYPES = ["bug", "feature", "chore"];
1928
1741
  var invalid3 = /* @__PURE__ */ __name((message) => {
1929
1742
  throw new CliError("validation_error", message);
@@ -1937,10 +1750,10 @@ var findingHash = /* @__PURE__ */ __name((value) => createHash2("sha256").update
1937
1750
  var snakeCase = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snakeCase");
1938
1751
  var findingWhere = /* @__PURE__ */ __name((of) => {
1939
1752
  const id4 = typeof of.id === "string" ? of.id : null;
1940
- const kind = typeof of.kind === "string" ? of.kind : null;
1753
+ const kind2 = typeof of.kind === "string" ? of.kind : null;
1941
1754
  return {
1942
- where: id4 || kind ? ` in ${[id4, kind && `(${kind})`].filter(Boolean).join(" ")}` : "",
1943
- named: { ...id4 ? { finding: id4 } : {}, ...kind ? { kind } : {} }
1755
+ where: id4 || kind2 ? ` in ${[id4, kind2 && `(${kind2})`].filter(Boolean).join(" ")}` : "",
1756
+ named: { ...id4 ? { finding: id4 } : {}, ...kind2 ? { kind: kind2 } : {} }
1944
1757
  };
1945
1758
  }, "findingWhere");
1946
1759
  var findingFields = /* @__PURE__ */ __name((value, allowed, noun, of = value) => {
@@ -1968,13 +1781,15 @@ var validEvidence = /* @__PURE__ */ __name((raw, rules) => {
1968
1781
  const evidence = raw.map((item) => {
1969
1782
  if (!item || typeof item !== "object")
1970
1783
  return invalid3("finding evidence is a reference and fingerprint");
1971
- findingFields(item, ["reference", "fingerprint"], rules.singular);
1784
+ findingFields(item, rules.quotes ? ["reference", "fingerprint", "quote"] : ["reference", "fingerprint"], rules.singular);
1972
1785
  if (typeof item.reference !== "string" || typeof item.fingerprint !== "string")
1973
1786
  return invalid3("evidence requires a reference and fingerprint");
1974
1787
  const reference2 = rules.reference(item.reference);
1975
1788
  if (!/^[a-f0-9]{64}$/.test(item.fingerprint))
1976
1789
  return invalid3(`finding evidence requires exact ${rules.cited} references and fingerprints`);
1977
- return { reference: reference2, fingerprint: item.fingerprint };
1790
+ if (item.quote === void 0)
1791
+ return { reference: reference2, fingerprint: item.fingerprint };
1792
+ return { reference: reference2, fingerprint: item.fingerprint, quote: findingText(item.quote, rules.quotes ?? 0) };
1978
1793
  }).sort((a, b) => a.reference.localeCompare(b.reference));
1979
1794
  if (new Set(evidence.map((item) => item.reference)).size !== evidence.length)
1980
1795
  return invalid3(`duplicate evidence ${rules.cited}`);
@@ -2096,7 +1911,7 @@ var validateBatch = /* @__PURE__ */ __name((input, rules, most, one) => {
2096
1911
  var validateFindings = /* @__PURE__ */ __name((input, rules) => validateBatch(input, rules, 16, (finding, ids2) => validateFinding(finding, rules, ids2)), "validateFindings");
2097
1912
  var findingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "findingFingerprint");
2098
1913
 
2099
- // 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/meetings/findings.js
1914
+ // 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/meetings/findings.js
2100
1915
  var MEETING_FINDINGS_KIND = "meeting_findings";
2101
1916
  var cue = /* @__PURE__ */ __name((raw) => {
2102
1917
  const reference2 = canonicalMeetingReference(raw);
@@ -2107,258 +1922,66 @@ var cue = /* @__PURE__ */ __name((raw) => {
2107
1922
  var validateMeetingFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "meeting findings", singular: "meeting finding", cited: "cue", reference: cue }), "validateMeetingFindings");
2108
1923
  var meetingFindingFingerprint = findingFingerprint;
2109
1924
 
2110
- // 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/meetings/result-items.js
2111
- var text3 = string();
2112
- var identifier = pipe(text3, minLength(1));
2113
- var nullableText = nullable(text3);
2114
- var count3 = pipe(number(), integer(), minValue(0));
2115
- var flag = boolean();
2116
- var scope = strictObject({ provider: text3, account: text3 });
2117
- var run = strictObject({
2118
- meetings: count3,
2119
- participants: count3,
2120
- transcript_rows: count3,
2121
- summaries: count3,
2122
- warnings: array(strictObject({ external_id: text3, message: text3 })),
2123
- timezone: optional(text3)
2124
- });
2125
- var exported = union([
2126
- strictObject({ meeting_id: identifier, format: picklist(["markdown", "vtt"]), filename: text3, content: text3 }),
2127
- strictObject({ meeting_id: identifier, format: picklist(["markdown", "vtt"]), output: text3 })
2128
- ]);
2129
- var eventChange = strictObject({
2130
- action: literal("event.link"),
2131
- event_id: nullable(identifier),
2132
- expected_event_id: optional(nullable(identifier))
1925
+ // 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/meetings/hit-query.js
1926
+ var context = {
1927
+ command: "search meetings",
1928
+ guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md#\u0432\u0441\u0442\u0440\u0435\u0447\u0438"
1929
+ };
1930
+ var words = ["term", "phrase"];
1931
+ var MOST_LINES_APART = 20;
1932
+ var near = /* @__PURE__ */ __name((node) => {
1933
+ if (node.slop !== void 0 && node.slop > MOST_LINES_APART)
1934
+ queryError("query.invalid-number", node.span, `words at most ${MOST_LINES_APART} lines apart: "a b"~${MOST_LINES_APART}`, context);
1935
+ }, "near");
1936
+ var MEETING_HIT_QUERY = defineQuery({
1937
+ entity: "meeting_hit",
1938
+ backend: "sql",
1939
+ fields: [
1940
+ {
1941
+ name: "text",
1942
+ type: "txt",
1943
+ operators: words,
1944
+ example: "text:budget",
1945
+ relation: "a passage with the word in any form, or a spelling speech recognition garbled",
1946
+ validate: near
1947
+ },
1948
+ {
1949
+ name: "exact",
1950
+ type: "txt",
1951
+ operators: words,
1952
+ example: "exact:budget",
1953
+ relation: "a passage with the word as typed: no other forms, no garbled spellings",
1954
+ validate: near
1955
+ },
1956
+ {
1957
+ name: "from",
1958
+ type: "kw",
1959
+ operators: words,
1960
+ example: 'from:"Alice Synthetic"',
1961
+ relation: "a line said or a chat message written by this person; attendance is --identity-id"
1962
+ }
1963
+ ]
2133
1964
  });
2134
- var personChange = strictObject({
2135
- action: literal("person.link"),
2136
- participant_id: identifier,
2137
- person_uid: text3,
2138
- expected_person_uid: optional(nullableText),
2139
- target_account_ids: optional(array(identifier))
2140
- });
2141
- var eventResult = strictObject({
2142
- meeting_id: identifier,
2143
- event_id: nullable(identifier),
2144
- previous_event_id: nullable(identifier),
2145
- changed: flag
2146
- });
2147
- var personResult = strictObject({
2148
- meeting_id: identifier,
2149
- participant_id: identifier,
2150
- person_uid: text3,
2151
- previous_person_uid: nullableText,
2152
- changed: flag
2153
- });
2154
- var meetingChange = strictObject({
2155
- scope,
2156
- account_id: identifier,
2157
- meeting_id: identifier,
2158
- change: union([eventChange, personChange]),
2159
- applied: flag,
2160
- result: optional(union([eventResult, personResult]))
2161
- });
2162
- var recognition = strictObject({
2163
- engine: text3,
2164
- model: text3,
2165
- version: optional(text3),
2166
- timing: optional(picklist(["fixed-windows", "recognition-segments"]))
2167
- });
2168
- var transcription = union([
2169
- strictObject({
2170
- applied: literal(false),
2171
- account_id: identifier,
2172
- external_id: text3,
2173
- segments: count3,
2174
- media: strictObject({
2175
- id: text3,
2176
- content_hash: text3,
2177
- size: count3,
2178
- duration_ms: count3,
2179
- format: text3,
2180
- sample_rate: count3,
2181
- channels: count3,
2182
- recognition
2183
- })
2184
- }),
2185
- strictObject({
2186
- applied: literal(true),
2187
- account_id: identifier,
2188
- external_id: text3,
2189
- meeting_id: identifier,
2190
- created: flag,
2191
- inserted_transcripts: count3,
2192
- replayed_transcripts: count3,
2193
- superseded_transcripts: count3,
2194
- segments: count3,
2195
- media_sha256: text3,
2196
- engine: text3,
2197
- model: text3,
2198
- model_version: nullableText,
2199
- timing: picklist(["fixed-windows", "recognition-segments"])
2200
- })
2201
- ]);
2202
- var embeddingModel = strictObject({ key: text3, dims: count3, kind: picklist(["local", "remote"]), model: text3 });
2203
- var embedding = union([
2204
- strictObject({
2205
- account_id: identifier,
2206
- model: embeddingModel,
2207
- status: strictObject({ chunks: count3, embedded: count3 }),
2208
- applied: literal(false),
2209
- scope: literal("existing-current-chunks"),
2210
- rebuild_required: literal("explicit")
2211
- }),
2212
- strictObject({
2213
- account_id: identifier,
2214
- model: embeddingModel,
2215
- saved: count3,
2216
- skipped: count3,
2217
- has_more: flag,
2218
- next_hash: optional(text3),
2219
- applied: literal(true),
2220
- rebuild: strictObject({
2221
- transcripts: count3,
2222
- chunks: count3,
2223
- has_more: flag,
2224
- next_transcript_id: optional(identifier)
2225
- })
2226
- })
2227
- ]);
2228
- var repair = strictObject({
2229
- account_id: identifier,
2230
- applied: flag,
2231
- transcripts: count3,
2232
- languages: array(strictObject({ language: nullableText, transcripts: count3 }))
2233
- });
2234
- var MEETING_RESULT_ENTITIES = {
2235
- meeting_ingestion: run,
2236
- meeting_export: exported,
2237
- meeting_association: meetingChange,
2238
- meeting_transcription: transcription,
2239
- meeting_embedding: embedding,
2240
- meeting_repair: repair
2241
- };
2242
-
2243
- // 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/meetings/event-query.js
2244
- var EVENT_QUERY = defineQuery({
2245
- entity: "event",
2246
- backend: "sql",
2247
- fields: [
2248
- { name: "id", type: "num", operators: ["term", "range"], example: "id:1" },
2249
- { name: "origin", type: "enum", operators: ["term"], values: ["auto", "owner"], example: "origin:owner" },
2250
- ...["starts_at", "ends_at", "created_at", "updated_at"].map((name) => ({
2251
- name,
2252
- type: "time",
2253
- operators: ["term", "range"],
2254
- example: `${name}>=2026-01-01`
2255
- }))
2256
- ]
2257
- });
2258
-
2259
- // 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/meetings/events.js
2260
- var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now()) => {
2261
- const current = await store.meeting(details.meeting.id);
2262
- if (!current)
2263
- return null;
2264
- const { meeting: meeting2, series } = current;
2265
- if (meeting2.eventId !== null)
2266
- return (await store.events()).find((e) => e.id === meeting2.eventId) ?? null;
2267
- const candidates = meeting2.startedAt === null ? [] : await store.eventCandidates({
2268
- meetingSeriesId: meeting2.meetingSeriesId,
2269
- joinUrl: meeting2.joinUrl,
2270
- startsAt: meeting2.startedAt,
2271
- endsAt: meeting2.endedAt ?? meeting2.startedAt
2272
- });
2273
- if (candidates.length > 1) {
2274
- await store.reviewMeetingLink?.(meeting2.id, candidates.map(({ id: id4 }) => id4), now);
2275
- return null;
2276
- }
2277
- let event2 = candidates[0];
2278
- if (!event2) {
2279
- let eventSeriesId = series?.eventSeriesId ?? null;
2280
- if (series?.kind === "recurring" && eventSeriesId === null) {
2281
- const created = await store.createEventSeries({ title: series.title, recurrence: null, origin: "auto" }, now);
2282
- eventSeriesId = created.id;
2283
- await store.setEventSeries(series.id, eventSeriesId, now);
2284
- }
2285
- event2 = await store.createEvent({
2286
- eventSeriesId,
2287
- title: meeting2.title,
2288
- description: meeting2.description,
2289
- location: meeting2.location,
2290
- startsAt: meeting2.startedAt,
2291
- endsAt: meeting2.endedAt,
2292
- timezone: meeting2.timezone,
2293
- origin: "auto",
2294
- deletedAt: null
2295
- }, now);
2296
- }
2297
- await store.linkMeeting(meeting2.id, event2.id, now);
2298
- const linked = await store.meeting(meeting2.id);
2299
- return (await store.events()).find((e) => e.id === linked?.meeting.eventId) ?? null;
2300
- }, "linkEvent");
2301
-
2302
- // 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/meetings/hit-query.js
2303
- var context = {
2304
- command: "search meetings",
2305
- guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md#\u0432\u0441\u0442\u0440\u0435\u0447\u0438"
2306
- };
2307
- var words = ["term", "phrase"];
2308
- var MOST_LINES_APART = 20;
2309
- var near = /* @__PURE__ */ __name((node) => {
2310
- if (node.slop !== void 0 && node.slop > MOST_LINES_APART)
2311
- queryError("query.invalid-number", node.span, `words at most ${MOST_LINES_APART} lines apart: "a b"~${MOST_LINES_APART}`, context);
2312
- }, "near");
2313
- var MEETING_HIT_QUERY = defineQuery({
2314
- entity: "meeting_hit",
2315
- backend: "sql",
2316
- fields: [
2317
- {
2318
- name: "text",
2319
- type: "txt",
2320
- operators: words,
2321
- example: "text:budget",
2322
- relation: "a passage with the word in any form, or a spelling speech recognition garbled",
2323
- validate: near
2324
- },
2325
- {
2326
- name: "exact",
2327
- type: "txt",
2328
- operators: words,
2329
- example: "exact:budget",
2330
- relation: "a passage with the word as typed: no other forms, no garbled spellings",
2331
- validate: near
2332
- },
2333
- {
2334
- name: "from",
2335
- type: "kw",
2336
- operators: words,
2337
- example: 'from:"Alice Synthetic"',
2338
- relation: "a line said or a chat message written by this person; attendance is --identity-id"
2339
- }
2340
- ]
2341
- });
2342
- var MEETING_FIELDS = defineQuery({
2343
- entity: "meeting_hit",
2344
- backend: "sql",
2345
- fields: [
2346
- ...MEETING_HIT_QUERY.fields,
2347
- {
2348
- name: "date",
2349
- type: "time",
2350
- operators: ["term", "range"],
2351
- example: "date>=30d",
2352
- relation: "meetings that started then; the same as --since-time and --until-time"
2353
- },
2354
- ...["project", "tag", "topic"].map((name) => ({
2355
- name,
2356
- type: "kw",
2357
- operators: words,
2358
- example: `${name}:"Example name"`,
2359
- relation: `meetings in this ${name}, by name or alias; the same as --${name}`
2360
- }))
2361
- ]
1965
+ var MEETING_FIELDS = defineQuery({
1966
+ entity: "meeting_hit",
1967
+ backend: "sql",
1968
+ fields: [
1969
+ ...MEETING_HIT_QUERY.fields,
1970
+ {
1971
+ name: "date",
1972
+ type: "time",
1973
+ operators: ["term", "range"],
1974
+ example: "date>=30d",
1975
+ relation: "meetings that started then; the same as --since-time and --until-time"
1976
+ },
1977
+ ...["project", "tag", "topic"].map((name) => ({
1978
+ name,
1979
+ type: "kw",
1980
+ operators: words,
1981
+ example: `${name}:"Example name"`,
1982
+ relation: `meetings in this ${name}, by name or alias; the same as --${name}`
1983
+ }))
1984
+ ]
2362
1985
  });
2363
1986
  var LIFTED = /* @__PURE__ */ new Set(["date", "project", "tag", "topic"]);
2364
1987
  var MEETING_FIELD_NAMES = new Set(MEETING_FIELDS.fields.map(({ name }) => name));
@@ -2419,7 +2042,7 @@ var meetingWordsQuery = /* @__PURE__ */ __name((text6) => {
2419
2042
  return { version: 1, language: "lucene-v1", root };
2420
2043
  }, "meetingWordsQuery");
2421
2044
 
2422
- // 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/meetings/language.js
2045
+ // 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/meetings/language.js
2423
2046
  var LATIN_WORDS = {
2424
2047
  en: ["the", "and", "is", "that", "you", "this", "what", "have", "with", "are"],
2425
2048
  es: ["el", "los", "las", "por", "pero", "para", "est\xE1", "muy", "tambi\xE9n", "hay"],
@@ -2468,7 +2091,7 @@ var transcriptLanguage = /* @__PURE__ */ __name((texts) => {
2468
2091
  return null;
2469
2092
  }, "transcriptLanguage");
2470
2093
 
2471
- // 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/meetings/ingest.js
2094
+ // 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/meetings/ingest.js
2472
2095
  var contentHash = /* @__PURE__ */ __name(async (text6) => {
2473
2096
  const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text6));
2474
2097
  return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -2505,7 +2128,7 @@ var timestamp2 = /* @__PURE__ */ __name((value) => {
2505
2128
  return time2;
2506
2129
  }, "timestamp");
2507
2130
 
2508
- // 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/meetings/transcript-text.js
2131
+ // 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/meetings/transcript-text.js
2509
2132
  var TranscriptTextError = class extends Error {
2510
2133
  static {
2511
2134
  __name(this, "TranscriptTextError");
@@ -2560,7 +2183,7 @@ var parseTranscriptText = /* @__PURE__ */ __name((input) => {
2560
2183
  return { header, lines };
2561
2184
  }, "parseTranscriptText");
2562
2185
 
2563
- // 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/meetings/vtt.js
2186
+ // 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/meetings/vtt.js
2564
2187
  var VttError = class extends Error {
2565
2188
  static {
2566
2189
  __name(this, "VttError");
@@ -2612,7 +2235,7 @@ var parseVtt = /* @__PURE__ */ __name((input) => {
2612
2235
  return cues;
2613
2236
  }, "parseVtt");
2614
2237
 
2615
- // 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/meetings/import.js
2238
+ // 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/meetings/import.js
2616
2239
  var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now()) => {
2617
2240
  const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
2618
2241
  for (const file of files) {
@@ -2645,10 +2268,10 @@ var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now())
2645
2268
  return report;
2646
2269
  }, "importFiles");
2647
2270
 
2648
- // 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/meetings/links.js
2271
+ // 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/meetings/links.js
2649
2272
  var CHAT_MESSAGES_READ = 1e5;
2650
2273
 
2651
- // 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/meetings/provider.js
2274
+ // 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/meetings/provider.js
2652
2275
  var snapshotMeetingScope = /* @__PURE__ */ __name((scope2) => {
2653
2276
  const provider = scope2?.provider;
2654
2277
  const account = scope2?.account;
@@ -2657,7 +2280,7 @@ var snapshotMeetingScope = /* @__PURE__ */ __name((scope2) => {
2657
2280
  return Object.freeze({ provider, account });
2658
2281
  }, "snapshotMeetingScope");
2659
2282
 
2660
- // 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/meetings/meeting-management.js
2283
+ // 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/meetings/meeting-management.js
2661
2284
  var nonempty = /* @__PURE__ */ __name((value, name) => {
2662
2285
  if (typeof value !== "string" || !value.trim())
2663
2286
  throw new CliError("validation_error", `${name} must be nonempty`);
@@ -2708,7 +2331,7 @@ var validateMeetingChange = /* @__PURE__ */ __name((change, create) => {
2708
2331
  return Object.freeze(result);
2709
2332
  }, "validateMeetingChange");
2710
2333
 
2711
- // 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/meetings/passage.js
2334
+ // 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/meetings/passage.js
2712
2335
  var meetingHitContextLimits = /* @__PURE__ */ __name((options = {}) => {
2713
2336
  const { before = 3, after = 3, bytes = 65536, max_read_bytes = 4194304, expected_fingerprint } = options;
2714
2337
  if (![before, after].every((value) => Number.isSafeInteger(value) && value >= 0) || before + after > 999 || !Number.isSafeInteger(bytes) || bytes < 2 || bytes > 4194304 || !Number.isSafeInteger(max_read_bytes) || max_read_bytes < 1 || max_read_bytes > 67108864 || expected_fingerprint !== void 0 && (typeof expected_fingerprint !== "string" || !/^[a-f0-9]{64}$/.test(expected_fingerprint)))
@@ -2721,7 +2344,7 @@ var validateMeetingPassage = /* @__PURE__ */ __name((reference2, options) => {
2721
2344
  throw new CliError("validation_error", "choose a cue reference and json, text or markdown output");
2722
2345
  }, "validateMeetingPassage");
2723
2346
 
2724
- // 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/meetings/preparation-context.js
2347
+ // 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/meetings/preparation-context.js
2725
2348
  var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
2726
2349
  if (!original || typeof original !== "object" || Array.isArray(original))
2727
2350
  throw new CliError("validation_error", "meeting preparation context is required");
@@ -2746,8 +2369,8 @@ var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
2746
2369
  return { ...input, limit, maxReadBytes };
2747
2370
  }, "validateMeetingPreparationContext");
2748
2371
 
2749
- // 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/meetings/project-evidence-answer.js
2750
- var count4 = pipe(number(), integer(), minValue(0));
2372
+ // 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/meetings/project-evidence-answer.js
2373
+ var count3 = pipe(number(), integer(), minValue(0));
2751
2374
  var id = pipe(string(), minLength(1));
2752
2375
  var meetingProjectEvidence = strictObject({
2753
2376
  schema_version: literal(1),
@@ -2773,16 +2396,16 @@ var meetingProjectEvidence = strictObject({
2773
2396
  since: optional(isoTime),
2774
2397
  until: optional(isoTime)
2775
2398
  }),
2776
- limits: strictObject({ limit: count4, max_read_bytes: count4, max_vocabulary_read_bytes: count4, max_terms: count4 }),
2399
+ limits: strictObject({ limit: count3, max_read_bytes: count3, max_vocabulary_read_bytes: count3, max_terms: count3 }),
2777
2400
  page: pageSchema,
2778
2401
  coverage: strictObject({
2779
2402
  archive_completeness: literal("unknown"),
2780
2403
  current_revisions: literal(true),
2781
2404
  indexing: picklist(["ready", "pending"]),
2782
2405
  index_completeness: literal("unknown"),
2783
- term_index: count4,
2784
- terms_total: count4,
2785
- remaining_terms: count4,
2406
+ term_index: count3,
2407
+ terms_total: count3,
2408
+ remaining_terms: count3,
2786
2409
  duplicates: literal("may-repeat-between-terms")
2787
2410
  })
2788
2411
  });
@@ -2867,7 +2490,7 @@ var meetingProjectEvidenceAnswer = /* @__PURE__ */ __name((page, prepared, comma
2867
2490
  };
2868
2491
  }, "meetingProjectEvidenceAnswer");
2869
2492
 
2870
- // 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/meetings/search-validation.js
2493
+ // 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/meetings/search-validation.js
2871
2494
  var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
2872
2495
  const integer3 = /* @__PURE__ */ __name((value, low, high) => Number.isSafeInteger(value) && value >= low && value <= high, "integer");
2873
2496
  if (typeof query !== "string" || !query.trim() || query.includes("\0") || new TextEncoder().encode(query).byteLength > 65536 || !integer3(options.limit ?? 100, 1, 1e3) || !integer3(options.maxReadBytes ?? 4194304, 1, 67108864) || [
@@ -2887,7 +2510,7 @@ var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
2887
2510
  throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
2888
2511
  }, "validateMeetingHitSearch");
2889
2512
 
2890
- // 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/meetings/project-evidence-query.js
2513
+ // 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/meetings/project-evidence-query.js
2891
2514
  var ids = {
2892
2515
  meeting_id: "meetingId",
2893
2516
  identity_id: "participantIdentityId",
@@ -2978,7 +2601,7 @@ var prepareMeetingProjectEvidence = /* @__PURE__ */ __name((project2, request =
2978
2601
  return { project: project2.trim(), options, query: frozen.join(" AND ") };
2979
2602
  }, "prepareMeetingProjectEvidence");
2980
2603
 
2981
- // 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/meetings/project-evidence.js
2604
+ // 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/meetings/project-evidence.js
2982
2605
  var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project2, request = {}, now = Date.now()) => {
2983
2606
  const prepared = prepareMeetingProjectEvidence(project2, request, now);
2984
2607
  const page = await read(prepared.project, prepared.options);
@@ -2986,7 +2609,7 @@ var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project2, r
2986
2609
  return meetingProjectEvidenceAnswer(page, prepared);
2987
2610
  }, "readMeetingProjectEvidence");
2988
2611
 
2989
- // 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/meetings/pull.js
2612
+ // 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/meetings/pull.js
2990
2613
  var participantInput = /* @__PURE__ */ __name((p, provider, occurrenceId2, position, accountId) => {
2991
2614
  const { identityExternalId, ...fields } = p;
2992
2615
  const externalId = identityExternalId ?? (p.email ? `email:${p.email.toLowerCase()}` : p.externalId) ?? `name:${p.displayName ?? "unknown"}@${accountId}/${occurrenceId2}:${position}`;
@@ -3148,80 +2771,80 @@ unlinked`, format)],
3148
2771
  return report;
3149
2772
  }, "pull");
3150
2773
 
3151
- // 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/meetings/read-answers.js
3152
- var text4 = string();
3153
- var count5 = pipe(number(), integer(), minValue(0));
2774
+ // 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/meetings/read-answers.js
2775
+ var text3 = string();
2776
+ var count4 = pipe(number(), integer(), minValue(0));
3154
2777
  var id2 = pipe(number(), integer(), minValue(1));
3155
2778
  var iso3 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
3156
2779
  var meetingReview = strictObject({
3157
2780
  ref: reference,
3158
2781
  id: pipe(string(), minLength(1)),
3159
- title: nullable(text4),
2782
+ title: nullable(text3),
3160
2783
  started_at: nullable(isoTime),
3161
- duration_ms: nullable(count5),
3162
- participants_count: nullable(count5),
3163
- projects: array(text4),
2784
+ duration_ms: nullable(count4),
2785
+ participants_count: nullable(count4),
2786
+ projects: array(text3),
3164
2787
  /** Null when the meeting has no current transcript. */
3165
- transcript: nullable(strictObject({ lines: count5, words: count5 })),
2788
+ transcript: nullable(strictObject({ lines: count4, words: count4 })),
3166
2789
  /** The three who talked longest. */
3167
- speakers: array(strictObject({ name: nullable(text4), talk_ms: count5 })),
2790
+ speakers: array(strictObject({ name: nullable(text3), talk_ms: count4 })),
3168
2791
  /** The newest stored summary; null when there is none. */
3169
2792
  summary: nullable(strictObject({
3170
- source: text4,
3171
- title: nullable(text4),
3172
- overview: nullable(text4),
3173
- next_steps: array(text4),
3174
- url: nullable(text4)
2793
+ source: text3,
2794
+ title: nullable(text3),
2795
+ overview: nullable(text3),
2796
+ next_steps: array(text3),
2797
+ url: nullable(text3)
3175
2798
  }))
3176
2799
  });
3177
2800
  var meetingLink = strictObject({
3178
- url: text4,
3179
- domain: nullable(text4),
2801
+ url: text3,
2802
+ domain: nullable(text3),
3180
2803
  /** The Google Docs, Sheets, Slides, Forms or Drive file it names. */
3181
- document_id: nullable(text4),
3182
- count: count5,
2804
+ document_id: nullable(text3),
2805
+ count: count4,
3183
2806
  first_at: isoTime,
3184
2807
  last_at: isoTime,
3185
- senders: array(text4),
3186
- meetings: array(strictObject({ ref: reference, title: nullable(text4) }))
2808
+ senders: array(text3),
2809
+ meetings: array(strictObject({ ref: reference, title: nullable(text3) }))
3187
2810
  });
3188
2811
  var meetingSpeaker = strictObject({
3189
2812
  /** `person:<id>`, `identity:<id>`, `name:<lowercased name>` or `unknown`. */
3190
- key: text4,
3191
- name: nullable(text4),
2813
+ key: text3,
2814
+ name: nullable(text3),
3192
2815
  person_id: nullable(id2),
3193
2816
  identity_id: nullable(id2),
3194
- meetings: count5,
3195
- lines: count5,
3196
- words: count5,
3197
- talk_ms: count5,
2817
+ meetings: count4,
2818
+ lines: count4,
2819
+ words: count4,
2820
+ talk_ms: count4,
3198
2821
  /** This speaker's part of all talk time, 0–1. */
3199
2822
  share: pipe(number(), minValue(0), maxValue(1))
3200
2823
  });
3201
2824
  var meetingStats = strictObject({
3202
- time_zone: text4,
3203
- meetings: count5,
3204
- lines: count5,
3205
- words: count5,
3206
- talk_ms: count5,
2825
+ time_zone: text3,
2826
+ meetings: count4,
2827
+ lines: count4,
2828
+ words: count4,
2829
+ talk_ms: count4,
3207
2830
  /** `week_start` is the Monday, as a date in `time_zone`. */
3208
- weeks: array(strictObject({ week_start: text4, meetings: count5, talk_ms: count5 })),
2831
+ weeks: array(strictObject({ week_start: text3, meetings: count4, talk_ms: count4 })),
3209
2832
  top_speakers: array(meetingSpeaker)
3210
2833
  });
3211
2834
  var meetingCountsRow = strictObject({
3212
- key: text4,
3213
- name: nullable(text4),
3214
- meetings: count5,
3215
- minutes: count5,
2835
+ key: text3,
2836
+ name: nullable(text3),
2837
+ meetings: count4,
2838
+ minutes: count4,
3216
2839
  mean_minutes: nullable(number()),
3217
- transcripts: count5
2840
+ transcripts: count4
3218
2841
  });
3219
2842
  var meetingCounts = strictObject({
3220
2843
  by: picklist(["day", "week", "series"]),
3221
- meetings: count5,
3222
- minutes: count5,
2844
+ meetings: count4,
2845
+ minutes: count4,
3223
2846
  mean_minutes: nullable(number()),
3224
- transcripts: count5,
2847
+ transcripts: count4,
3225
2848
  rows: array(meetingCountsRow),
3226
2849
  has_more: boolean()
3227
2850
  });
@@ -3230,27 +2853,27 @@ var meetingParticipants = strictObject({
3230
2853
  schema_version: literal(1),
3231
2854
  kind: literal("meeting_participants"),
3232
2855
  account_id: id2,
3233
- query: text4,
2856
+ query: text3,
3234
2857
  items: array(strictObject({
3235
2858
  participant_id: id2,
3236
2859
  meeting_id: id2,
3237
2860
  identity_id: id2,
3238
- display_name: nullable(text4),
3239
- email: nullable(text4)
2861
+ display_name: nullable(text3),
2862
+ email: nullable(text3)
3240
2863
  })),
3241
2864
  /** Several identities on one page are observations, never speaker attribution or person links. */
3242
2865
  ambiguity: strictObject({ scope: literal("page"), multiple_identities: boolean(), identity_ids: array(id2) }),
3243
2866
  coverage: strictObject({
3244
- scanned: count5,
3245
- read_bytes: count5,
2867
+ scanned: count4,
2868
+ read_bytes: count4,
3246
2869
  archive_completeness: literal("unknown"),
3247
2870
  truncated_by: truncated("limit", "scan_limit", "read_bytes")
3248
2871
  }),
3249
2872
  page: strictObject({
3250
2873
  mode: literal("cursor"),
3251
- limit: count5,
2874
+ limit: count4,
3252
2875
  has_more: boolean(),
3253
- next_cursor: optional(text4)
2876
+ next_cursor: optional(text3)
3254
2877
  })
3255
2878
  });
3256
2879
  var revision = picklist(["current", "superseded"]);
@@ -3259,15 +2882,15 @@ var meetingPassage = strictObject({
3259
2882
  kind: literal("meeting_context"),
3260
2883
  source: reference,
3261
2884
  target_ref: reference,
3262
- target_fingerprint: text4,
3263
- fingerprint: text4,
2885
+ target_fingerprint: text3,
2886
+ fingerprint: text3,
3264
2887
  revision,
3265
- limits: strictObject({ before: count5, after: count5, bytes: count5, max_read_bytes: count5 }),
3266
- content_bytes: count5,
2888
+ limits: strictObject({ before: count4, after: count4, bytes: count4, max_read_bytes: count4 }),
2889
+ content_bytes: count4,
3267
2890
  coverage: strictObject({
3268
- included: count5,
3269
- before: count5,
3270
- after: count5,
2891
+ included: count4,
2892
+ before: count4,
2893
+ after: count4,
3271
2894
  has_before: boolean(),
3272
2895
  has_after: boolean(),
3273
2896
  truncated_by: truncated("bytes"),
@@ -3279,30 +2902,30 @@ var meetingPassage = strictObject({
3279
2902
  }),
3280
2903
  items: array(strictObject({
3281
2904
  ref: reference,
3282
- fingerprint: text4,
2905
+ fingerprint: text3,
3283
2906
  transcript_id: id2,
3284
- content_hash: nullable(text4),
3285
- position: count5,
3286
- start_ms: count5,
3287
- end_ms: count5,
2907
+ content_hash: nullable(text3),
2908
+ position: count4,
2909
+ start_ms: count4,
2910
+ end_ms: count4,
3288
2911
  speaker_participant_id: nullable(id2),
3289
- speaker_name: nullable(text4),
3290
- text: text4,
2912
+ speaker_name: nullable(text3),
2913
+ text: text3,
3291
2914
  revision
3292
2915
  }))
3293
2916
  });
3294
2917
  var event = strictObject({
3295
2918
  id: pipe(string(), minLength(1)),
3296
- event_series_id: nullable(text4),
3297
- title: nullable(text4),
3298
- description: nullable(text4),
3299
- location: nullable(text4),
2919
+ event_series_id: nullable(text3),
2920
+ title: nullable(text3),
2921
+ description: nullable(text3),
2922
+ location: nullable(text3),
3300
2923
  starts_at: nullable(isoTime),
3301
2924
  ends_at: nullable(isoTime),
3302
- timezone: nullable(text4),
2925
+ timezone: nullable(text3),
3303
2926
  /** `auto`: made from a meeting; `owner`: made by hand; `calendar`: from a calendar's entries. */
3304
2927
  origin: picklist(["auto", "owner", "calendar"]),
3305
- status: nullable(text4),
2928
+ status: nullable(text3),
3306
2929
  all_day: boolean(),
3307
2930
  /** When its calendar deleted it: shown as "deleted in Google", kept as history. */
3308
2931
  source_deleted_at: nullable(isoTime),
@@ -3310,7 +2933,7 @@ var event = strictObject({
3310
2933
  created_at: isoTime,
3311
2934
  updated_at: isoTime,
3312
2935
  /** The fields whoever sent the invitation wrote, on a calendar CLI's `events list`: an agent reads them as data. */
3313
- untrusted: optional(array(text4)),
2936
+ untrusted: optional(array(text3)),
3314
2937
  /** On a calendar CLI's `events list changed:<date>`: what changed since then, and when the store saw it. */
3315
2938
  change: optional(picklist(["new", "moved", "cancelled"])),
3316
2939
  changed_at: optional(nullable(isoTime)),
@@ -3322,7 +2945,7 @@ var event = strictObject({
3322
2945
  */
3323
2946
  overlapping: optional(boolean()),
3324
2947
  /** With `overlapping:true`: the events it overlaps, as `event:<id>`. */
3325
- overlaps: optional(array(text4))
2948
+ overlaps: optional(array(text3))
3326
2949
  });
3327
2950
  var eventItem = /* @__PURE__ */ __name((one) => ({
3328
2951
  id: String(one.id),
@@ -3342,10 +2965,10 @@ var eventItem = /* @__PURE__ */ __name((one) => ({
3342
2965
  updated_at: new Date(one.updatedAt).toISOString()
3343
2966
  }), "eventItem");
3344
2967
 
3345
- // 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/meetings/recording-transfer.js
2968
+ // 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/meetings/recording-transfer.js
3346
2969
  var strongRecordingValidator = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length <= 1024 && /^"[\x21\x23-\x7e\x80-\xff]*"$/.test(value), "strongRecordingValidator");
3347
2970
 
3348
- // 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/meetings/related-history.js
2971
+ // 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/meetings/related-history.js
3349
2972
  var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
3350
2973
  if (!original || typeof original !== "object" || Array.isArray(original))
3351
2974
  throw new CliError("validation_error", "related history request is required");
@@ -3375,68 +2998,202 @@ var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
3375
2998
  return { ...input, anchorIds: [...new Set(input.anchorIds)], limit, maxReadBytes };
3376
2999
  }, "validateMeetingRelatedHistory");
3377
3000
 
3378
- // 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/meetings/review.js
3379
- var REVIEW_LIMIT = { default: 50, most: 200 };
3380
-
3381
- // 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/meetings/save-hints.js
3382
- var SAVE_HELP = `Worth keeping \u2014 a decision, a promise, a preference? Record it with \`memo facts add\` or
3383
- \`memo memories add\`, citing the msg: locator or meeting: reference as --evidence.`;
3384
-
3385
- // 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/meetings/series-history.js
3386
- var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
3387
- input.signal?.throwIfAborted();
3388
- if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)
3389
- throw new CliError("validation_error", "accountId must be a positive safe integer");
3390
- if (typeof input.externalId !== "string" || !input.externalId.trim() || new TextEncoder().encode(input.externalId).length > 4096 || /[\0\r\n]/.test(input.externalId))
3391
- throw new CliError("validation_error", "externalId must be a bounded nonempty series identifier");
3392
- for (const name of ["after", "before"])
3393
- if (!Number.isSafeInteger(input[name]) || Math.abs(input[name]) > 864e13)
3394
- throw new CliError("validation_error", `${name} must be an absolute timestamp in milliseconds`);
3395
- if (input.after >= input.before)
3396
- throw new CliError("validation_error", "after must be earlier than before");
3397
- const limit = input.limit === void 0 ? 20 : input.limit;
3398
- if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
3399
- throw new CliError("validation_error", "limit must be an integer from 1 to 100");
3400
- const maxReadBytes = input.maxReadBytes === void 0 ? 256 * 1024 : input.maxReadBytes;
3401
- if (!Number.isSafeInteger(maxReadBytes) || maxReadBytes < 1 || maxReadBytes > 4 * 1024 * 1024)
3402
- throw new CliError("validation_error", "maxReadBytes must be an integer from 1 to 4194304");
3403
- return { ...input, limit, maxReadBytes };
3404
- }, "validateMeetingSeriesHistory");
3405
-
3406
- // 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/meetings/upcoming-validation.js
3407
- var invalid4 = /* @__PURE__ */ __name((field) => {
3408
- throw new CliError("invalid_response", `meeting occurrence ${field} is invalid`);
3409
- }, "invalid");
3410
- var occurrenceTime = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isSafeInteger(value) && Math.abs(value) <= 864e13, "occurrenceTime");
3411
- var occurrenceId = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim().length > 0 && value.length <= 1e3 && !/[\0\r\n]/.test(value), "occurrenceId");
3412
- var readOccurrenceSchedule = /* @__PURE__ */ __name((input, meetingId, limit, maxReadBytes) => {
3413
- if (!input || typeof input !== "object" || Array.isArray(input))
3414
- invalid4("schedule");
3415
- for (const key of Object.keys(input))
3416
- if (!["meetingId", "kind", "timezone", "occurrences", "complete", "missing"].includes(key))
3417
- invalid4(key);
3418
- if (input.meetingId !== meetingId)
3419
- invalid4("meetingId");
3420
- if (!["single", "recurring", "unscheduled", "unknown"].includes(input.kind))
3421
- invalid4("kind");
3422
- if (input.timezone !== null) {
3423
- if (typeof input.timezone !== "string" || input.timezone.length > 100)
3424
- invalid4("timezone");
3425
- try {
3426
- new Intl.DateTimeFormat("en", { timeZone: input.timezone }).format(0);
3427
- } catch {
3428
- invalid4("timezone");
3429
- }
3430
- }
3431
- if (typeof input.complete !== "boolean")
3432
- invalid4("complete");
3433
- if (!Array.isArray(input.missing) || input.missing.length > 2 || new Set(input.missing).size !== input.missing.length || input.missing.some((value) => !["schedule-details", "occurrence-details"].includes(value)) || input.complete && input.missing.length > 0)
3434
- invalid4("missing");
3435
- if (!Array.isArray(input.occurrences) || input.occurrences.length > limit)
3436
- invalid4("occurrences");
3437
- if (input.kind === "single" && input.occurrences.length > 1)
3438
- invalid4("single occurrence count");
3439
- const seen = /* @__PURE__ */ new Set();
3001
+ // 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/meetings/result-items.js
3002
+ var text4 = string();
3003
+ var identifier = pipe(text4, minLength(1));
3004
+ var nullableText = nullable(text4);
3005
+ var count5 = pipe(number(), integer(), minValue(0));
3006
+ var flag = boolean();
3007
+ var scope = strictObject({ provider: text4, account: text4 });
3008
+ var run = strictObject({
3009
+ meetings: count5,
3010
+ participants: count5,
3011
+ transcript_rows: count5,
3012
+ summaries: count5,
3013
+ warnings: array(strictObject({ external_id: text4, message: text4 })),
3014
+ timezone: optional(text4)
3015
+ });
3016
+ var exported = union([
3017
+ strictObject({ meeting_id: identifier, format: picklist(["markdown", "vtt"]), filename: text4, content: text4 }),
3018
+ strictObject({ meeting_id: identifier, format: picklist(["markdown", "vtt"]), output: text4 })
3019
+ ]);
3020
+ var eventChange = strictObject({
3021
+ action: literal("event.link"),
3022
+ event_id: nullable(identifier),
3023
+ expected_event_id: optional(nullable(identifier))
3024
+ });
3025
+ var personChange = strictObject({
3026
+ action: literal("person.link"),
3027
+ participant_id: identifier,
3028
+ person_uid: text4,
3029
+ expected_person_uid: optional(nullableText),
3030
+ target_account_ids: optional(array(identifier))
3031
+ });
3032
+ var eventResult = strictObject({
3033
+ meeting_id: identifier,
3034
+ event_id: nullable(identifier),
3035
+ previous_event_id: nullable(identifier),
3036
+ changed: flag
3037
+ });
3038
+ var personResult = strictObject({
3039
+ meeting_id: identifier,
3040
+ participant_id: identifier,
3041
+ person_uid: text4,
3042
+ previous_person_uid: nullableText,
3043
+ changed: flag,
3044
+ proposal: optional(text4)
3045
+ });
3046
+ var meetingChange = strictObject({
3047
+ scope,
3048
+ account_id: identifier,
3049
+ meeting_id: identifier,
3050
+ change: union([eventChange, personChange]),
3051
+ applied: flag,
3052
+ result: optional(union([eventResult, personResult]))
3053
+ });
3054
+ var recognition = strictObject({
3055
+ engine: text4,
3056
+ model: text4,
3057
+ version: optional(text4),
3058
+ timing: optional(picklist(["fixed-windows", "recognition-segments"]))
3059
+ });
3060
+ var transcription = union([
3061
+ strictObject({
3062
+ applied: literal(false),
3063
+ account_id: identifier,
3064
+ external_id: text4,
3065
+ segments: count5,
3066
+ media: strictObject({
3067
+ id: text4,
3068
+ content_hash: text4,
3069
+ size: count5,
3070
+ duration_ms: count5,
3071
+ format: text4,
3072
+ sample_rate: count5,
3073
+ channels: count5,
3074
+ recognition
3075
+ })
3076
+ }),
3077
+ strictObject({
3078
+ applied: literal(true),
3079
+ account_id: identifier,
3080
+ external_id: text4,
3081
+ meeting_id: identifier,
3082
+ created: flag,
3083
+ inserted_transcripts: count5,
3084
+ replayed_transcripts: count5,
3085
+ superseded_transcripts: count5,
3086
+ segments: count5,
3087
+ media_sha256: text4,
3088
+ engine: text4,
3089
+ model: text4,
3090
+ model_version: nullableText,
3091
+ timing: picklist(["fixed-windows", "recognition-segments"])
3092
+ })
3093
+ ]);
3094
+ var embeddingModel = strictObject({ key: text4, dims: count5, kind: picklist(["local", "remote"]), model: text4 });
3095
+ var embedding = union([
3096
+ strictObject({
3097
+ account_id: identifier,
3098
+ model: embeddingModel,
3099
+ status: strictObject({ chunks: count5, embedded: count5 }),
3100
+ applied: literal(false),
3101
+ scope: literal("existing-current-chunks"),
3102
+ rebuild_required: literal("explicit")
3103
+ }),
3104
+ strictObject({
3105
+ account_id: identifier,
3106
+ model: embeddingModel,
3107
+ saved: count5,
3108
+ skipped: count5,
3109
+ has_more: flag,
3110
+ next_hash: optional(text4),
3111
+ applied: literal(true),
3112
+ rebuild: strictObject({
3113
+ transcripts: count5,
3114
+ chunks: count5,
3115
+ has_more: flag,
3116
+ next_transcript_id: optional(identifier)
3117
+ })
3118
+ })
3119
+ ]);
3120
+ var repair = strictObject({
3121
+ account_id: identifier,
3122
+ applied: flag,
3123
+ transcripts: count5,
3124
+ languages: array(strictObject({ language: nullableText, transcripts: count5 }))
3125
+ });
3126
+ var MEETING_RESULT_ENTITIES = {
3127
+ meeting_ingestion: run,
3128
+ meeting_export: exported,
3129
+ meeting_association: meetingChange,
3130
+ meeting_transcription: transcription,
3131
+ meeting_embedding: embedding,
3132
+ meeting_repair: repair
3133
+ };
3134
+
3135
+ // 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/meetings/review.js
3136
+ var REVIEW_LIMIT = { default: 50, most: 200 };
3137
+
3138
+ // 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/meetings/save-hints.js
3139
+ var SAVE_HELP = `Worth keeping \u2014 a decision, a promise, a preference? Record it with \`memo facts add\` or
3140
+ \`memo memories add\`, citing the msg: locator or meeting: reference as --evidence.`;
3141
+
3142
+ // 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/meetings/series-history.js
3143
+ var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
3144
+ input.signal?.throwIfAborted();
3145
+ if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)
3146
+ throw new CliError("validation_error", "accountId must be a positive safe integer");
3147
+ if (typeof input.externalId !== "string" || !input.externalId.trim() || new TextEncoder().encode(input.externalId).length > 4096 || /[\0\r\n]/.test(input.externalId))
3148
+ throw new CliError("validation_error", "externalId must be a bounded nonempty series identifier");
3149
+ for (const name of ["after", "before"])
3150
+ if (!Number.isSafeInteger(input[name]) || Math.abs(input[name]) > 864e13)
3151
+ throw new CliError("validation_error", `${name} must be an absolute timestamp in milliseconds`);
3152
+ if (input.after >= input.before)
3153
+ throw new CliError("validation_error", "after must be earlier than before");
3154
+ const limit = input.limit === void 0 ? 20 : input.limit;
3155
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
3156
+ throw new CliError("validation_error", "limit must be an integer from 1 to 100");
3157
+ const maxReadBytes = input.maxReadBytes === void 0 ? 256 * 1024 : input.maxReadBytes;
3158
+ if (!Number.isSafeInteger(maxReadBytes) || maxReadBytes < 1 || maxReadBytes > 4 * 1024 * 1024)
3159
+ throw new CliError("validation_error", "maxReadBytes must be an integer from 1 to 4194304");
3160
+ return { ...input, limit, maxReadBytes };
3161
+ }, "validateMeetingSeriesHistory");
3162
+
3163
+ // 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/meetings/upcoming-validation.js
3164
+ var invalid4 = /* @__PURE__ */ __name((field) => {
3165
+ throw new CliError("invalid_response", `meeting occurrence ${field} is invalid`);
3166
+ }, "invalid");
3167
+ var occurrenceTime = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isSafeInteger(value) && Math.abs(value) <= 864e13, "occurrenceTime");
3168
+ var occurrenceId = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim().length > 0 && value.length <= 1e3 && !/[\0\r\n]/.test(value), "occurrenceId");
3169
+ var readOccurrenceSchedule = /* @__PURE__ */ __name((input, meetingId, limit, maxReadBytes) => {
3170
+ if (!input || typeof input !== "object" || Array.isArray(input))
3171
+ invalid4("schedule");
3172
+ for (const key of Object.keys(input))
3173
+ if (!["meetingId", "kind", "timezone", "occurrences", "complete", "missing"].includes(key))
3174
+ invalid4(key);
3175
+ if (input.meetingId !== meetingId)
3176
+ invalid4("meetingId");
3177
+ if (!["single", "recurring", "unscheduled", "unknown"].includes(input.kind))
3178
+ invalid4("kind");
3179
+ if (input.timezone !== null) {
3180
+ if (typeof input.timezone !== "string" || input.timezone.length > 100)
3181
+ invalid4("timezone");
3182
+ try {
3183
+ new Intl.DateTimeFormat("en", { timeZone: input.timezone }).format(0);
3184
+ } catch {
3185
+ invalid4("timezone");
3186
+ }
3187
+ }
3188
+ if (typeof input.complete !== "boolean")
3189
+ invalid4("complete");
3190
+ if (!Array.isArray(input.missing) || input.missing.length > 2 || new Set(input.missing).size !== input.missing.length || input.missing.some((value) => !["schedule-details", "occurrence-details"].includes(value)) || input.complete && input.missing.length > 0)
3191
+ invalid4("missing");
3192
+ if (!Array.isArray(input.occurrences) || input.occurrences.length > limit)
3193
+ invalid4("occurrences");
3194
+ if (input.kind === "single" && input.occurrences.length > 1)
3195
+ invalid4("single occurrence count");
3196
+ const seen = /* @__PURE__ */ new Set();
3440
3197
  const occurrences = input.occurrences.map((entry) => {
3441
3198
  if (!entry || typeof entry !== "object" || Array.isArray(entry))
3442
3199
  invalid4("entry");
@@ -3472,7 +3229,7 @@ var readOccurrenceSchedule = /* @__PURE__ */ __name((input, meetingId, limit, ma
3472
3229
  return result;
3473
3230
  }, "readOccurrenceSchedule");
3474
3231
 
3475
- // 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/meetings/series-inventory-validation.js
3232
+ // 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/meetings/series-inventory-validation.js
3476
3233
  function invalid5(field, response = false) {
3477
3234
  throw new CliError(response ? "invalid_response" : "validation_error", `invalid meeting inventory ${field}`);
3478
3235
  }
@@ -3501,7 +3258,7 @@ var validateMeetingSeriesInventoryCursor = /* @__PURE__ */ __name((value) => {
3501
3258
  cursorDetails(value);
3502
3259
  }, "validateMeetingSeriesInventoryCursor");
3503
3260
 
3504
- // 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/meetings/stats.js
3261
+ // 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/meetings/stats.js
3505
3262
  var MEETING_COUNTS_GROUPINGS = ["day", "week", "series"];
3506
3263
  var zoneOf = /* @__PURE__ */ __name((timeZone) => {
3507
3264
  const zone = timeZone ?? "UTC";
@@ -3514,13 +3271,13 @@ var zoneOf = /* @__PURE__ */ __name((timeZone) => {
3514
3271
  }, "zoneOf");
3515
3272
  var DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3516
3273
  var weekStart = /* @__PURE__ */ __name((at, format) => {
3517
- const parts = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3518
- const day = Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day));
3519
- return new Date(day - DAYS.indexOf(parts.weekday ?? "Mon") * 864e5).toISOString().slice(0, 10);
3274
+ const parts2 = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3275
+ const day2 = Date.UTC(Number(parts2.year), Number(parts2.month) - 1, Number(parts2.day));
3276
+ return new Date(day2 - DAYS.indexOf(parts2.weekday ?? "Mon") * 864e5).toISOString().slice(0, 10);
3520
3277
  }, "weekStart");
3521
3278
  var dayKey = /* @__PURE__ */ __name((at, format) => {
3522
- const parts = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3523
- return `${parts.year}-${parts.month}-${parts.day}`;
3279
+ const parts2 = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
3280
+ return `${parts2.year}-${parts2.month}-${parts2.day}`;
3524
3281
  }, "dayKey");
3525
3282
  var zoneFormat = /* @__PURE__ */ __name((zone) => new Intl.DateTimeFormat("en-US", {
3526
3283
  timeZone: zone,
@@ -3636,7 +3393,7 @@ var aggregateMeetingStats = /* @__PURE__ */ __name((rows, timeZone) => {
3636
3393
  };
3637
3394
  }, "aggregateMeetingStats");
3638
3395
 
3639
- // 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/meetings/upcoming.js
3396
+ // 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/meetings/upcoming.js
3640
3397
  var cancelled = /* @__PURE__ */ __name((signal) => {
3641
3398
  if (!signal?.aborted)
3642
3399
  return;
@@ -3651,62 +3408,900 @@ var createUpcomingMeetingReader = /* @__PURE__ */ __name((scope2, port) => {
3651
3408
  throw new CliError("configuration_error", "meeting occurrence reader is required");
3652
3409
  const read = port.read.bind(port);
3653
3410
  return {
3654
- scope: fixed,
3655
- async next(meetingId, request) {
3656
- if (!occurrenceId(meetingId))
3657
- throw new CliError("validation_error", "meetingId must be a bounded identifier");
3658
- if (!request || typeof request !== "object" || Array.isArray(request))
3659
- throw new CliError("validation_error", "meeting occurrence request is required");
3660
- for (const key of Object.keys(request))
3661
- if (!["after", "until", "limit", "maxReadBytes", "signal"].includes(key))
3662
- throw new CliError("validation_error", `unknown meeting occurrence field: ${key}`);
3663
- const { after, until, signal } = request;
3664
- if (signal !== void 0 && !(signal instanceof AbortSignal))
3665
- throw new CliError("validation_error", "signal must be an AbortSignal");
3666
- if (!occurrenceTime(after) || !occurrenceTime(until) || after >= until)
3667
- throw new CliError("validation_error", "after and until must form an increasing absolute millisecond window");
3668
- const limit = request.limit ?? 100;
3669
- const maxReadBytes = request.maxReadBytes ?? 1048576;
3670
- if (!Number.isSafeInteger(limit) || limit < 1 || limit > 1e3)
3671
- throw new CliError("validation_error", "limit must be an integer from 1 to 1000");
3672
- if (!Number.isSafeInteger(maxReadBytes) || maxReadBytes < 1 || maxReadBytes > 4194304)
3673
- throw new CliError("validation_error", "maxReadBytes must be an integer from 1 to 4194304");
3674
- cancelled(signal);
3675
- const context3 = Object.freeze({ scope: fixed, after, until, limit, maxReadBytes, ...signal ? { signal } : {} });
3676
- const raw = await read(meetingId, context3);
3677
- cancelled(signal);
3678
- const schedule = readOccurrenceSchedule(raw, meetingId, limit, maxReadBytes);
3679
- const active = schedule.occurrences.filter((entry) => entry.status !== "cancelled");
3680
- const eligible = active.filter((entry) => entry.startAt !== null && entry.startAt >= after && entry.startAt < until);
3681
- eligible.sort((a, b) => a.startAt - b.startAt || ((a.id ?? "") < (b.id ?? "") ? -1 : 1));
3682
- const candidate = eligible[0] ?? null;
3683
- const undated = active.filter((entry) => entry.startAt === null).length;
3684
- const unverified = active.filter((entry) => !entry.verified).length;
3685
- const simultaneous = candidate === null ? 0 : eligible.filter((entry) => entry.startAt === candidate.startAt).length;
3686
- return {
3687
- scope: fixed,
3688
- meetingId,
3689
- kind: schedule.kind,
3690
- after,
3691
- until,
3692
- timezone: schedule.timezone,
3693
- candidate,
3694
- verifiedNext: Boolean(candidate?.verified && schedule.complete && unverified === 0 && simultaneous === 1),
3695
- coverage: {
3696
- scheduleComplete: schedule.complete,
3697
- inspected: schedule.occurrences.length,
3698
- undated,
3699
- unverified,
3700
- cancelled: schedule.occurrences.length - active.length,
3701
- simultaneous,
3702
- missing: schedule.missing
3703
- }
3704
- };
3705
- }
3411
+ scope: fixed,
3412
+ async next(meetingId, request) {
3413
+ if (!occurrenceId(meetingId))
3414
+ throw new CliError("validation_error", "meetingId must be a bounded identifier");
3415
+ if (!request || typeof request !== "object" || Array.isArray(request))
3416
+ throw new CliError("validation_error", "meeting occurrence request is required");
3417
+ for (const key of Object.keys(request))
3418
+ if (!["after", "until", "limit", "maxReadBytes", "signal"].includes(key))
3419
+ throw new CliError("validation_error", `unknown meeting occurrence field: ${key}`);
3420
+ const { after, until, signal } = request;
3421
+ if (signal !== void 0 && !(signal instanceof AbortSignal))
3422
+ throw new CliError("validation_error", "signal must be an AbortSignal");
3423
+ if (!occurrenceTime(after) || !occurrenceTime(until) || after >= until)
3424
+ throw new CliError("validation_error", "after and until must form an increasing absolute millisecond window");
3425
+ const limit = request.limit ?? 100;
3426
+ const maxReadBytes = request.maxReadBytes ?? 1048576;
3427
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 1e3)
3428
+ throw new CliError("validation_error", "limit must be an integer from 1 to 1000");
3429
+ if (!Number.isSafeInteger(maxReadBytes) || maxReadBytes < 1 || maxReadBytes > 4194304)
3430
+ throw new CliError("validation_error", "maxReadBytes must be an integer from 1 to 4194304");
3431
+ cancelled(signal);
3432
+ const context3 = Object.freeze({ scope: fixed, after, until, limit, maxReadBytes, ...signal ? { signal } : {} });
3433
+ const raw = await read(meetingId, context3);
3434
+ cancelled(signal);
3435
+ const schedule = readOccurrenceSchedule(raw, meetingId, limit, maxReadBytes);
3436
+ const active = schedule.occurrences.filter((entry) => entry.status !== "cancelled");
3437
+ const eligible = active.filter((entry) => entry.startAt !== null && entry.startAt >= after && entry.startAt < until);
3438
+ eligible.sort((a, b) => a.startAt - b.startAt || ((a.id ?? "") < (b.id ?? "") ? -1 : 1));
3439
+ const candidate = eligible[0] ?? null;
3440
+ const undated = active.filter((entry) => entry.startAt === null).length;
3441
+ const unverified = active.filter((entry) => !entry.verified).length;
3442
+ const simultaneous = candidate === null ? 0 : eligible.filter((entry) => entry.startAt === candidate.startAt).length;
3443
+ return {
3444
+ scope: fixed,
3445
+ meetingId,
3446
+ kind: schedule.kind,
3447
+ after,
3448
+ until,
3449
+ timezone: schedule.timezone,
3450
+ candidate,
3451
+ verifiedNext: Boolean(candidate?.verified && schedule.complete && unverified === 0 && simultaneous === 1),
3452
+ coverage: {
3453
+ scheduleComplete: schedule.complete,
3454
+ inspected: schedule.occurrences.length,
3455
+ undated,
3456
+ unverified,
3457
+ cancelled: schedule.occurrences.length - active.length,
3458
+ simultaneous,
3459
+ missing: schedule.missing
3460
+ }
3461
+ };
3462
+ }
3463
+ };
3464
+ }, "createUpcomingMeetingReader");
3465
+
3466
+ // 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/domain/locator.js
3467
+ var SCHEME = "msg:";
3468
+ var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat, message }) => SCHEME + [provider, account, chat, message].map(encodeURIComponent).join("/"), "formatLocator");
3469
+ var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
3470
+ var parseLocator = /* @__PURE__ */ __name((reference2) => {
3471
+ const trimmed = reference2.trim();
3472
+ const parts2 = trimmed.startsWith(SCHEME) ? trimmed.slice(SCHEME.length).split("/") : [];
3473
+ if (parts2.length !== 4 || parts2.some((part) => part === "")) {
3474
+ throw new CliError("validation_error", `"${singleLine(reference2)}" is not a message locator \u2014 expected msg:<provider>/<account>/<chat>/<message>`);
3475
+ }
3476
+ const [provider, account, chat, message] = parts2.map(decodeURIComponent);
3477
+ return { provider, account, chat, message };
3478
+ }, "parseLocator");
3479
+
3480
+ // 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/domain/references.js
3481
+ var SIMPLE_REFERENCES = [
3482
+ "note",
3483
+ "document",
3484
+ "person",
3485
+ "organization",
3486
+ "project",
3487
+ "task",
3488
+ "memory",
3489
+ "fact",
3490
+ "bot",
3491
+ "event",
3492
+ "invoice",
3493
+ "payment",
3494
+ "order",
3495
+ "deal",
3496
+ "lead",
3497
+ "pipeline",
3498
+ "product",
3499
+ "contract",
3500
+ "subscription",
3501
+ "wallet",
3502
+ "transaction",
3503
+ "entity"
3504
+ ];
3505
+ var malformed = /* @__PURE__ */ __name((text6, shape) => new CliError("validation_error", `"${singleLine(text6)}" is not a reference \u2014 expected ${shape}`, {
3506
+ reason: "ref.malformed"
3507
+ }), "malformed");
3508
+ var parts = /* @__PURE__ */ __name((rest, count7, text6, shape) => {
3509
+ const split = rest.split("/");
3510
+ if (split.length !== count7 || split.some((part) => part === ""))
3511
+ throw malformed(text6, shape);
3512
+ return split.map(decodeURIComponent);
3513
+ }, "parts");
3514
+ var encoded = /* @__PURE__ */ __name((...values) => values.map(encodeURIComponent).join("/"), "encoded");
3515
+ var folderPath = /* @__PURE__ */ __name((path) => {
3516
+ const clean = path.split("/").filter((part) => part !== "" && part !== ".").join("/");
3517
+ return clean === "" ? path.trim() === "" ? "" : null : clean;
3518
+ }, "folderPath");
3519
+ var MEETING_SHAPE = "meeting:<account>/<meeting>[/<transcript>[/<cue>]] with safe integer ids";
3520
+ var kind = /* @__PURE__ */ __name((spec) => spec, "kind");
3521
+ var simple = /* @__PURE__ */ __name((prefix) => kind({
3522
+ prefix,
3523
+ type: prefix,
3524
+ shape: `${prefix}:<id>`,
3525
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3526
+ if (!rest.trim())
3527
+ throw new CliError("validation_error", `"${singleLine(text6)}" names no ${prefix}`, {
3528
+ reason: "ref.malformed"
3529
+ });
3530
+ return { type: prefix, id: rest };
3531
+ }, "parse"),
3532
+ format: /* @__PURE__ */ __name((reference2) => `${reference2.type}:${reference2.id}`, "format")
3533
+ }), "simple");
3534
+ var REF_KINDS = [
3535
+ kind({
3536
+ prefix: "msg",
3537
+ type: "message",
3538
+ shape: "msg:<provider>/<account>/<chat>/<message>",
3539
+ parse: /* @__PURE__ */ __name((_, text6) => {
3540
+ try {
3541
+ return { type: "message", ...parseLocator(text6) };
3542
+ } catch {
3543
+ throw malformed(text6, "msg:<provider>/<account>/<chat>/<message>");
3544
+ }
3545
+ }, "parse"),
3546
+ format: formatLocator
3547
+ }),
3548
+ kind({
3549
+ prefix: "chat",
3550
+ type: "chat",
3551
+ shape: "chat:<provider>/<account>/<chat>",
3552
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3553
+ const [provider, account, chat] = parts(rest, 3, text6, "chat:<provider>/<account>/<chat>");
3554
+ return { type: "chat", provider, account, chat };
3555
+ }, "parse"),
3556
+ format: /* @__PURE__ */ __name(({ provider, account, chat }) => `chat:${encoded(provider, account, chat)}`, "format")
3557
+ }),
3558
+ kind({
3559
+ prefix: "contact",
3560
+ type: "contact",
3561
+ shape: "contact:<provider>/<id>",
3562
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3563
+ const [provider, id4] = parts(rest, 2, text6, "contact:<provider>/<id>");
3564
+ return { type: "contact", provider, id: id4 };
3565
+ }, "parse"),
3566
+ format: /* @__PURE__ */ __name(({ provider, id: id4 }) => `contact:${encoded(provider, id4)}`, "format")
3567
+ }),
3568
+ kind({
3569
+ prefix: "folder",
3570
+ type: "folder",
3571
+ shape: "folder:<id>[/<path>]",
3572
+ parse: /* @__PURE__ */ __name((rest, text6) => {
3573
+ const slash = rest.indexOf("/");
3574
+ const id4 = decodeURIComponent(slash < 0 ? rest : rest.slice(0, slash));
3575
+ const path = slash < 0 ? null : folderPath(decodeURIComponent(rest.slice(slash + 1)));
3576
+ if (!id4.trim() || path === "")
3577
+ throw malformed(text6, "folder:<id>[/<path>]");
3578
+ return { type: "folder", id: id4, path };
3579
+ }, "parse"),
3580
+ format: /* @__PURE__ */ __name(({ id: id4, path }) => path === null ? `folder:${encodeURIComponent(id4)}` : `folder:${encoded(id4, path)}`, "format")
3581
+ }),
3582
+ kind({
3583
+ prefix: "meeting",
3584
+ type: "meeting",
3585
+ shape: MEETING_SHAPE,
3586
+ parse: /* @__PURE__ */ __name((_, text6) => {
3587
+ try {
3588
+ return parseMeetingReference(text6);
3589
+ } catch {
3590
+ throw malformed(text6, MEETING_SHAPE);
3591
+ }
3592
+ }, "parse"),
3593
+ format: formatMeetingReference
3594
+ }),
3595
+ ...SIMPLE_REFERENCES.map(simple)
3596
+ ];
3597
+ var byPrefix = new Map(REF_KINDS.map((spec) => [spec.prefix, spec]));
3598
+ var byType = new Map(REF_KINDS.map((spec) => [spec.type, spec]));
3599
+ var offered = REF_KINDS.map(({ prefix }) => prefix).filter((prefix) => prefix !== "entity");
3600
+ var distance = /* @__PURE__ */ __name((a, b) => {
3601
+ let row = Array.from({ length: b.length + 1 }, (_, at) => at);
3602
+ for (const [i, x] of [...a].entries()) {
3603
+ const next = [i + 1];
3604
+ for (const [j, y] of [...b].entries())
3605
+ next.push(Math.min(row[j + 1] + 1, next[j] + 1, row[j] + (x === y ? 0 : 1)));
3606
+ row = next;
3607
+ }
3608
+ return row[b.length];
3609
+ }, "distance");
3610
+ var nearest = /* @__PURE__ */ __name((typed) => offered.find((prefix) => typed.length >= 2 && prefix.startsWith(typed)) ?? offered.map((prefix) => ({ prefix, far: distance(typed, prefix) })).filter(({ far }) => far <= 2).sort((a, b) => a.far - b.far)[0]?.prefix, "nearest");
3611
+ var unknownKind = /* @__PURE__ */ __name((text6, prefix, rest) => {
3612
+ const near2 = prefix === "" ? void 0 : nearest(prefix);
3613
+ const kinds = offered.map((one) => `${one}:`).join(", ");
3614
+ const hint = near2 === void 0 ? `; kinds: ${kinds}` : `; did you mean ${near2}:${singleLine(rest)}? Kinds: ${kinds}`;
3615
+ return new CliError("validation_error", `"${singleLine(text6)}" is no kind of reference${hint}`, {
3616
+ reason: "ref.unknown-kind"
3617
+ });
3618
+ }, "unknownKind");
3619
+ var formatReference = /* @__PURE__ */ __name((reference2) => byType.get(reference2.type).format(reference2), "formatReference");
3620
+ var parseReference = /* @__PURE__ */ __name((text6) => {
3621
+ const reference2 = text6.trim();
3622
+ const colon = reference2.indexOf(":");
3623
+ const prefix = colon < 0 ? "" : reference2.slice(0, colon);
3624
+ const rest = reference2.slice(colon + 1);
3625
+ const spec = byPrefix.get(prefix);
3626
+ if (!spec)
3627
+ throw unknownKind(reference2, prefix, rest);
3628
+ return spec.parse(rest, reference2);
3629
+ }, "parseReference");
3630
+ var canonicalReference = /* @__PURE__ */ __name((text6) => formatReference(parseReference(text6)), "canonicalReference");
3631
+ var looksLikeReference = /* @__PURE__ */ __name((text6) => {
3632
+ const match = /^([a-z]+):\S+$/.exec(text6.trim());
3633
+ return match !== null && byPrefix.has(match[1]);
3634
+ }, "looksLikeReference");
3635
+
3636
+ // 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/domain/money.js
3637
+ var CURRENCY_SCALES = {
3638
+ AED: 2,
3639
+ AMD: 2,
3640
+ AUD: 2,
3641
+ BHD: 3,
3642
+ BYN: 2,
3643
+ CAD: 2,
3644
+ CHF: 2,
3645
+ CLP: 0,
3646
+ CNY: 2,
3647
+ CZK: 2,
3648
+ DKK: 2,
3649
+ EUR: 2,
3650
+ GBP: 2,
3651
+ GEL: 2,
3652
+ HUF: 2,
3653
+ ILS: 2,
3654
+ INR: 2,
3655
+ ISK: 0,
3656
+ JPY: 0,
3657
+ KGS: 2,
3658
+ KRW: 0,
3659
+ KWD: 3,
3660
+ KZT: 2,
3661
+ NOK: 2,
3662
+ PLN: 2,
3663
+ RSD: 2,
3664
+ RUB: 2,
3665
+ SEK: 2,
3666
+ THB: 2,
3667
+ TRY: 2,
3668
+ UAH: 2,
3669
+ USD: 2,
3670
+ UZS: 2,
3671
+ VND: 0
3672
+ };
3673
+ var refuse = /* @__PURE__ */ __name((message, reason) => {
3674
+ throw new CliError("validation_error", message, { reason });
3675
+ }, "refuse");
3676
+ var DECIMAL = /^(\d{1,15})(?:\.(\d+))?$/;
3677
+ var parseDecimal = /* @__PURE__ */ __name((text6, scale) => {
3678
+ const match = DECIMAL.exec(text6.trim());
3679
+ if (!match || (match[2] ?? "").length > scale)
3680
+ return void 0;
3681
+ return BigInt(`${match[1]}${(match[2] ?? "").padEnd(scale, "0")}`);
3682
+ }, "parseDecimal");
3683
+ var formatDecimal = /* @__PURE__ */ __name((units, scale) => {
3684
+ const value = BigInt(units);
3685
+ if (value < 0n)
3686
+ return `-${formatDecimal(-value, scale)}`;
3687
+ const digits = value.toString().padStart(scale + 1, "0");
3688
+ return scale === 0 ? digits : `${digits.slice(0, -scale)}.${digits.slice(-scale)}`;
3689
+ }, "formatDecimal");
3690
+ var groupDigits = /* @__PURE__ */ __name((decimal) => {
3691
+ const [whole = "0", fraction] = decimal.split(".");
3692
+ const grouped2 = whole.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
3693
+ return fraction === void 0 ? grouped2 : `${grouped2}.${fraction}`;
3694
+ }, "groupDigits");
3695
+ var currencyOf = /* @__PURE__ */ __name((text6) => {
3696
+ const code = typeof text6 === "string" ? text6.trim().toUpperCase() : "";
3697
+ if (CURRENCY_SCALES[code] === void 0)
3698
+ return refuse(`${typeof text6 === "string" && text6.trim() ? text6.trim() : "an empty currency"} is not a currency the store keeps; use one of ${Object.keys(CURRENCY_SCALES).join(", ")}`, "money.currency");
3699
+ return code;
3700
+ }, "currencyOf");
3701
+ var scaleOf = /* @__PURE__ */ __name((currency) => CURRENCY_SCALES[currencyOf(currency)], "scaleOf");
3702
+ var minorUnits = /* @__PURE__ */ __name((amount, currency, what = "an amount") => {
3703
+ const scale = scaleOf(currency);
3704
+ const units = typeof amount === "string" ? parseDecimal(amount, scale) : void 0;
3705
+ if (units === void 0 || units > BigInt(Number.MAX_SAFE_INTEGER))
3706
+ return refuse(`${what} is a decimal string with at most ${scale} decimal${scale === 1 ? "" : "s"} for ${currency}, such as "${formatDecimal(5e3 * 10 ** scale, scale)}"`, "money.amount");
3707
+ return Number(units);
3708
+ }, "minorUnits");
3709
+ var signedMinorUnits = /* @__PURE__ */ __name((amount, currency, what = "an amount") => {
3710
+ if (typeof amount !== "string" || !amount.trim().startsWith("-"))
3711
+ return minorUnits(amount, currency, what);
3712
+ const units = minorUnits(amount.trim().slice(1), currency, what);
3713
+ return units === 0 ? 0 : -units;
3714
+ }, "signedMinorUnits");
3715
+ var moneyOf = /* @__PURE__ */ __name((units, currency) => ({
3716
+ amount: formatDecimal(units, scaleOf(currency)),
3717
+ currency
3718
+ }), "moneyOf");
3719
+ var moneyLabel = /* @__PURE__ */ __name((units, currency) => `${groupDigits(formatDecimal(units, scaleOf(currency)))} ${currency}`, "moneyLabel");
3720
+ var QUANTITY_SCALE = 3;
3721
+ var quantityOf = /* @__PURE__ */ __name((text6) => {
3722
+ const thousandths = typeof text6 === "string" ? parseDecimal(text6, QUANTITY_SCALE) : void 0;
3723
+ if (thousandths === void 0 || thousandths === 0n)
3724
+ return refuse('a quantity is a decimal string above 0 with at most 3 decimals, such as "1.5"', "money.quantity");
3725
+ const plain = formatDecimal(thousandths, QUANTITY_SCALE).replace(/\.?0+$/, "");
3726
+ return { text: plain, thousandths };
3727
+ }, "quantityOf");
3728
+ var lineUnits = /* @__PURE__ */ __name((thousandths, unitPrice) => Number((thousandths * BigInt(unitPrice) + 500n) / 1000n), "lineUnits");
3729
+
3730
+ // 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/domain/finance.js
3731
+ var INVOICE_DIRECTIONS = ["receivable", "payable"];
3732
+ var INVOICE_STATUSES = ["draft", "issued", "partly_paid", "paid", "void"];
3733
+ var MONEY_DIRECTIONS = ["in", "out"];
3734
+ var FINANCE_REVIEWS = ["proposed", "confirmed", "rejected"];
3735
+ var settledStatus = /* @__PURE__ */ __name((current, total, paid) => {
3736
+ if (current === "draft" || current === "void")
3737
+ return current;
3738
+ if (paid <= 0)
3739
+ return "issued";
3740
+ return paid < total ? "partly_paid" : "paid";
3741
+ }, "settledStatus");
3742
+ var dayMonth = /* @__PURE__ */ __name((date) => date === null ? null : `${date.slice(8, 10)}.${date.slice(5, 7)}`, "dayMonth");
3743
+ var notes = /* @__PURE__ */ __name((...words2) => {
3744
+ const kept = words2.filter((word) => word !== null);
3745
+ return kept.length === 0 ? "" : ` (${kept.join(", ")})`;
3746
+ }, "notes");
3747
+ var invoiceLine = /* @__PURE__ */ __name((invoice) => {
3748
+ const party = invoice.counterpartyName === null ? "" : `${invoice.direction === "receivable" ? " to" : " from"} ${invoice.counterpartyName}`;
3749
+ const due = invoice.dueDate === null ? "" : `, due ${dayMonth(invoice.dueDate)}`;
3750
+ return `${invoice.number ?? `#${invoice.id}`} \xB7 ${moneyLabel(invoice.total, invoice.currency)}${party}${due}` + notes(invoice.status.replace("_", " "), invoice.review === "confirmed" ? null : invoice.review);
3751
+ }, "invoiceLine");
3752
+ var paymentLine = /* @__PURE__ */ __name((payment) => {
3753
+ const party = payment.partyName === null ? "" : `${payment.direction === "in" ? " from" : " to"} ${payment.partyName}`;
3754
+ return `${moneyLabel(payment.amount, payment.currency)}${party}, ${dayMonth(payment.date)}` + notes(payment.review === "confirmed" ? null : payment.review);
3755
+ }, "paymentLine");
3756
+ var invoiceTitle = /* @__PURE__ */ __name((invoice) => `Invoice ${invoiceLine(invoice)}`, "invoiceTitle");
3757
+ var paymentEntryTitle = /* @__PURE__ */ __name((payment) => `Payment \xB7 ${paymentLine(payment)}`, "paymentEntryTitle");
3758
+
3759
+ // 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/domain/business.js
3760
+ var CATALOG_KINDS = ["product", "service"];
3761
+ var BUSINESS_KINDS = ["invoice", "payment", "order", "contract", "subscription", "product", "wallet"];
3762
+ var CONTRACT_KINDS = ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
3763
+ var CONTRACT_STATUSES = ["draft", "active", "ended", "terminated"];
3764
+ var SUBSCRIPTION_STATUSES = ["trial", "active", "paused", "cancelled", "ended"];
3765
+ var WALLET_KINDS = ["bank", "card", "cash", "wallet", "other"];
3766
+ var TRANSACTION_STATUSES = ["pending", "booked"];
3767
+ var ORDER_DIRECTIONS = ["purchase", "sale"];
3768
+ var intervalOf = /* @__PURE__ */ __name((text6, reason = "subscription.interval") => {
3769
+ const match = typeof text6 === "string" ? /^(?:([1-9]\d{0,2})-)?(day|week|month|year)$/.exec(text6.trim()) : null;
3770
+ if (!match)
3771
+ throw new CliError("validation_error", "an interval is a count and a unit, such as 1-month or 2-week", { reason });
3772
+ return { count: match[1] === void 0 ? 1 : Number(match[1]), unit: match[2] };
3773
+ }, "intervalOf");
3774
+ var intervalText = /* @__PURE__ */ __name(({ count: count7, unit }) => `${count7}-${unit}`, "intervalText");
3775
+ var priced = /* @__PURE__ */ __name((units, currency) => units === null || currency === null ? "" : `, ${moneyLabel(units, currency)}`, "priced");
3776
+ var pending = /* @__PURE__ */ __name((review) => review === "confirmed" ? null : review, "pending");
3777
+ var productLine = /* @__PURE__ */ __name((product) => {
3778
+ const price = product.unitPrice === null || product.currency === null ? "" : moneyLabel(product.unitPrice, product.currency);
3779
+ const per = price && product.unit !== null ? ` per ${product.unit}` : "";
3780
+ return `${product.name}${price ? ` \xB7 ${price}${per}` : ""}${notes(product.kind, product.archived ? "archived" : null)}`;
3781
+ }, "productLine");
3782
+ var contractLine = /* @__PURE__ */ __name((contract) => `${contract.number ?? `#${contract.id}`} \xB7 ${contract.name}${priced(contract.value, contract.currency)}` + notes(contract.status, pending(contract.review)), "contractLine");
3783
+ var subscriptionLine = /* @__PURE__ */ __name((subscription) => `${subscription.name}${priced(subscription.price, subscription.currency)} every ${intervalText(subscription.interval)}` + notes(subscription.status, pending(subscription.review)), "subscriptionLine");
3784
+ var walletLine = /* @__PURE__ */ __name((wallet) => `${wallet.name} \xB7 ${wallet.kind}, ${wallet.currency}${wallet.numberHint === null ? "" : `, \u2026${wallet.numberHint}`}` + notes(wallet.closed ? "closed" : null), "walletLine");
3785
+ var transactionLine = /* @__PURE__ */ __name((transaction) => `${moneyLabel(transaction.amount, transaction.currency)} ${transaction.direction}${transaction.label === null ? "" : ` \xB7 ${transaction.label}`}, ${dayMonth(transaction.date)}` + notes(transaction.status === "pending" ? "pending" : null, pending(transaction.review)), "transactionLine");
3786
+
3787
+ // 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/store/marks.js
3788
+ import { readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
3789
+ var damageMarkPath = /* @__PURE__ */ __name((store) => `${store}.damaged.json`, "damageMarkPath");
3790
+ var healthMarkPath = /* @__PURE__ */ __name((store) => `${store}.health.json`, "healthMarkPath");
3791
+ var journalMarkPath = /* @__PURE__ */ __name((store) => `${store}.journal.json`, "journalMarkPath");
3792
+ var inodeOf = /* @__PURE__ */ __name((store) => statSync(store, { throwIfNoEntry: false })?.ino, "inodeOf");
3793
+ var readJson = /* @__PURE__ */ __name((path) => {
3794
+ try {
3795
+ return JSON.parse(readFileSync(path, "utf8"));
3796
+ } catch (error) {
3797
+ if (error.code === "ENOENT")
3798
+ return null;
3799
+ throw error;
3800
+ }
3801
+ }, "readJson");
3802
+ var ownerStoreInTests = /* @__PURE__ */ __name((store) => {
3803
+ try {
3804
+ refuseOwnerStoreInTests(store);
3805
+ return false;
3806
+ } catch {
3807
+ return true;
3808
+ }
3809
+ }, "ownerStoreInTests");
3810
+ var sqliteFailure = /* @__PURE__ */ __name((error) => isCliFailure(error) && error.details?.reason === "store.damaged" ? error.cause : error, "sqliteFailure");
3811
+ var markStoreDamaged = /* @__PURE__ */ __name((error, { store, command, version, runId, now = Date.now }) => {
3812
+ const failure = sqliteFailure(error);
3813
+ if (!isStoreDamage(failure) || ownerStoreInTests(store))
3814
+ return false;
3815
+ const inode = inodeOf(store);
3816
+ if (inode === void 0)
3817
+ return false;
3818
+ const mark = {
3819
+ at: new Date(now()).toISOString(),
3820
+ command,
3821
+ ...version ? { cli_version: version } : {},
3822
+ ...runId ? { run_id: runId } : {},
3823
+ error: failure.message.slice(0, 500),
3824
+ inode
3825
+ };
3826
+ try {
3827
+ writeFileSync(damageMarkPath(store), `${JSON.stringify(mark, null, 2)}
3828
+ `, { flag: "wx", mode: 384 });
3829
+ return true;
3830
+ } catch {
3831
+ return false;
3832
+ }
3833
+ }, "markStoreDamaged");
3834
+ var readDamageMark = /* @__PURE__ */ __name((store) => {
3835
+ const path = damageMarkPath(store);
3836
+ let mark;
3837
+ try {
3838
+ mark = readJson(path);
3839
+ } catch {
3840
+ return { at: "unknown", command: "unknown", error: `${path} cannot be read`, inode: inodeOf(store) ?? 0 };
3841
+ }
3842
+ if (mark === null)
3843
+ return null;
3844
+ if (mark.inode !== inodeOf(store)) {
3845
+ clearDamageMark(store);
3846
+ return null;
3847
+ }
3848
+ return mark;
3849
+ }, "readDamageMark");
3850
+ var clearDamageMark = /* @__PURE__ */ __name((store) => rmSync(damageMarkPath(store), { force: true }), "clearDamageMark");
3851
+ var refuseDamagedStore = /* @__PURE__ */ __name((store, cli) => {
3852
+ const mark = readDamageMark(store);
3853
+ if (!mark)
3854
+ return;
3855
+ throw new CliError("configuration_error", `the store was found damaged at ${mark.at} by \`${mark.command}\` (${mark.error}), so nothing writes to it until it is recovered; \`${cli ?? "<cli>"} store recover\` says what is damaged and what to do`, { reason: "store.damaged" });
3856
+ }, "refuseDamagedStore");
3857
+ var markJournalLost = /* @__PURE__ */ __name((store, { seen, command, now = Date.now }) => {
3858
+ if (ownerStoreInTests(store))
3859
+ return;
3860
+ const mark = { at: new Date(now()).toISOString(), command, seen };
3861
+ try {
3862
+ writeFileSync(journalMarkPath(store), `${JSON.stringify(mark, null, 2)}
3863
+ `, { flag: "wx", mode: 384 });
3864
+ } catch {
3865
+ }
3866
+ }, "markJournalLost");
3867
+ var readJournalMark = /* @__PURE__ */ __name((store) => {
3868
+ try {
3869
+ return readJson(journalMarkPath(store));
3870
+ } catch {
3871
+ return null;
3872
+ }
3873
+ }, "readJournalMark");
3874
+ var readHealthMark = /* @__PURE__ */ __name((store) => {
3875
+ try {
3876
+ return readJson(healthMarkPath(store));
3877
+ } catch {
3878
+ return null;
3879
+ }
3880
+ }, "readHealthMark");
3881
+ var recordDeepCheck = /* @__PURE__ */ __name((store, health, { cli, version, schema, now = Date.now }) => {
3882
+ const previous = readHealthMark(store);
3883
+ if (ownerStoreInTests(store))
3884
+ return { previous, cleared: null };
3885
+ const checkedAt = new Date(now()).toISOString();
3886
+ const mark = {
3887
+ checked_at: checkedAt,
3888
+ ok: health.ok,
3889
+ problems: health.problems ?? 0,
3890
+ schema,
3891
+ cli,
3892
+ ...version ? { cli_version: version } : {},
3893
+ last_ok_at: health.ok ? checkedAt : previous?.last_ok_at ?? null
3894
+ };
3895
+ const cleared = health.ok ? readDamageMark(store) : null;
3896
+ try {
3897
+ writeFileSync(healthMarkPath(store), `${JSON.stringify(mark, null, 2)}
3898
+ `, { mode: 384 });
3899
+ } catch {
3900
+ }
3901
+ if (cleared)
3902
+ clearDamageMark(store);
3903
+ if (health.ok)
3904
+ rmSync(journalMarkPath(store), { force: true });
3905
+ return { previous, cleared };
3906
+ }, "recordDeepCheck");
3907
+
3908
+ // 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/domain/providers.js
3909
+ var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
3910
+ var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
3911
+ var PROVIDERS = [
3912
+ { name: "telegram", kind: "messages", aliases: ["tg"], command: "tg", opens: MESSENGER_OPENS },
3913
+ { name: "telegram-bot", kind: "messages", aliases: ["tg-bot"] },
3914
+ { name: "max", kind: "messages", aliases: [], command: "max", opens: MESSENGER_OPENS },
3915
+ { name: "max-bot", kind: "messages", aliases: [] },
3916
+ { name: "whatsapp", kind: "messages", aliases: ["wa"], command: "wa", opens: MESSENGER_OPENS },
3917
+ { name: "whatsapp-bot", kind: "messages", aliases: ["wa-bot"] },
3918
+ { name: "email", kind: "mail", aliases: [] },
3919
+ { name: "notes", kind: "notes", aliases: [] },
3920
+ { name: "local", kind: "notes", aliases: [] },
3921
+ { name: "obsidian", kind: "notes", aliases: [] },
3922
+ { name: "added", kind: "notes", aliases: [] },
3923
+ { name: "zoom", kind: "meetings", aliases: [] },
3924
+ // A phone export's records: its SMS and its calls in the one account the import names.
3925
+ { name: "phone", kind: "messages", kinds: ["messages", "events"], aliases: [], imported: true }
3926
+ ];
3927
+ var LABELS = {
3928
+ telegram: "Telegram",
3929
+ "telegram-bot": "Telegram bot",
3930
+ max: "MAX",
3931
+ "max-bot": "MAX bot",
3932
+ whatsapp: "WhatsApp",
3933
+ "whatsapp-bot": "WhatsApp bot",
3934
+ "google-drive": "Google Drive",
3935
+ added: "added by hand",
3936
+ email: "mail"
3937
+ };
3938
+ var providerLabel = /* @__PURE__ */ __name((provider) => LABELS[provider] ?? provider, "providerLabel");
3939
+ var FOLDER_PROVIDERS = ["local", "obsidian", "folder"];
3940
+ var isFolderProvider = /* @__PURE__ */ __name((provider) => FOLDER_PROVIDERS.includes(provider), "isFolderProvider");
3941
+ var folderProviderSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${FOLDER_PROVIDERS.map((name) => `'${name}'`).join(", ")})`, "folderProviderSql");
3942
+ var folderProviderOf = /* @__PURE__ */ __name((format) => format === "markdown" ? "local" : "obsidian", "folderProviderOf");
3943
+ var DOCUMENT_ACCOUNT_PROVIDERS = ["google-drive"];
3944
+ var isDocumentAccountProvider = /* @__PURE__ */ __name((provider) => DOCUMENT_ACCOUNT_PROVIDERS.includes(provider), "isDocumentAccountProvider");
3945
+ var ADDED_PROVIDER = "added";
3946
+ var ADDED_ACCOUNT = "owner";
3947
+ var notAdded = `d.account_id NOT IN (SELECT id FROM accounts WHERE provider = '${ADDED_PROVIDER}')`;
3948
+ var filesAccountSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...DOCUMENT_ACCOUNT_PROVIDERS, ADDED_PROVIDER].map((name) => `'${name}'`).join(", ")})`, "filesAccountSql");
3949
+ var INTERNAL_NOTES = "internal";
3950
+ var UNKNOWN_PROVIDER = "unknown provider \u2014 run its CLI once";
3951
+ var WORD = /^[a-z0-9][a-z0-9_-]*$/;
3952
+ var invalid6 = /* @__PURE__ */ __name((message) => {
3953
+ throw new CliError("validation_error", message);
3954
+ }, "invalid");
3955
+ var wordOf = /* @__PURE__ */ __name((value, what) => typeof value === "string" && WORD.test(value) ? value : invalid6(`${what} is lowercase letters, digits, - and _ \u2014 not ${JSON.stringify(value)}`), "wordOf");
3956
+ var OPEN_KINDS = new Set(REF_KINDS.map(({ type }) => type).filter((type) => type !== "entity"));
3957
+ var COMMAND_WORDS = /^[a-z0-9][a-z0-9_-]*( [a-z0-9][a-z0-9_-]*)*$/;
3958
+ var opensOf = /* @__PURE__ */ __name((value, named) => {
3959
+ if (typeof value !== "object" || value === null || Array.isArray(value))
3960
+ return invalid6(`provider ${named}'s opens maps a kind of reference to a command`);
3961
+ const known = Object.entries(value).filter(([kind2]) => OPEN_KINDS.has(kind2));
3962
+ for (const [kind2, command] of known)
3963
+ if (typeof command !== "string" || !COMMAND_WORDS.test(command))
3964
+ invalid6(`provider ${named} opens a ${kind2} with command words, not ${JSON.stringify(command)}`);
3965
+ return Object.fromEntries(known);
3966
+ }, "opensOf");
3967
+ var providerEntryOf = /* @__PURE__ */ __name((value) => {
3968
+ if (typeof value !== "object" || value === null || Array.isArray(value))
3969
+ return invalid6("a provider entry is an object");
3970
+ const { name, kind: kind2, kinds, aliases = [], command, opens, imported } = value;
3971
+ const named = wordOf(name, "a provider's name");
3972
+ const isKindWord = /* @__PURE__ */ __name((one) => typeof one === "string" && KINDS.includes(one), "isKindWord");
3973
+ const given = kinds === void 0 ? [kind2] : Array.isArray(kinds) && kinds.length > 0 ? kinds : [void 0];
3974
+ for (const one of given)
3975
+ if (!isKindWord(one))
3976
+ invalid6(`provider ${named}'s kind is one of ${KINDS.join(", ")} \u2014 not ${JSON.stringify(one)}`);
3977
+ const list = [...new Set(given)];
3978
+ if (kind2 !== void 0 && kind2 !== list[0])
3979
+ invalid6(`provider ${named}'s kind is the first of its kinds`);
3980
+ if (!Array.isArray(aliases))
3981
+ invalid6(`provider ${named}'s aliases are a list`);
3982
+ if (imported !== void 0 && typeof imported !== "boolean")
3983
+ invalid6(`provider ${named}'s imported is true or false`);
3984
+ return {
3985
+ name: named,
3986
+ kind: list[0],
3987
+ ...list.length > 1 ? { kinds: list } : {},
3988
+ ...imported === true ? { imported: true } : {},
3989
+ aliases: [...new Set(aliases.map((alias) => wordOf(alias, `an alias of ${named}`)))],
3990
+ ...command === void 0 ? {} : { command: wordOf(command, `the command of ${named}`) },
3991
+ ...opens === void 0 ? {} : { opens: opensOf(opens, named) }
3706
3992
  };
3707
- }, "createUpcomingMeetingReader");
3993
+ }, "providerEntryOf");
3994
+ var kindsOfEntry = /* @__PURE__ */ __name((entry) => entry.kinds ?? [entry.kind], "kindsOfEntry");
3995
+ var describe = /* @__PURE__ */ __name((entry) => `${entry.name} (${kindsOfEntry(entry).join(", ")}${entry.command ? `, from ${entry.command}` : ""})`, "describe");
3996
+ var unitedKinds = /* @__PURE__ */ __name((known, entry) => [
3997
+ .../* @__PURE__ */ new Set([...known, ...entry])
3998
+ ], "unitedKinds");
3999
+ var wordsOf2 = /* @__PURE__ */ __name(({ name, aliases }) => [name, ...aliases], "wordsOf");
4000
+ var joined = /* @__PURE__ */ __name((known, entry) => {
4001
+ const same = known.find(({ name }) => name === entry.name);
4002
+ const kinds = same ? unitedKinds(kindsOfEntry(same), kindsOfEntry(entry)) : kindsOfEntry(entry);
4003
+ if (same && same.kind !== entry.kind)
4004
+ invalid6(`two provider entries disagree on the kind: ${describe(same)} and ${describe(entry)}`);
4005
+ if (same && entry.imported === true && same.imported !== true)
4006
+ invalid6(`provider ${entry.name} is synced, so an entry cannot make it import-only`);
4007
+ const merged = same ? {
4008
+ ...same,
4009
+ ...kinds.length > 1 ? { kinds } : {},
4010
+ aliases: [.../* @__PURE__ */ new Set([...same.aliases, ...entry.aliases])],
4011
+ ...entry.command ? { command: entry.command } : {},
4012
+ ...entry.opens ? { opens: { ...same.opens, ...entry.opens } } : {}
4013
+ } : entry;
4014
+ const others = known.filter((one) => one !== same);
4015
+ for (const word of wordsOf2(merged)) {
4016
+ const owner = others.find((one) => wordsOf2(one).includes(word));
4017
+ if (owner)
4018
+ invalid6(`"${word}" names two providers: ${describe(owner)} and ${describe(merged)}`);
4019
+ }
4020
+ return same ? known.map((one) => one === same ? merged : one) : [...known, merged];
4021
+ }, "joined");
4022
+ var registry = PROVIDERS;
4023
+ var providers = /* @__PURE__ */ __name(() => registry, "providers");
4024
+ var useStoredProviders = /* @__PURE__ */ __name((entries) => {
4025
+ const left = [];
4026
+ registry = entries.reduce((known, entry) => {
4027
+ try {
4028
+ return joined(known, providerEntryOf(entry));
4029
+ } catch (error) {
4030
+ if (!(error instanceof CliError))
4031
+ throw error;
4032
+ left.push(entry);
4033
+ return known;
4034
+ }
4035
+ }, PROVIDERS);
4036
+ return left;
4037
+ }, "useStoredProviders");
4038
+ var addProvider = /* @__PURE__ */ __name((entry) => {
4039
+ registry = joined(registry, providerEntryOf(entry));
4040
+ }, "addProvider");
4041
+ var isKind = /* @__PURE__ */ __name((word) => KINDS.includes(word.toLowerCase()), "isKind");
4042
+ var providerNamed = /* @__PURE__ */ __name((word) => {
4043
+ const wanted = word.toLowerCase();
4044
+ return registry.find((entry) => wordsOf2(entry).includes(wanted));
4045
+ }, "providerNamed");
4046
+ var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
4047
+ var kindsIn = /* @__PURE__ */ __name((provider) => {
4048
+ if (isFolderProvider(provider))
4049
+ return ["notes"];
4050
+ const entry = registry.find(({ name }) => name === provider);
4051
+ return entry ? kindsOfEntry(entry) : [];
4052
+ }, "kindsIn");
4053
+ var importedOf = /* @__PURE__ */ __name((entry, held) => {
4054
+ const builtIn = PROVIDERS.find(({ name }) => name === entry.name);
4055
+ if (builtIn) {
4056
+ if (entry.imported === true && builtIn.imported !== true)
4057
+ invalid6(`provider ${entry.name} is synced, so an entry cannot make it import-only`);
4058
+ return builtIn.imported === true;
4059
+ }
4060
+ if (held === void 0)
4061
+ return entry.imported === true;
4062
+ if (entry.imported === true && held.imported !== true)
4063
+ invalid6(`provider ${entry.name} was registered without imported: an entry cannot make it import-only later`);
4064
+ return held.imported === true;
4065
+ }, "importedOf");
4066
+ var isImportedProvider = /* @__PURE__ */ __name((provider) => registry.find(({ name }) => name === provider)?.imported === true, "isImportedProvider");
4067
+ var holdsKind = /* @__PURE__ */ __name((provider, kind2) => kindsIn(provider).includes(kind2), "holdsKind");
4068
+ var holdsKindOf = /* @__PURE__ */ __name((provider, kind2) => kindIn(provider) === void 0 ? kind2 === "messages" : holdsKind(provider, kind2), "holdsKindOf");
4069
+ var kindOf2 = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
4070
+
4071
+ // 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/search/query.js
4072
+ var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
4073
+ var inSource = /* @__PURE__ */ __name((source, provider) => source === "all" || source === "bots" && isBotProvider(provider) || source === "personal" && !isBotProvider(provider) || source === provider || providerNamed(source)?.name === provider || isKind(source) && holdsKindOf(provider, source), "inSource");
4074
+ var fail = /* @__PURE__ */ __name((message) => {
4075
+ throw new CliError("validation_error", message);
4076
+ }, "fail");
4077
+ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
4078
+ const sources = [...providers2, "personal", "bots", "all"];
4079
+ const source = value.toLowerCase();
4080
+ if (sources.includes(source))
4081
+ return source;
4082
+ if (source === "mail")
4083
+ return "email";
4084
+ if (source === "messages")
4085
+ return source;
4086
+ if (isKind(source))
4087
+ fail(`${name}${source} names ${source}, which a message search does not read \u2014 search ${source === "meetings" || source === "events" ? `all --source ${source}` : "notes"} does`);
4088
+ const named = providerNamed(source);
4089
+ if (named && providers2.includes(named.name))
4090
+ return named.name;
4091
+ return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
4092
+ }, "sourceOf");
4093
+
4094
+ // 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/search/account-list.js
4095
+ var ACCOUNT_GROUPS = "accountGroups";
4096
+ var ACCOUNT_GROUPS_SETTING = "account_groups";
4097
+ var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
4098
+ var fail2 = /* @__PURE__ */ __name((message) => {
4099
+ throw new CliError("validation_error", message);
4100
+ }, "fail");
4101
+ var isAccountList = /* @__PURE__ */ __name((value) => value.includes(",") || value.includes(":"), "isAccountList");
4102
+ var itemsOf = /* @__PURE__ */ __name((value) => {
4103
+ const items = value.split(",").map((item) => item.trim());
4104
+ if (items.some((item) => item === ""))
4105
+ fail2(`"${value}" has an empty entry \u2014 separate accounts with one comma`);
4106
+ return items;
4107
+ }, "itemsOf");
4108
+ var isGroupName = /* @__PURE__ */ __name((name) => GROUP_NAME.test(name), "isGroupName");
4109
+ var groupName = /* @__PURE__ */ __name((name) => isGroupName(name) ? name : fail2(`a group name is letters, digits, - and _ \u2014 not "${name}"`), "groupName");
4110
+ var groupMembers = /* @__PURE__ */ __name((value) => itemsOf(value).map((item) => item.toLowerCase().startsWith("group:") ? fail2(`a group lists accounts, not other groups \u2014 "${item}"`) : item.includes(":") && item.split(":")[1] === "" ? fail2(`"${item}" names no account after the colon`) : item), "groupMembers");
4111
+ var describe2 = /* @__PURE__ */ __name((accounts) => accounts.map(({ provider, account, name }) => `${provider}:${account}${name ? ` (${name})` : ""}`).join(", "), "describe");
4112
+ var listedHolds = /* @__PURE__ */ __name((account, kind2) => (account.kinds ?? (account.kind === void 0 ? [] : [account.kind])).includes(kind2), "listedHolds");
4113
+ var kindHere = /* @__PURE__ */ __name((provider, running) => provider === running.provider ? kindOf2(provider) : kindIn(provider), "kindHere");
4114
+ var kindsOfHere = /* @__PURE__ */ __name((provider, running) => {
4115
+ const kinds = kindsIn(provider);
4116
+ return { kind: kindHere(provider, running), ...kinds.length > 1 ? { kinds } : {} };
4117
+ }, "kindsOfHere");
4118
+ var heldOf = /* @__PURE__ */ __name((stored, running) => [
4119
+ ...stored.filter(({ provider }) => kindIn(provider) !== "notes" && !isDocumentAccountProvider(provider)).map(({ provider, account, name }) => ({ provider, account, name, ...kindsOfHere(provider, running) })),
4120
+ { provider: "notes", account: INTERNAL_NOTES, name: null, kind: "notes" },
4121
+ ...stored.filter(({ provider }) => isFolderProvider(provider)).map(({ id: id4, name, provider, account }) => ({
4122
+ provider: "notes",
4123
+ account: String(id4),
4124
+ name,
4125
+ kind: "notes",
4126
+ stored: { provider, account }
4127
+ })),
4128
+ ...stored.filter(({ provider }) => isDocumentAccountProvider(provider) || provider === ADDED_PROVIDER).map(({ id: id4, provider, account, name }) => ({
4129
+ provider: "notes",
4130
+ account: String(id4),
4131
+ name,
4132
+ kind: "notes",
4133
+ stored: { provider, account }
4134
+ }))
4135
+ ], "heldOf");
4136
+ var storedAs = /* @__PURE__ */ __name((held, key) => held.filter(({ stored }) => stored?.provider === key.provider && (key.account === "" || stored.account === key.account)), "storedAs");
4137
+ var registry2 = /* @__PURE__ */ __name(() => providers().map(({ name, aliases }) => aliases.length ? `${name} (${aliases.join(", ")})` : name).join(", "), "registry");
4138
+ var providerOf = /* @__PURE__ */ __name((prefix, held, { running, profiles }) => {
4139
+ const wanted = prefix.toLowerCase();
4140
+ if (wanted === running.command?.toLowerCase())
4141
+ return running.provider;
4142
+ const providers2 = [...new Set(held.map(({ provider }) => provider))];
4143
+ if (providers2.includes(wanted) || isDocumentAccountProvider(wanted))
4144
+ return wanted;
4145
+ const named = providerNamed(wanted);
4146
+ if (named)
4147
+ return named.name;
4148
+ const recorded = Object.values(profiles[wanted] ?? {})[0];
4149
+ if (recorded)
4150
+ return recorded.provider;
4151
+ return fail2(`${prefix} is not a provider \u2014 they are ${registry2()}; the store holds ${providers2.join(", ")}`);
4152
+ }, "providerOf");
4153
+ var profilesOf = /* @__PURE__ */ __name((provider, profiles) => Object.values(profiles).flatMap((named) => Object.entries(named).filter(([, key]) => key.provider === provider)), "profilesOf");
4154
+ var accountOf = /* @__PURE__ */ __name((prefix, ref, held, context3) => {
4155
+ const provider = providerOf(prefix, held, context3);
4156
+ if (isDocumentAccountProvider(provider) && !context3.profiles[prefix.toLowerCase()]?.[ref]) {
4157
+ const stored = storedAs(held, { provider, account: ref })[0];
4158
+ if (stored)
4159
+ return stored;
4160
+ }
4161
+ const folder = isFolderProvider(provider);
4162
+ const ofProvider = folder ? storedAs(held, { provider, account: "" }) : held.filter((one) => one.provider === provider);
4163
+ const byId = ofProvider.find(({ account, stored }) => account === ref || account === ref.toLowerCase() || folder && stored?.account === ref.toUpperCase());
4164
+ if (byId)
4165
+ return byId;
4166
+ const keyed = /* @__PURE__ */ __name((key) => ofProvider.find(({ account }) => account === key.account) ?? {
4167
+ ...key,
4168
+ name: null,
4169
+ ...kindsOfHere(key.provider, context3.running)
4170
+ }, "keyed");
4171
+ const recorded = context3.profiles[prefix.toLowerCase()]?.[ref];
4172
+ if (recorded && isFolderProvider(recorded.provider)) {
4173
+ const folder2 = held.find((one) => one.provider === "notes" && one.name === recorded.account);
4174
+ if (folder2)
4175
+ return folder2;
4176
+ return fail2(`no stored folder for ${prefix}:${ref}; sync that profile first`);
4177
+ }
4178
+ if (recorded && isDocumentAccountProvider(recorded.provider)) {
4179
+ const account = storedAs(held, recorded)[0];
4180
+ if (account)
4181
+ return account;
4182
+ return fail2(`no stored documents for ${prefix}:${ref}; sync that profile first`);
4183
+ }
4184
+ if (recorded)
4185
+ return keyed(recorded);
4186
+ const byProfile = [
4187
+ ...new Map(profilesOf(provider, context3.profiles).filter(([name]) => name === ref).map(([, key]) => [key.account, key])).values()
4188
+ ];
4189
+ if (byProfile.length === 1)
4190
+ return keyed(byProfile[0]);
4191
+ const byName = ofProvider.filter(({ name }) => name?.toLowerCase() === ref.toLowerCase());
4192
+ if (byName.length === 1)
4193
+ return byName[0];
4194
+ if (byName.length > 1 || byProfile.length > 1)
4195
+ fail2(`${provider}:${ref} names more than one account \u2014 use the id: ${describe2(ofProvider)}`);
4196
+ const names = profilesOf(provider, context3.profiles).map(([name]) => name);
4197
+ return fail2(`no ${provider} account "${ref}" \u2014 the store holds ${describe2(ofProvider) || "none"}` + (names.length ? `; profiles: ${[...new Set(names)].join(", ")}` : ""));
4198
+ }, "accountOf");
4199
+ var accountsOfWord = /* @__PURE__ */ __name((word, held, context3) => {
4200
+ const wanted = word.toLowerCase();
4201
+ if (wanted === "all")
4202
+ return [...held];
4203
+ if (wanted === "personal" || wanted === "bots")
4204
+ return held.filter((one) => listedHolds(one, "messages") && isBotProvider(one.provider) === (wanted === "bots"));
4205
+ if (isKind(wanted))
4206
+ return held.filter((one) => listedHolds(one, wanted));
4207
+ const recorded = context3.profiles[wanted];
4208
+ if (recorded && Object.values(recorded).every((key) => isFolderProvider(key.provider) || isDocumentAccountProvider(key.provider)))
4209
+ return Object.keys(recorded).map((profile) => accountOf(word, profile, held, context3));
4210
+ const provider = providerOf(word, held, context3);
4211
+ if (isDocumentAccountProvider(provider) || isFolderProvider(provider))
4212
+ return storedAs(held, { provider, account: "" });
4213
+ return held.filter((one) => one.provider === provider);
4214
+ }, "accountsOfWord");
4215
+ var keyOf = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
4216
+ var sourceOf2 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "sourceOf");
4217
+ var sameAs = /* @__PURE__ */ __name((key) => (one) => one.provider === key.provider && one.account === key.account, "sameAs");
4218
+ var entriesOfList = /* @__PURE__ */ __name((value, context3) => {
4219
+ const held = heldOf(context3.held, context3.running);
4220
+ const entries = [];
4221
+ const entry = /* @__PURE__ */ __name((item, group) => {
4222
+ const colon = item.indexOf(":");
4223
+ if (colon === -1) {
4224
+ try {
4225
+ entries.push({ entry: item, accounts: accountsOfWord(item, held, context3) });
4226
+ } catch (error) {
4227
+ if (!group || !(error instanceof CliError))
4228
+ throw error;
4229
+ fail2(`"${item}" in group ${group}: ${error.message}`);
4230
+ }
4231
+ return;
4232
+ }
4233
+ const prefix = item.slice(0, colon);
4234
+ const ref = item.slice(colon + 1).trim();
4235
+ if (ref === "")
4236
+ fail2(`"${item}" names no account after the colon`);
4237
+ if (prefix.toLowerCase() === "group") {
4238
+ if (group)
4239
+ fail2(`group ${group} lists another group \u2014 a group lists accounts`);
4240
+ const members = context3.groups[ref];
4241
+ if (!members) {
4242
+ const known = Object.keys(context3.groups);
4243
+ fail2(`no account group "${ref}" \u2014 ${known.length ? `there are ${known.join(", ")}` : "none saved yet"}; \`config set ${ACCOUNT_GROUPS_SETTING}.${ref} <accounts>\` saves one`);
4244
+ }
4245
+ for (const member of members)
4246
+ entry(member, ref);
4247
+ return;
4248
+ }
4249
+ entries.push({ entry: item, accounts: [accountOf(prefix, ref, held, context3)] });
4250
+ }, "entry");
4251
+ for (const item of itemsOf(value))
4252
+ entry(item);
4253
+ const { only } = context3;
4254
+ return entries.map(({ entry: entry2, accounts }) => ({
4255
+ entry: entry2,
4256
+ accounts: accounts.filter((one) => only === void 0 || only.has(keyOf(one))).map(({ provider, account, kind: kind2, kinds }) => ({
4257
+ provider,
4258
+ account,
4259
+ kind: kind2,
4260
+ ...kinds === void 0 ? {} : { kinds }
4261
+ }))
4262
+ }));
4263
+ }, "entriesOfList");
4264
+ var accountsOfList = /* @__PURE__ */ __name((value, context3) => {
4265
+ const chosen = /* @__PURE__ */ new Map();
4266
+ for (const { accounts } of entriesOfList(value, context3))
4267
+ for (const one of accounts)
4268
+ if (!chosen.has(keyOf(one)))
4269
+ chosen.set(keyOf(one), one);
4270
+ return [...chosen.values()];
4271
+ }, "accountsOfList");
4272
+ var READS = {
4273
+ messages: "messenger messages \u2014 search messages reads them",
4274
+ mail: "a mailbox \u2014 memo search mail reads it",
4275
+ notes: "notes \u2014 search notes reads them",
4276
+ documents: "documents \u2014 search notes reads them",
4277
+ meetings: "meetings \u2014 search all reads them",
4278
+ events: "calendar events \u2014 no search reads them yet",
4279
+ crm: "CRM deals and leads \u2014 search all reads them"
4280
+ };
4281
+ var fitting = /* @__PURE__ */ __name((entries, kinds, what, reasonOf = (kind2) => READS[kind2], alsoFits = () => false) => {
4282
+ const chosen = /* @__PURE__ */ new Map();
4283
+ const skipped = [];
4284
+ for (const { entry, accounts } of entries) {
4285
+ const fits = accounts.filter((one) => kinds.some((kind2) => listedHolds(one, kind2)) || alsoFits(one));
4286
+ for (const { provider, account } of fits)
4287
+ if (!chosen.has(keyOf({ provider, account })))
4288
+ chosen.set(keyOf({ provider, account }), { provider, account });
4289
+ const known = accounts.filter(({ kind: kind2 }) => kind2 !== void 0);
4290
+ const unknown2 = accounts.filter((one) => one.kind === void 0 && !alsoFits(one));
4291
+ if (known.length)
4292
+ for (const { provider, account } of unknown2)
4293
+ skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
4294
+ if (fits.length)
4295
+ continue;
4296
+ const other = known[0];
4297
+ skipped.push(other?.kind ? { source: entry, code: "validation_error", reason: reasonOf(other.kind) } : unknown2.length ? { source: entry, code: "not_found", reason: UNKNOWN_PROVIDER } : { source: entry, code: "not_found", reason: "no account in the store" });
4298
+ }
4299
+ if (chosen.size === 0)
4300
+ fail2(`--source names nothing ${what} reads: ${skipped.map(({ source, reason }) => `${source} (${reason})`).join(", ")}`);
4301
+ return { accounts: [...chosen.values()], skipped };
4302
+ }, "fitting");
3708
4303
 
3709
- // 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/domain/deals.js
4304
+ // 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/domain/deals.js
3710
4305
  var DEAL_KINDS = ["deal", "lead"];
3711
4306
  var DEAL_STATUSES = ["open", "won", "lost"];
3712
4307
  var STAGE_OUTCOMES = DEAL_STATUSES;
@@ -3716,24 +4311,519 @@ var dealLine = /* @__PURE__ */ __name((deal) => {
3716
4311
  return `${deal.title} \xB7 ${deal.stage}${money}${deal.status === "open" ? "" : ` (${deal.status})`}`;
3717
4312
  }, "dealLine");
3718
4313
 
3719
- // 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/domain/orders.js
4314
+ // 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/domain/orders.js
3720
4315
  var ORDER_STATUSES = ["placed", "shipped", "delivered", "cancelled", "returned"];
3721
4316
  var ORDER_PURPOSES = ["personal", "business", "client", "other"];
3722
4317
  var orderLine = /* @__PURE__ */ __name((order) => {
4318
+ const party = order.direction === "sale" && order.customerName !== null ? `to ${order.customerName}` : order.supplierName;
3723
4319
  const money = order.total === null || order.currency === null ? "" : `, ${moneyLabel(order.total, order.currency)}`;
3724
4320
  const notes2 = [order.status, order.review === "confirmed" ? null : order.review].filter(Boolean).join(", ");
3725
- return `${order.number ?? `#${order.id}`} \xB7 ${order.supplierName}${money} (${notes2})`;
4321
+ return `${order.number ?? `#${order.id}`} \xB7 ${party}${money} (${notes2})`;
3726
4322
  }, "orderLine");
3727
4323
  var orderTitle = /* @__PURE__ */ __name((order) => `Order ${orderLine(order)}`, "orderTitle");
3728
4324
 
3729
- // 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/store/source-review.js
4325
+ // 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/store/source-review.js
3730
4326
  var SOURCE_REVIEW_KIND = "memory_source_review";
3731
4327
  var SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
3732
4328
  var ERASED_TEXT = "[source erased]";
3733
4329
  var severity = /* @__PURE__ */ __name((cause) => SOURCE_REVIEW_CAUSES.indexOf(cause), "severity");
3734
4330
  var graver = /* @__PURE__ */ __name((a, b) => severity(b) > severity(a) ? b : a, "graver");
3735
4331
 
3736
- // 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/domain/relations.js
4332
+ // 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/runs/log-keys.js
4333
+ var snake = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
4334
+ var camel = /* @__PURE__ */ __name((key) => key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase()), "camel");
4335
+ var renamed = /* @__PURE__ */ __name((record2, name) => Object.fromEntries(Object.entries(record2).map(([key, value]) => [name(key), value])), "renamed");
4336
+ var logAttributes = /* @__PURE__ */ __name((event2) => renamed(event2, snake), "logAttributes");
4337
+ var fromLogAttributes = /* @__PURE__ */ __name((attributes) => renamed(attributes, camel), "fromLogAttributes");
4338
+ var snakeLogger = /* @__PURE__ */ __name((logger) => ({
4339
+ debug: /* @__PURE__ */ __name((event2, message) => logger.debug(logAttributes(event2), message), "debug"),
4340
+ info: /* @__PURE__ */ __name((event2, message) => logger.info(logAttributes(event2), message), "info"),
4341
+ warn: /* @__PURE__ */ __name((event2, message) => logger.warn(logAttributes(event2), message), "warn"),
4342
+ error: /* @__PURE__ */ __name((event2, message) => logger.error(logAttributes(event2), message), "error")
4343
+ }), "snakeLogger");
4344
+
4345
+ // 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/runs/log-attributes.js
4346
+ var diagnostic = {
4347
+ event: true,
4348
+ operation: true,
4349
+ opcode: true,
4350
+ seq: true,
4351
+ status: true,
4352
+ method: true,
4353
+ endpointTemplate: true,
4354
+ bytes: true,
4355
+ ids: true,
4356
+ counts: true,
4357
+ durationMs: true,
4358
+ outcome: true,
4359
+ errorCode: true,
4360
+ providerError: true,
4361
+ level: true,
4362
+ transport: true,
4363
+ attempt: true,
4364
+ waitMs: true,
4365
+ code: true,
4366
+ detail: true,
4367
+ reason: true,
4368
+ ageMs: true,
4369
+ kind: true,
4370
+ table: true,
4371
+ op: true,
4372
+ n: true
4373
+ };
4374
+ var send = {
4375
+ profile: true,
4376
+ chatId: true,
4377
+ outcome: true,
4378
+ kind: true,
4379
+ action: true,
4380
+ people: true,
4381
+ messageId: true,
4382
+ key: true,
4383
+ count: true,
4384
+ forEveryone: true,
4385
+ sendId: true,
4386
+ operationId: true,
4387
+ parentOperationId: true,
4388
+ replyTo: true,
4389
+ threadId: true,
4390
+ sendAs: true,
4391
+ resultChatId: true,
4392
+ length: true,
4393
+ attachments: true,
4394
+ scheduledFor: true,
4395
+ notify: true,
4396
+ origin: true,
4397
+ reservation: true,
4398
+ errorCode: true
4399
+ };
4400
+ var background = [
4401
+ "job",
4402
+ "pid",
4403
+ "schedule",
4404
+ "exitCode",
4405
+ "tool",
4406
+ "tier",
4407
+ "actorType",
4408
+ "actorId",
4409
+ "agent",
4410
+ "targetType",
4411
+ "targetId"
4412
+ ];
4413
+ var crash = ["errorClass", "frames"];
4414
+ var dropped = ["dropped"];
4415
+ var LOG_ATTRIBUTES = [
4416
+ ...new Set([...Object.keys(diagnostic), ...Object.keys(send), ...background, ...crash, ...dropped].map((key) => Object.keys(logAttributes({ [key]: true }))[0]))
4417
+ ].sort();
4418
+
4419
+ // 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/runs/run.js
4420
+ import { randomUUID } from "node:crypto";
4421
+ import { appendFileSync, mkdirSync, readdirSync, readFileSync as readFileSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
4422
+ import { userInfo } from "node:os";
4423
+ import { join, sep } from "node:path";
4424
+ var KEEP_RUNS_FOR_DAYS = 30;
4425
+ var KEEP_SUCCESSFUL_RUNS_FOR_DAYS = 7;
4426
+ var KEEP_STORE_RUNS_FOR_DAYS = 3;
4427
+ var RUNS_SIZE_LIMIT_MB = 200;
4428
+ var runsDirFor = /* @__PURE__ */ __name((app, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "runs"), "runsDirFor");
4429
+ var startRun = /* @__PURE__ */ __name((options) => {
4430
+ const now = options.now ?? (() => /* @__PURE__ */ new Date());
4431
+ const startedAt = options.startedAt ?? now();
4432
+ const id4 = options.runId ?? newRunId(startedAt, options.command);
4433
+ const dir = join(options.runsDir, day(startedAt), id4);
4434
+ pruneRuns(options.runsDir, {
4435
+ keepDays: options.keepDays ?? KEEP_RUNS_FOR_DAYS,
4436
+ keepSuccessDays: options.keepSuccessDays ?? KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
4437
+ keepStoreDays: options.keepStoreDays ?? KEEP_STORE_RUNS_FOR_DAYS,
4438
+ maxBytes: options.maxBytes ?? RUNS_SIZE_LIMIT_MB * 1024 * 1024,
4439
+ now: startedAt
4440
+ });
4441
+ refuseRealStateInTests(dir);
4442
+ const metadata = {
4443
+ runId: id4,
4444
+ command: options.command,
4445
+ ...options.profile === void 0 ? {} : { profile: options.profile },
4446
+ startedAt: startedAt.toISOString(),
4447
+ status: "running",
4448
+ cliVersion: options.cliVersion,
4449
+ runtime: runtime(),
4450
+ platform: process.platform,
4451
+ arch: process.arch,
4452
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
4453
+ ...options.context
4454
+ };
4455
+ let file;
4456
+ const opened = /* @__PURE__ */ __name(() => {
4457
+ if (file)
4458
+ return file;
4459
+ mkdirSync(dir, { recursive: true, mode: 448 });
4460
+ const events = join(dir, "events.jsonl");
4461
+ writeFileSync2(events, "", { flag: "a", mode: 384 });
4462
+ file = snakeLogger(createRecordLog({
4463
+ to: events,
4464
+ runId: id4,
4465
+ command: options.command,
4466
+ resource: { service: options.service, version: options.cliVersion },
4467
+ allow: LOG_ATTRIBUTES,
4468
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
4469
+ ...options.onError === void 0 ? {} : { onError: options.onError }
4470
+ }));
4471
+ writeRunFile(dir, metadata);
4472
+ return file;
4473
+ }, "opened");
4474
+ if (!options.lazy)
4475
+ opened();
4476
+ let finished = false;
4477
+ const operations = /* @__PURE__ */ new Set();
4478
+ const codes = /* @__PURE__ */ new Set();
4479
+ const tables = /* @__PURE__ */ new Set();
4480
+ const noted = /* @__PURE__ */ __name((level) => (event2, message) => {
4481
+ const { operation, errorCode, error_code, code, kind: kind2, table } = event2;
4482
+ if (typeof operation === "string")
4483
+ operations.add(operation);
4484
+ if (kind2 === "store" && typeof table === "string")
4485
+ tables.add(table);
4486
+ for (const value of [errorCode, error_code, code])
4487
+ if (typeof value === "string")
4488
+ codes.add(value);
4489
+ if (finished)
4490
+ return;
4491
+ opened()[level](event2, message);
4492
+ }, "noted");
4493
+ const logger = { debug: noted("debug"), info: noted("info"), warn: noted("warn"), error: noted("error") };
4494
+ return {
4495
+ id: id4,
4496
+ dir,
4497
+ logger,
4498
+ finish: /* @__PURE__ */ __name(async (status, extra = {}) => {
4499
+ if (finished)
4500
+ return;
4501
+ finished = true;
4502
+ const completedAt = now();
4503
+ const final = {
4504
+ ...metadata,
4505
+ ...extra,
4506
+ status,
4507
+ completedAt: completedAt.toISOString(),
4508
+ durationMs: completedAt.getTime() - startedAt.getTime(),
4509
+ operations: [...operations].sort(),
4510
+ codes: [...codes].sort(),
4511
+ ...tables.size > 0 ? { tables: [...tables].sort() } : {}
4512
+ };
4513
+ if (file || status !== "success") {
4514
+ opened();
4515
+ writeRunFile(dir, final);
4516
+ return;
4517
+ }
4518
+ try {
4519
+ mkdirSync(join(dir, ".."), { recursive: true, mode: 448 });
4520
+ appendIndex(join(dir, ".."), runFileOf(final));
4521
+ } catch (error) {
4522
+ options.onError?.(error);
4523
+ }
4524
+ }, "finish")
4525
+ };
4526
+ }, "startRun");
4527
+ var refuseRealStateInTests = /* @__PURE__ */ __name((dir, env = process.env) => {
4528
+ if (env.VITEST === void 0)
4529
+ return;
4530
+ let home;
4531
+ try {
4532
+ home = userInfo().homedir;
4533
+ } catch {
4534
+ return;
4535
+ }
4536
+ if (dir.startsWith(join(home, ".local", "share") + sep))
4537
+ throw new Error(`a test opened a run in the real data folder: ${dir}`);
4538
+ }, "refuseRealStateInTests");
4539
+ var runtime = /* @__PURE__ */ __name(() => {
4540
+ const bun = process.versions.bun;
4541
+ return bun ? `bun ${bun}` : `node ${process.versions.node}`;
4542
+ }, "runtime");
4543
+ var newRunId = /* @__PURE__ */ __name((startedAt, command) => {
4544
+ const stamp = startedAt.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
4545
+ const slug = command.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
4546
+ return `${stamp}-${slug}-${randomUUID().slice(0, 6)}`;
4547
+ }, "newRunId");
4548
+ var INDEX = "index.jsonl";
4549
+ var appendIndex = /* @__PURE__ */ __name((dayDir, written) => {
4550
+ appendFileSync(join(dayDir, INDEX), `${JSON.stringify(written)}
4551
+ `, { mode: 384 });
4552
+ }, "appendIndex");
4553
+ var writeRunFile = /* @__PURE__ */ __name((dir, metadata) => {
4554
+ const written = runFileOf(metadata);
4555
+ writeSecurely(join(dir, "run.json"), `${JSON.stringify(written, null, 2)}
4556
+ `, 384);
4557
+ try {
4558
+ appendIndex(join(dir, ".."), written);
4559
+ } catch {
4560
+ }
4561
+ }, "writeRunFile");
4562
+ var matchesListFilter = /* @__PURE__ */ __name((run2, filter) => (filter.runId === void 0 || run2.runId === filter.runId) && (filter.command === void 0 || run2.command === filter.command) && (filter.profile === void 0 || run2.profile === filter.profile) && (filter.status === void 0 || run2.status === filter.status) && (filter.errorCode === void 0 || run2.errorCode === filter.errorCode), "matchesListFilter");
4563
+ var listRuns = /* @__PURE__ */ __name((runsDir, { since, atLeast = Number.POSITIVE_INFINITY, filter = {} } = {}) => {
4564
+ const first = since === void 0 ? void 0 : day(new Date(since));
4565
+ const runs = [];
4566
+ for (const date of days(runsDir).sort().reverse()) {
4567
+ if (first !== void 0 && date < first || runs.length >= atLeast)
4568
+ break;
4569
+ for (const metadata of runsOfDay(join(runsDir, date))) {
4570
+ if (matchesListFilter(metadata, filter))
4571
+ runs.push(metadata);
4572
+ }
4573
+ }
4574
+ return runs;
4575
+ }, "listRuns");
4576
+ var indexedRuns = /* @__PURE__ */ __name((dayDir) => {
4577
+ const latest = /* @__PURE__ */ new Map();
4578
+ let raw = "";
4579
+ try {
4580
+ raw = readFileSync2(join(dayDir, INDEX), "utf8");
4581
+ } catch {
4582
+ }
4583
+ for (const line2 of raw.split("\n")) {
4584
+ if (line2.trim() === "")
4585
+ continue;
4586
+ try {
4587
+ const metadata = metadataOf(JSON.parse(line2));
4588
+ if (typeof metadata.runId === "string")
4589
+ latest.set(metadata.runId, metadata);
4590
+ } catch {
4591
+ }
4592
+ }
4593
+ return latest;
4594
+ }, "indexedRuns");
4595
+ var runsOfDay = /* @__PURE__ */ __name((dayDir) => {
4596
+ const latest = indexedRuns(dayDir);
4597
+ for (const entry of safeReaddir(dayDir)) {
4598
+ if (entry === INDEX || entry.startsWith(".") || latest.has(entry))
4599
+ continue;
4600
+ const metadata = readRun(join(dayDir, entry));
4601
+ if (metadata)
4602
+ latest.set(metadata.runId, metadata);
4603
+ }
4604
+ return [...latest.values()].sort((a, b) => a.runId < b.runId ? 1 : a.runId > b.runId ? -1 : 0);
4605
+ }, "runsOfDay");
4606
+ var findRun = /* @__PURE__ */ __name((runsDir, id4) => {
4607
+ const stamped = /^(\d{4})(\d{2})(\d{2})T/.exec(id4);
4608
+ const likely = stamped ? [`${stamped[1]}-${stamped[2]}-${stamped[3]}`] : [];
4609
+ const dates = [.../* @__PURE__ */ new Set([...likely, ...days(runsDir)])];
4610
+ for (const date of dates) {
4611
+ const dir = join(runsDir, date, id4);
4612
+ const metadata = readRun(dir);
4613
+ if (metadata)
4614
+ return { dir, metadata };
4615
+ }
4616
+ for (const date of dates) {
4617
+ const metadata = indexedRuns(join(runsDir, date)).get(id4);
4618
+ if (metadata)
4619
+ return { dir: join(runsDir, date, id4), metadata };
4620
+ }
4621
+ return void 0;
4622
+ }, "findRun");
4623
+ var readEvents = /* @__PURE__ */ __name((dir) => {
4624
+ let raw;
4625
+ try {
4626
+ raw = readFileSync2(join(dir, "events.jsonl"), "utf8");
4627
+ } catch {
4628
+ return [];
4629
+ }
4630
+ const events = [];
4631
+ for (const line2 of raw.split("\n")) {
4632
+ if (line2.trim() === "")
4633
+ continue;
4634
+ try {
4635
+ const parsed = JSON.parse(line2);
4636
+ if (parsed !== null && typeof parsed === "object")
4637
+ events.push(eventOf(parsed));
4638
+ } catch {
4639
+ }
4640
+ }
4641
+ return events;
4642
+ }, "readEvents");
4643
+ var eventOf = /* @__PURE__ */ __name((line2) => {
4644
+ const { attributes, time: time2, severity: severity2 } = line2;
4645
+ if (attributes === null || typeof attributes !== "object")
4646
+ return logAttributes(line2);
4647
+ return { time: time2, severity: severity2, ...logAttributes(attributes) };
4648
+ }, "eventOf");
4649
+ var pruneRuns = /* @__PURE__ */ __name((runsDir, { keepDays, keepSuccessDays = keepDays, keepStoreDays = KEEP_STORE_RUNS_FOR_DAYS, maxBytes, now }) => {
4650
+ const cutoff = day(new Date(now.getTime() - keepDays * DAY_MS));
4651
+ const before = /* @__PURE__ */ __name((days2) => day(new Date(now.getTime() - Math.min(days2, keepDays) * DAY_MS)), "before");
4652
+ const successCutoff = before(keepSuccessDays);
4653
+ const storeCutoff = before(keepStoreDays);
4654
+ const keptFor = /* @__PURE__ */ __name((metadata) => metadata.keptBecauseStore ? keepStoreDays : metadata.operations?.includes(STORE_WRITE) ? Math.max(keepSuccessDays, keepStoreDays) : keepSuccessDays, "keptFor");
4655
+ let removed = 0;
4656
+ for (const date of days(runsDir)) {
4657
+ if (date >= cutoff) {
4658
+ if (date < storeCutoff)
4659
+ dropSuccesses(join(runsDir, date), STORE_RUNS_DROPPED, (metadata) => keptFor(metadata) <= keepStoreDays);
4660
+ if (date < successCutoff)
4661
+ dropSuccesses(join(runsDir, date), SUCCESSES_DROPPED, (metadata) => keptFor(metadata) <= keepSuccessDays);
4662
+ continue;
4663
+ }
4664
+ try {
4665
+ rmSync2(join(runsDir, date), { recursive: true, force: true });
4666
+ removed += 1;
4667
+ } catch {
4668
+ }
4669
+ }
4670
+ if (maxBytes !== void 0)
4671
+ removed += fitSize(runsDir, maxBytes, now);
4672
+ return removed;
4673
+ }, "pruneRuns");
4674
+ var DAY_MS = 24 * 60 * 60 * 1e3;
4675
+ var STORE_WRITE = "store.write";
4676
+ var SUCCESSES_DROPPED = ".successes-dropped";
4677
+ var STORE_RUNS_DROPPED = ".store-runs-dropped";
4678
+ var SIZE_CHECKED = ".size-checked";
4679
+ var dropSuccesses = /* @__PURE__ */ __name((dayDir, marker = SUCCESSES_DROPPED, drops = () => true) => {
4680
+ const done = join(dayDir, marker);
4681
+ try {
4682
+ statSync2(done);
4683
+ return;
4684
+ } catch {
4685
+ }
4686
+ const dropped2 = /* @__PURE__ */ __name((metadata) => metadata?.status === "success" && drops(metadata), "dropped");
4687
+ try {
4688
+ const kept = [];
4689
+ for (const [id4, metadata] of indexedRuns(dayDir)) {
4690
+ if (dropped2(metadata))
4691
+ rmSync2(join(dayDir, id4), { recursive: true, force: true });
4692
+ else
4693
+ kept.push(JSON.stringify(runFileOf(metadata)));
4694
+ }
4695
+ for (const entry of safeReaddir(dayDir)) {
4696
+ if (entry === INDEX || entry.startsWith("."))
4697
+ continue;
4698
+ if (dropped2(readRun(join(dayDir, entry))))
4699
+ rmSync2(join(dayDir, entry), { recursive: true, force: true });
4700
+ }
4701
+ writeSecurely(join(dayDir, INDEX), kept.map((line2) => `${line2}
4702
+ `).join(""), 384);
4703
+ writeFileSync2(done, "", { mode: 384 });
4704
+ } catch {
4705
+ }
4706
+ }, "dropSuccesses");
4707
+ var sizeOf = /* @__PURE__ */ __name((path) => {
4708
+ let total = 0;
4709
+ for (const entry of safeReaddir(path)) {
4710
+ const full = join(path, entry);
4711
+ try {
4712
+ const stat = statSync2(full);
4713
+ total += stat.isDirectory() ? sizeOf(full) : stat.size;
4714
+ } catch {
4715
+ }
4716
+ }
4717
+ return total;
4718
+ }, "sizeOf");
4719
+ var fitSize = /* @__PURE__ */ __name((runsDir, maxBytes, now) => {
4720
+ const stamp = join(runsDir, SIZE_CHECKED);
4721
+ const today = day(now);
4722
+ try {
4723
+ if (readFileSync2(stamp, "utf8").trim() === today)
4724
+ return 0;
4725
+ } catch {
4726
+ }
4727
+ const dates = days(runsDir).sort();
4728
+ const sizes = new Map(dates.map((date) => [date, sizeOf(join(runsDir, date))]));
4729
+ let total = [...sizes.values()].reduce((sum, size) => sum + size, 0);
4730
+ let removed = 0;
4731
+ for (const date of dates) {
4732
+ if (total <= maxBytes || date === today)
4733
+ break;
4734
+ dropSuccesses(join(runsDir, date));
4735
+ const after = sizeOf(join(runsDir, date));
4736
+ total -= (sizes.get(date) ?? 0) - after;
4737
+ sizes.set(date, after);
4738
+ }
4739
+ for (const date of dates) {
4740
+ if (total <= maxBytes || date === today)
4741
+ break;
4742
+ try {
4743
+ rmSync2(join(runsDir, date), { recursive: true, force: true });
4744
+ total -= sizes.get(date) ?? 0;
4745
+ removed += 1;
4746
+ } catch {
4747
+ }
4748
+ }
4749
+ try {
4750
+ mkdirSync(runsDir, { recursive: true, mode: 448 });
4751
+ writeFileSync2(stamp, today, { mode: 384 });
4752
+ } catch {
4753
+ }
4754
+ return removed;
4755
+ }, "fitSize");
4756
+ var day = /* @__PURE__ */ __name((date) => date.toISOString().slice(0, 10), "day");
4757
+ var days = /* @__PURE__ */ __name((runsDir) => safeReaddir(runsDir).filter((entry) => /^\d{4}-\d{2}-\d{2}$/.test(entry)), "days");
4758
+ var readRun = /* @__PURE__ */ __name((dir) => {
4759
+ try {
4760
+ return metadataOf(JSON.parse(readFileSync2(join(dir, "run.json"), "utf8")));
4761
+ } catch {
4762
+ return void 0;
4763
+ }
4764
+ }, "readRun");
4765
+ var safeReaddir = /* @__PURE__ */ __name((dir) => {
4766
+ try {
4767
+ return readdirSync(dir);
4768
+ } catch {
4769
+ return [];
4770
+ }
4771
+ }, "safeReaddir");
4772
+ var runFileOf = /* @__PURE__ */ __name(({ partial, ...metadata }) => ({
4773
+ ...logAttributes(metadata),
4774
+ ...partial ? { partial: { ...logAttributes(partial), failures: partial.failures.map((failure) => logAttributes(failure)) } } : {}
4775
+ }), "runFileOf");
4776
+ var metadataOf = /* @__PURE__ */ __name((parsed) => {
4777
+ const { partial, ...metadata } = fromLogAttributes(parsed);
4778
+ if (partial === null || typeof partial !== "object")
4779
+ return metadata;
4780
+ const { failures, ...rest } = fromLogAttributes(partial);
4781
+ return {
4782
+ ...metadata,
4783
+ partial: {
4784
+ ...rest,
4785
+ failures: Array.isArray(failures) ? failures.map((failure) => fromLogAttributes(failure)) : []
4786
+ }
4787
+ };
4788
+ }, "metadataOf");
4789
+
4790
+ // 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/runs/scope.js
4791
+ import { AsyncLocalStorage } from "node:async_hooks";
4792
+ import { randomBytes } from "node:crypto";
4793
+ var scopes = new AsyncLocalStorage();
4794
+ var processScope;
4795
+ var currentRun = /* @__PURE__ */ __name(() => {
4796
+ const scope2 = scopes.getStore();
4797
+ if (scope2)
4798
+ return scope2;
4799
+ processScope ??= {
4800
+ runId: newRunId(/* @__PURE__ */ new Date(), "process"),
4801
+ command: "",
4802
+ startedAt: Date.now(),
4803
+ ...traceOf(process.env)
4804
+ };
4805
+ return processScope;
4806
+ }, "currentRun");
4807
+ var inRun = /* @__PURE__ */ __name((scope2, body) => scopes.run(scope2, body), "inRun");
4808
+ var runEvent = /* @__PURE__ */ __name((event2) => scopes.getStore()?.events?.(event2), "runEvent");
4809
+ var typedCommand = /* @__PURE__ */ __name((tool, words2, profile = currentRun().profile) => [tool, profile, words2].filter((part) => part !== void 0 && part !== "").join(" "), "typedCommand");
4810
+ var useAsProcessRun = /* @__PURE__ */ __name((scope2) => {
4811
+ processScope = scope2;
4812
+ }, "useAsProcessRun");
4813
+ var enclosingTraceId = /* @__PURE__ */ __name(() => scopes.getStore()?.traceId, "enclosingTraceId");
4814
+ var traceOf = /* @__PURE__ */ __name((env) => {
4815
+ const traceId = traceIdOf(env.TRACEPARENT);
4816
+ return traceId === void 0 ? {} : { traceId };
4817
+ }, "traceOf");
4818
+ var childTrace = /* @__PURE__ */ __name(() => {
4819
+ const hex = /* @__PURE__ */ __name((bytes) => randomBytes(bytes).toString("hex"), "hex");
4820
+ const traceId = hex(16);
4821
+ return { traceId, traceparent: `00-${traceId}-${hex(8)}-01` };
4822
+ }, "childTrace");
4823
+ var attempts = new AsyncLocalStorage();
4824
+ var withAttempt = /* @__PURE__ */ __name((attempt, work) => attempts.run(attempt, work), "withAttempt");
4825
+
4826
+ // 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/domain/relations.js
3737
4827
  var ORGANIZATION_ROLES = [
3738
4828
  "employee",
3739
4829
  "contractor",
@@ -3744,10 +4834,11 @@ var ORGANIZATION_ROLES = [
3744
4834
  "contact"
3745
4835
  ];
3746
4836
  var PROJECT_ROLES = ["owner", "manager", "contributor", "client-contact", "approver"];
4837
+ var CONTRACT_ROLES = ["customer", "supplier", "signatory", "guarantor"];
3747
4838
  var ENGAGEMENT_LEVELS = ["none", "low", "medium", "high"];
3748
4839
  var isEngagement = /* @__PURE__ */ __name((value) => typeof value === "string" && ENGAGEMENT_LEVELS.includes(value), "isEngagement");
3749
- var checkEngagement = /* @__PURE__ */ __name((kind, from, to, level) => {
3750
- if (kind !== "member-of" || from !== "person" || to !== "project")
4840
+ var checkEngagement = /* @__PURE__ */ __name((kind2, from, to, level) => {
4841
+ if (kind2 !== "member-of" || from !== "person" || to !== "project")
3751
4842
  throw new CliError("validation_error", "an engagement level is set only on a person's member-of a project", {
3752
4843
  reason: "relationship.engagement-ends"
3753
4844
  });
@@ -3770,46 +4861,54 @@ var RELATIONS = {
3770
4861
  "customer-of": { from: ["person", "organization"], to: ["organization"], inverse: "supplier of" },
3771
4862
  "partner-of": { from: ["organization"], to: ["organization"], symmetric: true },
3772
4863
  "related-to": {
3773
- from: ["person", "organization", "project", "task", "deal", "lead"],
4864
+ from: ["person", "organization", "project", "task", "deal", "lead", "contract"],
3774
4865
  to: ["person", "organization", "project", "task"],
3775
- roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES } }
4866
+ roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES, contract: CONTRACT_ROLES } }
3776
4867
  }
3777
4868
  };
3778
4869
  var RELATION_KINDS = Object.keys(RELATIONS);
3779
- var specOf = /* @__PURE__ */ __name((kind) => Object.hasOwn(RELATIONS, kind) ? RELATIONS[kind] : void 0, "specOf");
3780
- var isRelationKind = /* @__PURE__ */ __name((kind) => specOf(kind) !== void 0, "isRelationKind");
4870
+ var specOf = /* @__PURE__ */ __name((kind2) => Object.hasOwn(RELATIONS, kind2) ? RELATIONS[kind2] : void 0, "specOf");
4871
+ var isRelationKind = /* @__PURE__ */ __name((kind2) => specOf(kind2) !== void 0, "isRelationKind");
3781
4872
  var memberOnly = /* @__PURE__ */ __name((type) => type === "chat" || type === "email_thread", "memberOnly");
3782
- var checkEnds = /* @__PURE__ */ __name((kind, from, to) => {
3783
- const spec = specOf(kind);
4873
+ var partyOnly = /* @__PURE__ */ __name((from, to) => from === "contract" && to !== "person" && to !== "organization", "partyOnly");
4874
+ var checkEnds = /* @__PURE__ */ __name((kind2, from, to) => {
4875
+ const spec = specOf(kind2);
3784
4876
  if (!spec)
3785
4877
  throw new CliError("validation_error", `a relationship's kind is one of ${RELATION_KINDS.join(", ")}`);
3786
- if (memberOnly(from) && (kind !== "member-of" || to !== "project"))
4878
+ if (memberOnly(from) && (kind2 !== "member-of" || to !== "project"))
3787
4879
  throw new CliError("validation_error", `a ${from === "chat" ? "chat" : "mail thread"} is related only as member-of a project`);
4880
+ if (partyOnly(from, to))
4881
+ throw new CliError("validation_error", "a contract is related only to a person or an organization");
3788
4882
  if (!spec.from.includes(from) || !spec.to.includes(to))
3789
- throw new CliError("validation_error", `${kind} joins ${spec.from.join(", ")} to ${spec.to.join(", ")}, not ${from} to ${to}`);
4883
+ throw new CliError("validation_error", `${kind2} joins ${spec.from.join(", ")} to ${spec.to.join(", ")}, not ${from} to ${to}`);
3790
4884
  return spec;
3791
4885
  }, "checkEnds");
3792
- var rolesOf = /* @__PURE__ */ __name((kind, from, to) => {
3793
- const spec = specOf(kind);
3794
- if (kind === "member-of" && from !== "person")
4886
+ var rolesOf = /* @__PURE__ */ __name((kind2, from, to) => {
4887
+ const spec = specOf(kind2);
4888
+ if (kind2 === "member-of" && from !== "person")
3795
4889
  return void 0;
3796
4890
  return spec?.roles?.from?.[from] ?? spec?.roles?.to?.[to];
3797
4891
  }, "rolesOf");
3798
- var ROLE_LISTS = { organization: ORGANIZATION_ROLES, project: PROJECT_ROLES, deal: DEAL_ROLES };
3799
- var roleListOf = /* @__PURE__ */ __name((kind, from, to) => {
3800
- const roles = rolesOf(kind, from, to);
4892
+ var ROLE_LISTS = {
4893
+ organization: ORGANIZATION_ROLES,
4894
+ project: PROJECT_ROLES,
4895
+ deal: DEAL_ROLES,
4896
+ contract: CONTRACT_ROLES
4897
+ };
4898
+ var roleListOf = /* @__PURE__ */ __name((kind2, from, to) => {
4899
+ const roles = rolesOf(kind2, from, to);
3801
4900
  return Object.keys(ROLE_LISTS).find((list) => ROLE_LISTS[list] === roles);
3802
4901
  }, "roleListOf");
3803
- var checkRole = /* @__PURE__ */ __name((kind, from, to, role, extra = []) => {
3804
- const roles = rolesOf(kind, from, to)?.concat(extra);
4902
+ var checkRole = /* @__PURE__ */ __name((kind2, from, to, role, extra = []) => {
4903
+ const roles = rolesOf(kind2, from, to)?.concat(extra);
3805
4904
  if (roles && !roles.includes(role))
3806
- throw new CliError("validation_error", `a ${from}'s role on ${kind} ${to} is one of ${roles.join(", ")}`, {
4905
+ throw new CliError("validation_error", `a ${from}'s role on ${kind2} ${to} is one of ${roles.join(", ")}`, {
3807
4906
  reason: "relationship.role-unknown"
3808
4907
  });
3809
4908
  return role;
3810
4909
  }, "checkRole");
3811
- var isSymmetric = /* @__PURE__ */ __name((kind) => specOf(kind)?.symmetric === true, "isSymmetric");
3812
- var inverseOf = /* @__PURE__ */ __name((kind) => specOf(kind)?.symmetric ? kind : specOf(kind)?.inverse ?? null, "inverseOf");
4910
+ var isSymmetric = /* @__PURE__ */ __name((kind2) => specOf(kind2)?.symmetric === true, "isSymmetric");
4911
+ var inverseOf = /* @__PURE__ */ __name((kind2) => specOf(kind2)?.symmetric ? kind2 : specOf(kind2)?.inverse ?? null, "inverseOf");
3813
4912
  var STANDINGS = ["confirmed", "reported", "proposed", "ended"];
3814
4913
  var standingOf = /* @__PURE__ */ __name((link, now) => {
3815
4914
  if (link.endsAt != null && link.endsAt <= now)
@@ -3824,7 +4923,7 @@ var isUsable = /* @__PURE__ */ __name((standing) => standing === "confirmed" ||
3824
4923
  var notOverriddenSql = /* @__PURE__ */ __name((alias) => `NOT EXISTS (SELECT 1 FROM links override WHERE override.kind = ${alias}.kind AND override.from_type = ${alias}.from_type AND override.from_id = ${alias}.from_id AND override.to_type = ${alias}.to_type AND override.to_id = ${alias}.to_id AND json_extract(override.metadata, '$.overrides') = ${alias}.id)`, "notOverriddenSql");
3825
4924
  var usableLinkSql = /* @__PURE__ */ __name((alias, now) => `(${alias}.confirmed = 1 OR (${alias}.account_id IS NOT NULL AND ${alias}.deleted_at IS NULL))` + (now === void 0 ? "" : ` AND (${alias}.ends_at IS NULL OR ${alias}.ends_at > ${Math.trunc(now)})`), "usableLinkSql");
3826
4925
 
3827
- // 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/domain/tags.js
4926
+ // 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/domain/tags.js
3828
4927
  var TAG_TYPES = ["chat", "contact", "message", "task"];
3829
4928
  var TAG = /^[a-z0-9-]{1,32}$/;
3830
4929
  var tagOf = /* @__PURE__ */ __name((value) => {
@@ -3838,31 +4937,7 @@ var normalizeTag = /* @__PURE__ */ __name((value) => {
3838
4937
  return tag;
3839
4938
  }, "normalizeTag");
3840
4939
 
3841
- // 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/store/sqlite/link-kinds.js
3842
- var LINK_KINDS = [
3843
- "links-to",
3844
- "blocked-by",
3845
- "follow-up-of",
3846
- "about",
3847
- "member-of",
3848
- "labelled",
3849
- "answered-by",
3850
- "evidence",
3851
- "created-from",
3852
- "duplicate-of",
3853
- "related-to",
3854
- "reports-to",
3855
- "customer-of",
3856
- "partner-of",
3857
- "assigned-to",
3858
- "attached"
3859
- ];
3860
- var LINK_ORIGINS = ["file", "owner", "suggested", "message"];
3861
- var LINK_SOURCES = [...LINK_ORIGINS, "calendar"];
3862
- var linkKind = /* @__PURE__ */ __name((kind) => `'${kind}'`, "linkKind");
3863
- var COUNTERPART_ROLE = "counterpart";
3864
-
3865
- // 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/tasks/model.js
4940
+ // 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/tasks/model.js
3866
4941
  var TASK_KINDS = ["question", "request", "mention", "promise"];
3867
4942
  var TASK_STATES = ["open", "todo", "in_progress", "done", "dismissed"];
3868
4943
  var CLOSED_STATES = ["done", "dismissed"];
@@ -3877,7 +4952,7 @@ function closeTask(task, state, by, at, reason) {
3877
4952
  }
3878
4953
  __name(closeTask, "closeTask");
3879
4954
 
3880
- // 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/tasks/priority.js
4955
+ // 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/tasks/priority.js
3881
4956
  var PRIORITY_LABELS = ["low", "medium", "high", "critical"];
3882
4957
  var MIDDLE = { low: 0.125, medium: 0.375, high: 0.625, critical: 0.875 };
3883
4958
  var LEGACY_PRIORITY_SCORES = [0.875, 0.625, 0.375, 0.1875, 0.0625];
@@ -3906,13 +4981,13 @@ var priorityOf = /* @__PURE__ */ __name((value) => {
3906
4981
  }, "priorityOf");
3907
4982
  var priorityOption = /* @__PURE__ */ __name((value) => priorityOf(value) ?? "none", "priorityOption");
3908
4983
 
3909
- // 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/tasks/store.js
4984
+ // 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/tasks/store.js
3910
4985
  function matches2(task, filter) {
3911
4986
  return (filter.account === void 0 || task.account === filter.account) && (filter.state === void 0 || task.state === filter.state) && (filter.group === void 0 || task.group === filter.group) && (filter.kind === void 0 || task.kind === filter.kind) && (filter.createdBefore === void 0 || task.createdAt < filter.createdBefore);
3912
4987
  }
3913
4988
  __name(matches2, "matches");
3914
4989
 
3915
- // 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/tasks/service.js
4990
+ // 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/tasks/service.js
3916
4991
  function createTaskService({ store, now = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "now"), newId = /* @__PURE__ */ __name(() => crypto.randomUUID(), "newId") }) {
3917
4992
  async function find(id4) {
3918
4993
  const task = await store.get(id4);
@@ -3972,7 +5047,7 @@ function median(values) {
3972
5047
  }
3973
5048
  __name(median, "median");
3974
5049
 
3975
- // 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/domain/knowledge.js
5050
+ // 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/domain/knowledge.js
3976
5051
  var FACT_STATUSES = ["proposed", "accepted", "superseded", "reversed", "rejected"];
3977
5052
  var MEMORY_KINDS = ["summary", "digest", "preference"];
3978
5053
  var MEMORY_STATUSES = ["proposed", "confirmed", "stale", "superseded"];
@@ -3980,7 +5055,41 @@ var MEMORY_SCOPES = ["personal", "work"];
3980
5055
  var WORK_TASK_TYPES = ["bug", "feature", "chore"];
3981
5056
  var TASK_TYPES2 = [...WORK_TASK_TYPES, ...TASK_KINDS];
3982
5057
 
3983
- // 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/entities/fields.js
5058
+ // 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/store/sqlite/link-source.js
5059
+ var REPORTER_SQL = "(SELECT provider || ':' || external_id FROM accounts r WHERE r.id = links.account_id) AS reporter";
5060
+ var sourceOf3 = /* @__PURE__ */ __name((database, row, metadata) => {
5061
+ const reporter = row.account_id == null ? void 0 : "reporter" in row ? row.reporter : database.prepare("SELECT provider || ':' || external_id AS key FROM accounts WHERE id = ?").get(Number(row.account_id))?.key;
5062
+ return {
5063
+ ...typeof reporter === "string" ? { account: reporter } : {},
5064
+ ...typeof metadata.derived === "string" ? { derived: metadata.derived } : {}
5065
+ };
5066
+ }, "sourceOf");
5067
+
5068
+ // 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/store/sqlite/link-kinds.js
5069
+ var LINK_KINDS = [
5070
+ "links-to",
5071
+ "blocked-by",
5072
+ "follow-up-of",
5073
+ "about",
5074
+ "member-of",
5075
+ "labelled",
5076
+ "answered-by",
5077
+ "evidence",
5078
+ "created-from",
5079
+ "duplicate-of",
5080
+ "related-to",
5081
+ "reports-to",
5082
+ "customer-of",
5083
+ "partner-of",
5084
+ "assigned-to",
5085
+ "attached"
5086
+ ];
5087
+ var LINK_ORIGINS = ["file", "owner", "suggested", "message"];
5088
+ var LINK_SOURCES = [...LINK_ORIGINS, "calendar"];
5089
+ var linkKind = /* @__PURE__ */ __name((kind2) => `'${kind2}'`, "linkKind");
5090
+ var COUNTERPART_ROLE = "counterpart";
5091
+
5092
+ // 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/entities/fields.js
3984
5093
  var text5 = string();
3985
5094
  var id3 = pipe(string(), minLength(1));
3986
5095
  var time = isoTime;
@@ -4005,7 +5114,7 @@ var author = strictObject({
4005
5114
  name: nullable(text5)
4006
5115
  });
4007
5116
 
4008
- // 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/entities/knowledge-lists.js
5117
+ // 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/entities/knowledge-lists.js
4009
5118
  var organization = strictObject({
4010
5119
  id: id3,
4011
5120
  ref: reference,
@@ -4035,6 +5144,9 @@ var reminder = strictObject({
4035
5144
  receipt: nullable(text5)
4036
5145
  });
4037
5146
 
5147
+ // 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/domain/categories.js
5148
+ var CATEGORIES = ["client", "supplier", "partner", "employer"];
5149
+
4038
5150
  export {
4039
5151
  QUERY_LIMITS,
4040
5152
  queryAstSchema,
@@ -4143,6 +5255,56 @@ export {
4143
5255
  aggregateMeetingCounts,
4144
5256
  aggregateMeetingStats,
4145
5257
  createUpcomingMeetingReader,
5258
+ formatLocator,
5259
+ isLocator,
5260
+ parseLocator,
5261
+ SIMPLE_REFERENCES,
5262
+ REF_KINDS,
5263
+ formatReference,
5264
+ parseReference,
5265
+ canonicalReference,
5266
+ looksLikeReference,
5267
+ providerLabel,
5268
+ isFolderProvider,
5269
+ folderProviderSql,
5270
+ folderProviderOf,
5271
+ DOCUMENT_ACCOUNT_PROVIDERS,
5272
+ isDocumentAccountProvider,
5273
+ ADDED_PROVIDER,
5274
+ ADDED_ACCOUNT,
5275
+ notAdded,
5276
+ filesAccountSql,
5277
+ INTERNAL_NOTES,
5278
+ UNKNOWN_PROVIDER,
5279
+ providerEntryOf,
5280
+ kindsOfEntry,
5281
+ unitedKinds,
5282
+ useStoredProviders,
5283
+ addProvider,
5284
+ isKind,
5285
+ providerNamed,
5286
+ kindIn,
5287
+ importedOf,
5288
+ isImportedProvider,
5289
+ holdsKind,
5290
+ holdsKindOf,
5291
+ kindOf2 as kindOf,
5292
+ isBotProvider,
5293
+ inSource,
5294
+ sourceOf,
5295
+ ACCOUNT_GROUPS,
5296
+ ACCOUNT_GROUPS_SETTING,
5297
+ isAccountList,
5298
+ isGroupName,
5299
+ groupName,
5300
+ groupMembers,
5301
+ listedHolds,
5302
+ keyOf,
5303
+ sourceOf2,
5304
+ sameAs,
5305
+ entriesOfList,
5306
+ accountsOfList,
5307
+ fitting,
4146
5308
  parseDecimal,
4147
5309
  formatDecimal,
4148
5310
  currencyOf,
@@ -4190,6 +5352,39 @@ export {
4190
5352
  ERASED_TEXT,
4191
5353
  severity,
4192
5354
  graver,
5355
+ markStoreDamaged,
5356
+ readDamageMark,
5357
+ refuseDamagedStore,
5358
+ markJournalLost,
5359
+ readJournalMark,
5360
+ readHealthMark,
5361
+ recordDeepCheck,
5362
+ logAttributes,
5363
+ fromLogAttributes,
5364
+ snakeLogger,
5365
+ LOG_ATTRIBUTES,
5366
+ KEEP_RUNS_FOR_DAYS,
5367
+ KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
5368
+ KEEP_STORE_RUNS_FOR_DAYS,
5369
+ RUNS_SIZE_LIMIT_MB,
5370
+ runsDirFor,
5371
+ startRun,
5372
+ runtime,
5373
+ newRunId,
5374
+ listRuns,
5375
+ findRun,
5376
+ readEvents,
5377
+ currentRun,
5378
+ inRun,
5379
+ runEvent,
5380
+ typedCommand,
5381
+ useAsProcessRun,
5382
+ enclosingTraceId,
5383
+ traceOf,
5384
+ childTrace,
5385
+ withAttempt,
5386
+ ORGANIZATION_ROLES,
5387
+ PROJECT_ROLES,
4193
5388
  ENGAGEMENT_LEVELS,
4194
5389
  isEngagement,
4195
5390
  checkEngagement,
@@ -4211,11 +5406,6 @@ export {
4211
5406
  TAG_TYPES,
4212
5407
  tagOf,
4213
5408
  normalizeTag,
4214
- LINK_KINDS,
4215
- LINK_ORIGINS,
4216
- LINK_SOURCES,
4217
- linkKind,
4218
- COUNTERPART_ROLE,
4219
5409
  TASK_KINDS,
4220
5410
  TASK_STATES,
4221
5411
  TASK_ORIGINS,
@@ -4236,6 +5426,13 @@ export {
4236
5426
  MEMORY_SCOPES,
4237
5427
  WORK_TASK_TYPES,
4238
5428
  TASK_TYPES2 as TASK_TYPES,
5429
+ REPORTER_SQL,
5430
+ sourceOf3,
5431
+ LINK_KINDS,
5432
+ LINK_ORIGINS,
5433
+ LINK_SOURCES,
5434
+ linkKind,
5435
+ COUNTERPART_ROLE,
4239
5436
  text5 as text,
4240
5437
  id3 as id,
4241
5438
  time,
@@ -4249,9 +5446,5 @@ export {
4249
5446
  organization,
4250
5447
  project,
4251
5448
  reminder,
4252
- markStoreDamaged,
4253
- readDamageMark,
4254
- refuseDamagedStore,
4255
- readHealthMark,
4256
- recordDeepCheck
5449
+ CATEGORIES
4257
5450
  };