@wirecat/tg-cli 0.128.0 → 0.129.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 (125) hide show
  1. package/contracts/wirecat.json +26 -0
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-JOI34QLS.js → adapter-2XFPXBTA.js} +60 -52
  4. package/dist/bundle/{all-profiles-2BZEE7J2.js → all-profiles-GXFPZLYU.js} +9 -9
  5. package/dist/bundle/{anthropic-NW7DL3S3.js → anthropic-FHS5XNK5.js} +5 -5
  6. package/dist/bundle/{app-server-RUTYKELF.js → app-server-IZMFSFP2.js} +54 -46
  7. package/dist/bundle/{bot-api-DW6NAZAQ.js → bot-api-LQP75V5I.js} +61 -53
  8. package/dist/bundle/{bot-history-FAJ2W42U.js → bot-history-EJQOD4AQ.js} +22 -18
  9. package/dist/bundle/{bun-IVP5LSVI.js → bun-GBAZFRCV.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-ATPCJ4CT.js → bun-sqlite-JB4BX6X7.js} +6 -6
  11. package/dist/bundle/chunk-2JZJPVBH.js +334 -0
  12. package/dist/bundle/{chunk-FHGAJK4I.js → chunk-2LPODKIF.js} +15 -15
  13. package/dist/bundle/chunk-3KZG63EH.js +170 -0
  14. package/dist/bundle/chunk-3XMUP55N.js +372 -0
  15. package/dist/bundle/{chunk-MDGLKMLD.js → chunk-4BJAQNJ5.js} +9 -9
  16. package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-66PL7P4C.js} +1 -1
  17. package/dist/bundle/{chunk-MOUPWPNL.js → chunk-66UG67CE.js} +12 -12
  18. package/dist/bundle/{chunk-R4QVV3LN.js → chunk-6JBRQ6PM.js} +41 -19
  19. package/dist/bundle/{chunk-GYO4WXLG.js → chunk-6M3FAHPS.js} +3 -3
  20. package/dist/bundle/{chunk-2QHIOPSA.js → chunk-7F3LOHRB.js} +261 -501
  21. package/dist/bundle/{chunk-XS5C5TQ7.js → chunk-AUNNJDVD.js} +25 -8
  22. package/dist/bundle/{chunk-7D6LI2N7.js → chunk-B5RGPZDZ.js} +7 -7
  23. package/dist/bundle/{chunk-YRZXOQOB.js → chunk-B6NQJAUC.js} +2 -2
  24. package/dist/bundle/{chunk-IV2KJQ5F.js → chunk-BMSS3PCY.js} +58 -33
  25. package/dist/bundle/{chunk-LTADKMP5.js → chunk-C4ALE7CH.js} +1 -1
  26. package/dist/bundle/{chunk-WG3BF7SA.js → chunk-CKJ73EF3.js} +1 -1
  27. package/dist/bundle/{chunk-IX3GUNGV.js → chunk-CLG2ISQH.js} +4 -4
  28. package/dist/bundle/{chunk-G3PL3R45.js → chunk-EB2JE722.js} +1 -1
  29. package/dist/bundle/{chunk-J3SX36NE.js → chunk-EUL7HMUL.js} +2 -2
  30. package/dist/bundle/{chunk-PJA43HVE.js → chunk-F6CV4KUN.js} +2 -2
  31. package/dist/bundle/{chunk-7KCBPAQS.js → chunk-F6MLJ3V5.js} +2 -2
  32. package/dist/bundle/{chunk-3UGRMFWK.js → chunk-FH4YIBBH.js} +4 -4
  33. package/dist/bundle/chunk-FIO5NMK3.js +771 -0
  34. package/dist/bundle/{chunk-7I5NMVX7.js → chunk-G2SMVYBU.js} +2 -2
  35. package/dist/bundle/{chunk-FIVFP53N.js → chunk-GA3URWIF.js} +1 -1
  36. package/dist/bundle/{chunk-2A3TC52A.js → chunk-GGGBPWUS.js} +10 -15
  37. package/dist/bundle/{chunk-KKZQK6IK.js → chunk-GSHTLLCJ.js} +2 -2
  38. package/dist/bundle/{chunk-F4UIBEQK.js → chunk-GYCKRIRK.js} +3 -3
  39. package/dist/bundle/{chunk-WPMJQIEU.js → chunk-HHUK3XO5.js} +1 -1
  40. package/dist/bundle/{chunk-NM5GBJME.js → chunk-HT6OFANN.js} +19 -19
  41. package/dist/bundle/{chunk-ODBK56ZR.js → chunk-I5PILOTU.js} +1 -1
  42. package/dist/bundle/chunk-IBSHQWIJ.js +29 -0
  43. package/dist/bundle/{chunk-RZFIQMOA.js → chunk-IRWSZJYL.js} +60 -58
  44. package/dist/bundle/{chunk-BVCRDHI2.js → chunk-IV6SIKVH.js} +4 -4
  45. package/dist/bundle/{chunk-URFBZNLU.js → chunk-JUFLELQ7.js} +2 -2
  46. package/dist/bundle/{chunk-XYAH6QQO.js → chunk-KY3JLXW2.js} +4 -4
  47. package/dist/bundle/{chunk-YSXDCSBP.js → chunk-LPT5T6PU.js} +29 -30
  48. package/dist/bundle/chunk-LQPZDDDP.js +259 -0
  49. package/dist/bundle/{chunk-JI2PFQFL.js → chunk-M327UNS6.js} +6 -6
  50. package/dist/bundle/{chunk-SDLJJF7E.js → chunk-MS6YEIG5.js} +13 -13
  51. package/dist/bundle/{chunk-WMUPZ3IY.js → chunk-MVFSWKTM.js} +12 -12
  52. package/dist/bundle/{chunk-YVV5S2QA.js → chunk-NRCY3WBC.js} +2 -2
  53. package/dist/bundle/{chunk-2IL4YDGG.js → chunk-O2ULG7OO.js} +3 -3
  54. package/dist/bundle/{chunk-E56QE3UC.js → chunk-OJMDKWWL.js} +627 -503
  55. package/dist/bundle/{chunk-UURJO46N.js → chunk-OKTRB4ZQ.js} +1 -1
  56. package/dist/bundle/{chunk-OX6574YV.js → chunk-OOQVHMCS.js} +15 -15
  57. package/dist/bundle/{chunk-IIHCSJV2.js → chunk-OWVQMK7G.js} +700 -837
  58. package/dist/bundle/{chunk-WMF6SL5D.js → chunk-P4FZJO5F.js} +2 -2
  59. package/dist/bundle/{chunk-LD42OGKK.js → chunk-PS7ZS5HD.js} +4 -4
  60. package/dist/bundle/{chunk-EAUHYQUK.js → chunk-PWQKGFS2.js} +36 -34
  61. package/dist/bundle/{chunk-MGBVVQTU.js → chunk-QBNEWEJC.js} +3 -3
  62. package/dist/bundle/{chunk-QYN5RDTZ.js → chunk-QDEP2QOA.js} +3 -3
  63. package/dist/bundle/{chunk-QO4ON2X7.js → chunk-QFVIHBLD.js} +1 -1
  64. package/dist/bundle/{chunk-ZVLYK6CZ.js → chunk-QJDHRBXL.js} +7 -7
  65. package/dist/bundle/{chunk-IHLNXL2D.js → chunk-QJLCEOAP.js} +1 -1
  66. package/dist/bundle/{chunk-KF2Q776U.js → chunk-RAFK5KXU.js} +9 -9
  67. package/dist/bundle/{chunk-RIGNCUZD.js → chunk-RPWYTOLI.js} +5 -5
  68. package/dist/bundle/{chunk-4DSIGS2E.js → chunk-RZPMFVWM.js} +6 -6
  69. package/dist/bundle/chunk-S5UTBEV3.js +1974 -0
  70. package/dist/bundle/{chunk-MC6FOTCV.js → chunk-SYZXOEHY.js} +3 -3
  71. package/dist/bundle/{chunk-5AP25FMW.js → chunk-SZB5WRMI.js} +2 -2
  72. package/dist/bundle/{chunk-Q3ZO6Q3M.js → chunk-TGRB4SSZ.js} +4 -4
  73. package/dist/bundle/{chunk-TQFUAKU6.js → chunk-VSPSHBAC.js} +2 -2
  74. package/dist/bundle/{chunk-TGUXKG4B.js → chunk-VTJ3AOTT.js} +17 -17
  75. package/dist/bundle/{chunk-T2CWSFGY.js → chunk-VXWDQDRU.js} +6341 -6902
  76. package/dist/bundle/{chunk-JJGPU24U.js → chunk-X5H5NERR.js} +6 -6
  77. package/dist/bundle/{chunk-AF2XVV5P.js → chunk-XHX5D5VE.js} +727 -2598
  78. package/dist/bundle/chunk-XXW6PFAX.js +16 -0
  79. package/dist/bundle/{chunk-NXDQXDRN.js → chunk-ZRQQOGAZ.js} +4 -4
  80. package/dist/bundle/command-contract-G752BLKA.js +37 -0
  81. package/dist/bundle/{command-server-entry-BU3X4XNL.js → command-server-entry-YR6ONDWO.js} +27 -24
  82. package/dist/bundle/decode-VUKGWFSW.js +296 -0
  83. package/dist/bundle/{dispatch-PRAIGIFS.js → dispatch-ST5FK2KI.js} +8 -8
  84. package/dist/bundle/{echarts-NAXLKJLA.js → echarts-GOV5M733.js} +2 -2
  85. package/dist/bundle/{embed-LB6ONWHX.js → embed-2IVIYNAJ.js} +6 -6
  86. package/dist/bundle/{embedder-WE7B2RU5.js → embedder-2HU7JYZK.js} +9 -9
  87. package/dist/bundle/{entry-W6Y52ZRN.js → entry-CSTCXYI5.js} +9 -9
  88. package/dist/bundle/{failure-7Y34AUJT.js → failure-GMUQKQ5K.js} +2 -2
  89. package/dist/bundle/{first-run-NVYNZZA6.js → first-run-3IZGXZT5.js} +12 -11
  90. package/dist/bundle/first-screen-7QSNCZIK.js +35 -0
  91. package/dist/bundle/{instructions-MRUC57NS.js → instructions-YSXV6FAC.js} +1 -1
  92. package/dist/bundle/{mcp-TDKGDB4V.js → mcp-VFIOZDVY.js} +2 -2
  93. package/dist/bundle/meeting-combined-X4E3LSIJ.js +23 -0
  94. package/dist/bundle/meeting-model-FQBDHGRU.js +24 -0
  95. package/dist/bundle/meeting-semantic-ONNEOJX5.js +21 -0
  96. package/dist/bundle/{node-G7PMDYQV.js → node-FMQWCZRS.js} +2 -2
  97. package/dist/bundle/{node-sqlite-RXWQ3SES.js → node-sqlite-YN5OKOC6.js} +7 -7
  98. package/dist/bundle/{oauth-6ZWOL6KX.js → oauth-EW7PTZVT.js} +7 -7
  99. package/dist/bundle/{open-V7LMZCFI.js → open-Q2RDY344.js} +5 -5
  100. package/dist/bundle/{openai-P472V4ZM.js → openai-STON6G3O.js} +28 -26
  101. package/dist/bundle/{process-GSNPENHL.js → process-OQUC2TW3.js} +1 -1
  102. package/dist/bundle/{program-IELITPKT.js → program-7JJHTZ25.js} +66 -57
  103. package/dist/bundle/{prompt-2CP6CQ5N.js → prompt-WHVF7UTW.js} +5 -5
  104. package/dist/bundle/{proxy-transport-DP7SIMIC.js → proxy-transport-A4MRO3PF.js} +5 -5
  105. package/dist/bundle/{recognize-R2DEQ5TC.js → recognize-YDQWMXNI.js} +4 -4
  106. package/dist/bundle/{remote-JG3POFES.js → remote-477LQHP6.js} +9 -9
  107. package/dist/bundle/{rerank-TVMR3OLL.js → rerank-4YPB26FG.js} +7 -7
  108. package/dist/bundle/{serve-DBWSMLPH.js → serve-FXJNUOTS.js} +9 -9
  109. package/dist/bundle/{server-EXJ2WNZY.js → server-2S6HFBGR.js} +44 -36
  110. package/dist/bundle/server-UOSUTZNE.js +69 -0
  111. package/dist/bundle/{sqlite-runtime-AWMY7W4Q.js → sqlite-runtime-RXYNJYMC.js} +6 -6
  112. package/dist/bundle/{state-HN44BWNQ.js → state-I2GGYGRL.js} +6 -6
  113. package/dist/bundle/{store-LOVKYQDC.js → store-KX3AAQZH.js} +25 -20
  114. package/dist/bundle/{store-GIYS3LHV.js → store-VQXIB6KV.js} +17 -13
  115. package/dist/bundle/store-maintenance-command-LW2MMDLY.js +60 -0
  116. package/dist/bundle/tg.js +13 -13
  117. package/dist/version.d.ts +1 -1
  118. package/dist/version.js +1 -1
  119. package/package.json +3 -3
  120. package/dist/bundle/command-contract-3BSXDYBC.js +0 -34
  121. package/dist/bundle/decode-NXB7E46F.js +0 -162
  122. package/dist/bundle/first-screen-Z6TVHK6I.js +0 -32
  123. package/dist/bundle/server-SXNFFAIR.js +0 -61
  124. package/dist/bundle/store-maintenance-command-X3VOYNCG.js +0 -52
  125. /package/dist/bundle/{chunk-XWBPP2HX.js → chunk-ZI3YTXSF.js} +0 -0
@@ -0,0 +1,372 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ validateVector
5
+ } from "./chunk-3KZG63EH.js";
6
+ import {
7
+ MESSAGE_PARSING,
8
+ RRF_K
9
+ } from "./chunk-FIO5NMK3.js";
10
+ import {
11
+ normalize
12
+ } from "./chunk-XXW6PFAX.js";
13
+ import {
14
+ meaningFloor
15
+ } from "./chunk-2JZJPVBH.js";
16
+ import {
17
+ formatMeetingReference,
18
+ implicitTextTerms,
19
+ liftMeetingFields,
20
+ parseLucene,
21
+ parseMeetingReference,
22
+ walkQuery
23
+ } from "./chunk-XHX5D5VE.js";
24
+ import {
25
+ CliError
26
+ } from "./chunk-F6MLJ3V5.js";
27
+ import {
28
+ __name
29
+ } from "./chunk-ZVVMGPBJ.js";
30
+
31
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
32
+ import { createHash } from "node:crypto";
33
+
34
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/search/question-plan.js
35
+ var words = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
36
+ 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");
37
+ 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"));
38
+ var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
39
+ 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"));
40
+ 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"));
41
+ 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"));
42
+ var isFunctionWord = /* @__PURE__ */ __name((word) => scaffolding.has(word) || QUESTION_STARTS.has(word) || QUESTION_FILLER.has(word) || LINKING.has(word), "isFunctionWord");
43
+ 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");
44
+ function planQuestion(text, strict = false) {
45
+ if (strict)
46
+ return {
47
+ changed: false,
48
+ natural: false,
49
+ queries: [text],
50
+ scope: "",
51
+ terms: words(text),
52
+ rankingTerms: words(text),
53
+ removed: [],
54
+ aliases: []
55
+ };
56
+ const inputAst = parseLucene(text, MESSAGE_PARSING);
57
+ const rawTextual = walkQuery(inputAst.root).filter((node) => node.field === "text" || node.field === "exact");
58
+ const body = rawTextual.map((node) => node.value).join(" ");
59
+ const prefix = words(body).slice(0, 2);
60
+ const questionPrefix = [
61
+ "what",
62
+ "which",
63
+ "how",
64
+ "who",
65
+ "where",
66
+ "when",
67
+ "can",
68
+ "could",
69
+ "should",
70
+ "\u0441\u043A\u043E\u043B\u044C\u043A\u043E",
71
+ "\u043A\u0430\u043A\u043E\u0438",
72
+ "\u043A\u0430\u043A\u0430\u044F",
73
+ "\u043A\u0430\u043A\u0438\u0435",
74
+ "\u043A\u0430\u043A\u043E\u0435",
75
+ "\u043A\u0442\u043E",
76
+ "\u043A\u043E\u043C\u0443",
77
+ "\u043A\u0435\u043C",
78
+ "\u0433\u0434\u0435",
79
+ "\u043A\u043E\u0433\u0434\u0430",
80
+ "\u043A\u0430\u043A",
81
+ "\u0447\u0442\u043E",
82
+ "\u043C\u043E\u0436\u043D\u043E",
83
+ "\u043C\u043E\u0436\u0435\u0442",
84
+ "\u043C\u043E\u0433\u0443\u0442"
85
+ ].includes(prefix[0] ?? "") || ["\u043A", "\u0432\u043E"].includes(prefix[0] ?? "") && ["\u043A\u043E\u043C\u0443", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E"].includes(prefix[1] ?? "");
86
+ const natural = questionWord.test(body) && (/\?/u.test(body) || questionPrefix);
87
+ let cleaned = text;
88
+ if (natural && !text.includes("\\")) {
89
+ const last = rawTextual.at(-1);
90
+ const mark = (last?.span.end ?? 0) - 1;
91
+ if (last?.operator === "wildcard" && text[mark] === "?")
92
+ cleaned = text.slice(0, mark) + text.slice(mark + 1);
93
+ }
94
+ const ast = cleaned === text ? inputAst : parseLucene(cleaned, MESSAGE_PARSING);
95
+ const predicates = walkQuery(ast.root);
96
+ const textual = predicates.filter((p) => p.field === "text" || p.field === "exact");
97
+ const fields = predicates.filter((p) => p.field !== "text" && p.field !== "exact");
98
+ const scope = fields.map((p) => {
99
+ const raw = cleaned.slice(p.span.start, p.span.end);
100
+ return new RegExp(`^${p.field}[:=<>]`, "u").test(raw) ? raw : `${p.field}:${raw}`;
101
+ }).join(" ");
102
+ 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.
103
+ textual.some((p) => !(p.operator === "term" || p.operator === "phrase" && !/\s/u.test(p.value)) || p.field === "exact");
104
+ if (bypass)
105
+ return {
106
+ changed: false,
107
+ natural: false,
108
+ queries: [text],
109
+ scope,
110
+ terms: textual.flatMap((p) => words(p.value)),
111
+ rankingTerms: textual.flatMap((p) => words(p.value)),
112
+ removed: [],
113
+ aliases: []
114
+ };
115
+ const original = textual.flatMap((p) => words(p.value));
116
+ const removed = original.filter((w) => scaffolding.has(w));
117
+ const terms = [...new Set(original.filter((w) => !scaffolding.has(w)))];
118
+ if (!terms.length)
119
+ return {
120
+ changed: false,
121
+ natural: true,
122
+ queries: [text],
123
+ scope,
124
+ terms,
125
+ rankingTerms: original,
126
+ removed,
127
+ aliases: []
128
+ };
129
+ const alias = [...terms];
130
+ const changes = [];
131
+ const replace = /* @__PURE__ */ __name((from, to) => {
132
+ for (let i = 0; i < alias.length; i++)
133
+ if (from.includes(alias[i] ?? "")) {
134
+ changes.push(`${alias[i]} -> ${to}`);
135
+ alias[i] = to;
136
+ }
137
+ }, "replace");
138
+ 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))) {
139
+ replace(["returned", "refunded", "received"], "refund");
140
+ 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");
141
+ }
142
+ 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))) {
143
+ replace(["lifetime", "kept", "keep"], "retention");
144
+ 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");
145
+ }
146
+ if (terms.includes("service") || terms.includes("build"))
147
+ replace(["currently", "now"], "current");
148
+ const render = /* @__PURE__ */ __name((ws) => [...new Set(ws)].join(" ") + (scope ? ` ${scope}` : ""), "render");
149
+ const queries = [.../* @__PURE__ */ new Set([render(terms), render(alias)])].slice(0, 2);
150
+ return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
151
+ }
152
+ __name(planQuestion, "planQuestion");
153
+ var questionText = /* @__PURE__ */ __name((text) => text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
154
+ var lookupTerms = /* @__PURE__ */ __name((plan) => [
155
+ ...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))
156
+ ], "lookupTerms");
157
+ var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
158
+ var questionLookup = /* @__PURE__ */ __name((text) => {
159
+ let plan;
160
+ try {
161
+ plan = planQuestion(questionText(text));
162
+ } catch (error) {
163
+ if (error instanceof CliError)
164
+ return void 0;
165
+ throw error;
166
+ }
167
+ const terms = plan.changed ? lookupTerms(plan) : [];
168
+ return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
169
+ }, "questionLookup");
170
+
171
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
172
+ var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
173
+ let before = Number.POSITIVE_INFINITY;
174
+ for (; ; ) {
175
+ signal?.throwIfAborted();
176
+ const { indexed, remaining } = await meetings.indexSearch({
177
+ accountId,
178
+ limit: 1e3,
179
+ maxReadBytes: 64 * 1024 ** 2,
180
+ signal
181
+ });
182
+ if (remaining === 0 || indexed === 0 || remaining >= before)
183
+ return;
184
+ before = remaining;
185
+ }
186
+ }, "refreshMeetingIndex");
187
+ var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
188
+ const { project, tag, topic, ...input } = request;
189
+ input.signal?.throwIfAborted();
190
+ if (project !== void 0 && input.projectId !== void 0 || [tag, topic].filter((value) => value !== void 0).length + Number(input.tagId !== void 0) > 1)
191
+ throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
192
+ const selection = [];
193
+ const knowledge = store.knowledge;
194
+ if (!knowledge && [project, tag, topic].some((value) => value !== void 0))
195
+ throw new CliError("configuration_error", "this store cannot resolve project, tag or topic names");
196
+ for (const [kind, name] of [
197
+ ["project", project],
198
+ ["tag", tag],
199
+ ["topic", topic]
200
+ ]) {
201
+ if (name === void 0)
202
+ continue;
203
+ if (!knowledge)
204
+ continue;
205
+ const found = await knowledge.resolveVocabulary(name, { kind, signal: input.signal });
206
+ input.signal?.throwIfAborted();
207
+ if (found.ambiguous || found.matches.length !== 1)
208
+ throw new CliError(found.matches.length ? "validation_error" : "not_found", `the ${kind} name needs one canonical record`, {
209
+ candidates: found.matches.map((entry2) => ({ kind: entry2.kind, id: entry2.id, name: entry2.name }))
210
+ });
211
+ const entry = found.matches[0];
212
+ const id = Number(entry?.id);
213
+ if (!entry || entry.kind !== kind || !Number.isSafeInteger(id) || id < 1)
214
+ throw new CliError("invalid_response", "vocabulary resolution returned an invalid canonical record");
215
+ if (kind === "project")
216
+ input.projectId = id;
217
+ else
218
+ input.tagId = id;
219
+ selection.push({ kind, id, name: entry.name, by: "explicit-link" });
220
+ }
221
+ return { input, selection };
222
+ }, "resolveMeetingSelection");
223
+
224
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
225
+ var DEPTH = 200;
226
+ var cursorOf = /* @__PURE__ */ __name((value, key) => {
227
+ if (value === void 0)
228
+ return 0;
229
+ let cursor;
230
+ try {
231
+ cursor = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
232
+ } catch {
233
+ throw new CliError("validation_error", "the cursor is not from a combined meeting search; search again");
234
+ }
235
+ if (cursor?.version !== 1 || cursor.key !== key || !Number.isSafeInteger(cursor.offset) || cursor.offset < 0)
236
+ throw new CliError("validation_error", "the cursor belongs to another query, filter or model; search again");
237
+ return cursor.offset;
238
+ }, "cursorOf");
239
+ var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, typed, request) => {
240
+ const { maxChunks, maxRows, maxTextBytes, ...chosen } = request;
241
+ const { query, request: words2 } = liftMeetingFields(typed, chosen);
242
+ const { input, selection } = await resolveMeetingSelection(store, words2);
243
+ const { after, limit = 20, maxReadBytes, ...filters } = input;
244
+ const terms = questionTerms(query);
245
+ const wordQuery = terms === null ? query : terms.join(" ");
246
+ const key = createHash("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
247
+ const offset = cursorOf(after, key);
248
+ let byWords = [];
249
+ let indexing = "ready";
250
+ let refused;
251
+ if (wordQuery.trim()) {
252
+ await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
253
+ try {
254
+ const page = await store.meetings.searchHits(wordQuery, { ...filters, limit: DEPTH, maxReadBytes });
255
+ byWords = page.items;
256
+ indexing = page.coverage.indexing;
257
+ } catch (error) {
258
+ if (!(error instanceof CliError) || error.code !== "validation_error")
259
+ throw error;
260
+ refused = error.message;
261
+ }
262
+ }
263
+ input.signal?.throwIfAborted();
264
+ const vectors = await embedder.embed([query], "query");
265
+ if (vectors.length !== 1)
266
+ throw new CliError("invalid_response", "Meeting query model returned another vector count");
267
+ const vector = vectors[0];
268
+ const ranked = await store.meetingVectors.ranked(embedder.key, validateVector(vector, embedder.dims), {
269
+ ...filters,
270
+ limit: DEPTH,
271
+ ...maxChunks === void 0 ? {} : { maxChunks },
272
+ ...maxRows === void 0 ? {} : { maxRows },
273
+ ...maxTextBytes === void 0 ? {} : { maxTextBytes }
274
+ });
275
+ const floor = meaningFloor(embedder.key);
276
+ const byMeaning = ranked.items.filter(({ score }) => score > floor);
277
+ const merged = /* @__PURE__ */ new Map();
278
+ byMeaning.forEach((hit, rank) => {
279
+ const reference = { type: "meeting", accountId: input.accountId, meetingId: hit.meetingId };
280
+ const first = formatMeetingReference({
281
+ ...reference,
282
+ transcriptId: hit.transcriptId,
283
+ cuePosition: hit.firstPosition
284
+ });
285
+ merged.set(`${hit.transcriptId}:${hit.firstPosition}`, {
286
+ ref: first,
287
+ meetingId: hit.meetingId,
288
+ scope: "transcript",
289
+ text: hit.text,
290
+ startMs: null,
291
+ source: { title: hit.title, startedAt: hit.startedAt, url: null },
292
+ by: ["meaning"],
293
+ score: hit.score,
294
+ passage: {
295
+ first,
296
+ last: formatMeetingReference({ ...reference, transcriptId: hit.transcriptId, cuePosition: hit.lastPosition })
297
+ },
298
+ fused: 1 / (RRF_K + rank + 1)
299
+ });
300
+ });
301
+ byWords.forEach((hit, rank) => {
302
+ const share = 1 / (RRF_K + rank + 1);
303
+ const cue = hit.scope === "transcript" ? parseMeetingReference(hit.ref) : void 0;
304
+ const within = cue?.cuePosition === void 0 ? void 0 : byMeaning.find((passage) => passage.transcriptId === cue.transcriptId && passage.firstPosition <= cue.cuePosition && cue.cuePosition <= passage.lastPosition);
305
+ const held = within && merged.get(`${within.transcriptId}:${within.firstPosition}`);
306
+ const found = {
307
+ ref: hit.ref,
308
+ text: hit.text,
309
+ startMs: hit.startMs,
310
+ ...hit.match === void 0 ? {} : { match: hit.match },
311
+ ...hit.corrections === void 0 ? {} : { corrections: hit.corrections }
312
+ };
313
+ if (held && !held.by.includes("words")) {
314
+ Object.assign(held, found, { by: ["words", "meaning"], fused: held.fused + share });
315
+ if (hit.source?.url)
316
+ held.source.url = hit.source.url;
317
+ } else if (held)
318
+ held.fused += share;
319
+ else
320
+ merged.set(`w:${hit.ref}:${hit.scope}:${hit.id}`, {
321
+ ...found,
322
+ meetingId: hit.meetingId,
323
+ scope: hit.scope,
324
+ source: {
325
+ title: hit.source?.title ?? null,
326
+ startedAt: hit.source?.startedAt ?? null,
327
+ url: hit.source?.url ?? null
328
+ },
329
+ by: ["words"],
330
+ score: null,
331
+ fused: share
332
+ });
333
+ });
334
+ 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));
335
+ const items = ordered.slice(offset, offset + limit).map(({ fused: _, ...hit }) => hit);
336
+ const hasMore = ordered.length > offset + limit;
337
+ return {
338
+ items,
339
+ hasMore,
340
+ nextCursor: hasMore ? Buffer.from(JSON.stringify({ version: 1, key, offset: offset + limit })).toString("base64url") : null,
341
+ selection,
342
+ words: {
343
+ query: wordQuery,
344
+ ...terms === null ? {} : { from: "question" },
345
+ ...refused === void 0 ? {} : { refused }
346
+ },
347
+ model: { key: embedder.key, model: embedder.model, kind: embedder.kind, dims: embedder.dims },
348
+ coverage: {
349
+ archiveCompleteness: "unknown",
350
+ indexCompleteness: "unknown",
351
+ indexing,
352
+ /** Every vector of the selection was compared; false when `maxChunks` stopped the scan. */
353
+ meaningScanComplete: ranked.complete,
354
+ scanned: ranked.scanned,
355
+ /** Each side ranks this many at most; pages past them hold nothing more. */
356
+ depth: DEPTH
357
+ }
358
+ };
359
+ }, "searchMeetingsCombined");
360
+
361
+ export {
362
+ words,
363
+ joinedHyphens,
364
+ isFunctionWord,
365
+ planQuestion,
366
+ questionText,
367
+ lookupTerms,
368
+ anyOfTerms,
369
+ questionLookup,
370
+ resolveMeetingSelection,
371
+ searchMeetingsCombined
372
+ };
@@ -1,30 +1,30 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
- import {
4
- isCommandServer
5
- } from "./chunk-UURJO46N.js";
6
3
  import {
7
4
  stdinFieldOf
8
- } from "./chunk-ODBK56ZR.js";
5
+ } from "./chunk-I5PILOTU.js";
6
+ import {
7
+ isCommandServer
8
+ } from "./chunk-OKTRB4ZQ.js";
9
9
  import {
10
10
  commandPathOf
11
- } from "./chunk-XYAH6QQO.js";
11
+ } from "./chunk-KY3JLXW2.js";
12
12
  import {
13
13
  commandServerRequest,
14
14
  metaOf
15
- } from "./chunk-2QHIOPSA.js";
15
+ } from "./chunk-7F3LOHRB.js";
16
16
  import {
17
17
  errorObjectOf,
18
18
  renderError
19
- } from "./chunk-XS5C5TQ7.js";
19
+ } from "./chunk-AUNNJDVD.js";
20
20
  import {
21
21
  CliError
22
- } from "./chunk-7KCBPAQS.js";
22
+ } from "./chunk-F6MLJ3V5.js";
23
23
  import {
24
24
  __name
25
25
  } from "./chunk-ZVVMGPBJ.js";
26
26
 
27
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/command-server.js
27
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/command-server.js
28
28
  import { createInterface } from "node:readline";
29
29
  var COMMAND_SERVER_PROTOCOL = 1;
30
30
  var COMMAND_SERVER_IDLE_MS = 10 * 6e4;
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/installer.js
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/installer.js
8
8
  var installerOf = /* @__PURE__ */ __name((scriptPath) => {
9
9
  const path = scriptPath.replaceAll("\\", "/");
10
10
  if (path.includes("/_npx/"))
@@ -2,31 +2,31 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  updateCommand
5
- } from "./chunk-LD42OGKK.js";
5
+ } from "./chunk-PS7ZS5HD.js";
6
6
  import {
7
7
  DEFAULT_STEMMERS,
8
8
  LANGUAGES
9
- } from "./chunk-2A3TC52A.js";
9
+ } from "./chunk-GGGBPWUS.js";
10
10
  import {
11
11
  installerOf
12
- } from "./chunk-M4OP5ASJ.js";
12
+ } from "./chunk-66PL7P4C.js";
13
13
  import {
14
14
  QUESTIONS,
15
15
  readSetupAnswers,
16
16
  unanswered,
17
17
  writeSetupAnswers
18
- } from "./chunk-QYN5RDTZ.js";
18
+ } from "./chunk-QDEP2QOA.js";
19
19
  import {
20
20
  sharedConfigPath
21
- } from "./chunk-7D6LI2N7.js";
21
+ } from "./chunk-B5RGPZDZ.js";
22
22
  import {
23
23
  storePath
24
- } from "./chunk-TQFUAKU6.js";
24
+ } from "./chunk-VSPSHBAC.js";
25
25
  import {
26
26
  __name
27
27
  } from "./chunk-ZVVMGPBJ.js";
28
28
 
29
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/first-run.js
29
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/first-run.js
30
30
  import { spawnSync } from "node:child_process";
31
31
  import { accessSync, constants, realpathSync } from "node:fs";
32
32
  import { delimiter, join } from "node:path";
@@ -84,7 +84,7 @@ var suggested = /* @__PURE__ */ __name((env, contentLanguages) => {
84
84
  return (own.length ? own : LANGUAGES.filter(({ code }) => code === "en" || code === system)).map(({ name }) => name);
85
85
  }, "suggested");
86
86
  var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLanguages }) => {
87
- const { openStore } = await import("./store-GIYS3LHV.js");
87
+ const { openStore } = await import("./store-VQXIB6KV.js");
88
88
  const store = await openStore({ env });
89
89
  let rebuild = false;
90
90
  try {
@@ -113,8 +113,8 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
113
113
  if (!rebuild)
114
114
  return;
115
115
  const [{ openCache }, { buildStems }] = await Promise.all([
116
- import("./open-V7LMZCFI.js"),
117
- import("./store-maintenance-command-X3VOYNCG.js")
116
+ import("./open-Q2RDY344.js"),
117
+ import("./store-maintenance-command-LW2MMDLY.js")
118
118
  ]);
119
119
  const database = await openCache(storePath(env));
120
120
  try {
@@ -126,7 +126,7 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
126
126
  var askTools = /* @__PURE__ */ __name(async (run) => {
127
127
  const { command, env, io } = run;
128
128
  const installed = run.installed ?? ((name) => onPath(name, env));
129
- const { WIRECAT_TOOLS } = await import("./first-screen-Z6TVHK6I.js");
129
+ const { WIRECAT_TOOLS } = await import("./first-screen-7QSNCZIK.js");
130
130
  const others = WIRECAT_TOOLS.filter((tool) => tool.command !== command);
131
131
  const missing = others.filter((tool) => !installed(tool.command));
132
132
  io.say("Other WireCat tools \u2014 they share this store, so one search finds everything:");
@@ -199,7 +199,7 @@ var setupAtStart = /* @__PURE__ */ __name(async (start) => {
199
199
  contentLanguages: start.contentLanguages,
200
200
  all: start.path[0] === "setup",
201
201
  io: {
202
- ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-2CP6CQ5N.js")).readSecret(prompt, { input, echo: true }), "ask"),
202
+ ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-WHVF7UTW.js")).readSecret(prompt, { input, echo: true }), "ask"),
203
203
  say: /* @__PURE__ */ __name((text) => process.stderr.write(`${text}
204
204
  `), "say")
205
205
  }