@wirecat/zoom-cli 0.73.0 → 0.75.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 (137) hide show
  1. package/contracts/wirecat.json +5 -4
  2. package/dist/bin/zm.js +2 -2
  3. package/dist/bundle/{all-profiles-V47CUJFK.js → all-profiles-WFLKFKJC.js} +19 -29
  4. package/dist/bundle/answer-policy-XCKC2LLN.js +110 -0
  5. package/dist/bundle/{anthropic-SID7Z3QN.js → anthropic-H45W4P22.js} +2 -2
  6. package/dist/bundle/{app-server-KCMUSY4A.js → app-server-I4FPLBIX.js} +49 -66
  7. package/dist/bundle/{bun-PWMM6L45.js → bun-V5QLYBZU.js} +2 -2
  8. package/dist/bundle/{bun-sqlite-3TLKUN5A.js → bun-sqlite-X2YZPHDS.js} +3 -3
  9. package/dist/bundle/{chunk-PGPHEC2X.js → chunk-2Q4CB4EI.js} +1 -1
  10. package/dist/bundle/{chunk-PACLT6IW.js → chunk-3U3W6YY5.js} +69 -68
  11. package/dist/bundle/{chunk-QVJMFZFW.js → chunk-3URYKAJP.js} +1 -1
  12. package/dist/bundle/{chunk-UYBLNGZ2.js → chunk-3YKAFLXY.js} +1 -1
  13. package/dist/bundle/{chunk-IKNOTHG2.js → chunk-3YRPDNWK.js} +544 -142
  14. package/dist/bundle/{chunk-CMWFYZ45.js → chunk-4J5GJJ2I.js} +1 -1
  15. package/dist/bundle/{chunk-Y3IH7EZC.js → chunk-4XDWV6VJ.js} +16 -16
  16. package/dist/bundle/{chunk-KHBZ4OEP.js → chunk-4YNUQGDP.js} +1 -1
  17. package/dist/bundle/{chunk-35CYSRGJ.js → chunk-532H3KT3.js} +2 -2
  18. package/dist/bundle/{chunk-TI2OANJZ.js → chunk-6XNTELM5.js} +1 -1
  19. package/dist/bundle/chunk-7ZVWV33Z.js +707 -0
  20. package/dist/bundle/{chunk-ERQRY6WZ.js → chunk-A3Q3PG54.js} +1 -1
  21. package/dist/bundle/{chunk-JQF4LM3V.js → chunk-AVCYD4WQ.js} +20 -19
  22. package/dist/bundle/{chunk-P4FU6R3Z.js → chunk-B6Q53CVA.js} +7 -7
  23. package/dist/bundle/{chunk-KSNJK4QM.js → chunk-BY2YPKZZ.js} +12 -12
  24. package/dist/bundle/{chunk-L6YSKCC3.js → chunk-C5WQ57AB.js} +1 -1
  25. package/dist/bundle/{chunk-AIEMFRBU.js → chunk-CAQ5GW3A.js} +1 -1
  26. package/dist/bundle/{chunk-G2TSDMTA.js → chunk-DQBLDZ7M.js} +3 -3
  27. package/dist/bundle/{chunk-ILDGZBZD.js → chunk-DUPFAY35.js} +6 -6
  28. package/dist/bundle/{chunk-GCZMYDKU.js → chunk-ELD5AC7Q.js} +2 -2
  29. package/dist/bundle/{chunk-CIUJEQH4.js → chunk-EOZAJGB4.js} +11 -12
  30. package/dist/bundle/{chunk-VJVYGTPM.js → chunk-F6RB5FHZ.js} +1 -1
  31. package/dist/bundle/{chunk-LVDTSCIN.js → chunk-F7K2V6OA.js} +10 -10
  32. package/dist/bundle/{chunk-4LFFDUUW.js → chunk-FBYGBR4Q.js} +3 -3
  33. package/dist/bundle/{chunk-6AO2RSYH.js → chunk-GPVSGZ4R.js} +1608 -1096
  34. package/dist/bundle/{chunk-2NQPB6MT.js → chunk-GU4FVTJV.js} +17 -1
  35. package/dist/bundle/{chunk-6NI4FE5G.js → chunk-HKPNQL52.js} +3 -3
  36. package/dist/bundle/{chunk-KUL7S5Y3.js → chunk-IDGWBKMH.js} +10 -10
  37. package/dist/bundle/{chunk-QS6DWXDB.js → chunk-IMDTC4MD.js} +34 -20
  38. package/dist/bundle/{chunk-LSVQCI6V.js → chunk-IO3BQ6JU.js} +22 -22
  39. package/dist/bundle/{chunk-V5Q2QKYM.js → chunk-IW245Q5B.js} +23 -25
  40. package/dist/bundle/{chunk-DPSTOVKC.js → chunk-JDTZCZ5K.js} +2 -2
  41. package/dist/bundle/{chunk-JIS34MLC.js → chunk-JTYWSXJG.js} +7 -7
  42. package/dist/bundle/{chunk-K5JFX5TK.js → chunk-K5E5MB4C.js} +18 -18
  43. package/dist/bundle/{chunk-VPPNYUQM.js → chunk-L5UILROP.js} +322 -11
  44. package/dist/bundle/{chunk-DYLYH7VE.js → chunk-LRCSDAYK.js} +3 -3
  45. package/dist/bundle/{chunk-PJ3FKBXG.js → chunk-MHXZ62CU.js} +1 -1
  46. package/dist/bundle/{chunk-OKOJEBHK.js → chunk-MNVT7EJS.js} +2 -2
  47. package/dist/bundle/{chunk-HAMDPWEZ.js → chunk-NE4GYKQA.js} +5 -5
  48. package/dist/bundle/{chunk-PKON63JH.js → chunk-NL6AZ6S2.js} +1 -1
  49. package/dist/bundle/{chunk-N3SOTKXC.js → chunk-NQLL4KRN.js} +5 -5
  50. package/dist/bundle/{chunk-XLY7V2LB.js → chunk-NQQVNLO6.js} +10 -10
  51. package/dist/bundle/{chunk-44YVZIA4.js → chunk-NU4FSSMN.js} +2 -2
  52. package/dist/bundle/{chunk-ZVQDOKDY.js → chunk-OUM4ZO53.js} +1 -1
  53. package/dist/bundle/{chunk-OU5OXA6Q.js → chunk-P4ZQQLZF.js} +1772 -718
  54. package/dist/bundle/{chunk-OMLVWOEF.js → chunk-P6MQ6FS4.js} +184 -16
  55. package/dist/bundle/{chunk-NBA2V6LB.js → chunk-PCJRHC5Y.js} +7 -7
  56. package/dist/bundle/{chunk-G3SIY4MQ.js → chunk-PPM7UTCT.js} +22 -21
  57. package/dist/bundle/{chunk-3ADFJ3UP.js → chunk-PX4IMYVB.js} +2 -2
  58. package/dist/bundle/{chunk-FJMRDRPN.js → chunk-QBKKTTA3.js} +1155 -484
  59. package/dist/bundle/{chunk-ZX4QWTMQ.js → chunk-QEO3XTIE.js} +37 -29
  60. package/dist/bundle/{chunk-FZLJ2G7A.js → chunk-QXQUANWE.js} +4 -4
  61. package/dist/bundle/{chunk-MG2CCAVG.js → chunk-RABCFGT3.js} +2 -2
  62. package/dist/bundle/{chunk-SYIOT45G.js → chunk-RBYVQE3S.js} +4 -4
  63. package/dist/bundle/{chunk-6WUTUCKH.js → chunk-RKI4BGWG.js} +2 -2
  64. package/dist/bundle/{chunk-EXWZCI5G.js → chunk-SEJBS7SI.js} +1 -1
  65. package/dist/bundle/{chunk-LQYMN36C.js → chunk-SR5X7YKB.js} +1 -1
  66. package/dist/bundle/{chunk-KK2IVZUQ.js → chunk-T25PR26L.js} +5 -5
  67. package/dist/bundle/{chunk-ZAIE3G5I.js → chunk-T4FMXDDV.js} +2 -2
  68. package/dist/bundle/{chunk-SO52EJ2W.js → chunk-TSHUBGN4.js} +2 -2
  69. package/dist/bundle/{chunk-OFA22L4G.js → chunk-V3UK6E5B.js} +4 -4
  70. package/dist/bundle/{chunk-Q43KX56Z.js → chunk-VLK3X53X.js} +2 -2
  71. package/dist/bundle/{chunk-Z5XCU4S7.js → chunk-VPSQZ2YR.js} +44 -52
  72. package/dist/bundle/{chunk-QWGEOQHA.js → chunk-VUPWDCYV.js} +1 -1
  73. package/dist/bundle/{chunk-K7EMVFJ7.js → chunk-W2AC2RAG.js} +13 -13
  74. package/dist/bundle/{chunk-UIKVP23D.js → chunk-WQOGHND4.js} +1 -1
  75. package/dist/bundle/{chunk-ETQNHS3A.js → chunk-WUWF4EXZ.js} +6 -6
  76. package/dist/bundle/{chunk-HO3GBTIT.js → chunk-XCJGDPMN.js} +1547 -917
  77. package/dist/bundle/{chunk-2VYEGKQ3.js → chunk-XUHQ7DVT.js} +1 -1
  78. package/dist/bundle/{chunk-IE7YBRUO.js → chunk-Y5J5CAG2.js} +1 -1
  79. package/dist/bundle/{chunk-MOKEB656.js → chunk-ZBYKCVSV.js} +1 -1
  80. package/dist/bundle/{chunk-CQBLPBZU.js → chunk-ZVVRRMLW.js} +98 -6
  81. package/dist/bundle/{cli-4ZYJ6OZE.js → cli-NPRYCWFH.js} +112 -83
  82. package/dist/bundle/command-contract-OJYRKQHR.js +41 -0
  83. package/dist/bundle/{command-server-entry-CASONRIJ.js → command-server-entry-BV4SUPUI.js} +24 -26
  84. package/dist/bundle/config-UMEV24OE.js +97 -0
  85. package/dist/bundle/{decode-KEFCVGEB.js → decode-PRMKCHHC.js} +2 -2
  86. package/dist/bundle/{dist-GCQ7KCKN.js → dist-HGLDGKUW.js} +18 -15
  87. package/dist/bundle/{echarts-SDZA2SWG.js → echarts-QIXLXS3G.js} +2 -2
  88. package/dist/bundle/{embed-43VJEPM6.js → embed-OZN2BIJY.js} +3 -3
  89. package/dist/bundle/{embedder-Q4ZHAGRP.js → embedder-RBDHO6Z6.js} +6 -6
  90. package/dist/bundle/{first-run-CPOLQVNA.js → first-run-HNCD7U3B.js} +6 -6
  91. package/dist/bundle/first-screen-374BBMO6.js +39 -0
  92. package/dist/bundle/{instructions-7T6JJIFS.js → instructions-MD2RZT5Z.js} +1 -1
  93. package/dist/bundle/{main-NA3QVPXS.js → main-FPMCCRIQ.js} +15 -15
  94. package/dist/bundle/{meetings-7CVIQJTA.js → meetings-WYCVHAIP.js} +17 -1
  95. package/dist/bundle/{node-BZDMUFTW.js → node-IEVT2FSJ.js} +2 -2
  96. package/dist/bundle/{node-sqlite-QHGB23B4.js → node-sqlite-O4C6IWSM.js} +4 -4
  97. package/dist/bundle/{oauth-BMEMCM2I.js → oauth-6VXOUXSE.js} +4 -4
  98. package/dist/bundle/{open-JGU2NRJP.js → open-AMUIWV3Y.js} +2 -2
  99. package/dist/bundle/{openai-VTXXFNCS.js → openai-MEDN6FSK.js} +10 -10
  100. package/dist/bundle/{process-756VBE7E.js → process-6Q23D3TO.js} +1 -1
  101. package/dist/bundle/{program-XM6CDIJ2.js → program-CF2NKA2A.js} +84 -87
  102. package/dist/bundle/{prompt-2IPFXJ4B.js → prompt-N3UZE4ZR.js} +2 -2
  103. package/dist/bundle/{recognize-672E2RIB.js → recognize-I5F3K3CZ.js} +1 -1
  104. package/dist/bundle/{remote-YLHRVPDS.js → remote-CJF5KMMY.js} +6 -6
  105. package/dist/bundle/{rerank-NBXQG3OS.js → rerank-6WLY6MKY.js} +4 -4
  106. package/dist/bundle/{run-log-3WITBT2F.js → run-log-FKF4ZX4M.js} +55 -57
  107. package/dist/bundle/{serve-FNLOUMYP.js → serve-FOQJ3WMX.js} +6 -6
  108. package/dist/bundle/server-BAGY5HEZ.js +74 -0
  109. package/dist/bundle/{server-7ZB5AK5H.js → server-OEEGRSQD.js} +47 -47
  110. package/dist/bundle/{services-Z4UWN64R.js → services-Q6SFESMS.js} +43 -28
  111. package/dist/bundle/{speech-XSYVCKR3.js → speech-PBVEIG4N.js} +12 -12
  112. package/dist/bundle/{sqlite-runtime-GAPXJNWU.js → sqlite-runtime-IWR65V6I.js} +3 -3
  113. package/dist/bundle/{state-QSA53EF5.js → state-G54C2N6U.js} +3 -3
  114. package/dist/bundle/{store-NOF5EYUC.js → store-7EWMPTTW.js} +20 -16
  115. package/dist/bundle/{store-EKI4OAJH.js → store-D5OLXIFW.js} +14 -14
  116. package/dist/bundle/store-connection-34747SCC.js +90 -0
  117. package/dist/bundle/store-maintenance-command-QBO67F7Z.js +65 -0
  118. package/dist/bundle/{tokens-WJQYQ3FK.js → tokens-J7TFHLEG.js} +4 -4
  119. package/dist/bundle/zm.js +2 -2
  120. package/dist/bundle/{zoom-app-Y7RMWLVU.js → zoom-app-SULPMVN4.js} +2 -2
  121. package/dist/recording-schedule-commands.d.ts.map +1 -1
  122. package/dist/recording-schedule-commands.js +2 -2
  123. package/dist/recording-schedule-commands.js.map +1 -1
  124. package/dist/version.d.ts +1 -1
  125. package/dist/version.js +1 -1
  126. package/package.json +2 -2
  127. package/dist/bundle/answer-policy-W6H72X2R.js +0 -112
  128. package/dist/bundle/chunk-2BAZRRJP.js +0 -1239
  129. package/dist/bundle/chunk-KQD4ZVNC.js +0 -153
  130. package/dist/bundle/chunk-R5FTCNLJ.js +0 -76
  131. package/dist/bundle/chunk-USIMMGWS.js +0 -997
  132. package/dist/bundle/command-contract-FJDDCHYP.js +0 -43
  133. package/dist/bundle/config-4DZHX2WX.js +0 -99
  134. package/dist/bundle/first-screen-XYESRGWW.js +0 -41
  135. package/dist/bundle/server-GGRGD4SH.js +0 -77
  136. package/dist/bundle/store-connection-2OZQGEIO.js +0 -92
  137. package/dist/bundle/store-maintenance-command-GNX3SOZ6.js +0 -67
@@ -1,997 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- endpoint
5
- } from "./chunk-LQYMN36C.js";
6
- import {
7
- filesPresent,
8
- sharedModelsDirectory
9
- } from "./chunk-4LFFDUUW.js";
10
- import {
11
- PRIORITY_LABELS,
12
- TASK_ORIGINS,
13
- TASK_STATES,
14
- TASK_TYPES,
15
- count,
16
- id,
17
- text,
18
- time
19
- } from "./chunk-LSVQCI6V.js";
20
- import {
21
- TAG_TYPES
22
- } from "./chunk-QS6DWXDB.js";
23
- import {
24
- readSharedSection,
25
- sharedConfigPath,
26
- writeSharedSection
27
- } from "./chunk-VPPNYUQM.js";
28
- import {
29
- storePath
30
- } from "./chunk-ERQRY6WZ.js";
31
- import {
32
- writeSecurely
33
- } from "./chunk-HNWDEDMU.js";
34
- import {
35
- array,
36
- boolean,
37
- check,
38
- getDotPath,
39
- integer,
40
- maxLength,
41
- maxValue,
42
- minLength,
43
- minValue,
44
- nullable,
45
- number,
46
- optional,
47
- picklist,
48
- pipe,
49
- record,
50
- reference,
51
- regex,
52
- safeParse,
53
- startsWith,
54
- strictObject,
55
- string,
56
- trim,
57
- url
58
- } from "./chunk-4RJL32PF.js";
59
- import {
60
- CliError,
61
- isCliError
62
- } from "./chunk-EA2OB75T.js";
63
- import {
64
- __name
65
- } from "./chunk-ZVVMGPBJ.js";
66
-
67
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/duration.js
68
- var DURATION = /^(\d+)(ms|s|m|h|d)$/;
69
- var UNIT_MS = { ms: 1, s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
70
- var parseDuration = /* @__PURE__ */ __name((value, source) => {
71
- const match = DURATION.exec(value.trim());
72
- if (!match?.[1] || !match[2]) {
73
- throw new CliError("validation_error", `${source} takes a duration with a unit \u2014 500ms, 30s, 2m, 4h or 1d \u2014 not "${value}"`);
74
- }
75
- const ms = Number(match[1]) * (UNIT_MS[match[2]] ?? 0);
76
- if (ms <= 0)
77
- throw new CliError("validation_error", `${source} has to be more than zero, and "${value}" is not`);
78
- return ms;
79
- }, "parseDuration");
80
-
81
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/embeddings/models.js
82
- import { existsSync } from "node:fs";
83
- import { join } from "node:path";
84
- var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
85
- var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
86
- var e5Large = huggingFace("Xenova/multilingual-e5-large", "00fc3aeb3dbb95842de2ac1961d33c6319acf57b");
87
- var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
88
- var TEXT_MODELS = [
89
- {
90
- id: "e5-small",
91
- title: "multilingual-e5-small, 8-bit",
92
- size: "small",
93
- languages: "about 100 languages, Russian and English among them",
94
- licence: "MIT",
95
- dims: 384,
96
- maxTokens: 512,
97
- // 100k-message corpus, one 8-thread session on Ryzen AI 9 HX 470: 31–32 chunks/s.
98
- chunksPerSecond: 31,
99
- pooling: "mean",
100
- prefix: { query: "query: ", passage: "passage: " },
101
- onnx: "onnx/model_quantized.onnx",
102
- files: [
103
- {
104
- name: "onnx/model_quantized.onnx",
105
- url: e5("onnx/model_quantized.onnx"),
106
- sha256: "f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193",
107
- bytes: 118308185
108
- },
109
- {
110
- name: "tokenizer.json",
111
- url: e5("tokenizer.json"),
112
- sha256: "0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39",
113
- bytes: 17082730
114
- },
115
- {
116
- name: "tokenizer_config.json",
117
- url: e5("tokenizer_config.json"),
118
- sha256: "a1d6bc8734a6f635dc158508bef000f8e2e5a759c7d92f984b2c86e5ff53425b",
119
- bytes: 443
120
- }
121
- ]
122
- },
123
- {
124
- id: "embeddinggemma",
125
- title: "EmbeddingGemma 300M, 4-bit",
126
- size: "medium",
127
- languages: "over 100 languages \u2014 the best of the two on chat, about seven times slower",
128
- licence: "Gemma Terms of Use",
129
- terms: "https://ai.google.dev/gemma/terms",
130
- // Gemma Terms of Use §3.1: every copy carries this notice and the use restrictions of §3.2.
131
- notice: "Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms. Its use is restricted by the Gemma Prohibited Use Policy: https://ai.google.dev/gemma/prohibited_use_policy",
132
- dims: 768,
133
- maxTokens: 2048,
134
- // 2026-11-08, 1,200-character chunks, 8 threads on the Ryzen AI 9 HX 470: 8.3 chunks/s against e5-small's 52.7, so
135
- // 5 on the scale e5-small's 31 sets. It was 2, which held a memo sync to 39 chunks.
136
- chunksPerSecond: 5,
137
- pooling: "sentence_embedding",
138
- prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
139
- onnx: "onnx/model_q4.onnx",
140
- externalData: "onnx/model_q4.onnx_data",
141
- files: [
142
- {
143
- name: "onnx/model_q4.onnx",
144
- url: gemma("onnx/model_q4.onnx"),
145
- sha256: "ad1dfee81a70f7944b9b9d1cc6e48075b832881cf33fab2f2b248be78f3f0043",
146
- bytes: 519322
147
- },
148
- {
149
- name: "onnx/model_q4.onnx_data",
150
- url: gemma("onnx/model_q4.onnx_data"),
151
- sha256: "599962c3143b040de2dd05e5975be3e9091dd067cacc6a8f7186e3203bab9e02",
152
- bytes: 196725760
153
- },
154
- {
155
- name: "tokenizer.json",
156
- url: gemma("tokenizer.json"),
157
- sha256: "4dda02faaf32bc91031dc8c88457ac272b00c1016cc679757d1c441b248b9c47",
158
- bytes: 20323312
159
- },
160
- {
161
- name: "tokenizer_config.json",
162
- url: gemma("tokenizer_config.json"),
163
- sha256: "3ca953eea6c3c9fcda9cf3df22949ff18b216f7c74bd6459230f3f1013953f3a",
164
- bytes: 1156830
165
- }
166
- ]
167
- },
168
- {
169
- id: "e5-large",
170
- title: "multilingual-e5-large, 8-bit",
171
- size: "large",
172
- languages: "about 100 languages, Russian and English among them \u2014 reads better than e5-small, several times slower",
173
- licence: "MIT",
174
- dims: 1024,
175
- maxTokens: 512,
176
- // 2026-11-07, one 8-thread session on the Ryzen AI 9 HX 470 while other benchmarks ran: 3.4 chunks/s.
177
- chunksPerSecond: 4,
178
- pooling: "mean",
179
- prefix: { query: "query: ", passage: "passage: " },
180
- onnx: "onnx/model_quantized.onnx",
181
- files: [
182
- {
183
- name: "onnx/model_quantized.onnx",
184
- url: e5Large("onnx/model_quantized.onnx"),
185
- sha256: "0a8d65db9a36f810ba5da15249f13145fcdc7890e6656f1fd38cd8b7c4db1fca",
186
- bytes: 561768762
187
- },
188
- {
189
- name: "tokenizer.json",
190
- url: e5Large("tokenizer.json"),
191
- sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
192
- bytes: 17082660
193
- },
194
- {
195
- name: "tokenizer_config.json",
196
- url: e5Large("tokenizer_config.json"),
197
- sha256: "efb5c0d09722e5fe59a462cd2a9976ee216d55b037597d997cd3fe833216da15",
198
- bytes: 418
199
- }
200
- ]
201
- }
202
- ];
203
- var DEFAULT_TEXT_MODEL = "embeddinggemma";
204
- var PREVIOUS_DEFAULT_TEXT_MODEL = "e5-small";
205
- var SECTION = "text_models";
206
- var slug = pipe(string(), regex(/^[a-z0-9][a-z0-9._-]{0,62}$/, "is not a model id: a-z, 0-9, . _ -"));
207
- var words = pipe(string(), trim(), minLength(1), maxLength(300));
208
- var fileName = pipe(string(), check((name) => /^[\w.-]+(\/[\w.-]+)*$/.test(name) && !name.split("/").some((part) => part === ".." || part === "."), "is not a file inside the model's folder"));
209
- var modelFile = strictObject({
210
- name: fileName,
211
- url: pipe(string(), url(), startsWith("https://", "has to be an https address")),
212
- sha256: pipe(string(), regex(/^[0-9a-f]{64}$/, "has to be a sha256 in hex")),
213
- bytes: pipe(number(), integer(), minValue(1))
214
- });
215
- var CustomTextModelShape = pipe(strictObject({
216
- id: slug,
217
- title: words,
218
- languages: words,
219
- licence: words,
220
- terms: optional(pipe(string(), url())),
221
- dims: pipe(number(), integer(), minValue(1), maxValue(8192)),
222
- maxTokens: pipe(number(), integer(), minValue(16), maxValue(32768)),
223
- chunksPerSecond: optional(pipe(number(), minValue(0.01))),
224
- pooling: picklist(["mean", "sentence_embedding"]),
225
- prefix: strictObject({
226
- query: pipe(string(), maxLength(200)),
227
- passage: pipe(string(), maxLength(200))
228
- }),
229
- onnx: fileName,
230
- externalData: optional(fileName),
231
- files: pipe(array(modelFile), minLength(1), maxLength(16))
232
- }), check((model) => !TEXT_MODELS.some((one) => one.id === model.id), "takes the id of a model this version ships; choose another"), check((model) => {
233
- const names = model.files.map(({ name }) => name);
234
- return [model.onnx, model.externalData, "tokenizer.json", "tokenizer_config.json"].every((name) => name === void 0 || names.includes(name));
235
- }, "has to list its onnx file, its external data and tokenizer.json and tokenizer_config.json among files"));
236
- var TextModelsSection = strictObject({
237
- use: optional(slug),
238
- custom: optional(array(CustomTextModelShape))
239
- });
240
- var textModelsFile = /* @__PURE__ */ __name((env = process.env) => sharedConfigPath(storePath(env), env), "textModelsFile");
241
- var readTextModelsSection = /* @__PURE__ */ __name((env = process.env) => {
242
- const path = textModelsFile(env);
243
- const section = readSharedSection(path, SECTION);
244
- if (section === void 0)
245
- return {};
246
- const checked = safeParse(TextModelsSection, section);
247
- if (!checked.success) {
248
- const issue = checked.issues[0];
249
- const at = issue ? getDotPath(issue) : null;
250
- throw new CliError("configuration_error", `${path}: ${SECTION}${at ? `.${at}` : ""} ${issue?.message ?? "is not valid"}`);
251
- }
252
- const ids = checked.output.custom?.map(({ id: id2 }) => id2) ?? [];
253
- const twice = ids.find((id2, at) => ids.indexOf(id2) !== at);
254
- if (twice)
255
- throw new CliError("configuration_error", `${path}: ${SECTION}.custom names ${twice} twice`);
256
- return checked.output;
257
- }, "readTextModelsSection");
258
- var writeTextModelsSection = /* @__PURE__ */ __name((section, env = process.env) => writeSharedSection(textModelsFile(env), SECTION, section.use === void 0 && !section.custom?.length ? void 0 : section), "writeTextModelsSection");
259
- var textModels = /* @__PURE__ */ __name((env = process.env) => [
260
- ...TEXT_MODELS,
261
- ...(readTextModelsSection(env).custom ?? []).map((model) => ({ ...model, custom: true }))
262
- ], "textModels");
263
- var textModel = /* @__PURE__ */ __name((id2, env = process.env) => {
264
- const known = textModels(env);
265
- const found = known.find((model) => model.id === id2);
266
- if (!found) {
267
- throw new CliError("validation_error", `no text model ${id2} \u2014 one of: ${known.map((model) => model.id).join(", ")}`);
268
- }
269
- return found;
270
- }, "textModel");
271
- var downloaded = /* @__PURE__ */ __name((id2, env) => {
272
- const model = TEXT_MODELS.find((one) => one.id === id2);
273
- const directory = sharedModelsDirectory("text", env);
274
- return model !== void 0 && filesPresent(model.files.map((file) => [file, join(directory, model.id, file.name)]));
275
- }, "downloaded");
276
- var chosenTextModel = /* @__PURE__ */ __name((env = process.env) => {
277
- const use = readTextModelsSection(env).use;
278
- if (use !== void 0)
279
- return { id: use, from: "chosen" };
280
- const kept = !downloaded(DEFAULT_TEXT_MODEL, env) && existsSync(join(sharedModelsDirectory("text", env), PREVIOUS_DEFAULT_TEXT_MODEL));
281
- return { id: kept ? PREVIOUS_DEFAULT_TEXT_MODEL : DEFAULT_TEXT_MODEL, from: "default" };
282
- }, "chosenTextModel");
283
- var mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
284
- var bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
285
- var RERANK_MODELS = [
286
- {
287
- id: "mmarco",
288
- title: "mMARCO mMiniLMv2-L12 cross-encoder, 8-bit",
289
- languages: "about 100 languages, Russian and English among them",
290
- licence: "Apache-2.0",
291
- maxTokens: 512,
292
- // The x86 name is the quantizer's target; WebAssembly and native ONNX Runtime both run it on any processor.
293
- onnx: "onnx/model_quint8_avx2.onnx",
294
- files: [
295
- {
296
- name: "onnx/model_quint8_avx2.onnx",
297
- url: mmarco("onnx/model_quint8_avx2.onnx"),
298
- sha256: "6c2513767fb63d008a4377bef7a7a3555433d9436342bb53e35a3a72ffc52d4b",
299
- bytes: 118620016
300
- },
301
- {
302
- name: "tokenizer.json",
303
- url: mmarco("tokenizer.json"),
304
- sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
305
- bytes: 17082660
306
- },
307
- {
308
- name: "tokenizer_config.json",
309
- url: mmarco("tokenizer_config.json"),
310
- sha256: "e7fbfbfa6347b4e414c1cee50d142e2c2f9a895dad68b068ae83a8b564c3837e",
311
- bytes: 435
312
- }
313
- ]
314
- },
315
- {
316
- id: "bge-reranker-v2-m3",
317
- title: "BGE reranker v2 m3, 8-bit",
318
- languages: "over 100 languages \u2014 better than mmarco in the benchmark, about seven times slower",
319
- licence: "Apache-2.0 (BAAI's; the ONNX export declares none)",
320
- maxTokens: 512,
321
- onnx: "onnx/model_quantized.onnx",
322
- files: [
323
- {
324
- name: "onnx/model_quantized.onnx",
325
- url: bge("onnx/model_quantized.onnx"),
326
- sha256: "912fc1215c2dbff6499700534bd8d31253af01573861abbfc43afd1fab6cce5d",
327
- bytes: 570727094
328
- },
329
- {
330
- name: "tokenizer.json",
331
- url: bge("tokenizer.json"),
332
- sha256: "8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3",
333
- bytes: 17082900
334
- },
335
- {
336
- name: "tokenizer_config.json",
337
- url: bge("tokenizer_config.json"),
338
- sha256: "b87c8703482b0300d3da30e201519aa641f6a450f5eb5bf1e624afbf70c74d80",
339
- bytes: 1203
340
- }
341
- ]
342
- }
343
- ];
344
- var DEFAULT_RERANK_MODEL = "mmarco";
345
- var rerankModel = /* @__PURE__ */ __name((id2) => {
346
- const found = RERANK_MODELS.find((model) => model.id === id2);
347
- if (!found) {
348
- throw new CliError("validation_error", `no reranker ${id2} \u2014 one of: ${RERANK_MODELS.map((model) => model.id).join(", ")}`);
349
- }
350
- return found;
351
- }, "rerankModel");
352
- var vectorModelKey = /* @__PURE__ */ __name((model) => {
353
- const weights = model.custom ? model.files.find(({ name }) => name === model.onnx)?.sha256.slice(0, 12) : void 0;
354
- return `local:${model.id}${weights ? `@${weights}` : ""}:${model.dims}`;
355
- }, "vectorModelKey");
356
- var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
357
-
358
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/entities/task.js
359
- var closeSuggestion = strictObject({
360
- as: picklist(["done", "dismissed"]),
361
- /** The agent's name. */
362
- by: text,
363
- /** 0–1, as the agent rated it. */
364
- certainty: number(),
365
- reason: nullable(text),
366
- at: time
367
- });
368
- var task = strictObject({
369
- ref: reference,
370
- id,
371
- /** The readable key: `Q-15` for a task found in a message from now on, `IN1A2B3C4D-17` before, `HRB-12` in a project. */
372
- key: optional(nullable(text)),
373
- title: nullable(text),
374
- description: optional(nullable(text)),
375
- kind: picklist(TASK_TYPES),
376
- state: picklist(TASK_STATES),
377
- origin: optional(picklist(TASK_ORIGINS)),
378
- project: optional(nullable(text)),
379
- /** The project's key and name, as `tasks counts` names it. */
380
- project_key: optional(nullable(text)),
381
- project_name: optional(nullable(text)),
382
- /** Who added it: the owner, or an agent by its bot name. */
383
- created_by: optional(nullable(strictObject({ type: picklist(["person", "bot"]), id, name: nullable(text), owner: boolean() }))),
384
- account: optional(text),
385
- /** The chat it came from, as a `chat:` reference. */
386
- chat: optional(nullable(reference)),
387
- /** The message it came from. */
388
- source_message: optional(nullable(reference)),
389
- /** `<service>:<id>`, its id in an outside service, such as `avito:4512345678`. */
390
- external_id: optional(nullable(text)),
391
- /** The http or https page it is about, such as an Avito ad. */
392
- source_url: optional(nullable(text)),
393
- /** 0 to 1, higher first; `priority_label` reads it as low, medium, high or critical. */
394
- priority: optional(nullable(number())),
395
- priority_label: optional(nullable(picklist(PRIORITY_LABELS))),
396
- /** The agent working on it, apart from its assignees and its claim. */
397
- agent: optional(nullable(text)),
398
- /** Give it back with `--revision` to refuse a write made on a stale copy. */
399
- revision: optional(number()),
400
- assignments: optional(array(strictObject({ to: reference, role: picklist(["assignee", "reviewer", "watcher"]) }))),
401
- /** Open work whose blocked-by tasks are all done. */
402
- ready: optional(boolean()),
403
- /** The blocked-by tasks not done yet: open (any open state), dismissed, or unavailable. */
404
- blocked_by: optional(array(strictObject({ task: reference, state: picklist(["open", "dismissed", "unavailable"]) }))),
405
- parent: optional(nullable(reference)),
406
- due_at: optional(nullable(time)),
407
- closed_at: optional(nullable(time)),
408
- reason: optional(nullable(text)),
409
- /** One name from the category list (`tasks categories`). */
410
- category: optional(nullable(text)),
411
- /** Who works on it now, and until when; null when nobody does. */
412
- claimed_by: optional(nullable(text)),
413
- claimed_until: optional(nullable(time)),
414
- /** The close an agent would make, waiting on the owner: `tasks close` confirms it, `tasks reject` refuses it. */
415
- close_suggestion: optional(nullable(closeSuggestion)),
416
- created_at: time,
417
- updated_at: optional(time)
418
- });
419
-
420
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/entities/agenda.js
421
- var agendaChat = strictObject({
422
- chat: reference,
423
- title: nullable(text),
424
- kind: picklist(["dialog", "group", "channel", "saved", "unknown"]),
425
- /** The newest message, never its text; `null` while it is not stored. */
426
- last_message: nullable(reference),
427
- last_message_at: time,
428
- /** `null` when the newest message is not stored, or the messenger did not say who sent it. */
429
- last_from_owner: nullable(boolean()),
430
- /** Open tasks whose source is in this chat. */
431
- open_tasks: array(id),
432
- /** `unknown` means nothing ever fetched the chat's history; `partial` that the store holds only part of it. */
433
- completeness: strictObject({
434
- state: picklist(["complete", "partial", "unknown"]),
435
- up_to_date: nullable(boolean()),
436
- gaps: boolean(),
437
- reaches_start: boolean(),
438
- fetched_at: nullable(time)
439
- }),
440
- /** What the store holds of the chat: the count and the span, never the text. */
441
- held: strictObject({ messages: number(), oldest_at: nullable(time), newest_at: nullable(time) })
442
- });
443
- var agenda = strictObject({
444
- at: time,
445
- account: text,
446
- stored_at: nullable(time),
447
- /** The store saved nothing for a day: a chat may look quiet only because nothing was synced. */
448
- stale: boolean(),
449
- tasks: array(strictObject({
450
- id,
451
- key: text,
452
- title: nullable(text),
453
- kind: picklist(TASK_TYPES),
454
- category: nullable(text),
455
- /** The message or note it came from. */
456
- source: nullable(reference),
457
- due_at: nullable(time),
458
- next_check_at: nullable(time),
459
- /** Who works on it now; only the asker's own claims are listed unless the query names claimed:. */
460
- claimed_by: nullable(text),
461
- claimed_until: nullable(time),
462
- /** An agent's close waiting on the owner: `tasks close` confirms it, `tasks reject` refuses it. */
463
- close_suggestion: nullable(closeSuggestion),
464
- created_at: time,
465
- reasons: array(picklist(["overdue", "due", "check", "unplanned", "close-suggested"]))
466
- })),
467
- /** Someone else wrote last, and the owner has not answered. */
468
- owed: array(agendaChat),
469
- /** The owner wrote last, and nobody answered. */
470
- waiting: array(agendaChat),
471
- /** The chat list says these moved and their newest message is not stored: read them first. */
472
- unsynced: array(agendaChat),
473
- /** Open tasks someone else does: what they owe the owner, oldest first. */
474
- assigned: array(strictObject({
475
- id,
476
- key: text,
477
- title: nullable(text),
478
- kind: picklist(TASK_TYPES),
479
- category: nullable(text),
480
- source: nullable(reference),
481
- due_at: nullable(time),
482
- created_at: time,
483
- /** `person:<id>`, each one who does it. */
484
- assignees: array(reference)
485
- })),
486
- /** Open tasks carry these categories, which the list no longer holds: move them, or put the category back. */
487
- unlisted_categories: array(strictObject({ name: text, open_tasks: number() }))
488
- });
489
-
490
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/entities/attachment.js
491
- var attachment = strictObject({
492
- /** The message it came with, as a locator; absent inside that message. */
493
- message: optional(reference),
494
- /** Lower-cased: `photo`, `video`, `file`, `voice`… */
495
- kind: text,
496
- /** Its place among the message's attachments, from 1, as `attachments show --attachment` takes it. */
497
- position: optional(count),
498
- url: optional(text),
499
- name: optional(text),
500
- title: optional(text),
501
- mime: optional(text),
502
- size: optional(count),
503
- width: optional(count),
504
- height: optional(count),
505
- /** Seconds, for audio and video. */
506
- duration: optional(number()),
507
- /** The text read out of it; how it was read is `extraction`. */
508
- text: optional(text),
509
- extraction: optional(strictObject({ origin: text, extractor: text, chars: count, error: optional(text) })),
510
- local_path: optional(text),
511
- /** A shared contact card (`kind: "contact"`); the phone is the whole number as the sender put it. */
512
- contact: optional(strictObject({
513
- name: text,
514
- first_name: optional(text),
515
- last_name: optional(text),
516
- phone: optional(text),
517
- user_id: optional(id)
518
- })),
519
- /** A bot's keyboard under the message, row by row; `messages press` presses one. */
520
- buttons: optional(array(array(strictObject({
521
- kind: picklist(["callback", "link", "message", "chat", "contact", "location", "app", "clipboard", "other"]),
522
- text,
523
- url: optional(text)
524
- }))))
525
- });
526
- var hitFile = strictObject({
527
- position: count,
528
- kind: text,
529
- name: optional(text),
530
- size: optional(count),
531
- /** The saved copy on this computer, once `messages download` fetched it; absent until then. */
532
- local_path: optional(text)
533
- });
534
-
535
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/entities/conversation.js
536
- var conversation = strictObject({
537
- id,
538
- chat: reference,
539
- /** The message it starts with. */
540
- first_message: reference,
541
- started_at: time,
542
- ended_at: time,
543
- messages_count: count,
544
- /** How many people wrote in it. */
545
- senders_count: count,
546
- built_at: time,
547
- rules_version: count
548
- });
549
-
550
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/entities/tagging.js
551
- var tagging = strictObject({
552
- tag: text,
553
- type: picklist(TAG_TYPES),
554
- /** What carries it: a `chat:`, `contact:` or `msg:` reference. */
555
- target: reference,
556
- /** The chat's title or the person's name, as the store holds it. */
557
- name: nullable(text),
558
- /** Who claims it: `manual` the owner, `auto` the keyword rules; both when both do. */
559
- sources: array(picklist(["manual", "auto"])),
560
- created_at: time
561
- });
562
-
563
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/background/budget.js
564
- var DEADLINE_MARGIN_MS = 5e3;
565
- var DEADLINE_MARGIN_SHARE = 0.15;
566
- var DEFAULT_REQUEST_MS = 2e3;
567
- var deadlineMargin = /* @__PURE__ */ __name((deadline) => Math.max(DEADLINE_MARGIN_MS, deadline.ms * DEADLINE_MARGIN_SHARE), "deadlineMargin");
568
- var requestsFor = /* @__PURE__ */ __name((deadline, requestMs = DEFAULT_REQUEST_MS) => deadline === void 0 ? null : Math.max(1, Math.floor((deadline.ms - deadlineMargin(deadline)) / requestMs)), "requestsFor");
569
- var runBudget = /* @__PURE__ */ __name(({ requests, deadline, requestMs, signal, now = Date.now } = {}) => {
570
- const fits = requestsFor(deadline, requestMs);
571
- const limit = fits === null ? requests ?? null : Math.min(fits, requests ?? fits);
572
- const margin = deadline ? deadlineMargin(deadline) : 0;
573
- let used = 0;
574
- let stopped2 = null;
575
- let last;
576
- let slowest = 0;
577
- return {
578
- take() {
579
- if (stopped2)
580
- return stopped2;
581
- const at = now();
582
- if (last !== void 0)
583
- slowest = Math.max(slowest, at - last);
584
- if (signal?.aborted)
585
- stopped2 = "cancelled";
586
- else if (limit !== null && used >= limit)
587
- stopped2 = "requests";
588
- else if (deadline && at + margin + slowest >= deadline.endsAt)
589
- stopped2 = "deadline";
590
- if (stopped2)
591
- return stopped2;
592
- used += 1;
593
- last = at;
594
- return null;
595
- },
596
- get used() {
597
- return used;
598
- },
599
- limit,
600
- get stopped() {
601
- return stopped2;
602
- }
603
- };
604
- }, "runBudget");
605
-
606
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/sends/guarded.js
607
- import { AsyncLocalStorage } from "node:async_hooks";
608
- var sentIds = /* @__PURE__ */ __name((typed, message) => ({
609
- messageId: message.id,
610
- ...message.chatId && message.chatId !== typed ? { resultChatId: message.chatId } : {}
611
- }), "sentIds");
612
- var current = new AsyncLocalStorage();
613
- var writesInFlight = new AsyncLocalStorage();
614
- var parents = /* @__PURE__ */ new WeakMap();
615
- var stopped = /* @__PURE__ */ new WeakMap();
616
- var scopesFor = /* @__PURE__ */ __name((scope = writesInFlight.getStore()) => {
617
- const result = [];
618
- for (let at = scope; at; at = parents.get(at))
619
- result.push(at);
620
- return result;
621
- }, "scopesFor");
622
- var withWriteScope = /* @__PURE__ */ __name((scope, body) => {
623
- const parent = writesInFlight.getStore();
624
- if (parent && parent !== scope)
625
- parents.set(scope, parent);
626
- return writesInFlight.run(scope, body);
627
- }, "withWriteScope");
628
- var stopWrites = /* @__PURE__ */ __name((scope, reason) => {
629
- stopped.set(scope, reason);
630
- for (const write of scope)
631
- write.cut();
632
- }, "stopWrites");
633
- var refuseStopped = /* @__PURE__ */ __name((scopes) => {
634
- for (const scope of scopes)
635
- if (stopped.has(scope))
636
- throw stopped.get(scope);
637
- }, "refuseStopped");
638
- var currentOperation = /* @__PURE__ */ __name(() => current.getStore(), "currentOperation");
639
- var guardedWrite = /* @__PURE__ */ __name(async (guard, attempt, act, settled = () => ({}), prepare) => {
640
- const scopes = scopesFor();
641
- refuseStopped(scopes);
642
- try {
643
- await guard.ask?.(attempt);
644
- refuseStopped(scopes);
645
- if (guard.reserve) {
646
- guard.check(attempt, { reserve: false });
647
- await guard.reserve(attempt);
648
- } else
649
- guard.check(attempt);
650
- } catch (error) {
651
- guard.record({ ...attempt, outcome: "refused", errorCode: codeOf(error) });
652
- throw error;
653
- }
654
- try {
655
- refuseStopped(scopes);
656
- } catch (error) {
657
- guard.record({ ...attempt, outcome: "failed", errorCode: codeOf(error) });
658
- throw error;
659
- }
660
- let recorded = false;
661
- const once = /* @__PURE__ */ __name((entry) => {
662
- if (recorded)
663
- return;
664
- recorded = true;
665
- guard.record(entry);
666
- }, "once");
667
- let cancelled = false;
668
- const flight = {
669
- operationId: attempt.operationId,
670
- preparing: prepare !== void 0,
671
- cut: /* @__PURE__ */ __name(() => {
672
- cancelled = true;
673
- once({
674
- ...attempt,
675
- outcome: flight.preparing ? "failed" : "outcome_unknown",
676
- errorCode: flight.preparing ? "timeout" : "outcome_unknown"
677
- });
678
- }, "cut")
679
- };
680
- for (const scope of scopes)
681
- scope.add(flight);
682
- try {
683
- if (prepare !== void 0)
684
- await prepare();
685
- if (cancelled)
686
- throw new CliError("timeout", "the command ended before sending; nothing was sent", { sent: false });
687
- flight.preparing = false;
688
- const done = await current.run(attempt.operationId, act);
689
- if (cancelled)
690
- throw new CliError("outcome_unknown", "the command ended with a write in flight; check its result before continuing", { operation_id: attempt.operationId });
691
- once({ ...attempt, ...settled(done), outcome: "sent" });
692
- return done;
693
- } catch (error) {
694
- const code = codeOf(error);
695
- once({ ...attempt, outcome: code === "outcome_unknown" ? "outcome_unknown" : "failed", errorCode: code });
696
- if (code === "outcome_unknown" && error instanceof Error)
697
- throw new CliError("outcome_unknown", error.message, {
698
- ...error.details,
699
- operation_id: attempt.operationId,
700
- retryable: false
701
- });
702
- if (flight.preparing && isCliError(error) && error.details.sent === void 0)
703
- throw new CliError(error.code, error.message, { ...error.details, sent: false });
704
- throw error;
705
- } finally {
706
- for (const scope of scopes)
707
- scope.delete(flight);
708
- }
709
- }, "guardedWrite");
710
- var codeOf = /* @__PURE__ */ __name((error) => typeof error?.code === "string" ? error.code : "unknown", "codeOf");
711
-
712
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/models/settings.js
713
- var MODEL_FIELDS = ["provider", "model", "base_url"];
714
- var modelSettingsShape = record(pipe(string(), regex(/^[a-z][a-z0-9-]*$/)), strictObject({
715
- provider: optional(picklist(["off", "openai", "anthropic"])),
716
- model: optional(pipe(string(), trim(), minLength(1), maxLength(200))),
717
- base_url: optional(pipe(string(), check((value) => endpoint(value), "use an HTTP/S endpoint without credentials, query or fragment")))
718
- }));
719
- var resolveModelSettings = /* @__PURE__ */ __name((prefix, layers, env) => {
720
- const configured = layers.map(([from, scope]) => [from, scope?.models ?? {}]);
721
- const purposes = /* @__PURE__ */ new Set([
722
- "default",
723
- "analysis",
724
- "replies",
725
- ...configured.flatMap(([, models2]) => Object.keys(models2))
726
- ]);
727
- for (const name of Object.keys(env)) {
728
- const match = new RegExp(`^${prefix}_MODELS_([A-Z][A-Z0-9_]*)_(PROVIDER|MODEL|BASE_URL)$`).exec(name);
729
- if (match?.[1])
730
- purposes.add(match[1].toLowerCase().replaceAll("_", "-"));
731
- }
732
- const models = {};
733
- const sources = {};
734
- for (const purpose of purposes) {
735
- const resolved = {};
736
- for (const field of MODEL_FIELDS) {
737
- const variable = `${prefix}_MODELS_${purpose.replaceAll("-", "_").toUpperCase()}_${field.toUpperCase()}`;
738
- const candidates = [
739
- [variable, env[variable]?.trim() || void 0],
740
- ...configured.map(([from, model]) => [
741
- `${from}: models.${purpose}.${field}`,
742
- model[purpose]?.[field]
743
- ]),
744
- ...purpose === "default" ? [] : [
745
- [
746
- `${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`,
747
- env[`${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`]?.trim() || void 0
748
- ],
749
- ...configured.map(([from, model]) => [
750
- `${from}: models.default.${field}`,
751
- model.default?.[field]
752
- ])
753
- ]
754
- ];
755
- const selected = candidates.find(([, value]) => value !== void 0);
756
- if (selected)
757
- resolved[field] = selected[1];
758
- sources[`models.${purpose}.${field}`] = selected?.[0] ?? "default";
759
- }
760
- if (Object.keys(resolved).length)
761
- models[purpose] = resolved;
762
- }
763
- const checked = safeParse(modelSettingsShape, models);
764
- if (!checked.success)
765
- throw new CliError("configuration_error", `models.${getDotPath(checked.issues[0]) ?? "settings"} is invalid`);
766
- return { models: checked.output, sources };
767
- }, "resolveModelSettings");
768
- var modelTarget = /* @__PURE__ */ __name((settings, purpose) => {
769
- const configured = { ...settings.models?.default, ...settings.models?.[purpose] };
770
- if (configured.provider === void 0 || configured.provider === "off")
771
- return void 0;
772
- if (!configured.model)
773
- throw new CliError("configuration_error", `set models.${purpose}.model before calling its provider`);
774
- return {
775
- provider: configured.provider,
776
- model: configured.model,
777
- ...configured.base_url === void 0 ? {} : { baseUrl: configured.base_url }
778
- };
779
- }, "modelTarget");
780
-
781
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/services/history-limits.js
782
- var HISTORY_MAX_DAYS = 1095;
783
- var DEFAULT_HISTORY_LIMITS = { dialogDays: 1095, groupDays: 365, groupMembersMax: 50 };
784
- var DAY_MS = 24 * 60 * 60 * 1e3;
785
- var historyWindow = /* @__PURE__ */ __name((shape, limits, now) => {
786
- const group = shape !== void 0 && shape.kind !== "dialog" && shape.kind !== "saved";
787
- if (group && (shape.participantsCount ?? 0) > limits.groupMembersMax)
788
- return { skip: "group_too_large", members: shape.participantsCount ?? 0 };
789
- const days = group ? limits.groupDays : limits.dialogDays;
790
- return { keepFrom: now - Math.min(days, HISTORY_MAX_DAYS) * DAY_MS };
791
- }, "historyWindow");
792
- var limitBatch = /* @__PURE__ */ __name((batch, shapes, included, limits, now = Date.now()) => {
793
- const skipped = /* @__PURE__ */ new Map();
794
- if (!batch.messages?.length)
795
- return { batch, skipped };
796
- const named = new Map((batch.chats ?? []).map((chat) => [chat.id, chat]));
797
- const windows = /* @__PURE__ */ new Map();
798
- const windowOf = /* @__PURE__ */ __name((chatId) => {
799
- if (!windows.has(chatId)) {
800
- const chat = named.get(chatId);
801
- const shape = chat ? { kind: chat.kind, participantsCount: chat.participantsCount ?? null } : shapes(chatId);
802
- windows.set(chatId, included(chatId) ? void 0 : historyWindow(shape, limits, now));
803
- }
804
- return windows.get(chatId);
805
- }, "windowOf");
806
- const messages = batch.messages.filter((message) => {
807
- const window = windowOf(message.chatId);
808
- if (window === void 0)
809
- return true;
810
- const at = Date.parse(message.timestamp);
811
- if ("keepFrom" in window && !(at < window.keepFrom))
812
- return true;
813
- const reason = "skip" in window ? window.skip : "older_than_window";
814
- const held = skipped.get(message.chatId);
815
- const iso = new Date(at).toISOString();
816
- skipped.set(message.chatId, {
817
- reason,
818
- messages: (held?.messages ?? 0) + 1,
819
- oldestAt: held && held.oldestAt < iso ? held.oldestAt : iso,
820
- newestAt: held && held.newestAt > iso ? held.newestAt : iso,
821
- ..."skip" in window ? { members: window.members } : { keptFrom: new Date(window.keepFrom).toISOString() }
822
- });
823
- return false;
824
- });
825
- return { batch: { ...batch, messages }, skipped };
826
- }, "limitBatch");
827
-
828
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/images/picture/models.js
829
- import { join as join2 } from "node:path";
830
- var clip = /* @__PURE__ */ __name((name) => `https://huggingface.co/Xenova/clip-vit-base-patch32/resolve/d15189d7028b43f1d3e65039190477f6af591c2a/${name}`, "clip");
831
- var IMAGE_MODELS = [
832
- {
833
- id: "clip-b32",
834
- title: "CLIP ViT-B/32, 8-bit",
835
- languages: "English only: translate a query before searching",
836
- licence: "MIT",
837
- dims: 512,
838
- key: "local:clip-b32:512",
839
- maxTokens: 77,
840
- vision: "onnx/vision_model_quantized.onnx",
841
- text: "onnx/text_model_quantized.onnx",
842
- files: [
843
- {
844
- name: "onnx/vision_model_quantized.onnx",
845
- url: clip("onnx/vision_model_quantized.onnx"),
846
- sha256: "583fd1110a514667812fee7d684952aaf82a99b959760c8d7dca7e0ab9839299",
847
- bytes: 89117001
848
- },
849
- {
850
- name: "onnx/text_model_quantized.onnx",
851
- url: clip("onnx/text_model_quantized.onnx"),
852
- sha256: "73baab855d406190da9faa498cfedf65f15cf309f4cc7385b7b032e6d08e5c3a",
853
- bytes: 64504507
854
- },
855
- {
856
- name: "tokenizer.json",
857
- url: clip("tokenizer.json"),
858
- sha256: "f7f3b7af117d467b58374797691a6438d3e6b9e9cef800dfd5dced7f697a90cd",
859
- bytes: 2224119
860
- },
861
- {
862
- name: "tokenizer_config.json",
863
- url: clip("tokenizer_config.json"),
864
- sha256: "60ba2912bc6344c94bc16bbdec27fa1209409167b6f2fdf3cfe9e65462ea3967",
865
- bytes: 775
866
- }
867
- ]
868
- }
869
- ];
870
- var DEFAULT_IMAGE_MODEL = "clip-b32";
871
- var imageModel = /* @__PURE__ */ __name((id2) => {
872
- const found = IMAGE_MODELS.find((model) => model.id === id2);
873
- if (!found) {
874
- throw new CliError("validation_error", `no image model ${id2} \u2014 one of: ${IMAGE_MODELS.map((model) => model.id).join(", ")}`);
875
- }
876
- return found;
877
- }, "imageModel");
878
- var imageModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("image", env), "imageModelsDirectory");
879
- var placedImage = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join2(directory, model.id, file.name)]), "placedImage");
880
- var isImageModelInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placedImage(model, directory)), "isImageModelInstalled");
881
-
882
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/botcheck/reasons.js
883
- var WEIGHTS = {
884
- bot: 3,
885
- scam: 3,
886
- fake: 3,
887
- deleted: 1,
888
- no_photo: 1,
889
- no_username: 1,
890
- odd_name: 1,
891
- never_wrote: 1,
892
- link_first: 2,
893
- burst_join: 1,
894
- mass_invited: 1,
895
- new_account: 2,
896
- no_bio: 1,
897
- same_text: 2,
898
- photo_recent: 1,
899
- cas_banned: 3,
900
- lols_banned: 3,
901
- lols_scammer: 3
902
- };
903
- var LINK = /https?:\/\/|t\.me\/|www\./i;
904
- var DIGITS = /\d{5,}/;
905
- var oddName = /* @__PURE__ */ __name((name) => !name?.trim() || DIGITS.test(name) || LINK.test(name), "oddName");
906
-
907
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/background/checkpoints.js
908
- import { existsSync as existsSync2, readFileSync, rmSync } from "node:fs";
909
- import { join as join3 } from "node:path";
910
- var PART = /^[\w@+-][\w.@+-]{0,99}$/;
911
- var checkpointPath = /* @__PURE__ */ __name((state, profile, job) => {
912
- for (const part of [profile, job]) {
913
- if (!PART.test(part) || part.includes("..")) {
914
- throw new CliError("validation_error", `a checkpoint is named by letters, digits, ".", "@" and "-" \u2014 not "${part}"`);
915
- }
916
- }
917
- return join3(state, "checkpoints", profile, `${job}.json`);
918
- }, "checkpointPath");
919
- var readCheckpoint = /* @__PURE__ */ __name((path) => {
920
- try {
921
- return existsSync2(path) ? JSON.parse(readFileSync(path, "utf8")) : void 0;
922
- } catch {
923
- return void 0;
924
- }
925
- }, "readCheckpoint");
926
- var saveCheckpoint = /* @__PURE__ */ __name((path, point, now = /* @__PURE__ */ new Date()) => {
927
- const saved = { ...point, updated_at: now.toISOString() };
928
- writeSecurely(path, `${JSON.stringify(saved, null, 2)}
929
- `, 384);
930
- return saved;
931
- }, "saveCheckpoint");
932
- var progressOf = /* @__PURE__ */ __name((input) => {
933
- const total = input.total ?? null;
934
- const updated = input.updatedAt ?? null;
935
- return {
936
- job: input.job,
937
- profile: input.profile,
938
- done: input.done,
939
- total,
940
- remaining: total === null ? null : Math.max(0, total - input.done),
941
- state: input.complete ?? (total !== null && input.done >= total) ? "complete" : "partial",
942
- updated_at: updated,
943
- cursor_age_ms: updated === null ? null : Math.max(0, (input.now ?? /* @__PURE__ */ new Date()).getTime() - Date.parse(updated))
944
- };
945
- }, "progressOf");
946
-
947
- export {
948
- closeSuggestion,
949
- task,
950
- agenda,
951
- attachment,
952
- hitFile,
953
- WEIGHTS,
954
- LINK,
955
- oddName,
956
- conversation,
957
- checkpointPath,
958
- readCheckpoint,
959
- saveCheckpoint,
960
- progressOf,
961
- tagging,
962
- runBudget,
963
- sentIds,
964
- withWriteScope,
965
- stopWrites,
966
- currentOperation,
967
- guardedWrite,
968
- codeOf,
969
- modelSettingsShape,
970
- resolveModelSettings,
971
- modelTarget,
972
- parseDuration,
973
- DEFAULT_TEXT_MODEL,
974
- PREVIOUS_DEFAULT_TEXT_MODEL,
975
- CustomTextModelShape,
976
- textModelsFile,
977
- readTextModelsSection,
978
- writeTextModelsSection,
979
- textModels,
980
- textModel,
981
- chosenTextModel,
982
- RERANK_MODELS,
983
- DEFAULT_RERANK_MODEL,
984
- rerankModel,
985
- vectorModelKey,
986
- meaningFloor,
987
- HISTORY_MAX_DAYS,
988
- DEFAULT_HISTORY_LIMITS,
989
- historyWindow,
990
- limitBatch,
991
- IMAGE_MODELS,
992
- DEFAULT_IMAGE_MODEL,
993
- imageModel,
994
- imageModelsDirectory,
995
- placedImage,
996
- isImageModelInstalled
997
- };