@wirecat/yandex-disk-cli 0.0.0-stage → 0.1.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 (235) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +204 -0
  3. package/README.md +243 -2
  4. package/contracts/wirecat.json +1554 -0
  5. package/dist/bin/ydisk.d.ts +3 -0
  6. package/dist/bin/ydisk.d.ts.map +1 -0
  7. package/dist/bin/ydisk.js +40 -0
  8. package/dist/bin/ydisk.js.map +1 -0
  9. package/dist/bundle/all-profiles-4OLZF3RT.js +279 -0
  10. package/dist/bundle/anthropic-DKB4OJXZ.js +91 -0
  11. package/dist/bundle/app-server-G4545SSV.js +247 -0
  12. package/dist/bundle/bun-RXEQKFED.js +169 -0
  13. package/dist/bundle/bun-sqlite-VHT5LN7U.js +76 -0
  14. package/dist/bundle/chunk-2BITUXGC.js +12289 -0
  15. package/dist/bundle/chunk-2CLWDQKA.js +39330 -0
  16. package/dist/bundle/chunk-2JFDOPKA.js +9575 -0
  17. package/dist/bundle/chunk-3GVI2MAO.js +106 -0
  18. package/dist/bundle/chunk-3SZBWBMI.js +131 -0
  19. package/dist/bundle/chunk-44VSEXW6.js +4054 -0
  20. package/dist/bundle/chunk-4YPRRQBE.js +95 -0
  21. package/dist/bundle/chunk-5COYRL5B.js +379 -0
  22. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  23. package/dist/bundle/chunk-5DM7DIZL.js +1402 -0
  24. package/dist/bundle/chunk-6R2DVTVZ.js +24 -0
  25. package/dist/bundle/chunk-762BS35H.js +2787 -0
  26. package/dist/bundle/chunk-AG64V7AB.js +1233 -0
  27. package/dist/bundle/chunk-BC5HGIXB.js +334 -0
  28. package/dist/bundle/chunk-BH7LFEX7.js +36 -0
  29. package/dist/bundle/chunk-BLNPGY7N.js +53 -0
  30. package/dist/bundle/chunk-CNIA2LJF.js +372 -0
  31. package/dist/bundle/chunk-COSXMDC7.js +230 -0
  32. package/dist/bundle/chunk-D72URWJE.js +532 -0
  33. package/dist/bundle/chunk-D7FO33KU.js +785 -0
  34. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  35. package/dist/bundle/chunk-DJH26PQ3.js +1396 -0
  36. package/dist/bundle/chunk-DJPT7IUC.js +64567 -0
  37. package/dist/bundle/chunk-DTMSCZDW.js +209 -0
  38. package/dist/bundle/chunk-E6LGZ5LX.js +16 -0
  39. package/dist/bundle/chunk-E6YRIHS5.js +92 -0
  40. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  41. package/dist/bundle/chunk-F3DDSZTF.js +78 -0
  42. package/dist/bundle/chunk-F4WWTQNL.js +188 -0
  43. package/dist/bundle/chunk-FDDAUASC.js +1028 -0
  44. package/dist/bundle/chunk-FMNPG6N2.js +170 -0
  45. package/dist/bundle/chunk-FOKJ4POB.js +274 -0
  46. package/dist/bundle/chunk-G22C7JG6.js +731 -0
  47. package/dist/bundle/chunk-GA442SYZ.js +161 -0
  48. package/dist/bundle/chunk-GEBSW7UK.js +6848 -0
  49. package/dist/bundle/chunk-GGRKWAOK.js +594 -0
  50. package/dist/bundle/chunk-HHINRNZA.js +788 -0
  51. package/dist/bundle/chunk-HUZCL33L.js +128 -0
  52. package/dist/bundle/chunk-IALSIQVT.js +142 -0
  53. package/dist/bundle/chunk-IOXR2QBX.js +398 -0
  54. package/dist/bundle/chunk-J5CXR6VX.js +63 -0
  55. package/dist/bundle/chunk-J5PWSTOX.js +82 -0
  56. package/dist/bundle/chunk-J7BVAEHR.js +364 -0
  57. package/dist/bundle/chunk-JH46HMZW.js +1334 -0
  58. package/dist/bundle/chunk-JOBO7F6W.js +52 -0
  59. package/dist/bundle/chunk-JXZ5B3L5.js +2333 -0
  60. package/dist/bundle/chunk-KBIAMDZN.js +66 -0
  61. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  62. package/dist/bundle/chunk-LNHTLSR5.js +288 -0
  63. package/dist/bundle/chunk-M24RAKMJ.js +58 -0
  64. package/dist/bundle/chunk-MDQ57Q3H.js +1197 -0
  65. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  66. package/dist/bundle/chunk-MLXQ4X5L.js +206 -0
  67. package/dist/bundle/chunk-NQAKARHE.js +54 -0
  68. package/dist/bundle/chunk-OF7VVUDQ.js +23 -0
  69. package/dist/bundle/chunk-OQVPE3XK.js +324 -0
  70. package/dist/bundle/chunk-OR3QG7UR.js +259 -0
  71. package/dist/bundle/chunk-OUUYVROP.js +76 -0
  72. package/dist/bundle/chunk-PQBAM64O.js +168 -0
  73. package/dist/bundle/chunk-PYVIA7WF.js +88 -0
  74. package/dist/bundle/chunk-Q6HK3PHE.js +72 -0
  75. package/dist/bundle/chunk-QB3KECV2.js +218 -0
  76. package/dist/bundle/chunk-QGWXSFYN.js +73 -0
  77. package/dist/bundle/chunk-RC5QAAAE.js +29 -0
  78. package/dist/bundle/chunk-RMJ26HLB.js +18 -0
  79. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  80. package/dist/bundle/chunk-T7ZUDA4C.js +72 -0
  81. package/dist/bundle/chunk-TRCSMVV5.js +72 -0
  82. package/dist/bundle/chunk-UD2BQEKA.js +46 -0
  83. package/dist/bundle/chunk-V4TL55GS.js +1068 -0
  84. package/dist/bundle/chunk-VJNWN5VU.js +4072 -0
  85. package/dist/bundle/chunk-VRRNBLMA.js +1227 -0
  86. package/dist/bundle/chunk-WUCMMNFJ.js +771 -0
  87. package/dist/bundle/chunk-XDESE3NY.js +44 -0
  88. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  89. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  90. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  91. package/dist/bundle/chunk-Z2QEON7B.js +2275 -0
  92. package/dist/bundle/chunk-ZMJ56GME.js +7 -0
  93. package/dist/bundle/chunk-ZTSB3D7Q.js +100 -0
  94. package/dist/bundle/chunk-ZVJWD3FK.js +38 -0
  95. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  96. package/dist/bundle/command-contract-YIOYGPJA.js +40 -0
  97. package/dist/bundle/command-server-entry-MHBQDXS4.js +169 -0
  98. package/dist/bundle/decode-NUGJIOUW.js +297 -0
  99. package/dist/bundle/definitions-AILHKEQT.js +2005 -0
  100. package/dist/bundle/dispatch-5LC4UEGY.js +411 -0
  101. package/dist/bundle/dist-4I2W6X2I.js +7577 -0
  102. package/dist/bundle/echarts-MHSH6PGC.js +42501 -0
  103. package/dist/bundle/embed-ZDXTHHYS.js +38 -0
  104. package/dist/bundle/embedder-XFEELFUL.js +111 -0
  105. package/dist/bundle/failure-5S7VPBYK.js +25 -0
  106. package/dist/bundle/first-run-JHCHT3RJ.js +29 -0
  107. package/dist/bundle/first-screen-FHGQ6QRV.js +40 -0
  108. package/dist/bundle/instructions-WKSMBUFX.js +11 -0
  109. package/dist/bundle/mcp-HS2ZDUVR.js +167 -0
  110. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  111. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  112. package/dist/bundle/meeting-combined-K4U4NYRZ.js +25 -0
  113. package/dist/bundle/meeting-model-KCEG6Y5O.js +26 -0
  114. package/dist/bundle/meeting-semantic-VYGSV3H6.js +22 -0
  115. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  116. package/dist/bundle/node-CM6NC6UE.js +176 -0
  117. package/dist/bundle/node-KM3CUABH.js +2340 -0
  118. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  119. package/dist/bundle/node-sqlite-5YDQ3LIJ.js +74 -0
  120. package/dist/bundle/notes-search-PGO7KM2U.js +62 -0
  121. package/dist/bundle/oauth-NY4C5UCK.js +20 -0
  122. package/dist/bundle/open-YNUTA6ZE.js +23 -0
  123. package/dist/bundle/openai-4CVT5PHH.js +241 -0
  124. package/dist/bundle/process-2XT3TL27.js +91 -0
  125. package/dist/bundle/program-FMIVF5T6.js +31904 -0
  126. package/dist/bundle/prompt-VNWY3H6S.js +17 -0
  127. package/dist/bundle/recognize-JS4PBPSZ.js +26 -0
  128. package/dist/bundle/remote-RCLFH4V2.js +32 -0
  129. package/dist/bundle/rerank-EG6VKYGO.js +52 -0
  130. package/dist/bundle/schemas-ED2LHKXK.js +645 -0
  131. package/dist/bundle/serve-AHG25QXB.js +199 -0
  132. package/dist/bundle/server-5FTB7WM3.js +78 -0
  133. package/dist/bundle/server-JNZVSAZE.js +209 -0
  134. package/dist/bundle/sqlite-runtime-XSZOAQPF.js +20 -0
  135. package/dist/bundle/state-XGVAJFF7.js +36 -0
  136. package/dist/bundle/store-OHSCWZEV.js +177 -0
  137. package/dist/bundle/store-PKSPKJXL.js +293 -0
  138. package/dist/bundle/store-maintenance-command-KAWGBSWK.js +69 -0
  139. package/dist/bundle/ydisk.js +183 -0
  140. package/dist/commands/api.d.ts +9 -0
  141. package/dist/commands/api.d.ts.map +1 -0
  142. package/dist/commands/api.js +59 -0
  143. package/dist/commands/api.js.map +1 -0
  144. package/dist/commands/comments.d.ts +3 -0
  145. package/dist/commands/comments.d.ts.map +1 -0
  146. package/dist/commands/comments.js +114 -0
  147. package/dist/commands/comments.js.map +1 -0
  148. package/dist/commands/files.d.ts +3 -0
  149. package/dist/commands/files.d.ts.map +1 -0
  150. package/dist/commands/files.js +272 -0
  151. package/dist/commands/files.js.map +1 -0
  152. package/dist/commands/library.d.ts +13 -0
  153. package/dist/commands/library.d.ts.map +1 -0
  154. package/dist/commands/library.js +118 -0
  155. package/dist/commands/library.js.map +1 -0
  156. package/dist/commands/session.d.ts +3 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +99 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +18 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +62 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +80 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +77 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/generated/definitions.d.ts +3 -0
  169. package/dist/generated/definitions.d.ts.map +1 -0
  170. package/dist/generated/definitions.js +2001 -0
  171. package/dist/generated/definitions.js.map +1 -0
  172. package/dist/generated/manifest.d.ts +6 -0
  173. package/dist/generated/manifest.d.ts.map +1 -0
  174. package/dist/generated/manifest.js +1473 -0
  175. package/dist/generated/manifest.js.map +1 -0
  176. package/dist/generated/schemas.d.ts +127 -0
  177. package/dist/generated/schemas.d.ts.map +1 -0
  178. package/dist/generated/schemas.js +545 -0
  179. package/dist/generated/schemas.js.map +1 -0
  180. package/dist/generated/types.d.ts +829 -0
  181. package/dist/generated/types.d.ts.map +1 -0
  182. package/dist/generated/types.js +5 -0
  183. package/dist/generated/types.js.map +1 -0
  184. package/dist/identity.d.ts +10 -0
  185. package/dist/identity.d.ts.map +1 -0
  186. package/dist/identity.js +33 -0
  187. package/dist/identity.js.map +1 -0
  188. package/dist/index.d.ts +3 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +3 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/program.d.ts +6 -0
  193. package/dist/program.d.ts.map +1 -0
  194. package/dist/program.js +65 -0
  195. package/dist/program.js.map +1 -0
  196. package/dist/sample/comments.d.ts +61 -0
  197. package/dist/sample/comments.d.ts.map +1 -0
  198. package/dist/sample/comments.js +39 -0
  199. package/dist/sample/comments.js.map +1 -0
  200. package/dist/sample/records.d.ts +16 -0
  201. package/dist/sample/records.d.ts.map +1 -0
  202. package/dist/sample/records.js +22 -0
  203. package/dist/sample/records.js.map +1 -0
  204. package/dist/sample/transport.d.ts +42 -0
  205. package/dist/sample/transport.d.ts.map +1 -0
  206. package/dist/sample/transport.js +153 -0
  207. package/dist/sample/transport.js.map +1 -0
  208. package/dist/version.d.ts +2 -0
  209. package/dist/version.d.ts.map +1 -0
  210. package/dist/version.js +2 -0
  211. package/dist/version.js.map +1 -0
  212. package/dist/wcat.d.ts +3 -0
  213. package/dist/wcat.d.ts.map +1 -0
  214. package/dist/wcat.js +4 -0
  215. package/dist/wcat.js.map +1 -0
  216. package/dist/yandex/source.d.ts +39 -0
  217. package/dist/yandex/source.d.ts.map +1 -0
  218. package/dist/yandex/source.js +189 -0
  219. package/dist/yandex/source.js.map +1 -0
  220. package/dist/yandex/transport.d.ts +41 -0
  221. package/dist/yandex/transport.d.ts.map +1 -0
  222. package/dist/yandex/transport.js +152 -0
  223. package/dist/yandex/transport.js.map +1 -0
  224. package/dist/yandex/writes.d.ts +27 -0
  225. package/dist/yandex/writes.d.ts.map +1 -0
  226. package/dist/yandex/writes.js +61 -0
  227. package/dist/yandex/writes.js.map +1 -0
  228. package/package.json +88 -4
  229. package/skills/yandex-disk-cli/SKILL.md +46 -0
  230. package/skills/yandex-disk-cli/references/api/api-disk-operations-operation-id.md +13 -0
  231. package/skills/yandex-disk-cli/references/api/api-disk-public-resources.md +50 -0
  232. package/skills/yandex-disk-cli/references/api/api-disk-resources.md +171 -0
  233. package/skills/yandex-disk-cli/references/api/api-disk-trash-resources.md +48 -0
  234. package/skills/yandex-disk-cli/references/api/api-disk.md +13 -0
  235. package/skills/yandex-disk-cli/references/api.md +17 -0
@@ -0,0 +1,771 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ tagOf
5
+ } from "./chunk-RC5QAAAE.js";
6
+ import {
7
+ QUERY_LIMITS,
8
+ parseLucene,
9
+ queryAstSchema,
10
+ queryError,
11
+ validateQuery,
12
+ walkQuery
13
+ } from "./chunk-VJNWN5VU.js";
14
+ import {
15
+ safeParse
16
+ } from "./chunk-S4UUN6LD.js";
17
+ import {
18
+ CliError,
19
+ isCliError
20
+ } from "./chunk-T7ZUDA4C.js";
21
+ import {
22
+ __name
23
+ } from "./chunk-ZVVMGPBJ.js";
24
+
25
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
26
+ var QUERY_VERSION = 1;
27
+ var QUERY_LIMITS2 = {
28
+ ...QUERY_LIMITS,
29
+ pattern: 1024,
30
+ states: 1e4,
31
+ expansions: 1e4,
32
+ candidates: 5e4,
33
+ bodyBytes: 8388608,
34
+ milliseconds: 2e3,
35
+ work: 1e7
36
+ };
37
+ var SEARCH_QUERY = {
38
+ command: "search",
39
+ guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md"
40
+ };
41
+ var MESSAGE_PARSING = { ...SEARCH_QUERY, proximity: true };
42
+ var MOST_WORDS_APART = 50;
43
+ function searchError(reason, span, alternative) {
44
+ queryError(reason, span, alternative, SEARCH_QUERY);
45
+ }
46
+ __name(searchError, "searchError");
47
+ var ANSWER_MS = 1e3;
48
+ var searchTimeLimit = /* @__PURE__ */ __name((deadline, now = Date.now()) => deadline?.explicit ? Math.max(QUERY_LIMITS2.milliseconds, deadline.endsAt - now - ANSWER_MS) : void 0, "searchTimeLimit");
49
+ function outOfTime(limitMs = QUERY_LIMITS2.milliseconds) {
50
+ throw new CliError("timeout", `search stopped at its time limit of ${limitMs / 1e3}s \u2014 the query is valid; add chat: or date: to search less of the store`, { reason: "query.time-limit", budget: "time", limit_ms: limitMs, complete: false });
51
+ }
52
+ __name(outOfTime, "outOfTime");
53
+ var isQueryLimit = /* @__PURE__ */ __name((error) => isCliError(error) && (error.details.reason === "query.too-large" || error.details.reason === "query.time-limit"), "isQueryLimit");
54
+ function exhausted(budget) {
55
+ throw new CliError("validation_error", `search exceeded its ${budget} budget \u2014 narrow the chat or date range`, {
56
+ reason: "query.too-large",
57
+ budget,
58
+ complete: false
59
+ });
60
+ }
61
+ __name(exhausted, "exhausted");
62
+ function tooWideTerm([term], budget) {
63
+ if (term === void 0)
64
+ exhausted(budget);
65
+ const part = term.replace(/[*?]+/gu, " ").trim().split(/\s+/u).sort((a, b) => b.length - a.length)[0] ?? term;
66
+ throw new CliError("validation_error", `search exceeded its ${budget} budget: ${term} is checked word by word, and too many messages hold it \u2014 write *${part}* (any word holding it, read from the index), more of the word, or add chat: or date:`, { reason: "query.too-large", budget, term, complete: false });
67
+ }
68
+ __name(tooWideTerm, "tooWideTerm");
69
+
70
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
71
+ var FIELD_VERSION = 2;
72
+ var UNITS = {
73
+ "": 1,
74
+ b: 1,
75
+ k: 1024,
76
+ kb: 1024,
77
+ m: 1024 ** 2,
78
+ mb: 1024 ** 2,
79
+ g: 1024 ** 3,
80
+ gb: 1024 ** 3
81
+ };
82
+ var parseBytes = /* @__PURE__ */ __name((value, span) => {
83
+ const [, amount, unit] = /^(\d+(?:\.\d+)?)\s*([a-z]*)$/iu.exec(value.trim()) ?? [];
84
+ const scale = UNITS[unit?.toLowerCase() ?? ""];
85
+ if (amount === void 0 || scale === void 0)
86
+ searchError("query.invalid-size", span, "use bytes or KB/MB/GB, e.g. 10MB");
87
+ return Math.round(Number(amount) * scale);
88
+ }, "parseBytes");
89
+ var filled = /* @__PURE__ */ __name((node) => {
90
+ if (node.value === "")
91
+ searchError("query.missing-value", node.span);
92
+ }, "filled");
93
+ var validateSize = /* @__PURE__ */ __name((node) => {
94
+ for (const bound of node.operator === "range" ? [node.value, node.upper] : [node.value])
95
+ if (bound !== void 0 && bound !== "*")
96
+ parseBytes(bound, node.span);
97
+ }, "validateSize");
98
+ var validateTag = /* @__PURE__ */ __name((node) => {
99
+ if (node.operator === "wildcard" ? !/^[a-z0-9*?-]{1,32}$/iu.test(node.value) : tagOf(node.value) === void 0)
100
+ searchError("query.invalid-tag", node.span, "a tag is 1-32 letters a-z, digits and hyphens");
101
+ }, "validateTag");
102
+ var validateMentioned = /* @__PURE__ */ __name((node) => {
103
+ if (!/^(?:person|organization|document):[1-9]\d*$/u.test(node.value))
104
+ searchError("query.invalid-reference", node.span, "use person:<uid>, organization:<id> or document:<id>, quoted");
105
+ }, "validateMentioned");
106
+ var validateTopic = /* @__PURE__ */ __name((node) => {
107
+ if (!/^\d+$/u.test(node.value))
108
+ searchError("query.invalid-topic", node.span, "use a thread id in one chat");
109
+ }, "validateTopic");
110
+ var terms = ["term", "phrase"];
111
+ var names = [...terms, "wildcard"];
112
+ var NAMES = "account-scoped: an id or contact: reference as is; with * or ? a pattern over alias, name, @username (up to 50); else a name";
113
+ var QUERY_FIELDS = [
114
+ {
115
+ name: "text",
116
+ example: "invoice",
117
+ index: "message_stems \u222A message_words; wildcard and regex: message_words",
118
+ aliases: [],
119
+ type: "txt",
120
+ operators: ["term", "phrase", "wildcard", "regex"],
121
+ normalization: "Snowball 3.1.1 by script (Cyrillic, Latin; the store's search_stemmers), then v1",
122
+ support: "A1"
123
+ },
124
+ {
125
+ name: "exact",
126
+ example: "exact:invoice",
127
+ index: "message_words",
128
+ aliases: [],
129
+ type: "txt",
130
+ operators: ["term", "phrase", "wildcard", "regex"],
131
+ normalization: "NFKD/marks/NFC/lowercase v1",
132
+ support: "A1"
133
+ },
134
+ {
135
+ name: "body",
136
+ example: "body:/.*invoice.*/",
137
+ index: "messages.text / bounded postfilter",
138
+ aliases: [],
139
+ type: "txt",
140
+ operators: ["term", "phrase", "wildcard", "regex"],
141
+ normalization: "raw, case-sensitive",
142
+ support: "A1"
143
+ },
144
+ {
145
+ name: "from",
146
+ example: "from:Alice*",
147
+ index: "identities / sender index",
148
+ aliases: ["sender"],
149
+ type: "kw",
150
+ operators: names,
151
+ normalization: NAMES,
152
+ support: "A1"
153
+ },
154
+ ...["to", "cc", "bcc"].map((name) => ({
155
+ name,
156
+ example: `${name}:"Alice Synthetic"`,
157
+ index: "email_recipients",
158
+ aliases: [],
159
+ type: "kw",
160
+ operators: names,
161
+ normalization: `${NAMES}; mail only`,
162
+ support: "A1"
163
+ })),
164
+ {
165
+ name: "subject",
166
+ example: 'subject:"quarterly planning"',
167
+ index: "email_words, then the subject",
168
+ aliases: [],
169
+ type: "txt",
170
+ operators: [...terms, "wildcard"],
171
+ normalization: "every word, folded as text is; mail only",
172
+ support: "A1",
173
+ validate: filled
174
+ },
175
+ {
176
+ name: "mailbox",
177
+ example: 'mailbox:INBOX OR mailbox:"[Gmail]/Sent Mail"',
178
+ index: "email_mailboxes",
179
+ aliases: [],
180
+ type: "kw",
181
+ operators: [...terms, "wildcard"],
182
+ normalization: "a folder or label by its id (ASCII case folded) or name (case folded in any script); mail only",
183
+ support: "A1"
184
+ },
185
+ {
186
+ name: "label",
187
+ example: "label:Projects",
188
+ index: "email_mailboxes",
189
+ aliases: [],
190
+ type: "kw",
191
+ operators: [...terms, "wildcard"],
192
+ normalization: "the same as mailbox:; mail only",
193
+ support: "A1"
194
+ },
195
+ {
196
+ name: "list",
197
+ example: "list:github.com",
198
+ index: "emails.headers list-id",
199
+ aliases: [],
200
+ type: "kw",
201
+ operators: terms,
202
+ normalization: "the List-Id of a mailing list, lower case; a domain matches every list under it; mail only",
203
+ support: "A1",
204
+ validate: filled
205
+ },
206
+ {
207
+ name: "is",
208
+ example: "is:unread",
209
+ index: "emails.read / emails.flagged / messages.starred",
210
+ aliases: [],
211
+ type: "enum",
212
+ operators: terms,
213
+ normalization: "lowercase; read and unread are mail only; starred is a flagged email or a message the owner starred; an unknown state matches neither read nor unread",
214
+ support: "A1",
215
+ values: ["unread", "read", "starred"]
216
+ },
217
+ {
218
+ name: "chat",
219
+ example: "chat:*fixture*",
220
+ index: "chats / message time index",
221
+ aliases: [],
222
+ type: "kw",
223
+ operators: names,
224
+ normalization: "account-scoped: an id or chat: reference as is; with * or ? a pattern over title, @username (up to 50); else a title",
225
+ support: "A1"
226
+ },
227
+ {
228
+ name: "date",
229
+ example: "date:[2026-01-01 TO 2026-02-01}",
230
+ index: "messages.sent_at",
231
+ aliases: [],
232
+ type: "time",
233
+ operators: [...terms, "range"],
234
+ normalization: "ISO/calendar timezone; today, yesterday, 30m/2h/7d ago",
235
+ support: "A1"
236
+ },
237
+ {
238
+ name: "source",
239
+ example: "source:internal",
240
+ index: "notes (internal) / documents (file)",
241
+ aliases: [],
242
+ type: "enum",
243
+ operators: terms,
244
+ normalization: "lowercase; notes only: internal is written in memo, file is from a notes folder",
245
+ support: "A1",
246
+ values: ["internal", "file"]
247
+ },
248
+ {
249
+ name: "kind",
250
+ example: "kind:private",
251
+ index: "chats.kind / peerKind metadata",
252
+ aliases: [],
253
+ type: "enum",
254
+ operators: terms,
255
+ normalization: "lowercase",
256
+ support: "A1",
257
+ values: ["private", "saved", "bot", "service", "group", "channel", "unknown"]
258
+ },
259
+ {
260
+ name: "muted",
261
+ example: "muted:false",
262
+ index: "chats.muted / chats.muted_until",
263
+ aliases: [],
264
+ type: "enum",
265
+ operators: terms,
266
+ normalization: "lowercase; true is a chat the owner muted, until the mute runs out; false is every other chat",
267
+ support: "A1",
268
+ values: ["true", "false"]
269
+ },
270
+ {
271
+ name: "participants_count",
272
+ example: "participants_count<10",
273
+ index: "chats.participants_count",
274
+ aliases: [],
275
+ type: "num",
276
+ operators: [...terms, "range"],
277
+ normalization: "a whole number; a chat whose size the messenger never told matches no value",
278
+ support: "A1"
279
+ },
280
+ {
281
+ name: "has",
282
+ example: "has:file",
283
+ index: "attachments / messages_fts links / message_transcripts",
284
+ aliases: [],
285
+ type: "enum",
286
+ operators: terms,
287
+ normalization: "lowercase",
288
+ support: "A1",
289
+ values: [
290
+ "text",
291
+ "attachment",
292
+ "link",
293
+ "file",
294
+ "photo",
295
+ "image",
296
+ "video",
297
+ "audio",
298
+ "voice",
299
+ "sticker",
300
+ "contact",
301
+ "location",
302
+ "poll",
303
+ "transcript"
304
+ ]
305
+ },
306
+ {
307
+ name: "topic",
308
+ example: "chat:7 AND topic:42",
309
+ index: "messages.thread_native_id",
310
+ aliases: [],
311
+ type: "kw",
312
+ operators: terms,
313
+ normalization: "string id, one chat required",
314
+ support: "A1",
315
+ validate: validateTopic
316
+ },
317
+ {
318
+ name: "in",
319
+ example: "in:bots",
320
+ index: "accounts.provider",
321
+ aliases: [],
322
+ type: "kw",
323
+ operators: terms,
324
+ normalization: "lowercase provider/account class",
325
+ support: "A1"
326
+ },
327
+ {
328
+ name: "preset",
329
+ example: "preset:secret",
330
+ index: "bounded local candidate detector",
331
+ aliases: [],
332
+ type: "enum",
333
+ operators: terms,
334
+ normalization: "versioned candidate detector",
335
+ support: "A1",
336
+ values: [
337
+ "password",
338
+ "code",
339
+ "api-key",
340
+ "secret",
341
+ "card",
342
+ "bank",
343
+ "passport",
344
+ "phone",
345
+ "email",
346
+ "telegram-link",
347
+ "url",
348
+ "contact",
349
+ "location"
350
+ ]
351
+ },
352
+ {
353
+ name: "filename",
354
+ example: "filename:*.pdf",
355
+ index: "attachments.name / bounded postfilter",
356
+ aliases: [],
357
+ type: "kw",
358
+ operators: [...terms, "wildcard", "regex"],
359
+ normalization: "NFKD/marks/NFC/lowercase v1, whole name",
360
+ support: "A2"
361
+ },
362
+ {
363
+ name: "mime",
364
+ example: 'mime:"application/pdf" OR mime:image',
365
+ index: "attachments.mime / bounded postfilter",
366
+ aliases: [],
367
+ type: "kw",
368
+ operators: [...terms, "wildcard"],
369
+ normalization: "lowercase; a value without / matches the first part; only where the messenger reports a type",
370
+ support: "A2"
371
+ },
372
+ {
373
+ name: "size",
374
+ example: "size>10MB",
375
+ index: "attachments.size",
376
+ aliases: [],
377
+ type: "kw",
378
+ operators: [...terms, "range"],
379
+ normalization: "bytes; KB/MB/GB are 1024-based",
380
+ support: "A2",
381
+ validate: validateSize
382
+ },
383
+ {
384
+ name: "content",
385
+ example: "content:invoice",
386
+ index: "attachment_words",
387
+ aliases: [],
388
+ type: "txt",
389
+ operators: [...terms, "wildcard"],
390
+ normalization: "NFKD/marks/NFC/lowercase v1; the text of files attachments extract read or an agent wrote",
391
+ support: "A2",
392
+ validate: filled
393
+ },
394
+ {
395
+ name: "transcript",
396
+ example: "transcript:invoice",
397
+ index: "attachment_words \u222A transcript_stems; garbled spellings from transcript_words_vocab",
398
+ aliases: [],
399
+ type: "txt",
400
+ operators: [...terms, "wildcard"],
401
+ normalization: "any form of the word (Snowball), widened to spellings speech recognition garbles; what a voice message said",
402
+ support: "A2",
403
+ validate: filled
404
+ },
405
+ ...[
406
+ [
407
+ "title",
408
+ 'title:"quarterly report"',
409
+ "documents.metadata, then the title column; chats.title_folded; email_words, then the subject",
410
+ "every word, folded as text is: of a note's or a file's title, inside a chat's title, of a mail's subject (as subject:)",
411
+ "txt"
412
+ ],
413
+ [
414
+ "site",
415
+ "site:wikipedia",
416
+ "documents.metadata (og:site_name)",
417
+ "contained, folded as text is; notes and files only",
418
+ "kw"
419
+ ],
420
+ [
421
+ "lang",
422
+ "lang:ru",
423
+ "documents.metadata (html lang)",
424
+ "language tag or its prefix, lowercase; notes and files only",
425
+ "kw"
426
+ ],
427
+ [
428
+ "author",
429
+ "author:ivanov",
430
+ "documents.metadata (meta author, JSON-LD)",
431
+ "contained, folded as text is; notes and files only",
432
+ "kw"
433
+ ],
434
+ [
435
+ "keyword",
436
+ "keyword:invoices",
437
+ "documents.metadata (meta keywords)",
438
+ "whole keyword, folded as text is; notes and files only",
439
+ "kw"
440
+ ]
441
+ ].map(([name, example, index, normalization, type]) => ({
442
+ name,
443
+ example,
444
+ index,
445
+ aliases: [],
446
+ type,
447
+ operators: terms,
448
+ normalization,
449
+ support: "A2",
450
+ validate: filled
451
+ })),
452
+ ...[
453
+ [
454
+ "phone",
455
+ 'phone:"8 900 000-00-01"',
456
+ "a phone found in the text, written any way; a number without + is read in phone_countries"
457
+ ],
458
+ ["email", "email:ana@example.com", "an address found in the text, lower-cased"],
459
+ ["url", 'url:"https://example.com/a"', "a link found in the text, without utm_*, fbclid and the fragment"],
460
+ ["domain", "domain:google.com", "the site of a link or an address in the text; docs.google.com means google.com"],
461
+ [
462
+ "link",
463
+ 'link:"click?id=1"',
464
+ "a part of a link, quoted; Latin letters in any case; in mail also the body of a letter with a tracking link"
465
+ ]
466
+ ].map(([name, example, normalization]) => ({
467
+ name,
468
+ example,
469
+ index: "mentions (kind, value) / (domain); in mail a tracking link is kept as its site",
470
+ aliases: [],
471
+ type: "kw",
472
+ operators: terms,
473
+ normalization,
474
+ support: "A2",
475
+ validate: filled
476
+ })),
477
+ {
478
+ name: "mentions",
479
+ example: 'mentions:"person:12"',
480
+ index: "mentions (target_type, target_id)",
481
+ aliases: [],
482
+ type: "kw",
483
+ operators: terms,
484
+ normalization: "a person (by name, phone or address), an organization or a document, linked; quoted",
485
+ support: "A2",
486
+ validate: validateMentioned
487
+ },
488
+ {
489
+ name: "tag",
490
+ example: "tag:work",
491
+ index: "tags: the message, its chat or its sender",
492
+ aliases: [],
493
+ type: "kw",
494
+ operators: [...terms, "wildcard"],
495
+ normalization: "lowercase a-z, 0-9 and -, 1-32 characters",
496
+ support: "A2",
497
+ validate: validateTag
498
+ }
499
+ ];
500
+ var MESSAGES = { entity: "message", backend: "sql", fields: QUERY_FIELDS };
501
+ var NEAR_FIELDS = /* @__PURE__ */ new Set(["text", "exact", "transcript", "content"]);
502
+ var CANONICAL = new Map(QUERY_FIELDS.flatMap(({ name, aliases }) => aliases.map((alias) => [alias, name])));
503
+ var isPresence = /* @__PURE__ */ __name((node) => node.operator === "wildcard" && node.value === "*", "isPresence");
504
+ var PRESENCE = /* @__PURE__ */ new Set(["from", "to", "cc", "bcc", "subject", "title", "topic", "participants_count"]);
505
+ var ALWAYS = /* @__PURE__ */ new Set(["chat", "date"]);
506
+ var EVERY_DATE = { operator: "range", value: "*", upper: "*", lower_inclusive: true, upper_inclusive: true };
507
+ var PRESENCE_INSTEAD = {
508
+ text: "has:text",
509
+ exact: "has:text",
510
+ body: "has:text",
511
+ content: "has:file",
512
+ transcript: "has:transcript",
513
+ size: "has:attachment",
514
+ url: "has:link",
515
+ link: "has:link",
516
+ domain: "has:link"
517
+ };
518
+ var CONTAINED = /* @__PURE__ */ new Set(["title", "site", "author"]);
519
+ var notPresent = /* @__PURE__ */ __name((node) => searchError("query.unsupported-operator", node.span, `${node.field}:* asks whether ${node.field} has a value, which search answers for ${[...PRESENCE, ...ALWAYS].join(", ")}${PRESENCE_INSTEAD[node.field] ? `; write ${PRESENCE_INSTEAD[node.field]}` : ""}`), "notPresent");
520
+ var canonical = /* @__PURE__ */ __name((node) => {
521
+ if (node.kind === "boolean") {
522
+ const clauses = node.clauses.map((clause) => {
523
+ const inner = canonical(clause.node);
524
+ return inner === clause.node ? clause : { ...clause, node: inner };
525
+ });
526
+ return clauses.every((clause, at) => clause === node.clauses[at]) ? node : { ...node, clauses };
527
+ }
528
+ const field = CANONICAL.get(node.field);
529
+ if (node.field !== "_exists_")
530
+ return field ? { ...node, field } : node;
531
+ const { implicit: _, ...rest } = node;
532
+ return { ...rest, field: CANONICAL.get(node.value) ?? node.value, operator: "wildcard", value: "*" };
533
+ }, "canonical");
534
+ var everyDate = /* @__PURE__ */ __name((node) => node.kind === "boolean" ? { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: everyDate(clause.node) })) } : isPresence(node) && ALWAYS.has(node.field) ? { kind: "predicate", field: "date", ...EVERY_DATE, span: node.span } : node, "everyDate");
535
+ var validateFields = /* @__PURE__ */ __name((written, { presence = false } = {}) => {
536
+ const root = canonical(written.root);
537
+ const ast = root === written.root ? written : { ...written, root };
538
+ for (const node of walkQuery(ast.root)) {
539
+ if (presence && isPresence(node)) {
540
+ if (PRESENCE.has(node.field) || ALWAYS.has(node.field))
541
+ continue;
542
+ const known = QUERY_FIELDS.find(({ name }) => name === node.field);
543
+ if (known && (!known.operators.includes("wildcard") || PRESENCE_INSTEAD[node.field]))
544
+ notPresent(node);
545
+ }
546
+ const field = QUERY_FIELDS.find(({ name }) => name === node.field);
547
+ if (!field && ["after", "before"].includes(node.field)) {
548
+ const plain = ["term", "phrase"].includes(node.operator) && /^[\w:.+-]+$/u.test(node.value);
549
+ searchError("query.legacy-date-field", node.span, plain ? `use date${node.field === "after" ? ">=" : "<"}${node.value}` : "use date>=YYYY-MM-DD or date:[a TO b]");
550
+ }
551
+ if (node.slop !== void 0 && !NEAR_FIELDS.has(node.field))
552
+ searchError("query.unsupported-operator", node.span, `"a b"~N takes words: ${[...NEAR_FIELDS].join(", ")}`);
553
+ if (node.slop !== void 0 && node.slop > MOST_WORDS_APART)
554
+ searchError("query.invalid-number", node.span, `words at most ${MOST_WORDS_APART} apart: "a b"~${MOST_WORDS_APART}`);
555
+ if (field && node.operator === "wildcard" && !field.operators.includes("wildcard")) {
556
+ const part = node.value.replace(/[*?]/gu, "");
557
+ searchError("query.unsupported-operator", node.span, `${field.name} takes ${field.operators.join(", ")}` + (CONTAINED.has(field.name) && part ? `; ${field.name}:${part} already finds it inside a word` : ""));
558
+ }
559
+ }
560
+ const valid = validateQuery(ast, MESSAGES, SEARCH_QUERY);
561
+ return presence ? { ...valid, root: everyDate(valid.root) } : valid;
562
+ }, "validateFields");
563
+ var record = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "record");
564
+ var validSpan = /* @__PURE__ */ __name((value) => record(value) && Number.isInteger(value.start) && Number.isInteger(value.end) && Number(value.start) >= 0 && Number(value.end) >= Number(value.start) && Number(value.end) <= QUERY_LIMITS2.bytes, "validSpan");
565
+ var validateAst = /* @__PURE__ */ __name((input, options = {}) => {
566
+ const failure = { start: 0, end: 0 };
567
+ if (!record(input) || input.version !== 1 || input.language !== "lucene-v1")
568
+ searchError("query.unsupported-version", failure);
569
+ let count = 0;
570
+ let bytes = 0;
571
+ const measure = /* @__PURE__ */ __name((value, depth) => {
572
+ if (++count > QUERY_LIMITS2.nodes || depth > QUERY_LIMITS2.depth)
573
+ searchError("query.too-large", failure);
574
+ if (!record(value) || !validSpan(value.span))
575
+ searchError("query.invalid-ast", failure);
576
+ if (Array.isArray(value.clauses)) {
577
+ if (value.clauses.length === 0)
578
+ searchError("query.invalid-ast", value.span);
579
+ for (const clause of value.clauses)
580
+ measure(record(clause) ? clause.node : void 0, depth + 1);
581
+ return;
582
+ }
583
+ for (const text of [value.field, value.value, value.upper])
584
+ if (typeof text === "string")
585
+ bytes += new TextEncoder().encode(text).length;
586
+ if (bytes > QUERY_LIMITS2.bytes)
587
+ searchError("query.too-large", value.span);
588
+ }, "measure");
589
+ measure(input.root, 1);
590
+ const parsed = safeParse(queryAstSchema, input);
591
+ if (!parsed.success)
592
+ searchError("query.invalid-ast", failure);
593
+ const open = walkQuery(parsed.output.root).find((node) => node.operator === "range" && (node.upper === void 0 || node.lower_inclusive === void 0 || node.upper_inclusive === void 0));
594
+ if (open)
595
+ searchError("query.invalid-ast", open.span);
596
+ return validateFields(parsed.output, options);
597
+ }, "validateAst");
598
+
599
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
600
+ var REPAIRED = /* @__PURE__ */ new Set([
601
+ "query.invalid-syntax",
602
+ "query.unclosed-literal",
603
+ "query.unsupported-operator",
604
+ "query.invalid-escape"
605
+ ]);
606
+ var SEARCH_FIELDS = /* @__PURE__ */ new Set([
607
+ ...QUERY_FIELDS.flatMap(({ name, aliases }) => [name, ...aliases]),
608
+ "after",
609
+ "before",
610
+ "_exists_"
611
+ ]);
612
+ var FIELD_PREFIX = /^[+-]?([\p{L}\p{N}_.]+)(?:[:=]|[<>]=?)/u;
613
+ var FIELD_NAME = /^[a-z][a-z_]{2,}$/u;
614
+ var LISTED_BY = "this search has no such field; a list filters by it:";
615
+ var ELSEWHERE = {
616
+ status: `${LISTED_BY} tasks list status:open, deals list status:won`,
617
+ stage: `${LISTED_BY} deals list stage:<value>`,
618
+ pipeline: `${LISTED_BY} deals list pipeline:<value>`,
619
+ priority: `${LISTED_BY} tasks list priority:<value>`,
620
+ assignee: `${LISTED_BY} tasks list assignee:<value>`,
621
+ project: `${LISTED_BY} tasks list project:<value>`,
622
+ due: `${LISTED_BY} tasks list due:<value>`,
623
+ name: "a person's name is from: (who wrote) or mentions: here"
624
+ };
625
+ var unknownField = /* @__PURE__ */ __name((field, written, span, fields) => searchError("query.unknown-field", span, `${ELSEWHERE[field] ?? `fields here: ${[...fields].filter((one) => FIELD_NAME.test(one)).join(", ")}`}; to find the words as written, quote them: "${written}"`), "unknownField");
626
+ var space = /* @__PURE__ */ __name((c) => c !== void 0 && /[ \t\n\r\u3000]/u.test(c), "space");
627
+ var quoted = /* @__PURE__ */ __name((text) => {
628
+ let out = "";
629
+ for (let at = 0; at < text.length; at++) {
630
+ const c = text[at];
631
+ if (c === "\\" && at + 1 < text.length && (text[at + 1] !== "u" || /^u[0-9a-fA-F]{4}/u.test(text.slice(at + 1)))) {
632
+ out += c + text[at + 1];
633
+ at++;
634
+ } else
635
+ out += c === '"' || c === "\\" ? `\\${c}` : c;
636
+ }
637
+ return `"${out}"`;
638
+ }, "quoted");
639
+ var literal = /* @__PURE__ */ __name((word, keepParens, fields) => {
640
+ const prefix = FIELD_PREFIX.exec(word);
641
+ const field = prefix && fields.has(prefix[1] ?? "") ? prefix[0] : "";
642
+ const rest = word.slice(field.length);
643
+ const opening = keepParens ? /^[(+-]*/u.exec(rest)?.[0] ?? "" : "";
644
+ const closing = keepParens ? /\)*$/u.exec(rest.slice(opening.length))?.[0] ?? "" : "";
645
+ const body = rest.slice(opening.length, rest.length - closing.length);
646
+ if (!body)
647
+ return keepParens ? literal(word, false, fields) : `${field}${quoted(rest)}`;
648
+ return `${field}${opening}${quoted(body)}${closing}`;
649
+ }, "literal");
650
+ var wordAround = /* @__PURE__ */ __name((text, at) => {
651
+ let start = at;
652
+ while (start > 0 && !space(text[start - 1]))
653
+ start--;
654
+ let end = at;
655
+ while (end < text.length && !space(text[end]))
656
+ end++;
657
+ return { start, end };
658
+ }, "wordAround");
659
+ var everyWordLiteral = /* @__PURE__ */ __name((text, fields) => text.replace(/[^ \t\n\r\u3000]+/gu, (word) => literal(word, false, fields)), "everyWordLiteral");
660
+ var refusal = /* @__PURE__ */ __name((refuse) => {
661
+ try {
662
+ return refuse();
663
+ } catch (error) {
664
+ return { refused: error };
665
+ }
666
+ }, "refusal");
667
+ var read = /* @__PURE__ */ __name((text, fields) => {
668
+ try {
669
+ const leaves = walkQuery(parseLucene(text, MESSAGE_PARSING).root);
670
+ const unknown = leaves.find(({ field }) => !fields.has(field));
671
+ if (unknown && FIELD_NAME.test(unknown.field) && unknown.value && !unknown.value.startsWith("/"))
672
+ return refusal(() => unknownField(unknown.field, text.slice(unknown.span.start, unknown.span.end), unknown.span, fields));
673
+ if (unknown)
674
+ return { at: text.lastIndexOf(unknown.field, unknown.span.start) };
675
+ const questions = leaves.flatMap(({ implicit, operator, value, span }) => {
676
+ const mark = /^[^*?]*[^*?\\]\?+$/u.test(value) && implicit && operator === "wildcard" ? /\?+$/u.exec(value) : null;
677
+ return mark ? [span.end - mark[0].length] : [];
678
+ });
679
+ if (questions.length)
680
+ return { questions };
681
+ const wordless = leaves.filter(({ implicit, operator, value }) => implicit && (operator === "term" || operator === "phrase") && !/[\p{L}\p{N}]/u.test(value));
682
+ const words = wordless.length < leaves.length;
683
+ return { wordless: words ? wordless : [], words };
684
+ } catch (error) {
685
+ const details = isCliError(error) ? error.details : void 0;
686
+ if (!details?.span || !REPAIRED.has(details.reason ?? ""))
687
+ throw error;
688
+ if (/^~\d/u.test(text.slice(details.span.start)))
689
+ throw error;
690
+ const at = details.span.start;
691
+ const boost = /^\^\d+(?:\.\d+)?/u.exec(text.slice(at))?.[0];
692
+ if (boost && at > 0 && !space(text[at - 1])) {
693
+ const { start } = wordAround(text, at);
694
+ const written = text.slice(start, at + boost.length);
695
+ return refusal(() => searchError("query.unsupported-operator", { start, end: at + boost.length }, `boost ${boost} is not supported \u2014 drop it: ${text.slice(start, at)}, or quote the text to find it as written: ${quoted(written)}`));
696
+ }
697
+ return { at };
698
+ }
699
+ }, "read");
700
+ var without = /* @__PURE__ */ __name((text, leaves) => [...leaves].sort((a, b) => b.span.start - a.span.start).reduce((left, { span }) => left.slice(0, span.start) + left.slice(span.end), text).trim(), "without");
701
+ var plainQuery = /* @__PURE__ */ __name((text, fields = SEARCH_FIELDS) => {
702
+ if (text.trim() && !/[\p{L}\p{N}*]/u.test(text))
703
+ throw new CliError("validation_error", `search needs a letter or a digit to look for; ${JSON.stringify(text)} has none`);
704
+ let current = text;
705
+ let whole = false;
706
+ for (let tries = 0; tries <= 64; tries++) {
707
+ let reading;
708
+ try {
709
+ reading = read(current, fields);
710
+ } catch {
711
+ return text;
712
+ }
713
+ if ("refused" in reading)
714
+ throw reading.refused;
715
+ if ("questions" in reading) {
716
+ current = reading.questions.sort((a, b) => b - a).reduce((left, at) => left.slice(0, at) + left.slice(at).replace(/^\?+/u, (marks) => "\\?".repeat(marks.length)), current);
717
+ continue;
718
+ }
719
+ if ("wordless" in reading) {
720
+ if (!reading.words && current !== text)
721
+ return text;
722
+ if (!reading.wordless.length)
723
+ return current;
724
+ current = without(current, reading.wordless);
725
+ continue;
726
+ }
727
+ const word = reading.at < 0 || reading.at >= current.length ? void 0 : wordAround(current, reading.at);
728
+ const paren = "()".includes(current[reading.at] ?? "");
729
+ const repaired = word ? current.slice(0, word.start) + literal(current.slice(word.start, word.end), !paren, fields) + current.slice(word.end) : current;
730
+ if (repaired !== current) {
731
+ current = repaired;
732
+ continue;
733
+ }
734
+ if (whole)
735
+ return text;
736
+ whole = true;
737
+ current = everyWordLiteral(text, fields);
738
+ }
739
+ return text;
740
+ }, "plainQuery");
741
+
742
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/search/fusion.js
743
+ var RRF_K = 60;
744
+ var fuseRanked = /* @__PURE__ */ __name((lists, facts) => {
745
+ const rows = lists.flatMap((list) => list.map((item, rank) => ({ item, vote: 1 / (RRF_K + rank + 1), ...facts(item) })));
746
+ const ranking = rows.some(({ ranked }) => ranked);
747
+ return rows.sort((a, b) => Number(b.exact === true) - Number(a.exact === true) || (ranking ? Number(b.ranked) - Number(a.ranked) || b.vote - a.vote : 0) || b.at - a.at).map(({ item }) => item);
748
+ }, "fuseRanked");
749
+
750
+ export {
751
+ QUERY_VERSION,
752
+ QUERY_LIMITS2 as QUERY_LIMITS,
753
+ SEARCH_QUERY,
754
+ MESSAGE_PARSING,
755
+ searchError,
756
+ searchTimeLimit,
757
+ outOfTime,
758
+ isQueryLimit,
759
+ exhausted,
760
+ tooWideTerm,
761
+ FIELD_VERSION,
762
+ parseBytes,
763
+ QUERY_FIELDS,
764
+ isPresence,
765
+ PRESENCE,
766
+ validateFields,
767
+ validateAst,
768
+ plainQuery,
769
+ RRF_K,
770
+ fuseRanked
771
+ };