@wirecat/notion-cli 0.1.0 → 0.3.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 (212) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +14 -4
  3. package/contracts/wirecat.json +698 -1
  4. package/dist/bin/notion.js +2 -2
  5. package/dist/bundle/{all-profiles-OETMCOLN.js → all-profiles-4IONYZB6.js} +10 -10
  6. package/dist/bundle/{anthropic-5Y3O2TYM.js → anthropic-OXF74J4P.js} +6 -6
  7. package/dist/bundle/{app-server-IVWBIVHC.js → app-server-M2VF6ABM.js} +61 -52
  8. package/dist/bundle/{bun-EO636SAD.js → bun-DLA6QRLL.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-C2T7QJ2M.js → bun-sqlite-F4BYLW3F.js} +7 -7
  10. package/dist/bundle/{chunk-QBC23NHD.js → chunk-2MHMKNWD.js} +1 -1
  11. package/dist/bundle/{chunk-TSCIIXN3.js → chunk-4KUJTSHG.js} +2 -2
  12. package/dist/bundle/{chunk-24FAYAML.js → chunk-4TQVZXOV.js} +3 -3
  13. package/dist/bundle/{chunk-FF4DDBCB.js → chunk-5LBJNTEJ.js} +6 -6
  14. package/dist/bundle/chunk-5UA2TYMI.js +29 -0
  15. package/dist/bundle/{chunk-DIM5YWBU.js → chunk-5XP4KQ2F.js} +1 -1
  16. package/dist/bundle/{chunk-WM7663C2.js → chunk-6GN7KU7X.js} +9 -9
  17. package/dist/bundle/chunk-6JBLIQQN.js +16 -0
  18. package/dist/bundle/{chunk-CLG2ISQH.js → chunk-7NF3V5L2.js} +4 -4
  19. package/dist/bundle/{chunk-TR7R5DL4.js → chunk-7NGFGFE5.js} +12 -63
  20. package/dist/bundle/{chunk-YA4LSSDZ.js → chunk-7NVPM55S.js} +2913 -2371
  21. package/dist/bundle/{chunk-XC5CKHX2.js → chunk-7YZPBAQX.js} +1 -1
  22. package/dist/bundle/{chunk-RSIS7BR7.js → chunk-AYU5TFDU.js} +21 -21
  23. package/dist/bundle/{chunk-64D5VUZ4.js → chunk-BEPFGITI.js} +68 -64
  24. package/dist/bundle/{chunk-HRTIRRXR.js → chunk-CBGBFAYJ.js} +41 -6
  25. package/dist/bundle/{chunk-QC3KOJT4.js → chunk-CDGZZNGY.js} +6 -6
  26. package/dist/bundle/{chunk-JK44XO2S.js → chunk-CIVXTBJY.js} +56 -56
  27. package/dist/bundle/{chunk-OWJDC4CB.js → chunk-COH7OEER.js} +14 -13
  28. package/dist/bundle/{chunk-XL2HXHP3.js → chunk-D6RCRBDH.js} +2 -2
  29. package/dist/bundle/{chunk-47R43UVJ.js → chunk-EQPAZ33O.js} +19 -19
  30. package/dist/bundle/{chunk-AE2KQ37N.js → chunk-EY6S7FV3.js} +6 -6
  31. package/dist/bundle/chunk-FEMHUSGO.js +88 -0
  32. package/dist/bundle/{chunk-NLDYZBTC.js → chunk-FSJHASRQ.js} +1146 -2555
  33. package/dist/bundle/chunk-GBFEEHQC.js +385 -0
  34. package/dist/bundle/{chunk-IQWEJEB5.js → chunk-GCCPFKSU.js} +26264 -21086
  35. package/dist/bundle/{chunk-RDZ7SVBZ.js → chunk-GK4GLPG2.js} +3 -3
  36. package/dist/bundle/{chunk-B2XKEEFX.js → chunk-GSNE7OB4.js} +4 -4
  37. package/dist/bundle/{chunk-UWW24JQF.js → chunk-HTKSCSJU.js} +4 -4
  38. package/dist/bundle/{chunk-7FII4DCE.js → chunk-IJMFG7HB.js} +7 -7
  39. package/dist/bundle/{chunk-WVZFXI36.js → chunk-JIRRF6BM.js} +4 -4
  40. package/dist/bundle/{chunk-ST2UC7FS.js → chunk-JODE2XED.js} +31 -27
  41. package/dist/bundle/{chunk-CWVAYQXI.js → chunk-K5I64ZVI.js} +9 -9
  42. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  43. package/dist/bundle/{chunk-JKIN5TOU.js → chunk-KL3P5TQK.js} +4 -4
  44. package/dist/bundle/chunk-L62XTC7N.js +726 -0
  45. package/dist/bundle/chunk-L6H7PY4X.js +170 -0
  46. package/dist/bundle/{chunk-F6MLJ3V5.js → chunk-LIQMUDIZ.js} +2 -2
  47. package/dist/bundle/{chunk-HWRKURQH.js → chunk-M2EEIYBU.js} +2 -2
  48. package/dist/bundle/chunk-M6DGZ2O6.js +823 -0
  49. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  50. package/dist/bundle/{chunk-UWIA2G6Q.js → chunk-MRA62W5K.js} +404 -537
  51. package/dist/bundle/{chunk-XYIT2XB3.js → chunk-MVA5HVKL.js} +20 -0
  52. package/dist/bundle/{chunk-GA3URWIF.js → chunk-NO2LIHWA.js} +1 -1
  53. package/dist/bundle/{chunk-ESZT4WW3.js → chunk-OCDJ4FFA.js} +4 -4
  54. package/dist/bundle/{chunk-B4B65XIO.js → chunk-OI5DWZJG.js} +3 -3
  55. package/dist/bundle/chunk-P3P6DA6K.js +259 -0
  56. package/dist/bundle/chunk-QX3TPFEX.js +1977 -0
  57. package/dist/bundle/{chunk-EU5WCOMQ.js → chunk-R6SDRSZK.js} +76 -35
  58. package/dist/bundle/{chunk-K5TWMQSY.js → chunk-RMJMID5D.js} +8 -8
  59. package/dist/bundle/{chunk-RLSFOR2D.js → chunk-SGBS5QCU.js} +4 -4
  60. package/dist/bundle/{chunk-3D3PFXBP.js → chunk-T5UNSFES.js} +10 -15
  61. package/dist/bundle/{chunk-RAZKIHGH.js → chunk-TFNRCCGR.js} +4 -4
  62. package/dist/bundle/{chunk-WK3OSDNV.js → chunk-TJCPTRYD.js} +7 -7
  63. package/dist/bundle/{chunk-BWICUW7W.js → chunk-TXONV3HW.js} +2 -2
  64. package/dist/bundle/{chunk-AQZO3ITW.js → chunk-TZ2QJ53V.js} +2 -2
  65. package/dist/bundle/{chunk-35K5T6WV.js → chunk-UKE3CGHK.js} +1 -1
  66. package/dist/bundle/{chunk-7N5QB6NL.js → chunk-UROEWCOG.js} +5 -3
  67. package/dist/bundle/chunk-WHJWURZB.js +335 -0
  68. package/dist/bundle/{chunk-R6ZM45NF.js → chunk-WU3XHGOB.js} +185 -57
  69. package/dist/bundle/{chunk-2YR3RYT4.js → chunk-WZEEEQGC.js} +3 -3
  70. package/dist/bundle/{chunk-B2WFKFYL.js → chunk-XCTOCVMW.js} +20 -116
  71. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  72. package/dist/bundle/{chunk-EGTBL3MJ.js → chunk-Y5LAJWR5.js} +1 -1
  73. package/dist/bundle/{chunk-66PL7P4C.js → chunk-YAPDU3SV.js} +1 -1
  74. package/dist/bundle/{chunk-WWMB4UHF.js → chunk-YFWLHTNO.js} +1 -1
  75. package/dist/bundle/{chunk-KHOVVPLC.js → chunk-YGCI3DHS.js} +1 -1
  76. package/dist/bundle/{chunk-4GC5DBHW.js → chunk-Z53LYX4M.js} +3 -3
  77. package/dist/bundle/{chunk-EPAZ7DJB.js → chunk-ZC6ZQQ55.js} +48 -45
  78. package/dist/bundle/command-contract-UBXS6NHI.js +38 -0
  79. package/dist/bundle/{command-server-entry-A66DJ3MH.js → command-server-entry-2SORMVRM.js} +27 -24
  80. package/dist/bundle/decode-5O7IEFPN.js +297 -0
  81. package/dist/bundle/{dispatch-FEKU5UXC.js → dispatch-YHQX6FEJ.js} +8 -8
  82. package/dist/bundle/{dist-YFKABFFF.js → dist-ILNOLGYN.js} +1 -1
  83. package/dist/bundle/{echarts-XD2JSWU4.js → echarts-ARLMVQC7.js} +2 -2
  84. package/dist/bundle/{embed-F3HYGAF7.js → embed-FUDUKQ3K.js} +7 -7
  85. package/dist/bundle/{embedder-GSEDDUH7.js → embedder-HDRV7GX3.js} +10 -10
  86. package/dist/bundle/{failure-HDJLR2YJ.js → failure-JHXICWIL.js} +3 -3
  87. package/dist/bundle/first-run-BGEFTXOE.js +29 -0
  88. package/dist/bundle/first-screen-F5F3VS6Y.js +38 -0
  89. package/dist/bundle/{instructions-NZGJ4FW5.js → instructions-MEFIKCDI.js} +1 -1
  90. package/dist/bundle/{mcp-VFIOZDVY.js → mcp-VMS6PBCU.js} +2 -2
  91. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  92. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  93. package/dist/bundle/meeting-combined-HNSS3FQY.js +24 -0
  94. package/dist/bundle/meeting-model-REZVYGQW.js +26 -0
  95. package/dist/bundle/meeting-semantic-R4CSLVRG.js +22 -0
  96. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  97. package/dist/bundle/{node-RPKPDYQS.js → node-MAQALPLA.js} +2 -2
  98. package/dist/bundle/{node-sqlite-KH2UUYVO.js → node-sqlite-J7IJYNBO.js} +8 -8
  99. package/dist/bundle/notion.js +14 -14
  100. package/dist/bundle/{oauth-NKAI7TQD.js → oauth-AMV4YGJD.js} +8 -8
  101. package/dist/bundle/{open-WSAEAA2V.js → open-AB27MTGR.js} +6 -6
  102. package/dist/bundle/{openai-JPVDGHG5.js → openai-D77MU5XV.js} +31 -29
  103. package/dist/bundle/{process-5ZFVKOQX.js → process-SIOWTRJ6.js} +1 -1
  104. package/dist/bundle/{program-M3D56D6T.js → program-QC5MX4ZJ.js} +7533 -1997
  105. package/dist/bundle/{prompt-FROYQ5LV.js → prompt-W77YDHA6.js} +6 -6
  106. package/dist/bundle/{recognize-NYCHQMCX.js → recognize-3JAXQQ36.js} +5 -5
  107. package/dist/bundle/{remote-4OERF3Z4.js → remote-PSOJXCXO.js} +11 -11
  108. package/dist/bundle/{rerank-TEGXFUWY.js → rerank-EE44ZTGL.js} +8 -8
  109. package/dist/bundle/{schemas-MZNNOEYN.js → schemas-LBYUMBC6.js} +2 -2
  110. package/dist/bundle/{serve-HLYYBAXY.js → serve-XJMGAMFW.js} +10 -10
  111. package/dist/bundle/{server-D5OYNEUW.js → server-ASU6CP5R.js} +53 -44
  112. package/dist/bundle/server-WSPQ5EOA.js +72 -0
  113. package/dist/bundle/services-PT4PA4J6.js +588 -0
  114. package/dist/bundle/{sqlite-runtime-H2S5RR2F.js → sqlite-runtime-YHXRTVXE.js} +7 -7
  115. package/dist/bundle/{state-OPOXCDZL.js → state-T6ZKFWGD.js} +7 -7
  116. package/dist/bundle/{store-NHMXEJPD.js → store-3MUCZEI3.js} +20 -14
  117. package/dist/bundle/{store-Y3KRLCJ7.js → store-E5EE25FY.js} +30 -21
  118. package/dist/bundle/store-maintenance-command-ZZ55BBBG.js +63 -0
  119. package/dist/commands/api.d.ts.map +1 -1
  120. package/dist/commands/api.js +13 -4
  121. package/dist/commands/api.js.map +1 -1
  122. package/dist/commands/documents.d.ts +10 -1
  123. package/dist/commands/documents.d.ts.map +1 -1
  124. package/dist/commands/documents.js +175 -5
  125. package/dist/commands/documents.js.map +1 -1
  126. package/dist/commands/library.d.ts +10 -0
  127. package/dist/commands/library.d.ts.map +1 -0
  128. package/dist/commands/library.js +470 -0
  129. package/dist/commands/library.js.map +1 -0
  130. package/dist/commands/session.d.ts.map +1 -1
  131. package/dist/commands/session.js +4 -3
  132. package/dist/commands/session.js.map +1 -1
  133. package/dist/config.d.ts +19 -0
  134. package/dist/config.d.ts.map +1 -1
  135. package/dist/config.js +73 -5
  136. package/dist/config.js.map +1 -1
  137. package/dist/context.d.ts +8 -0
  138. package/dist/context.d.ts.map +1 -1
  139. package/dist/context.js +15 -3
  140. package/dist/context.js.map +1 -1
  141. package/dist/generated/types.d.ts +485 -375
  142. package/dist/generated/types.d.ts.map +1 -1
  143. package/dist/identity.d.ts.map +1 -1
  144. package/dist/identity.js +1 -0
  145. package/dist/identity.js.map +1 -1
  146. package/dist/knowledge.d.ts +27 -0
  147. package/dist/knowledge.d.ts.map +1 -0
  148. package/dist/knowledge.js +87 -0
  149. package/dist/knowledge.js.map +1 -0
  150. package/dist/library.d.ts +44 -0
  151. package/dist/library.d.ts.map +1 -0
  152. package/dist/library.js +149 -0
  153. package/dist/library.js.map +1 -0
  154. package/dist/notion/client.d.ts +4 -1
  155. package/dist/notion/client.d.ts.map +1 -1
  156. package/dist/notion/client.js +5 -2
  157. package/dist/notion/client.js.map +1 -1
  158. package/dist/notion/errors.d.ts +5 -0
  159. package/dist/notion/errors.d.ts.map +1 -1
  160. package/dist/notion/errors.js +33 -1
  161. package/dist/notion/errors.js.map +1 -1
  162. package/dist/notion/reads.d.ts +4 -0
  163. package/dist/notion/reads.d.ts.map +1 -1
  164. package/dist/notion/writes.d.ts +40 -0
  165. package/dist/notion/writes.d.ts.map +1 -0
  166. package/dist/notion/writes.js +112 -0
  167. package/dist/notion/writes.js.map +1 -0
  168. package/dist/program.js +2 -2
  169. package/dist/program.js.map +1 -1
  170. package/dist/sync/cursor.d.ts +93 -0
  171. package/dist/sync/cursor.d.ts.map +1 -1
  172. package/dist/sync/cursor.js +63 -2
  173. package/dist/sync/cursor.js.map +1 -1
  174. package/dist/sync/files.d.ts +87 -0
  175. package/dist/sync/files.d.ts.map +1 -0
  176. package/dist/sync/files.js +31 -0
  177. package/dist/sync/files.js.map +1 -0
  178. package/dist/sync/markdown.d.ts +4 -1
  179. package/dist/sync/markdown.d.ts.map +1 -1
  180. package/dist/sync/markdown.js +8 -6
  181. package/dist/sync/markdown.js.map +1 -1
  182. package/dist/sync/source.d.ts +6 -59
  183. package/dist/sync/source.d.ts.map +1 -1
  184. package/dist/sync/source.js +650 -271
  185. package/dist/sync/source.js.map +1 -1
  186. package/dist/version.d.ts +1 -1
  187. package/dist/version.js +1 -1
  188. package/package.json +3 -3
  189. package/skills/notion-cli/SKILL.md +18 -1
  190. package/dist/bundle/command-contract-6G5DC2FN.js +0 -35
  191. package/dist/bundle/decode-7XOFRAAT.js +0 -163
  192. package/dist/bundle/first-run-TXNTIUSP.js +0 -28
  193. package/dist/bundle/first-screen-JZPJND7J.js +0 -33
  194. package/dist/bundle/server-LWZGVMNW.js +0 -62
  195. package/dist/bundle/store-maintenance-command-D4W7WSLQ.js +0 -53
  196. package/dist/commands/comments.d.ts +0 -3
  197. package/dist/commands/comments.d.ts.map +0 -1
  198. package/dist/commands/comments.js +0 -114
  199. package/dist/commands/comments.js.map +0 -1
  200. package/dist/sample/comments.d.ts +0 -61
  201. package/dist/sample/comments.d.ts.map +0 -1
  202. package/dist/sample/comments.js +0 -39
  203. package/dist/sample/comments.js.map +0 -1
  204. package/dist/sample/records.d.ts +0 -16
  205. package/dist/sample/records.d.ts.map +0 -1
  206. package/dist/sample/records.js +0 -22
  207. package/dist/sample/records.js.map +0 -1
  208. package/dist/sample/transport.d.ts +0 -42
  209. package/dist/sample/transport.d.ts.map +0 -1
  210. package/dist/sample/transport.js +0 -153
  211. package/dist/sample/transport.js.map +0 -1
  212. /package/dist/bundle/{chunk-ZI3YTXSF.js → chunk-SHTHNBHG.js} +0 -0
@@ -0,0 +1,385 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ validateVector
5
+ } from "./chunk-L6H7PY4X.js";
6
+ import {
7
+ meaningFloor
8
+ } from "./chunk-WHJWURZB.js";
9
+ import {
10
+ MESSAGE_PARSING,
11
+ RRF_K,
12
+ plainQuery
13
+ } from "./chunk-M6DGZ2O6.js";
14
+ import {
15
+ normalize
16
+ } from "./chunk-6JBLIQQN.js";
17
+ import {
18
+ MEETING_FIELD_NAMES,
19
+ formatMeetingReference,
20
+ implicitTextTerms,
21
+ liftMeetingFields,
22
+ parseLucene,
23
+ parseMeetingReference,
24
+ walkQuery
25
+ } from "./chunk-FSJHASRQ.js";
26
+ import {
27
+ CliError
28
+ } from "./chunk-LIQMUDIZ.js";
29
+ import {
30
+ __name
31
+ } from "./chunk-ZVVMGPBJ.js";
32
+
33
+ // 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/services/meeting-combined.js
34
+ import { createHash } from "node:crypto";
35
+
36
+ // 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/question-plan.js
37
+ var words = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
38
+ var joinedHyphens = /* @__PURE__ */ __name((text) => (normalize(text).match(new RegExp("(?<![:\\p{L}\\p{N}-])\\p{L}[\\p{L}\\p{N}]*(?:-\\p{L}[\\p{L}\\p{N}]*)+", "gu")) ?? []).map((word) => word.replaceAll("-", "")), "joinedHyphens");
39
+ var scaffolding = new Set(words("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u043E\u0435 \u043A\u0442\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u0447\u0442\u043E \u0432\u043E \u043F\u043E \u043D\u0430 \u0432 \u043A \u0441 \u0443 \u0447\u0435\u0440\u0435\u0437 \u043B\u0438 \u0434\u043E\u043B\u0436\u0435\u043D \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0443\u0436\u043D\u043E \u0438\u0434\u0451\u0442 \u0438\u0434\u0435\u0442 \u043C\u043E\u0436\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043C\u043E\u0433\u0443\u0442"));
40
+ var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
41
+ var QUESTION_STARTS = new Set(words("what which how who whom whose where when why can could should would did do does is are was were will \u0447\u0442\u043E \u043A\u0442\u043E \u043A\u043E\u0433\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u043E\u0435 \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u0443\u044E \u043A\u0430\u043A\u0438\u043C \u043A\u0430\u043A\u043E\u0433\u043E \u043A\u0430\u043A\u0438\u0445 \u043F\u043E\u0447\u0435\u043C\u0443 \u0437\u0430\u0447\u0435\u043C \u043E\u0442\u043A\u0443\u0434\u0430 \u043A\u0443\u0434\u0430 \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043B\u0438 \u043C\u043E\u0436\u043D\u043E \u0440\u0430\u0437\u0432\u0435 \u0447\u0435\u0439 \u0447\u044C\u044F \u0447\u044C\u0451 \u0447\u044C\u0438"));
42
+ var QUESTION_FILLER = new Set(words("about any did does why whom whose would will \u044D\u0442\u043E \u043C\u044B \u0432\u044B \u044F \u043E\u043D\u0438 \u043E\u043D \u043E\u043D\u0430 \u043E \u043E\u0431 \u043F\u0440\u043E \u043B\u0438"));
43
+ var LINKING = new Set(words("and or but not nor with without this that these those there their they them you your our its his her all any and for into onto over then than also just and \u043F\u0440\u0438 \u0434\u043B\u044F \u0431\u0435\u0437 \u043D\u0430\u0434 \u043F\u043E\u0434 \u0438\u043B\u0438 \u043B\u0438\u0431\u043E \u0435\u0433\u043E \u0435\u0451 \u0438\u0445 \u0432\u0441\u0435 \u0432\u0441\u0451 \u0443\u0436\u0435 \u0435\u0449\u0451 \u0442\u0430\u043A \u0442\u043E\u0436\u0435 \u0442\u0430\u043A\u0436\u0435 \u0431\u044B\u043B \u0431\u044B\u043B\u0430 \u0431\u044B\u043B\u0438 \u0431\u044B\u043B\u043E \u0431\u0443\u0434\u0435\u0442 \u044D\u0442\u043E \u044D\u0442\u0430 \u044D\u0442\u043E\u0442 \u044D\u0442\u0438 \u0442\u0430\u043C \u0442\u0443\u0442"));
44
+ var isFunctionWord = /* @__PURE__ */ __name((word) => scaffolding.has(word) || QUESTION_STARTS.has(word) || QUESTION_FILLER.has(word) || LINKING.has(word), "isFunctionWord");
45
+ var questionTerms = /* @__PURE__ */ __name((text) => /\?\s*$/u.test(text) || QUESTION_STARTS.has(words(text)[0] ?? "") ? words(text).filter((word) => !scaffolding.has(word) && !QUESTION_STARTS.has(word) && !QUESTION_FILLER.has(word)) : null, "questionTerms");
46
+ function planQuestion(text, strict = false) {
47
+ if (strict)
48
+ return {
49
+ changed: false,
50
+ natural: false,
51
+ queries: [text],
52
+ scope: "",
53
+ terms: words(text),
54
+ rankingTerms: words(text),
55
+ removed: [],
56
+ aliases: []
57
+ };
58
+ const inputAst = parseLucene(text, MESSAGE_PARSING);
59
+ const rawTextual = walkQuery(inputAst.root).filter((node) => node.field === "text" || node.field === "exact");
60
+ const body = rawTextual.map((node) => node.value).join(" ");
61
+ const prefix = words(body).slice(0, 2);
62
+ const questionPrefix = [
63
+ "what",
64
+ "which",
65
+ "how",
66
+ "who",
67
+ "where",
68
+ "when",
69
+ "can",
70
+ "could",
71
+ "should",
72
+ "\u0441\u043A\u043E\u043B\u044C\u043A\u043E",
73
+ "\u043A\u0430\u043A\u043E\u0438",
74
+ "\u043A\u0430\u043A\u0430\u044F",
75
+ "\u043A\u0430\u043A\u0438\u0435",
76
+ "\u043A\u0430\u043A\u043E\u0435",
77
+ "\u043A\u0442\u043E",
78
+ "\u043A\u043E\u043C\u0443",
79
+ "\u043A\u0435\u043C",
80
+ "\u0433\u0434\u0435",
81
+ "\u043A\u043E\u0433\u0434\u0430",
82
+ "\u043A\u0430\u043A",
83
+ "\u0447\u0442\u043E",
84
+ "\u043C\u043E\u0436\u043D\u043E",
85
+ "\u043C\u043E\u0436\u0435\u0442",
86
+ "\u043C\u043E\u0433\u0443\u0442"
87
+ ].includes(prefix[0] ?? "") || ["\u043A", "\u0432\u043E"].includes(prefix[0] ?? "") && ["\u043A\u043E\u043C\u0443", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E"].includes(prefix[1] ?? "");
88
+ const natural = questionWord.test(body) && (/\?/u.test(body) || questionPrefix);
89
+ let cleaned = text;
90
+ if (natural && !text.includes("\\")) {
91
+ const last = rawTextual.at(-1);
92
+ const mark = (last?.span.end ?? 0) - 1;
93
+ if (last?.operator === "wildcard" && text[mark] === "?")
94
+ cleaned = text.slice(0, mark) + text.slice(mark + 1);
95
+ }
96
+ const ast = cleaned === text ? inputAst : parseLucene(cleaned, MESSAGE_PARSING);
97
+ const predicates = walkQuery(ast.root);
98
+ const textual = predicates.filter((p) => p.field === "text" || p.field === "exact");
99
+ const fields = predicates.filter((p) => p.field !== "text" && p.field !== "exact");
100
+ const scope = fields.map((p) => {
101
+ const raw = cleaned.slice(p.span.start, p.span.end);
102
+ return new RegExp(`^${p.field}[:=<>]`, "u").test(raw) ? raw : `${p.field}:${raw}`;
103
+ }).join(" ");
104
+ const bypass = strict || !natural || implicitTextTerms(cleaned).size === 0 || // A quoted single word is how `plainQuery` keeps `10:30` or `HH:MM` literal; it is no phrase the asker wrote.
105
+ textual.some((p) => !(p.operator === "term" || p.operator === "phrase" && !/\s/u.test(p.value)) || p.field === "exact");
106
+ if (bypass)
107
+ return {
108
+ changed: false,
109
+ natural: false,
110
+ queries: [text],
111
+ scope,
112
+ terms: textual.flatMap((p) => words(p.value)),
113
+ rankingTerms: textual.flatMap((p) => words(p.value)),
114
+ removed: [],
115
+ aliases: []
116
+ };
117
+ const original = textual.flatMap((p) => words(p.value));
118
+ const removed = original.filter((w) => scaffolding.has(w));
119
+ const terms = [...new Set(original.filter((w) => !scaffolding.has(w)))];
120
+ if (!terms.length)
121
+ return {
122
+ changed: false,
123
+ natural: true,
124
+ queries: [text],
125
+ scope,
126
+ terms,
127
+ rankingTerms: original,
128
+ removed,
129
+ aliases: []
130
+ };
131
+ const alias = [...terms];
132
+ const changes = [];
133
+ const replace = /* @__PURE__ */ __name((from, to) => {
134
+ for (let i = 0; i < alias.length; i++)
135
+ if (from.includes(alias[i] ?? "")) {
136
+ changes.push(`${alias[i]} -> ${to}`);
137
+ alias[i] = to;
138
+ }
139
+ }, "replace");
140
+ if (terms.some((w) => ["refund", "euros", "euro", "money", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442\u0430", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442", "\u0435\u0432\u0440\u043E"].includes(w))) {
141
+ replace(["returned", "refunded", "received"], "refund");
142
+ replace(["\u0432\u0435\u0440\u043D\u0443\u043B\u0438", "\u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0435\u043D\u043E", "\u043F\u0435\u0440\u0435\u0447\u0438\u0441\u043B\u0435\u043D\u043E"], "\u0432\u043E\u0437\u0432\u0440\u0430\u0442");
143
+ }
144
+ if (terms.some((w) => ["log", "logs", "retention", "backup", "\u043B\u043E\u0433\u043E\u0432", "\u043B\u043E\u0433\u0438", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F"].includes(w))) {
145
+ replace(["lifetime", "kept", "keep"], "retention");
146
+ replace(["\u0445\u0440\u0430\u043D\u044F\u0442\u0441\u044F", "\u0445\u0440\u0430\u043D\u044F\u0442", "\u0445\u0440\u0430\u043D\u0438\u0442\u044C", "\u0441\u0440\u043E\u043A"], "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435");
147
+ }
148
+ if (terms.includes("service") || terms.includes("build"))
149
+ replace(["currently", "now"], "current");
150
+ const render = /* @__PURE__ */ __name((ws) => [...new Set(ws)].join(" ") + (scope ? ` ${scope}` : ""), "render");
151
+ const queries = [.../* @__PURE__ */ new Set([render(terms), render(alias)])].slice(0, 2);
152
+ return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
153
+ }
154
+ __name(planQuestion, "planQuestion");
155
+ var questionText = /* @__PURE__ */ __name((text) => text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
156
+ var lookupTerms = /* @__PURE__ */ __name((plan) => [
157
+ ...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))
158
+ ], "lookupTerms");
159
+ var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
160
+ var questionLookup = /* @__PURE__ */ __name((text) => {
161
+ let plan;
162
+ try {
163
+ plan = planQuestion(questionText(text));
164
+ } catch (error) {
165
+ if (error instanceof CliError)
166
+ return void 0;
167
+ throw error;
168
+ }
169
+ const terms = plan.changed ? lookupTerms(plan) : [];
170
+ return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
171
+ }, "questionLookup");
172
+
173
+ // 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/services/meeting-hit-search.js
174
+ var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
175
+ let before = Number.POSITIVE_INFINITY;
176
+ for (; ; ) {
177
+ signal?.throwIfAborted();
178
+ const { indexed, remaining } = await meetings.indexSearch({
179
+ accountId,
180
+ limit: 1e3,
181
+ maxReadBytes: 64 * 1024 ** 2,
182
+ signal
183
+ });
184
+ if (remaining === 0 || indexed === 0 || remaining >= before)
185
+ return;
186
+ before = remaining;
187
+ }
188
+ }, "refreshMeetingIndex");
189
+ var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
190
+ const { project, tag, topic, ...input } = request;
191
+ input.signal?.throwIfAborted();
192
+ if (project !== void 0 && input.projectId !== void 0 || [tag, topic].filter((value) => value !== void 0).length + Number(input.tagId !== void 0) > 1)
193
+ throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
194
+ const selection = [];
195
+ const knowledge = store.knowledge;
196
+ if (!knowledge && [project, tag, topic].some((value) => value !== void 0))
197
+ throw new CliError("configuration_error", "this store cannot resolve project, tag or topic names");
198
+ for (const [kind, name] of [
199
+ ["project", project],
200
+ ["tag", tag],
201
+ ["topic", topic]
202
+ ]) {
203
+ if (name === void 0)
204
+ continue;
205
+ if (!knowledge)
206
+ continue;
207
+ const found = await knowledge.resolveVocabulary(name, { kind, signal: input.signal });
208
+ input.signal?.throwIfAborted();
209
+ if (found.ambiguous || found.matches.length !== 1)
210
+ throw new CliError(found.matches.length ? "validation_error" : "not_found", `the ${kind} name needs one canonical record`, {
211
+ candidates: found.matches.map((entry2) => ({ kind: entry2.kind, id: entry2.id, name: entry2.name }))
212
+ });
213
+ const entry = found.matches[0];
214
+ const id = Number(entry?.id);
215
+ if (!entry || entry.kind !== kind || !Number.isSafeInteger(id) || id < 1)
216
+ throw new CliError("invalid_response", "vocabulary resolution returned an invalid canonical record");
217
+ if (kind === "project")
218
+ input.projectId = id;
219
+ else
220
+ input.tagId = id;
221
+ selection.push({ kind, id, name: entry.name, by: "explicit-link" });
222
+ }
223
+ return { input, selection };
224
+ }, "resolveMeetingSelection");
225
+ var searchMeetingHits = /* @__PURE__ */ __name(async (store, query, request, options = {}) => {
226
+ const lifted = liftMeetingFields(plainQuery(query, MEETING_FIELD_NAMES), request);
227
+ const { input, selection } = await resolveMeetingSelection(store, lifted.request);
228
+ if (options.refreshIndex !== false)
229
+ await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
230
+ const result = await store.meetings.searchHits(lifted.query, input);
231
+ input.signal?.throwIfAborted();
232
+ return { ...result, selection };
233
+ }, "searchMeetingHits");
234
+
235
+ // 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/services/meeting-combined.js
236
+ var DEPTH = 200;
237
+ var cursorOf = /* @__PURE__ */ __name((value, key) => {
238
+ if (value === void 0)
239
+ return 0;
240
+ let cursor;
241
+ try {
242
+ cursor = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
243
+ } catch {
244
+ throw new CliError("validation_error", "the cursor is not from a combined meeting search; search again");
245
+ }
246
+ if (cursor?.version !== 1 || cursor.key !== key || !Number.isSafeInteger(cursor.offset) || cursor.offset < 0)
247
+ throw new CliError("validation_error", "the cursor belongs to another query, filter or model; search again");
248
+ return cursor.offset;
249
+ }, "cursorOf");
250
+ var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, typed, request) => {
251
+ const { maxChunks, maxRows, maxTextBytes, ...chosen } = request;
252
+ const { query, request: words2 } = liftMeetingFields(typed, chosen);
253
+ const { input, selection } = await resolveMeetingSelection(store, words2);
254
+ const { after, limit = 20, maxReadBytes, ...filters } = input;
255
+ const terms = questionTerms(query);
256
+ const wordQuery = terms === null ? query : terms.join(" ");
257
+ const key = createHash("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
258
+ const offset = cursorOf(after, key);
259
+ let byWords = [];
260
+ let indexing = "ready";
261
+ let refused;
262
+ if (wordQuery.trim()) {
263
+ await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
264
+ try {
265
+ const page = await store.meetings.searchHits(wordQuery, { ...filters, limit: DEPTH, maxReadBytes });
266
+ byWords = page.items;
267
+ indexing = page.coverage.indexing;
268
+ } catch (error) {
269
+ if (!(error instanceof CliError) || error.code !== "validation_error")
270
+ throw error;
271
+ refused = error.message;
272
+ }
273
+ }
274
+ input.signal?.throwIfAborted();
275
+ const vectors = await embedder.embed([query], "query");
276
+ if (vectors.length !== 1)
277
+ throw new CliError("invalid_response", "Meeting query model returned another vector count");
278
+ const vector = vectors[0];
279
+ const ranked = await store.meetingVectors.ranked(embedder.key, validateVector(vector, embedder.dims), {
280
+ ...filters,
281
+ limit: DEPTH,
282
+ ...maxChunks === void 0 ? {} : { maxChunks },
283
+ ...maxRows === void 0 ? {} : { maxRows },
284
+ ...maxTextBytes === void 0 ? {} : { maxTextBytes }
285
+ });
286
+ const floor = meaningFloor(embedder.key);
287
+ const byMeaning = ranked.items.filter(({ score }) => score > floor);
288
+ const merged = /* @__PURE__ */ new Map();
289
+ byMeaning.forEach((hit, rank) => {
290
+ const reference = { type: "meeting", accountId: input.accountId, meetingId: hit.meetingId };
291
+ const first = formatMeetingReference({
292
+ ...reference,
293
+ transcriptId: hit.transcriptId,
294
+ cuePosition: hit.firstPosition
295
+ });
296
+ merged.set(`${hit.transcriptId}:${hit.firstPosition}`, {
297
+ ref: first,
298
+ meetingId: hit.meetingId,
299
+ scope: "transcript",
300
+ text: hit.text,
301
+ startMs: null,
302
+ source: { title: hit.title, startedAt: hit.startedAt, url: null },
303
+ by: ["meaning"],
304
+ score: hit.score,
305
+ passage: {
306
+ first,
307
+ last: formatMeetingReference({ ...reference, transcriptId: hit.transcriptId, cuePosition: hit.lastPosition })
308
+ },
309
+ fused: 1 / (RRF_K + rank + 1)
310
+ });
311
+ });
312
+ byWords.forEach((hit, rank) => {
313
+ const share = 1 / (RRF_K + rank + 1);
314
+ const cue = hit.scope === "transcript" ? parseMeetingReference(hit.ref) : void 0;
315
+ const within = cue?.cuePosition === void 0 ? void 0 : byMeaning.find((passage) => passage.transcriptId === cue.transcriptId && passage.firstPosition <= cue.cuePosition && cue.cuePosition <= passage.lastPosition);
316
+ const held = within && merged.get(`${within.transcriptId}:${within.firstPosition}`);
317
+ const found = {
318
+ ref: hit.ref,
319
+ text: hit.text,
320
+ startMs: hit.startMs,
321
+ ...hit.match === void 0 ? {} : { match: hit.match },
322
+ ...hit.corrections === void 0 ? {} : { corrections: hit.corrections }
323
+ };
324
+ if (held && !held.by.includes("words")) {
325
+ Object.assign(held, found, { by: ["words", "meaning"], fused: held.fused + share });
326
+ if (hit.source?.url)
327
+ held.source.url = hit.source.url;
328
+ } else if (held)
329
+ held.fused += share;
330
+ else
331
+ merged.set(`w:${hit.ref}:${hit.scope}:${hit.id}`, {
332
+ ...found,
333
+ meetingId: hit.meetingId,
334
+ scope: hit.scope,
335
+ source: {
336
+ title: hit.source?.title ?? null,
337
+ startedAt: hit.source?.startedAt ?? null,
338
+ url: hit.source?.url ?? null
339
+ },
340
+ by: ["words"],
341
+ score: null,
342
+ fused: share
343
+ });
344
+ });
345
+ const ordered = [...merged.values()].sort((a, b) => b.fused - a.fused || Number(b.by.includes("words")) - Number(a.by.includes("words")) || (b.score ?? -2) - (a.score ?? -2));
346
+ const items = ordered.slice(offset, offset + limit).map(({ fused: _, ...hit }) => hit);
347
+ const hasMore = ordered.length > offset + limit;
348
+ return {
349
+ items,
350
+ hasMore,
351
+ nextCursor: hasMore ? Buffer.from(JSON.stringify({ version: 1, key, offset: offset + limit })).toString("base64url") : null,
352
+ selection,
353
+ words: {
354
+ query: wordQuery,
355
+ ...terms === null ? {} : { from: "question" },
356
+ ...refused === void 0 ? {} : { refused }
357
+ },
358
+ model: { key: embedder.key, model: embedder.model, kind: embedder.kind, dims: embedder.dims },
359
+ coverage: {
360
+ archiveCompleteness: "unknown",
361
+ indexCompleteness: "unknown",
362
+ indexing,
363
+ /** Every vector of the selection was compared; false when `maxChunks` stopped the scan. */
364
+ meaningScanComplete: ranked.complete,
365
+ scanned: ranked.scanned,
366
+ /** Each side ranks this many at most; pages past them hold nothing more. */
367
+ depth: DEPTH
368
+ }
369
+ };
370
+ }, "searchMeetingsCombined");
371
+
372
+ export {
373
+ words,
374
+ joinedHyphens,
375
+ isFunctionWord,
376
+ planQuestion,
377
+ questionText,
378
+ lookupTerms,
379
+ anyOfTerms,
380
+ questionLookup,
381
+ refreshMeetingIndex,
382
+ resolveMeetingSelection,
383
+ searchMeetingHits,
384
+ searchMeetingsCombined
385
+ };