@wirecat/notion-cli 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +5 -0
  3. package/contracts/wirecat.json +55 -2
  4. package/dist/bin/notion.js +2 -2
  5. package/dist/bundle/agent-ILG6AH7S.js +42 -0
  6. package/dist/bundle/{all-profiles-4IONYZB6.js → all-profiles-AELHUTFU.js} +64 -21
  7. package/dist/bundle/{anthropic-OXF74J4P.js → anthropic-3CCYAGO3.js} +6 -6
  8. package/dist/bundle/{app-server-M2VF6ABM.js → app-server-DJ6P4NY4.js} +86 -65
  9. package/dist/bundle/{bun-DLA6QRLL.js → bun-2FLR4IV4.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-F4BYLW3F.js → bun-sqlite-QB6CU6TH.js} +7 -7
  11. package/dist/bundle/chunk-2CMLY2X3.js +72 -0
  12. package/dist/bundle/{chunk-TZ2QJ53V.js → chunk-2XUV7HNE.js} +2 -2
  13. package/dist/bundle/{chunk-6JBLIQQN.js → chunk-2Z7UOXFC.js} +1 -1
  14. package/dist/bundle/{chunk-6GN7KU7X.js → chunk-3LMW7U7F.js} +22 -10
  15. package/dist/bundle/chunk-3MYN2RMG.js +398 -0
  16. package/dist/bundle/{chunk-YFWLHTNO.js → chunk-3UX4VJWD.js} +1 -1
  17. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  18. package/dist/bundle/{chunk-4KUJTSHG.js → chunk-4RFR4J2O.js} +2 -2
  19. package/dist/bundle/{chunk-OCDJ4FFA.js → chunk-4VXXOJ2F.js} +4 -4
  20. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  21. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  22. package/dist/bundle/{chunk-P3P6DA6K.js → chunk-5OJLUUOJ.js} +6 -6
  23. package/dist/bundle/{chunk-T5UNSFES.js → chunk-5XPHFV7H.js} +35 -12
  24. package/dist/bundle/{chunk-KL3P5TQK.js → chunk-6EJCI47L.js} +4 -4
  25. package/dist/bundle/chunk-6VPC5Z56.js +2145 -0
  26. package/dist/bundle/{chunk-IJMFG7HB.js → chunk-6YOMPW7Y.js} +10 -8
  27. package/dist/bundle/{chunk-7NF3V5L2.js → chunk-7JVKQ6NM.js} +4 -4
  28. package/dist/bundle/chunk-7L2XOKDZ.js +353 -0
  29. package/dist/bundle/{chunk-TXONV3HW.js → chunk-A42T4YX7.js} +3 -3
  30. package/dist/bundle/chunk-AE4VW4NB.js +50 -0
  31. package/dist/bundle/chunk-AV2ZJ4WX.js +7 -0
  32. package/dist/bundle/{chunk-L6H7PY4X.js → chunk-AZLDR36U.js} +3 -3
  33. package/dist/bundle/{chunk-TFNRCCGR.js → chunk-BAXNAOOL.js} +4 -4
  34. package/dist/bundle/{chunk-QX3TPFEX.js → chunk-BEV5LO4D.js} +110 -862
  35. package/dist/bundle/{chunk-UROEWCOG.js → chunk-BQBC2WIG.js} +1 -65
  36. package/dist/bundle/{chunk-NO2LIHWA.js → chunk-CFQQTDSA.js} +1 -1
  37. package/dist/bundle/chunk-CHPWBQUK.js +39 -0
  38. package/dist/bundle/chunk-CL3YNUCC.js +388 -0
  39. package/dist/bundle/{chunk-WHJWURZB.js → chunk-DGMTSDKB.js} +6 -6
  40. package/dist/bundle/{chunk-HTKSCSJU.js → chunk-DHVVXQEL.js} +4 -4
  41. package/dist/bundle/chunk-DIU2QJJF.js +785 -0
  42. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  43. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  44. package/dist/bundle/{chunk-Z53LYX4M.js → chunk-EHW45LLT.js} +3 -3
  45. package/dist/bundle/{chunk-XCTOCVMW.js → chunk-ERN53B3Z.js} +32 -24
  46. package/dist/bundle/{chunk-CDGZZNGY.js → chunk-ESZHGC4Q.js} +38 -8
  47. package/dist/bundle/{chunk-RMJMID5D.js → chunk-EZMG5QXB.js} +8 -8
  48. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  49. package/dist/bundle/{chunk-Y5LAJWR5.js → chunk-F5ZAN7OC.js} +1 -1
  50. package/dist/bundle/{chunk-2MHMKNWD.js → chunk-FMMYBVCH.js} +1 -1
  51. package/dist/bundle/{chunk-WZEEEQGC.js → chunk-FRB2L7OE.js} +3 -3
  52. package/dist/bundle/chunk-FV4WTZCU.js +561 -0
  53. package/dist/bundle/{chunk-BEPFGITI.js → chunk-G4ZU73SD.js} +101 -80
  54. package/dist/bundle/{chunk-5XP4KQ2F.js → chunk-GCAJW4SR.js} +1 -1
  55. package/dist/bundle/{chunk-FEMHUSGO.js → chunk-GPRJXJC7.js} +15 -1
  56. package/dist/bundle/chunk-GUIQJUJV.js +340 -0
  57. package/dist/bundle/{chunk-M2EEIYBU.js → chunk-HHEWTLAT.js} +2 -2
  58. package/dist/bundle/{chunk-LIQMUDIZ.js → chunk-HM6AMYHR.js} +2 -2
  59. package/dist/bundle/{chunk-TJCPTRYD.js → chunk-HOVHE3A3.js} +7 -7
  60. package/dist/bundle/{chunk-YAPDU3SV.js → chunk-HVXOA4FO.js} +1 -1
  61. package/dist/bundle/{chunk-D6RCRBDH.js → chunk-IJVTN5L3.js} +2 -2
  62. package/dist/bundle/{chunk-CIVXTBJY.js → chunk-IURYZSG3.js} +39 -52
  63. package/dist/bundle/chunk-JFSVAOA7.js +108 -0
  64. package/dist/bundle/{chunk-FSJHASRQ.js → chunk-JVESLS7B.js} +611 -572
  65. package/dist/bundle/chunk-K5IC4FZN.js +36 -0
  66. package/dist/bundle/chunk-KB35BVTG.js +30 -0
  67. package/dist/bundle/chunk-KGAUINBO.js +594 -0
  68. package/dist/bundle/{chunk-AYU5TFDU.js → chunk-KNCPBX5P.js} +85 -76
  69. package/dist/bundle/{chunk-GSNE7OB4.js → chunk-KZJQPJK5.js} +4 -4
  70. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  71. package/dist/bundle/{chunk-M6DGZ2O6.js → chunk-LC6WE6JS.js} +9 -9
  72. package/dist/bundle/{chunk-YGCI3DHS.js → chunk-LECMHK2F.js} +1 -1
  73. package/dist/bundle/chunk-LQVDFD65.js +72 -0
  74. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  75. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  76. package/dist/bundle/{chunk-K5I64ZVI.js → chunk-NSR43UEW.js} +7 -64
  77. package/dist/bundle/{chunk-GK4GLPG2.js → chunk-OEQNP56V.js} +2 -100
  78. package/dist/bundle/{chunk-MGUEZYFA.js → chunk-OLAGFJDM.js} +13 -2143
  79. package/dist/bundle/{chunk-MRA62W5K.js → chunk-P27NDZQR.js} +255 -563
  80. package/dist/bundle/{chunk-GBFEEHQC.js → chunk-PHKED7AG.js} +8 -225
  81. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  82. package/dist/bundle/{chunk-JODE2XED.js → chunk-Q7EIL6VU.js} +43 -33
  83. package/dist/bundle/{chunk-4TQVZXOV.js → chunk-QEJFBORC.js} +3 -3
  84. package/dist/bundle/{chunk-ZC6ZQQ55.js → chunk-QGGRFRMP.js} +65 -49
  85. package/dist/bundle/{chunk-JIRRF6BM.js → chunk-RD7BKTWV.js} +4 -4
  86. package/dist/bundle/chunk-RXU5T5NM.js +714 -0
  87. package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
  88. package/dist/bundle/{chunk-7NGFGFE5.js → chunk-SAPP2LEH.js} +10 -10
  89. package/dist/bundle/{chunk-COH7OEER.js → chunk-SEAGUFBX.js} +12 -12
  90. package/dist/bundle/{chunk-5LBJNTEJ.js → chunk-STTO2MSY.js} +43 -64
  91. package/dist/bundle/{chunk-5UA2TYMI.js → chunk-T37TAXVL.js} +2 -2
  92. package/dist/bundle/{chunk-R6SDRSZK.js → chunk-T6XIBULH.js} +139 -571
  93. package/dist/bundle/chunk-TFT4FVRU.js +67 -0
  94. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  95. package/dist/bundle/{chunk-KFVDL2QS.js → chunk-UC7JLE6J.js} +1 -89
  96. package/dist/bundle/{chunk-SGBS5QCU.js → chunk-UOC52GCB.js} +4 -4
  97. package/dist/bundle/chunk-UPL474OW.js +94 -0
  98. package/dist/bundle/chunk-VH7526NL.js +80 -0
  99. package/dist/bundle/chunk-VNWF4I7E.js +34 -0
  100. package/dist/bundle/chunk-W2VQDIU5.js +221 -0
  101. package/dist/bundle/{chunk-EQPAZ33O.js → chunk-WAGADES3.js} +19 -19
  102. package/dist/bundle/{chunk-WU3XHGOB.js → chunk-WAU5LSHP.js} +81 -438
  103. package/dist/bundle/{chunk-FIHXADRF.js → chunk-WB2KSQIP.js} +4 -4
  104. package/dist/bundle/{chunk-OI5DWZJG.js → chunk-WGZH2M64.js} +3 -3
  105. package/dist/bundle/chunk-WVN2KTNS.js +52 -0
  106. package/dist/bundle/{chunk-UKE3CGHK.js → chunk-XYQVVW4R.js} +1 -1
  107. package/dist/bundle/{chunk-7NVPM55S.js → chunk-YDDI4QIT.js} +2203 -1808
  108. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  109. package/dist/bundle/{chunk-7YZPBAQX.js → chunk-YUDVRFXN.js} +1 -1
  110. package/dist/bundle/{chunk-EY6S7FV3.js → chunk-YXYZAWWW.js} +6 -6
  111. package/dist/bundle/{chunk-GCCPFKSU.js → chunk-YYQ5GKAI.js} +9532 -10735
  112. package/dist/bundle/chunk-ZDYEOE7L.js +2366 -0
  113. package/dist/bundle/command-contract-L2FASWD6.js +41 -0
  114. package/dist/bundle/{command-server-entry-2SORMVRM.js → command-server-entry-VUR6WL77.js} +30 -27
  115. package/dist/bundle/{decode-5O7IEFPN.js → decode-I64PF2RM.js} +6 -6
  116. package/dist/bundle/{definitions-M3U4UYHN.js → definitions-MB65223J.js} +72 -18
  117. package/dist/bundle/{dispatch-YHQX6FEJ.js → dispatch-JQBAZWCL.js} +8 -8
  118. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  119. package/dist/bundle/{echarts-ARLMVQC7.js → echarts-YRRVLEX3.js} +2 -2
  120. package/dist/bundle/{embed-FUDUKQ3K.js → embed-BLXLKMK2.js} +7 -7
  121. package/dist/bundle/{embedder-HDRV7GX3.js → embedder-JYGF6R7I.js} +10 -10
  122. package/dist/bundle/{failure-JHXICWIL.js → failure-I6AAF5R5.js} +3 -3
  123. package/dist/bundle/first-run-YLDOZGY6.js +29 -0
  124. package/dist/bundle/first-screen-GZH3LMLZ.js +41 -0
  125. package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
  126. package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
  127. package/dist/bundle/hast-util-to-mdast-3CSMIWK2.js +2272 -0
  128. package/dist/bundle/{instructions-MEFIKCDI.js → instructions-AG7SRWTR.js} +1 -1
  129. package/dist/bundle/{mcp-VMS6PBCU.js → mcp-YGOAUNC3.js} +2 -2
  130. package/dist/bundle/{mdast-util-from-markdown-R66F4HZA.js → mdast-util-from-markdown-XCR5KW5S.js} +138 -195
  131. package/dist/bundle/{mdast-util-gfm-LN2ELINH.js → mdast-util-gfm-JO7PHUIB.js} +28 -357
  132. package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
  133. package/dist/bundle/mdast-util-to-markdown-DOXGHRI7.js +1854 -0
  134. package/dist/bundle/meeting-combined-OFQSGKBG.js +25 -0
  135. package/dist/bundle/meeting-model-K6NSX3O5.js +27 -0
  136. package/dist/bundle/{meeting-semantic-R4CSLVRG.js → meeting-semantic-3DZPHM7L.js} +7 -7
  137. package/dist/bundle/{micromark-extension-gfm-5X7YT43T.js → micromark-extension-gfm-PQ7DWZM7.js} +12 -78
  138. package/dist/bundle/{node-MAQALPLA.js → node-GJQYN4FT.js} +2 -2
  139. package/dist/bundle/{node-sqlite-J7IJYNBO.js → node-sqlite-7VXIRQPH.js} +8 -8
  140. package/dist/bundle/notes-search-ACDOPTNH.js +64 -0
  141. package/dist/bundle/notion.js +14 -14
  142. package/dist/bundle/oauth-N67CH2TK.js +20 -0
  143. package/dist/bundle/{open-AB27MTGR.js → open-JGXVHIKO.js} +6 -6
  144. package/dist/bundle/{openai-D77MU5XV.js → openai-PFQJTF4H.js} +21 -18
  145. package/dist/bundle/{process-SIOWTRJ6.js → process-MEKCZMX3.js} +1 -1
  146. package/dist/bundle/{program-7K34KI27.js → program-DUJYLJH5.js} +6947 -6532
  147. package/dist/bundle/{prompt-W77YDHA6.js → prompt-FW44QDHD.js} +6 -6
  148. package/dist/bundle/{recognize-3JAXQQ36.js → recognize-62TDQ6A7.js} +5 -5
  149. package/dist/bundle/{remote-PSOJXCXO.js → remote-7ONFD7GG.js} +12 -11
  150. package/dist/bundle/{rerank-EE44ZTGL.js → rerank-YOHQQJS4.js} +8 -8
  151. package/dist/bundle/{schemas-LBYUMBC6.js → schemas-IIGJ7DOP.js} +39 -60
  152. package/dist/bundle/{serve-XJMGAMFW.js → serve-ZCXGT5RB.js} +11 -11
  153. package/dist/bundle/{server-ASU6CP5R.js → server-RQ74M637.js} +78 -56
  154. package/dist/bundle/server-XMZF57WM.js +90 -0
  155. package/dist/bundle/{services-PT4PA4J6.js → services-FWBRZ57M.js} +105 -90
  156. package/dist/bundle/{sqlite-runtime-YHXRTVXE.js → sqlite-runtime-ZZBNGV5L.js} +7 -7
  157. package/dist/bundle/{state-T6ZKFWGD.js → state-GDDFO62Y.js} +7 -7
  158. package/dist/bundle/{store-E5EE25FY.js → store-D2LRIWEI.js} +24 -20
  159. package/dist/bundle/{store-3MUCZEI3.js → store-KQCLR57N.js} +32 -18
  160. package/dist/bundle/store-maintenance-command-CK2MU5M6.js +77 -0
  161. package/dist/bundle/surface-K4TPIQW7.js +76 -0
  162. package/dist/commands/account.d.ts +3 -0
  163. package/dist/commands/account.d.ts.map +1 -0
  164. package/dist/commands/account.js +22 -0
  165. package/dist/commands/account.js.map +1 -0
  166. package/dist/commands/api.d.ts +7 -2
  167. package/dist/commands/api.d.ts.map +1 -1
  168. package/dist/commands/api.js +19 -119
  169. package/dist/commands/api.js.map +1 -1
  170. package/dist/commands/library.d.ts.map +1 -1
  171. package/dist/commands/library.js +16 -5
  172. package/dist/commands/library.js.map +1 -1
  173. package/dist/config.d.ts +11 -13
  174. package/dist/config.d.ts.map +1 -1
  175. package/dist/config.js +63 -54
  176. package/dist/config.js.map +1 -1
  177. package/dist/generated/definitions.d.ts.map +1 -1
  178. package/dist/generated/definitions.js +72 -18
  179. package/dist/generated/definitions.js.map +1 -1
  180. package/dist/generated/manifest.d.ts +4 -1
  181. package/dist/generated/manifest.d.ts.map +1 -1
  182. package/dist/generated/manifest.js +69 -0
  183. package/dist/generated/manifest.js.map +1 -1
  184. package/dist/generated/schemas.d.ts.map +1 -1
  185. package/dist/generated/schemas.js +32 -32
  186. package/dist/generated/schemas.js.map +1 -1
  187. package/dist/generated/types.d.ts +125 -25
  188. package/dist/generated/types.d.ts.map +1 -1
  189. package/dist/knowledge.d.ts +1 -0
  190. package/dist/knowledge.d.ts.map +1 -1
  191. package/dist/knowledge.js +68 -2
  192. package/dist/knowledge.js.map +1 -1
  193. package/dist/library.d.ts +12 -1
  194. package/dist/library.d.ts.map +1 -1
  195. package/dist/library.js +35 -1
  196. package/dist/library.js.map +1 -1
  197. package/dist/notion/port.d.ts.map +1 -1
  198. package/dist/notion/port.js +1 -0
  199. package/dist/notion/port.js.map +1 -1
  200. package/dist/notion/reads.d.ts +13 -1
  201. package/dist/notion/reads.d.ts.map +1 -1
  202. package/dist/notion/reads.js +1 -1
  203. package/dist/program.d.ts.map +1 -1
  204. package/dist/program.js +19 -2
  205. package/dist/program.js.map +1 -1
  206. package/dist/sync/files.d.ts +19 -0
  207. package/dist/sync/files.d.ts.map +1 -1
  208. package/dist/sync/files.js.map +1 -1
  209. package/dist/sync/source.d.ts +1 -1
  210. package/dist/sync/source.d.ts.map +1 -1
  211. package/dist/sync/source.js +60 -55
  212. package/dist/sync/source.js.map +1 -1
  213. package/dist/sync/users.d.ts +22 -0
  214. package/dist/sync/users.d.ts.map +1 -0
  215. package/dist/sync/users.js +111 -0
  216. package/dist/sync/users.js.map +1 -0
  217. package/dist/version.d.ts +1 -1
  218. package/dist/version.js +1 -1
  219. package/package.json +4 -4
  220. package/dist/bundle/chunk-L62XTC7N.js +0 -726
  221. package/dist/bundle/chunk-SHTHNBHG.js +0 -2
  222. package/dist/bundle/command-contract-UBXS6NHI.js +0 -38
  223. package/dist/bundle/first-run-BGEFTXOE.js +0 -29
  224. package/dist/bundle/first-screen-F5F3VS6Y.js +0 -38
  225. package/dist/bundle/meeting-combined-HNSS3FQY.js +0 -24
  226. package/dist/bundle/meeting-model-REZVYGQW.js +0 -26
  227. package/dist/bundle/oauth-AMV4YGJD.js +0 -20
  228. package/dist/bundle/server-WSPQ5EOA.js +0 -72
  229. package/dist/bundle/store-maintenance-command-ZZ55BBBG.js +0 -63
@@ -11,7 +11,7 @@ import {
11
11
  pageSchema,
12
12
  reference,
13
13
  stepOf
14
- } from "./chunk-6GN7KU7X.js";
14
+ } from "./chunk-3LMW7U7F.js";
15
15
  import {
16
16
  array,
17
17
  boolean,
@@ -34,149 +34,18 @@ import {
34
34
  string,
35
35
  union,
36
36
  variant
37
- } from "./chunk-MVA5HVKL.js";
37
+ } from "./chunk-S4UUN6LD.js";
38
38
  import {
39
39
  CliError,
40
40
  isCliError,
41
41
  singleLine,
42
42
  visibleControls
43
- } from "./chunk-LIQMUDIZ.js";
43
+ } from "./chunk-HM6AMYHR.js";
44
44
  import {
45
45
  __name
46
46
  } from "./chunk-ZVVMGPBJ.js";
47
47
 
48
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/reference.js
49
- var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "expected meeting:<accountId>/<meetingId>[/<transcriptId>[/<cuePosition>]] with safe integer IDs"), "invalid");
50
- var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
51
- if (!Number.isSafeInteger(value) || value < minimum)
52
- throw invalid();
53
- return value;
54
- }, "integer");
55
- var formatMeetingReference = /* @__PURE__ */ __name((reference2) => {
56
- const parts = [integer2(reference2.accountId), integer2(reference2.meetingId)];
57
- if (reference2.transcriptId !== void 0)
58
- parts.push(integer2(reference2.transcriptId));
59
- if (reference2.cuePosition !== void 0) {
60
- if (reference2.transcriptId === void 0)
61
- throw invalid();
62
- parts.push(integer2(reference2.cuePosition, 0));
63
- }
64
- return `meeting:${parts.join("/")}`;
65
- }, "formatMeetingReference");
66
- var parseMeetingReference = /* @__PURE__ */ __name((text7) => {
67
- const value = text7.trim();
68
- if (!value.startsWith("meeting:"))
69
- throw invalid();
70
- const parts = value.slice(8).split("/");
71
- if (parts.length < 2 || parts.length > 4 || parts.some((part) => !/^\d+$/.test(part)))
72
- throw invalid();
73
- const ids2 = parts.map(Number);
74
- const reference2 = {
75
- type: "meeting",
76
- accountId: integer2(ids2[0]),
77
- meetingId: integer2(ids2[1]),
78
- ...ids2.length > 2 ? { transcriptId: integer2(ids2[2]) } : {},
79
- ...ids2.length > 3 ? { cuePosition: integer2(ids2[3], 0) } : {}
80
- };
81
- return reference2;
82
- }, "parseMeetingReference");
83
- var canonicalMeetingReference = /* @__PURE__ */ __name((text7) => formatMeetingReference(parseMeetingReference(text7)), "canonicalMeetingReference");
84
-
85
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/payment.js
86
- var FACT_TYPES = ["fact", "statement", "question", "decision", "promise"];
87
- var PAYMENT_DIRECTIONS = ["to_us", "from_us"];
88
- var PAYMENT_STATES = ["expected", "paid", "cancelled"];
89
- var invalid2 = /* @__PURE__ */ __name((message) => {
90
- throw new CliError("validation_error", message);
91
- }, "invalid");
92
- var CURRENCIES = new Set(Intl.supportedValuesOf("currency"));
93
- var AMOUNT = /^(\d{1,15})(?:\.(\d{1,2}))?$/;
94
- var COUNTERPARTY = /^(person|organization|project):[1-9]\d*$/;
95
- var amountOf = /* @__PURE__ */ __name((value) => {
96
- const match = AMOUNT.exec(typeof value === "number" ? String(value) : typeof value === "string" ? value.trim() : "");
97
- if (!match)
98
- return invalid2("a payment's amount is a positive number with at most 2 decimals, such as 1200.50");
99
- const amount = `${BigInt(match[1] ?? "0")}.${(match[2] ?? "").padEnd(2, "0")}`;
100
- if (amount === "0.00")
101
- return invalid2("a payment's amount is more than 0");
102
- return amount;
103
- }, "amountOf");
104
- var dateOf = /* @__PURE__ */ __name((value) => {
105
- const date = typeof value === "string" ? value.trim() : "";
106
- if (!/^\d{4}-\d{2}-\d{2}$/.test(date) || (/* @__PURE__ */ new Date(`${date}T00:00:00Z`)).toISOString().slice(0, 10) !== date)
107
- return invalid2("a payment's dates are ISO dates, such as 2026-10-31");
108
- return date;
109
- }, "dateOf");
110
- var optionalText = /* @__PURE__ */ __name((value, what, limit) => {
111
- if (value === void 0 || value === null)
112
- return null;
113
- if (typeof value !== "string" || !value.trim() || value.length > limit || value.includes("\0"))
114
- return invalid2(`a payment's ${what} takes 1\u2013${limit} characters`);
115
- return value.trim();
116
- }, "optionalText");
117
- var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
118
- if (typeof value !== "string" || !allowed.includes(value))
119
- return invalid2(`a payment's ${what} is one of ${allowed.join(", ")}`);
120
- return value;
121
- }, "oneOf");
122
- var FIELDS = [
123
- "amount",
124
- "currency",
125
- "direction",
126
- "counterparty",
127
- "counterparty_name",
128
- "due_at",
129
- "state",
130
- "item",
131
- "paid_at"
132
- ];
133
- var validatePayment = /* @__PURE__ */ __name((input) => {
134
- if (!input || typeof input !== "object" || Array.isArray(input))
135
- return invalid2("a payment is an object");
136
- const raw = input;
137
- const unknown = Object.keys(raw).filter((key) => !FIELDS.includes(key));
138
- if (unknown.length)
139
- return invalid2(`a payment has no field ${unknown.join(", ")}; its fields are ${FIELDS.join(", ")}`);
140
- const currency = typeof raw.currency === "string" ? raw.currency.trim().toUpperCase() : "";
141
- if (!/^[A-Z]{3}$/.test(currency) || !CURRENCIES.has(currency))
142
- return invalid2("a payment's currency is an ISO 4217 code, such as EUR or RUB");
143
- const counterparty = optionalText(raw.counterparty, "counterparty", 80);
144
- if (counterparty !== null && !COUNTERPARTY.test(counterparty))
145
- return invalid2("a payment's counterparty is a person:, organization: or project: reference");
146
- const state = oneOf(raw.state, PAYMENT_STATES, "state");
147
- if (raw.paid_at != null && state !== "paid")
148
- return invalid2("only a paid payment has paid_at");
149
- return {
150
- amount: amountOf(raw.amount),
151
- currency,
152
- direction: oneOf(raw.direction, PAYMENT_DIRECTIONS, "direction"),
153
- counterparty,
154
- counterparty_name: optionalText(raw.counterparty_name, "counterparty name", 200),
155
- due_at: raw.due_at === void 0 || raw.due_at === null ? null : dateOf(raw.due_at),
156
- state,
157
- item: optionalText(raw.item, "item", 200),
158
- // Left out when absent, so a finding staged before the field keeps its fingerprint.
159
- ...raw.paid_at == null ? {} : { paid_at: dateOf(raw.paid_at) }
160
- };
161
- }, "validatePayment");
162
- var grouped = /* @__PURE__ */ __name((amount) => {
163
- const [whole = "0", cents = "00"] = amount.split(".");
164
- const digits = whole.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
165
- return cents === "00" ? digits : `${digits}.${cents}`;
166
- }, "grouped");
167
- var paymentTitle = /* @__PURE__ */ __name((fact) => {
168
- const payment = fact.payment;
169
- if (!payment)
170
- return "";
171
- const who = payment.counterparty_name ?? payment.counterparty;
172
- const way = payment.direction === "to_us" ? "to us" : "from us";
173
- const party = who === null ? "" : payment.direction === "to_us" ? ` from ${who}` : ` to ${who}`;
174
- const due = payment.due_at === null ? "" : `, due ${payment.due_at.slice(8, 10)}.${payment.due_at.slice(5, 7)}`;
175
- const item = payment.item === null ? "" : ` for ${payment.item}`;
176
- return `${grouped(payment.amount)} ${payment.currency} ${way}${party}${item}${due} (${payment.state})`;
177
- }, "paymentTitle");
178
-
179
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
48
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
180
49
  var QUERY_LIMITS = {
181
50
  bytes: 8192,
182
51
  depth: 32,
@@ -220,7 +89,7 @@ function queryError(reason, span, alternative, context3 = {}, details = {}) {
220
89
  __name(queryError, "queryError");
221
90
  var walkQuery = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => walkQuery(node2)), "walkQuery");
222
91
 
223
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
92
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
224
93
  var timezoneOf = /* @__PURE__ */ __name((given) => {
225
94
  const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
226
95
  try {
@@ -370,141 +239,7 @@ var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclu
370
239
  };
371
240
  }, "dateRange");
372
241
 
373
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
374
- var wordsOf = /* @__PURE__ */ __name((text7) => text7.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
375
- var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
376
- var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
377
- var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
378
- if (!present(value))
379
- return false;
380
- if (node.operator === "wildcard" && node.value === "*")
381
- return true;
382
- const text7 = String(value);
383
- switch (field.type) {
384
- case "txt": {
385
- const words2 = wordsOf(text7);
386
- if (node.operator === "wildcard")
387
- return words2.some((word2) => pattern(node.value).test(word2));
388
- const wanted = wordsOf(node.value);
389
- return words2.some((_, at) => wanted.every((word2, offset) => words2[at + offset] === word2));
390
- }
391
- case "num": {
392
- const number2 = Number(value);
393
- if (node.operator !== "range")
394
- return number2 === Number(node.value);
395
- const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
396
- return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
397
- }
398
- case "time": {
399
- const time = Date.parse(text7);
400
- 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];
401
- const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
402
- return (range.lower === void 0 || (range.lower_inclusive ? time >= range.lower : time > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time <= range.upper : time < range.upper));
403
- }
404
- default:
405
- return node.operator === "wildcard" ? pattern(node.value).test(text7) : text7.toLowerCase() === node.value.toLowerCase();
406
- }
407
- }, "matchOne");
408
- var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
409
- if (node.kind === "boolean") {
410
- const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
411
- const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
412
- const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
413
- return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
414
- }
415
- const field = byName.get(node.field);
416
- if (!field)
417
- throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
418
- if (field.relation !== void 0) {
419
- if (!options.relation)
420
- throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
421
- return options.relation(node, item);
422
- }
423
- const value = item[node.field];
424
- return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
425
- }, "matches");
426
- var evaluate = /* @__PURE__ */ __name((ast, fields2, item, options = {}) => matches(ast.root, item, new Map(fields2.map((field) => [field.name, field])), options), "evaluate");
427
-
428
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
429
- var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
430
- var OPERATORS_BY_TYPE = {
431
- kw: ["term", "phrase", "wildcard"],
432
- txt: ["term", "phrase", "wildcard"],
433
- enum: ["term"],
434
- num: ["term", "range"],
435
- time: ["term", "range"],
436
- bool: ["term"],
437
- ref: ["term", "phrase"]
438
- };
439
- var QUERY_BACKENDS = ["sql", "native"];
440
- var unwrap = /* @__PURE__ */ __name((schema) => schema.wrapped ? unwrap(schema.wrapped) : schema, "unwrap");
441
- var REFERENCE_SOURCE = reference.pipe[1].requirement.source;
442
- var typeOf = /* @__PURE__ */ __name((schema) => {
443
- const plain = unwrap(schema);
444
- const actions = plain.pipe ?? [];
445
- switch (plain.type) {
446
- case "picklist":
447
- return { type: "enum", values: (plain.options ?? []).map(String) };
448
- case "number":
449
- return { type: "num" };
450
- case "boolean":
451
- return { type: "bool" };
452
- case "string":
453
- if (actions.some((action) => action.type === "iso_timestamp"))
454
- return { type: "time" };
455
- if (actions.some((action) => action.requirement instanceof RegExp && action.requirement.source === REFERENCE_SOURCE))
456
- return { type: "ref" };
457
- return { type: "kw" };
458
- case "array":
459
- return plain.item ? typeOf(plain.item) : void 0;
460
- default:
461
- return void 0;
462
- }
463
- }, "typeOf");
464
- var exampleOf = /* @__PURE__ */ __name((name, type, values) => ({
465
- kw: `${name}:abc`,
466
- txt: `${name}:word*`,
467
- enum: `${name}:${values?.[0] ?? "x"}`,
468
- num: `${name}>0`,
469
- time: `${name}>=7d`,
470
- bool: `${name}:true`,
471
- ref: `${name}:"note:42"`
472
- })[type], "exampleOf");
473
- var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
474
- const entries = unwrap(schema).entries ?? {};
475
- const excluded = new Set(annotations.exclude ?? []);
476
- const words2 = new Set(annotations.text ?? []);
477
- const native = new Set(annotations.native ?? []);
478
- const negatable = new Set(annotations.negatable ?? []);
479
- const finish = /* @__PURE__ */ __name((field) => ({
480
- ...field,
481
- operators: OPERATORS_BY_TYPE[field.type],
482
- example: annotations.examples?.[field.name] ?? field.example ?? exampleOf(field.name, field.type, field.values),
483
- ...native.has(field.name) ? { native: true } : {},
484
- ...negatable.has(field.name) ? { negatable: true } : {},
485
- ...annotations.validate?.[field.name] ? { validate: annotations.validate[field.name] } : {}
486
- }), "finish");
487
- const own = Object.entries(entries).flatMap(([name, entry]) => {
488
- if (excluded.has(name))
489
- return [];
490
- const found = typeOf(entry);
491
- if (!found)
492
- return [];
493
- return [finish({ name, ...found, ...words2.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
494
- });
495
- const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
496
- const states = annotations.states ? [
497
- finish({
498
- name: "is",
499
- type: "enum",
500
- values: Object.keys(annotations.states),
501
- relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
502
- })
503
- ] : [];
504
- return [...own, ...relations, ...states];
505
- }, "queryFieldsOf");
506
-
507
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
242
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
508
243
  var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
509
244
  var leftOut = /* @__PURE__ */ __name((fields2) => fields2.filter((field) => field.negatable).map((field) => field.name), "leftOut");
510
245
  var has = /* @__PURE__ */ __name((fields2, operator) => fields2.some((field) => field.operators.includes(operator)), "has");
@@ -541,7 +276,7 @@ var queryDescription = /* @__PURE__ */ __name((registry) => {
541
276
  return `${terms}; fields: ${fields2.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
542
277
  }, "queryDescription");
543
278
 
544
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
279
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
545
280
  var whitespace = /* @__PURE__ */ __name((c) => /[ \t\n\r\u3000]/u.test(c), "whitespace");
546
281
  var reserved = /* @__PURE__ */ new Set([
547
282
  "+",
@@ -850,7 +585,141 @@ var implicitTextTerms = /* @__PURE__ */ __name((text7) => {
850
585
  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] : []));
851
586
  }, "implicitTextTerms");
852
587
 
853
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
588
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
589
+ var wordsOf = /* @__PURE__ */ __name((text7) => text7.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
590
+ var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
591
+ var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
592
+ var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
593
+ if (!present(value))
594
+ return false;
595
+ if (node.operator === "wildcard" && node.value === "*")
596
+ return true;
597
+ const text7 = String(value);
598
+ switch (field.type) {
599
+ case "txt": {
600
+ const words2 = wordsOf(text7);
601
+ if (node.operator === "wildcard")
602
+ return words2.some((word2) => pattern(node.value).test(word2));
603
+ const wanted = wordsOf(node.value);
604
+ return words2.some((_, at) => wanted.every((word2, offset) => words2[at + offset] === word2));
605
+ }
606
+ case "num": {
607
+ const number2 = Number(value);
608
+ if (node.operator !== "range")
609
+ return number2 === Number(node.value);
610
+ const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
611
+ return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
612
+ }
613
+ case "time": {
614
+ const time = Date.parse(text7);
615
+ 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];
616
+ const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
617
+ return (range.lower === void 0 || (range.lower_inclusive ? time >= range.lower : time > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time <= range.upper : time < range.upper));
618
+ }
619
+ default:
620
+ return node.operator === "wildcard" ? pattern(node.value).test(text7) : text7.toLowerCase() === node.value.toLowerCase();
621
+ }
622
+ }, "matchOne");
623
+ var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
624
+ if (node.kind === "boolean") {
625
+ const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
626
+ const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
627
+ const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
628
+ return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
629
+ }
630
+ const field = byName.get(node.field);
631
+ if (!field)
632
+ throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
633
+ if (field.relation !== void 0) {
634
+ if (!options.relation)
635
+ throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
636
+ return options.relation(node, item);
637
+ }
638
+ const value = item[node.field];
639
+ return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
640
+ }, "matches");
641
+ var evaluate = /* @__PURE__ */ __name((ast, fields2, item, options = {}) => matches(ast.root, item, new Map(fields2.map((field) => [field.name, field])), options), "evaluate");
642
+
643
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
644
+ var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
645
+ var OPERATORS_BY_TYPE = {
646
+ kw: ["term", "phrase", "wildcard"],
647
+ txt: ["term", "phrase", "wildcard"],
648
+ enum: ["term"],
649
+ num: ["term", "range"],
650
+ time: ["term", "range"],
651
+ bool: ["term"],
652
+ ref: ["term", "phrase"]
653
+ };
654
+ var QUERY_BACKENDS = ["sql", "native"];
655
+ var unwrap = /* @__PURE__ */ __name((schema) => schema.wrapped ? unwrap(schema.wrapped) : schema, "unwrap");
656
+ var REFERENCE_SOURCE = reference.pipe[1].requirement.source;
657
+ var typeOf = /* @__PURE__ */ __name((schema) => {
658
+ const plain = unwrap(schema);
659
+ const actions = plain.pipe ?? [];
660
+ switch (plain.type) {
661
+ case "picklist":
662
+ return { type: "enum", values: (plain.options ?? []).map(String) };
663
+ case "number":
664
+ return { type: "num" };
665
+ case "boolean":
666
+ return { type: "bool" };
667
+ case "string":
668
+ if (actions.some((action) => action.type === "iso_timestamp"))
669
+ return { type: "time" };
670
+ if (actions.some((action) => action.requirement instanceof RegExp && action.requirement.source === REFERENCE_SOURCE))
671
+ return { type: "ref" };
672
+ return { type: "kw" };
673
+ case "array":
674
+ return plain.item ? typeOf(plain.item) : void 0;
675
+ default:
676
+ return void 0;
677
+ }
678
+ }, "typeOf");
679
+ var exampleOf = /* @__PURE__ */ __name((name, type, values) => ({
680
+ kw: `${name}:abc`,
681
+ txt: `${name}:word*`,
682
+ enum: `${name}:${values?.[0] ?? "x"}`,
683
+ num: `${name}>0`,
684
+ time: `${name}>=7d`,
685
+ bool: `${name}:true`,
686
+ ref: `${name}:"note:42"`
687
+ })[type], "exampleOf");
688
+ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
689
+ const entries = unwrap(schema).entries ?? {};
690
+ const excluded = new Set(annotations.exclude ?? []);
691
+ const words2 = new Set(annotations.text ?? []);
692
+ const native = new Set(annotations.native ?? []);
693
+ const negatable = new Set(annotations.negatable ?? []);
694
+ const finish = /* @__PURE__ */ __name((field) => ({
695
+ ...field,
696
+ operators: OPERATORS_BY_TYPE[field.type],
697
+ example: annotations.examples?.[field.name] ?? field.example ?? exampleOf(field.name, field.type, field.values),
698
+ ...native.has(field.name) ? { native: true } : {},
699
+ ...negatable.has(field.name) ? { negatable: true } : {},
700
+ ...annotations.validate?.[field.name] ? { validate: annotations.validate[field.name] } : {}
701
+ }), "finish");
702
+ const own = Object.entries(entries).flatMap(([name, entry]) => {
703
+ if (excluded.has(name))
704
+ return [];
705
+ const found = typeOf(entry);
706
+ if (!found)
707
+ return [];
708
+ return [finish({ name, ...found, ...words2.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
709
+ });
710
+ const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
711
+ const states = annotations.states ? [
712
+ finish({
713
+ name: "is",
714
+ type: "enum",
715
+ values: Object.keys(annotations.states),
716
+ relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
717
+ })
718
+ ] : [];
719
+ return [...own, ...relations, ...states];
720
+ }, "queryFieldsOf");
721
+
722
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
854
723
  var inContext = /* @__PURE__ */ __name((context3, run2) => {
855
724
  try {
856
725
  run2();
@@ -925,7 +794,7 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
925
794
  }, "validateQuery");
926
795
  var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
927
796
 
928
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
797
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
929
798
  var describeQuery = /* @__PURE__ */ __name((registry) => ({
930
799
  entity: registry.entity,
931
800
  backend: registry.backend,
@@ -996,7 +865,138 @@ var QUERY_REASONS = defineReasons([
996
865
  details: [...SPAN, ...details]
997
866
  })));
998
867
 
999
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/hit-query.js
868
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/reference.js
869
+ var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "expected meeting:<accountId>/<meetingId>[/<transcriptId>[/<cuePosition>]] with safe integer IDs"), "invalid");
870
+ var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
871
+ if (!Number.isSafeInteger(value) || value < minimum)
872
+ throw invalid();
873
+ return value;
874
+ }, "integer");
875
+ var formatMeetingReference = /* @__PURE__ */ __name((reference2) => {
876
+ const parts = [integer2(reference2.accountId), integer2(reference2.meetingId)];
877
+ if (reference2.transcriptId !== void 0)
878
+ parts.push(integer2(reference2.transcriptId));
879
+ if (reference2.cuePosition !== void 0) {
880
+ if (reference2.transcriptId === void 0)
881
+ throw invalid();
882
+ parts.push(integer2(reference2.cuePosition, 0));
883
+ }
884
+ return `meeting:${parts.join("/")}`;
885
+ }, "formatMeetingReference");
886
+ var parseMeetingReference = /* @__PURE__ */ __name((text7) => {
887
+ const value = text7.trim();
888
+ if (!value.startsWith("meeting:"))
889
+ throw invalid();
890
+ const parts = value.slice(8).split("/");
891
+ if (parts.length < 2 || parts.length > 4 || parts.some((part) => !/^\d+$/.test(part)))
892
+ throw invalid();
893
+ const ids2 = parts.map(Number);
894
+ const reference2 = {
895
+ type: "meeting",
896
+ accountId: integer2(ids2[0]),
897
+ meetingId: integer2(ids2[1]),
898
+ ...ids2.length > 2 ? { transcriptId: integer2(ids2[2]) } : {},
899
+ ...ids2.length > 3 ? { cuePosition: integer2(ids2[3], 0) } : {}
900
+ };
901
+ return reference2;
902
+ }, "parseMeetingReference");
903
+ var canonicalMeetingReference = /* @__PURE__ */ __name((text7) => formatMeetingReference(parseMeetingReference(text7)), "canonicalMeetingReference");
904
+
905
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/payment.js
906
+ var FACT_TYPES = ["fact", "statement", "question", "decision", "promise"];
907
+ var PAYMENT_DIRECTIONS = ["to_us", "from_us"];
908
+ var PAYMENT_STATES = ["expected", "paid", "cancelled"];
909
+ var invalid2 = /* @__PURE__ */ __name((message) => {
910
+ throw new CliError("validation_error", message);
911
+ }, "invalid");
912
+ var CURRENCIES = new Set(Intl.supportedValuesOf("currency"));
913
+ var AMOUNT = /^(\d{1,15})(?:\.(\d{1,2}))?$/;
914
+ var COUNTERPARTY = /^(person|organization|project):[1-9]\d*$/;
915
+ var amountOf = /* @__PURE__ */ __name((value) => {
916
+ const match = AMOUNT.exec(typeof value === "number" ? String(value) : typeof value === "string" ? value.trim() : "");
917
+ if (!match)
918
+ return invalid2("a payment's amount is a positive number with at most 2 decimals, such as 1200.50");
919
+ const amount = `${BigInt(match[1] ?? "0")}.${(match[2] ?? "").padEnd(2, "0")}`;
920
+ if (amount === "0.00")
921
+ return invalid2("a payment's amount is more than 0");
922
+ return amount;
923
+ }, "amountOf");
924
+ var dateOf = /* @__PURE__ */ __name((value) => {
925
+ const date = typeof value === "string" ? value.trim() : "";
926
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(date) || (/* @__PURE__ */ new Date(`${date}T00:00:00Z`)).toISOString().slice(0, 10) !== date)
927
+ return invalid2("a payment's dates are ISO dates, such as 2026-10-31");
928
+ return date;
929
+ }, "dateOf");
930
+ var optionalText = /* @__PURE__ */ __name((value, what, limit) => {
931
+ if (value === void 0 || value === null)
932
+ return null;
933
+ if (typeof value !== "string" || !value.trim() || value.length > limit || value.includes("\0"))
934
+ return invalid2(`a payment's ${what} takes 1\u2013${limit} characters`);
935
+ return value.trim();
936
+ }, "optionalText");
937
+ var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
938
+ if (typeof value !== "string" || !allowed.includes(value))
939
+ return invalid2(`a payment's ${what} is one of ${allowed.join(", ")}`);
940
+ return value;
941
+ }, "oneOf");
942
+ var FIELDS = [
943
+ "amount",
944
+ "currency",
945
+ "direction",
946
+ "counterparty",
947
+ "counterparty_name",
948
+ "due_at",
949
+ "state",
950
+ "item",
951
+ "paid_at"
952
+ ];
953
+ var validatePayment = /* @__PURE__ */ __name((input) => {
954
+ if (!input || typeof input !== "object" || Array.isArray(input))
955
+ return invalid2("a payment is an object");
956
+ const raw = input;
957
+ const unknown = Object.keys(raw).filter((key) => !FIELDS.includes(key));
958
+ if (unknown.length)
959
+ return invalid2(`a payment has no field ${unknown.join(", ")}; its fields are ${FIELDS.join(", ")}`);
960
+ const currency = typeof raw.currency === "string" ? raw.currency.trim().toUpperCase() : "";
961
+ if (!/^[A-Z]{3}$/.test(currency) || !CURRENCIES.has(currency))
962
+ return invalid2("a payment's currency is an ISO 4217 code, such as EUR or RUB");
963
+ const counterparty = optionalText(raw.counterparty, "counterparty", 80);
964
+ if (counterparty !== null && !COUNTERPARTY.test(counterparty))
965
+ return invalid2("a payment's counterparty is a person:, organization: or project: reference");
966
+ const state = oneOf(raw.state, PAYMENT_STATES, "state");
967
+ if (raw.paid_at != null && state !== "paid")
968
+ return invalid2("only a paid payment has paid_at");
969
+ return {
970
+ amount: amountOf(raw.amount),
971
+ currency,
972
+ direction: oneOf(raw.direction, PAYMENT_DIRECTIONS, "direction"),
973
+ counterparty,
974
+ counterparty_name: optionalText(raw.counterparty_name, "counterparty name", 200),
975
+ due_at: raw.due_at === void 0 || raw.due_at === null ? null : dateOf(raw.due_at),
976
+ state,
977
+ item: optionalText(raw.item, "item", 200),
978
+ // Left out when absent, so a finding staged before the field keeps its fingerprint.
979
+ ...raw.paid_at == null ? {} : { paid_at: dateOf(raw.paid_at) }
980
+ };
981
+ }, "validatePayment");
982
+ var grouped = /* @__PURE__ */ __name((amount) => {
983
+ const [whole = "0", cents = "00"] = amount.split(".");
984
+ const digits = whole.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
985
+ return cents === "00" ? digits : `${digits}.${cents}`;
986
+ }, "grouped");
987
+ var paymentTitle = /* @__PURE__ */ __name((fact) => {
988
+ const payment = fact.payment;
989
+ if (!payment)
990
+ return "";
991
+ const who = payment.counterparty_name ?? payment.counterparty;
992
+ const way = payment.direction === "to_us" ? "to us" : "from us";
993
+ const party = who === null ? "" : payment.direction === "to_us" ? ` from ${who}` : ` to ${who}`;
994
+ const due = payment.due_at === null ? "" : `, due ${payment.due_at.slice(8, 10)}.${payment.due_at.slice(5, 7)}`;
995
+ const item = payment.item === null ? "" : ` for ${payment.item}`;
996
+ return `${grouped(payment.amount)} ${payment.currency} ${way}${party}${item}${due} (${payment.state})`;
997
+ }, "paymentTitle");
998
+
999
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/hit-query.js
1000
1000
  var context = {
1001
1001
  command: "search meetings",
1002
1002
  guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md#\u0432\u0441\u0442\u0440\u0435\u0447\u0438"
@@ -1118,7 +1118,24 @@ var meetingWordsQuery = /* @__PURE__ */ __name((text7) => {
1118
1118
  return { version: 1, language: "lucene-v1", root };
1119
1119
  }, "meetingWordsQuery");
1120
1120
 
1121
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/passage.js
1121
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/search-store.js
1122
+ var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
1123
+ let before = Number.POSITIVE_INFINITY;
1124
+ for (; ; ) {
1125
+ signal?.throwIfAborted();
1126
+ const { indexed, remaining } = await meetings.indexSearch({
1127
+ accountId,
1128
+ limit: 1e3,
1129
+ maxReadBytes: 64 * 1024 ** 2,
1130
+ signal
1131
+ });
1132
+ if (remaining === 0 || indexed === 0 || remaining >= before)
1133
+ return;
1134
+ before = remaining;
1135
+ }
1136
+ }, "refreshMeetingIndex");
1137
+
1138
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/passage.js
1122
1139
  var meetingHitContextLimits = /* @__PURE__ */ __name((options = {}) => {
1123
1140
  const { before = 3, after = 3, bytes = 65536, max_read_bytes = 4194304, expected_fingerprint } = options;
1124
1141
  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)))
@@ -1139,7 +1156,7 @@ var validateMeetingPassage = /* @__PURE__ */ __name((reference2, options) => {
1139
1156
  throw new CliError("validation_error", "choose a cue reference and json, text or markdown output");
1140
1157
  }, "validateMeetingPassage");
1141
1158
 
1142
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/search/service-query.js
1159
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/search/service-query.js
1143
1160
  var BACKENDS = ["archive", "server", "both"];
1144
1161
  var MAX_BRANCHES = 64;
1145
1162
  var some = /* @__PURE__ */ __name((value) => value === void 0 ? [] : [value], "some");
@@ -1178,10 +1195,10 @@ var RELATIVE_TIME = /^\d+[mhd]$/i;
1178
1195
  var OFFSET = /(?:Z|[+-]\d{2}:?\d{2})$/i;
1179
1196
  var readsZone = /* @__PURE__ */ __name((ast, times) => walkQuery(ast.root).some((term) => times.has(term.field) && [term.value, term.upper].some((value) => value !== void 0 && value !== "*" && !RELATIVE_TIME.test(value) && !OFFSET.test(value))), "readsZone");
1180
1197
 
1181
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/model.js
1198
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/model.js
1182
1199
  var MEETING_CALL_DIRECTIONS = ["in", "out"];
1183
1200
 
1184
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/item.js
1201
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/item.js
1185
1202
  var text = string();
1186
1203
  var count = pipe(number(), integer(), minValue(0));
1187
1204
  var MEETING_ISSUES = ["time_without_zone"];
@@ -1281,7 +1298,7 @@ var MEETING_QUERY = {
1281
1298
  })
1282
1299
  };
1283
1300
 
1284
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/store.js
1301
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/store.js
1285
1302
  var MEETING_DOCUMENT_ROLES = ["transcript", "recording", "notes"];
1286
1303
  var TRANSCRIPT_WORDS = [
1287
1304
  "Transcript",
@@ -1293,7 +1310,7 @@ var TRANSCRIPT_WORDS = [
1293
1310
  ];
1294
1311
  var READ_BUDGET_EXCEEDED = "Meeting search exceeds its stored text byte budget";
1295
1312
 
1296
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/answers.js
1313
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/answers.js
1297
1314
  var text2 = string();
1298
1315
  var count2 = pipe(number(), integer(), minValue(0));
1299
1316
  var iso2 = /* @__PURE__ */ __name((ms2) => ms2 === null ? null : new Date(ms2).toISOString(), "iso");
@@ -1577,7 +1594,7 @@ var meetingHitsList = /* @__PURE__ */ __name((found, limit, command = "search me
1577
1594
  };
1578
1595
  }, "meetingHitsList");
1579
1596
 
1580
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/join-key.js
1597
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/join-key.js
1581
1598
  var joinKeyOf = /* @__PURE__ */ __name((url) => {
1582
1599
  const parsed = urlOf(url);
1583
1600
  if (!parsed)
@@ -1611,7 +1628,7 @@ var urlOf = /* @__PURE__ */ __name((url) => {
1611
1628
  }
1612
1629
  }, "urlOf");
1613
1630
 
1614
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/calendar-text.js
1631
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/calendar-text.js
1615
1632
  var ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'", apos: "'", nbsp: " " };
1616
1633
  var SECRET_LINE = /(?<![\p{L}\p{N}])(pass ?codes?|passwords?|pwd|pins?|access ?codes?|meeting ?codes?|kennwort|пароль|пин-?код|код доступа)(?![\p{L}\p{N}])|pwd=/iu;
1617
1634
  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");
@@ -1648,7 +1665,7 @@ var entryMetadata = /* @__PURE__ */ __name((metadata) => {
1648
1665
  return kept;
1649
1666
  }, "entryMetadata");
1650
1667
 
1651
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/calls.js
1668
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/calls.js
1652
1669
  var CALL_DIRECTIONS = ["incoming", "outgoing", "internal"];
1653
1670
  var CALL_OUTCOMES = ["answered", "voicemail", "busy", "no_answer", "failed"];
1654
1671
  var MISSED_OUTCOMES = ["voicemail", "busy", "no_answer"];
@@ -1717,7 +1734,7 @@ var callOf = /* @__PURE__ */ __name((stored) => {
1717
1734
  };
1718
1735
  }, "callOf");
1719
1736
 
1720
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/call-answers.js
1737
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/call-answers.js
1721
1738
  var count3 = pipe(number(), integer(), minValue(0));
1722
1739
  var ms = count3;
1723
1740
  var id = pipe(number(), integer(), minValue(1));
@@ -1800,7 +1817,7 @@ var callStatsSchema = strictObject({
1800
1817
  });
1801
1818
  var callStats = callStatsSchema;
1802
1819
 
1803
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/stats.js
1820
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/stats.js
1804
1821
  var MEETING_COUNTS_GROUPINGS = ["day", "week", "series"];
1805
1822
  var zoneOf = /* @__PURE__ */ __name((timeZone) => {
1806
1823
  const zone = timeZone ?? "UTC";
@@ -1935,7 +1952,7 @@ var aggregateMeetingStats = /* @__PURE__ */ __name((rows, timeZone) => {
1935
1952
  };
1936
1953
  }, "aggregateMeetingStats");
1937
1954
 
1938
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/call-stats.js
1955
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/call-stats.js
1939
1956
  var CALLBACK_WITHIN_MS = 24 * 60 * 60 * 1e3;
1940
1957
  var SHORT_CALL_UNDER_MS = 3e4;
1941
1958
  var MOST_MISSED = 100;
@@ -2125,7 +2142,7 @@ var aggregateCallStats = /* @__PURE__ */ __name((calls, options = {}) => {
2125
2142
  };
2126
2143
  }, "aggregateCallStats");
2127
2144
 
2128
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/cue-fingerprint.js
2145
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/cue-fingerprint.js
2129
2146
  import { createHash } from "node:crypto";
2130
2147
  var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256").update(JSON.stringify({
2131
2148
  reference: cue2.reference,
@@ -2139,7 +2156,7 @@ var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256"
2139
2156
  text: cue2.text
2140
2157
  })).digest("hex"), "meetingCueFingerprint");
2141
2158
 
2142
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/event-query.js
2159
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/event-query.js
2143
2160
  var EVENT_QUERY = defineQuery({
2144
2161
  entity: "event",
2145
2162
  backend: "sql",
@@ -2155,7 +2172,7 @@ var EVENT_QUERY = defineQuery({
2155
2172
  ]
2156
2173
  });
2157
2174
 
2158
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/event-store.js
2175
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/event-store.js
2159
2176
  var PARTICIPANT_RESPONSES = ["needs-action", "accepted", "tentative", "declined", "delegated"];
2160
2177
  var UNTIL = /(?:^|;)UNTIL=(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?(?:;|$)/iu;
2161
2178
  var seriesEnd = /* @__PURE__ */ __name((entry) => {
@@ -2179,7 +2196,7 @@ var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
2179
2196
  return Math.max(entry.endsAt ?? start, start + 1) > window.from;
2180
2197
  }, "entryInWindow");
2181
2198
 
2182
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/events.js
2199
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/events.js
2183
2200
  var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now(), { create = true } = {}) => {
2184
2201
  const current = await store.meeting(details.meeting.id);
2185
2202
  if (!current)
@@ -2224,7 +2241,7 @@ var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now(),
2224
2241
  return (await store.events()).find((e) => e.id === linked?.meeting.eventId) ?? null;
2225
2242
  }, "linkEvent");
2226
2243
 
2227
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/participant-search.js
2244
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/participant-search.js
2228
2245
  var normalizeMeetingParticipantQuery = /* @__PURE__ */ __name((text7) => text7.normalize("NFKC").toLowerCase(), "normalizeMeetingParticipantQuery");
2229
2246
  var validateMeetingParticipantQuery = /* @__PURE__ */ __name((query) => {
2230
2247
  if (typeof query !== "string" || !query.trim() || query.length > 500 || query.includes("\0"))
@@ -2248,7 +2265,7 @@ var validateMeetingParticipantSearch = /* @__PURE__ */ __name((query, input) =>
2248
2265
  };
2249
2266
  }, "validateMeetingParticipantSearch");
2250
2267
 
2251
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/reads.js
2268
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/reads.js
2252
2269
  var MeetingError = class extends CliError {
2253
2270
  static {
2254
2271
  __name(this, "MeetingError");
@@ -2387,7 +2404,7 @@ var meetingSummaryAnswer = /* @__PURE__ */ __name(async (store, id5, accountId)
2387
2404
  return wholeList(details.summaries.map((one) => meetingSummaryItem(details.meeting.accountId, one)));
2388
2405
  }, "meetingSummaryAnswer");
2389
2406
 
2390
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/export.js
2407
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/export.js
2391
2408
  var timestamp = /* @__PURE__ */ __name((milliseconds2) => {
2392
2409
  if (!Number.isSafeInteger(milliseconds2) || milliseconds2 < 0)
2393
2410
  throw new MeetingError("validation_error", "transcript times must be nonnegative integer milliseconds");
@@ -2484,10 +2501,10 @@ var exportMeeting = /* @__PURE__ */ __name(async (store, id5, options) => {
2484
2501
  };
2485
2502
  }, "exportMeeting");
2486
2503
 
2487
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
2504
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
2488
2505
  import { createHash as createHash2 } from "node:crypto";
2489
2506
 
2490
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/timestamp.js
2507
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/timestamp.js
2491
2508
  var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
2492
2509
  if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T.+(?:Z|[+-]\d{2}:\d{2})$/i.test(value) || !Number.isFinite(Date.parse(value)))
2493
2510
  throw new CliError("validation_error", `${name} must be an ISO timestamp with a timezone, such as 2026-11-09T09:00:00Z`);
@@ -2498,7 +2515,7 @@ var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
2498
2515
  return new Date(value).toISOString();
2499
2516
  }, "meetingTimestamp");
2500
2517
 
2501
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
2518
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/findings-rules.js
2502
2519
  var TASK_TYPES = ["bug", "feature", "chore"];
2503
2520
  var invalid3 = /* @__PURE__ */ __name((message) => {
2504
2521
  throw new CliError("validation_error", message);
@@ -2673,7 +2690,7 @@ var validateBatch = /* @__PURE__ */ __name((input, rules, most, one) => {
2673
2690
  var validateFindings = /* @__PURE__ */ __name((input, rules) => validateBatch(input, rules, 16, (finding, ids2) => validateFinding(finding, rules, ids2)), "validateFindings");
2674
2691
  var findingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "findingFingerprint");
2675
2692
 
2676
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/findings.js
2693
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/findings.js
2677
2694
  var MEETING_FINDINGS_KIND = "meeting_findings";
2678
2695
  var cue = /* @__PURE__ */ __name((raw) => {
2679
2696
  const reference2 = canonicalMeetingReference(raw);
@@ -2684,7 +2701,7 @@ var cue = /* @__PURE__ */ __name((raw) => {
2684
2701
  var validateMeetingFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "meeting findings", singular: "meeting finding", cited: "cue", reference: cue }), "validateMeetingFindings");
2685
2702
  var meetingFindingFingerprint = findingFingerprint;
2686
2703
 
2687
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/language.js
2704
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/language.js
2688
2705
  var LATIN_WORDS = {
2689
2706
  en: ["the", "and", "is", "that", "you", "this", "what", "have", "with", "are"],
2690
2707
  es: ["el", "los", "las", "por", "pero", "para", "est\xE1", "muy", "tambi\xE9n", "hay"],
@@ -2723,54 +2740,270 @@ var transcriptLanguage = /* @__PURE__ */ __name((texts) => {
2723
2740
  latin += countOf(text7, LATIN);
2724
2741
  ukrainian += countOf(text7, UKRAINIAN);
2725
2742
  }
2726
- const letters = cyrillic + latin;
2727
- if (letters < MIN_LETTERS)
2728
- return null;
2729
- if (cyrillic / letters >= DOMINANT)
2730
- return ukrainian / cyrillic >= 0.01 ? "uk" : "ru";
2731
- if (latin / letters >= DOMINANT)
2732
- return latinLanguage(all);
2733
- return null;
2734
- }, "transcriptLanguage");
2735
-
2736
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/ingest.js
2737
- var contentHash = /* @__PURE__ */ __name(async (text7) => {
2738
- const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text7));
2739
- return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
2740
- }, "contentHash");
2741
- var speakerPosition = /* @__PURE__ */ __name((name, participants) => {
2742
- if (name === null)
2743
- return null;
2744
- const matches2 = participants.flatMap((p, i) => p.displayName === name ? [i] : []);
2745
- return matches2.length === 1 ? matches2[0] ?? null : null;
2746
- }, "speakerPosition");
2747
- var transcriptInput = /* @__PURE__ */ __name(async (lines, participants, source, hashText = JSON.stringify(lines), format = null) => ({
2748
- source,
2749
- format,
2750
- language: transcriptLanguage(lines.map((line2) => line2.text)),
2751
- contentHash: await contentHash(hashText),
2752
- externalCreatedAt: null,
2753
- metadata: null,
2754
- deletedAt: null,
2755
- rows: lines.map((line2, position) => ({
2756
- position,
2757
- startMs: line2.startMs,
2758
- endMs: line2.endMs,
2759
- speakerParticipantPosition: speakerPosition(line2.speaker, participants),
2760
- speakerName: line2.speaker,
2761
- text: line2.text,
2762
- normalizedText: null,
2763
- metadata: null
2764
- }))
2765
- }), "transcriptInput");
2766
- var timestamp2 = /* @__PURE__ */ __name((value) => {
2767
- const time = Date.parse(value);
2768
- if (!Number.isFinite(time))
2769
- throw new Error("Invalid meeting timestamp");
2770
- return time;
2771
- }, "timestamp");
2743
+ const letters = cyrillic + latin;
2744
+ if (letters < MIN_LETTERS)
2745
+ return null;
2746
+ if (cyrillic / letters >= DOMINANT)
2747
+ return ukrainian / cyrillic >= 0.01 ? "uk" : "ru";
2748
+ if (latin / letters >= DOMINANT)
2749
+ return latinLanguage(all);
2750
+ return null;
2751
+ }, "transcriptLanguage");
2752
+
2753
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/ingest.js
2754
+ var contentHash = /* @__PURE__ */ __name(async (text7) => {
2755
+ const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text7));
2756
+ return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
2757
+ }, "contentHash");
2758
+ var speakerPosition = /* @__PURE__ */ __name((name, participants) => {
2759
+ if (name === null)
2760
+ return null;
2761
+ const matches2 = participants.flatMap((p, i) => p.displayName === name ? [i] : []);
2762
+ return matches2.length === 1 ? matches2[0] ?? null : null;
2763
+ }, "speakerPosition");
2764
+ var transcriptInput = /* @__PURE__ */ __name(async (lines, participants, source, hashText = JSON.stringify(lines), format = null) => ({
2765
+ source,
2766
+ format,
2767
+ language: transcriptLanguage(lines.map((line2) => line2.text)),
2768
+ contentHash: await contentHash(hashText),
2769
+ externalCreatedAt: null,
2770
+ metadata: null,
2771
+ deletedAt: null,
2772
+ rows: lines.map((line2, position) => ({
2773
+ position,
2774
+ startMs: line2.startMs,
2775
+ endMs: line2.endMs,
2776
+ speakerParticipantPosition: speakerPosition(line2.speaker, participants),
2777
+ speakerName: line2.speaker,
2778
+ text: line2.text,
2779
+ normalizedText: null,
2780
+ metadata: null
2781
+ }))
2782
+ }), "transcriptInput");
2783
+ var timestamp2 = /* @__PURE__ */ __name((value) => {
2784
+ const time = Date.parse(value);
2785
+ if (!Number.isFinite(time))
2786
+ throw new Error("Invalid meeting timestamp");
2787
+ return time;
2788
+ }, "timestamp");
2789
+
2790
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/pull.js
2791
+ var participantInput = /* @__PURE__ */ __name((p, provider, occurrenceId2, position, accountId) => {
2792
+ const { identityExternalId, phone, ...fields2 } = p;
2793
+ const externalId = identityExternalId ?? (p.email ? `email:${p.email.toLowerCase()}` : p.externalId) ?? `name:${p.displayName ?? "unknown"}@${accountId}/${occurrenceId2}:${position}`;
2794
+ return {
2795
+ ...fields2,
2796
+ identity: {
2797
+ provider,
2798
+ externalId,
2799
+ name: p.displayName,
2800
+ ...phone?.trim() ? { phone } : {},
2801
+ metadata: p.metadata,
2802
+ associatePerson: Boolean(identityExternalId?.trim() || p.email?.trim() || p.externalId?.trim())
2803
+ }
2804
+ };
2805
+ }, "participantInput");
2806
+ var participantInputs = /* @__PURE__ */ __name((provider, occurrenceId2, list, accountId) => list.map((p, i) => participantInput(p, provider, occurrenceId2, i, accountId)), "participantInputs");
2807
+ var sourceMeetingInput = /* @__PURE__ */ __name((m, accountId, participantsCount, kept) => {
2808
+ const startedAt = timestamp2(m.occurrence.startedAt);
2809
+ const given = m.occurrence.endedAt === null ? null : timestamp2(m.occurrence.endedAt);
2810
+ if (given !== null && given < startedAt)
2811
+ throw new Error("Meeting ends before it starts");
2812
+ const keptEnd = kept?.endedAt ?? null;
2813
+ const endedAt = given ?? (keptEnd !== null && keptEnd >= startedAt ? keptEnd : null);
2814
+ const count7 = participantsCount === null && kept ? kept.participantsCount : participantsCount;
2815
+ const metadata = kept?.metadata && m.metadata ? { ...kept.metadata, ...m.metadata } : m.metadata ?? kept?.metadata ?? null;
2816
+ const meeting2 = {
2817
+ accountId,
2818
+ externalId: m.occurrence.id,
2819
+ title: m.occurrence.title,
2820
+ description: m.description ?? kept?.description ?? null,
2821
+ location: m.location ?? kept?.location ?? null,
2822
+ joinUrl: m.joinUrl ?? m.series?.joinUrl ?? kept?.joinUrl ?? null,
2823
+ startedAt,
2824
+ endedAt,
2825
+ durationMs: endedAt === null ? null : endedAt - startedAt,
2826
+ timezone: m.timezone ?? kept?.timezone ?? null,
2827
+ hostIdentityId: kept?.hostIdentityId ?? null,
2828
+ ...count7 === void 0 ? {} : { participantsCount: count7 },
2829
+ ...m.call ? { direction: m.call.direction ?? null, clientPhone: m.call.clientPhone ?? null } : {},
2830
+ metadata,
2831
+ deletedAt: null
2832
+ };
2833
+ if (m.series)
2834
+ meeting2.series = {
2835
+ externalId: m.series.id,
2836
+ title: m.series.title,
2837
+ description: null,
2838
+ kind: m.series.kind ?? null,
2839
+ recurrence: m.series.recurrence ?? null,
2840
+ hostIdentityId: null,
2841
+ joinUrl: m.series.joinUrl ?? null,
2842
+ metadata: null,
2843
+ deletedAt: null
2844
+ };
2845
+ return meeting2;
2846
+ }, "sourceMeetingInput");
2847
+ var saveSourceMeeting = /* @__PURE__ */ __name(async (source, store, m, parts, { accountId, now, kept }) => {
2848
+ const id5 = m.occurrence.id;
2849
+ const { participants: sourceParticipants, transcript: lines, chat, summary } = parts;
2850
+ const participants = participantInputs(source.provider, id5, sourceParticipants ?? [], accountId);
2851
+ const meeting2 = sourceMeetingInput(m, accountId, sourceParticipants === void 0 ? void 0 : sourceParticipants?.length ?? null, kept);
2852
+ const linked = sourceParticipants !== void 0;
2853
+ const format = source.transcriptFormat ?? null;
2854
+ const transcripts = lines && linked ? [await transcriptInput(lines, participants, source.name, void 0, format)] : void 0;
2855
+ const details = await store.saveMeeting({
2856
+ meeting: meeting2,
2857
+ participants: sourceParticipants ? participants : void 0,
2858
+ transcripts,
2859
+ chat: chat?.map((line2) => ({
2860
+ externalId: null,
2861
+ sentAt: timestamp2(line2.sentAt),
2862
+ senderParticipantPosition: speakerPosition(line2.sender, participants),
2863
+ senderName: line2.sender,
2864
+ recipient: null,
2865
+ text: line2.text,
2866
+ normalizedText: null,
2867
+ metadata: null
2868
+ })),
2869
+ summaries: summary ? [
2870
+ {
2871
+ ...summary,
2872
+ source: summary.source ?? source.name,
2873
+ content: summary.content ?? null,
2874
+ docUrl: summary.docUrl ?? null,
2875
+ externalCreatedAt: summary.externalCreatedAt ?? null,
2876
+ externalUpdatedAt: summary.externalUpdatedAt ?? null,
2877
+ metadata: summary.metadata ?? null
2878
+ }
2879
+ ] : void 0,
2880
+ attachments: parts.files ?? void 0,
2881
+ documents: parts.documents ?? void 0,
2882
+ now
2883
+ });
2884
+ if (lines && !linked && !details.transcripts.some((t) => t.transcript.source === source.name && t.transcript.supersededAt === null))
2885
+ await store.saveMeeting({
2886
+ meeting: meeting2,
2887
+ transcripts: [await transcriptInput(lines, [], source.name, `${JSON.stringify(lines)}
2888
+ unlinked`, format)],
2889
+ now
2890
+ });
2891
+ await linkEvent(store, details, now, { create: source.createsEvents !== false });
2892
+ return details;
2893
+ }, "saveSourceMeeting");
2894
+ var startOf = /* @__PURE__ */ __name((m) => {
2895
+ const at = Date.parse(m.occurrence.startedAt);
2896
+ return Number.isFinite(at) ? at : Number.POSITIVE_INFINITY;
2897
+ }, "startOf");
2898
+ var indexSaved = /* @__PURE__ */ __name(async (store, accountIds, report) => {
2899
+ const indexSearch = store.indexSearch?.bind(store);
2900
+ if (!indexSearch || report.meetings === 0)
2901
+ return;
2902
+ for (const accountId of new Set(accountIds))
2903
+ try {
2904
+ await refreshMeetingIndex({ indexSearch }, accountId);
2905
+ } catch (error) {
2906
+ report.warnings.push({
2907
+ externalId: String(accountId),
2908
+ message: `search index not updated: ${error instanceof Error ? error.message : "failed"}`
2909
+ });
2910
+ }
2911
+ }, "indexSaved");
2912
+ var pull = /* @__PURE__ */ __name(async (source, store, options) => {
2913
+ const now = options.now ?? Date.now();
2914
+ for (const [name, ms2] of [
2915
+ ["lookbackMs", options.lookbackMs ?? 0],
2916
+ ["overlapMs", source.overlapMs ?? 0]
2917
+ ])
2918
+ if (!Number.isSafeInteger(ms2) || ms2 < 0 || ms2 > 31 * 864e5)
2919
+ throw new Error(`${name} must be an integer from 0 through 31 days`);
2920
+ const lookbackMs = Math.max(options.lookbackMs ?? 0, source.overlapMs ?? 0);
2921
+ const cursor = options.rescan ? void 0 : await store.cursor(options.accountId);
2922
+ const since = options.since ?? cursor ?? new Date(now - 30 * 864e5).toISOString();
2923
+ timestamp2(since);
2924
+ const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
2925
+ let failed = false;
2926
+ let firstFailed;
2927
+ const callers = /* @__PURE__ */ new Set();
2928
+ const linkCallers = /* @__PURE__ */ __name(async () => {
2929
+ if (callers.size === 0 || !store.linkCallers)
2930
+ return;
2931
+ try {
2932
+ await store.linkCallers(source.provider, [...callers]);
2933
+ } catch (error) {
2934
+ report.warnings.push({
2935
+ externalId: source.provider,
2936
+ message: `callers not linked to people: ${error instanceof Error ? error.message : "failed"}`
2937
+ });
2938
+ }
2939
+ }, "linkCallers");
2940
+ const from = timestamp2(since) - lookbackMs;
2941
+ const meetings = (await source.meetings(lookbackMs === 0 ? since : new Date(from).toISOString())).toSorted((a, b) => startOf(a) - startOf(b));
2942
+ for (const [index, m] of meetings.entries()) {
2943
+ const stop = options.budget?.take() ?? null;
2944
+ if (stop) {
2945
+ report.stopped = stop;
2946
+ report.remaining = meetings.length - index;
2947
+ const reached = Math.min(startOf(m), firstFailed ?? Number.POSITIVE_INFINITY);
2948
+ if (Number.isFinite(reached) && reached > timestamp2(since))
2949
+ await store.setCursor(options.accountId, new Date(reached).toISOString(), now);
2950
+ await linkCallers();
2951
+ return report;
2952
+ }
2953
+ const id5 = m.occurrence.id;
2954
+ const failedHere = /* @__PURE__ */ __name(() => {
2955
+ failed = true;
2956
+ firstFailed ??= startOf(m);
2957
+ }, "failedHere");
2958
+ const read = /* @__PURE__ */ __name(async (part, call) => {
2959
+ try {
2960
+ return await call();
2961
+ } catch (error) {
2962
+ failedHere();
2963
+ const message = error instanceof Error ? error.message : "could not be read";
2964
+ report.warnings.push({ externalId: id5, message: `${part}: ${message}` });
2965
+ return void 0;
2966
+ }
2967
+ }, "read");
2968
+ try {
2969
+ const sourceParticipants = await read("participants", () => source.participants(id5));
2970
+ const participants = participantInputs(source.provider, id5, sourceParticipants ?? [], options.accountId);
2971
+ const names = /* @__PURE__ */ new Map();
2972
+ for (const p of participants)
2973
+ if (p.displayName !== null) {
2974
+ const identities = names.get(p.displayName) ?? /* @__PURE__ */ new Set();
2975
+ identities.add(p.identity.externalId);
2976
+ names.set(p.displayName, identities);
2977
+ }
2978
+ if ([...names.values()].some((ids2) => ids2.size > 1))
2979
+ report.warnings.push({ externalId: id5, message: "Participant names are ambiguous" });
2980
+ const lines = await read("transcript", () => source.transcript(id5));
2981
+ const chat = await read("chat", () => source.chat(id5));
2982
+ const summary = await read("summary", () => source.summary(id5));
2983
+ const attachments = await read("files", () => source.files(id5));
2984
+ const listDocuments = source.documents?.bind(source);
2985
+ const documents = listDocuments ? await read("documents", () => listDocuments(id5)) : void 0;
2986
+ await saveSourceMeeting(source, store, m, { participants: sourceParticipants, transcript: lines, chat, summary, files: attachments, documents }, { accountId: options.accountId, now });
2987
+ for (const p of participants)
2988
+ if (p.identity.phone)
2989
+ callers.add(p.identity.externalId);
2990
+ report.meetings++;
2991
+ report.participants += participants.length;
2992
+ report.transcriptRows += lines?.length ?? 0;
2993
+ report.summaries += summary ? 1 : 0;
2994
+ } catch (error) {
2995
+ failedHere();
2996
+ report.warnings.push({ externalId: id5, message: error instanceof Error ? error.message : "Meeting pull failed" });
2997
+ }
2998
+ }
2999
+ await linkCallers();
3000
+ await indexSaved(store, [options.accountId], report);
3001
+ if (!failed)
3002
+ await store.setCursor(options.accountId, new Date(now).toISOString(), now);
3003
+ return report;
3004
+ }, "pull");
2772
3005
 
2773
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/transcript-text.js
3006
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/transcript-text.js
2774
3007
  var TranscriptTextError = class extends Error {
2775
3008
  static {
2776
3009
  __name(this, "TranscriptTextError");
@@ -2825,7 +3058,7 @@ var parseTranscriptText = /* @__PURE__ */ __name((input) => {
2825
3058
  return { header, lines };
2826
3059
  }, "parseTranscriptText");
2827
3060
 
2828
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/vtt.js
3061
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/vtt.js
2829
3062
  var VttError = class extends Error {
2830
3063
  static {
2831
3064
  __name(this, "VttError");
@@ -2877,7 +3110,7 @@ var parseVtt = /* @__PURE__ */ __name((input) => {
2877
3110
  return cues;
2878
3111
  }, "parseVtt");
2879
3112
 
2880
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/import.js
3113
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/import.js
2881
3114
  var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now()) => {
2882
3115
  const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
2883
3116
  for (const file of files) {
@@ -2903,6 +3136,7 @@ var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now())
2903
3136
  });
2904
3137
  }
2905
3138
  }
3139
+ await indexSaved(store, files.map((file) => file.meeting.accountId), report);
2906
3140
  const zones = new Set(files.map((file) => file.meeting.timezone).filter((zone2) => zone2 !== null && zone2 !== void 0));
2907
3141
  const [zone] = zones;
2908
3142
  if (zones.size === 1 && zone)
@@ -2910,10 +3144,10 @@ var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now())
2910
3144
  return report;
2911
3145
  }, "importFiles");
2912
3146
 
2913
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/links.js
3147
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/links.js
2914
3148
  var CHAT_MESSAGES_READ = 1e5;
2915
3149
 
2916
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/provider.js
3150
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/provider.js
2917
3151
  var snapshotMeetingScope = /* @__PURE__ */ __name((scope2) => {
2918
3152
  const provider = scope2?.provider;
2919
3153
  const account = scope2?.account;
@@ -2922,7 +3156,7 @@ var snapshotMeetingScope = /* @__PURE__ */ __name((scope2) => {
2922
3156
  return Object.freeze({ provider, account });
2923
3157
  }, "snapshotMeetingScope");
2924
3158
 
2925
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/meeting-management.js
3159
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/meeting-management.js
2926
3160
  var MEETING_FIELD_KEYS = Object.freeze({
2927
3161
  title: "title",
2928
3162
  kind: "kind",
@@ -2954,7 +3188,7 @@ var dispatchMeetingMutation = /* @__PURE__ */ __name(async (options, dispatch) =
2954
3188
  return { applied: true, value: await dispatch(signal) };
2955
3189
  }, "dispatchMeetingMutation");
2956
3190
 
2957
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/meeting-context.js
3191
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/meeting-context.js
2958
3192
  var id2 = /* @__PURE__ */ __name((value) => {
2959
3193
  if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)
2960
3194
  throw new CliError("validation_error", "meeting context identifiers must be positive integers");
@@ -3076,7 +3310,7 @@ var createMeetingContext = /* @__PURE__ */ __name((scope2, accountId, ports) =>
3076
3310
  };
3077
3311
  }, "createMeetingContext");
3078
3312
 
3079
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/preparation-context.js
3313
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/preparation-context.js
3080
3314
  var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
3081
3315
  if (!original || typeof original !== "object" || Array.isArray(original))
3082
3316
  throw new CliError("validation_error", "meeting preparation context is required");
@@ -3101,7 +3335,7 @@ var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
3101
3335
  return { ...input, limit, maxReadBytes };
3102
3336
  }, "validateMeetingPreparationContext");
3103
3337
 
3104
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-answer.js
3338
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-answer.js
3105
3339
  var count4 = pipe(number(), integer(), minValue(0));
3106
3340
  var id3 = pipe(string(), minLength(1));
3107
3341
  var meetingProjectEvidence = strictObject({
@@ -3222,7 +3456,7 @@ var meetingProjectEvidenceAnswer = /* @__PURE__ */ __name((page, prepared, comma
3222
3456
  };
3223
3457
  }, "meetingProjectEvidenceAnswer");
3224
3458
 
3225
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/search-validation.js
3459
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/search-validation.js
3226
3460
  var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
3227
3461
  const integer3 = /* @__PURE__ */ __name((value, low, high) => Number.isSafeInteger(value) && value >= low && value <= high, "integer");
3228
3462
  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) || [
@@ -3242,7 +3476,7 @@ var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
3242
3476
  throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
3243
3477
  }, "validateMeetingHitSearch");
3244
3478
 
3245
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-query.js
3479
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/project-evidence-query.js
3246
3480
  var ids = {
3247
3481
  meeting_id: "meetingId",
3248
3482
  identity_id: "participantIdentityId",
@@ -3333,7 +3567,7 @@ var prepareMeetingProjectEvidence = /* @__PURE__ */ __name((project, request = {
3333
3567
  return { project: project.trim(), options, query: frozen.join(" AND ") };
3334
3568
  }, "prepareMeetingProjectEvidence");
3335
3569
 
3336
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/project-evidence.js
3570
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/project-evidence.js
3337
3571
  var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project, request = {}, now = Date.now()) => {
3338
3572
  const prepared = prepareMeetingProjectEvidence(project, request, now);
3339
3573
  const page = await read(prepared.project, prepared.options);
@@ -3341,208 +3575,7 @@ var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project, re
3341
3575
  return meetingProjectEvidenceAnswer(page, prepared);
3342
3576
  }, "readMeetingProjectEvidence");
3343
3577
 
3344
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/pull.js
3345
- var participantInput = /* @__PURE__ */ __name((p, provider, occurrenceId2, position, accountId) => {
3346
- const { identityExternalId, phone, ...fields2 } = p;
3347
- const externalId = identityExternalId ?? (p.email ? `email:${p.email.toLowerCase()}` : p.externalId) ?? `name:${p.displayName ?? "unknown"}@${accountId}/${occurrenceId2}:${position}`;
3348
- return {
3349
- ...fields2,
3350
- identity: {
3351
- provider,
3352
- externalId,
3353
- name: p.displayName,
3354
- ...phone?.trim() ? { phone } : {},
3355
- metadata: p.metadata,
3356
- associatePerson: Boolean(identityExternalId?.trim() || p.email?.trim() || p.externalId?.trim())
3357
- }
3358
- };
3359
- }, "participantInput");
3360
- var participantInputs = /* @__PURE__ */ __name((provider, occurrenceId2, list, accountId) => list.map((p, i) => participantInput(p, provider, occurrenceId2, i, accountId)), "participantInputs");
3361
- var sourceMeetingInput = /* @__PURE__ */ __name((m, accountId, participantsCount, kept) => {
3362
- const startedAt = timestamp2(m.occurrence.startedAt);
3363
- const given = m.occurrence.endedAt === null ? null : timestamp2(m.occurrence.endedAt);
3364
- if (given !== null && given < startedAt)
3365
- throw new Error("Meeting ends before it starts");
3366
- const keptEnd = kept?.endedAt ?? null;
3367
- const endedAt = given ?? (keptEnd !== null && keptEnd >= startedAt ? keptEnd : null);
3368
- const count7 = participantsCount === null && kept ? kept.participantsCount : participantsCount;
3369
- const metadata = kept?.metadata && m.metadata ? { ...kept.metadata, ...m.metadata } : m.metadata ?? kept?.metadata ?? null;
3370
- const meeting2 = {
3371
- accountId,
3372
- externalId: m.occurrence.id,
3373
- title: m.occurrence.title,
3374
- description: m.description ?? kept?.description ?? null,
3375
- location: m.location ?? kept?.location ?? null,
3376
- joinUrl: m.joinUrl ?? m.series?.joinUrl ?? kept?.joinUrl ?? null,
3377
- startedAt,
3378
- endedAt,
3379
- durationMs: endedAt === null ? null : endedAt - startedAt,
3380
- timezone: m.timezone ?? kept?.timezone ?? null,
3381
- hostIdentityId: kept?.hostIdentityId ?? null,
3382
- ...count7 === void 0 ? {} : { participantsCount: count7 },
3383
- ...m.call ? { direction: m.call.direction ?? null, clientPhone: m.call.clientPhone ?? null } : {},
3384
- metadata,
3385
- deletedAt: null
3386
- };
3387
- if (m.series)
3388
- meeting2.series = {
3389
- externalId: m.series.id,
3390
- title: m.series.title,
3391
- description: null,
3392
- kind: m.series.kind ?? null,
3393
- recurrence: m.series.recurrence ?? null,
3394
- hostIdentityId: null,
3395
- joinUrl: m.series.joinUrl ?? null,
3396
- metadata: null,
3397
- deletedAt: null
3398
- };
3399
- return meeting2;
3400
- }, "sourceMeetingInput");
3401
- var saveSourceMeeting = /* @__PURE__ */ __name(async (source, store, m, parts, { accountId, now, kept }) => {
3402
- const id5 = m.occurrence.id;
3403
- const { participants: sourceParticipants, transcript: lines, chat, summary } = parts;
3404
- const participants = participantInputs(source.provider, id5, sourceParticipants ?? [], accountId);
3405
- const meeting2 = sourceMeetingInput(m, accountId, sourceParticipants === void 0 ? void 0 : sourceParticipants?.length ?? null, kept);
3406
- const linked = sourceParticipants !== void 0;
3407
- const format = source.transcriptFormat ?? null;
3408
- const transcripts = lines && linked ? [await transcriptInput(lines, participants, source.name, void 0, format)] : void 0;
3409
- const details = await store.saveMeeting({
3410
- meeting: meeting2,
3411
- participants: sourceParticipants ? participants : void 0,
3412
- transcripts,
3413
- chat: chat?.map((line2) => ({
3414
- externalId: null,
3415
- sentAt: timestamp2(line2.sentAt),
3416
- senderParticipantPosition: speakerPosition(line2.sender, participants),
3417
- senderName: line2.sender,
3418
- recipient: null,
3419
- text: line2.text,
3420
- normalizedText: null,
3421
- metadata: null
3422
- })),
3423
- summaries: summary ? [
3424
- {
3425
- ...summary,
3426
- source: summary.source ?? source.name,
3427
- content: summary.content ?? null,
3428
- docUrl: summary.docUrl ?? null,
3429
- externalCreatedAt: summary.externalCreatedAt ?? null,
3430
- externalUpdatedAt: summary.externalUpdatedAt ?? null,
3431
- metadata: summary.metadata ?? null
3432
- }
3433
- ] : void 0,
3434
- attachments: parts.files ?? void 0,
3435
- documents: parts.documents ?? void 0,
3436
- now
3437
- });
3438
- if (lines && !linked && !details.transcripts.some((t) => t.transcript.source === source.name && t.transcript.supersededAt === null))
3439
- await store.saveMeeting({
3440
- meeting: meeting2,
3441
- transcripts: [await transcriptInput(lines, [], source.name, `${JSON.stringify(lines)}
3442
- unlinked`, format)],
3443
- now
3444
- });
3445
- await linkEvent(store, details, now, { create: source.createsEvents !== false });
3446
- return details;
3447
- }, "saveSourceMeeting");
3448
- var startOf = /* @__PURE__ */ __name((m) => {
3449
- const at = Date.parse(m.occurrence.startedAt);
3450
- return Number.isFinite(at) ? at : Number.POSITIVE_INFINITY;
3451
- }, "startOf");
3452
- var pull = /* @__PURE__ */ __name(async (source, store, options) => {
3453
- const now = options.now ?? Date.now();
3454
- for (const [name, ms2] of [
3455
- ["lookbackMs", options.lookbackMs ?? 0],
3456
- ["overlapMs", source.overlapMs ?? 0]
3457
- ])
3458
- if (!Number.isSafeInteger(ms2) || ms2 < 0 || ms2 > 31 * 864e5)
3459
- throw new Error(`${name} must be an integer from 0 through 31 days`);
3460
- const lookbackMs = Math.max(options.lookbackMs ?? 0, source.overlapMs ?? 0);
3461
- const cursor = options.rescan ? void 0 : await store.cursor(options.accountId);
3462
- const since = options.since ?? cursor ?? new Date(now - 30 * 864e5).toISOString();
3463
- timestamp2(since);
3464
- const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
3465
- let failed = false;
3466
- let firstFailed;
3467
- const callers = /* @__PURE__ */ new Set();
3468
- const linkCallers = /* @__PURE__ */ __name(async () => {
3469
- if (callers.size === 0 || !store.linkCallers)
3470
- return;
3471
- try {
3472
- await store.linkCallers(source.provider, [...callers]);
3473
- } catch (error) {
3474
- report.warnings.push({
3475
- externalId: source.provider,
3476
- message: `callers not linked to people: ${error instanceof Error ? error.message : "failed"}`
3477
- });
3478
- }
3479
- }, "linkCallers");
3480
- const from = timestamp2(since) - lookbackMs;
3481
- const meetings = (await source.meetings(lookbackMs === 0 ? since : new Date(from).toISOString())).toSorted((a, b) => startOf(a) - startOf(b));
3482
- for (const [index, m] of meetings.entries()) {
3483
- const stop = options.budget?.take() ?? null;
3484
- if (stop) {
3485
- report.stopped = stop;
3486
- report.remaining = meetings.length - index;
3487
- const reached = Math.min(startOf(m), firstFailed ?? Number.POSITIVE_INFINITY);
3488
- if (Number.isFinite(reached) && reached > timestamp2(since))
3489
- await store.setCursor(options.accountId, new Date(reached).toISOString(), now);
3490
- await linkCallers();
3491
- return report;
3492
- }
3493
- const id5 = m.occurrence.id;
3494
- const failedHere = /* @__PURE__ */ __name(() => {
3495
- failed = true;
3496
- firstFailed ??= startOf(m);
3497
- }, "failedHere");
3498
- const read = /* @__PURE__ */ __name(async (part, call) => {
3499
- try {
3500
- return await call();
3501
- } catch (error) {
3502
- failedHere();
3503
- const message = error instanceof Error ? error.message : "could not be read";
3504
- report.warnings.push({ externalId: id5, message: `${part}: ${message}` });
3505
- return void 0;
3506
- }
3507
- }, "read");
3508
- try {
3509
- const sourceParticipants = await read("participants", () => source.participants(id5));
3510
- const participants = participantInputs(source.provider, id5, sourceParticipants ?? [], options.accountId);
3511
- const names = /* @__PURE__ */ new Map();
3512
- for (const p of participants)
3513
- if (p.displayName !== null) {
3514
- const identities = names.get(p.displayName) ?? /* @__PURE__ */ new Set();
3515
- identities.add(p.identity.externalId);
3516
- names.set(p.displayName, identities);
3517
- }
3518
- if ([...names.values()].some((ids2) => ids2.size > 1))
3519
- report.warnings.push({ externalId: id5, message: "Participant names are ambiguous" });
3520
- const lines = await read("transcript", () => source.transcript(id5));
3521
- const chat = await read("chat", () => source.chat(id5));
3522
- const summary = await read("summary", () => source.summary(id5));
3523
- const attachments = await read("files", () => source.files(id5));
3524
- const listDocuments = source.documents?.bind(source);
3525
- const documents = listDocuments ? await read("documents", () => listDocuments(id5)) : void 0;
3526
- await saveSourceMeeting(source, store, m, { participants: sourceParticipants, transcript: lines, chat, summary, files: attachments, documents }, { accountId: options.accountId, now });
3527
- for (const p of participants)
3528
- if (p.identity.phone)
3529
- callers.add(p.identity.externalId);
3530
- report.meetings++;
3531
- report.participants += participants.length;
3532
- report.transcriptRows += lines?.length ?? 0;
3533
- report.summaries += summary ? 1 : 0;
3534
- } catch (error) {
3535
- failedHere();
3536
- report.warnings.push({ externalId: id5, message: error instanceof Error ? error.message : "Meeting pull failed" });
3537
- }
3538
- }
3539
- await linkCallers();
3540
- if (!failed)
3541
- await store.setCursor(options.accountId, new Date(now).toISOString(), now);
3542
- return report;
3543
- }, "pull");
3544
-
3545
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/read-answers.js
3578
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/read-answers.js
3546
3579
  var text4 = string();
3547
3580
  var count5 = pipe(number(), integer(), minValue(0));
3548
3581
  var id4 = pipe(number(), integer(), minValue(1));
@@ -3740,7 +3773,7 @@ var eventItem = /* @__PURE__ */ __name((one) => ({
3740
3773
  updated_at: new Date(one.updatedAt).toISOString()
3741
3774
  }), "eventItem");
3742
3775
 
3743
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/read-through.js
3776
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/read-through.js
3744
3777
  var MEETING_SERVER_BOUNDS = { calls: 3, pages: 2 };
3745
3778
  var ISSUES = {
3746
3779
  offline: ["permission_error", "meetings.server-offline"],
@@ -3883,14 +3916,17 @@ var askServerForList = /* @__PURE__ */ __name(async (source, store, accountId, q
3883
3916
  for (const call of asked) {
3884
3917
  let cursor = null;
3885
3918
  for (let page = 0; page < MEETING_SERVER_BOUNDS.pages; page++) {
3919
+ access.signal?.throwIfAborted();
3886
3920
  step.report.calls += 1;
3887
3921
  let answer;
3888
3922
  try {
3889
- answer = await source.find(call.window, call.terms, cursor);
3923
+ answer = await source.find(call.window, call.terms, cursor, access.signal);
3890
3924
  } catch (error) {
3925
+ access.signal?.throwIfAborted();
3891
3926
  return skip(reasonOf(error), error);
3892
3927
  }
3893
3928
  for (const found of answer.meetings) {
3929
+ access.signal?.throwIfAborted();
3894
3930
  if (seen.has(found.meeting.occurrence.id))
3895
3931
  continue;
3896
3932
  seen.add(found.meeting.occurrence.id);
@@ -4015,11 +4051,13 @@ var meetingShowThrough = /* @__PURE__ */ __name(async (source, store, accountId,
4015
4051
  return fromStore("unsupported");
4016
4052
  if (access.offline)
4017
4053
  return fromStore("offline");
4054
+ access.signal?.throwIfAborted();
4018
4055
  step.report.calls = 1;
4019
4056
  let full;
4020
4057
  try {
4021
- full = await source.get(providerId);
4058
+ full = await source.get(providerId, access.signal);
4022
4059
  } catch (error) {
4060
+ access.signal?.throwIfAborted();
4023
4061
  return fromStore(reasonOf(error), error);
4024
4062
  }
4025
4063
  if (!full) {
@@ -4032,10 +4070,10 @@ var meetingShowThrough = /* @__PURE__ */ __name(async (source, store, accountId,
4032
4070
  return { details: fresh, foundIn: step.found.get(details.meeting.id) ?? "server", server: step.report };
4033
4071
  }, "meetingShowThrough");
4034
4072
 
4035
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/recording-transfer.js
4073
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/recording-transfer.js
4036
4074
  var strongRecordingValidator = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length <= 1024 && /^"[\x21\x23-\x7e\x80-\xff]*"$/.test(value), "strongRecordingValidator");
4037
4075
 
4038
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/related-history.js
4076
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/related-history.js
4039
4077
  var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
4040
4078
  if (!original || typeof original !== "object" || Array.isArray(original))
4041
4079
  throw new CliError("validation_error", "related history request is required");
@@ -4065,7 +4103,7 @@ var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
4065
4103
  return { ...input, anchorIds: [...new Set(input.anchorIds)], limit, maxReadBytes };
4066
4104
  }, "validateMeetingRelatedHistory");
4067
4105
 
4068
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/result-items.js
4106
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/result-items.js
4069
4107
  var text5 = string();
4070
4108
  var identifier = pipe(text5, minLength(1));
4071
4109
  var nullableText = nullable(text5);
@@ -4237,14 +4275,14 @@ var MEETING_RESULT_ENTITIES = {
4237
4275
  meeting_repair: repair
4238
4276
  };
4239
4277
 
4240
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/review.js
4278
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/review.js
4241
4279
  var REVIEW_LIMIT = { default: 50, most: 200 };
4242
4280
 
4243
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/save-hints.js
4281
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/save-hints.js
4244
4282
  var SAVE_HELP = `Worth keeping \u2014 a decision, a promise, a preference? Record it with \`memo facts add\` or
4245
4283
  \`memo memories add\`, citing the msg: locator or meeting: reference as --evidence.`;
4246
4284
 
4247
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/series-history.js
4285
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/series-history.js
4248
4286
  var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
4249
4287
  input.signal?.throwIfAborted();
4250
4288
  if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)
@@ -4265,10 +4303,10 @@ var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
4265
4303
  return { ...input, limit, maxReadBytes };
4266
4304
  }, "validateMeetingSeriesHistory");
4267
4305
 
4268
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/upcoming-validation.js
4306
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/upcoming-validation.js
4269
4307
  var occurrenceId = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim().length > 0 && value.length <= 1e3 && !/[\0\r\n]/.test(value), "occurrenceId");
4270
4308
 
4271
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/series-inventory-validation.js
4309
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/series-inventory-validation.js
4272
4310
  function invalid4(field, response = false) {
4273
4311
  throw new CliError(response ? "invalid_response" : "validation_error", `invalid meeting inventory ${field}`);
4274
4312
  }
@@ -4297,7 +4335,7 @@ var validateMeetingSeriesInventoryCursor = /* @__PURE__ */ __name((value) => {
4297
4335
  cursorDetails(value);
4298
4336
  }, "validateMeetingSeriesInventoryCursor");
4299
4337
 
4300
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/meetings/tag-answers.js
4338
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/meetings/tag-answers.js
4301
4339
  var text6 = string();
4302
4340
  var storeId = pipe(number(), integer(), minValue(1));
4303
4341
  var meetingTagChange = strictObject({
@@ -4410,6 +4448,8 @@ export {
4410
4448
  parseMeetingQuery,
4411
4449
  meetingWordsQuery,
4412
4450
  transcriptLanguage,
4451
+ refreshMeetingIndex,
4452
+ pull,
4413
4453
  importFiles,
4414
4454
  CHAT_MESSAGES_READ,
4415
4455
  snapshotMeetingScope,
@@ -4429,7 +4469,6 @@ export {
4429
4469
  MEETING_PROJECT_EVIDENCE_QUERY,
4430
4470
  prepareMeetingProjectEvidence,
4431
4471
  readMeetingProjectEvidence,
4432
- pull,
4433
4472
  meetingReview,
4434
4473
  meetingLink,
4435
4474
  meetingSpeaker,