@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,4072 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ RegistryError,
5
+ SNAKE_CASE,
6
+ STEPS,
7
+ defineReasons,
8
+ defineSteps,
9
+ duplicates,
10
+ isoTime,
11
+ pageSchema,
12
+ reference,
13
+ stepOf
14
+ } from "./chunk-AG64V7AB.js";
15
+ import {
16
+ array,
17
+ boolean,
18
+ exactOptional,
19
+ integer,
20
+ lazy,
21
+ literal,
22
+ maxValue,
23
+ minLength,
24
+ minValue,
25
+ nullable,
26
+ number,
27
+ object,
28
+ optional,
29
+ picklist,
30
+ pipe,
31
+ record,
32
+ safeParse,
33
+ strictObject,
34
+ string,
35
+ union,
36
+ variant
37
+ } from "./chunk-S4UUN6LD.js";
38
+ import {
39
+ CliError,
40
+ isCliError,
41
+ singleLine,
42
+ visibleControls
43
+ } from "./chunk-T7ZUDA4C.js";
44
+ import {
45
+ __name
46
+ } from "./chunk-ZVVMGPBJ.js";
47
+
48
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/types.js
49
+ var QUERY_LIMITS = {
50
+ bytes: 8192,
51
+ depth: 32,
52
+ nodes: 256
53
+ };
54
+ var spanSchema = object({ start: number(), end: number() });
55
+ var predicateSchema = object({
56
+ kind: literal("predicate"),
57
+ field: string(),
58
+ operator: picklist(["term", "phrase", "wildcard", "regex", "range"]),
59
+ value: string(),
60
+ upper: optional(string()),
61
+ lower_inclusive: optional(boolean()),
62
+ upper_inclusive: optional(boolean()),
63
+ span: spanSchema,
64
+ implicit: optional(literal(true)),
65
+ slop: optional(pipe(number(), integer(), minValue(0)))
66
+ });
67
+ var queryNodeSchema = variant("kind", [
68
+ predicateSchema,
69
+ object({
70
+ kind: literal("boolean"),
71
+ clauses: array(object({ occur: picklist(["must", "should", "must_not"]), node: lazy(() => queryNodeSchema) })),
72
+ span: spanSchema
73
+ })
74
+ ]);
75
+ var queryAstSchema = object({
76
+ version: literal(1),
77
+ language: literal("lucene-v1"),
78
+ root: queryNodeSchema
79
+ });
80
+ function queryError(reason, span, alternative, context3 = {}, details = {}) {
81
+ throw new CliError("validation_error", `${context3.command ?? "query"}: ${reason} at position ${span.start + 1}${alternative ? ` \u2014 ${alternative}` : ""}`, {
82
+ reason,
83
+ span,
84
+ ...alternative ? { alternative } : {},
85
+ ...context3.guide ? { guide: context3.guide } : {},
86
+ ...details
87
+ });
88
+ }
89
+ __name(queryError, "queryError");
90
+ var walkQuery = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => walkQuery(node2)), "walkQuery");
91
+
92
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/dates.js
93
+ var timezoneOf = /* @__PURE__ */ __name((given) => {
94
+ const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
95
+ try {
96
+ new Intl.DateTimeFormat("en", { timeZone: zone }).format(0);
97
+ } catch {
98
+ queryError("query.invalid-timezone", { start: 0, end: 0 }, "use an IANA timezone such as Europe/Madrid");
99
+ }
100
+ return zone;
101
+ }, "timezoneOf");
102
+ var calendar = /* @__PURE__ */ __name((value, span) => {
103
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
104
+ queryError("query.invalid-date", span, "use an ISO date such as 2026-10-01");
105
+ const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
106
+ const date = /* @__PURE__ */ new Date(0);
107
+ date.setUTCFullYear(year, month - 1, day);
108
+ date.setUTCHours(0, 0, 0, 0);
109
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
110
+ queryError("query.invalid-date", span);
111
+ return date;
112
+ }, "calendar");
113
+ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
114
+ const date = calendar(value, span);
115
+ if (next)
116
+ date.setUTCDate(date.getUTCDate() + 1);
117
+ const wanted = date.getUTCFullYear() * 1e4 + (date.getUTCMonth() + 1) * 100 + date.getUTCDate();
118
+ const formatter = new Intl.DateTimeFormat("en-CA", {
119
+ timeZone: zone,
120
+ year: "numeric",
121
+ month: "2-digit",
122
+ day: "2-digit",
123
+ era: "short"
124
+ });
125
+ const dayAt = /* @__PURE__ */ __name((time) => {
126
+ const parts = formatter.formatToParts(time);
127
+ const value2 = /* @__PURE__ */ __name((name) => Number(parts.find((p) => p.type === name)?.value), "value");
128
+ const year = parts.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
129
+ return year * 1e4 + value2("month") * 100 + value2("day");
130
+ }, "dayAt");
131
+ let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
132
+ while (lo < hi) {
133
+ const mid = Math.floor((lo + hi) / 2);
134
+ if (dayAt(mid) < wanted)
135
+ lo = mid + 1;
136
+ else
137
+ hi = mid;
138
+ }
139
+ if (dayAt(lo) !== wanted)
140
+ queryError("query.invalid-date", span, "this calendar day does not exist in the selected timezone");
141
+ return lo;
142
+ }, "dayBoundary");
143
+ var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
144
+ var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
145
+ const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
146
+ if (year === void 0)
147
+ queryError("query.invalid-date", span, "use YYYY-MM-DDTHH:mm, with optional seconds");
148
+ const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
149
+ const check = new Date(wanted);
150
+ if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
151
+ queryError("query.invalid-date", span);
152
+ const formatter = new Intl.DateTimeFormat("en-CA", {
153
+ timeZone: zone,
154
+ year: "numeric",
155
+ month: "2-digit",
156
+ day: "2-digit",
157
+ hour: "2-digit",
158
+ minute: "2-digit",
159
+ second: "2-digit",
160
+ hourCycle: "h23"
161
+ });
162
+ const shown = /* @__PURE__ */ __name((instant) => {
163
+ const parts = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
164
+ return Date.UTC(parts.year ?? 0, (parts.month ?? 1) - 1, parts.day, parts.hour, parts.minute, parts.second) + (instant % 1e3 + 1e3) % 1e3;
165
+ }, "shown");
166
+ const found = /* @__PURE__ */ new Set();
167
+ for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
168
+ const candidate = wanted - (shown(probe) - probe);
169
+ if (shown(candidate) === wanted)
170
+ found.add(candidate);
171
+ }
172
+ if (found.size !== 1)
173
+ queryError("query.invalid-date", span, "this local time is skipped or repeated by daylight saving; add an offset");
174
+ return [...found][0];
175
+ }, "wallTime");
176
+ var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/iu;
177
+ var zonedMoment = /* @__PURE__ */ __name((value, zone, span, { end = false } = {}) => {
178
+ if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
179
+ return dayBoundary(value, zone, end, span) - (end ? 1 : 0);
180
+ if (!ZONED.test(value))
181
+ return wallTime(value, zone, span);
182
+ const time = Date.parse(value);
183
+ if (!/^\d{4}-\d{2}-\d{2}T/u.test(value) || !Number.isFinite(time))
184
+ queryError("query.invalid-date", span);
185
+ calendar(value.slice(0, 10), span);
186
+ return time;
187
+ }, "zonedMoment");
188
+ var AGO = /^(\d+)(m|h|d)$/u;
189
+ var MOMENT = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/u;
190
+ var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
191
+ var dayOf = /* @__PURE__ */ __name((word, zone, now, span) => {
192
+ const today = new Intl.DateTimeFormat("en-CA", {
193
+ timeZone: zone,
194
+ year: "numeric",
195
+ month: "2-digit",
196
+ day: "2-digit"
197
+ }).format(now);
198
+ if (word === "today")
199
+ return today;
200
+ const date = calendar(today, span);
201
+ date.setUTCDate(date.getUTCDate() - 1);
202
+ return date.toISOString().slice(0, 10);
203
+ }, "dayOf");
204
+ var dateEndpoint = /* @__PURE__ */ __name((value, zone, side, inclusive, span, now = Date.now()) => {
205
+ if (value === "*")
206
+ return { inclusive };
207
+ const word = value.toLowerCase();
208
+ if (word === "today" || word === "yesterday")
209
+ return dateEndpoint(dayOf(word, zone, now, span), zone, side, inclusive, span);
210
+ const [, amount, unit] = AGO.exec(word) ?? [];
211
+ if (amount && unit)
212
+ return { time: now - Number(amount) * (AGO_MS[unit] ?? 0), inclusive };
213
+ if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
214
+ return {
215
+ time: dayBoundary(value, zone, side === "lower" ? !inclusive : inclusive, span),
216
+ inclusive: side === "lower"
217
+ };
218
+ const [, day, hour, minute, second = "0", offset] = MOMENT.exec(value) ?? [];
219
+ if (day === void 0)
220
+ queryError("query.invalid-date", span, "use an ISO date, a date and time such as 2026-10-01T09:00 (optional seconds and offset), today, yesterday or 30m/2h/7d ago");
221
+ const moment = value.replace(" ", "T");
222
+ if (offset === void 0)
223
+ return { time: wallTime(moment, zone, span), inclusive };
224
+ calendar(day, span);
225
+ const time = Date.parse(moment);
226
+ if (!Number.isFinite(time) || Number(hour) > 23 || Number(minute) > 59 || Number(second) > 59)
227
+ queryError("query.invalid-date", span);
228
+ return { time, inclusive };
229
+ }, "dateEndpoint");
230
+ var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclusive, zone, span, now = Date.now()) => {
231
+ const since = lower === upper && AGO.test(lower.toLowerCase());
232
+ const lo = dateEndpoint(lower, zone, "lower", lowerInclusive, span, now);
233
+ const hi = dateEndpoint(since ? "*" : upper, zone, "upper", upperInclusive, span, now);
234
+ return {
235
+ ...lo.time === void 0 ? {} : { lower: lo.time },
236
+ ...hi.time === void 0 ? {} : { upper: hi.time },
237
+ lower_inclusive: lo.inclusive,
238
+ upper_inclusive: hi.inclusive
239
+ };
240
+ }, "dateRange");
241
+
242
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/parser.js
243
+ var whitespace = /* @__PURE__ */ __name((c) => /[ \t\n\r\u3000]/u.test(c), "whitespace");
244
+ var reserved = /* @__PURE__ */ new Set([
245
+ "+",
246
+ "-",
247
+ "!",
248
+ "(",
249
+ ")",
250
+ ":",
251
+ "=",
252
+ "^",
253
+ "@",
254
+ "<",
255
+ ">",
256
+ "[",
257
+ "]",
258
+ '"',
259
+ "{",
260
+ "}",
261
+ "~",
262
+ "\\",
263
+ "/"
264
+ ]);
265
+ var decodeEscapes = /* @__PURE__ */ __name((raw, span, fail) => {
266
+ let out = "";
267
+ for (let at = 0; at < raw.length; at++) {
268
+ if (raw[at] !== "\\") {
269
+ out += raw[at];
270
+ continue;
271
+ }
272
+ if (++at >= raw.length)
273
+ fail("query.invalid-escape", span);
274
+ if (raw[at] === "u") {
275
+ const hex = raw.slice(at + 1, at + 5);
276
+ if (!/^[0-9a-fA-F]{4}$/.test(hex))
277
+ fail("query.invalid-escape", span);
278
+ out += String.fromCharCode(Number.parseInt(hex, 16));
279
+ at += 4;
280
+ } else
281
+ out += raw[at];
282
+ }
283
+ return out;
284
+ }, "decodeEscapes");
285
+ var tokensOf = /* @__PURE__ */ __name((text6, fail = queryError) => {
286
+ const tokens = [];
287
+ let at = 0;
288
+ let range = false;
289
+ while (at < text6.length) {
290
+ const start = at;
291
+ const c = text6[at] ?? "";
292
+ if (whitespace(c)) {
293
+ at++;
294
+ continue;
295
+ }
296
+ let kind2 = c;
297
+ if (c === '"' || !range && c === "/") {
298
+ at++;
299
+ while (at < text6.length && text6[at] !== c) {
300
+ if (text6[at] === "\\" && (c === '"' || text6[at + 1] === "/"))
301
+ at++;
302
+ at++;
303
+ }
304
+ if (at >= text6.length)
305
+ fail("query.unclosed-literal", { start, end: at }, c === "/" ? regexHint(text6, start) : void 0);
306
+ at++;
307
+ if (c === "/" && /^[dgimsuvy]+(?:$|[ \t\n\r)])/.test(text6.slice(at)))
308
+ fail("query.unsupported-regex-flags", { start: at, end: at + 1 }, "Lucene regex does not take JavaScript flags");
309
+ kind2 = c === '"' ? "quoted" : "regex";
310
+ } else if (range && c !== "]" && c !== "}") {
311
+ while (at < text6.length && !whitespace(text6[at] ?? "") && !["]", "}"].includes(text6[at] ?? ""))
312
+ at++;
313
+ kind2 = "rangeValue";
314
+ } else if (reserved.has(c)) {
315
+ if (c === "\\") {
316
+ at += 2;
317
+ while (at < text6.length && !whitespace(text6[at] ?? "") && (!reserved.has(text6[at] ?? "") || ["+", "-"].includes(text6[at] ?? "")))
318
+ at++;
319
+ kind2 = "term";
320
+ } else {
321
+ at++;
322
+ if ((c === "<" || c === ">") && text6[at] === "=") {
323
+ at++;
324
+ kind2 += "=";
325
+ }
326
+ if (c === "[" || c === "{")
327
+ range = true;
328
+ if (c === "]" || c === "}")
329
+ range = false;
330
+ }
331
+ } else {
332
+ at++;
333
+ while (at < text6.length) {
334
+ const next = text6[at] ?? "";
335
+ if (next === "\\") {
336
+ if (at + 1 >= text6.length)
337
+ fail("query.invalid-escape", { start: at, end: at + 1 });
338
+ at += 2;
339
+ continue;
340
+ }
341
+ if (next === "@" && new RegExp("^@(?:\\p{L}|[\\p{L}\\p{N}][^\\s@]*\\.[\\p{L}\\p{N}])", "u").test(text6.slice(at))) {
342
+ at++;
343
+ continue;
344
+ }
345
+ if (whitespace(next) || reserved.has(next) && next !== "+" && next !== "-")
346
+ break;
347
+ at++;
348
+ }
349
+ const [field, colon] = tokens.slice(-2);
350
+ if (field?.kind === "term" && colon?.kind === ":" && colon.span.end === start && text6[at] === ":" && /^[a-z][a-z_-]*$/u.test(text6.slice(start, at)) && /^:[^\s()"]/u.test(text6.slice(at)))
351
+ while (at < text6.length && !whitespace(text6[at] ?? "") && !["(", ")", '"'].includes(text6[at] ?? ""))
352
+ at++;
353
+ const raw = text6.slice(start, at);
354
+ kind2 = { AND: "AND", OR: "OR", NOT: "NOT", "&&": "AND", "||": "OR" }[raw] ?? (/^\d+(?:\.\d+)?$/u.test(raw) ? "number" : "term");
355
+ }
356
+ tokens.push({ kind: kind2, raw: text6.slice(start, at), span: { start, end: at } });
357
+ }
358
+ tokens.push({ kind: "EOF", raw: "", span: { start: at, end: at } });
359
+ return tokens;
360
+ }, "tokensOf");
361
+ var quoteHint = /* @__PURE__ */ __name((text6, at) => {
362
+ for (const match of text6.matchAll(/(?<=^|[\s(])([\p{L}\p{N}_.-]+):([^\s"()]+)/gu)) {
363
+ const [whole, field, value = ""] = match;
364
+ if (at < match.index || at > match.index + whole.length)
365
+ continue;
366
+ return /[:=/?*~^@<>![\]{}\\]/u.test(value) ? `put the value in quotes: ${field}:"${value}"` : void 0;
367
+ }
368
+ return void 0;
369
+ }, "quoteHint");
370
+ var regexHint = /* @__PURE__ */ __name((text6, at) => {
371
+ const word = `${/[^\s()"]*$/u.exec(text6.slice(0, at))?.[0] ?? ""}${/^[^\s()"]*/u.exec(text6.slice(at))?.[0] ?? ""}`;
372
+ return quoteHint(text6, at) ?? `/ starts a regular expression; put the value in quotes: "${word}"`;
373
+ }, "regexHint");
374
+ var parseLucene = /* @__PURE__ */ __name((text6, { defaultField = "text", proximity = false, ...context3 } = {}) => {
375
+ const fail = /* @__PURE__ */ __name((reason, span, alternative) => queryError(reason, span, alternative ?? quoteHint(text6, span.start), context3), "fail");
376
+ if (text6.length > QUERY_LIMITS.bytes || new TextEncoder().encode(text6).length > QUERY_LIMITS.bytes)
377
+ fail("query.too-large", { start: 0, end: text6.length });
378
+ const tokens = tokensOf(text6, fail);
379
+ let at = 0;
380
+ let count7 = 0;
381
+ let depth = 0;
382
+ const peek = /* @__PURE__ */ __name(() => tokens[at], "peek");
383
+ const take = /* @__PURE__ */ __name(() => tokens[at++], "take");
384
+ const expect = /* @__PURE__ */ __name((kind2) => {
385
+ if (peek().kind !== kind2)
386
+ fail("query.invalid-syntax", peek().span);
387
+ return take();
388
+ }, "expect");
389
+ const built = /* @__PURE__ */ __name((node) => {
390
+ if (++count7 > QUERY_LIMITS.nodes)
391
+ fail("query.too-large", node.span);
392
+ return node;
393
+ }, "built");
394
+ const combine = /* @__PURE__ */ __name((clauses, occur) => {
395
+ const first = clauses[0];
396
+ const last = clauses.at(-1);
397
+ if (!first || !last)
398
+ fail("query.invalid-syntax", peek().span);
399
+ if (clauses.length === 1)
400
+ return first;
401
+ return {
402
+ node: built({
403
+ kind: "boolean",
404
+ clauses: clauses.map(({ node, modifier }) => ({ node, occur: modifier ?? occur })),
405
+ span: { start: first.node.span.start, end: last.node.span.end }
406
+ })
407
+ };
408
+ }, "combine");
409
+ const query = /* @__PURE__ */ __name((field, implicit = false) => {
410
+ if (++depth > QUERY_LIMITS.depth)
411
+ fail("query.too-large", peek().span);
412
+ const clauses = [];
413
+ do {
414
+ clauses.push(disjunction(field, implicit));
415
+ } while (!["EOF", ")"].includes(peek().kind));
416
+ const result = combine(clauses, "must");
417
+ depth--;
418
+ if (result.modifier === "must_not")
419
+ return built({ kind: "boolean", clauses: [{ node: result.node, occur: "must_not" }], span: result.node.span });
420
+ return result.node;
421
+ }, "query");
422
+ const disjunction = /* @__PURE__ */ __name((field, implicit) => {
423
+ const clauses = [conjunction(field, implicit)];
424
+ while (peek().kind === "OR") {
425
+ take();
426
+ clauses.push(conjunction(field, implicit));
427
+ }
428
+ return combine(clauses, "should");
429
+ }, "disjunction");
430
+ const conjunction = /* @__PURE__ */ __name((field, implicit) => {
431
+ const clauses = [clause(field, implicit)];
432
+ while (peek().kind === "AND") {
433
+ take();
434
+ clauses.push(clause(field, implicit));
435
+ }
436
+ return combine(clauses, "must");
437
+ }, "conjunction");
438
+ const clause = /* @__PURE__ */ __name((inherited, inheritedImplicit) => {
439
+ let modifier;
440
+ if (["+", "-", "NOT", "!"].includes(peek().kind))
441
+ modifier = take().kind === "+" ? "must" : "must_not";
442
+ let field = inherited;
443
+ let start;
444
+ let implicit = inheritedImplicit;
445
+ if (peek().kind === "term" && [":", "=", "<", ">", "<=", ">="].includes(tokens[at + 1]?.kind ?? "")) {
446
+ const token = take();
447
+ field = decodeEscapes(token.raw, token.span, fail);
448
+ start = token.span.start;
449
+ implicit = false;
450
+ let operator = take();
451
+ if (operator.kind === ":" && ["<", ">", "<=", ">="].includes(peek().kind))
452
+ operator = take();
453
+ if (["<", ">", "<=", ">="].includes(operator.kind)) {
454
+ const value = take();
455
+ if (!["term", "number", "quoted"].includes(value.kind))
456
+ fail("query.invalid-syntax", value.span);
457
+ const decoded = decodeEscapes(value.kind === "quoted" ? value.raw.slice(1, -1) : value.raw, value.span, fail);
458
+ const lower = operator.kind.startsWith(">");
459
+ const node2 = built({
460
+ kind: "predicate",
461
+ field,
462
+ operator: "range",
463
+ value: lower ? decoded : "*",
464
+ upper: lower ? "*" : decoded,
465
+ lower_inclusive: !lower || operator.kind.endsWith("="),
466
+ upper_inclusive: lower || operator.kind.endsWith("="),
467
+ span: { start: token.span.start, end: value.span.end }
468
+ });
469
+ return { node: node2, ...modifier ? { modifier } : {} };
470
+ }
471
+ }
472
+ let node;
473
+ if (peek().kind === "(") {
474
+ const start2 = take().span.start;
475
+ node = query(field, implicit);
476
+ const end = expect(")").span.end;
477
+ node = { ...node, span: { start: start2, end } };
478
+ } else if (["[", "{"].includes(peek().kind)) {
479
+ const opening = take();
480
+ const lower = take();
481
+ if (!["rangeValue", "quoted"].includes(lower.kind))
482
+ fail("query.invalid-syntax", lower.span);
483
+ const separator = take();
484
+ if (separator.raw !== "TO")
485
+ fail("query.invalid-syntax", separator.span);
486
+ const upper = take();
487
+ if (!["rangeValue", "quoted"].includes(upper.kind))
488
+ fail("query.invalid-syntax", upper.span);
489
+ const closing = take();
490
+ if (!["]", "}"].includes(closing.kind))
491
+ fail("query.invalid-syntax", closing.span);
492
+ const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail), "decode");
493
+ node = built({
494
+ kind: "predicate",
495
+ field,
496
+ operator: "range",
497
+ value: decode(lower),
498
+ upper: decode(upper),
499
+ lower_inclusive: opening.kind === "[",
500
+ upper_inclusive: closing.kind === "]",
501
+ span: { start: start ?? opening.span.start, end: closing.span.end }
502
+ });
503
+ } else {
504
+ const token = take();
505
+ if (!["term", "number", "quoted", "regex"].includes(token.kind))
506
+ fail("query.invalid-syntax", token.span);
507
+ const raw = ["term", "number"].includes(token.kind) ? token.raw : token.raw.slice(1, -1);
508
+ if (field === "fn")
509
+ fail("query.unsupported-operator", token.span, "interval functions are not supported");
510
+ const wildcard = ["term", "number"].includes(token.kind) && /(?<!\\)[*?]/u.test(raw);
511
+ node = built({
512
+ kind: "predicate",
513
+ field,
514
+ operator: token.kind === "regex" ? "regex" : token.kind === "quoted" ? "phrase" : wildcard ? "wildcard" : "term",
515
+ value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail),
516
+ span: { start: start ?? token.span.start, end: token.span.end },
517
+ ...implicit ? { implicit: true } : {}
518
+ });
519
+ }
520
+ if (proximity && peek().kind === "~" && node.kind === "predicate" && node.operator === "phrase") {
521
+ take();
522
+ const distance = take();
523
+ if (distance.kind !== "number" || !/^\d+$/u.test(distance.raw))
524
+ fail("query.invalid-syntax", distance.span, 'write the distance as a whole number: "a b"~3');
525
+ node = { ...node, slop: Number(distance.raw), span: { start: node.span.start, end: distance.span.end } };
526
+ }
527
+ if (peek().kind === "~")
528
+ fail("query.unsupported-operator", peek().span, node.kind === "predicate" && node.operator === "phrase" ? "proximity (~) is not supported \u2014 drop the ~ for the exact phrase, or join the words with AND" : "fuzzy matching (~) is not supported \u2014 use a prefix such as word* to catch word forms");
529
+ if (["^", "@"].includes(peek().kind))
530
+ fail("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
531
+ return { node, ...modifier ? { modifier } : {} };
532
+ }, "clause");
533
+ const root = query(defaultField, true);
534
+ expect("EOF");
535
+ if (defaultField === "none") {
536
+ const bare = walkQuery(root).find((node) => node.implicit);
537
+ if (bare)
538
+ queryError("query.bare-word", bare.span, `"${bare.value}" has no field; write field:value`, context3, {
539
+ word: bare.value
540
+ });
541
+ }
542
+ return { version: 1, language: "lucene-v1", root };
543
+ }, "parseLucene");
544
+ var implicitTextTerms = /* @__PURE__ */ __name((text6) => {
545
+ const tokens = tokensOf(text6);
546
+ if (tokens.some(({ kind: kind2 }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind2)))
547
+ return /* @__PURE__ */ new Set();
548
+ return new Set(tokens.flatMap((token, index) => (token.kind === "term" || token.kind === "number") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index - 1]?.kind ?? "") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index + 1]?.kind ?? "") ? [token.span.start] : []));
549
+ }, "implicitTextTerms");
550
+
551
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/evaluate.js
552
+ var wordsOf = /* @__PURE__ */ __name((text6) => text6.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
553
+ var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
554
+ var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
555
+ var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
556
+ if (!present(value))
557
+ return false;
558
+ if (node.operator === "wildcard" && node.value === "*")
559
+ return true;
560
+ const text6 = String(value);
561
+ switch (field.type) {
562
+ case "txt": {
563
+ const words2 = wordsOf(text6);
564
+ if (node.operator === "wildcard")
565
+ return words2.some((word) => pattern(node.value).test(word));
566
+ const wanted = wordsOf(node.value);
567
+ return words2.some((_, at) => wanted.every((word, offset) => words2[at + offset] === word));
568
+ }
569
+ case "num": {
570
+ const number2 = Number(value);
571
+ if (node.operator !== "range")
572
+ return number2 === Number(node.value);
573
+ const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
574
+ return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
575
+ }
576
+ case "time": {
577
+ const time = Date.parse(text6);
578
+ const [lower, upper, lowerInclusive, upperInclusive] = node.operator === "range" ? [node.value, node.upper ?? "*", node.lower_inclusive ?? true, node.upper_inclusive ?? true] : [node.value, node.value, true, true];
579
+ const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
580
+ return (range.lower === void 0 || (range.lower_inclusive ? time >= range.lower : time > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time <= range.upper : time < range.upper));
581
+ }
582
+ default:
583
+ return node.operator === "wildcard" ? pattern(node.value).test(text6) : text6.toLowerCase() === node.value.toLowerCase();
584
+ }
585
+ }, "matchOne");
586
+ var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
587
+ if (node.kind === "boolean") {
588
+ const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
589
+ const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
590
+ const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
591
+ return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
592
+ }
593
+ const field = byName.get(node.field);
594
+ if (!field)
595
+ throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
596
+ if (field.relation !== void 0) {
597
+ if (!options.relation)
598
+ throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
599
+ return options.relation(node, item);
600
+ }
601
+ const value = item[node.field];
602
+ return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
603
+ }, "matches");
604
+ var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
605
+
606
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/fields.js
607
+ var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
608
+ var OPERATORS_BY_TYPE = {
609
+ kw: ["term", "phrase", "wildcard"],
610
+ txt: ["term", "phrase", "wildcard"],
611
+ enum: ["term"],
612
+ num: ["term", "range"],
613
+ time: ["term", "range"],
614
+ bool: ["term"],
615
+ ref: ["term", "phrase"]
616
+ };
617
+ var QUERY_BACKENDS = ["sql", "native"];
618
+ var unwrap = /* @__PURE__ */ __name((schema) => schema.wrapped ? unwrap(schema.wrapped) : schema, "unwrap");
619
+ var REFERENCE_SOURCE = reference.pipe[1].requirement.source;
620
+ var typeOf = /* @__PURE__ */ __name((schema) => {
621
+ const plain = unwrap(schema);
622
+ const actions = plain.pipe ?? [];
623
+ switch (plain.type) {
624
+ case "picklist":
625
+ return { type: "enum", values: (plain.options ?? []).map(String) };
626
+ case "number":
627
+ return { type: "num" };
628
+ case "boolean":
629
+ return { type: "bool" };
630
+ case "string":
631
+ if (actions.some((action) => action.type === "iso_timestamp"))
632
+ return { type: "time" };
633
+ if (actions.some((action) => action.requirement instanceof RegExp && action.requirement.source === REFERENCE_SOURCE))
634
+ return { type: "ref" };
635
+ return { type: "kw" };
636
+ case "array":
637
+ return plain.item ? typeOf(plain.item) : void 0;
638
+ default:
639
+ return void 0;
640
+ }
641
+ }, "typeOf");
642
+ var exampleOf = /* @__PURE__ */ __name((name, type, values) => ({
643
+ kw: `${name}:abc`,
644
+ txt: `${name}:word*`,
645
+ enum: `${name}:${values?.[0] ?? "x"}`,
646
+ num: `${name}>0`,
647
+ time: `${name}>=7d`,
648
+ bool: `${name}:true`,
649
+ ref: `${name}:"note:42"`
650
+ })[type], "exampleOf");
651
+ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
652
+ const entries = unwrap(schema).entries ?? {};
653
+ const excluded = new Set(annotations.exclude ?? []);
654
+ const words2 = new Set(annotations.text ?? []);
655
+ const native = new Set(annotations.native ?? []);
656
+ const negatable = new Set(annotations.negatable ?? []);
657
+ const finish = /* @__PURE__ */ __name((field) => ({
658
+ ...field,
659
+ operators: OPERATORS_BY_TYPE[field.type],
660
+ example: annotations.examples?.[field.name] ?? field.example ?? exampleOf(field.name, field.type, field.values),
661
+ ...native.has(field.name) ? { native: true } : {},
662
+ ...negatable.has(field.name) ? { negatable: true } : {},
663
+ ...annotations.validate?.[field.name] ? { validate: annotations.validate[field.name] } : {}
664
+ }), "finish");
665
+ const own = Object.entries(entries).flatMap(([name, entry]) => {
666
+ if (excluded.has(name))
667
+ return [];
668
+ const found = typeOf(entry);
669
+ if (!found)
670
+ return [];
671
+ return [finish({ name, ...found, ...words2.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
672
+ });
673
+ const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
674
+ const states = annotations.states ? [
675
+ finish({
676
+ name: "is",
677
+ type: "enum",
678
+ values: Object.keys(annotations.states),
679
+ relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
680
+ })
681
+ ] : [];
682
+ return [...own, ...relations, ...states];
683
+ }, "queryFieldsOf");
684
+
685
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/help.js
686
+ var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
687
+ var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
688
+ var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
689
+ var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
690
+ "field:value",
691
+ ...has(shown, "phrase") ? ['"a phrase"'] : [],
692
+ ...has(shown, "wildcard") ? ["word*"] : [],
693
+ ...backend === "native" ? ["terms joined by AND"] : ["AND OR NOT", "( )"],
694
+ ...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
695
+ ].join(" \xB7 "), "syntaxOf");
696
+ var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
697
+ var fieldsHelp = /* @__PURE__ */ __name((registry, guide) => {
698
+ const shown = shownOf(registry);
699
+ const negatable = leftOut(shown);
700
+ const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
701
+ const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
702
+ return [
703
+ "Fields:",
704
+ ...rows.map(([name = "", kind2 = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind2.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
705
+ ...registry.defaults && registry.defaults.length > 0 ? [`Defaults: ${registry.defaults.join(" ")} \u2014 name the field to change it`] : [],
706
+ ...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
707
+ `Syntax: ${syntaxOf(shown, registry.backend)}`,
708
+ ...guide ? [`Guide: ${guide}`] : []
709
+ ].join("\n");
710
+ }, "fieldsHelp");
711
+ var queryDescription = /* @__PURE__ */ __name((registry) => {
712
+ const shown = shownOf(registry);
713
+ if (shown.length === 0)
714
+ return "field:value terms; this list filters by none yet, so any term is refused";
715
+ const negatable = leftOut(shown);
716
+ const terms = registry.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
717
+ const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
718
+ const defaults = registry.defaults?.length ? `; unless named: ${registry.defaults.join(" ")}` : "";
719
+ return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
720
+ }, "queryDescription");
721
+
722
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/validate.js
723
+ var inContext = /* @__PURE__ */ __name((context3, run2) => {
724
+ try {
725
+ run2();
726
+ } catch (failure) {
727
+ if (!isCliError(failure) || typeof failure.details.reason !== "string" || failure.details.span === void 0)
728
+ throw failure;
729
+ const { reason, span, alternative } = failure.details;
730
+ queryError(reason, span, alternative, context3);
731
+ }
732
+ }, "inContext");
733
+ var bounds = /* @__PURE__ */ __name((node) => node.operator === "range" ? [node.value, node.upper ?? "*"].filter((bound) => bound !== "*") : [node.value], "bounds");
734
+ var checkValue = /* @__PURE__ */ __name((field, node, options) => {
735
+ const fail = /* @__PURE__ */ __name((reason, alternative) => queryError(reason, node.span, alternative, options), "fail");
736
+ if (node.value === "" && field.type !== "txt")
737
+ fail("query.missing-value");
738
+ if (node.operator === "wildcard")
739
+ return;
740
+ switch (field.type) {
741
+ case "enum":
742
+ if (!field.values?.includes(node.value.toLowerCase()))
743
+ fail("query.unknown-value", `${field.name} takes ${field.values?.join(", ")}`);
744
+ return;
745
+ case "bool":
746
+ if (!["true", "false"].includes(node.value.toLowerCase()))
747
+ fail("query.unknown-value", `${field.name} takes true, false`);
748
+ return;
749
+ case "num":
750
+ for (const bound of bounds(node))
751
+ if (!Number.isFinite(Number(bound)) || bound.trim() === "")
752
+ fail("query.invalid-number", `${field.name} takes a number`);
753
+ return;
754
+ case "time":
755
+ inContext(options, () => {
756
+ for (const bound of bounds(node))
757
+ dateEndpoint(bound, options.zone ?? "UTC", "lower", true, node.span);
758
+ });
759
+ return;
760
+ default:
761
+ return;
762
+ }
763
+ }, "checkValue");
764
+ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
765
+ const byName = new Map(registry.fields.map((field) => [field.name, field]));
766
+ const visit = /* @__PURE__ */ __name((node, required) => {
767
+ if (node.kind === "boolean") {
768
+ for (const clause of node.clauses)
769
+ visit(clause.node, required && clause.occur === "must");
770
+ return;
771
+ }
772
+ const field = byName.get(node.field);
773
+ if (!field)
774
+ queryError("query.unknown-field", node.span, `no field "${node.field}"`, options, {
775
+ fields: registry.fields.map((one) => one.name)
776
+ });
777
+ if (registry.backend === "native" && !field.native)
778
+ queryError("query.unsupported-field", node.span, `the source cannot filter by ${field.name}`, options, {
779
+ supported: registry.fields.filter((one) => one.native).map((one) => one.name)
780
+ });
781
+ const presence = node.operator === "wildcard" && node.value === "*";
782
+ if (!presence && !field.operators.includes(node.operator))
783
+ queryError("query.unsupported-operator", node.span, `${field.name} takes ${field.operators.join(", ")}`, options);
784
+ if (field.placement === "and" && !required)
785
+ queryError("query.unsupported-placement", node.span, `${field.name} only as a required term, not under OR or NOT`, options);
786
+ if (presence)
787
+ return;
788
+ checkValue(field, node, options);
789
+ if (field.validate)
790
+ inContext(options, () => field.validate?.(node));
791
+ }, "visit");
792
+ visit(ast.root, true);
793
+ return ast;
794
+ }, "validateQuery");
795
+ var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
796
+
797
+ // node_modules/.pnpm/@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28._2fe0e09d29eda9827e2087fd1a1cce67/node_modules/@wirecat/cli-base/dist/query/registry.js
798
+ var describeQuery = /* @__PURE__ */ __name((registry) => ({
799
+ entity: registry.entity,
800
+ backend: registry.backend,
801
+ fields: registry.fields.map(({ validate: _, ...field }) => field),
802
+ ...registry.defaults && registry.defaults.length > 0 ? { defaults: [...registry.defaults] } : {}
803
+ }), "describeQuery");
804
+ var exampleProblems = /* @__PURE__ */ __name((registry) => {
805
+ const syntaxOnly = { ...registry, backend: "sql" };
806
+ const problem = /* @__PURE__ */ __name((text6, field) => {
807
+ try {
808
+ const named = walkQuery(validateQuery(parseLucene(text6, { defaultField: "none" }), syntaxOnly).root);
809
+ return named.every((node) => node.field === field) ? void 0 : `"${text6}" does not name ${field}`;
810
+ } catch (failure) {
811
+ if (!isCliError(failure))
812
+ throw failure;
813
+ return `"${text6}": ${failure.message}`;
814
+ }
815
+ }, "problem");
816
+ const defaults = (registry.defaults ?? []).map((term) => {
817
+ const field = term.replace(/^-/, "").split(/[:<>=]/)[0] ?? "";
818
+ return { field, problem: problem(term.replace(/^-/, ""), field) };
819
+ });
820
+ return [
821
+ ...registry.fields.map((field) => ({ field: field.name, problem: problem(field.example, field.name) })),
822
+ ...defaults
823
+ ].filter((entry) => entry.problem !== void 0);
824
+ }, "exampleProblems");
825
+ var checked = /* @__PURE__ */ new WeakSet();
826
+ var defineQuery = /* @__PURE__ */ __name((registry) => {
827
+ if (checked.has(registry))
828
+ return registry;
829
+ const names = registry.fields.map((field) => field.name);
830
+ const problems = [
831
+ ...duplicates(names).map((name) => `"${name}" is listed twice`),
832
+ ...names.filter((name) => !SNAKE_CASE.test(name)).map((name) => `"${name}" is not snake_case`),
833
+ ...exampleProblems(registry).map(({ field, problem }) => `${field}: ${problem}`)
834
+ ];
835
+ if (problems.length > 0)
836
+ throw new RegistryError(`${registry.entity} query`, problems);
837
+ checked.add(registry);
838
+ return registry;
839
+ }, "defineQuery");
840
+ var SPAN = ["span", "alternative", "guide"];
841
+ var QUERY_REASONS = defineReasons([
842
+ ["query.bare-word", "a word in the query has no field", ["word"]],
843
+ ["query.invalid-ast", "the query tree is not valid", []],
844
+ ["query.invalid-date", "a date in the query cannot be read", []],
845
+ ["query.invalid-escape", "an escape in the query is not valid", []],
846
+ ["query.invalid-number", "a number in the query cannot be read", []],
847
+ ["query.invalid-regex", "a regular expression in the query is not valid", []],
848
+ ["query.invalid-syntax", "the query cannot be parsed", []],
849
+ ["query.invalid-timezone", "the time zone is not known", []],
850
+ ["query.missing-value", "a field in the query has no value", []],
851
+ ["query.too-large", "the query is over one of its limits", []],
852
+ ["query.unclosed-literal", "a quote or bracket in the query is not closed", []],
853
+ ["query.unknown-field", "a field in the query is not known", ["fields"]],
854
+ ["query.unknown-value", "a value in the query is not known", []],
855
+ ["query.unsupported-field", "this list cannot filter by that field", ["supported"]],
856
+ ["query.unsupported-operator", "this field does not take that operator", []],
857
+ ["query.unsupported-placement", "this field works only as a required term", []],
858
+ ["query.unsupported-regex", "that regular expression is not supported", []],
859
+ ["query.unsupported-regex-flags", "regular expression flags are not supported", []],
860
+ ["query.unsupported-version", "the query version is not supported", []]
861
+ ].map(([reason, message, details]) => ({
862
+ reason,
863
+ code: "validation_error",
864
+ message,
865
+ details: [...SPAN, ...details]
866
+ })));
867
+
868
+ // 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/meetings/reference.js
869
+ var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "expected meeting:<accountId>/<meetingId>[/<transcriptId>[/<cuePosition>]] with safe integer IDs"), "invalid");
870
+ var integer2 = /* @__PURE__ */ __name((value, minimum = 1) => {
871
+ if (!Number.isSafeInteger(value) || value < minimum)
872
+ throw invalid();
873
+ return value;
874
+ }, "integer");
875
+ var formatMeetingReference = /* @__PURE__ */ __name((reference2) => {
876
+ const parts = [integer2(reference2.accountId), integer2(reference2.meetingId)];
877
+ if (reference2.transcriptId !== void 0)
878
+ parts.push(integer2(reference2.transcriptId));
879
+ if (reference2.cuePosition !== void 0) {
880
+ if (reference2.transcriptId === void 0)
881
+ throw invalid();
882
+ parts.push(integer2(reference2.cuePosition, 0));
883
+ }
884
+ return `meeting:${parts.join("/")}`;
885
+ }, "formatMeetingReference");
886
+ var parseMeetingReference = /* @__PURE__ */ __name((text6) => {
887
+ const value = text6.trim();
888
+ if (!value.startsWith("meeting:"))
889
+ throw invalid();
890
+ const parts = value.slice(8).split("/");
891
+ if (parts.length < 2 || parts.length > 4 || parts.some((part) => !/^\d+$/.test(part)))
892
+ throw invalid();
893
+ const ids2 = parts.map(Number);
894
+ const reference2 = {
895
+ type: "meeting",
896
+ accountId: integer2(ids2[0]),
897
+ meetingId: integer2(ids2[1]),
898
+ ...ids2.length > 2 ? { transcriptId: integer2(ids2[2]) } : {},
899
+ ...ids2.length > 3 ? { cuePosition: integer2(ids2[3], 0) } : {}
900
+ };
901
+ return reference2;
902
+ }, "parseMeetingReference");
903
+ var canonicalMeetingReference = /* @__PURE__ */ __name((text6) => formatMeetingReference(parseMeetingReference(text6)), "canonicalMeetingReference");
904
+
905
+ // 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/meetings/payment.js
906
+ var FACT_TYPES = ["fact", "statement", "question", "decision", "promise"];
907
+ var PAYMENT_DIRECTIONS = ["to_us", "from_us"];
908
+ var PAYMENT_STATES = ["expected", "paid", "cancelled"];
909
+ var invalid2 = /* @__PURE__ */ __name((message) => {
910
+ throw new CliError("validation_error", message);
911
+ }, "invalid");
912
+ var CURRENCIES = new Set(Intl.supportedValuesOf("currency"));
913
+ var AMOUNT = /^(\d{1,15})(?:\.(\d{1,2}))?$/;
914
+ var COUNTERPARTY = /^(person|organization|project):[1-9]\d*$/;
915
+ var amountOf = /* @__PURE__ */ __name((value) => {
916
+ const match = AMOUNT.exec(typeof value === "number" ? String(value) : typeof value === "string" ? value.trim() : "");
917
+ if (!match)
918
+ return invalid2("a payment's amount is a positive number with at most 2 decimals, such as 1200.50");
919
+ const amount = `${BigInt(match[1] ?? "0")}.${(match[2] ?? "").padEnd(2, "0")}`;
920
+ if (amount === "0.00")
921
+ return invalid2("a payment's amount is more than 0");
922
+ return amount;
923
+ }, "amountOf");
924
+ var dateOf = /* @__PURE__ */ __name((value) => {
925
+ const date = typeof value === "string" ? value.trim() : "";
926
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(date) || (/* @__PURE__ */ new Date(`${date}T00:00:00Z`)).toISOString().slice(0, 10) !== date)
927
+ return invalid2("a payment's dates are ISO dates, such as 2026-10-31");
928
+ return date;
929
+ }, "dateOf");
930
+ var optionalText = /* @__PURE__ */ __name((value, what, limit) => {
931
+ if (value === void 0 || value === null)
932
+ return null;
933
+ if (typeof value !== "string" || !value.trim() || value.length > limit || value.includes("\0"))
934
+ return invalid2(`a payment's ${what} takes 1\u2013${limit} characters`);
935
+ return value.trim();
936
+ }, "optionalText");
937
+ var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
938
+ if (typeof value !== "string" || !allowed.includes(value))
939
+ return invalid2(`a payment's ${what} is one of ${allowed.join(", ")}`);
940
+ return value;
941
+ }, "oneOf");
942
+ var FIELDS = [
943
+ "amount",
944
+ "currency",
945
+ "direction",
946
+ "counterparty",
947
+ "counterparty_name",
948
+ "due_at",
949
+ "state",
950
+ "item",
951
+ "paid_at"
952
+ ];
953
+ var validatePayment = /* @__PURE__ */ __name((input) => {
954
+ if (!input || typeof input !== "object" || Array.isArray(input))
955
+ return invalid2("a payment is an object");
956
+ const raw = input;
957
+ const unknown = Object.keys(raw).filter((key) => !FIELDS.includes(key));
958
+ if (unknown.length)
959
+ return invalid2(`a payment has no field ${unknown.join(", ")}; its fields are ${FIELDS.join(", ")}`);
960
+ const currency = typeof raw.currency === "string" ? raw.currency.trim().toUpperCase() : "";
961
+ if (!/^[A-Z]{3}$/.test(currency) || !CURRENCIES.has(currency))
962
+ return invalid2("a payment's currency is an ISO 4217 code, such as EUR or RUB");
963
+ const counterparty = optionalText(raw.counterparty, "counterparty", 80);
964
+ if (counterparty !== null && !COUNTERPARTY.test(counterparty))
965
+ return invalid2("a payment's counterparty is a person:, organization: or project: reference");
966
+ const state = oneOf(raw.state, PAYMENT_STATES, "state");
967
+ if (raw.paid_at != null && state !== "paid")
968
+ return invalid2("only a paid payment has paid_at");
969
+ return {
970
+ amount: amountOf(raw.amount),
971
+ currency,
972
+ direction: oneOf(raw.direction, PAYMENT_DIRECTIONS, "direction"),
973
+ counterparty,
974
+ counterparty_name: optionalText(raw.counterparty_name, "counterparty name", 200),
975
+ due_at: raw.due_at === void 0 || raw.due_at === null ? null : dateOf(raw.due_at),
976
+ state,
977
+ item: optionalText(raw.item, "item", 200),
978
+ // Left out when absent, so a finding staged before the field keeps its fingerprint.
979
+ ...raw.paid_at == null ? {} : { paid_at: dateOf(raw.paid_at) }
980
+ };
981
+ }, "validatePayment");
982
+ var grouped = /* @__PURE__ */ __name((amount) => {
983
+ const [whole = "0", cents = "00"] = amount.split(".");
984
+ const digits = whole.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
985
+ return cents === "00" ? digits : `${digits}.${cents}`;
986
+ }, "grouped");
987
+ var paymentTitle = /* @__PURE__ */ __name((fact) => {
988
+ const payment = fact.payment;
989
+ if (!payment)
990
+ return "";
991
+ const who = payment.counterparty_name ?? payment.counterparty;
992
+ const way = payment.direction === "to_us" ? "to us" : "from us";
993
+ const party = who === null ? "" : payment.direction === "to_us" ? ` from ${who}` : ` to ${who}`;
994
+ const due = payment.due_at === null ? "" : `, due ${payment.due_at.slice(8, 10)}.${payment.due_at.slice(5, 7)}`;
995
+ const item = payment.item === null ? "" : ` for ${payment.item}`;
996
+ return `${grouped(payment.amount)} ${payment.currency} ${way}${party}${item}${due} (${payment.state})`;
997
+ }, "paymentTitle");
998
+
999
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/meetings/hit-query.js
1000
+ var context = {
1001
+ command: "search meetings",
1002
+ guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md#\u0432\u0441\u0442\u0440\u0435\u0447\u0438"
1003
+ };
1004
+ var words = ["term", "phrase"];
1005
+ var MOST_LINES_APART = 20;
1006
+ var near = /* @__PURE__ */ __name((node) => {
1007
+ if (node.slop !== void 0 && node.slop > MOST_LINES_APART)
1008
+ queryError("query.invalid-number", node.span, `words at most ${MOST_LINES_APART} lines apart: "a b"~${MOST_LINES_APART}`, context);
1009
+ }, "near");
1010
+ var MEETING_HIT_QUERY = defineQuery({
1011
+ entity: "meeting_hit",
1012
+ backend: "sql",
1013
+ fields: [
1014
+ {
1015
+ name: "text",
1016
+ type: "txt",
1017
+ operators: words,
1018
+ example: "text:budget",
1019
+ relation: "a passage with the word in any form, or a spelling speech recognition garbled",
1020
+ validate: near
1021
+ },
1022
+ {
1023
+ name: "exact",
1024
+ type: "txt",
1025
+ operators: words,
1026
+ example: "exact:budget",
1027
+ relation: "a passage with the word as typed: no other forms, no garbled spellings",
1028
+ validate: near
1029
+ },
1030
+ {
1031
+ name: "from",
1032
+ type: "kw",
1033
+ operators: words,
1034
+ example: 'from:"Alice Synthetic"',
1035
+ relation: "a line said or a chat message written by this person; attendance is --identity-id"
1036
+ }
1037
+ ]
1038
+ });
1039
+ var MEETING_FIELDS = defineQuery({
1040
+ entity: "meeting_hit",
1041
+ backend: "sql",
1042
+ fields: [
1043
+ ...MEETING_HIT_QUERY.fields,
1044
+ {
1045
+ name: "date",
1046
+ type: "time",
1047
+ operators: ["term", "range"],
1048
+ example: "date>=30d",
1049
+ relation: "meetings that started then; the same as --since-time and --until-time"
1050
+ },
1051
+ ...["project", "tag", "topic"].map((name) => ({
1052
+ name,
1053
+ type: "kw",
1054
+ operators: words,
1055
+ example: `${name}:"Example name"`,
1056
+ relation: `meetings in this ${name}, by name or alias; the same as --${name}`
1057
+ }))
1058
+ ]
1059
+ });
1060
+ var LIFTED = /* @__PURE__ */ new Set(["date", "project", "tag", "topic"]);
1061
+ var MEETING_FIELD_NAMES = new Set(MEETING_FIELDS.fields.map(({ name }) => name));
1062
+ var liftMeetingFields = /* @__PURE__ */ __name((query, request, now, timezone) => {
1063
+ let ast;
1064
+ try {
1065
+ ast = validateQuery(parseLucene(query, { defaultField: "text", proximity: true, ...context }), MEETING_FIELDS, context);
1066
+ } catch (error) {
1067
+ if (error instanceof CliError)
1068
+ return { query, request };
1069
+ throw error;
1070
+ }
1071
+ const top = ast.root.kind === "boolean" ? ast.root.clauses : [{ occur: "must", node: ast.root }];
1072
+ const lifted = top.filter((clause) => clause.node.kind === "predicate" && LIFTED.has(clause.node.field));
1073
+ const misplaced = /* @__PURE__ */ __name((node, nested) => node.kind === "predicate" ? nested && LIFTED.has(node.field) ? node : void 0 : node.clauses.map((clause) => misplaced(clause.node, true)).find(Boolean), "misplaced");
1074
+ const wrong = lifted.find((clause) => clause.occur !== "must")?.node ?? top.map((clause) => clause.node.kind === "boolean" ? misplaced(clause.node, true) : void 0).find(Boolean);
1075
+ if (wrong)
1076
+ queryError("query.unsupported-field", wrong.span, `${wrong.field}: chooses meetings; join it to the words with AND, outside OR, NOT and groups`, context);
1077
+ if (!lifted.length)
1078
+ return { query, request };
1079
+ const next = { ...request };
1080
+ const once = /* @__PURE__ */ __name((name, flag2) => {
1081
+ if (next[name] !== void 0)
1082
+ throw new CliError("validation_error", `give ${flag2.replace(/^--/, "")} once: as ${flag2} or in the query`);
1083
+ }, "once");
1084
+ for (const { node } of lifted) {
1085
+ if (node.field === "date") {
1086
+ const range = dateRange(node.value, node.operator === "range" ? node.upper ?? "*" : node.value, node.lower_inclusive !== false, node.upper_inclusive !== false, timezoneOf(timezone), node.span, now);
1087
+ if (range.lower !== void 0) {
1088
+ once("since", "--since-time");
1089
+ next.since = range.lower + (range.lower_inclusive ? 0 : 1);
1090
+ }
1091
+ if (range.upper !== void 0) {
1092
+ once("until", "--until-time");
1093
+ next.until = range.upper - (range.upper_inclusive ? 0 : 1);
1094
+ }
1095
+ } else {
1096
+ const field = node.field;
1097
+ once(field, `--${field}`);
1098
+ next[field] = node.value;
1099
+ }
1100
+ }
1101
+ let rest = query;
1102
+ for (const { node } of [...lifted].sort((a, b) => b.node.span.start - a.node.span.start))
1103
+ rest = `${rest.slice(0, node.span.start)}${rest.slice(node.span.end)}`;
1104
+ rest = rest.replace(/(^|\s)\+(?=\s|$)/g, "$1").replace(/^(?:\s*(?:AND\b|&&))+|(?:(?:\bAND|&&)\s*)+$/g, "").replace(/(?:\bAND|&&)(\s+(?:AND\b|&&))+/g, "AND").trim();
1105
+ if (!rest)
1106
+ throw new CliError("validation_error", "give words to find besides date:, project:, tag: and topic:");
1107
+ return { query: rest, request: next };
1108
+ }, "liftMeetingFields");
1109
+ var parseMeetingQuery = /* @__PURE__ */ __name((query) => validateQuery(parseLucene(query, { defaultField: "text", proximity: true, ...context }), MEETING_HIT_QUERY, context), "parseMeetingQuery");
1110
+
1111
+ // 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/meetings/search-store.js
1112
+ var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
1113
+ let before = Number.POSITIVE_INFINITY;
1114
+ for (; ; ) {
1115
+ signal?.throwIfAborted();
1116
+ const { indexed, remaining } = await meetings.indexSearch({
1117
+ accountId,
1118
+ limit: 1e3,
1119
+ maxReadBytes: 64 * 1024 ** 2,
1120
+ signal
1121
+ });
1122
+ if (remaining === 0 || indexed === 0 || remaining >= before)
1123
+ return;
1124
+ before = remaining;
1125
+ }
1126
+ }, "refreshMeetingIndex");
1127
+
1128
+ // 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/service-query.js
1129
+ var BACKENDS = ["archive", "server", "both"];
1130
+ var MAX_BRANCHES = 64;
1131
+ var some = /* @__PURE__ */ __name((value) => value === void 0 ? [] : [value], "some");
1132
+ var readable = /* @__PURE__ */ __name((node, capability) => capability.fields[node.field]?.includes(node.operator) === true, "readable");
1133
+ var branchesOf = /* @__PURE__ */ __name((node, capability, cut) => {
1134
+ if (node.kind === "predicate")
1135
+ return readable(node, capability) ? some(capability.leaf(node, false)) : [capability.all];
1136
+ const must = node.clauses.filter(({ occur }) => occur === "must");
1137
+ const not = node.clauses.flatMap(({ occur, node: node2 }) => occur === "must_not" && node2.kind === "predicate" && capability.negatable?.includes(node2.field) && readable(node2, capability) ? some(capability.leaf(node2, true)) : []);
1138
+ const should = node.clauses.filter(({ occur }) => occur === "should");
1139
+ const base = must.length || !should.length ? must.reduce((product, { node: node2 }) => {
1140
+ const next = product.flatMap((one) => branchesOf(node2, capability, cut).flatMap((other) => some(capability.both(one, other))));
1141
+ return next.length > MAX_BRANCHES ? product : next;
1142
+ }, [capability.all]) : should.flatMap(({ node: node2 }) => branchesOf(node2, capability, cut));
1143
+ if (base.length > MAX_BRANCHES)
1144
+ cut.branches = true;
1145
+ return not.reduce((branches, negated) => branches.flatMap((one) => some(capability.both(one, negated))), base.slice(0, MAX_BRANCHES));
1146
+ }, "branchesOf");
1147
+ var serviceCallsOf = /* @__PURE__ */ __name((root, capability, scope2) => {
1148
+ const cut = { branches: false };
1149
+ const all = branchesOf(root, capability, cut).flatMap((branch) => scope2 === void 0 ? [branch] : some(capability.both(scope2, branch)));
1150
+ const sent = capability.sends ? all.filter((branch) => capability.sends?.(branch)) : all;
1151
+ const unique = [...new Map(sent.map((branch) => [JSON.stringify(branch), branch])).values()];
1152
+ const unsent = all.length - sent.length;
1153
+ if (capability.either && unique.length)
1154
+ return { calls: [capability.either(unique)], complete: !cut.branches, unsent };
1155
+ const max = Math.max(1, capability.maxCalls);
1156
+ return { calls: unique.slice(0, max), complete: !cut.branches && unique.length <= max, unsent };
1157
+ }, "serviceCallsOf");
1158
+ var rangeOf = /* @__PURE__ */ __name((node, zone, now) => dateRange(node.value, node.operator === "range" ? node.upper ?? "*" : node.value, node.operator === "range" ? node.lower_inclusive === true : true, node.operator === "range" ? node.upper_inclusive === true : true, zone, node.span, now), "rangeOf");
1159
+ var windowOf = /* @__PURE__ */ __name(({ lower, upper, lower_inclusive, upper_inclusive }) => ({
1160
+ ...lower === void 0 ? {} : { from: lower_inclusive ? lower : lower + 1 },
1161
+ ...upper === void 0 ? {} : { to: upper_inclusive ? upper : upper - 1 }
1162
+ }), "windowOf");
1163
+ var RELATIVE_TIME = /^\d+[mhd]$/i;
1164
+ var OFFSET = /(?:Z|[+-]\d{2}:?\d{2})$/i;
1165
+ var readsZone = /* @__PURE__ */ __name((ast, times) => walkQuery(ast.root).some((term) => times.has(term.field) && [term.value, term.upper].some((value) => value !== void 0 && value !== "*" && !RELATIVE_TIME.test(value) && !OFFSET.test(value))), "readsZone");
1166
+
1167
+ // 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/meetings/model.js
1168
+ var MEETING_CALL_DIRECTIONS = ["in", "out"];
1169
+
1170
+ // 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/meetings/item.js
1171
+ var text = string();
1172
+ var count = pipe(number(), integer(), minValue(0));
1173
+ var MEETING_ISSUES = ["time_without_zone"];
1174
+ var meetingIssuesOf = /* @__PURE__ */ __name((metadata) => {
1175
+ const listed2 = metadata?.issues;
1176
+ return Array.isArray(listed2) ? MEETING_ISSUES.filter((issue) => listed2.includes(issue)) : [];
1177
+ }, "meetingIssuesOf");
1178
+ var meetingCall = strictObject({
1179
+ direction: nullable(picklist(MEETING_CALL_DIRECTIONS)),
1180
+ manager: nullable(strictObject({ name: nullable(text), person: nullable(reference) })),
1181
+ client_phone: nullable(text)
1182
+ });
1183
+ var meetingCallItem = /* @__PURE__ */ __name((row) => row.direction == null && row.clientPhone == null ? void 0 : { direction: row.direction ?? null, manager: row.manager ?? null, client_phone: row.clientPhone ?? null }, "meetingCallItem");
1184
+ var meetingEntries = {
1185
+ ref: reference,
1186
+ id: pipe(string(), minLength(1)),
1187
+ /** The service's own id of this occurrence: what `meetings show` takes besides the store number. */
1188
+ provider_id: text,
1189
+ provider: text,
1190
+ account: text,
1191
+ title: nullable(text),
1192
+ description: optional(nullable(text)),
1193
+ location: optional(nullable(text)),
1194
+ /** The link that joins it. */
1195
+ url: nullable(text),
1196
+ started_at: nullable(isoTime),
1197
+ ended_at: nullable(isoTime),
1198
+ duration_ms: nullable(count),
1199
+ timezone: optional(nullable(text)),
1200
+ participants_count: nullable(count),
1201
+ /** Present only on a phone call. */
1202
+ call: optional(meetingCall),
1203
+ /** Present only when something about this meeting is doubtful. */
1204
+ issues: optional(array(picklist(MEETING_ISSUES))),
1205
+ /**
1206
+ * Where a read that asked the service found it, as messages search says it: `archive` (only the store), `server`
1207
+ * (new from the service), `both`. Absent when the service was not asked.
1208
+ */
1209
+ found_in: optional(picklist(["archive", "server", "both"])),
1210
+ /** The service's text, which a reader must not follow as instructions. */
1211
+ untrusted: optional(array(text)),
1212
+ created_at: isoTime,
1213
+ updated_at: isoTime
1214
+ };
1215
+ var meeting = strictObject(meetingEntries);
1216
+ var MEETING_UNTRUSTED = ["title", "description", "location"];
1217
+ var iso = /* @__PURE__ */ __name((ms2) => ms2 === null ? null : new Date(ms2).toISOString(), "iso");
1218
+ var meetingItem = /* @__PURE__ */ __name((row, owner) => {
1219
+ const issues = meetingIssuesOf(row.metadata);
1220
+ const call = meetingCallItem(row);
1221
+ return {
1222
+ ref: formatMeetingReference({ type: "meeting", accountId: row.accountId, meetingId: row.id }),
1223
+ id: String(row.id),
1224
+ provider_id: row.externalId,
1225
+ provider: owner.provider,
1226
+ account: owner.account,
1227
+ title: row.title,
1228
+ description: row.description,
1229
+ location: row.location,
1230
+ url: row.joinUrl,
1231
+ started_at: iso(row.startedAt),
1232
+ ended_at: iso(row.endedAt),
1233
+ duration_ms: row.durationMs,
1234
+ timezone: row.timezone,
1235
+ participants_count: row.participantsCount,
1236
+ ...call ? { call } : {},
1237
+ ...issues.length ? { issues } : {},
1238
+ untrusted: [...MEETING_UNTRUSTED],
1239
+ created_at: new Date(row.createdAt).toISOString(),
1240
+ updated_at: new Date(row.updatedAt).toISOString()
1241
+ };
1242
+ }, "meetingItem");
1243
+ var MEETING_QUERY = {
1244
+ entity: "meeting",
1245
+ backend: "sql",
1246
+ fields: queryFieldsOf(meeting, {
1247
+ exclude: [
1248
+ "ref",
1249
+ "provider",
1250
+ "account",
1251
+ "description",
1252
+ "location",
1253
+ "url",
1254
+ "timezone",
1255
+ "issues",
1256
+ "found_in",
1257
+ "untrusted"
1258
+ ],
1259
+ examples: {
1260
+ id: "id:12",
1261
+ provider_id: "provider_id:85746065432",
1262
+ title: "title:*standup*",
1263
+ started_at: "started_at:[2026-10-01 TO 2026-10-31]",
1264
+ duration_ms: "duration_ms>=3600000",
1265
+ participants_count: "participants_count>5"
1266
+ }
1267
+ })
1268
+ };
1269
+
1270
+ // 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/meetings/store.js
1271
+ var MEETING_DOCUMENT_ROLES = ["transcript", "recording", "notes"];
1272
+ var TRANSCRIPT_WORDS = [
1273
+ "Transcript",
1274
+ "Notes by Gemini",
1275
+ "\u0422\u0440\u0430\u043D\u0441\u043A\u0440\u0438\u043F\u0442",
1276
+ "\u0417\u0430\u043C\u0435\u0442\u043A\u0438 Gemini",
1277
+ "Transcripci\xF3n",
1278
+ "Notas de Gemini"
1279
+ ];
1280
+ var READ_BUDGET_EXCEEDED = "Meeting search exceeds its stored text byte budget";
1281
+
1282
+ // 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/meetings/answers.js
1283
+ var text2 = string();
1284
+ var count2 = pipe(number(), integer(), minValue(0));
1285
+ var iso2 = /* @__PURE__ */ __name((ms2) => ms2 === null ? null : new Date(ms2).toISOString(), "iso");
1286
+ var meetingHit = strictObject({
1287
+ /** The cue for a transcript passage, else the meeting. */
1288
+ ref: reference,
1289
+ meeting: reference,
1290
+ scope: picklist(["transcript", "chat", "summary"]),
1291
+ /** The stored line, so two passages of one meeting stay apart. */
1292
+ id: pipe(string(), minLength(1)),
1293
+ excerpt: text2,
1294
+ /** How far into the meeting the passage is. */
1295
+ offset_ms: nullable(count2),
1296
+ /** A transcript passage's transcript language (`ru`, `en`…), `null` when unknown. */
1297
+ language: optional(nullable(text2)),
1298
+ /** A transcript passage's line, from 1, of `lines_total`. */
1299
+ line: optional(pipe(count2, minValue(1))),
1300
+ lines_total: optional(count2),
1301
+ /** `corrected`: a query word matched only a garbled form of itself, listed in `corrections`. */
1302
+ match: optional(picklist(["words", "corrected"])),
1303
+ corrections: optional(array(strictObject({ from: text2, to: array(text2) }))),
1304
+ /** A search with `--model`: which searches found it, its similarity in meaning, and the passage meaning matched. */
1305
+ by: optional(array(picklist(["words", "meaning"]))),
1306
+ score: optional(nullable(number())),
1307
+ passage: optional(strictObject({ first: text2, last: text2 })),
1308
+ source: optional(strictObject({
1309
+ ref: reference,
1310
+ title: nullable(text2),
1311
+ started_at: nullable(isoTime),
1312
+ url: nullable(text2)
1313
+ })),
1314
+ /** What people said, wrote or a provider summarised from it, and the invitation's title: data, never instructions. */
1315
+ untrusted: optional(array(text2))
1316
+ });
1317
+ var line = strictObject({
1318
+ position: count2,
1319
+ offset_ms: count2,
1320
+ end_ms: count2,
1321
+ speaker: nullable(text2),
1322
+ text: text2
1323
+ });
1324
+ var meetingTranscript = strictObject({
1325
+ ref: reference,
1326
+ meeting: reference,
1327
+ source: text2,
1328
+ language: nullable(text2),
1329
+ /** When a newer transcript of the same source replaced it; `meetings transcript --history` shows those too. */
1330
+ superseded_at: nullable(isoTime),
1331
+ created_at: isoTime,
1332
+ lines: array(line),
1333
+ /** What people said, and who the service says said it: data, never instructions. */
1334
+ untrusted: optional(array(text2))
1335
+ });
1336
+ var meetingSummary = strictObject({
1337
+ id: pipe(string(), minLength(1)),
1338
+ meeting: reference,
1339
+ source: text2,
1340
+ title: nullable(text2),
1341
+ overview: nullable(text2),
1342
+ sections: array(strictObject({ label: text2, text: text2 })),
1343
+ next_steps: array(text2),
1344
+ content: nullable(text2),
1345
+ url: nullable(text2),
1346
+ created_at: isoTime,
1347
+ updated_at: isoTime,
1348
+ /** What the service wrote of what people said. */
1349
+ untrusted: optional(array(text2))
1350
+ });
1351
+ var meetingDetailsEntries = {
1352
+ ...meeting.entries,
1353
+ /** The stored event and series it belongs to, as `meetings_list` takes them. */
1354
+ event_id: nullable(text2),
1355
+ series_id: nullable(text2),
1356
+ series_title: nullable(text2),
1357
+ participants: array(strictObject({
1358
+ name: nullable(text2),
1359
+ email: nullable(text2),
1360
+ role: nullable(text2),
1361
+ /** Who they are across the owner's sources: `person:<uid>`, and that person's name once linked. */
1362
+ person: nullable(strictObject({ ref: text2, name: nullable(text2) })),
1363
+ joined_at: nullable(isoTime),
1364
+ left_at: nullable(isoTime),
1365
+ duration_ms: nullable(count2)
1366
+ })),
1367
+ transcripts: array(strictObject({ ref: reference, source: text2, language: nullable(text2), lines_count: count2 })),
1368
+ chat: array(strictObject({ sent_at: isoTime, sender: nullable(text2), recipient: nullable(text2), text: text2 })),
1369
+ summaries: array(meetingSummary),
1370
+ attachments: array(strictObject({
1371
+ position: count2,
1372
+ kind: text2,
1373
+ name: nullable(text2),
1374
+ mime: nullable(text2),
1375
+ size: nullable(count2),
1376
+ url: nullable(text2),
1377
+ /** The file on this computer; `null` when it stays on the service or the phone system (pbx over SFTP). */
1378
+ local_path: nullable(text2)
1379
+ })),
1380
+ /**
1381
+ * The Drive files the meeting service saved for it, by role. `document` is the stored document (`document:<id>`) once
1382
+ * a Drive profile has imported the file, else `null`: then `drive` can fetch it by `file_id`.
1383
+ */
1384
+ documents: array(strictObject({
1385
+ file_id: text2,
1386
+ role: picklist(MEETING_DOCUMENT_ROLES),
1387
+ title: nullable(text2),
1388
+ document: nullable(reference)
1389
+ }))
1390
+ };
1391
+ var meetingDetails = strictObject(meetingDetailsEntries);
1392
+ var TRANSCRIPT_UNTRUSTED = ["lines.text", "lines.speaker"];
1393
+ var SUMMARY_UNTRUSTED = ["title", "overview", "sections.label", "sections.text", "next_steps", "content"];
1394
+ var DETAILS_UNTRUSTED = [
1395
+ "series_title",
1396
+ "participants.name",
1397
+ "participants.email",
1398
+ "participants.person.name",
1399
+ "chat.sender",
1400
+ "chat.recipient",
1401
+ "chat.text",
1402
+ "attachments.name",
1403
+ "documents.title"
1404
+ ];
1405
+ var PARTICIPANT_UNTRUSTED = ["display_name", "email", "person.name"];
1406
+ var meetingRef = /* @__PURE__ */ __name((accountId, meetingId) => formatMeetingReference({ type: "meeting", accountId, meetingId }), "meetingRef");
1407
+ var meetingTranscriptItem = /* @__PURE__ */ __name((accountId, transcript, rows) => ({
1408
+ ref: formatMeetingReference({
1409
+ type: "meeting",
1410
+ accountId,
1411
+ meetingId: transcript.meetingId,
1412
+ transcriptId: transcript.id
1413
+ }),
1414
+ meeting: meetingRef(accountId, transcript.meetingId),
1415
+ source: transcript.source,
1416
+ language: transcript.language,
1417
+ superseded_at: iso2(transcript.supersededAt),
1418
+ created_at: new Date(transcript.externalCreatedAt ?? transcript.createdAt).toISOString(),
1419
+ lines: rows.map((row) => ({
1420
+ position: row.position,
1421
+ offset_ms: row.startMs,
1422
+ end_ms: row.endMs,
1423
+ speaker: row.speakerName,
1424
+ text: row.text
1425
+ })),
1426
+ untrusted: [...TRANSCRIPT_UNTRUSTED]
1427
+ }), "meetingTranscriptItem");
1428
+ var meetingSummaryItem = /* @__PURE__ */ __name((accountId, summary) => ({
1429
+ id: String(summary.id),
1430
+ meeting: meetingRef(accountId, summary.meetingId),
1431
+ source: summary.source,
1432
+ title: summary.title,
1433
+ overview: summary.overview,
1434
+ sections: summary.sections.map(({ label, text: text6 }) => ({ label, text: text6 })),
1435
+ next_steps: summary.nextSteps,
1436
+ content: summary.content,
1437
+ url: summary.docUrl,
1438
+ created_at: new Date(summary.externalCreatedAt ?? summary.createdAt).toISOString(),
1439
+ updated_at: new Date(summary.externalUpdatedAt ?? summary.updatedAt).toISOString(),
1440
+ untrusted: [...SUMMARY_UNTRUSTED]
1441
+ }), "meetingSummaryItem");
1442
+ var meetingDetailsItem = /* @__PURE__ */ __name((details, owner) => {
1443
+ const { accountId } = details.meeting;
1444
+ const item = meetingItem(details.meeting, owner);
1445
+ return {
1446
+ ...item,
1447
+ untrusted: [...item.untrusted ?? [], ...DETAILS_UNTRUSTED],
1448
+ event_id: details.meeting.eventId === null ? null : String(details.meeting.eventId),
1449
+ series_id: details.meeting.meetingSeriesId === null ? null : String(details.meeting.meetingSeriesId),
1450
+ series_title: details.series?.title ?? null,
1451
+ participants: details.participants.map((one) => ({
1452
+ name: one.displayName,
1453
+ email: one.email,
1454
+ role: one.role,
1455
+ person: one.person ? { ref: `person:${one.person.uid}`, name: one.person.name } : null,
1456
+ joined_at: iso2(one.joinedAt),
1457
+ left_at: iso2(one.leftAt),
1458
+ duration_ms: one.durationMs
1459
+ })),
1460
+ transcripts: details.transcripts.filter(({ transcript }) => transcript.supersededAt === null && transcript.deletedAt === null).map(({ transcript, rows }) => ({
1461
+ ref: formatMeetingReference({
1462
+ type: "meeting",
1463
+ accountId,
1464
+ meetingId: transcript.meetingId,
1465
+ transcriptId: transcript.id
1466
+ }),
1467
+ source: transcript.source,
1468
+ language: transcript.language,
1469
+ lines_count: rows.length
1470
+ })),
1471
+ chat: details.chat.map((one) => ({
1472
+ sent_at: new Date(one.sentAt).toISOString(),
1473
+ sender: one.senderName,
1474
+ recipient: one.recipient,
1475
+ text: one.text
1476
+ })),
1477
+ summaries: details.summaries.map((one) => meetingSummaryItem(accountId, one)),
1478
+ attachments: details.attachments.map((one) => ({
1479
+ position: one.position,
1480
+ kind: one.kind,
1481
+ name: one.name ?? one.title,
1482
+ mime: one.mime,
1483
+ size: one.size,
1484
+ url: one.url,
1485
+ local_path: one.localPath
1486
+ })),
1487
+ documents: (details.documents ?? []).map((one) => ({
1488
+ file_id: one.fileId,
1489
+ role: one.role,
1490
+ title: one.title,
1491
+ document: one.documentId === null ? null : `document:${one.documentId}`
1492
+ }))
1493
+ };
1494
+ }, "meetingDetailsItem");
1495
+ var wholeList = /* @__PURE__ */ __name((items) => ({
1496
+ items,
1497
+ page: { mode: "page", limit: Math.max(1, items.length), has_more: false }
1498
+ }), "wholeList");
1499
+ var PAGE_NEXT = STEPS.find((step) => step.id === "page.next");
1500
+ var MEETING_STEPS = defineSteps([
1501
+ {
1502
+ id: "meetings.search-again",
1503
+ command: "*",
1504
+ args: [],
1505
+ why: "passages that changed since they were indexed were left out; the next search indexes them first"
1506
+ }
1507
+ ]);
1508
+ var SEARCH_AGAIN = MEETING_STEPS[0];
1509
+ var meetingHitItem = /* @__PURE__ */ __name((hit) => ({
1510
+ ref: hit.ref,
1511
+ meeting: meetingRef(parseMeetingReference(hit.ref).accountId, hit.meetingId),
1512
+ scope: hit.scope,
1513
+ id: String(hit.id),
1514
+ excerpt: hit.text,
1515
+ offset_ms: hit.startMs,
1516
+ ...hit.language === void 0 ? {} : { language: hit.language },
1517
+ ...hit.line === void 0 ? {} : { line: hit.line },
1518
+ ...hit.linesTotal === void 0 ? {} : { lines_total: hit.linesTotal },
1519
+ untrusted: hit.source === void 0 ? ["excerpt"] : ["excerpt", "source.title"],
1520
+ ...hit.match === void 0 ? {} : { match: hit.match },
1521
+ ...hit.corrections === void 0 ? {} : { corrections: hit.corrections },
1522
+ ...hit.source === void 0 ? {} : {
1523
+ source: {
1524
+ ref: hit.ref,
1525
+ title: hit.source.title,
1526
+ started_at: iso2(hit.source.startedAt),
1527
+ url: hit.source.url
1528
+ }
1529
+ }
1530
+ }), "meetingHitItem");
1531
+ var meetingHitsList = /* @__PURE__ */ __name((found, limit, command = "search meetings", args = {}, meta = {}) => {
1532
+ const items = found.items.map(meetingHitItem);
1533
+ const cursor = found.hasMore && found.nextCursor !== null ? found.nextCursor : void 0;
1534
+ const pending = found.coverage.indexing === "pending";
1535
+ const next = [
1536
+ ...cursor === void 0 ? [] : [stepOf(PAGE_NEXT, { command, args: { ...args, cursor, limit }, values: { shown: items.length } })],
1537
+ ...pending ? [
1538
+ stepOf(SEARCH_AGAIN, {
1539
+ command,
1540
+ args: Object.fromEntries(Object.entries(args).filter(([key]) => key !== "cursor"))
1541
+ })
1542
+ ] : []
1543
+ ];
1544
+ return {
1545
+ items,
1546
+ page: {
1547
+ mode: "cursor",
1548
+ limit,
1549
+ has_more: cursor !== void 0,
1550
+ ...cursor === void 0 ? {} : { next_cursor: cursor }
1551
+ },
1552
+ ...next.length > 0 ? { next } : {},
1553
+ ...pending ? {
1554
+ missing: [
1555
+ {
1556
+ field: "excerpt",
1557
+ why: "passages that changed since they were indexed were left out",
1558
+ step: "meetings.search-again"
1559
+ }
1560
+ ]
1561
+ } : {},
1562
+ ...Object.keys(meta).length === 0 ? {} : { meta }
1563
+ };
1564
+ }, "meetingHitsList");
1565
+
1566
+ // 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/meetings/join-key.js
1567
+ var joinKeyOf = /* @__PURE__ */ __name((url) => {
1568
+ const parsed = urlOf(url);
1569
+ if (!parsed)
1570
+ return null;
1571
+ const host = parsed.hostname.toLowerCase().replace(/^www\./u, "");
1572
+ const path = parsed.pathname.replace(/\/+$/u, "");
1573
+ if (host === "zoom.us" || host.endsWith(".zoom.us") || host === "zoomgov.com" || host.endsWith(".zoomgov.com")) {
1574
+ const number2 = /^\/(?:j|w|s|wc\/join|wc)\/(\d{9,12})(?:\/|$)/u.exec(path)?.[1];
1575
+ if (number2)
1576
+ return `zoom:${number2}`;
1577
+ }
1578
+ if (host === "meet.google.com") {
1579
+ const code = /^\/([a-z]{3}-[a-z]{4}-[a-z]{3})$/iu.exec(path)?.[1];
1580
+ if (code)
1581
+ return `meet:${code.toLowerCase()}`;
1582
+ }
1583
+ return `${host}${path}`;
1584
+ }, "joinKeyOf");
1585
+ var joinUrlWithoutQuery = /* @__PURE__ */ __name((url) => {
1586
+ const parsed = urlOf(url);
1587
+ return parsed ? `${parsed.origin}${parsed.pathname}` : null;
1588
+ }, "joinUrlWithoutQuery");
1589
+ var urlOf = /* @__PURE__ */ __name((url) => {
1590
+ if (!url?.trim())
1591
+ return null;
1592
+ try {
1593
+ const parsed = new URL(url.trim());
1594
+ return parsed.protocol === "https:" || parsed.protocol === "http:" ? parsed : null;
1595
+ } catch {
1596
+ return null;
1597
+ }
1598
+ }, "urlOf");
1599
+
1600
+ // 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/meetings/calendar-text.js
1601
+ var ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'", apos: "'", nbsp: " " };
1602
+ var SECRET_LINE = /(?<![\p{L}\p{N}])(pass ?codes?|passwords?|pwd|pins?|access ?codes?|meeting ?codes?|kennwort|пароль|пин-?код|код доступа)(?![\p{L}\p{N}])|pwd=/iu;
1603
+ var htmlToText = /* @__PURE__ */ __name((html) => html.replace(/<\s*br\s*\/?>/giu, "\n").replace(/<\/\s*(p|div|li|tr|h[1-6])\s*>/giu, "\n").replace(/<a\s[^>]*href\s*=\s*"([^"]*)"[^>]*>/giu, " $1 ").replace(/<[^>]+>/gu, "").replace(/&(amp|lt|gt|quot|#39|apos|nbsp);/gu, (_, name) => ENTITIES[name] ?? ""), "htmlToText");
1604
+ var withoutLinkQueries = /* @__PURE__ */ __name((text6) => text6.replace(/https?:\/\/[^\s<>"')\]]+/giu, (url) => joinUrlWithoutQuery(url) ?? ""), "withoutLinkQueries");
1605
+ var calendarText = /* @__PURE__ */ __name((text6, { dropSecretLines = true } = {}) => {
1606
+ if (!text6)
1607
+ return null;
1608
+ const kept = htmlToText(text6).split(/\r?\n/u).map((line2) => withoutLinkQueries(line2).replace(/[ \t]+/gu, " ").trim()).filter((line2) => !dropSecretLines || !SECRET_LINE.test(line2));
1609
+ const joined = kept.join("\n").replace(/\n{3,}/gu, "\n\n").trim();
1610
+ return joined || null;
1611
+ }, "calendarText");
1612
+ var ENTRY_METADATA_KEYS = [
1613
+ "colorId",
1614
+ "guestsCanInviteOthers",
1615
+ "guestsCanModify",
1616
+ "guestsCanSeeOtherGuests",
1617
+ "hangoutLink",
1618
+ "locked",
1619
+ "privateCopy",
1620
+ // A phone call's, from a records import: the entry's other columns have no place for them.
1621
+ "callDirection",
1622
+ "callSeconds",
1623
+ "callNumber"
1624
+ ];
1625
+ var entryMetadata = /* @__PURE__ */ __name((metadata) => {
1626
+ const kept = {};
1627
+ for (const key of ENTRY_METADATA_KEYS) {
1628
+ const value = metadata?.[key];
1629
+ if (typeof value === "string")
1630
+ kept[key] = withoutLinkQueries(value);
1631
+ else if (typeof value === "number" || typeof value === "boolean")
1632
+ kept[key] = value;
1633
+ }
1634
+ return kept;
1635
+ }, "entryMetadata");
1636
+
1637
+ // 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/meetings/calls.js
1638
+ var CALL_DIRECTIONS = ["incoming", "outgoing", "internal"];
1639
+ var CALL_OUTCOMES = ["answered", "voicemail", "busy", "no_answer", "failed"];
1640
+
1641
+ // 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/meetings/call-answers.js
1642
+ var count3 = pipe(number(), integer(), minValue(0));
1643
+ var ms = count3;
1644
+ var id = pipe(number(), integer(), minValue(1));
1645
+ var counts = /* @__PURE__ */ __name((keys) => strictObject(Object.fromEntries([...keys, "unknown"].map((key) => [key, count3]))), "counts");
1646
+ var maybe = exactOptional;
1647
+ var employee = strictObject({
1648
+ /** `extension:<number>`, or `identity:<id>` where the provider names no extension. */
1649
+ key: string(),
1650
+ name: nullable(string()),
1651
+ identity_id: nullable(id),
1652
+ extension: nullable(string()),
1653
+ calls: count3,
1654
+ incoming: count3,
1655
+ outgoing: count3,
1656
+ internal: count3,
1657
+ placed: maybe(count3),
1658
+ answered: maybe(count3),
1659
+ rang_not_answered: maybe(count3),
1660
+ talk_ms: maybe(ms),
1661
+ mean_talk_ms: maybe(nullable(ms)),
1662
+ mean_wait_ms: maybe(nullable(ms)),
1663
+ max_wait_ms: maybe(nullable(ms))
1664
+ });
1665
+ var periodFields = {
1666
+ calls: count3,
1667
+ incoming: count3,
1668
+ outgoing: count3,
1669
+ internal: count3,
1670
+ answered: maybe(count3),
1671
+ missed: maybe(count3),
1672
+ talk_ms: maybe(ms)
1673
+ };
1674
+ var callRef = strictObject({ ref: reference, meeting_id: id, started_at: nullable(isoTime) });
1675
+ var callStatsSchema = strictObject({
1676
+ time_zone: string(),
1677
+ callback_within_ms: ms,
1678
+ short_call_under_ms: ms,
1679
+ calls: count3,
1680
+ /** Selected meetings that are not calls. */
1681
+ not_calls: count3,
1682
+ /** How many calls give each field; `roles` says who placed, answered and rang. */
1683
+ known: strictObject({
1684
+ direction: count3,
1685
+ outcome: count3,
1686
+ wait_ms: count3,
1687
+ talk_ms: count3,
1688
+ duration_ms: count3,
1689
+ roles: count3
1690
+ }),
1691
+ by_direction: maybe(counts(CALL_DIRECTIONS)),
1692
+ by_outcome: maybe(counts(CALL_OUTCOMES)),
1693
+ talk_ms: maybe(ms),
1694
+ mean_talk_ms: maybe(ms),
1695
+ duration_ms: maybe(ms),
1696
+ mean_wait_ms: maybe(nullable(ms)),
1697
+ max_wait_ms: maybe(nullable(ms)),
1698
+ short_calls: maybe(count3),
1699
+ employees: array(employee),
1700
+ /** Hours 0–23 in `time_zone`. */
1701
+ hours: array(strictObject({ hour: pipe(count3, maxValue(23)), ...periodFields })),
1702
+ /** `YYYY-MM-DD` in `time_zone`, the days with a call. */
1703
+ days: array(strictObject({ date: string(), ...periodFields })),
1704
+ missed: maybe(strictObject({
1705
+ calls: count3,
1706
+ called_back: count3,
1707
+ not_called_back: count3,
1708
+ unknown_callback: count3,
1709
+ unknown_outcome: count3,
1710
+ /** Newest first. */
1711
+ items: array(strictObject({
1712
+ ...callRef.entries,
1713
+ outcome: picklist(["voicemail", "busy", "no_answer"]),
1714
+ client: nullable(strictObject({ key: string(), name: nullable(string()) })),
1715
+ rang: array(string()),
1716
+ called_back: maybe(boolean()),
1717
+ callback: maybe(nullable(strictObject({ ...callRef.entries, after_ms: ms, direction: picklist(["outgoing", "incoming"]) })))
1718
+ })),
1719
+ has_more: boolean()
1720
+ }))
1721
+ });
1722
+ var callStats = callStatsSchema;
1723
+
1724
+ // 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/meetings/stats.js
1725
+ var MEETING_COUNTS_GROUPINGS = ["day", "week", "series"];
1726
+ var zoneOf = /* @__PURE__ */ __name((timeZone) => {
1727
+ const zone = timeZone ?? "UTC";
1728
+ try {
1729
+ new Intl.DateTimeFormat("en", { timeZone: zone });
1730
+ } catch {
1731
+ throw new CliError("validation_error", "expected an IANA time zone such as Europe/Madrid");
1732
+ }
1733
+ return zone;
1734
+ }, "zoneOf");
1735
+ var DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
1736
+ var weekStart = /* @__PURE__ */ __name((at, format) => {
1737
+ const parts = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
1738
+ const day = Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day));
1739
+ return new Date(day - DAYS.indexOf(parts.weekday ?? "Mon") * 864e5).toISOString().slice(0, 10);
1740
+ }, "weekStart");
1741
+ var dayKey = /* @__PURE__ */ __name((at, format) => {
1742
+ const parts = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
1743
+ return `${parts.year}-${parts.month}-${parts.day}`;
1744
+ }, "dayKey");
1745
+ var zoneFormat = /* @__PURE__ */ __name((zone) => new Intl.DateTimeFormat("en-US", {
1746
+ timeZone: zone,
1747
+ year: "numeric",
1748
+ month: "2-digit",
1749
+ day: "2-digit",
1750
+ weekday: "short"
1751
+ }), "zoneFormat");
1752
+ var NO_SERIES = "no-series";
1753
+ var MOST_COUNT_ROWS = 100;
1754
+ var minutesOf = /* @__PURE__ */ __name((ms2) => Math.round(ms2 / 6e4), "minutesOf");
1755
+ var meanOf = /* @__PURE__ */ __name((ms2, timed) => timed === 0 ? null : Math.round(ms2 / timed / 6e3) / 10, "meanOf");
1756
+ var aggregateMeetingCounts = /* @__PURE__ */ __name((meetings, by, timeZone, limit = MOST_COUNT_ROWS) => {
1757
+ if (!MEETING_COUNTS_GROUPINGS.includes(by))
1758
+ throw new CliError("validation_error", `--by takes ${MEETING_COUNTS_GROUPINGS.join(", ")}`);
1759
+ if (!Number.isSafeInteger(limit) || limit < 1)
1760
+ throw new CliError("validation_error", "--limit is a positive number");
1761
+ const zone = zoneOf(timeZone);
1762
+ const format = zoneFormat(zone);
1763
+ const sum = /* @__PURE__ */ __name(() => ({ meetings: 0, ms: 0, timed: 0, transcripts: 0 }), "sum");
1764
+ const add = /* @__PURE__ */ __name((into, meeting2) => {
1765
+ into.meetings += 1;
1766
+ if (meeting2.durationMs !== null) {
1767
+ into.ms += Math.max(0, meeting2.durationMs);
1768
+ into.timed += 1;
1769
+ }
1770
+ if (meeting2.transcribed)
1771
+ into.transcripts += 1;
1772
+ }, "add");
1773
+ const total = { ...sum(), name: null };
1774
+ const groups = /* @__PURE__ */ new Map();
1775
+ for (const meeting2 of meetings) {
1776
+ add(total, meeting2);
1777
+ const key = by === "series" ? meeting2.seriesKey === null ? NO_SERIES : `series:${meeting2.seriesKey}` : meeting2.startedAt === null ? null : by === "day" ? dayKey(meeting2.startedAt, format) : weekStart(meeting2.startedAt, format);
1778
+ if (key === null)
1779
+ continue;
1780
+ const group = groups.get(key) ?? { ...sum(), name: by === "series" ? meeting2.seriesTitle : null };
1781
+ add(group, meeting2);
1782
+ groups.set(key, group);
1783
+ }
1784
+ const ordered = [...groups.entries()].sort(([a, one], [b, other]) => by === "series" ? other.ms - one.ms || other.meetings - one.meetings || a.localeCompare(b) : b.localeCompare(a));
1785
+ const kept = ordered.slice(0, limit);
1786
+ if (by !== "series")
1787
+ kept.reverse();
1788
+ const counted = /* @__PURE__ */ __name(({ meetings: count7, ms: ms2, timed, transcripts }) => ({
1789
+ meetings: count7,
1790
+ minutes: minutesOf(ms2),
1791
+ meanMinutes: meanOf(ms2, timed),
1792
+ transcripts
1793
+ }), "counted");
1794
+ return {
1795
+ by,
1796
+ timeZone: zone,
1797
+ ...counted(total),
1798
+ rows: kept.map(([key, group]) => ({ key, name: group.name, ...counted(group) })),
1799
+ hasMore: ordered.length > limit
1800
+ };
1801
+ }, "aggregateMeetingCounts");
1802
+ var UNKNOWN_SPEAKER = "unknown";
1803
+ var speakerOf = /* @__PURE__ */ __name((row) => row.personId !== null ? { key: `person:${row.personId}`, name: row.personName ?? row.identityName ?? row.speakerName } : row.identityId !== null ? { key: `identity:${row.identityId}`, name: row.identityName ?? row.speakerName } : row.speakerName?.trim() ? { key: `name:${row.speakerName.trim().toLowerCase()}`, name: row.speakerName.trim() } : { key: UNKNOWN_SPEAKER, name: null }, "speakerOf");
1804
+ var aggregateMeetingStats = /* @__PURE__ */ __name((rows, timeZone) => {
1805
+ const zone = zoneOf(timeZone);
1806
+ const format = zoneFormat(zone);
1807
+ const speakers = /* @__PURE__ */ new Map();
1808
+ const weeks = /* @__PURE__ */ new Map();
1809
+ const meetings = /* @__PURE__ */ new Set();
1810
+ let lines = 0;
1811
+ let words2 = 0;
1812
+ let talkMs = 0;
1813
+ for (const row of rows) {
1814
+ const talk = Math.max(0, row.endMs - row.startMs);
1815
+ meetings.add(row.meetingId);
1816
+ lines += 1;
1817
+ words2 += row.words;
1818
+ talkMs += talk;
1819
+ const who = speakerOf(row);
1820
+ const held = speakers.get(who.key) ?? {
1821
+ key: who.key,
1822
+ name: who.name ?? null,
1823
+ personId: row.personId,
1824
+ identityId: row.personId === null ? row.identityId : null,
1825
+ meetings: 0,
1826
+ lines: 0,
1827
+ words: 0,
1828
+ talkMs: 0,
1829
+ share: 0,
1830
+ seen: /* @__PURE__ */ new Set()
1831
+ };
1832
+ held.seen.add(row.meetingId);
1833
+ held.lines += 1;
1834
+ held.words += row.words;
1835
+ held.talkMs += talk;
1836
+ speakers.set(who.key, held);
1837
+ if (row.startedAt !== null) {
1838
+ const week = weeks.get(weekStart(row.startedAt, format)) ?? { meetings: /* @__PURE__ */ new Set(), talkMs: 0 };
1839
+ week.meetings.add(row.meetingId);
1840
+ week.talkMs += talk;
1841
+ weeks.set(weekStart(row.startedAt, format), week);
1842
+ }
1843
+ }
1844
+ return {
1845
+ timeZone: zone,
1846
+ meetings: meetings.size,
1847
+ lines,
1848
+ words: words2,
1849
+ talkMs,
1850
+ speakers: [...speakers.values()].map(({ seen, ...speaker }) => ({
1851
+ ...speaker,
1852
+ meetings: seen.size,
1853
+ share: talkMs === 0 ? 0 : Math.round(speaker.talkMs / talkMs * 1e3) / 1e3
1854
+ })).sort((a, b) => b.talkMs - a.talkMs || a.key.localeCompare(b.key)),
1855
+ weeks: [...weeks.entries()].map(([start, week]) => ({ weekStart: start, meetings: week.meetings.size, talkMs: week.talkMs })).sort((a, b) => a.weekStart.localeCompare(b.weekStart))
1856
+ };
1857
+ }, "aggregateMeetingStats");
1858
+
1859
+ // 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/meetings/call-stats.js
1860
+ var CALLBACK_WITHIN_MS = 24 * 60 * 60 * 1e3;
1861
+
1862
+ // 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/meetings/cue-fingerprint.js
1863
+ import { createHash } from "node:crypto";
1864
+ var meetingCueFingerprint = /* @__PURE__ */ __name((cue2) => createHash("sha256").update(JSON.stringify({
1865
+ reference: cue2.reference,
1866
+ transcriptId: cue2.transcriptId,
1867
+ contentHash: cue2.contentHash,
1868
+ position: cue2.position,
1869
+ startMs: cue2.startMs,
1870
+ endMs: cue2.endMs,
1871
+ speakerParticipantId: cue2.speakerParticipantId,
1872
+ speakerName: cue2.speakerName,
1873
+ text: cue2.text
1874
+ })).digest("hex"), "meetingCueFingerprint");
1875
+
1876
+ // 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/meetings/event-query.js
1877
+ var EVENT_QUERY = defineQuery({
1878
+ entity: "event",
1879
+ backend: "sql",
1880
+ fields: [
1881
+ { name: "id", type: "num", operators: ["term", "range"], example: "id:1" },
1882
+ { name: "origin", type: "enum", operators: ["term"], values: ["auto", "owner"], example: "origin:owner" },
1883
+ ...["starts_at", "ends_at", "created_at", "updated_at"].map((name) => ({
1884
+ name,
1885
+ type: "time",
1886
+ operators: ["term", "range"],
1887
+ example: `${name}>=2026-01-01`
1888
+ }))
1889
+ ]
1890
+ });
1891
+
1892
+ // 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/meetings/event-store.js
1893
+ var PARTICIPANT_RESPONSES = ["needs-action", "accepted", "tentative", "declined", "delegated"];
1894
+ var UNTIL = /(?:^|;)UNTIL=(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?(?:;|$)/iu;
1895
+ var seriesEnd = /* @__PURE__ */ __name((entry) => {
1896
+ if (entry.recurrenceEndsAt !== null)
1897
+ return entry.recurrenceEndsAt;
1898
+ const rule = entry.recurrence?.find((line2) => /^RRULE:/iu.test(line2));
1899
+ const until = rule === void 0 ? null : UNTIL.exec(rule.slice("RRULE:".length));
1900
+ if (!until)
1901
+ return Number.POSITIVE_INFINITY;
1902
+ const [, year, month, day, hour = "23", minute = "59", second = "59"] = until;
1903
+ return Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second)) + 864e5;
1904
+ }, "seriesEnd");
1905
+ var entryInWindow = /* @__PURE__ */ __name((entry, window) => {
1906
+ if (entry.kind === "occurrence" && !entry.exception)
1907
+ return entry.originalStartsAt !== null && entry.originalStartsAt >= window.from && entry.originalStartsAt < window.to;
1908
+ const start = entry.startsAt ?? (entry.kind === "occurrence" ? entry.originalStartsAt : null);
1909
+ if (start === null || start >= window.to)
1910
+ return false;
1911
+ if (entry.kind === "series")
1912
+ return seriesEnd(entry) >= window.from;
1913
+ return Math.max(entry.endsAt ?? start, start + 1) > window.from;
1914
+ }, "entryInWindow");
1915
+
1916
+ // 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/meetings/events.js
1917
+ var linkEvent = /* @__PURE__ */ __name(async (store, details, now = Date.now(), { create = true } = {}) => {
1918
+ const current = await store.meeting(details.meeting.id);
1919
+ if (!current)
1920
+ return null;
1921
+ const { meeting: meeting2, series } = current;
1922
+ if (meeting2.eventId !== null)
1923
+ return (await store.events()).find((e) => e.id === meeting2.eventId) ?? null;
1924
+ const candidates = meeting2.startedAt === null ? [] : await store.eventCandidates({
1925
+ meetingSeriesId: meeting2.meetingSeriesId,
1926
+ joinUrl: meeting2.joinUrl,
1927
+ startsAt: meeting2.startedAt,
1928
+ endsAt: meeting2.endedAt ?? meeting2.startedAt
1929
+ });
1930
+ if (candidates.length > 1) {
1931
+ await store.reviewMeetingLink?.(meeting2.id, candidates.map(({ id: id4 }) => id4), now);
1932
+ return null;
1933
+ }
1934
+ let event2 = candidates[0];
1935
+ if (!event2 && !create)
1936
+ return null;
1937
+ if (!event2) {
1938
+ let eventSeriesId = series?.eventSeriesId ?? null;
1939
+ if (series?.kind === "recurring" && eventSeriesId === null) {
1940
+ const created = await store.createEventSeries({ title: series.title, recurrence: null, origin: "auto" }, now);
1941
+ eventSeriesId = created.id;
1942
+ await store.setEventSeries(series.id, eventSeriesId, now);
1943
+ }
1944
+ event2 = await store.createEvent({
1945
+ eventSeriesId,
1946
+ title: meeting2.title,
1947
+ description: meeting2.description,
1948
+ location: meeting2.location,
1949
+ startsAt: meeting2.startedAt,
1950
+ endsAt: meeting2.endedAt,
1951
+ timezone: meeting2.timezone,
1952
+ origin: "auto",
1953
+ deletedAt: null
1954
+ }, now);
1955
+ }
1956
+ await store.linkMeeting(meeting2.id, event2.id, now);
1957
+ const linked = await store.meeting(meeting2.id);
1958
+ return (await store.events()).find((e) => e.id === linked?.meeting.eventId) ?? null;
1959
+ }, "linkEvent");
1960
+
1961
+ // 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/meetings/participant-search.js
1962
+ var normalizeMeetingParticipantQuery = /* @__PURE__ */ __name((text6) => text6.normalize("NFKC").toLowerCase(), "normalizeMeetingParticipantQuery");
1963
+ var validateMeetingParticipantQuery = /* @__PURE__ */ __name((query) => {
1964
+ if (typeof query !== "string" || !query.trim() || query.length > 500 || query.includes("\0"))
1965
+ throw new CliError("validation_error", "participant query must contain 1\u2013500 characters without NUL");
1966
+ return normalizeMeetingParticipantQuery(query.trim());
1967
+ }, "validateMeetingParticipantQuery");
1968
+ var validateMeetingParticipantSearch = /* @__PURE__ */ __name((query, input) => {
1969
+ input.signal?.throwIfAborted();
1970
+ const normalized = validateMeetingParticipantQuery(query);
1971
+ const bounded = /* @__PURE__ */ __name((value, maximum, name) => {
1972
+ if (!Number.isSafeInteger(value) || value < 1 || value > maximum)
1973
+ throw new CliError("validation_error", `${name} must be an integer from 1 through ${maximum}`);
1974
+ return value;
1975
+ }, "bounded");
1976
+ return {
1977
+ query: normalized,
1978
+ accountId: bounded(input.accountId, Number.MAX_SAFE_INTEGER, "accountId"),
1979
+ limit: bounded(input.limit ?? 50, 1e3, "limit"),
1980
+ scanLimit: bounded(input.scanLimit ?? 1e3, 1e4, "scanLimit"),
1981
+ maxReadBytes: bounded(input.maxReadBytes ?? 1024 ** 2, 64 * 1024 ** 2, "maxReadBytes")
1982
+ };
1983
+ }, "validateMeetingParticipantSearch");
1984
+
1985
+ // 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/meetings/reads.js
1986
+ var MeetingError = class extends CliError {
1987
+ static {
1988
+ __name(this, "MeetingError");
1989
+ }
1990
+ constructor(code, message) {
1991
+ super(code, message);
1992
+ }
1993
+ };
1994
+ var positiveInteger = /* @__PURE__ */ __name((value) => {
1995
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0)
1996
+ throw new MeetingError("validation_error", "expected a positive integer");
1997
+ return value;
1998
+ }, "positiveInteger");
1999
+ var validateFilter = /* @__PURE__ */ __name((filter) => {
2000
+ for (const value of [filter.accountId, filter.eventId, filter.meetingSeriesId])
2001
+ if (value !== void 0)
2002
+ positiveInteger(value);
2003
+ for (const value of [filter.since, filter.until])
2004
+ if (value !== void 0 && !Number.isFinite(value))
2005
+ throw new MeetingError("validation_error", "expected epoch milliseconds");
2006
+ if (filter.since !== void 0 && filter.until !== void 0 && filter.since > filter.until)
2007
+ throw new MeetingError("validation_error", "since must not exceed until");
2008
+ for (const value of [filter.limit, filter.offset])
2009
+ if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0))
2010
+ throw new MeetingError("validation_error", "expected a nonnegative integer");
2011
+ }, "validateFilter");
2012
+ var meetingShow = /* @__PURE__ */ __name(async (store, id4, accountId) => {
2013
+ const details = await store.meeting(positiveInteger(id4));
2014
+ if (!details || accountId !== void 0 && details.meeting.accountId !== accountId)
2015
+ throw new MeetingError("not_found", "meeting not found");
2016
+ return details;
2017
+ }, "meetingShow");
2018
+ var listed = /* @__PURE__ */ __name((items, page = { limit: items.length, hasMore: false }) => ({
2019
+ items,
2020
+ page: 1,
2021
+ ...page
2022
+ }), "listed");
2023
+ var meetingPeople = /* @__PURE__ */ __name(async (store, query, accountId, options = {}) => {
2024
+ if (accountId === void 0)
2025
+ validateMeetingParticipantQuery(query);
2026
+ else
2027
+ validateMeetingParticipantSearch(query, { ...options, accountId });
2028
+ if (store.participantCandidates && accountId === void 0)
2029
+ throw new MeetingError("configuration_error", "select an account for bounded participant lookup");
2030
+ if (accountId !== void 0 && store.participantCandidates) {
2031
+ const { limit, hasMore: has_more, nextCursor: next_cursor, ...packet } = await store.participantCandidates(query, {
2032
+ ...options,
2033
+ accountId
2034
+ });
2035
+ return {
2036
+ ...packet,
2037
+ items: packet.items.map((one) => ({ ...one, untrusted: [...PARTICIPANT_UNTRUSTED] })),
2038
+ page: { mode: "cursor", limit, has_more, ...next_cursor ? { next_cursor } : {} },
2039
+ ...next_cursor ? {
2040
+ next: [
2041
+ stepOf(PAGE_NEXT2, {
2042
+ command: "meetings people",
2043
+ args: {
2044
+ query,
2045
+ limit,
2046
+ ...options.scanLimit === void 0 ? {} : { scan_limit: options.scanLimit },
2047
+ ...options.maxReadBytes === void 0 ? {} : { max_read_bytes: options.maxReadBytes },
2048
+ cursor: next_cursor
2049
+ },
2050
+ values: { shown: packet.items.length }
2051
+ })
2052
+ ]
2053
+ } : {}
2054
+ };
2055
+ }
2056
+ if (Object.values(options).some((value) => value !== void 0))
2057
+ throw new MeetingError("configuration_error", "bounded participant lookup needs a selected account and capable store");
2058
+ return listed((await store.participants(query, accountId)).map((one) => ({
2059
+ participant_id: one.id,
2060
+ meeting_id: one.meetingId,
2061
+ identity_id: one.identityId,
2062
+ display_name: one.displayName,
2063
+ email: one.email,
2064
+ untrusted: [...PARTICIPANT_UNTRUSTED]
2065
+ })));
2066
+ }, "meetingPeople");
2067
+ var PAGE_NEXT2 = STEPS.find((step) => step.id === "page.next");
2068
+ var meetingsList = /* @__PURE__ */ __name(async (store, filter = {}) => {
2069
+ validateFilter(filter);
2070
+ const limit = positiveInteger(filter.limit ?? 100);
2071
+ const offset = filter.offset ?? 0;
2072
+ const page = Math.floor(offset / limit) + 1;
2073
+ if (!Number.isSafeInteger(offset + limit + 1))
2074
+ throw new MeetingError("validation_error", "pagination exceeds safe integer range");
2075
+ const rows = await store.meetings({ ...filter, limit: limit + 1, offset });
2076
+ const shown = rows.slice(0, limit);
2077
+ const owners = /* @__PURE__ */ new Map();
2078
+ for (const { accountId } of shown) {
2079
+ if (owners.has(accountId))
2080
+ continue;
2081
+ const owner = await store.account(accountId);
2082
+ if (!owner)
2083
+ throw new MeetingError("not_found", `meeting account ${accountId} is not in the store`);
2084
+ owners.set(accountId, owner);
2085
+ }
2086
+ const has_more = rows.length > limit;
2087
+ return {
2088
+ items: shown.map((row) => meetingItem(row, owners.get(row.accountId))),
2089
+ page: { mode: "page", limit, has_more, ...has_more ? { next_page: page + 1 } : {} },
2090
+ ...has_more ? {
2091
+ next: [
2092
+ stepOf(PAGE_NEXT2, { command: "meetings list", args: { page: page + 1, limit }, values: { shown: limit } })
2093
+ ]
2094
+ } : {}
2095
+ };
2096
+ }, "meetingsList");
2097
+ var meetingsQuery = /* @__PURE__ */ __name((text6) => {
2098
+ if (text6 === void 0 || text6.trim() === "")
2099
+ return void 0;
2100
+ const context3 = { command: "meetings list", guide: MEETING_QUERY_GUIDE };
2101
+ const query = parseLucene(text6, { defaultField: "none", ...context3 });
2102
+ validateQuery(query, MEETING_QUERY, context3);
2103
+ return query;
2104
+ }, "meetingsQuery");
2105
+ var MEETING_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
2106
+ var ownerOf = /* @__PURE__ */ __name(async (store, accountId) => {
2107
+ const owner = await store.account(accountId);
2108
+ if (!owner)
2109
+ throw new MeetingError("not_found", `meeting account ${accountId} is not in the store`);
2110
+ return owner;
2111
+ }, "ownerOf");
2112
+ var meetingDetailsBody = /* @__PURE__ */ __name(async (store, details) => ({
2113
+ item: meetingDetailsItem(details, await ownerOf(store, details.meeting.accountId))
2114
+ }), "meetingDetailsBody");
2115
+ var meetingTranscriptAnswer = /* @__PURE__ */ __name(async (store, id4, accountId, options = {}) => {
2116
+ const details = await meetingShow(store, id4, accountId);
2117
+ return wholeList(details.transcripts.filter((t) => (options.history || t.transcript.supersededAt === null) && t.transcript.deletedAt === null).map((t) => meetingTranscriptItem(details.meeting.accountId, t.transcript, t.rows)));
2118
+ }, "meetingTranscriptAnswer");
2119
+ var meetingSummaryAnswer = /* @__PURE__ */ __name(async (store, id4, accountId) => {
2120
+ const details = await meetingShow(store, id4, accountId);
2121
+ return wholeList(details.summaries.map((one) => meetingSummaryItem(details.meeting.accountId, one)));
2122
+ }, "meetingSummaryAnswer");
2123
+
2124
+ // 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/meetings/export.js
2125
+ var timestamp = /* @__PURE__ */ __name((milliseconds) => {
2126
+ if (!Number.isSafeInteger(milliseconds) || milliseconds < 0)
2127
+ throw new MeetingError("validation_error", "transcript times must be nonnegative integer milliseconds");
2128
+ const hours = Math.floor(milliseconds / 36e5);
2129
+ const minutes = Math.floor(milliseconds % 36e5 / 6e4);
2130
+ const seconds = Math.floor(milliseconds % 6e4 / 1e3);
2131
+ return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}.${String(milliseconds % 1e3).padStart(3, "0")}`;
2132
+ }, "timestamp");
2133
+ var vttText = /* @__PURE__ */ __name((text6) => {
2134
+ if (visibleControls(text6) !== text6 || /\n\s*\n/.test(text6))
2135
+ throw new MeetingError("validation_error", "cue paragraphs or control characters require Markdown export");
2136
+ return text6.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2137
+ }, "vttText");
2138
+ var serializeVtt = /* @__PURE__ */ __name((lines) => `WEBVTT
2139
+
2140
+ ${lines.map((line2, index) => {
2141
+ if (index > 0 && line2.startMs < (lines[index - 1]?.startMs ?? 0))
2142
+ throw new MeetingError("validation_error", "WebVTT cues must have nondecreasing start times");
2143
+ if (line2.endMs <= line2.startMs)
2144
+ throw new MeetingError("validation_error", "a transcript cue ends before it starts");
2145
+ const speaker = line2.speaker === null ? "" : `${vttText(line2.speaker)}: `;
2146
+ if (line2.speaker?.includes("\n"))
2147
+ throw new MeetingError("validation_error", "a speaker must fit on one line");
2148
+ return `${index + 1}
2149
+ ${timestamp(line2.startMs)} --> ${timestamp(line2.endMs)}
2150
+ ${speaker}${vttText(line2.text)}
2151
+
2152
+ `;
2153
+ }).join("")}`, "serializeVtt");
2154
+ var markdown = /* @__PURE__ */ __name((text6) => visibleControls(text6).replace(/[\\`*_{}[\]()<>#+.!|~]/g, "\\$&"), "markdown");
2155
+ var heading = /* @__PURE__ */ __name((text6) => markdown(singleLine(text6)), "heading");
2156
+ var quote = /* @__PURE__ */ __name((text6) => markdown(text6).split(/\r\n|\r|\n/).map((line2) => `> ${line2}`).join("\n"), "quote");
2157
+ var transcriptsOf = /* @__PURE__ */ __name((details, transcriptId) => {
2158
+ if (transcriptId !== void 0) {
2159
+ positiveInteger(transcriptId);
2160
+ const transcript = details.transcripts.find((part) => part.transcript.id === transcriptId && part.transcript.deletedAt === null);
2161
+ if (!transcript)
2162
+ throw new MeetingError("not_found", "transcript not found in the selected meeting");
2163
+ return [transcript];
2164
+ }
2165
+ return details.transcripts.filter((part) => part.transcript.supersededAt === null && part.transcript.deletedAt === null);
2166
+ }, "transcriptsOf");
2167
+ var exportMeeting = /* @__PURE__ */ __name(async (store, id4, options) => {
2168
+ if (options.format !== "markdown" && options.format !== "vtt")
2169
+ throw new MeetingError("validation_error", "export format must be markdown or vtt");
2170
+ const details = await meetingShow(store, id4, options.accountId);
2171
+ const transcripts = transcriptsOf(details, options.transcriptId);
2172
+ let content;
2173
+ if (options.format === "vtt") {
2174
+ const [selected] = transcripts;
2175
+ if (!selected)
2176
+ throw new MeetingError("not_found", "meeting has no transcript to export");
2177
+ if (transcripts.length > 1)
2178
+ throw new MeetingError("validation_error", "choose a transcript id when exporting multiple transcripts as VTT");
2179
+ content = serializeVtt([...selected.rows].sort((a, b) => a.position - b.position).map((row) => ({
2180
+ startMs: row.startMs,
2181
+ endMs: row.endMs,
2182
+ speaker: row.speakerName,
2183
+ text: row.text
2184
+ })));
2185
+ } else {
2186
+ const parts = [`# ${heading(details.meeting.title ?? "Untitled meeting")}`, `Meeting ID: ${details.meeting.id}`];
2187
+ if (details.meeting.description !== null)
2188
+ parts.push("## Description", quote(details.meeting.description));
2189
+ for (const summary of details.summaries) {
2190
+ parts.push(`## ${heading(summary.title ?? "Summary")}`);
2191
+ if (summary.content !== null)
2192
+ parts.push(quote(summary.content));
2193
+ else {
2194
+ if (summary.overview !== null)
2195
+ parts.push(quote(summary.overview));
2196
+ for (const section of summary.sections)
2197
+ parts.push(`### ${heading(section.label)}`, quote(section.text));
2198
+ if (summary.nextSteps.length > 0)
2199
+ parts.push("### Next steps", summary.nextSteps.map((step) => `- ${markdown(step)}`).join("\n"));
2200
+ }
2201
+ }
2202
+ for (const part of transcripts) {
2203
+ parts.push(`## Transcript ${part.transcript.id}`, `Source: ${heading(part.transcript.source)}`);
2204
+ if (part.transcript.supersededAt !== null)
2205
+ parts.push("Version: superseded");
2206
+ for (const row of [...part.rows].sort((a, b) => a.position - b.position))
2207
+ parts.push(`[${timestamp(row.startMs)} \u2013 ${timestamp(row.endMs)}]${row.speakerName === null ? "" : ` ${heading(row.speakerName)}`}`, quote(row.text));
2208
+ }
2209
+ content = `${parts.join("\n\n")}
2210
+ `;
2211
+ }
2212
+ return {
2213
+ meetingId: details.meeting.id,
2214
+ format: options.format,
2215
+ filename: `meeting-${details.meeting.id}${options.transcriptId === void 0 ? "" : `-transcript-${options.transcriptId}`}.${options.format === "markdown" ? "md" : "vtt"}`,
2216
+ content,
2217
+ untrusted: ["content"]
2218
+ };
2219
+ }, "exportMeeting");
2220
+
2221
+ // 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/meetings/findings-rules.js
2222
+ import { createHash as createHash2 } from "node:crypto";
2223
+
2224
+ // 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/meetings/timestamp.js
2225
+ var meetingTimestamp = /* @__PURE__ */ __name((value, name) => {
2226
+ if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T.+(?:Z|[+-]\d{2}:\d{2})$/i.test(value) || !Number.isFinite(Date.parse(value)))
2227
+ throw new CliError("validation_error", `${name} must be an ISO timestamp with a timezone, such as 2026-11-09T09:00:00Z`);
2228
+ const date = value.slice(0, 10);
2229
+ const instant = Date.parse(`${date}T00:00:00Z`);
2230
+ if (!Number.isFinite(instant) || new Date(instant).toISOString().slice(0, 10) !== date)
2231
+ throw new CliError("validation_error", `${name} contains an invalid calendar date`);
2232
+ return new Date(value).toISOString();
2233
+ }, "meetingTimestamp");
2234
+
2235
+ // 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/meetings/findings-rules.js
2236
+ var TASK_TYPES = ["bug", "feature", "chore"];
2237
+ var invalid3 = /* @__PURE__ */ __name((message) => {
2238
+ throw new CliError("validation_error", message);
2239
+ }, "invalid");
2240
+ var findingText = /* @__PURE__ */ __name((value, limit) => {
2241
+ if (typeof value !== "string" || !value.trim() || value.includes("\0") || value.length > limit)
2242
+ return invalid3(`finding text must contain 1\u2013${limit} characters without NUL`);
2243
+ return value.trim();
2244
+ }, "findingText");
2245
+ var findingHash = /* @__PURE__ */ __name((value) => createHash2("sha256").update(JSON.stringify(value)).digest("hex"), "findingHash");
2246
+ var snakeCase = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snakeCase");
2247
+ var findingWhere = /* @__PURE__ */ __name((of) => {
2248
+ const id4 = typeof of.id === "string" ? of.id : null;
2249
+ const kind2 = typeof of.kind === "string" ? of.kind : null;
2250
+ return {
2251
+ where: id4 || kind2 ? ` in ${[id4, kind2 && `(${kind2})`].filter(Boolean).join(" ")}` : "",
2252
+ named: { ...id4 ? { finding: id4 } : {}, ...kind2 ? { kind: kind2 } : {} }
2253
+ };
2254
+ }, "findingWhere");
2255
+ var findingFields = /* @__PURE__ */ __name((value, allowed, noun, of = value) => {
2256
+ const unknown = Object.keys(value).filter((key) => !allowed.includes(key));
2257
+ if (!unknown.length)
2258
+ return;
2259
+ const fields = unknown.map(snakeCase);
2260
+ const takes = allowed.map(snakeCase);
2261
+ const { where, named } = findingWhere(of);
2262
+ throw new CliError("validation_error", `unknown ${noun} field${fields.length > 1 ? "s" : ""} ${fields.join(", ")}${where}; it takes ${takes.join(", ")}`, { reason: "finding.unknown-field", fields, allowed: takes, ...named });
2263
+ }, "findingFields");
2264
+ var findingNeeds = /* @__PURE__ */ __name((value, needed, noun) => {
2265
+ const missing = needed.filter((key) => value[key] === void 0);
2266
+ if (!missing.length)
2267
+ return;
2268
+ const fields = missing.map(snakeCase);
2269
+ const needs = needed.map(snakeCase);
2270
+ const { where, named } = findingWhere(value);
2271
+ throw new CliError("validation_error", `missing ${noun} field${fields.length > 1 ? "s" : ""} ${fields.join(", ")}${where}; it needs ${needs.join(", ")}`, { reason: "finding.missing-field", fields, needs, ...named });
2272
+ }, "findingNeeds");
2273
+ var SUBJECT = /^(person|organization|project):[1-9]\d*$|^task:[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/;
2274
+ var validEvidence = /* @__PURE__ */ __name((raw, rules) => {
2275
+ if (!Array.isArray(raw) || raw.length < 1 || raw.length > 8)
2276
+ return invalid3(`a finding requires 1\u20138 cited ${rules.cited}s`);
2277
+ const evidence = raw.map((item) => {
2278
+ if (!item || typeof item !== "object")
2279
+ return invalid3("finding evidence is a reference and fingerprint");
2280
+ findingFields(item, rules.quotes ? ["reference", "fingerprint", "quote"] : ["reference", "fingerprint"], rules.singular);
2281
+ if (typeof item.reference !== "string" || typeof item.fingerprint !== "string")
2282
+ return invalid3("evidence requires a reference and fingerprint");
2283
+ const reference2 = rules.reference(item.reference);
2284
+ if (!/^[a-f0-9]{64}$/.test(item.fingerprint))
2285
+ return invalid3(`finding evidence requires exact ${rules.cited} references and fingerprints`);
2286
+ if (item.quote === void 0)
2287
+ return { reference: reference2, fingerprint: item.fingerprint };
2288
+ return { reference: reference2, fingerprint: item.fingerprint, quote: findingText(item.quote, rules.quotes ?? 0) };
2289
+ }).sort((a, b) => a.reference.localeCompare(b.reference));
2290
+ if (new Set(evidence.map((item) => item.reference)).size !== evidence.length)
2291
+ return invalid3(`duplicate evidence ${rules.cited}`);
2292
+ return evidence;
2293
+ }, "validEvidence");
2294
+ var findingId = /* @__PURE__ */ __name((raw, ids2) => {
2295
+ const id4 = findingText(raw, 64);
2296
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/.test(id4) || ids2.has(id4))
2297
+ return invalid3("finding IDs must be unique simple keys");
2298
+ ids2.add(id4);
2299
+ return id4;
2300
+ }, "findingId");
2301
+ var validateFinding = /* @__PURE__ */ __name((finding, rules, ids2) => {
2302
+ if (!finding || typeof finding !== "object")
2303
+ return invalid3("a finding is an object");
2304
+ const id4 = findingId(finding.id, ids2);
2305
+ const project = finding.project === void 0 && rules.anySubject ? void 0 : findingText(finding.project, 64);
2306
+ if (project !== void 0 && !/^project:[1-9]\d*$/.test(project))
2307
+ return invalid3("a finding names a project reference");
2308
+ if (finding.subject !== void 0 && (!rules.anySubject || !SUBJECT.test(findingText(finding.subject, 80))))
2309
+ return invalid3("a finding's subject is a person:, organization:, task: or project: reference");
2310
+ if (finding.kind === "task" && project === void 0 && !rules.inboxTasks)
2311
+ return invalid3("a task finding names the project the task goes in");
2312
+ const evidence = validEvidence(finding.evidence, rules);
2313
+ const base = {
2314
+ id: id4,
2315
+ ...project === void 0 ? {} : { project },
2316
+ ...finding.subject === void 0 ? {} : { subject: finding.subject },
2317
+ evidence
2318
+ };
2319
+ if (finding.kind === "fact") {
2320
+ findingFields(finding, ["id", "project", "subject", "evidence", "kind", "type", "statement"], rules.singular);
2321
+ if (finding.type === "payment")
2322
+ return invalid3("a payment is a finding of kind payment; money is a payments row, not a fact");
2323
+ if (!FACT_TYPES.includes(finding.type))
2324
+ return invalid3("unknown fact finding type");
2325
+ return { ...base, kind: "fact", type: finding.type, statement: findingText(finding.statement, 2e3) };
2326
+ }
2327
+ if (finding.kind === "payment" && rules.payments) {
2328
+ findingFields(finding, ["id", "project", "subject", "evidence", "kind", "statement", "payment", "supersedes"], rules.singular);
2329
+ if (finding.supersedes !== void 0 && !/^invoice:[1-9]\d*$/.test(String(finding.supersedes)))
2330
+ return invalid3("a payment finding supersedes an invoice: reference, the expected payment it settles or voids");
2331
+ const payment = validatePayment(finding.payment);
2332
+ if (payment.state === "expected" && finding.supersedes !== void 0)
2333
+ return invalid3("an expected payment supersedes nothing; a paid or cancelled one supersedes its invoice");
2334
+ if (payment.state === "cancelled" && finding.supersedes === void 0)
2335
+ return invalid3("a cancelled payment names the invoice: it cancels in supersedes");
2336
+ if (payment.state === "expected" && !/^(person|organization):/.test(payment.counterparty ?? ""))
2337
+ return invalid3("an expected payment becomes an invoice, which names its counterparty as a person: or organization:");
2338
+ return {
2339
+ ...base,
2340
+ kind: "payment",
2341
+ ...finding.statement === void 0 ? {} : { statement: findingText(finding.statement, 2e3) },
2342
+ payment,
2343
+ ...finding.supersedes === void 0 ? {} : { supersedes: finding.supersedes }
2344
+ };
2345
+ }
2346
+ if (finding.kind !== "task")
2347
+ return invalid3(`a finding is a fact${rules.payments ? ", payment" : ""} or task`);
2348
+ findingFields(finding, [
2349
+ "id",
2350
+ "project",
2351
+ "evidence",
2352
+ "kind",
2353
+ "type",
2354
+ "title",
2355
+ "reason",
2356
+ "commitment",
2357
+ "dueAt",
2358
+ "dueEvidence",
2359
+ "assignee",
2360
+ "assigneeEvidence"
2361
+ ], rules.singular);
2362
+ if (!TASK_TYPES.includes(finding.type))
2363
+ return invalid3("a task finding type is bug, chore or feature");
2364
+ if (!["explicit", "inferred"].includes(finding.commitment))
2365
+ return invalid3("task commitment must be explicit or inferred");
2366
+ if (finding.dueAt === void 0 !== (finding.dueEvidence === void 0))
2367
+ return invalid3(`due_at comes with due_evidence: the ${rules.cited} references of this finding's evidence that give the date, as a list of strings such as ["<reference>"]`);
2368
+ if (finding.assignee === void 0 !== (finding.assigneeEvidence === void 0))
2369
+ return invalid3(`assignee comes with assignee_evidence: the ${rules.cited} references of this finding's evidence that name them, as a list of strings such as ["<reference>"]`);
2370
+ if (finding.assignee !== void 0 && (typeof finding.assignee !== "string" || !/^person:[1-9]\d*$/.test(finding.assignee)))
2371
+ return invalid3("an assignee must be a person reference");
2372
+ return {
2373
+ ...base,
2374
+ kind: "task",
2375
+ type: finding.type,
2376
+ title: findingText(finding.title, 300),
2377
+ reason: findingText(finding.reason, 2e3),
2378
+ commitment: finding.commitment,
2379
+ ...finding.dueAt === void 0 ? {} : {
2380
+ dueAt: meetingTimestamp(finding.dueAt, "a task's due_at"),
2381
+ dueEvidence: support(finding.dueEvidence, evidence, "due_evidence")
2382
+ },
2383
+ ...finding.assignee === void 0 ? {} : {
2384
+ assignee: finding.assignee,
2385
+ assigneeEvidence: support(finding.assigneeEvidence, evidence, "assignee_evidence")
2386
+ }
2387
+ };
2388
+ }, "validateFinding");
2389
+ var support = /* @__PURE__ */ __name((value, evidence, field) => {
2390
+ if (!Array.isArray(value) || value.length < 1 || value.length > 8 || value.some((ref) => typeof ref !== "string" || !evidence.some((item) => item.reference === ref)))
2391
+ return invalid3(`${field} lists 1\u20138 references this finding's evidence cites, as plain strings such as ["<reference>"], not evidence objects`);
2392
+ return [...new Set(value)].sort();
2393
+ }, "support");
2394
+ var validateBatch = /* @__PURE__ */ __name((input, rules, most, one) => {
2395
+ if (!input || typeof input !== "object" || Buffer.byteLength(JSON.stringify(input), "utf8") > 65536)
2396
+ return invalid3(`${rules.plural} take at most 65536 UTF-8 bytes`);
2397
+ findingFields(input, ["schemaVersion", "key", "extractor", "findings"], rules.singular);
2398
+ if (input.schemaVersion !== 1 || !Array.isArray(input.findings) || input.findings.length < 1 || input.findings.length > most)
2399
+ return invalid3(`schemaVersion 1 takes 1\u2013${most} ${rules.plural}`);
2400
+ const key = findingText(input.key, 64);
2401
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/.test(key))
2402
+ return invalid3("a findings key uses letters, digits, dot, colon, underscore or hyphen");
2403
+ const ids2 = /* @__PURE__ */ new Set();
2404
+ const findings = input.findings.map((finding) => one(finding, ids2));
2405
+ return { schemaVersion: 1, key, extractor: findingText(input.extractor, 200), findings };
2406
+ }, "validateBatch");
2407
+ var validateFindings = /* @__PURE__ */ __name((input, rules) => validateBatch(input, rules, 16, (finding, ids2) => validateFinding(finding, rules, ids2)), "validateFindings");
2408
+ var findingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "findingFingerprint");
2409
+
2410
+ // 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/meetings/findings.js
2411
+ var MEETING_FINDINGS_KIND = "meeting_findings";
2412
+ var cue = /* @__PURE__ */ __name((raw) => {
2413
+ const reference2 = canonicalMeetingReference(raw);
2414
+ if (parseMeetingReference(reference2).cuePosition === void 0)
2415
+ throw new CliError("validation_error", "finding evidence requires exact cue references and fingerprints");
2416
+ return reference2;
2417
+ }, "cue");
2418
+ var validateMeetingFindings = /* @__PURE__ */ __name((input) => validateFindings(input, { plural: "meeting findings", singular: "meeting finding", cited: "cue", reference: cue }), "validateMeetingFindings");
2419
+ var meetingFindingFingerprint = findingFingerprint;
2420
+
2421
+ // 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/meetings/language.js
2422
+ var LATIN_WORDS = {
2423
+ en: ["the", "and", "is", "that", "you", "this", "what", "have", "with", "are"],
2424
+ es: ["el", "los", "las", "por", "pero", "para", "est\xE1", "muy", "tambi\xE9n", "hay"],
2425
+ de: ["der", "und", "ist", "nicht", "das", "ich", "wir", "mit", "auch", "ein"],
2426
+ fr: ["le", "les", "est", "une", "pas", "je", "vous", "nous", "avec", "mais"],
2427
+ it: ["gli", "della", "sono", "perch\xE9", "anche", "questo", "molto", "che", "di", "\xE8"],
2428
+ pt: ["n\xE3o", "voc\xEA", "isso", "muito", "ent\xE3o", "com", "uma", "tamb\xE9m", "mas", "eu"]
2429
+ };
2430
+ var LATIN_LANGUAGE = new Map(Object.entries(LATIN_WORDS).flatMap(([language, words2]) => words2.map((word) => [word, language])));
2431
+ var UKRAINIAN = /[іїєґ]/giu;
2432
+ var CYRILLIC = new RegExp("\\p{Script=Cyrillic}", "gu");
2433
+ var LATIN = new RegExp("\\p{Script=Latin}", "gu");
2434
+ var MIN_LETTERS = 20;
2435
+ var DOMINANT = 0.75;
2436
+ var countOf = /* @__PURE__ */ __name((text6, pattern2) => text6.match(pattern2)?.length ?? 0, "countOf");
2437
+ var latinLanguage = /* @__PURE__ */ __name((texts) => {
2438
+ const votes = /* @__PURE__ */ new Map();
2439
+ for (const text6 of texts)
2440
+ for (const word of text6.toLowerCase().split(/[^\p{L}]+/u)) {
2441
+ const language = LATIN_LANGUAGE.get(word);
2442
+ if (language)
2443
+ votes.set(language, (votes.get(language) ?? 0) + 1);
2444
+ }
2445
+ const [first, second] = [...votes].sort((a, b) => b[1] - a[1]);
2446
+ if (!first || first[1] < 3 || second && first[1] < 2 * second[1])
2447
+ return null;
2448
+ return first[0];
2449
+ }, "latinLanguage");
2450
+ var transcriptLanguage = /* @__PURE__ */ __name((texts) => {
2451
+ const all = [...texts];
2452
+ let cyrillic = 0;
2453
+ let latin = 0;
2454
+ let ukrainian = 0;
2455
+ for (const text6 of all) {
2456
+ cyrillic += countOf(text6, CYRILLIC);
2457
+ latin += countOf(text6, LATIN);
2458
+ ukrainian += countOf(text6, UKRAINIAN);
2459
+ }
2460
+ const letters = cyrillic + latin;
2461
+ if (letters < MIN_LETTERS)
2462
+ return null;
2463
+ if (cyrillic / letters >= DOMINANT)
2464
+ return ukrainian / cyrillic >= 0.01 ? "uk" : "ru";
2465
+ if (latin / letters >= DOMINANT)
2466
+ return latinLanguage(all);
2467
+ return null;
2468
+ }, "transcriptLanguage");
2469
+
2470
+ // 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/meetings/ingest.js
2471
+ var contentHash = /* @__PURE__ */ __name(async (text6) => {
2472
+ const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text6));
2473
+ return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
2474
+ }, "contentHash");
2475
+ var speakerPosition = /* @__PURE__ */ __name((name, participants) => {
2476
+ if (name === null)
2477
+ return null;
2478
+ const matches2 = participants.flatMap((p, i) => p.displayName === name ? [i] : []);
2479
+ return matches2.length === 1 ? matches2[0] ?? null : null;
2480
+ }, "speakerPosition");
2481
+ var transcriptInput = /* @__PURE__ */ __name(async (lines, participants, source, hashText = JSON.stringify(lines), format = null) => ({
2482
+ source,
2483
+ format,
2484
+ language: transcriptLanguage(lines.map((line2) => line2.text)),
2485
+ contentHash: await contentHash(hashText),
2486
+ externalCreatedAt: null,
2487
+ metadata: null,
2488
+ deletedAt: null,
2489
+ rows: lines.map((line2, position) => ({
2490
+ position,
2491
+ startMs: line2.startMs,
2492
+ endMs: line2.endMs,
2493
+ speakerParticipantPosition: speakerPosition(line2.speaker, participants),
2494
+ speakerName: line2.speaker,
2495
+ text: line2.text,
2496
+ normalizedText: null,
2497
+ metadata: null
2498
+ }))
2499
+ }), "transcriptInput");
2500
+ var timestamp2 = /* @__PURE__ */ __name((value) => {
2501
+ const time = Date.parse(value);
2502
+ if (!Number.isFinite(time))
2503
+ throw new Error("Invalid meeting timestamp");
2504
+ return time;
2505
+ }, "timestamp");
2506
+
2507
+ // 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/meetings/pull.js
2508
+ var participantInput = /* @__PURE__ */ __name((p, provider, occurrenceId2, position, accountId) => {
2509
+ const { identityExternalId, phone, ...fields } = p;
2510
+ const externalId = identityExternalId ?? (p.email ? `email:${p.email.toLowerCase()}` : p.externalId) ?? `name:${p.displayName ?? "unknown"}@${accountId}/${occurrenceId2}:${position}`;
2511
+ return {
2512
+ ...fields,
2513
+ identity: {
2514
+ provider,
2515
+ externalId,
2516
+ name: p.displayName,
2517
+ ...phone?.trim() ? { phone } : {},
2518
+ metadata: p.metadata,
2519
+ associatePerson: Boolean(identityExternalId?.trim() || p.email?.trim() || p.externalId?.trim())
2520
+ }
2521
+ };
2522
+ }, "participantInput");
2523
+ var participantInputs = /* @__PURE__ */ __name((provider, occurrenceId2, list, accountId) => list.map((p, i) => participantInput(p, provider, occurrenceId2, i, accountId)), "participantInputs");
2524
+ var sourceMeetingInput = /* @__PURE__ */ __name((m, accountId, participantsCount, kept) => {
2525
+ const startedAt = timestamp2(m.occurrence.startedAt);
2526
+ const given = m.occurrence.endedAt === null ? null : timestamp2(m.occurrence.endedAt);
2527
+ if (given !== null && given < startedAt)
2528
+ throw new Error("Meeting ends before it starts");
2529
+ const keptEnd = kept?.endedAt ?? null;
2530
+ const endedAt = given ?? (keptEnd !== null && keptEnd >= startedAt ? keptEnd : null);
2531
+ const count7 = participantsCount === null && kept ? kept.participantsCount : participantsCount;
2532
+ const metadata = kept?.metadata && m.metadata ? { ...kept.metadata, ...m.metadata } : m.metadata ?? kept?.metadata ?? null;
2533
+ const meeting2 = {
2534
+ accountId,
2535
+ externalId: m.occurrence.id,
2536
+ title: m.occurrence.title,
2537
+ description: m.description ?? kept?.description ?? null,
2538
+ location: m.location ?? kept?.location ?? null,
2539
+ joinUrl: m.joinUrl ?? m.series?.joinUrl ?? kept?.joinUrl ?? null,
2540
+ startedAt,
2541
+ endedAt,
2542
+ durationMs: endedAt === null ? null : endedAt - startedAt,
2543
+ timezone: m.timezone ?? kept?.timezone ?? null,
2544
+ hostIdentityId: kept?.hostIdentityId ?? null,
2545
+ ...count7 === void 0 ? {} : { participantsCount: count7 },
2546
+ ...m.call ? { direction: m.call.direction ?? null, clientPhone: m.call.clientPhone ?? null } : {},
2547
+ metadata,
2548
+ deletedAt: null
2549
+ };
2550
+ if (m.series)
2551
+ meeting2.series = {
2552
+ externalId: m.series.id,
2553
+ title: m.series.title,
2554
+ description: null,
2555
+ kind: m.series.kind ?? null,
2556
+ recurrence: m.series.recurrence ?? null,
2557
+ hostIdentityId: null,
2558
+ joinUrl: m.series.joinUrl ?? null,
2559
+ metadata: null,
2560
+ deletedAt: null
2561
+ };
2562
+ return meeting2;
2563
+ }, "sourceMeetingInput");
2564
+ var saveSourceMeeting = /* @__PURE__ */ __name(async (source, store, m, parts, { accountId, now, kept }) => {
2565
+ const id4 = m.occurrence.id;
2566
+ const { participants: sourceParticipants, transcript: lines, chat, summary } = parts;
2567
+ const participants = participantInputs(source.provider, id4, sourceParticipants ?? [], accountId);
2568
+ const meeting2 = sourceMeetingInput(m, accountId, sourceParticipants === void 0 ? void 0 : sourceParticipants?.length ?? null, kept);
2569
+ const linked = sourceParticipants !== void 0;
2570
+ const format = source.transcriptFormat ?? null;
2571
+ const transcripts = lines && linked ? [await transcriptInput(lines, participants, source.name, void 0, format)] : void 0;
2572
+ const details = await store.saveMeeting({
2573
+ meeting: meeting2,
2574
+ participants: sourceParticipants ? participants : void 0,
2575
+ transcripts,
2576
+ chat: chat?.map((line2) => ({
2577
+ externalId: null,
2578
+ sentAt: timestamp2(line2.sentAt),
2579
+ senderParticipantPosition: speakerPosition(line2.sender, participants),
2580
+ senderName: line2.sender,
2581
+ recipient: null,
2582
+ text: line2.text,
2583
+ normalizedText: null,
2584
+ metadata: null
2585
+ })),
2586
+ summaries: summary ? [
2587
+ {
2588
+ ...summary,
2589
+ source: summary.source ?? source.name,
2590
+ content: summary.content ?? null,
2591
+ docUrl: summary.docUrl ?? null,
2592
+ externalCreatedAt: summary.externalCreatedAt ?? null,
2593
+ externalUpdatedAt: summary.externalUpdatedAt ?? null,
2594
+ metadata: summary.metadata ?? null
2595
+ }
2596
+ ] : void 0,
2597
+ attachments: parts.files ?? void 0,
2598
+ documents: parts.documents ?? void 0,
2599
+ now
2600
+ });
2601
+ if (lines && !linked && !details.transcripts.some((t) => t.transcript.source === source.name && t.transcript.supersededAt === null))
2602
+ await store.saveMeeting({
2603
+ meeting: meeting2,
2604
+ transcripts: [await transcriptInput(lines, [], source.name, `${JSON.stringify(lines)}
2605
+ unlinked`, format)],
2606
+ now
2607
+ });
2608
+ await linkEvent(store, details, now, { create: source.createsEvents !== false });
2609
+ return details;
2610
+ }, "saveSourceMeeting");
2611
+ var startOf = /* @__PURE__ */ __name((m) => {
2612
+ const at = Date.parse(m.occurrence.startedAt);
2613
+ return Number.isFinite(at) ? at : Number.POSITIVE_INFINITY;
2614
+ }, "startOf");
2615
+ var indexSaved = /* @__PURE__ */ __name(async (store, accountIds, report) => {
2616
+ const indexSearch = store.indexSearch?.bind(store);
2617
+ if (!indexSearch || report.meetings === 0)
2618
+ return;
2619
+ for (const accountId of new Set(accountIds))
2620
+ try {
2621
+ await refreshMeetingIndex({ indexSearch }, accountId);
2622
+ } catch (error) {
2623
+ report.warnings.push({
2624
+ externalId: String(accountId),
2625
+ message: `search index not updated: ${error instanceof Error ? error.message : "failed"}`
2626
+ });
2627
+ }
2628
+ }, "indexSaved");
2629
+ var pull = /* @__PURE__ */ __name(async (source, store, options) => {
2630
+ const now = options.now ?? Date.now();
2631
+ for (const [name, ms2] of [
2632
+ ["lookbackMs", options.lookbackMs ?? 0],
2633
+ ["overlapMs", source.overlapMs ?? 0]
2634
+ ])
2635
+ if (!Number.isSafeInteger(ms2) || ms2 < 0 || ms2 > 31 * 864e5)
2636
+ throw new Error(`${name} must be an integer from 0 through 31 days`);
2637
+ const lookbackMs = Math.max(options.lookbackMs ?? 0, source.overlapMs ?? 0);
2638
+ const cursor = options.rescan ? void 0 : await store.cursor(options.accountId);
2639
+ const since = options.since ?? cursor ?? new Date(now - 30 * 864e5).toISOString();
2640
+ timestamp2(since);
2641
+ const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
2642
+ let failed = false;
2643
+ let firstFailed;
2644
+ const callers = /* @__PURE__ */ new Set();
2645
+ const linkCallers = /* @__PURE__ */ __name(async () => {
2646
+ if (callers.size === 0 || !store.linkCallers)
2647
+ return;
2648
+ try {
2649
+ await store.linkCallers(source.provider, [...callers]);
2650
+ } catch (error) {
2651
+ report.warnings.push({
2652
+ externalId: source.provider,
2653
+ message: `callers not linked to people: ${error instanceof Error ? error.message : "failed"}`
2654
+ });
2655
+ }
2656
+ }, "linkCallers");
2657
+ const from = timestamp2(since) - lookbackMs;
2658
+ const meetings = (await source.meetings(lookbackMs === 0 ? since : new Date(from).toISOString())).toSorted((a, b) => startOf(a) - startOf(b));
2659
+ for (const [index, m] of meetings.entries()) {
2660
+ const stop = options.budget?.take() ?? null;
2661
+ if (stop) {
2662
+ report.stopped = stop;
2663
+ report.remaining = meetings.length - index;
2664
+ const reached = Math.min(startOf(m), firstFailed ?? Number.POSITIVE_INFINITY);
2665
+ if (Number.isFinite(reached) && reached > timestamp2(since))
2666
+ await store.setCursor(options.accountId, new Date(reached).toISOString(), now);
2667
+ await linkCallers();
2668
+ return report;
2669
+ }
2670
+ const id4 = m.occurrence.id;
2671
+ const failedHere = /* @__PURE__ */ __name(() => {
2672
+ failed = true;
2673
+ firstFailed ??= startOf(m);
2674
+ }, "failedHere");
2675
+ const read = /* @__PURE__ */ __name(async (part, call) => {
2676
+ try {
2677
+ return await call();
2678
+ } catch (error) {
2679
+ failedHere();
2680
+ const message = error instanceof Error ? error.message : "could not be read";
2681
+ report.warnings.push({ externalId: id4, message: `${part}: ${message}` });
2682
+ return void 0;
2683
+ }
2684
+ }, "read");
2685
+ try {
2686
+ const sourceParticipants = await read("participants", () => source.participants(id4));
2687
+ const participants = participantInputs(source.provider, id4, sourceParticipants ?? [], options.accountId);
2688
+ const names = /* @__PURE__ */ new Map();
2689
+ for (const p of participants)
2690
+ if (p.displayName !== null) {
2691
+ const identities = names.get(p.displayName) ?? /* @__PURE__ */ new Set();
2692
+ identities.add(p.identity.externalId);
2693
+ names.set(p.displayName, identities);
2694
+ }
2695
+ if ([...names.values()].some((ids2) => ids2.size > 1))
2696
+ report.warnings.push({ externalId: id4, message: "Participant names are ambiguous" });
2697
+ const lines = await read("transcript", () => source.transcript(id4));
2698
+ const chat = await read("chat", () => source.chat(id4));
2699
+ const summary = await read("summary", () => source.summary(id4));
2700
+ const attachments = await read("files", () => source.files(id4));
2701
+ const listDocuments = source.documents?.bind(source);
2702
+ const documents = listDocuments ? await read("documents", () => listDocuments(id4)) : void 0;
2703
+ await saveSourceMeeting(source, store, m, { participants: sourceParticipants, transcript: lines, chat, summary, files: attachments, documents }, { accountId: options.accountId, now });
2704
+ for (const p of participants)
2705
+ if (p.identity.phone)
2706
+ callers.add(p.identity.externalId);
2707
+ report.meetings++;
2708
+ report.participants += participants.length;
2709
+ report.transcriptRows += lines?.length ?? 0;
2710
+ report.summaries += summary ? 1 : 0;
2711
+ } catch (error) {
2712
+ failedHere();
2713
+ report.warnings.push({ externalId: id4, message: error instanceof Error ? error.message : "Meeting pull failed" });
2714
+ }
2715
+ }
2716
+ await linkCallers();
2717
+ await indexSaved(store, [options.accountId], report);
2718
+ if (!failed)
2719
+ await store.setCursor(options.accountId, new Date(now).toISOString(), now);
2720
+ return report;
2721
+ }, "pull");
2722
+
2723
+ // 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/meetings/transcript-text.js
2724
+ var TranscriptTextError = class extends Error {
2725
+ static {
2726
+ __name(this, "TranscriptTextError");
2727
+ }
2728
+ name = "TranscriptTextError";
2729
+ };
2730
+ var HEADER = {
2731
+ "\u0412\u0441\u0442\u0440\u0435\u0447\u0430: ": "title",
2732
+ "\u0414\u0430\u0442\u0430: ": "date",
2733
+ "Zoom ID: ": "meetingId",
2734
+ "\u0413\u043E\u0432\u043E\u0440\u044F\u0442: ": "speakers"
2735
+ };
2736
+ var LINE = /^\[(\d{2,}):([0-5]\d):([0-5]\d)\]\s*(?:([^:\n]{1,60}):\s*)?([\s\S]*)$/;
2737
+ var RULE = /^[—–-]{10,}[^\n]*(?:\n|$)/;
2738
+ var EMPTY = /* @__PURE__ */ new Set(["", "\u2014", "-"]);
2739
+ var parseTranscriptText = /* @__PURE__ */ __name((input) => {
2740
+ const text6 = input.replace(/^/, "").replace(/\r\n?/g, "\n");
2741
+ const header = { title: null, date: null, meetingId: null, speakers: [] };
2742
+ let sawHeader = false;
2743
+ for (const line2 of text6.split("\n")) {
2744
+ if (!line2.trim())
2745
+ break;
2746
+ for (const [prefix, key] of Object.entries(HEADER)) {
2747
+ if (!line2.startsWith(prefix))
2748
+ continue;
2749
+ sawHeader = true;
2750
+ const value = line2.slice(prefix.length).trim();
2751
+ if (key === "speakers")
2752
+ header.speakers = value.split(",").map((name) => name.trim()).filter((name) => !EMPTY.has(name));
2753
+ else
2754
+ header[key] = EMPTY.has(value) ? null : value;
2755
+ }
2756
+ }
2757
+ if (!sawHeader)
2758
+ throw new TranscriptTextError('a text transcript starts with a header such as "\u0412\u0441\u0442\u0440\u0435\u0447\u0430: \u2026"');
2759
+ const found = [];
2760
+ for (const block of text6.split(/\n\s*\n/)) {
2761
+ const match = LINE.exec(block.trim().replace(RULE, ""));
2762
+ if (!match)
2763
+ continue;
2764
+ const [, hours = "0", minutes = "0", seconds = "0", speaker, said = ""] = match;
2765
+ found.push({
2766
+ startMs: ((Number(hours) * 60 + Number(minutes)) * 60 + Number(seconds)) * 1e3,
2767
+ speaker: speaker?.trim() || null,
2768
+ text: said.trim()
2769
+ });
2770
+ }
2771
+ const lines = found.map((line2, at) => ({
2772
+ ...line2,
2773
+ endMs: Math.max(line2.startMs, found[at + 1]?.startMs ?? line2.startMs)
2774
+ }));
2775
+ return { header, lines };
2776
+ }, "parseTranscriptText");
2777
+
2778
+ // 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/meetings/vtt.js
2779
+ var VttError = class extends Error {
2780
+ static {
2781
+ __name(this, "VttError");
2782
+ }
2783
+ name = "VttError";
2784
+ };
2785
+ var TIMESTAMP = /^(?:(\d+):)?([0-5]\d):([0-5]\d)\.(\d{3})$/;
2786
+ var SKIPPED = /^(NOTE|STYLE|REGION)(\s|$)/;
2787
+ var millis = /* @__PURE__ */ __name((stamp, lineNo) => {
2788
+ const match = TIMESTAMP.exec(stamp);
2789
+ if (!match)
2790
+ throw new VttError(`line ${lineNo}: "${stamp}" is not a WebVTT timestamp`);
2791
+ const [, hours = "0", minutes = "0", seconds = "0", ms2 = "0"] = match;
2792
+ return ((Number(hours) * 60 + Number(minutes)) * 60 + Number(seconds)) * 1e3 + Number(ms2);
2793
+ }, "millis");
2794
+ var splitSpeaker = /* @__PURE__ */ __name((text6) => {
2795
+ const firstLine = text6.split("\n", 1)[0] ?? "";
2796
+ const at = firstLine.indexOf(": ");
2797
+ if (at <= 0)
2798
+ return { speaker: null, text: text6 };
2799
+ return { speaker: firstLine.slice(0, at).trim(), text: text6.slice(at + 2) };
2800
+ }, "splitSpeaker");
2801
+ var parseVtt = /* @__PURE__ */ __name((input) => {
2802
+ const lines = input.replace(/^/, "").split(/\r\n|\r|\n/);
2803
+ if (!/^WEBVTT([ \t].*)?$/.test(lines[0] ?? ""))
2804
+ throw new VttError('line 1: a WebVTT file starts with "WEBVTT"');
2805
+ const cues = [];
2806
+ let i = lines.findIndex((line2) => line2.trim() === "");
2807
+ if (i < 0)
2808
+ return [];
2809
+ while (i < lines.length) {
2810
+ while (i < lines.length && lines[i]?.trim() === "")
2811
+ i++;
2812
+ const start = i;
2813
+ while (i < lines.length && lines[i]?.trim() !== "")
2814
+ i++;
2815
+ const block = lines.slice(start, i);
2816
+ if (block.length === 0 || SKIPPED.test(block[0] ?? ""))
2817
+ continue;
2818
+ const timingAt = block.findIndex((line2) => line2.includes("-->"));
2819
+ if (timingAt < 0 || timingAt > 1)
2820
+ throw new VttError(`line ${start + 1}: a cue has no timing line`);
2821
+ const lineNo = start + timingAt + 1;
2822
+ const [from = "", rest = ""] = (block[timingAt] ?? "").split("-->");
2823
+ const to = rest.trim().split(/\s+/)[0] ?? "";
2824
+ const text6 = block.slice(timingAt + 1).join("\n").trim();
2825
+ cues.push({ startMs: millis(from.trim(), lineNo), endMs: millis(to, lineNo), ...splitSpeaker(text6) });
2826
+ }
2827
+ return cues;
2828
+ }, "parseVtt");
2829
+
2830
+ // 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/meetings/import.js
2831
+ var importFiles = /* @__PURE__ */ __name(async (files, store, now = Date.now()) => {
2832
+ const report = { meetings: 0, participants: 0, transcriptRows: 0, summaries: 0, warnings: [] };
2833
+ for (const file of files) {
2834
+ try {
2835
+ const format = file.format ?? "vtt";
2836
+ const lines = format === "text" ? parseTranscriptText(file.content).lines : parseVtt(file.content);
2837
+ const participants = file.participants ?? [];
2838
+ const details = await store.saveMeeting({
2839
+ meeting: file.meeting,
2840
+ participants: file.participants,
2841
+ transcripts: [await transcriptInput(lines, participants, file.source ?? "file", file.content, format)],
2842
+ now,
2843
+ fromFile: true
2844
+ });
2845
+ await linkEvent(store, details, now);
2846
+ report.meetings++;
2847
+ report.participants += participants.length;
2848
+ report.transcriptRows += lines.length;
2849
+ } catch (error) {
2850
+ report.warnings.push({
2851
+ externalId: file.meeting.externalId,
2852
+ message: error instanceof Error ? error.message : "Meeting import failed"
2853
+ });
2854
+ }
2855
+ }
2856
+ await indexSaved(store, files.map((file) => file.meeting.accountId), report);
2857
+ const zones = new Set(files.map((file) => file.meeting.timezone).filter((zone2) => zone2 !== null && zone2 !== void 0));
2858
+ const [zone] = zones;
2859
+ if (zones.size === 1 && zone)
2860
+ report.timezone = zone;
2861
+ return report;
2862
+ }, "importFiles");
2863
+
2864
+ // 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/meetings/links.js
2865
+ var CHAT_MESSAGES_READ = 1e5;
2866
+
2867
+ // 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/meetings/meeting-management.js
2868
+ var MEETING_FIELD_KEYS = Object.freeze({
2869
+ title: "title",
2870
+ kind: "kind",
2871
+ startTime: "start_time",
2872
+ durationMinutes: "duration_minutes",
2873
+ timezone: "timezone",
2874
+ agenda: "agenda"
2875
+ });
2876
+ var MEETING_FIELDS2 = Object.freeze(Object.keys(MEETING_FIELD_KEYS));
2877
+ var meetingFieldFlag = /* @__PURE__ */ __name((field) => `--${MEETING_FIELD_KEYS[field].replaceAll("_", "-")}`, "meetingFieldFlag");
2878
+ var SNAKE_CASE2 = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/;
2879
+
2880
+ // 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/meetings/passage.js
2881
+ var meetingHitContextLimits = /* @__PURE__ */ __name((options = {}) => {
2882
+ const { before = 3, after = 3, bytes = 65536, max_read_bytes = 4194304, expected_fingerprint } = options;
2883
+ if (![before, after].every((value) => Number.isSafeInteger(value) && value >= 0) || before + after > 999 || !Number.isSafeInteger(bytes) || bytes < 2 || bytes > 4194304 || !Number.isSafeInteger(max_read_bytes) || max_read_bytes < 1 || max_read_bytes > 67108864 || expected_fingerprint !== void 0 && (typeof expected_fingerprint !== "string" || !/^[a-f0-9]{64}$/.test(expected_fingerprint)))
2884
+ throw new CliError("validation_error", "context takes 0\u2013999 surrounding cues, 2\u20134194304 output bytes and a bounded read budget");
2885
+ return { before, after, bytes, max_read_bytes };
2886
+ }, "meetingHitContextLimits");
2887
+ var MEETING_CUE_UNTRUSTED = ["speaker_name", "text"];
2888
+ var markedPassage = /* @__PURE__ */ __name((result) => ({
2889
+ ...result,
2890
+ packet: {
2891
+ ...result.packet,
2892
+ items: result.packet.items.map((cue2) => ({ ...cue2, untrusted: [...MEETING_CUE_UNTRUSTED] }))
2893
+ }
2894
+ }), "markedPassage");
2895
+ var validateMeetingPassage = /* @__PURE__ */ __name((reference2, options) => {
2896
+ meetingHitContextLimits(options);
2897
+ if (typeof reference2 !== "string" || !reference2.trim() || reference2.length > 200 || options.format !== void 0 && !["json", "text", "markdown"].includes(options.format))
2898
+ throw new CliError("validation_error", "choose a cue reference and json, text or markdown output");
2899
+ }, "validateMeetingPassage");
2900
+
2901
+ // 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/meetings/preparation-context.js
2902
+ var validateMeetingPreparationContext = /* @__PURE__ */ __name((original) => {
2903
+ if (!original || typeof original !== "object" || Array.isArray(original))
2904
+ throw new CliError("validation_error", "meeting preparation context is required");
2905
+ const input = { ...original };
2906
+ for (const key of Object.keys(input))
2907
+ if (!["accountId", "meetingId", "seriesId", "updatedAt", "limit", "maxReadBytes", "signal"].includes(key))
2908
+ throw new CliError("validation_error", `unknown preparation context field: ${key}`);
2909
+ if (input.signal !== void 0 && !(input.signal instanceof AbortSignal))
2910
+ throw new CliError("validation_error", "signal must be an AbortSignal");
2911
+ input.signal?.throwIfAborted();
2912
+ for (const key of ["accountId", "meetingId", "seriesId"])
2913
+ if (!Number.isSafeInteger(input[key]) || input[key] <= 0)
2914
+ throw new CliError("validation_error", `${key} must be a positive safe integer`);
2915
+ if (!Number.isSafeInteger(input.updatedAt) || Math.abs(input.updatedAt) > 864e13)
2916
+ throw new CliError("validation_error", "updatedAt must be an absolute timestamp");
2917
+ const limit = input.limit === void 0 ? 20 : input.limit;
2918
+ const maxReadBytes = input.maxReadBytes === void 0 ? 262144 : input.maxReadBytes;
2919
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
2920
+ throw new CliError("validation_error", "limit must be an integer from 1 to 100");
2921
+ if (!Number.isSafeInteger(maxReadBytes) || maxReadBytes < 1 || maxReadBytes > 4194304)
2922
+ throw new CliError("validation_error", "maxReadBytes must be an integer from 1 to 4194304");
2923
+ return { ...input, limit, maxReadBytes };
2924
+ }, "validateMeetingPreparationContext");
2925
+
2926
+ // 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/meetings/project-evidence-answer.js
2927
+ var count4 = pipe(number(), integer(), minValue(0));
2928
+ var id2 = pipe(string(), minLength(1));
2929
+ var meetingProjectEvidence = strictObject({
2930
+ schema_version: literal(1),
2931
+ kind: literal("meeting_project_evidence"),
2932
+ account_id: id2,
2933
+ query: string(),
2934
+ project: strictObject({ id: id2, name: string(), key: nullable(string()) }),
2935
+ term: strictObject({
2936
+ name: string(),
2937
+ kind: picklist(["canonical", "key", "alias"]),
2938
+ alias_id: optional(id2)
2939
+ }),
2940
+ hits: array(meetingHit),
2941
+ association: literal("unconfirmed-word-evidence"),
2942
+ vocabulary_fingerprint: id2,
2943
+ selection: strictObject({
2944
+ meeting_id: optional(id2),
2945
+ identity_id: optional(id2),
2946
+ person_id: optional(id2),
2947
+ tag_id: optional(id2),
2948
+ event_id: optional(id2),
2949
+ series_id: optional(id2),
2950
+ since: optional(isoTime),
2951
+ until: optional(isoTime)
2952
+ }),
2953
+ limits: strictObject({ limit: count4, max_read_bytes: count4, max_vocabulary_read_bytes: count4, max_terms: count4 }),
2954
+ page: pageSchema,
2955
+ coverage: strictObject({
2956
+ archive_completeness: literal("unknown"),
2957
+ current_revisions: literal(true),
2958
+ indexing: picklist(["ready", "pending"]),
2959
+ index_completeness: literal("unknown"),
2960
+ term_index: count4,
2961
+ terms_total: count4,
2962
+ remaining_terms: count4,
2963
+ duplicates: literal("may-repeat-between-terms")
2964
+ })
2965
+ });
2966
+ var PAGE_NEXT3 = STEPS.find((step) => step.id === "page.next");
2967
+ var meetingProjectEvidenceAnswer = /* @__PURE__ */ __name((page, prepared, command = "meetings projects evidence") => {
2968
+ const { options } = prepared;
2969
+ const selection = {};
2970
+ for (const [field, value] of [
2971
+ ["meeting_id", options.meetingId],
2972
+ ["identity_id", options.participantIdentityId],
2973
+ ["person_id", options.personId],
2974
+ ["tag_id", options.tagId],
2975
+ ["event_id", options.eventId],
2976
+ ["series_id", options.meetingSeriesId]
2977
+ ])
2978
+ if (value !== void 0)
2979
+ selection[field] = String(value);
2980
+ if (options.since !== void 0)
2981
+ selection.since = new Date(options.since).toISOString();
2982
+ if (options.until !== void 0)
2983
+ selection.until = new Date(options.until).toISOString();
2984
+ const cursor = page.nextCursor ?? void 0;
2985
+ if (page.hasMore !== (cursor !== void 0))
2986
+ throw new CliError("invalid_response", "project evidence continuation is inconsistent");
2987
+ const item = {
2988
+ schema_version: 1,
2989
+ kind: "meeting_project_evidence",
2990
+ account_id: String(page.accountId),
2991
+ query: page.query,
2992
+ project: page.project,
2993
+ term: {
2994
+ name: page.term.name,
2995
+ kind: page.term.kind,
2996
+ ...page.term.aliasId === void 0 ? {} : { alias_id: page.term.aliasId }
2997
+ },
2998
+ hits: page.items.map(meetingHitItem),
2999
+ association: page.association,
3000
+ vocabulary_fingerprint: page.vocabularyFingerprint,
3001
+ selection,
3002
+ limits: {
3003
+ limit: page.limits.limit,
3004
+ max_read_bytes: page.limits.maxReadBytes,
3005
+ max_vocabulary_read_bytes: page.limits.maxVocabularyReadBytes,
3006
+ max_terms: page.limits.maxTerms
3007
+ },
3008
+ page: {
3009
+ mode: "cursor",
3010
+ limit: page.limits.limit,
3011
+ has_more: page.hasMore,
3012
+ ...cursor === void 0 ? {} : { next_cursor: cursor }
3013
+ },
3014
+ coverage: {
3015
+ archive_completeness: page.coverage.archiveCompleteness,
3016
+ current_revisions: page.coverage.currentRevisions,
3017
+ indexing: page.coverage.indexing,
3018
+ index_completeness: page.coverage.indexCompleteness,
3019
+ term_index: page.coverage.termIndex,
3020
+ terms_total: page.coverage.termsTotal,
3021
+ remaining_terms: page.coverage.remainingTerms,
3022
+ duplicates: page.coverage.duplicates
3023
+ }
3024
+ };
3025
+ if (!safeParse(meetingProjectEvidence, item).success)
3026
+ throw new CliError("invalid_response", "project evidence does not match its answer contract");
3027
+ return {
3028
+ item,
3029
+ ...cursor === void 0 ? {} : {
3030
+ next: [
3031
+ stepOf(PAGE_NEXT3, {
3032
+ command,
3033
+ args: {
3034
+ project: prepared.project,
3035
+ query: prepared.query,
3036
+ cursor,
3037
+ limit: page.limits.limit,
3038
+ max_read_bytes: page.limits.maxReadBytes
3039
+ },
3040
+ values: { shown: page.items.length }
3041
+ })
3042
+ ]
3043
+ }
3044
+ };
3045
+ }, "meetingProjectEvidenceAnswer");
3046
+
3047
+ // 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/meetings/search-validation.js
3048
+ var validateMeetingHitSearch = /* @__PURE__ */ __name((query, options = {}) => {
3049
+ const integer3 = /* @__PURE__ */ __name((value, low, high) => Number.isSafeInteger(value) && value >= low && value <= high, "integer");
3050
+ if (typeof query !== "string" || !query.trim() || query.includes("\0") || new TextEncoder().encode(query).byteLength > 65536 || !integer3(options.limit ?? 100, 1, 1e3) || !integer3(options.maxReadBytes ?? 4194304, 1, 67108864) || [
3051
+ options.meetingId,
3052
+ options.participantIdentityId,
3053
+ options.personId,
3054
+ options.projectId,
3055
+ options.tagId,
3056
+ options.eventId,
3057
+ options.meetingSeriesId
3058
+ ].some((value) => value !== void 0 && !integer3(value, 1, Number.MAX_SAFE_INTEGER)) || [options.since, options.until].some((value) => value !== void 0 && !integer3(value, -864e13, 864e13)) || options.since !== void 0 && options.until !== void 0 && options.since > options.until || options.after !== void 0 && (typeof options.after !== "string" || !/^[A-Za-z0-9_-]{1,1000}$/.test(options.after)))
3059
+ throw new CliError("validation_error", "invalid bounded meeting search query, cursor or limits");
3060
+ for (const name of [options.project, options.tag, options.topic])
3061
+ if (name !== void 0 && (typeof name !== "string" || !name.trim() || name.length > 200 || /[\p{Cc}\p{Cf}]/u.test(name)))
3062
+ throw new CliError("validation_error", "a meeting vocabulary name takes 1\u2013200 characters without control characters");
3063
+ if (options.project !== void 0 && options.projectId !== void 0 || [options.tag, options.topic, options.tagId].filter((value) => value !== void 0).length > 1)
3064
+ throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
3065
+ }, "validateMeetingHitSearch");
3066
+
3067
+ // 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/meetings/project-evidence-query.js
3068
+ var ids = {
3069
+ meeting_id: "meetingId",
3070
+ identity_id: "participantIdentityId",
3071
+ person_id: "personId",
3072
+ tag_id: "tagId",
3073
+ event_id: "eventId",
3074
+ series_id: "meetingSeriesId"
3075
+ };
3076
+ var context2 = {
3077
+ command: "meetings projects evidence",
3078
+ guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md"
3079
+ };
3080
+ var MEETING_PROJECT_EVIDENCE_QUERY = defineQuery({
3081
+ entity: "meeting_project_evidence",
3082
+ backend: "sql",
3083
+ fields: [
3084
+ ...Object.keys(ids).map((name) => ({
3085
+ name,
3086
+ type: "num",
3087
+ operators: ["term"],
3088
+ example: `${name}:12`,
3089
+ placement: "and",
3090
+ relation: "meetings selected by this stored ID; identity selects participants, not speakers"
3091
+ })),
3092
+ {
3093
+ name: "started_at",
3094
+ type: "time",
3095
+ operators: ["term", "phrase", "range"],
3096
+ example: "started_at:[2026-10-01 TO 2026-10-31]",
3097
+ placement: "and",
3098
+ relation: "the meeting start time in UTC"
3099
+ }
3100
+ ]
3101
+ });
3102
+ var requestKeys = /* @__PURE__ */ new Set(["query", "limit", "cursor", "maxReadBytes", "signal"]);
3103
+ var prepareMeetingProjectEvidence = /* @__PURE__ */ __name((project, request = {}, now = Date.now()) => {
3104
+ if (!request || typeof request !== "object" || Array.isArray(request) || Object.keys(request).some((key) => !requestKeys.has(key)) || typeof project !== "string" || !project.trim() || project.length > 200 || /[\p{Cc}\p{Cf}]/u.test(project) || request.query !== void 0 && typeof request.query !== "string")
3105
+ throw new CliError("validation_error", "expected an existing project and bounded evidence arguments");
3106
+ if (request.query !== void 0 && new TextEncoder().encode(request.query).byteLength > 8192 || [request.limit, request.maxReadBytes].some((value) => value !== void 0 && typeof value !== "number"))
3107
+ throw new CliError("validation_error", "invalid project evidence query or budget");
3108
+ request.signal?.throwIfAborted();
3109
+ const options = {
3110
+ limit: request.limit ?? 100,
3111
+ maxReadBytes: request.maxReadBytes ?? 4194304,
3112
+ ...request.cursor === void 0 ? {} : { cursor: request.cursor },
3113
+ ...request.signal === void 0 ? {} : { signal: request.signal }
3114
+ };
3115
+ const terms = /* @__PURE__ */ new Map();
3116
+ if (request.query?.trim()) {
3117
+ const ast = parseLucene(request.query, { defaultField: "none", ...context2 });
3118
+ validateQuery(ast, MEETING_PROJECT_EVIDENCE_QUERY, context2);
3119
+ const add = /* @__PURE__ */ __name((node) => {
3120
+ if (terms.has(node.field))
3121
+ queryError("query.unsupported-placement", node.span, "each field only once", context2);
3122
+ terms.set(node.field, node);
3123
+ }, "add");
3124
+ if (ast.root.kind === "predicate")
3125
+ add(ast.root);
3126
+ else
3127
+ for (const clause of ast.root.clauses) {
3128
+ if (clause.occur !== "must" || clause.node.kind !== "predicate")
3129
+ queryError("query.unsupported-placement", clause.node.span, "field:value terms joined by AND", context2);
3130
+ add(clause.node);
3131
+ }
3132
+ }
3133
+ const frozen = [];
3134
+ for (const [field, key] of Object.entries(ids)) {
3135
+ const term2 = terms.get(field);
3136
+ if (!term2)
3137
+ continue;
3138
+ if (term2.operator !== "term" || !/^[1-9]\d*$/.test(term2.value) || !Number.isSafeInteger(Number(term2.value)))
3139
+ queryError("query.unsupported-operator", term2.span, "one positive safe integer ID", context2);
3140
+ options[key] = Number(term2.value);
3141
+ frozen.push(`${field}:${term2.value}`);
3142
+ }
3143
+ const term = terms.get("started_at");
3144
+ if (term) {
3145
+ const range = dateRange(term.value, term.operator === "range" ? term.upper ?? "*" : term.value, term.lower_inclusive !== false, term.upper_inclusive !== false, "UTC", term.span, now);
3146
+ if (range.lower !== void 0)
3147
+ options.since = range.lower + (range.lower_inclusive ? 0 : 1);
3148
+ if (range.upper !== void 0)
3149
+ options.until = range.upper - (range.upper_inclusive ? 0 : 1);
3150
+ frozen.push(`started_at:[${options.since === void 0 ? "*" : `"${new Date(options.since).toISOString()}"`} TO ${options.until === void 0 ? "*" : `"${new Date(options.until).toISOString()}"`}]`);
3151
+ }
3152
+ validateMeetingHitSearch(project, options);
3153
+ if (options.cursor !== void 0 && (typeof options.cursor !== "string" || !/^[A-Za-z0-9_-]{1,4096}$/.test(options.cursor)))
3154
+ throw new CliError("validation_error", "invalid project evidence cursor");
3155
+ return { project: project.trim(), options, query: frozen.join(" AND ") };
3156
+ }, "prepareMeetingProjectEvidence");
3157
+
3158
+ // 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/meetings/project-evidence.js
3159
+ var readMeetingProjectEvidence = /* @__PURE__ */ __name(async (read, project, request = {}, now = Date.now()) => {
3160
+ const prepared = prepareMeetingProjectEvidence(project, request, now);
3161
+ const page = await read(prepared.project, prepared.options);
3162
+ prepared.options.signal?.throwIfAborted();
3163
+ return meetingProjectEvidenceAnswer(page, prepared);
3164
+ }, "readMeetingProjectEvidence");
3165
+
3166
+ // 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/meetings/read-answers.js
3167
+ var text3 = string();
3168
+ var count5 = pipe(number(), integer(), minValue(0));
3169
+ var id3 = pipe(number(), integer(), minValue(1));
3170
+ var iso3 = /* @__PURE__ */ __name((ms2) => ms2 === null ? null : new Date(ms2).toISOString(), "iso");
3171
+ var meetingReview = strictObject({
3172
+ ref: reference,
3173
+ id: pipe(string(), minLength(1)),
3174
+ title: nullable(text3),
3175
+ started_at: nullable(isoTime),
3176
+ duration_ms: nullable(count5),
3177
+ participants_count: nullable(count5),
3178
+ projects: array(text3),
3179
+ /** Null when the meeting has no current transcript. */
3180
+ transcript: nullable(strictObject({ lines: count5, words: count5 })),
3181
+ /** The three who talked longest. */
3182
+ speakers: array(strictObject({ name: nullable(text3), talk_ms: count5 })),
3183
+ /** The newest stored summary; null when there is none. */
3184
+ summary: nullable(strictObject({
3185
+ source: text3,
3186
+ title: nullable(text3),
3187
+ overview: nullable(text3),
3188
+ next_steps: array(text3),
3189
+ url: nullable(text3)
3190
+ }))
3191
+ });
3192
+ var meetingLink = strictObject({
3193
+ url: text3,
3194
+ domain: nullable(text3),
3195
+ /** The Google Docs, Sheets, Slides, Forms or Drive file it names. */
3196
+ document_id: nullable(text3),
3197
+ count: count5,
3198
+ first_at: isoTime,
3199
+ last_at: isoTime,
3200
+ senders: array(text3),
3201
+ meetings: array(strictObject({ ref: reference, title: nullable(text3) }))
3202
+ });
3203
+ var meetingSpeaker = strictObject({
3204
+ /** `person:<id>`, `identity:<id>`, `name:<lowercased name>` or `unknown`. */
3205
+ key: text3,
3206
+ name: nullable(text3),
3207
+ person_id: nullable(id3),
3208
+ identity_id: nullable(id3),
3209
+ meetings: count5,
3210
+ lines: count5,
3211
+ words: count5,
3212
+ talk_ms: count5,
3213
+ /** This speaker's part of all talk time, 0–1. */
3214
+ share: pipe(number(), minValue(0), maxValue(1))
3215
+ });
3216
+ var meetingStats = strictObject({
3217
+ time_zone: text3,
3218
+ meetings: count5,
3219
+ lines: count5,
3220
+ words: count5,
3221
+ talk_ms: count5,
3222
+ /** `week_start` is the Monday, as a date in `time_zone`. */
3223
+ weeks: array(strictObject({ week_start: text3, meetings: count5, talk_ms: count5 })),
3224
+ top_speakers: array(meetingSpeaker)
3225
+ });
3226
+ var meetingCountsRow = strictObject({
3227
+ key: text3,
3228
+ name: nullable(text3),
3229
+ meetings: count5,
3230
+ minutes: count5,
3231
+ mean_minutes: nullable(number()),
3232
+ transcripts: count5
3233
+ });
3234
+ var meetingCounts = strictObject({
3235
+ by: picklist(["day", "week", "series"]),
3236
+ meetings: count5,
3237
+ minutes: count5,
3238
+ mean_minutes: nullable(number()),
3239
+ transcripts: count5,
3240
+ rows: array(meetingCountsRow),
3241
+ has_more: boolean()
3242
+ });
3243
+ var truncated = /* @__PURE__ */ __name((...why) => nullable(picklist(why)), "truncated");
3244
+ var meetingParticipants = strictObject({
3245
+ schema_version: literal(1),
3246
+ kind: literal("meeting_participants"),
3247
+ account_id: id3,
3248
+ query: text3,
3249
+ items: array(strictObject({
3250
+ participant_id: id3,
3251
+ meeting_id: id3,
3252
+ identity_id: id3,
3253
+ display_name: nullable(text3),
3254
+ email: nullable(text3),
3255
+ person: nullable(strictObject({ ref: text3, name: nullable(text3) })),
3256
+ untrusted: optional(array(text3))
3257
+ })),
3258
+ /** Several identities on one page are observations, never speaker attribution or person links. */
3259
+ ambiguity: strictObject({ scope: literal("page"), multiple_identities: boolean(), identity_ids: array(id3) }),
3260
+ coverage: strictObject({
3261
+ scanned: count5,
3262
+ read_bytes: count5,
3263
+ archive_completeness: literal("unknown"),
3264
+ truncated_by: truncated("limit", "scan_limit", "read_bytes")
3265
+ }),
3266
+ page: strictObject({
3267
+ mode: literal("cursor"),
3268
+ limit: count5,
3269
+ has_more: boolean(),
3270
+ next_cursor: optional(text3)
3271
+ })
3272
+ });
3273
+ var revision = picklist(["current", "superseded"]);
3274
+ var meetingPassage = strictObject({
3275
+ schema_version: literal(1),
3276
+ kind: literal("meeting_context"),
3277
+ source: reference,
3278
+ target_ref: reference,
3279
+ target_fingerprint: text3,
3280
+ fingerprint: text3,
3281
+ revision,
3282
+ limits: strictObject({ before: count5, after: count5, bytes: count5, max_read_bytes: count5 }),
3283
+ content_bytes: count5,
3284
+ coverage: strictObject({
3285
+ included: count5,
3286
+ before: count5,
3287
+ after: count5,
3288
+ has_before: boolean(),
3289
+ has_after: boolean(),
3290
+ truncated_by: truncated("bytes"),
3291
+ before_ref: nullable(reference),
3292
+ after_ref: nullable(reference),
3293
+ continuation: literal("anchor-inclusive"),
3294
+ archive_completeness: literal("unknown"),
3295
+ input: literal("bounded-meeting-context")
3296
+ }),
3297
+ items: array(strictObject({
3298
+ ref: reference,
3299
+ fingerprint: text3,
3300
+ transcript_id: id3,
3301
+ content_hash: nullable(text3),
3302
+ position: count5,
3303
+ start_ms: count5,
3304
+ end_ms: count5,
3305
+ speaker_participant_id: nullable(id3),
3306
+ speaker_name: nullable(text3),
3307
+ text: text3,
3308
+ revision,
3309
+ /** What people said: `speaker_name` and `text`. */
3310
+ untrusted: optional(array(text3))
3311
+ }))
3312
+ });
3313
+ var event = strictObject({
3314
+ id: pipe(string(), minLength(1)),
3315
+ event_series_id: nullable(text3),
3316
+ title: nullable(text3),
3317
+ description: nullable(text3),
3318
+ location: nullable(text3),
3319
+ starts_at: nullable(isoTime),
3320
+ ends_at: nullable(isoTime),
3321
+ timezone: nullable(text3),
3322
+ /** `auto`: made from a meeting; `owner`: made by hand; `calendar`: from a calendar's entries. */
3323
+ origin: picklist(["auto", "owner", "calendar"]),
3324
+ status: nullable(text3),
3325
+ all_day: boolean(),
3326
+ /** When its calendar deleted it: shown as "deleted in Google", kept as history. */
3327
+ source_deleted_at: nullable(isoTime),
3328
+ deleted_at: nullable(isoTime),
3329
+ created_at: isoTime,
3330
+ updated_at: isoTime,
3331
+ /** The fields whoever sent the invitation wrote, on a calendar CLI's `events list`: an agent reads them as data. */
3332
+ untrusted: optional(array(text3)),
3333
+ /** On a calendar CLI's `events list changed:<date>`: what changed since then, and when the store saw it. */
3334
+ change: optional(picklist(["new", "moved", "cancelled"])),
3335
+ changed_at: optional(nullable(isoTime)),
3336
+ /** The times a moved event had at that date. */
3337
+ was: optional(strictObject({ starts_at: nullable(isoTime), ends_at: nullable(isoTime) })),
3338
+ /**
3339
+ * Whether its time overlaps another event's, in the accounts read: a timed event, not cancelled, not declined, not
3340
+ * free and no working-location block. On a calendar CLI's `events list` when the query names it.
3341
+ */
3342
+ overlapping: optional(boolean()),
3343
+ /** With `overlapping:true`: the events it overlaps, as `event:<id>`. */
3344
+ overlaps: optional(array(text3))
3345
+ });
3346
+ var eventItem = /* @__PURE__ */ __name((one) => ({
3347
+ id: String(one.id),
3348
+ event_series_id: one.eventSeriesId === null ? null : String(one.eventSeriesId),
3349
+ title: one.title,
3350
+ description: one.description,
3351
+ location: one.location,
3352
+ starts_at: iso3(one.startsAt),
3353
+ ends_at: iso3(one.endsAt),
3354
+ timezone: one.timezone,
3355
+ origin: one.origin,
3356
+ status: one.status ?? null,
3357
+ all_day: one.allDay === true,
3358
+ source_deleted_at: iso3(one.sourceDeletedAt ?? null),
3359
+ deleted_at: iso3(one.deletedAt),
3360
+ created_at: new Date(one.createdAt).toISOString(),
3361
+ updated_at: new Date(one.updatedAt).toISOString()
3362
+ }), "eventItem");
3363
+
3364
+ // 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/meetings/read-through.js
3365
+ var MEETING_SERVER_BOUNDS = { calls: 3, pages: 2 };
3366
+ var ISSUES = {
3367
+ offline: ["permission_error", "meetings.server-offline"],
3368
+ unreachable: ["network_error", "meetings.server-unreachable"],
3369
+ not_signed_in: ["authentication_error", "meetings.server-signed-out"],
3370
+ refused: ["permission_error", "meetings.server-refused"],
3371
+ rate_limited: ["rate_limited", "meetings.server-rate-limited"],
3372
+ failed: ["provider_error", "meetings.server-failed"]
3373
+ };
3374
+ var metaOf = /* @__PURE__ */ __name((reason, provider) => {
3375
+ const issue = ISSUES[reason];
3376
+ return issue && { complete: false, issues: [{ code: issue[0], reason: issue[1], source: provider }] };
3377
+ }, "metaOf");
3378
+ var WHY = {
3379
+ unsupported: /* @__PURE__ */ __name((provider) => `${provider} cannot be asked for meetings here \u2014 the answer is the store's`, "unsupported"),
3380
+ offline: /* @__PURE__ */ __name(() => "--offline: the service was not asked \u2014 the answer is the store's", "offline"),
3381
+ unreachable: /* @__PURE__ */ __name((provider) => `${provider} could not be reached \u2014 the answer is the store's`, "unreachable"),
3382
+ not_signed_in: /* @__PURE__ */ __name((provider) => `not signed in to ${provider} \u2014 the answer is the store's`, "not_signed_in"),
3383
+ refused: /* @__PURE__ */ __name((provider) => `${provider} refused the request \u2014 the answer is the store's`, "refused"),
3384
+ rate_limited: /* @__PURE__ */ __name((provider) => `${provider} asked to wait before more requests \u2014 the answer is the store's`, "rate_limited"),
3385
+ failed: /* @__PURE__ */ __name((provider) => `${provider} could not be read \u2014 the answer is the store's`, "failed"),
3386
+ no_upcoming: /* @__PURE__ */ __name((provider) => `${provider} lists no meeting before it starts \u2014 upcoming ones are not in the answer`, "no_upcoming")
3387
+ };
3388
+ var reasonOf = /* @__PURE__ */ __name((error) => {
3389
+ const code = error instanceof CliError ? error.code : void 0;
3390
+ if (code === "authentication_error")
3391
+ return "not_signed_in";
3392
+ if (code === "permission_error")
3393
+ return "refused";
3394
+ if (code === "network_error")
3395
+ return "unreachable";
3396
+ if (code === "rate_limited")
3397
+ return "rate_limited";
3398
+ return "failed";
3399
+ }, "reasonOf");
3400
+ var refusal = /* @__PURE__ */ __name((reason, provider, error) => error ?? new CliError("validation_error", `--backend server: ${WHY[reason](provider).replace(/ — .*$/, "")}; use --backend archive or both`, { reason }), "refusal");
3401
+ var within = /* @__PURE__ */ __name((one, other) => {
3402
+ const from = Math.max(one.from ?? -Infinity, other.from ?? -Infinity);
3403
+ const to = Math.min(one.to ?? Infinity, other.to ?? Infinity);
3404
+ if (from > to)
3405
+ return void 0;
3406
+ return { ...Number.isFinite(from) ? { from } : {}, ...Number.isFinite(to) ? { to } : {} };
3407
+ }, "within");
3408
+ var findsOf = /* @__PURE__ */ __name((source, zone, now) => ({
3409
+ fields: { ...source.finds.fields, started_at: ["term", "range"] },
3410
+ negatable: source.finds.negatable?.filter((field) => field !== "started_at") ?? [],
3411
+ maxCalls: MEETING_SERVER_BOUNDS.calls,
3412
+ all: { window: {}, terms: [] },
3413
+ leaf: /* @__PURE__ */ __name((predicate, negated) => predicate.field === "started_at" ? { window: windowOf(rangeOf(predicate, zone, now)), terms: [] } : { window: {}, terms: [{ predicate, negated }] }, "leaf"),
3414
+ both: /* @__PURE__ */ __name((one, other) => {
3415
+ const window = within(one.window, other.window);
3416
+ return window && { window, terms: [...one.terms, ...other.terms] };
3417
+ }, "both")
3418
+ }), "findsOf");
3419
+ var reachesFuture = /* @__PURE__ */ __name(({ to }, now) => to === void 0 || to > now, "reachesFuture");
3420
+ var storedByExternalId = /* @__PURE__ */ __name(async (store, accountId, externalId) => {
3421
+ if (store.meetingByExternalId)
3422
+ return store.meetingByExternalId(accountId, externalId);
3423
+ const span = { start: 0, end: 0 };
3424
+ const query = {
3425
+ version: 1,
3426
+ language: "lucene-v1",
3427
+ root: { kind: "predicate", field: "provider_id", operator: "term", value: externalId, span }
3428
+ };
3429
+ const [row] = await store.meetings({ accountId, query, includeDeleted: true, limit: 1 });
3430
+ return row ? store.meeting(row.id) : null;
3431
+ }, "storedByExternalId");
3432
+ var peopleKey = /* @__PURE__ */ __name((people) => JSON.stringify(people.map(({ email, displayName }) => [email ?? "", displayName ?? ""]).sort()), "peopleKey");
3433
+ var unchanged = /* @__PURE__ */ __name((found, stored, accountId) => {
3434
+ const participants = found.participants;
3435
+ const input = sourceMeetingInput(found.meeting, accountId, participants === void 0 ? void 0 : participants?.length ?? null, stored.meeting);
3436
+ const row = stored.meeting;
3437
+ return row.deletedAt === null && input.title === row.title && input.description === row.description && input.location === row.location && input.joinUrl === row.joinUrl && input.startedAt === row.startedAt && input.endedAt === row.endedAt && input.timezone === row.timezone && JSON.stringify(input.metadata ?? null) === JSON.stringify(row.metadata ?? null) && (input.series === void 0 || input.series.externalId === stored.series?.externalId && input.series.title === stored.series.title) && (participants == null || row.participantsCount === participants.length && peopleKey(participants) === peopleKey(stored.participants));
3438
+ }, "unchanged");
3439
+ var stepFor = /* @__PURE__ */ __name((backend) => ({
3440
+ report: {
3441
+ backend: backend === "server" ? "server" : "both",
3442
+ skipped: null,
3443
+ calls: 0,
3444
+ returned: 0,
3445
+ new: 0,
3446
+ failed: 0,
3447
+ complete: true
3448
+ },
3449
+ found: /* @__PURE__ */ new Map(),
3450
+ missing: []
3451
+ }), "stepFor");
3452
+ var keep = /* @__PURE__ */ __name(async (source, store, accountId, now, step, found, parts, fresh = false) => {
3453
+ const stored = await storedByExternalId(store, accountId, found.meeting.occurrence.id);
3454
+ const details = stored && !fresh && unchanged(found, stored, accountId) ? stored : await saveSourceMeeting(source, store, found.meeting, parts, {
3455
+ accountId,
3456
+ now,
3457
+ ...stored ? { kept: stored.meeting } : {}
3458
+ });
3459
+ step.found.set(details.meeting.id, stored ? "both" : "server");
3460
+ step.report.returned += 1;
3461
+ if (!stored)
3462
+ step.report.new += 1;
3463
+ return details;
3464
+ }, "keep");
3465
+ var askServerForList = /* @__PURE__ */ __name(async (source, store, accountId, query, access) => {
3466
+ const backend = access.backend ?? "both";
3467
+ if (backend === "archive")
3468
+ return void 0;
3469
+ const step = stepFor(backend);
3470
+ const provider = source?.name ?? "the service";
3471
+ const skip = /* @__PURE__ */ __name((reason, error) => {
3472
+ if (backend === "server")
3473
+ throw refusal(reason, provider, error);
3474
+ step.report.skipped = reason;
3475
+ step.report.complete = false;
3476
+ step.missing.push({ field: "server", why: WHY[reason](provider) });
3477
+ const meta = metaOf(reason, provider);
3478
+ if (meta)
3479
+ step.meta = meta;
3480
+ return step;
3481
+ }, "skip");
3482
+ if (!source?.find || !source.finds)
3483
+ return skip("unsupported");
3484
+ if (access.offline)
3485
+ return skip("offline");
3486
+ const now = access.now ?? Date.now();
3487
+ const finds = source.finds;
3488
+ const capability = findsOf({ ...source, finds }, timezoneOf(access.timezone), now);
3489
+ const { calls, complete } = query ? serviceCallsOf(query.root, capability) : { calls: [capability.all], complete: true };
3490
+ let capped = !complete;
3491
+ let asked = calls;
3492
+ if (finds.upcoming === false) {
3493
+ if (calls.some(({ window }) => reachesFuture(window, now)))
3494
+ step.missing.push({ field: "upcoming", why: WHY.no_upcoming(provider) });
3495
+ asked = calls.flatMap((call) => {
3496
+ const window = within(call.window, { to: now });
3497
+ return window ? [{ ...call, window }] : [];
3498
+ });
3499
+ if (!asked.length)
3500
+ return skip("no_upcoming");
3501
+ }
3502
+ const seen = /* @__PURE__ */ new Set();
3503
+ let failure;
3504
+ for (const call of asked) {
3505
+ let cursor = null;
3506
+ for (let page = 0; page < MEETING_SERVER_BOUNDS.pages; page++) {
3507
+ access.signal?.throwIfAborted();
3508
+ step.report.calls += 1;
3509
+ let answer;
3510
+ try {
3511
+ answer = await source.find(call.window, call.terms, cursor, access.signal);
3512
+ } catch (error) {
3513
+ access.signal?.throwIfAborted();
3514
+ return skip(reasonOf(error), error);
3515
+ }
3516
+ for (const found of answer.meetings) {
3517
+ access.signal?.throwIfAborted();
3518
+ if (seen.has(found.meeting.occurrence.id))
3519
+ continue;
3520
+ seen.add(found.meeting.occurrence.id);
3521
+ try {
3522
+ await keep(source, store, accountId, now, step, found, { participants: found.participants });
3523
+ } catch (error) {
3524
+ step.report.failed += 1;
3525
+ failure ??= error;
3526
+ }
3527
+ }
3528
+ cursor = answer.next;
3529
+ if (cursor === null)
3530
+ break;
3531
+ if (page === MEETING_SERVER_BOUNDS.pages - 1)
3532
+ capped = true;
3533
+ }
3534
+ }
3535
+ const issues = [];
3536
+ if (step.report.failed) {
3537
+ issues.push({
3538
+ code: failure instanceof CliError ? failure.code : "provider_error",
3539
+ reason: "meetings.server-failed",
3540
+ source: provider
3541
+ });
3542
+ const why = failure instanceof Error ? `: ${failure.message}` : "";
3543
+ step.missing.push({
3544
+ field: "server",
3545
+ why: `${step.report.failed} meeting(s) ${provider} returned could not be kept${why} \u2014 the answer is without them`
3546
+ });
3547
+ }
3548
+ if (capped) {
3549
+ issues.push({ code: "outcome_unknown", reason: "meetings.server-capped", source: provider });
3550
+ const { calls: calls2, returned } = step.report;
3551
+ step.missing.push({
3552
+ field: "server",
3553
+ why: `${provider} was asked ${calls2} time(s) and returned ${returned} meeting(s), not every one that may match \u2014 narrow the query by started_at`
3554
+ });
3555
+ }
3556
+ if (issues.length) {
3557
+ step.report.complete = false;
3558
+ step.meta = { complete: false, issues };
3559
+ }
3560
+ return step;
3561
+ }, "askServerForList");
3562
+ var meetingsListThrough = /* @__PURE__ */ __name(async (source, store, filter, access) => {
3563
+ const listed2 = await listThrough(source, store, filter, access);
3564
+ if (!filter.query || !readsZone(filter.query, MEETING_TIMES))
3565
+ return listed2;
3566
+ return { ...listed2, meta: { ...listed2.meta, timezone: timezoneOf(access.timezone) } };
3567
+ }, "meetingsListThrough");
3568
+ var MEETING_TIMES = new Set(MEETING_QUERY.fields.filter(({ type }) => type === "time").map(({ name }) => name));
3569
+ var listThrough = /* @__PURE__ */ __name(async (source, store, filter, access) => {
3570
+ const now = access.now ?? Date.now();
3571
+ const zoned = { ...filter, timezone: timezoneOf(access.timezone), now };
3572
+ const step = await askServerForList(source, store, filter.accountId, filter.query, { ...access, now });
3573
+ if (!step)
3574
+ return meetingsList(store, zoned);
3575
+ const extras = {
3576
+ server: step.report,
3577
+ ...step.missing.length ? { missing: step.missing } : {},
3578
+ ...step.meta ? { meta: step.meta } : {}
3579
+ };
3580
+ const ids2 = [...step.found.keys()];
3581
+ if (access.backend === "server" && !ids2.length)
3582
+ return { items: [], page: { mode: "page", limit: filter.limit ?? 100, has_more: false }, ...extras };
3583
+ const list = await meetingsList(store, access.backend === "server" ? { ...zoned, ids: ids2 } : zoned);
3584
+ return {
3585
+ ...list,
3586
+ items: list.items.map((item) => ({ ...item, found_in: step.found.get(Number(item.id)) ?? "archive" })),
3587
+ ...extras
3588
+ };
3589
+ }, "listThrough");
3590
+ var storedMeeting = /* @__PURE__ */ __name(async (store, accountId, meeting2) => {
3591
+ const text6 = meeting2.trim();
3592
+ const own = /* @__PURE__ */ __name((details) => details?.meeting.accountId === accountId ? details : null, "own");
3593
+ if (/^[1-9]\d*$/.test(text6) && Number.isSafeInteger(Number(text6))) {
3594
+ const byNumber = own(await store.meeting(Number(text6)));
3595
+ if (byNumber)
3596
+ return byNumber;
3597
+ }
3598
+ if (text6.startsWith("meeting:")) {
3599
+ const reference2 = parseMeetingReference(text6);
3600
+ if (reference2.accountId !== accountId)
3601
+ throw new MeetingError("not_found", "meeting not found");
3602
+ return own(await store.meeting(reference2.meetingId));
3603
+ }
3604
+ return store.meetingByExternalId ? own(await store.meetingByExternalId(accountId, text6)) : null;
3605
+ }, "storedMeeting");
3606
+ var meetingShowThrough = /* @__PURE__ */ __name(async (source, store, accountId, meeting2, access) => {
3607
+ if (!meeting2.trim())
3608
+ throw new MeetingError("validation_error", "name a meeting");
3609
+ const stored = await storedMeeting(store, accountId, meeting2);
3610
+ const backend = access.backend ?? "both";
3611
+ const notFound = /* @__PURE__ */ __name(() => new MeetingError("not_found", "meeting not found"), "notFound");
3612
+ if (backend === "archive") {
3613
+ if (!stored)
3614
+ throw notFound();
3615
+ return { details: stored };
3616
+ }
3617
+ const step = stepFor(backend);
3618
+ const provider = source?.name ?? "the service";
3619
+ const fromStore = /* @__PURE__ */ __name((reason, error) => {
3620
+ if (backend === "server")
3621
+ throw refusal(reason, provider, error);
3622
+ if (!stored)
3623
+ throw error instanceof CliError && reason !== "failed" ? error : notFound();
3624
+ step.report.skipped = reason;
3625
+ step.report.complete = false;
3626
+ const meta = metaOf(reason, provider);
3627
+ return {
3628
+ details: stored,
3629
+ foundIn: "archive",
3630
+ server: step.report,
3631
+ missing: [{ field: "server", why: WHY[reason](provider) }],
3632
+ ...meta ? { meta } : {}
3633
+ };
3634
+ }, "fromStore");
3635
+ const providerId = stored?.meeting.externalId ?? (meeting2.trim().startsWith("meeting:") ? void 0 : meeting2.trim());
3636
+ if (providerId === void 0)
3637
+ throw notFound();
3638
+ if (!source?.get)
3639
+ return fromStore("unsupported");
3640
+ if (access.offline)
3641
+ return fromStore("offline");
3642
+ access.signal?.throwIfAborted();
3643
+ step.report.calls = 1;
3644
+ let full;
3645
+ try {
3646
+ full = await source.get(providerId, access.signal);
3647
+ } catch (error) {
3648
+ access.signal?.throwIfAborted();
3649
+ return fromStore(reasonOf(error), error);
3650
+ }
3651
+ if (!full) {
3652
+ if (!stored || backend === "server")
3653
+ throw notFound();
3654
+ return { details: stored, foundIn: "archive", server: step.report };
3655
+ }
3656
+ const details = await keep(source, store, accountId, access.now ?? Date.now(), step, full, { participants: full.participants, transcript: full.transcript, documents: full.documents }, true);
3657
+ const fresh = await store.meeting(details.meeting.id) ?? details;
3658
+ return { details: fresh, foundIn: step.found.get(details.meeting.id) ?? "server", server: step.report };
3659
+ }, "meetingShowThrough");
3660
+
3661
+ // 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/meetings/recording-transfer.js
3662
+ var strongRecordingValidator = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length <= 1024 && /^"[\x21\x23-\x7e\x80-\xff]*"$/.test(value), "strongRecordingValidator");
3663
+
3664
+ // 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/meetings/related-history.js
3665
+ var validateMeetingRelatedHistory = /* @__PURE__ */ __name((original) => {
3666
+ if (!original || typeof original !== "object" || Array.isArray(original))
3667
+ throw new CliError("validation_error", "related history request is required");
3668
+ const input = { ...original };
3669
+ for (const field of Object.keys(input))
3670
+ if (!["accountId", "seriesId", "anchorIds", "after", "before", "limit", "maxReadBytes", "signal"].includes(field))
3671
+ throw new CliError("validation_error", `unknown related history field: ${field}`);
3672
+ const positive = /* @__PURE__ */ __name((value) => Number.isSafeInteger(value) && value > 0, "positive");
3673
+ if (!positive(input.accountId) || !positive(input.seriesId))
3674
+ throw new CliError("validation_error", "accountId and seriesId must be positive safe integers");
3675
+ if (!Array.isArray(input.anchorIds) || input.anchorIds.length > 20 || input.anchorIds.some((id4) => !positive(id4)))
3676
+ throw new CliError("validation_error", "anchorIds must contain at most 20 positive safe integers");
3677
+ for (const key of ["after", "before"])
3678
+ if (!Number.isSafeInteger(input[key]) || Math.abs(input[key]) > 864e13)
3679
+ throw new CliError("validation_error", `${key} must be an absolute timestamp`);
3680
+ if (input.after >= input.before)
3681
+ throw new CliError("validation_error", "after must precede before");
3682
+ const limit = input.limit === void 0 ? 5 : input.limit;
3683
+ const maxReadBytes = input.maxReadBytes === void 0 ? 262144 : input.maxReadBytes;
3684
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 20)
3685
+ throw new CliError("validation_error", "limit must be an integer from 1 to 20");
3686
+ if (!Number.isSafeInteger(maxReadBytes) || maxReadBytes < 1 || maxReadBytes > 4194304)
3687
+ throw new CliError("validation_error", "maxReadBytes must be an integer from 1 to 4194304");
3688
+ if (input.signal !== void 0 && !(input.signal instanceof AbortSignal))
3689
+ throw new CliError("validation_error", "signal must be an AbortSignal");
3690
+ input.signal?.throwIfAborted();
3691
+ return { ...input, anchorIds: [...new Set(input.anchorIds)], limit, maxReadBytes };
3692
+ }, "validateMeetingRelatedHistory");
3693
+
3694
+ // 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/meetings/result-items.js
3695
+ var text4 = string();
3696
+ var identifier = pipe(text4, minLength(1));
3697
+ var nullableText = nullable(text4);
3698
+ var count6 = pipe(number(), integer(), minValue(0));
3699
+ var flag = boolean();
3700
+ var scope = strictObject({ provider: text4, account: text4 });
3701
+ var run = strictObject({
3702
+ meetings: count6,
3703
+ participants: count6,
3704
+ transcript_rows: count6,
3705
+ summaries: count6,
3706
+ warnings: array(strictObject({ external_id: text4, message: text4 })),
3707
+ timezone: optional(text4)
3708
+ });
3709
+ var exported = union([
3710
+ strictObject({
3711
+ meeting_id: identifier,
3712
+ format: picklist(["markdown", "vtt"]),
3713
+ filename: text4,
3714
+ content: text4,
3715
+ untrusted: optional(array(text4))
3716
+ }),
3717
+ strictObject({ meeting_id: identifier, format: picklist(["markdown", "vtt"]), output: text4 })
3718
+ ]);
3719
+ var eventChange = strictObject({
3720
+ action: literal("event.link"),
3721
+ event_id: nullable(identifier),
3722
+ expected_event_id: optional(nullable(identifier))
3723
+ });
3724
+ var personChange = strictObject({
3725
+ action: literal("person.link"),
3726
+ participant_id: identifier,
3727
+ person_uid: text4,
3728
+ expected_person_uid: optional(nullableText),
3729
+ target_account_ids: optional(array(identifier))
3730
+ });
3731
+ var eventResult = strictObject({
3732
+ meeting_id: identifier,
3733
+ event_id: nullable(identifier),
3734
+ previous_event_id: nullable(identifier),
3735
+ changed: flag
3736
+ });
3737
+ var personResult = strictObject({
3738
+ meeting_id: identifier,
3739
+ participant_id: identifier,
3740
+ person_uid: text4,
3741
+ previous_person_uid: nullableText,
3742
+ changed: flag,
3743
+ proposal: optional(text4)
3744
+ });
3745
+ var meetingChange = strictObject({
3746
+ scope,
3747
+ account_id: identifier,
3748
+ meeting_id: identifier,
3749
+ change: union([eventChange, personChange]),
3750
+ applied: flag,
3751
+ result: optional(union([eventResult, personResult]))
3752
+ });
3753
+ var recognition = strictObject({
3754
+ engine: text4,
3755
+ model: text4,
3756
+ version: optional(text4),
3757
+ timing: optional(picklist(["fixed-windows", "recognition-segments"]))
3758
+ });
3759
+ var transcription = union([
3760
+ strictObject({
3761
+ applied: literal(false),
3762
+ account_id: identifier,
3763
+ external_id: text4,
3764
+ segments: count6,
3765
+ media: strictObject({
3766
+ id: text4,
3767
+ content_hash: text4,
3768
+ size: count6,
3769
+ duration_ms: count6,
3770
+ format: text4,
3771
+ sample_rate: count6,
3772
+ channels: count6,
3773
+ recognition
3774
+ })
3775
+ }),
3776
+ strictObject({
3777
+ applied: literal(true),
3778
+ account_id: identifier,
3779
+ external_id: text4,
3780
+ meeting_id: identifier,
3781
+ created: flag,
3782
+ inserted_transcripts: count6,
3783
+ replayed_transcripts: count6,
3784
+ superseded_transcripts: count6,
3785
+ segments: count6,
3786
+ media_sha256: text4,
3787
+ engine: text4,
3788
+ model: text4,
3789
+ model_version: nullableText,
3790
+ timing: picklist(["fixed-windows", "recognition-segments"])
3791
+ })
3792
+ ]);
3793
+ var embeddingModel = strictObject({ key: text4, dims: count6, kind: picklist(["local", "remote"]), model: text4 });
3794
+ var embedding = union([
3795
+ strictObject({
3796
+ account_id: identifier,
3797
+ model: embeddingModel,
3798
+ status: strictObject({ chunks: count6, embedded: count6 }),
3799
+ applied: literal(false),
3800
+ scope: literal("existing-current-chunks"),
3801
+ rebuild_required: literal("explicit")
3802
+ }),
3803
+ strictObject({
3804
+ account_id: identifier,
3805
+ model: embeddingModel,
3806
+ saved: count6,
3807
+ skipped: count6,
3808
+ has_more: flag,
3809
+ next_hash: optional(text4),
3810
+ applied: literal(true),
3811
+ rebuild: strictObject({
3812
+ transcripts: count6,
3813
+ chunks: count6,
3814
+ has_more: flag,
3815
+ next_transcript_id: optional(identifier)
3816
+ })
3817
+ })
3818
+ ]);
3819
+ var repair = strictObject({
3820
+ account_id: identifier,
3821
+ applied: flag,
3822
+ transcripts: count6,
3823
+ languages: array(strictObject({ language: nullableText, transcripts: count6 }))
3824
+ });
3825
+ var kind = picklist(["instant", "scheduled"]);
3826
+ var managedChange = strictObject({
3827
+ action: picklist(["create", "update", "cancel"]),
3828
+ provider: text4,
3829
+ account: text4,
3830
+ id: optional(identifier),
3831
+ occurrence_id: optional(identifier),
3832
+ change: optional(strictObject({
3833
+ title: optional(text4),
3834
+ kind: optional(kind),
3835
+ start_time: optional(text4),
3836
+ duration_minutes: optional(count6),
3837
+ timezone: optional(text4),
3838
+ agenda: optional(text4),
3839
+ settings: optional(record(text4, union([text4, flag])))
3840
+ })),
3841
+ applied: flag,
3842
+ meeting: optional(strictObject({
3843
+ id: identifier,
3844
+ title: nullableText,
3845
+ kind: nullable(kind),
3846
+ start_time: nullableText,
3847
+ duration_minutes: nullable(count6),
3848
+ timezone: nullableText,
3849
+ agenda: nullableText,
3850
+ join_url: nullableText
3851
+ })),
3852
+ untrusted: optional(array(text4))
3853
+ });
3854
+ var invitation = strictObject({ id: identifier, invitation: text4, untrusted: optional(array(text4)) });
3855
+ var MEETING_RESULT_ENTITIES = {
3856
+ meeting_change: managedChange,
3857
+ meeting_invitation: invitation,
3858
+ meeting_ingestion: run,
3859
+ meeting_export: exported,
3860
+ meeting_association: meetingChange,
3861
+ meeting_transcription: transcription,
3862
+ meeting_embedding: embedding,
3863
+ meeting_repair: repair
3864
+ };
3865
+
3866
+ // 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/meetings/review.js
3867
+ var REVIEW_LIMIT = { default: 50, most: 200 };
3868
+
3869
+ // 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/meetings/save-hints.js
3870
+ var SAVE_HELP = `Worth keeping \u2014 a decision, a promise, a preference? Record it with \`memo facts add\` or
3871
+ \`memo memories add\`, citing the msg: locator or meeting: reference as --evidence.`;
3872
+
3873
+ // 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/meetings/series-history.js
3874
+ var validateMeetingSeriesHistory = /* @__PURE__ */ __name((input) => {
3875
+ input.signal?.throwIfAborted();
3876
+ if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)
3877
+ throw new CliError("validation_error", "accountId must be a positive safe integer");
3878
+ if (typeof input.externalId !== "string" || !input.externalId.trim() || new TextEncoder().encode(input.externalId).length > 4096 || /[\0\r\n]/.test(input.externalId))
3879
+ throw new CliError("validation_error", "externalId must be a bounded nonempty series identifier");
3880
+ for (const name of ["after", "before"])
3881
+ if (!Number.isSafeInteger(input[name]) || Math.abs(input[name]) > 864e13)
3882
+ throw new CliError("validation_error", `${name} must be an absolute timestamp in milliseconds`);
3883
+ if (input.after >= input.before)
3884
+ throw new CliError("validation_error", "after must be earlier than before");
3885
+ const limit = input.limit === void 0 ? 20 : input.limit;
3886
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
3887
+ throw new CliError("validation_error", "limit must be an integer from 1 to 100");
3888
+ const maxReadBytes = input.maxReadBytes === void 0 ? 256 * 1024 : input.maxReadBytes;
3889
+ if (!Number.isSafeInteger(maxReadBytes) || maxReadBytes < 1 || maxReadBytes > 4 * 1024 * 1024)
3890
+ throw new CliError("validation_error", "maxReadBytes must be an integer from 1 to 4194304");
3891
+ return { ...input, limit, maxReadBytes };
3892
+ }, "validateMeetingSeriesHistory");
3893
+
3894
+ // 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/meetings/upcoming-validation.js
3895
+ var occurrenceId = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim().length > 0 && value.length <= 1e3 && !/[\0\r\n]/.test(value), "occurrenceId");
3896
+
3897
+ // 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/meetings/series-inventory-validation.js
3898
+ function invalid4(field, response = false) {
3899
+ throw new CliError(response ? "invalid_response" : "validation_error", `invalid meeting inventory ${field}`);
3900
+ }
3901
+ __name(invalid4, "invalid");
3902
+ var object2 = /* @__PURE__ */ __name((value, fields, field, response = false) => {
3903
+ if (!value || typeof value !== "object" || Array.isArray(value))
3904
+ invalid4(field, response);
3905
+ for (const key of Object.keys(value))
3906
+ if (!fields.includes(key))
3907
+ invalid4(`${field}.${key}`, response);
3908
+ }, "object");
3909
+ var cursorDetails = /* @__PURE__ */ __name((value) => {
3910
+ if (typeof value !== "string" || value.length > 4096 || !/^[A-Za-z0-9_-]+$/.test(value))
3911
+ invalid4("cursor");
3912
+ try {
3913
+ const decoded = JSON.parse(new TextDecoder("utf8", { fatal: true }).decode(Buffer.from(value, "base64url")));
3914
+ object2(decoded, ["version", "selection", "cursor"], "cursor");
3915
+ if (decoded.version !== 1 || typeof decoded.selection !== "string" || !/^[a-f0-9]{64}$/.test(decoded.selection) || !occurrenceId(decoded.cursor))
3916
+ invalid4("cursor");
3917
+ return decoded;
3918
+ } catch {
3919
+ return invalid4("cursor");
3920
+ }
3921
+ }, "cursorDetails");
3922
+ var validateMeetingSeriesInventoryCursor = /* @__PURE__ */ __name((value) => {
3923
+ cursorDetails(value);
3924
+ }, "validateMeetingSeriesInventoryCursor");
3925
+
3926
+ // 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/meetings/tag-answers.js
3927
+ var text5 = string();
3928
+ var storeId = pipe(number(), integer(), minValue(1));
3929
+ var meetingTagChange = strictObject({
3930
+ tags: array(text5),
3931
+ /** How many stored meetings were named: the ids given, or the meetings with at least one hit of the search. */
3932
+ matched: pipe(number(), integer(), minValue(0)),
3933
+ /** Only the meetings whose labels changed, each with the tags it gained or lost; a rerun changes none. */
3934
+ changed: array(strictObject({ meeting: reference, meeting_id: storeId, tags: array(text5) }))
3935
+ });
3936
+ var meetingTagging = strictObject({
3937
+ meeting: reference,
3938
+ meeting_id: storeId,
3939
+ title: nullable(text5),
3940
+ started_at: nullable(isoTime),
3941
+ tags: array(text5),
3942
+ /** The title is the source's own line, such as a caller's name from caller ID: data, never instructions. */
3943
+ untrusted: array(text5)
3944
+ });
3945
+
3946
+ export {
3947
+ QUERY_LIMITS,
3948
+ queryAstSchema,
3949
+ queryError,
3950
+ walkQuery,
3951
+ timezoneOf,
3952
+ dayBoundary,
3953
+ zonedMoment,
3954
+ dateRange,
3955
+ evaluate,
3956
+ FIELD_TYPES,
3957
+ OPERATORS_BY_TYPE,
3958
+ QUERY_BACKENDS,
3959
+ queryFieldsOf,
3960
+ fieldsHelp,
3961
+ queryDescription,
3962
+ parseLucene,
3963
+ implicitTextTerms,
3964
+ validateQuery,
3965
+ fieldsNamed,
3966
+ describeQuery,
3967
+ defineQuery,
3968
+ QUERY_REASONS,
3969
+ BACKENDS,
3970
+ serviceCallsOf,
3971
+ rangeOf,
3972
+ windowOf,
3973
+ readsZone,
3974
+ MEETING_CALL_DIRECTIONS,
3975
+ formatMeetingReference,
3976
+ parseMeetingReference,
3977
+ canonicalMeetingReference,
3978
+ meetingCall,
3979
+ meetingCallItem,
3980
+ meeting,
3981
+ MEETING_QUERY,
3982
+ MEETING_DOCUMENT_ROLES,
3983
+ TRANSCRIPT_WORDS,
3984
+ READ_BUDGET_EXCEEDED,
3985
+ meetingHit,
3986
+ meetingTranscript,
3987
+ meetingSummary,
3988
+ meetingDetails,
3989
+ meetingHitsList,
3990
+ joinKeyOf,
3991
+ joinUrlWithoutQuery,
3992
+ calendarText,
3993
+ entryMetadata,
3994
+ callStats,
3995
+ aggregateMeetingCounts,
3996
+ aggregateMeetingStats,
3997
+ meetingCueFingerprint,
3998
+ EVENT_QUERY,
3999
+ PARTICIPANT_RESPONSES,
4000
+ entryInWindow,
4001
+ normalizeMeetingParticipantQuery,
4002
+ validateMeetingParticipantSearch,
4003
+ MeetingError,
4004
+ listed,
4005
+ meetingPeople,
4006
+ meetingsQuery,
4007
+ MEETING_QUERY_GUIDE,
4008
+ meetingDetailsBody,
4009
+ meetingTranscriptAnswer,
4010
+ meetingSummaryAnswer,
4011
+ exportMeeting,
4012
+ FACT_TYPES,
4013
+ PAYMENT_DIRECTIONS,
4014
+ PAYMENT_STATES,
4015
+ validatePayment,
4016
+ paymentTitle,
4017
+ meetingTimestamp,
4018
+ findingText,
4019
+ findingHash,
4020
+ findingFields,
4021
+ findingNeeds,
4022
+ validEvidence,
4023
+ findingId,
4024
+ validateFinding,
4025
+ validateBatch,
4026
+ validateFindings,
4027
+ findingFingerprint,
4028
+ MEETING_FINDINGS_KIND,
4029
+ validateMeetingFindings,
4030
+ meetingFindingFingerprint,
4031
+ MEETING_FIELD_NAMES,
4032
+ liftMeetingFields,
4033
+ parseMeetingQuery,
4034
+ transcriptLanguage,
4035
+ refreshMeetingIndex,
4036
+ pull,
4037
+ importFiles,
4038
+ CHAT_MESSAGES_READ,
4039
+ MEETING_FIELD_KEYS,
4040
+ MEETING_FIELDS2 as MEETING_FIELDS,
4041
+ meetingFieldFlag,
4042
+ SNAKE_CASE2 as SNAKE_CASE,
4043
+ markedPassage,
4044
+ validateMeetingPassage,
4045
+ validateMeetingPreparationContext,
4046
+ meetingProjectEvidence,
4047
+ meetingProjectEvidenceAnswer,
4048
+ validateMeetingHitSearch,
4049
+ MEETING_PROJECT_EVIDENCE_QUERY,
4050
+ prepareMeetingProjectEvidence,
4051
+ readMeetingProjectEvidence,
4052
+ meetingReview,
4053
+ meetingLink,
4054
+ meetingSpeaker,
4055
+ meetingStats,
4056
+ meetingCounts,
4057
+ meetingParticipants,
4058
+ meetingPassage,
4059
+ event,
4060
+ eventItem,
4061
+ meetingsListThrough,
4062
+ meetingShowThrough,
4063
+ strongRecordingValidator,
4064
+ validateMeetingRelatedHistory,
4065
+ MEETING_RESULT_ENTITIES,
4066
+ REVIEW_LIMIT,
4067
+ SAVE_HELP,
4068
+ validateMeetingSeriesHistory,
4069
+ validateMeetingSeriesInventoryCursor,
4070
+ meetingTagChange,
4071
+ meetingTagging
4072
+ };