@wirecat/drive-cli 0.68.0 → 0.70.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 (225) hide show
  1. package/contracts/wirecat.json +14 -13
  2. package/dist/age.d.ts +0 -36
  3. package/dist/age.d.ts.map +1 -1
  4. package/dist/age.js +0 -22
  5. package/dist/age.js.map +1 -1
  6. package/dist/bin/drive.js +2 -2
  7. package/dist/bundle/{all-profiles-BU6XUFUP.js → all-profiles-FW3GK3QO.js} +24 -34
  8. package/dist/bundle/{anthropic-ZP5B7S2Z.js → anthropic-QVKJT3II.js} +8 -8
  9. package/dist/bundle/{app-server-EB4DH6T7.js → app-server-QU73RD5R.js} +68 -76
  10. package/dist/bundle/{bun-PWMM6L45.js → bun-5XCD5CBB.js} +2 -2
  11. package/dist/bundle/{bun-sqlite-6VPR2SVC.js → bun-sqlite-TIGSVNSV.js} +9 -9
  12. package/dist/bundle/{chunk-7BXVI7XF.js → chunk-2SBC4DVV.js} +4 -4
  13. package/dist/bundle/{chunk-UFPRP7MG.js → chunk-3AHBZP33.js} +10 -15
  14. package/dist/bundle/{chunk-QRSPFCRY.js → chunk-3CHW7JGR.js} +17 -17
  15. package/dist/bundle/chunk-3TCMANIM.js +387 -0
  16. package/dist/bundle/{chunk-EOC7RHJ2.js → chunk-3UWRAIWA.js} +5 -7
  17. package/dist/bundle/{chunk-5G2BY4B6.js → chunk-3UZ4OH22.js} +32 -31
  18. package/dist/bundle/{chunk-UIKVP23D.js → chunk-4WK26MPY.js} +1 -1
  19. package/dist/bundle/{chunk-WUFZGPXX.js → chunk-54BQWRJL.js} +7 -7
  20. package/dist/bundle/{chunk-EA2OB75T.js → chunk-54NDYVZA.js} +1 -1
  21. package/dist/bundle/{chunk-QKY24RWV.js → chunk-5JTB4URG.js} +12 -12
  22. package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-66PL7P4C.js} +1 -1
  23. package/dist/bundle/{chunk-JMZQBRRZ.js → chunk-6BMTW5A6.js} +9 -9
  24. package/dist/bundle/{chunk-CVAJMRRD.js → chunk-6DPOWBKA.js} +6 -6
  25. package/dist/bundle/{chunk-YUGTJBV3.js → chunk-7C5KENNU.js} +3 -3
  26. package/dist/bundle/chunk-7DJNURKV.js +823 -0
  27. package/dist/bundle/{chunk-5TK2YQCO.js → chunk-7IBENBCK.js} +2 -2
  28. package/dist/bundle/chunk-7QSRODXM.js +259 -0
  29. package/dist/bundle/{chunk-HCZYJMBP.js → chunk-ABZ2NYDT.js} +1 -1
  30. package/dist/bundle/chunk-AV5UKJZM.js +729 -0
  31. package/dist/bundle/{chunk-IVOG6T6P.js → chunk-BBFXQPKD.js} +3 -3
  32. package/dist/bundle/{chunk-BXHFJTU5.js → chunk-BBRMDMIR.js} +3 -3
  33. package/dist/bundle/{chunk-DYLYH7VE.js → chunk-BD2K2ONK.js} +4 -4
  34. package/dist/bundle/{chunk-AIEMFRBU.js → chunk-BFKFKDPC.js} +1 -1
  35. package/dist/bundle/{chunk-JZ3MT7IE.js → chunk-BXPC5TFG.js} +2 -2
  36. package/dist/bundle/chunk-DHX27E5M.js +31 -0
  37. package/dist/bundle/{chunk-6QR7NKMG.js → chunk-DR57KDAY.js} +109 -5
  38. package/dist/bundle/{chunk-2VYEGKQ3.js → chunk-DVI72ZQG.js} +1 -1
  39. package/dist/bundle/{chunk-WGX4DZPW.js → chunk-DVVUJ254.js} +2 -2
  40. package/dist/bundle/{chunk-PJ3FKBXG.js → chunk-EDO5LZVF.js} +1 -1
  41. package/dist/bundle/{chunk-QTRYJZL7.js → chunk-EG62WVR2.js} +6 -6
  42. package/dist/bundle/{chunk-WCNTDETD.js → chunk-F5KJWRF5.js} +98 -6
  43. package/dist/bundle/{chunk-D4MVEOU2.js → chunk-FADAOLGB.js} +4 -4
  44. package/dist/bundle/{chunk-FAMXUI2X.js → chunk-FCSHWUMW.js} +5 -5
  45. package/dist/bundle/{chunk-O7T3WGCV.js → chunk-FN3RXBO7.js} +6 -6
  46. package/dist/bundle/{chunk-5W65QTYS.js → chunk-FONIFRYI.js} +4 -4
  47. package/dist/bundle/{chunk-UUQJVKPB.js → chunk-FVTKFIQH.js} +2340 -1436
  48. package/dist/bundle/{chunk-7A77GYCE.js → chunk-FYPW7NMH.js} +4 -4
  49. package/dist/bundle/{chunk-FIVFP53N.js → chunk-GA3URWIF.js} +1 -1
  50. package/dist/bundle/{chunk-GTLXBAJV.js → chunk-GAHIHE4K.js} +3035 -2482
  51. package/dist/bundle/{chunk-CMWFYZ45.js → chunk-GJZSVSV3.js} +2 -2
  52. package/dist/bundle/{chunk-QWGEOQHA.js → chunk-GK3BJMGK.js} +1 -1
  53. package/dist/bundle/{chunk-TI2OANJZ.js → chunk-GPDPEHYX.js} +1 -1
  54. package/dist/bundle/{chunk-KPKIHJIT.js → chunk-GV5DGHSA.js} +4 -4
  55. package/dist/bundle/{chunk-JRFKCYMW.js → chunk-HHAZ6DCY.js} +23 -6
  56. package/dist/bundle/{chunk-ZVQDOKDY.js → chunk-HK225DAG.js} +1 -1
  57. package/dist/bundle/{chunk-MW46BLWH.js → chunk-HRATXUFH.js} +22 -20
  58. package/dist/bundle/{chunk-Z5BMYI2V.js → chunk-HWUPU6WX.js} +8 -8
  59. package/dist/bundle/{chunk-6WAC2LOS.js → chunk-HYXXMSVD.js} +8614 -8597
  60. package/dist/bundle/{chunk-YYIWPH53.js → chunk-I7YSHUPW.js} +13 -13
  61. package/dist/bundle/{chunk-MWCPKUU4.js → chunk-IFTX7AQU.js} +5 -5
  62. package/dist/bundle/{chunk-SOS4U2RF.js → chunk-IGNIUDI3.js} +71 -49
  63. package/dist/bundle/{chunk-7JKECODO.js → chunk-ILAQIBEO.js} +1 -11
  64. package/dist/bundle/{chunk-CK2SQ2CE.js → chunk-KSJAFMU5.js} +78 -31
  65. package/dist/bundle/{chunk-ZSVMZH5O.js → chunk-LINBDWJK.js} +2 -2
  66. package/dist/bundle/{chunk-43NEDPXB.js → chunk-LMJBQFW6.js} +6 -6
  67. package/dist/bundle/{chunk-IJCUAKR5.js → chunk-ML3R2UHV.js} +4 -4
  68. package/dist/bundle/{chunk-PGPHEC2X.js → chunk-MXNQZAJQ.js} +2 -2
  69. package/dist/bundle/{chunk-RT5NT62B.js → chunk-NP7LJATI.js} +16 -70
  70. package/dist/bundle/chunk-OY7TNUEC.js +16 -0
  71. package/dist/bundle/{chunk-74NCZKRW.js → chunk-P77FL6RY.js} +18 -18
  72. package/dist/bundle/chunk-P7PLKNPX.js +3611 -0
  73. package/dist/bundle/{chunk-QVJMFZFW.js → chunk-PAPY6Q6H.js} +1 -1
  74. package/dist/bundle/{chunk-Q6BD6RUH.js → chunk-PN4JYURZ.js} +102 -57
  75. package/dist/bundle/{chunk-MOKEB656.js → chunk-PR7XD2DI.js} +2 -2
  76. package/dist/bundle/{chunk-UPCEHSIZ.js → chunk-Q5C6YKAY.js} +21 -16
  77. package/dist/bundle/{chunk-EXWZCI5G.js → chunk-QBAOIMVB.js} +1 -1
  78. package/dist/bundle/{chunk-ULNN3LCY.js → chunk-RCTOWLCD.js} +44 -37
  79. package/dist/bundle/{chunk-7TNQZKRD.js → chunk-REM5WHHQ.js} +77 -76
  80. package/dist/bundle/{chunk-Y2QVNVHK.js → chunk-RHSBXOQM.js} +1 -1
  81. package/dist/bundle/{chunk-UYBLNGZ2.js → chunk-RLNZ7NX5.js} +2 -2
  82. package/dist/bundle/chunk-RQNRYF6D.js +170 -0
  83. package/dist/bundle/{chunk-PV3AWPHR.js → chunk-SONPLYV7.js} +5 -5
  84. package/dist/bundle/{chunk-CRIEW4FP.js → chunk-T5D4OGDC.js} +2 -2
  85. package/dist/bundle/{chunk-MLSXHTUB.js → chunk-TGS5VPJD.js} +1228 -455
  86. package/dist/bundle/chunk-TNKQDS5A.js +335 -0
  87. package/dist/bundle/{chunk-DU23ET2O.js → chunk-VVN6GHAZ.js} +60 -81
  88. package/dist/bundle/{chunk-PWIEOATY.js → chunk-WJK6KTCS.js} +325 -14
  89. package/dist/bundle/{chunk-U52QE4QV.js → chunk-WWE5GO6G.js} +3 -3
  90. package/dist/bundle/{chunk-6HFZZ2PW.js → chunk-XOL346TJ.js} +2 -2
  91. package/dist/bundle/{chunk-ZAIE3G5I.js → chunk-XZBA6FVH.js} +3 -3
  92. package/dist/bundle/chunk-YCL3SK4T.js +1978 -0
  93. package/dist/bundle/{chunk-DIZBJLPM.js → chunk-YRUR3E3E.js} +68 -78
  94. package/dist/bundle/{chunk-EEE4H2PA.js → chunk-YZPE72GE.js} +12 -12
  95. package/dist/bundle/{chunk-F7KAMSXA.js → chunk-ZCXWV4XO.js} +4 -4
  96. package/dist/bundle/{chunk-NV75QPML.js → chunk-ZHZYGY5R.js} +4 -4
  97. package/dist/bundle/{cli-L7P36YUH.js → cli-K4D4DIGQ.js} +137 -88
  98. package/dist/bundle/command-contract-V3F452QI.js +43 -0
  99. package/dist/bundle/{command-server-entry-H3VGPOLJ.js → command-server-entry-WREK3QBB.js} +33 -31
  100. package/dist/bundle/decode-SEETPKBH.js +299 -0
  101. package/dist/bundle/{dispatch-WBEOHZDV.js → dispatch-SQCEURVK.js} +9 -9
  102. package/dist/bundle/drive.js +11 -11
  103. package/dist/bundle/{echarts-SDZA2SWG.js → echarts-WZ5RKFCX.js} +2 -2
  104. package/dist/bundle/{embed-WUKOASQG.js → embed-B2UCRZZR.js} +9 -9
  105. package/dist/bundle/{embedder-UBRAXRDZ.js → embedder-4R6Z7G7L.js} +12 -12
  106. package/dist/bundle/entry-ORZYRJ5N.js +25 -0
  107. package/dist/bundle/{failure-X6PSLVSO.js → failure-CYNXH3RQ.js} +4 -4
  108. package/dist/bundle/first-run-KAKA6KBY.js +31 -0
  109. package/dist/bundle/first-screen-R645UHRH.js +41 -0
  110. package/dist/bundle/google-BSO3YB7N.js +45 -0
  111. package/dist/bundle/{google-api-SQQ4BSNR.js → google-api-SAND2F7L.js} +70 -63
  112. package/dist/bundle/grants-PLNFYARD.js +118 -0
  113. package/dist/bundle/{identity-SRL6RSU2.js → identity-JVVGS4U6.js} +6 -6
  114. package/dist/bundle/{instructions-7T6JJIFS.js → instructions-JSMTSB22.js} +1 -1
  115. package/dist/bundle/{login-N243GGEE.js → login-6WG3YBDU.js} +78 -71
  116. package/dist/bundle/{mcp-TDKGDB4V.js → mcp-VFIOZDVY.js} +2 -2
  117. package/dist/bundle/meeting-combined-SUKMFK3F.js +27 -0
  118. package/dist/bundle/meeting-model-S4YGKIFI.js +29 -0
  119. package/dist/bundle/meeting-semantic-5U7JQCFF.js +25 -0
  120. package/dist/bundle/{node-BZDMUFTW.js → node-VJMVHOWD.js} +2 -2
  121. package/dist/bundle/{node-sqlite-SZQCCMV2.js → node-sqlite-DCNT3HVE.js} +10 -10
  122. package/dist/bundle/oauth-KCMNQ3ZP.js +22 -0
  123. package/dist/bundle/{open-RVTPKDA3.js → open-NFOEHVW7.js} +8 -8
  124. package/dist/bundle/{openai-6NN63BMH.js → openai-D47WY7EC.js} +32 -30
  125. package/dist/bundle/{process-756VBE7E.js → process-Q2FRU5VA.js} +1 -1
  126. package/dist/bundle/{program-B4QBJYB5.js → program-T2AJJQEM.js} +1327 -1329
  127. package/dist/bundle/{prompt-HGP2DSRW.js → prompt-YJSDABXN.js} +8 -8
  128. package/dist/bundle/{reasons-KSYP5VDJ.js → reasons-WEHPCSJX.js} +5 -5
  129. package/dist/bundle/{recognize-26SHB7HI.js → recognize-6OBEIEB3.js} +7 -7
  130. package/dist/bundle/{remote-Z4PWHZ5N.js → remote-3SL2QJ7T.js} +13 -13
  131. package/dist/bundle/{rerank-QHJZJK3Q.js → rerank-L6F5SLIB.js} +10 -10
  132. package/dist/bundle/{serve-MYJW5IEM.js → serve-GYSWIWH4.js} +12 -12
  133. package/dist/bundle/server-BI46BSRE.js +80 -0
  134. package/dist/bundle/{server-XFW3V7CR.js → server-GWWP3RIT.js} +62 -53
  135. package/dist/bundle/{services-IQG2RVTO.js → services-BDQBRXT5.js} +91 -51
  136. package/dist/bundle/{sqlite-runtime-X4GB5PBV.js → sqlite-runtime-ZSZGAUYB.js} +9 -9
  137. package/dist/bundle/{start-C6EXYXAL.js → start-BJ275RUK.js} +7 -7
  138. package/dist/bundle/{state-ATQK2X3W.js → state-HLNGFI2T.js} +9 -9
  139. package/dist/bundle/{store-QUBUPK6F.js → store-I43KZNJW.js} +35 -26
  140. package/dist/bundle/{store-MEHEUOJH.js → store-OSRTGYGI.js} +23 -19
  141. package/dist/bundle/store-maintenance-command-FO7LEVSL.js +72 -0
  142. package/dist/bundle/tokens-DB7O7QNB.js +118 -0
  143. package/dist/catalog.d.ts +0 -28
  144. package/dist/catalog.d.ts.map +1 -1
  145. package/dist/catalog.js +0 -82
  146. package/dist/catalog.js.map +1 -1
  147. package/dist/commands/catalog.d.ts +3 -8
  148. package/dist/commands/catalog.d.ts.map +1 -1
  149. package/dist/commands/catalog.js +36 -109
  150. package/dist/commands/catalog.js.map +1 -1
  151. package/dist/commands/context.d.ts +3 -0
  152. package/dist/commands/context.d.ts.map +1 -1
  153. package/dist/commands/context.js +20 -0
  154. package/dist/commands/context.js.map +1 -1
  155. package/dist/commands/documents.d.ts.map +1 -1
  156. package/dist/commands/documents.js +30 -72
  157. package/dist/commands/documents.js.map +1 -1
  158. package/dist/commands/folders.d.ts +1 -1
  159. package/dist/commands/folders.d.ts.map +1 -1
  160. package/dist/commands/folders.js +45 -48
  161. package/dist/commands/folders.js.map +1 -1
  162. package/dist/commands/knowledge.d.ts +4 -21
  163. package/dist/commands/knowledge.d.ts.map +1 -1
  164. package/dist/commands/knowledge.js +3 -241
  165. package/dist/commands/knowledge.js.map +1 -1
  166. package/dist/commands/mirrors.d.ts +2 -2
  167. package/dist/commands/mirrors.d.ts.map +1 -1
  168. package/dist/commands/mirrors.js +46 -202
  169. package/dist/commands/mirrors.js.map +1 -1
  170. package/dist/commands/search.d.ts +1 -3
  171. package/dist/commands/search.d.ts.map +1 -1
  172. package/dist/commands/search.js +20 -42
  173. package/dist/commands/search.js.map +1 -1
  174. package/dist/commands/sync.d.ts.map +1 -1
  175. package/dist/commands/sync.js +36 -53
  176. package/dist/commands/sync.js.map +1 -1
  177. package/dist/contract-overrides.d.ts +0 -2
  178. package/dist/contract-overrides.d.ts.map +1 -1
  179. package/dist/contract-overrides.js +0 -317
  180. package/dist/contract-overrides.js.map +1 -1
  181. package/dist/knowledge.d.ts +1 -1
  182. package/dist/knowledge.d.ts.map +1 -1
  183. package/dist/knowledge.js +4 -3
  184. package/dist/knowledge.js.map +1 -1
  185. package/dist/list-queries.d.ts +0 -31
  186. package/dist/list-queries.d.ts.map +1 -1
  187. package/dist/list-queries.js +0 -36
  188. package/dist/list-queries.js.map +1 -1
  189. package/dist/policy.d.ts +1 -1
  190. package/dist/policy.d.ts.map +1 -1
  191. package/dist/policy.js +3 -3
  192. package/dist/policy.js.map +1 -1
  193. package/dist/program.d.ts.map +1 -1
  194. package/dist/program.js +2 -3
  195. package/dist/program.js.map +1 -1
  196. package/dist/provider-json.d.ts.map +1 -1
  197. package/dist/provider-json.js +5 -5
  198. package/dist/provider-json.js.map +1 -1
  199. package/dist/reasons.d.ts.map +1 -1
  200. package/dist/reasons.js +0 -10
  201. package/dist/reasons.js.map +1 -1
  202. package/dist/version.d.ts +1 -1
  203. package/dist/version.js +1 -1
  204. package/package.json +3 -3
  205. package/dist/bundle/chunk-2UHQVRH2.js +0 -1235
  206. package/dist/bundle/chunk-AXYG2DDY.js +0 -4721
  207. package/dist/bundle/chunk-J5LXL435.js +0 -1316
  208. package/dist/bundle/chunk-R5FTCNLJ.js +0 -76
  209. package/dist/bundle/command-contract-EYFGMKIG.js +0 -41
  210. package/dist/bundle/decode-JEU6JWCV.js +0 -165
  211. package/dist/bundle/entry-C4NUQFTF.js +0 -25
  212. package/dist/bundle/first-run-PKHBS7B4.js +0 -30
  213. package/dist/bundle/first-screen-QOVOM4BF.js +0 -39
  214. package/dist/bundle/google-XXHSMTVK.js +0 -45
  215. package/dist/bundle/grants-2U4JVT6O.js +0 -111
  216. package/dist/bundle/oauth-CMAFXX6A.js +0 -22
  217. package/dist/bundle/server-HBZPIHDX.js +0 -74
  218. package/dist/bundle/store-maintenance-command-33ULVDWY.js +0 -65
  219. package/dist/bundle/tokens-A2GP4F34.js +0 -111
  220. package/dist/knowledge-query.d.ts +0 -77
  221. package/dist/knowledge-query.d.ts.map +0 -1
  222. package/dist/knowledge-query.js +0 -104
  223. package/dist/knowledge-query.js.map +0 -1
  224. package/dist/bundle/{chunk-XWBPP2HX.js → chunk-ZI3YTXSF.js} +0 -0
  225. package/dist/bundle/{mdast-util-from-markdown-CE73EWJ2.js → mdast-util-from-markdown-FXEPSNER.js} +3 -3
@@ -1,1316 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- filesPresent,
5
- sharedModelsDirectory
6
- } from "./chunk-5W65QTYS.js";
7
- import {
8
- PRIORITY_LABELS,
9
- TAG_TYPES,
10
- TASK_ORIGINS,
11
- TASK_STATES,
12
- TASK_TYPES,
13
- count,
14
- id,
15
- text,
16
- time
17
- } from "./chunk-AXYG2DDY.js";
18
- import {
19
- readSharedSection,
20
- sharedConfigPath,
21
- writeSharedSection
22
- } from "./chunk-PWIEOATY.js";
23
- import {
24
- storePath
25
- } from "./chunk-CRIEW4FP.js";
26
- import {
27
- array,
28
- boolean,
29
- check,
30
- getDotPath,
31
- integer,
32
- maxLength,
33
- maxValue,
34
- minLength,
35
- minValue,
36
- nullable,
37
- number,
38
- optional,
39
- picklist,
40
- pipe,
41
- reference,
42
- regex,
43
- safeParse,
44
- startsWith,
45
- strictObject,
46
- string,
47
- trim,
48
- url
49
- } from "./chunk-JRFKCYMW.js";
50
- import {
51
- CliError,
52
- isCliError
53
- } from "./chunk-EA2OB75T.js";
54
- import {
55
- __name
56
- } from "./chunk-ZVVMGPBJ.js";
57
-
58
- // 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/permissions.js
59
- var LEVELS = ["deny", "readonly", "ask", "allow"];
60
- var DANGEROUS = /* @__PURE__ */ new Set(["messages.delete", "bot.messages.delete", "topics.delete", "chats.delete", "chats.clear"]);
61
- var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
62
- var DEFAULT_PERMISSIONS = {
63
- "messages.delete": "ask",
64
- "account.sessions.end": "ask",
65
- "bot.messages.delete": "ask",
66
- "topics.enable": "ask",
67
- "topics.delete": "ask",
68
- "chats.delete": "ask",
69
- "chats.clear": "ask",
70
- // NEED-568: a rule writes to people with nobody typing a command; it waits for the owner's own allow.
71
- "replies.send": "deny",
72
- // NEED-1662: an agent that changes settings, schedules or recipients could lift its own limits; the owner opts in.
73
- "mcp.authority": "deny",
74
- // NEED-1663: writes no level stopped before, so MCP could not offer them; over MCP `ask` goes ahead.
75
- "store.backup": "ask",
76
- "store.restore": "ask",
77
- "store.migrate": "ask",
78
- "store.repair": "ask",
79
- "store.reset": "ask",
80
- "store.import": "ask",
81
- "store.clear": "ask",
82
- "store.decrypt": "ask",
83
- "store.copies.delete": "ask",
84
- "store.recover.run": "ask",
85
- "server.start": "ask",
86
- "server.stop": "ask",
87
- "server.restart": "ask",
88
- "models.download": "ask",
89
- // NEED-2357.f: many MCP clients (ChatGPT) cannot answer a question, and a switch deletes nothing; kept as a key so a
90
- // profile can still deny it.
91
- "models.set": "allow",
92
- "models.add": "ask",
93
- "images.models.download": "ask",
94
- "schedule.run": "ask",
95
- "schedule.exec": "ask",
96
- "doctor.reports.create": "ask"
97
- };
98
- var KEYED_UNDER_HOUSEKEEPING = new Set(Object.keys(DEFAULT_PERMISSIONS).filter((key) => /^(store|server|models|images|schedule|doctor)\./.test(key)));
99
- var AUTHORITY_KEY = "mcp.authority";
100
- var authorityAllowed = /* @__PURE__ */ __name((levels) => {
101
- const { level } = levelFor(levels, AUTHORITY_KEY);
102
- return level === "allow" || level === "ask";
103
- }, "authorityAllowed");
104
- var BOT_API_KEY = "bot.api";
105
- var isBotApi = /* @__PURE__ */ __name((path) => path[0] === "bot" && path[1] === "api", "isBotApi");
106
- var botApiAllowed = /* @__PURE__ */ __name((levels) => {
107
- const { level } = levelFor(levels, BOT_API_KEY, { ...DEFAULT_PERMISSIONS, [BOT_API_KEY]: "deny" });
108
- return level === "allow" || level === "ask";
109
- }, "botApiAllowed");
110
- var RESOURCES = [
111
- "messages",
112
- "drafts",
113
- "reactions",
114
- "polls",
115
- "topics",
116
- "chats",
117
- "contacts",
118
- "account",
119
- "bot",
120
- "conversations",
121
- "tags",
122
- "mentions",
123
- "search",
124
- "searches",
125
- "tasks",
126
- "replies",
127
- "attachments",
128
- "stats",
129
- "store",
130
- "metadata",
131
- "mcp",
132
- "server",
133
- "models",
134
- "schedule",
135
- "doctor",
136
- "images"
137
- ];
138
- var layerPermissions = /* @__PURE__ */ __name((layers) => {
139
- const levels = {};
140
- const sources = {};
141
- for (const [from, layer] of layers) {
142
- const nearer = Object.keys(levels);
143
- for (const [key, level] of Object.entries(layer ?? {})) {
144
- if (nearer.some((named) => key === named || key.startsWith(`${named}.`)))
145
- continue;
146
- levels[key] = level;
147
- sources[key] = from;
148
- }
149
- }
150
- return { levels, sources };
151
- }, "layerPermissions");
152
- var CEILING_KEY = "*";
153
- var ALLOWED = { level: "allow", key: null };
154
- var ORDER = { deny: 0, readonly: 1, ask: 2, allow: 3 };
155
- var nearest = /* @__PURE__ */ __name((levels, key) => {
156
- for (let parts = key.split("."); parts.length > 0; parts = parts.slice(0, -1)) {
157
- const named = parts.join(".");
158
- const level = levels[named];
159
- if (level)
160
- return { level, key: named, depth: parts.length };
161
- }
162
- return void 0;
163
- }, "nearest");
164
- var levelFor = /* @__PURE__ */ __name((permissions, key, defaults = DEFAULT_PERMISSIONS) => {
165
- const found = profileLevel(permissions, key, defaults);
166
- const ceiling = permissions[CEILING_KEY];
167
- return ceiling && ORDER[ceiling] < ORDER[found.level] ? { level: ceiling, key: CEILING_KEY } : found;
168
- }, "levelFor");
169
- var profileLevel = /* @__PURE__ */ __name((permissions, key, defaults) => {
170
- const own = nearest(permissions, key);
171
- const builtIn = nearest(defaults, key);
172
- if (!builtIn || own && own.depth >= builtIn.depth)
173
- return own ? { level: own.level, key: own.key } : ALLOWED;
174
- if (!own || ORDER[builtIn.level] <= ORDER[own.level])
175
- return { level: builtIn.level, key: builtIn.key };
176
- return { level: own.level, key: own.key };
177
- }, "profileLevel");
178
- var CHAT_KEYS = {
179
- settings: "chats.update",
180
- "requests.accept": "chats.requests.confirm",
181
- "requests.decline": "chats.requests.reject",
182
- "link.create": "chats.links.create",
183
- "link.reset": "chats.links.reset",
184
- "link.revoke": "chats.links.remove",
185
- "link.update": "chats.links.update"
186
- };
187
- var ACCOUNT_KEYS = {
188
- "contact-add": "contacts.add",
189
- "contact-remove": "contacts.remove",
190
- "contact-import": "contacts.import",
191
- "contact-rename": "contacts.rename",
192
- "contact-block": "contacts.block",
193
- "contact-unblock": "contacts.unblock",
194
- profile: "account.update",
195
- "folder-create": "chats.folders.create",
196
- "folder-update": "chats.folders.update",
197
- "folder-delete": "chats.folders.delete",
198
- "folder-order": "chats.folders.order",
199
- "folder-join": "chats.folders.join",
200
- "sessions-end": "account.sessions.end",
201
- "chat-mute": "chats.mute",
202
- "chat-unmute": "chats.unmute",
203
- "chat-archive": "chats.archive",
204
- "chat-unarchive": "chats.unarchive",
205
- "chat-pin": "chats.pin",
206
- "chat-unpin": "chats.unpin",
207
- "chat-mark-unread": "chats.mark-unread",
208
- "message-star": "messages.star",
209
- "message-unstar": "messages.unstar",
210
- // A mail CLI names its own key on every write; these only answer `keyForWrite` when one is left out.
211
- "message-flag": "messages.update",
212
- "message-move": "messages.move",
213
- "message-copy": "messages.copy",
214
- "message-delete": "messages.trash",
215
- "message-restore": "messages.restore",
216
- privacy: "account.privacy.set"
217
- };
218
- var KIND_KEYS = {
219
- message: "messages.send",
220
- forward: "messages.forward",
221
- edit: "messages.edit",
222
- pin: "messages.pin",
223
- reaction: "reactions",
224
- read: "chats.mark-read",
225
- delete: "messages.delete"
226
- };
227
- var keyForWrite = /* @__PURE__ */ __name((kind, action) => {
228
- if (kind === "chat")
229
- return CHAT_KEYS[action] ?? `chats.${action ?? "update"}`;
230
- if (kind === "account") {
231
- const key = ACCOUNT_KEYS[action];
232
- if (!key)
233
- throw new Error(`an account change without a known action: ${action}`);
234
- return key;
235
- }
236
- return KIND_KEYS[kind];
237
- }, "keyForWrite");
238
- var writeOfKey = /* @__PURE__ */ __name((key) => {
239
- const account = Object.entries(ACCOUNT_KEYS).find(([, named]) => named === key)?.[0];
240
- if (account)
241
- return { kind: "account", action: account };
242
- const kind = Object.entries(KIND_KEYS).find(([, named]) => named === key || key.startsWith(`${named}.`))?.[0];
243
- if (kind)
244
- return { kind };
245
- if (key === "messages.unpin")
246
- return { kind: "pin" };
247
- if (key.startsWith("chats.")) {
248
- const action = Object.entries(CHAT_KEYS).find(([, named]) => named === key)?.[0] ?? key.slice("chats.".length);
249
- return { kind: "chat", action };
250
- }
251
- return {};
252
- }, "writeOfKey");
253
- var NAMED_WRITE_KEYS = [
254
- "drafts",
255
- "store.gaps.repair",
256
- "messages.sync-first",
257
- "messages.server-search",
258
- "messages.press",
259
- "chats.start",
260
- "chats.app",
261
- "stats.messages.counters.sync",
262
- "stats.messages.show.sync-first",
263
- "stats.messages.top.sync-first",
264
- "stats.contacts.top.sync-first",
265
- "account.sessions.list",
266
- "attachments.extract",
267
- "attachments.move",
268
- "attachments.update",
269
- "bot.callbacks.answer",
270
- "bot.chats.action",
271
- "bot.chats.admins.add",
272
- "bot.chats.admins.remove",
273
- "bot.chats.leave",
274
- "bot.chats.members.remove",
275
- "bot.chats.moderate",
276
- "bot.messages.delete",
277
- "bot.messages.edit",
278
- "bot.messages.pin",
279
- "bot.messages.send",
280
- "bot.messages.unpin",
281
- "chats.admins.add",
282
- "chats.admins.remove",
283
- "chats.links.create",
284
- "chats.links.reset",
285
- "chats.links.remove",
286
- "chats.links.update",
287
- "chats.members.add",
288
- "chats.members.remove",
289
- "chats.moderate",
290
- "conversations.embeddings",
291
- "conversations.links",
292
- "polls.close",
293
- "polls.create",
294
- "polls.vote",
295
- "searches.clear",
296
- "searches.create",
297
- "searches.delete",
298
- "contacts.aliases.set",
299
- "contacts.aliases.remove",
300
- "contacts.notes.add",
301
- "contacts.notes.edit",
302
- "contacts.notes.remove",
303
- "tags.rebuild",
304
- "metadata.sync",
305
- "mentions.rebuild",
306
- "mentions.confirm",
307
- "mentions.reject",
308
- "tags.add",
309
- "tags.remove",
310
- "tasks.acknowledge",
311
- "tasks.add",
312
- "tasks.claim",
313
- "tasks.close",
314
- "tasks.duplicates.defer",
315
- "tasks.duplicates.reject",
316
- "tasks.link",
317
- "tasks.merge",
318
- "tasks.update",
319
- "tasks.release",
320
- "tasks.scan",
321
- "tasks.unmerge",
322
- "topics.create",
323
- "topics.edit",
324
- "topics.enable"
325
- ];
326
- var WRITE_KEYS = [
327
- .../* @__PURE__ */ new Set([
328
- ...NAMED_WRITE_KEYS,
329
- ...Object.keys(DEFAULT_PERMISSIONS),
330
- ...Object.values(KIND_KEYS),
331
- ...Object.values(ACCOUNT_KEYS),
332
- ...Object.values(CHAT_KEYS)
333
- ])
334
- ];
335
- var HOUSEKEEPING = /* @__PURE__ */ new Set([
336
- "help",
337
- "guide",
338
- "config",
339
- "session",
340
- "doctor",
341
- "commands",
342
- "complete",
343
- "upgrade",
344
- "skill",
345
- "models",
346
- "server",
347
- // What a schedule runs is checked by its own key when it runs; an agent runs read-only.
348
- "schedule",
349
- "runs",
350
- "sends",
351
- "recipients",
352
- "flood",
353
- "mcp",
354
- // Its commands read the rules or flip the pause switch; what a rule sends is checked as `replies.send`.
355
- "replies"
356
- ]);
357
- var BOT_HOUSEKEEPING = /* @__PURE__ */ new Set(["auth", "list", "sends", "recipients", "mcp"]);
358
- var STORE_MAINTENANCE = /* @__PURE__ */ new Set(["info", "check", "copies"]);
359
- var SHOW_MESSAGES = /* @__PURE__ */ new Set(["inbox", "review", "watch", "serve", "store", "conversations", "projects"]);
360
- var readKeysForCommand = /* @__PURE__ */ __name((path) => {
361
- if (path[0] === "bot")
362
- return readKeysForCommand(path.slice(1)).map((key2) => `bot.${key2}`);
363
- const key = keyForCommand(path);
364
- if (!key)
365
- return [];
366
- if (path[0] === "attachments" && path[1] === "download")
367
- return [key, "messages", "chats"];
368
- if (path[0] === "attachments" && (path[1] === "extract" || path[1] === "show"))
369
- return [key, "messages"];
370
- if (path[0] === "store" && path[1] === "gaps" && path[2] === "repair")
371
- return [key, "messages"];
372
- if (path[0] === "store" && ["reset", "clear", "decrypt"].includes(path[1] ?? ""))
373
- return [key, "messages"];
374
- if (key === "store.recover.run")
375
- return [key, "messages"];
376
- if (path[0] === "search") {
377
- if (path[1] === "notes")
378
- return [key];
379
- if (path[1] === "topics")
380
- return [key, "topics"];
381
- if (path[1] === "conversations")
382
- return [key, "messages", "conversations"];
383
- return [key, "messages"];
384
- }
385
- if (path[0] !== "stats")
386
- return [key];
387
- const resource = path[1] === "charts" ? "chats" : path[1];
388
- return [
389
- .../* @__PURE__ */ new Set([
390
- key,
391
- "messages",
392
- ...["chats", "contacts", "tasks"].includes(resource ?? "") ? [resource] : []
393
- ])
394
- ];
395
- }, "readKeysForCommand");
396
- var keyForCommand = /* @__PURE__ */ __name((path) => {
397
- if (path.length === 0)
398
- return null;
399
- const [top, next] = path;
400
- if (top === "bot") {
401
- if (next === void 0 || BOT_HOUSEKEEPING.has(next))
402
- return null;
403
- const inner = keyForCommand(path.slice(1));
404
- return `bot.${inner ?? path.slice(1).join(".")}`;
405
- }
406
- if (KEYED_UNDER_HOUSEKEEPING.has(path.join(".")))
407
- return path.join(".");
408
- if (top === void 0 || HOUSEKEEPING.has(top) || top === "search" && next === "runs")
409
- return null;
410
- if (top === "images" && next === "models")
411
- return null;
412
- if (top === "attachments" && (next === "check" || next === "jobs"))
413
- return null;
414
- if (top === "attachments" && next === "download")
415
- return "messages";
416
- if (top === "store" && next !== void 0 && STORE_MAINTENANCE.has(next))
417
- return null;
418
- if (top === "conversations" && next === "links")
419
- return path[2] === "rebuild" ? "conversations.links.rebuild" : "conversations.links";
420
- if (top === "conversations" && (next === "embeddings" || next === "embed") || top === "images" && next === "embed" || top === "conversations" && next === "rebuild")
421
- return "conversations.embeddings";
422
- if (top === "attachments" && next === "list" || top === "chats" && next === "documents")
423
- return "messages";
424
- if (top === "mentions")
425
- return next === "rebuild" || next === "confirm" || next === "reject" ? `mentions.${next}` : "messages";
426
- if (top === "store" && (next === "gaps" || next === "jobs"))
427
- return path.join(".");
428
- if (SHOW_MESSAGES.has(top) || top === "contacts" && (next === "context" || next === "prepare" || next === "events"))
429
- return "messages";
430
- if (RESOURCES.includes(top))
431
- return path.join(".");
432
- return void 0;
433
- }, "keyForCommand");
434
- var RESOURCE_KEY = new RegExp(`^(${RESOURCES.join("|")})(\\.[a-z][a-z-]*)*$`);
435
- var COMMAND_PATH_KEY = /^[a-z][a-z-]*(\.[a-zA-Z][a-zA-Z-]*)*$/;
436
- var permissionOverrides = /* @__PURE__ */ __name((entries = [], shape = RESOURCE_KEY) => {
437
- const levels = {};
438
- const example = shape === RESOURCE_KEY ? "messages.send=allow" : "api=readonly";
439
- for (const entry of entries) {
440
- const [key = "", level = "", extra] = entry.split("=");
441
- if (!shape.test(key) || !LEVELS.includes(level) || extra !== void 0)
442
- throw new CliError("validation_error", `--permission takes a command path and level, e.g. ${example} (deny, readonly, ask, allow)`);
443
- levels[key] = level;
444
- }
445
- return levels;
446
- }, "permissionOverrides");
447
- var assertOverridesTighten = /* @__PURE__ */ __name((overrides, profile, defaults = DEFAULT_PERMISSIONS) => {
448
- for (const [key, level] of Object.entries(overrides)) {
449
- const under = Object.keys(profile).filter((named) => named.startsWith(`${key}.`));
450
- const lifted = [key, ...under].find((named) => ORDER[level] > ORDER[levelFor(profile, named, defaults).level]);
451
- if (lifted !== void 0)
452
- throw new CliError("validation_error", `--permission ${key}=${level} would loosen ${lifted} from ${levelFor(profile, lifted, defaults).level}; it only tightens \u2014 change the profile's permissions to loosen it`, { key, lifted });
453
- }
454
- }, "assertOverridesTighten");
455
- var assertRetentionEvidenceRead = /* @__PURE__ */ __name((permissions) => {
456
- for (const permission of ["stats.chats.retention", "chats"]) {
457
- if (levelFor(permissions, permission).level === "deny")
458
- throw new CliError("permission_error", `profile denies ${permission}`, { permission });
459
- }
460
- }, "assertRetentionEvidenceRead");
461
-
462
- // 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
463
- var DURATION = /^(\d+)(ms|s|m|h|d)$/;
464
- var UNIT_MS = { ms: 1, s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
465
- var parseDuration = /* @__PURE__ */ __name((value, source) => {
466
- const match = DURATION.exec(value.trim());
467
- if (!match?.[1] || !match[2]) {
468
- throw new CliError("validation_error", `${source} takes a duration with a unit \u2014 500ms, 30s, 2m, 4h or 1d \u2014 not "${value}"`);
469
- }
470
- const ms = Number(match[1]) * (UNIT_MS[match[2]] ?? 0);
471
- if (ms <= 0)
472
- throw new CliError("validation_error", `${source} has to be more than zero, and "${value}" is not`);
473
- return ms;
474
- }, "parseDuration");
475
-
476
- // 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
477
- import { existsSync } from "node:fs";
478
- import { join } from "node:path";
479
- var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
480
- var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
481
- var e5Large = huggingFace("Xenova/multilingual-e5-large", "00fc3aeb3dbb95842de2ac1961d33c6319acf57b");
482
- var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
483
- var TEXT_MODELS = [
484
- {
485
- id: "e5-small",
486
- title: "multilingual-e5-small, 8-bit",
487
- size: "small",
488
- languages: "about 100 languages, Russian and English among them",
489
- licence: "MIT",
490
- dims: 384,
491
- maxTokens: 512,
492
- // 100k-message corpus, one 8-thread session on Ryzen AI 9 HX 470: 31–32 chunks/s.
493
- chunksPerSecond: 31,
494
- pooling: "mean",
495
- prefix: { query: "query: ", passage: "passage: " },
496
- onnx: "onnx/model_quantized.onnx",
497
- files: [
498
- {
499
- name: "onnx/model_quantized.onnx",
500
- url: e5("onnx/model_quantized.onnx"),
501
- sha256: "f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193",
502
- bytes: 118308185
503
- },
504
- {
505
- name: "tokenizer.json",
506
- url: e5("tokenizer.json"),
507
- sha256: "0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39",
508
- bytes: 17082730
509
- },
510
- {
511
- name: "tokenizer_config.json",
512
- url: e5("tokenizer_config.json"),
513
- sha256: "a1d6bc8734a6f635dc158508bef000f8e2e5a759c7d92f984b2c86e5ff53425b",
514
- bytes: 443
515
- }
516
- ]
517
- },
518
- {
519
- id: "embeddinggemma",
520
- title: "EmbeddingGemma 300M, 4-bit",
521
- size: "medium",
522
- languages: "over 100 languages \u2014 the best of the two on chat, about seven times slower",
523
- licence: "Gemma Terms of Use",
524
- terms: "https://ai.google.dev/gemma/terms",
525
- // Gemma Terms of Use §3.1: every copy carries this notice and the use restrictions of §3.2.
526
- 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",
527
- dims: 768,
528
- maxTokens: 2048,
529
- // 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
530
- // 5 on the scale e5-small's 31 sets. It was 2, which held a memo sync to 39 chunks.
531
- chunksPerSecond: 5,
532
- pooling: "sentence_embedding",
533
- prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
534
- onnx: "onnx/model_q4.onnx",
535
- externalData: "onnx/model_q4.onnx_data",
536
- files: [
537
- {
538
- name: "onnx/model_q4.onnx",
539
- url: gemma("onnx/model_q4.onnx"),
540
- sha256: "ad1dfee81a70f7944b9b9d1cc6e48075b832881cf33fab2f2b248be78f3f0043",
541
- bytes: 519322
542
- },
543
- {
544
- name: "onnx/model_q4.onnx_data",
545
- url: gemma("onnx/model_q4.onnx_data"),
546
- sha256: "599962c3143b040de2dd05e5975be3e9091dd067cacc6a8f7186e3203bab9e02",
547
- bytes: 196725760
548
- },
549
- {
550
- name: "tokenizer.json",
551
- url: gemma("tokenizer.json"),
552
- sha256: "4dda02faaf32bc91031dc8c88457ac272b00c1016cc679757d1c441b248b9c47",
553
- bytes: 20323312
554
- },
555
- {
556
- name: "tokenizer_config.json",
557
- url: gemma("tokenizer_config.json"),
558
- sha256: "3ca953eea6c3c9fcda9cf3df22949ff18b216f7c74bd6459230f3f1013953f3a",
559
- bytes: 1156830
560
- }
561
- ]
562
- },
563
- {
564
- id: "e5-large",
565
- title: "multilingual-e5-large, 8-bit",
566
- size: "large",
567
- languages: "about 100 languages, Russian and English among them \u2014 reads better than e5-small, several times slower",
568
- licence: "MIT",
569
- dims: 1024,
570
- maxTokens: 512,
571
- // 2026-11-07, one 8-thread session on the Ryzen AI 9 HX 470 while other benchmarks ran: 3.4 chunks/s.
572
- chunksPerSecond: 4,
573
- pooling: "mean",
574
- prefix: { query: "query: ", passage: "passage: " },
575
- onnx: "onnx/model_quantized.onnx",
576
- files: [
577
- {
578
- name: "onnx/model_quantized.onnx",
579
- url: e5Large("onnx/model_quantized.onnx"),
580
- sha256: "0a8d65db9a36f810ba5da15249f13145fcdc7890e6656f1fd38cd8b7c4db1fca",
581
- bytes: 561768762
582
- },
583
- {
584
- name: "tokenizer.json",
585
- url: e5Large("tokenizer.json"),
586
- sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
587
- bytes: 17082660
588
- },
589
- {
590
- name: "tokenizer_config.json",
591
- url: e5Large("tokenizer_config.json"),
592
- sha256: "efb5c0d09722e5fe59a462cd2a9976ee216d55b037597d997cd3fe833216da15",
593
- bytes: 418
594
- }
595
- ]
596
- }
597
- ];
598
- var DEFAULT_TEXT_MODEL = "embeddinggemma";
599
- var PREVIOUS_DEFAULT_TEXT_MODEL = "e5-small";
600
- var SECTION = "text_models";
601
- var slug = pipe(string(), regex(/^[a-z0-9][a-z0-9._-]{0,62}$/, "is not a model id: a-z, 0-9, . _ -"));
602
- var words = pipe(string(), trim(), minLength(1), maxLength(300));
603
- 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"));
604
- var modelFile = strictObject({
605
- name: fileName,
606
- url: pipe(string(), url(), startsWith("https://", "has to be an https address")),
607
- sha256: pipe(string(), regex(/^[0-9a-f]{64}$/, "has to be a sha256 in hex")),
608
- bytes: pipe(number(), integer(), minValue(1))
609
- });
610
- var CustomTextModelShape = pipe(strictObject({
611
- id: slug,
612
- title: words,
613
- languages: words,
614
- licence: words,
615
- terms: optional(pipe(string(), url())),
616
- dims: pipe(number(), integer(), minValue(1), maxValue(8192)),
617
- maxTokens: pipe(number(), integer(), minValue(16), maxValue(32768)),
618
- chunksPerSecond: optional(pipe(number(), minValue(0.01))),
619
- pooling: picklist(["mean", "sentence_embedding"]),
620
- prefix: strictObject({
621
- query: pipe(string(), maxLength(200)),
622
- passage: pipe(string(), maxLength(200))
623
- }),
624
- onnx: fileName,
625
- externalData: optional(fileName),
626
- files: pipe(array(modelFile), minLength(1), maxLength(16))
627
- }), check((model) => !TEXT_MODELS.some((one) => one.id === model.id), "takes the id of a model this version ships; choose another"), check((model) => {
628
- const names = model.files.map(({ name }) => name);
629
- return [model.onnx, model.externalData, "tokenizer.json", "tokenizer_config.json"].every((name) => name === void 0 || names.includes(name));
630
- }, "has to list its onnx file, its external data and tokenizer.json and tokenizer_config.json among files"));
631
- var TextModelsSection = strictObject({
632
- use: optional(slug),
633
- custom: optional(array(CustomTextModelShape))
634
- });
635
- var textModelsFile = /* @__PURE__ */ __name((env = process.env) => sharedConfigPath(storePath(env), env), "textModelsFile");
636
- var readTextModelsSection = /* @__PURE__ */ __name((env = process.env) => {
637
- const path = textModelsFile(env);
638
- const section = readSharedSection(path, SECTION);
639
- if (section === void 0)
640
- return {};
641
- const checked = safeParse(TextModelsSection, section);
642
- if (!checked.success) {
643
- const issue = checked.issues[0];
644
- const at = issue ? getDotPath(issue) : null;
645
- throw new CliError("configuration_error", `${path}: ${SECTION}${at ? `.${at}` : ""} ${issue?.message ?? "is not valid"}`);
646
- }
647
- const ids = checked.output.custom?.map(({ id: id2 }) => id2) ?? [];
648
- const twice = ids.find((id2, at) => ids.indexOf(id2) !== at);
649
- if (twice)
650
- throw new CliError("configuration_error", `${path}: ${SECTION}.custom names ${twice} twice`);
651
- return checked.output;
652
- }, "readTextModelsSection");
653
- var writeTextModelsSection = /* @__PURE__ */ __name((section, env = process.env) => writeSharedSection(textModelsFile(env), SECTION, section.use === void 0 && !section.custom?.length ? void 0 : section), "writeTextModelsSection");
654
- var textModels = /* @__PURE__ */ __name((env = process.env) => [
655
- ...TEXT_MODELS,
656
- ...(readTextModelsSection(env).custom ?? []).map((model) => ({ ...model, custom: true }))
657
- ], "textModels");
658
- var textModel = /* @__PURE__ */ __name((id2, env = process.env) => {
659
- const known = textModels(env);
660
- const found = known.find((model) => model.id === id2);
661
- if (!found) {
662
- throw new CliError("validation_error", `no text model ${id2} \u2014 one of: ${known.map((model) => model.id).join(", ")}`);
663
- }
664
- return found;
665
- }, "textModel");
666
- var downloaded = /* @__PURE__ */ __name((id2, env) => {
667
- const model = TEXT_MODELS.find((one) => one.id === id2);
668
- const directory = sharedModelsDirectory("text", env);
669
- return model !== void 0 && filesPresent(model.files.map((file) => [file, join(directory, model.id, file.name)]));
670
- }, "downloaded");
671
- var chosenTextModel = /* @__PURE__ */ __name((env = process.env) => {
672
- const use = readTextModelsSection(env).use;
673
- if (use !== void 0)
674
- return { id: use, from: "chosen" };
675
- const kept = !downloaded(DEFAULT_TEXT_MODEL, env) && existsSync(join(sharedModelsDirectory("text", env), PREVIOUS_DEFAULT_TEXT_MODEL));
676
- return { id: kept ? PREVIOUS_DEFAULT_TEXT_MODEL : DEFAULT_TEXT_MODEL, from: "default" };
677
- }, "chosenTextModel");
678
- var mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
679
- var bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
680
- var RERANK_MODELS = [
681
- {
682
- id: "mmarco",
683
- title: "mMARCO mMiniLMv2-L12 cross-encoder, 8-bit",
684
- languages: "about 100 languages, Russian and English among them",
685
- licence: "Apache-2.0",
686
- maxTokens: 512,
687
- // The x86 name is the quantizer's target; WebAssembly and native ONNX Runtime both run it on any processor.
688
- onnx: "onnx/model_quint8_avx2.onnx",
689
- files: [
690
- {
691
- name: "onnx/model_quint8_avx2.onnx",
692
- url: mmarco("onnx/model_quint8_avx2.onnx"),
693
- sha256: "6c2513767fb63d008a4377bef7a7a3555433d9436342bb53e35a3a72ffc52d4b",
694
- bytes: 118620016
695
- },
696
- {
697
- name: "tokenizer.json",
698
- url: mmarco("tokenizer.json"),
699
- sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
700
- bytes: 17082660
701
- },
702
- {
703
- name: "tokenizer_config.json",
704
- url: mmarco("tokenizer_config.json"),
705
- sha256: "e7fbfbfa6347b4e414c1cee50d142e2c2f9a895dad68b068ae83a8b564c3837e",
706
- bytes: 435
707
- }
708
- ]
709
- },
710
- {
711
- id: "bge-reranker-v2-m3",
712
- title: "BGE reranker v2 m3, 8-bit",
713
- languages: "over 100 languages \u2014 better than mmarco in the benchmark, about seven times slower",
714
- licence: "Apache-2.0 (BAAI's; the ONNX export declares none)",
715
- maxTokens: 512,
716
- onnx: "onnx/model_quantized.onnx",
717
- files: [
718
- {
719
- name: "onnx/model_quantized.onnx",
720
- url: bge("onnx/model_quantized.onnx"),
721
- sha256: "912fc1215c2dbff6499700534bd8d31253af01573861abbfc43afd1fab6cce5d",
722
- bytes: 570727094
723
- },
724
- {
725
- name: "tokenizer.json",
726
- url: bge("tokenizer.json"),
727
- sha256: "8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3",
728
- bytes: 17082900
729
- },
730
- {
731
- name: "tokenizer_config.json",
732
- url: bge("tokenizer_config.json"),
733
- sha256: "b87c8703482b0300d3da30e201519aa641f6a450f5eb5bf1e624afbf70c74d80",
734
- bytes: 1203
735
- }
736
- ]
737
- }
738
- ];
739
- var DEFAULT_RERANK_MODEL = "mmarco";
740
- var rerankModel = /* @__PURE__ */ __name((id2) => {
741
- const found = RERANK_MODELS.find((model) => model.id === id2);
742
- if (!found) {
743
- throw new CliError("validation_error", `no reranker ${id2} \u2014 one of: ${RERANK_MODELS.map((model) => model.id).join(", ")}`);
744
- }
745
- return found;
746
- }, "rerankModel");
747
- var vectorModelKey = /* @__PURE__ */ __name((model) => {
748
- const weights = model.custom ? model.files.find(({ name }) => name === model.onnx)?.sha256.slice(0, 12) : void 0;
749
- return `local:${model.id}${weights ? `@${weights}` : ""}:${model.dims}`;
750
- }, "vectorModelKey");
751
- var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
752
-
753
- // 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
754
- var closeSuggestion = strictObject({
755
- as: picklist(["done", "dismissed"]),
756
- /** The agent's name. */
757
- by: text,
758
- /** 0–1, as the agent rated it. */
759
- certainty: number(),
760
- reason: nullable(text),
761
- at: time
762
- });
763
- var task = strictObject({
764
- ref: reference,
765
- id,
766
- /** The readable key: `Q-15` for a task found in a message from now on, `IN1A2B3C4D-17` before, `HRB-12` in a project. */
767
- key: optional(nullable(text)),
768
- title: nullable(text),
769
- description: optional(nullable(text)),
770
- kind: picklist(TASK_TYPES),
771
- state: picklist(TASK_STATES),
772
- origin: optional(picklist(TASK_ORIGINS)),
773
- project: optional(nullable(text)),
774
- /** The project's key and name, as `tasks counts` names it. */
775
- project_key: optional(nullable(text)),
776
- project_name: optional(nullable(text)),
777
- /** Who added it: the owner, or an agent by its bot name. */
778
- created_by: optional(nullable(strictObject({ type: picklist(["person", "bot"]), id, name: nullable(text), owner: boolean() }))),
779
- account: optional(text),
780
- /** The chat it came from, as a `chat:` reference. */
781
- chat: optional(nullable(reference)),
782
- /** The message it came from. */
783
- source_message: optional(nullable(reference)),
784
- /** `<service>:<id>`, its id in an outside service, such as `avito:4512345678`. */
785
- external_id: optional(nullable(text)),
786
- /** The http or https page it is about, such as an Avito ad. */
787
- source_url: optional(nullable(text)),
788
- /** 0 to 1, higher first; `priority_label` reads it as low, medium, high or critical. */
789
- priority: optional(nullable(number())),
790
- priority_label: optional(nullable(picklist(PRIORITY_LABELS))),
791
- /** The agent working on it, apart from its assignees and its claim. */
792
- agent: optional(nullable(text)),
793
- /** Give it back with `--revision` to refuse a write made on a stale copy. */
794
- revision: optional(number()),
795
- assignments: optional(array(strictObject({ to: reference, role: picklist(["assignee", "reviewer", "watcher"]) }))),
796
- /** Open work whose blocked-by tasks are all done. */
797
- ready: optional(boolean()),
798
- /** The blocked-by tasks not done yet: open (any open state), dismissed, or unavailable. */
799
- blocked_by: optional(array(strictObject({ task: reference, state: picklist(["open", "dismissed", "unavailable"]) }))),
800
- parent: optional(nullable(reference)),
801
- due_at: optional(nullable(time)),
802
- closed_at: optional(nullable(time)),
803
- reason: optional(nullable(text)),
804
- /** One name from the category list (`tasks categories`). */
805
- category: optional(nullable(text)),
806
- /** Who works on it now, and until when; null when nobody does. */
807
- claimed_by: optional(nullable(text)),
808
- claimed_until: optional(nullable(time)),
809
- /** The close an agent would make, waiting on the owner: `tasks close` confirms it, `tasks reject` refuses it. */
810
- close_suggestion: optional(nullable(closeSuggestion)),
811
- created_at: time,
812
- updated_at: optional(time)
813
- });
814
-
815
- // 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
816
- var agendaChat = strictObject({
817
- chat: reference,
818
- title: nullable(text),
819
- kind: picklist(["dialog", "group", "channel", "saved", "unknown"]),
820
- /** The newest message, never its text; `null` while it is not stored. */
821
- last_message: nullable(reference),
822
- last_message_at: time,
823
- /** `null` when the newest message is not stored, or the messenger did not say who sent it. */
824
- last_from_owner: nullable(boolean()),
825
- /** Open tasks whose source is in this chat. */
826
- open_tasks: array(id),
827
- /** `unknown` means nothing ever fetched the chat's history; `partial` that the store holds only part of it. */
828
- completeness: strictObject({
829
- state: picklist(["complete", "partial", "unknown"]),
830
- up_to_date: nullable(boolean()),
831
- gaps: boolean(),
832
- reaches_start: boolean(),
833
- fetched_at: nullable(time)
834
- }),
835
- /** What the store holds of the chat: the count and the span, never the text. */
836
- held: strictObject({ messages: number(), oldest_at: nullable(time), newest_at: nullable(time) })
837
- });
838
- var agenda = strictObject({
839
- at: time,
840
- account: text,
841
- stored_at: nullable(time),
842
- /** The store saved nothing for a day: a chat may look quiet only because nothing was synced. */
843
- stale: boolean(),
844
- tasks: array(strictObject({
845
- id,
846
- key: text,
847
- title: nullable(text),
848
- kind: picklist(TASK_TYPES),
849
- category: nullable(text),
850
- /** The message or note it came from. */
851
- source: nullable(reference),
852
- due_at: nullable(time),
853
- next_check_at: nullable(time),
854
- /** Who works on it now; only the asker's own claims are listed unless the query names claimed:. */
855
- claimed_by: nullable(text),
856
- claimed_until: nullable(time),
857
- /** An agent's close waiting on the owner: `tasks close` confirms it, `tasks reject` refuses it. */
858
- close_suggestion: nullable(closeSuggestion),
859
- created_at: time,
860
- reasons: array(picklist(["overdue", "due", "check", "unplanned", "close-suggested"]))
861
- })),
862
- /** Someone else wrote last, and the owner has not answered. */
863
- owed: array(agendaChat),
864
- /** The owner wrote last, and nobody answered. */
865
- waiting: array(agendaChat),
866
- /** The chat list says these moved and their newest message is not stored: read them first. */
867
- unsynced: array(agendaChat),
868
- /** Open tasks someone else does: what they owe the owner, oldest first. */
869
- assigned: array(strictObject({
870
- id,
871
- key: text,
872
- title: nullable(text),
873
- kind: picklist(TASK_TYPES),
874
- category: nullable(text),
875
- source: nullable(reference),
876
- due_at: nullable(time),
877
- created_at: time,
878
- /** `person:<id>`, each one who does it. */
879
- assignees: array(reference)
880
- })),
881
- /** Open tasks carry these categories, which the list no longer holds: move them, or put the category back. */
882
- unlisted_categories: array(strictObject({ name: text, open_tasks: number() }))
883
- });
884
-
885
- // 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
886
- var attachment = strictObject({
887
- /** The message it came with, as a locator; absent inside that message. */
888
- message: optional(reference),
889
- /** Lower-cased: `photo`, `video`, `file`, `voice`… */
890
- kind: text,
891
- /** Its place among the message's attachments, from 1, as `attachments show --attachment` takes it. */
892
- position: optional(count),
893
- url: optional(text),
894
- name: optional(text),
895
- title: optional(text),
896
- mime: optional(text),
897
- size: optional(count),
898
- width: optional(count),
899
- height: optional(count),
900
- /** Seconds, for audio and video. */
901
- duration: optional(number()),
902
- /** The text read out of it; how it was read is `extraction`. */
903
- text: optional(text),
904
- extraction: optional(strictObject({ origin: text, extractor: text, chars: count, error: optional(text) })),
905
- local_path: optional(text),
906
- /** A shared contact card (`kind: "contact"`); the phone is the whole number as the sender put it. */
907
- contact: optional(strictObject({
908
- name: text,
909
- first_name: optional(text),
910
- last_name: optional(text),
911
- phone: optional(text),
912
- user_id: optional(id)
913
- })),
914
- /** A bot's keyboard under the message, row by row; `messages press` presses one. */
915
- buttons: optional(array(array(strictObject({
916
- kind: picklist(["callback", "link", "message", "chat", "contact", "location", "app", "clipboard", "other"]),
917
- text,
918
- url: optional(text)
919
- }))))
920
- });
921
- var hitFile = strictObject({
922
- position: count,
923
- kind: text,
924
- name: optional(text),
925
- size: optional(count),
926
- /** The saved copy on this computer, once `messages download` fetched it; absent until then. */
927
- local_path: optional(text)
928
- });
929
-
930
- // 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
931
- var conversation = strictObject({
932
- id,
933
- chat: reference,
934
- /** The message it starts with. */
935
- first_message: reference,
936
- started_at: time,
937
- ended_at: time,
938
- messages_count: count,
939
- /** How many people wrote in it. */
940
- senders_count: count,
941
- built_at: time,
942
- rules_version: count
943
- });
944
-
945
- // 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
946
- var tagging = strictObject({
947
- tag: text,
948
- type: picklist(TAG_TYPES),
949
- /** What carries it: a `chat:`, `contact:` or `msg:` reference. */
950
- target: reference,
951
- /** The chat's title or the person's name, as the store holds it. */
952
- name: nullable(text),
953
- /** Who claims it: `manual` the owner, `auto` the keyword rules; both when both do. */
954
- sources: array(picklist(["manual", "auto"])),
955
- created_at: time
956
- });
957
-
958
- // 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
959
- var DEADLINE_MARGIN_MS = 5e3;
960
- var DEADLINE_MARGIN_SHARE = 0.15;
961
- var DEFAULT_REQUEST_MS = 2e3;
962
- var deadlineMargin = /* @__PURE__ */ __name((deadline) => Math.max(DEADLINE_MARGIN_MS, deadline.ms * DEADLINE_MARGIN_SHARE), "deadlineMargin");
963
- var requestsFor = /* @__PURE__ */ __name((deadline, requestMs = DEFAULT_REQUEST_MS) => deadline === void 0 ? null : Math.max(1, Math.floor((deadline.ms - deadlineMargin(deadline)) / requestMs)), "requestsFor");
964
- var runBudget = /* @__PURE__ */ __name(({ requests, deadline, requestMs, signal, now = Date.now } = {}) => {
965
- const fits = requestsFor(deadline, requestMs);
966
- const limit = fits === null ? requests ?? null : Math.min(fits, requests ?? fits);
967
- const margin = deadline ? deadlineMargin(deadline) : 0;
968
- let used = 0;
969
- let stopped2 = null;
970
- let last;
971
- let slowest = 0;
972
- return {
973
- take() {
974
- if (stopped2)
975
- return stopped2;
976
- const at = now();
977
- if (last !== void 0)
978
- slowest = Math.max(slowest, at - last);
979
- if (signal?.aborted)
980
- stopped2 = "cancelled";
981
- else if (limit !== null && used >= limit)
982
- stopped2 = "requests";
983
- else if (deadline && at + margin + slowest >= deadline.endsAt)
984
- stopped2 = "deadline";
985
- if (stopped2)
986
- return stopped2;
987
- used += 1;
988
- last = at;
989
- return null;
990
- },
991
- get used() {
992
- return used;
993
- },
994
- limit,
995
- get stopped() {
996
- return stopped2;
997
- }
998
- };
999
- }, "runBudget");
1000
-
1001
- // 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
1002
- import { AsyncLocalStorage } from "node:async_hooks";
1003
- var sentIds = /* @__PURE__ */ __name((typed, message) => ({
1004
- messageId: message.id,
1005
- ...message.chatId && message.chatId !== typed ? { resultChatId: message.chatId } : {}
1006
- }), "sentIds");
1007
- var current = new AsyncLocalStorage();
1008
- var writesInFlight = new AsyncLocalStorage();
1009
- var parents = /* @__PURE__ */ new WeakMap();
1010
- var stopped = /* @__PURE__ */ new WeakMap();
1011
- var scopesFor = /* @__PURE__ */ __name((scope = writesInFlight.getStore()) => {
1012
- const result = [];
1013
- for (let at = scope; at; at = parents.get(at))
1014
- result.push(at);
1015
- return result;
1016
- }, "scopesFor");
1017
- var withWriteScope = /* @__PURE__ */ __name((scope, body) => {
1018
- const parent = writesInFlight.getStore();
1019
- if (parent && parent !== scope)
1020
- parents.set(scope, parent);
1021
- return writesInFlight.run(scope, body);
1022
- }, "withWriteScope");
1023
- var stopWrites = /* @__PURE__ */ __name((scope, reason) => {
1024
- stopped.set(scope, reason);
1025
- for (const write of scope)
1026
- write.cut();
1027
- }, "stopWrites");
1028
- var refuseStopped = /* @__PURE__ */ __name((scopes) => {
1029
- for (const scope of scopes)
1030
- if (stopped.has(scope))
1031
- throw stopped.get(scope);
1032
- }, "refuseStopped");
1033
- var currentOperation = /* @__PURE__ */ __name(() => current.getStore(), "currentOperation");
1034
- var guardedWrite = /* @__PURE__ */ __name(async (guard, attempt, act, settled = () => ({}), prepare) => {
1035
- const scopes = scopesFor();
1036
- refuseStopped(scopes);
1037
- try {
1038
- await guard.ask?.(attempt);
1039
- refuseStopped(scopes);
1040
- if (guard.reserve) {
1041
- guard.check(attempt, { reserve: false });
1042
- await guard.reserve(attempt);
1043
- } else
1044
- guard.check(attempt);
1045
- } catch (error) {
1046
- guard.record({ ...attempt, outcome: "refused", errorCode: codeOf(error) });
1047
- throw error;
1048
- }
1049
- try {
1050
- refuseStopped(scopes);
1051
- } catch (error) {
1052
- guard.record({ ...attempt, outcome: "failed", errorCode: codeOf(error) });
1053
- throw error;
1054
- }
1055
- let recorded = false;
1056
- const once = /* @__PURE__ */ __name((entry) => {
1057
- if (recorded)
1058
- return;
1059
- recorded = true;
1060
- guard.record(entry);
1061
- }, "once");
1062
- let cancelled = false;
1063
- const flight = {
1064
- operationId: attempt.operationId,
1065
- preparing: prepare !== void 0,
1066
- cut: /* @__PURE__ */ __name(() => {
1067
- cancelled = true;
1068
- once({
1069
- ...attempt,
1070
- outcome: flight.preparing ? "failed" : "outcome_unknown",
1071
- errorCode: flight.preparing ? "timeout" : "outcome_unknown"
1072
- });
1073
- }, "cut")
1074
- };
1075
- for (const scope of scopes)
1076
- scope.add(flight);
1077
- try {
1078
- if (prepare !== void 0)
1079
- await prepare();
1080
- if (cancelled)
1081
- throw new CliError("timeout", "the command ended before sending; nothing was sent", { sent: false });
1082
- flight.preparing = false;
1083
- const done = await current.run(attempt.operationId, act);
1084
- if (cancelled)
1085
- throw new CliError("outcome_unknown", "the command ended with a write in flight; check its result before continuing", { operation_id: attempt.operationId });
1086
- once({ ...attempt, ...settled(done), outcome: "sent" });
1087
- return done;
1088
- } catch (error) {
1089
- const code = codeOf(error);
1090
- once({ ...attempt, outcome: code === "outcome_unknown" ? "outcome_unknown" : "failed", errorCode: code });
1091
- if (code === "outcome_unknown" && error instanceof Error)
1092
- throw new CliError("outcome_unknown", error.message, {
1093
- ...error.details,
1094
- operation_id: attempt.operationId,
1095
- retryable: false
1096
- });
1097
- if (flight.preparing && isCliError(error) && error.details.sent === void 0)
1098
- throw new CliError(error.code, error.message, { ...error.details, sent: false });
1099
- throw error;
1100
- } finally {
1101
- for (const scope of scopes)
1102
- scope.delete(flight);
1103
- }
1104
- }, "guardedWrite");
1105
- var codeOf = /* @__PURE__ */ __name((error) => typeof error?.code === "string" ? error.code : "unknown", "codeOf");
1106
-
1107
- // 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
1108
- var HISTORY_MAX_DAYS = 1095;
1109
- var DEFAULT_HISTORY_LIMITS = { dialogDays: 1095, groupDays: 365, groupMembersMax: 50 };
1110
- var DAY_MS = 24 * 60 * 60 * 1e3;
1111
- var historyWindow = /* @__PURE__ */ __name((shape, limits, now) => {
1112
- const group = shape !== void 0 && shape.kind !== "dialog" && shape.kind !== "saved";
1113
- if (group && (shape.participantsCount ?? 0) > limits.groupMembersMax)
1114
- return { skip: "group_too_large", members: shape.participantsCount ?? 0 };
1115
- const days = group ? limits.groupDays : limits.dialogDays;
1116
- return { keepFrom: now - Math.min(days, HISTORY_MAX_DAYS) * DAY_MS };
1117
- }, "historyWindow");
1118
- var limitBatch = /* @__PURE__ */ __name((batch, shapes, included, limits, now = Date.now()) => {
1119
- const skipped = /* @__PURE__ */ new Map();
1120
- if (!batch.messages?.length)
1121
- return { batch, skipped };
1122
- const named = new Map((batch.chats ?? []).map((chat) => [chat.id, chat]));
1123
- const windows = /* @__PURE__ */ new Map();
1124
- const windowOf = /* @__PURE__ */ __name((chatId) => {
1125
- if (!windows.has(chatId)) {
1126
- const chat = named.get(chatId);
1127
- const shape = chat ? { kind: chat.kind, participantsCount: chat.participantsCount ?? null } : shapes(chatId);
1128
- windows.set(chatId, included(chatId) ? void 0 : historyWindow(shape, limits, now));
1129
- }
1130
- return windows.get(chatId);
1131
- }, "windowOf");
1132
- const messages = batch.messages.filter((message) => {
1133
- const window = windowOf(message.chatId);
1134
- if (window === void 0)
1135
- return true;
1136
- const at = Date.parse(message.timestamp);
1137
- if ("keepFrom" in window && !(at < window.keepFrom))
1138
- return true;
1139
- const reason = "skip" in window ? window.skip : "older_than_window";
1140
- const held = skipped.get(message.chatId);
1141
- const iso = new Date(at).toISOString();
1142
- skipped.set(message.chatId, {
1143
- reason,
1144
- messages: (held?.messages ?? 0) + 1,
1145
- oldestAt: held && held.oldestAt < iso ? held.oldestAt : iso,
1146
- newestAt: held && held.newestAt > iso ? held.newestAt : iso,
1147
- ..."skip" in window ? { members: window.members } : { keptFrom: new Date(window.keepFrom).toISOString() }
1148
- });
1149
- return false;
1150
- });
1151
- return { batch: { ...batch, messages }, skipped };
1152
- }, "limitBatch");
1153
-
1154
- // 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
1155
- import { join as join2 } from "node:path";
1156
- var clip = /* @__PURE__ */ __name((name) => `https://huggingface.co/Xenova/clip-vit-base-patch32/resolve/d15189d7028b43f1d3e65039190477f6af591c2a/${name}`, "clip");
1157
- var IMAGE_MODELS = [
1158
- {
1159
- id: "clip-b32",
1160
- title: "CLIP ViT-B/32, 8-bit",
1161
- languages: "English only: translate a query before searching",
1162
- licence: "MIT",
1163
- dims: 512,
1164
- key: "local:clip-b32:512",
1165
- maxTokens: 77,
1166
- vision: "onnx/vision_model_quantized.onnx",
1167
- text: "onnx/text_model_quantized.onnx",
1168
- files: [
1169
- {
1170
- name: "onnx/vision_model_quantized.onnx",
1171
- url: clip("onnx/vision_model_quantized.onnx"),
1172
- sha256: "583fd1110a514667812fee7d684952aaf82a99b959760c8d7dca7e0ab9839299",
1173
- bytes: 89117001
1174
- },
1175
- {
1176
- name: "onnx/text_model_quantized.onnx",
1177
- url: clip("onnx/text_model_quantized.onnx"),
1178
- sha256: "73baab855d406190da9faa498cfedf65f15cf309f4cc7385b7b032e6d08e5c3a",
1179
- bytes: 64504507
1180
- },
1181
- {
1182
- name: "tokenizer.json",
1183
- url: clip("tokenizer.json"),
1184
- sha256: "f7f3b7af117d467b58374797691a6438d3e6b9e9cef800dfd5dced7f697a90cd",
1185
- bytes: 2224119
1186
- },
1187
- {
1188
- name: "tokenizer_config.json",
1189
- url: clip("tokenizer_config.json"),
1190
- sha256: "60ba2912bc6344c94bc16bbdec27fa1209409167b6f2fdf3cfe9e65462ea3967",
1191
- bytes: 775
1192
- }
1193
- ]
1194
- }
1195
- ];
1196
- var DEFAULT_IMAGE_MODEL = "clip-b32";
1197
- var imageModel = /* @__PURE__ */ __name((id2) => {
1198
- const found = IMAGE_MODELS.find((model) => model.id === id2);
1199
- if (!found) {
1200
- throw new CliError("validation_error", `no image model ${id2} \u2014 one of: ${IMAGE_MODELS.map((model) => model.id).join(", ")}`);
1201
- }
1202
- return found;
1203
- }, "imageModel");
1204
- var imageModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("image", env), "imageModelsDirectory");
1205
- var placedImage = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join2(directory, model.id, file.name)]), "placedImage");
1206
- var isImageModelInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placedImage(model, directory)), "isImageModelInstalled");
1207
-
1208
- // 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
1209
- var WEIGHTS = {
1210
- bot: 3,
1211
- scam: 3,
1212
- fake: 3,
1213
- deleted: 1,
1214
- no_photo: 1,
1215
- no_username: 1,
1216
- odd_name: 1,
1217
- never_wrote: 1,
1218
- link_first: 2,
1219
- burst_join: 1,
1220
- mass_invited: 1,
1221
- new_account: 2,
1222
- no_bio: 1,
1223
- same_text: 2,
1224
- photo_recent: 1,
1225
- cas_banned: 3,
1226
- lols_banned: 3,
1227
- lols_scammer: 3
1228
- };
1229
- var LINK = /https?:\/\/|t\.me\/|www\./i;
1230
- var DIGITS = /\d{5,}/;
1231
- var oddName = /* @__PURE__ */ __name((name) => !name?.trim() || DIGITS.test(name) || LINK.test(name), "oddName");
1232
-
1233
- // 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
1234
- var progressOf = /* @__PURE__ */ __name((input) => {
1235
- const total = input.total ?? null;
1236
- const updated = input.updatedAt ?? null;
1237
- return {
1238
- job: input.job,
1239
- profile: input.profile,
1240
- done: input.done,
1241
- total,
1242
- remaining: total === null ? null : Math.max(0, total - input.done),
1243
- state: input.complete ?? (total !== null && input.done >= total) ? "complete" : "partial",
1244
- updated_at: updated,
1245
- cursor_age_ms: updated === null ? null : Math.max(0, (input.now ?? /* @__PURE__ */ new Date()).getTime() - Date.parse(updated))
1246
- };
1247
- }, "progressOf");
1248
-
1249
- export {
1250
- LEVELS,
1251
- skipFlagFor,
1252
- DEFAULT_PERMISSIONS,
1253
- KEYED_UNDER_HOUSEKEEPING,
1254
- AUTHORITY_KEY,
1255
- authorityAllowed,
1256
- BOT_API_KEY,
1257
- isBotApi,
1258
- botApiAllowed,
1259
- RESOURCES,
1260
- layerPermissions,
1261
- CEILING_KEY,
1262
- levelFor,
1263
- keyForWrite,
1264
- writeOfKey,
1265
- WRITE_KEYS,
1266
- readKeysForCommand,
1267
- keyForCommand,
1268
- RESOURCE_KEY,
1269
- COMMAND_PATH_KEY,
1270
- permissionOverrides,
1271
- assertOverridesTighten,
1272
- assertRetentionEvidenceRead,
1273
- closeSuggestion,
1274
- task,
1275
- agenda,
1276
- attachment,
1277
- hitFile,
1278
- WEIGHTS,
1279
- LINK,
1280
- oddName,
1281
- conversation,
1282
- progressOf,
1283
- tagging,
1284
- runBudget,
1285
- sentIds,
1286
- withWriteScope,
1287
- stopWrites,
1288
- currentOperation,
1289
- guardedWrite,
1290
- codeOf,
1291
- parseDuration,
1292
- DEFAULT_TEXT_MODEL,
1293
- PREVIOUS_DEFAULT_TEXT_MODEL,
1294
- CustomTextModelShape,
1295
- textModelsFile,
1296
- readTextModelsSection,
1297
- writeTextModelsSection,
1298
- textModels,
1299
- textModel,
1300
- chosenTextModel,
1301
- RERANK_MODELS,
1302
- DEFAULT_RERANK_MODEL,
1303
- rerankModel,
1304
- vectorModelKey,
1305
- meaningFloor,
1306
- HISTORY_MAX_DAYS,
1307
- DEFAULT_HISTORY_LIMITS,
1308
- historyWindow,
1309
- limitBatch,
1310
- IMAGE_MODELS,
1311
- DEFAULT_IMAGE_MODEL,
1312
- imageModel,
1313
- imageModelsDirectory,
1314
- placedImage,
1315
- isImageModelInstalled
1316
- };