@wirecat/drive-cli 0.62.0 → 0.64.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 (150) hide show
  1. package/README.md +2 -1
  2. package/dist/bin/drive.js +2 -2
  3. package/dist/bundle/{all-profiles-CKD2DWUK.js → all-profiles-BPPT2AK5.js} +13 -14
  4. package/dist/bundle/{anthropic-E3T4USLA.js → anthropic-JW6GOJUD.js} +13 -11
  5. package/dist/bundle/{app-server-JB2AEWWL.js → app-server-KAQIOJMZ.js} +53 -54
  6. package/dist/bundle/{bun-CC44AAND.js → bun-UT7GNTPV.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-AUMFKYVR.js → bun-sqlite-2OIVV3LS.js} +8 -8
  8. package/dist/bundle/{chunk-EOOGWUTP.js → chunk-2FEZ24DK.js} +10 -10
  9. package/dist/bundle/{chunk-N7OZPKU7.js → chunk-2W464HAE.js} +4 -4
  10. package/dist/bundle/{chunk-UGXN5D7U.js → chunk-34BIDKF4.js} +332 -430
  11. package/dist/bundle/{chunk-WZKEU7WR.js → chunk-36GPBPWM.js} +1 -1
  12. package/dist/bundle/{chunk-LQKD257P.js → chunk-3J5KAFNA.js} +2255 -1125
  13. package/dist/bundle/{chunk-7W5HYGVW.js → chunk-3NULZGQU.js} +2 -2
  14. package/dist/bundle/{chunk-XFRRKZHQ.js → chunk-46CD64J2.js} +155 -36
  15. package/dist/bundle/{chunk-DWJHL6DV.js → chunk-4CNTID2X.js} +4 -4
  16. package/dist/bundle/{chunk-LWE4JGRN.js → chunk-4YRENUB5.js} +2 -2
  17. package/dist/bundle/{chunk-SW4I5BR7.js → chunk-5HSRQ53R.js} +2 -2
  18. package/dist/bundle/{chunk-IR4SQLBR.js → chunk-5OFA5EXE.js} +2 -2
  19. package/dist/bundle/{chunk-R347FPYU.js → chunk-5ZBR55US.js} +1 -1
  20. package/dist/bundle/{chunk-Q2LRPOKL.js → chunk-66AF4FBW.js} +4 -4
  21. package/dist/bundle/{chunk-RWSXVCSG.js → chunk-6B37XO6B.js} +23 -5
  22. package/dist/bundle/{chunk-ZMOUUOT2.js → chunk-6G53ZFUT.js} +1 -1
  23. package/dist/bundle/{chunk-HCNQT3QE.js → chunk-AHB4OJCI.js} +1951 -580
  24. package/dist/bundle/{chunk-JK3U25QZ.js → chunk-B67BLRAI.js} +59 -1
  25. package/dist/bundle/{chunk-7ZXIWZQ6.js → chunk-B7XBIOMR.js} +12 -12
  26. package/dist/bundle/{chunk-FEZF3TII.js → chunk-BDYWZ7JE.js} +50 -6
  27. package/dist/bundle/{chunk-SVPCHFKI.js → chunk-BEUAICUD.js} +2 -2
  28. package/dist/bundle/{chunk-TDX4GZFO.js → chunk-BEZJA44H.js} +7 -7
  29. package/dist/bundle/{chunk-RIDQNVZM.js → chunk-BZ2ZKILM.js} +3 -3
  30. package/dist/bundle/{chunk-FUITWY7O.js → chunk-C7WBNOYW.js} +1 -1
  31. package/dist/bundle/{chunk-CJHY5YIF.js → chunk-CPMRM3GQ.js} +489 -210
  32. package/dist/bundle/{chunk-FNWIJ6EJ.js → chunk-DD7EFG6B.js} +2 -2
  33. package/dist/bundle/{chunk-W4RTIL7S.js → chunk-E2LBCCTG.js} +5 -5
  34. package/dist/bundle/{chunk-O2XOX4HB.js → chunk-EC2XGDKJ.js} +50 -34
  35. package/dist/bundle/{chunk-4OSSOWDM.js → chunk-EJ4PNHPP.js} +1 -1
  36. package/dist/bundle/{chunk-XS5POQST.js → chunk-EQEGJVO2.js} +1 -1
  37. package/dist/bundle/{chunk-U2BFYSQV.js → chunk-EWGVDFPT.js} +8983 -3343
  38. package/dist/bundle/{chunk-OBH5BA62.js → chunk-EZ6O3ST3.js} +3 -3
  39. package/dist/bundle/{chunk-HG6CAYJH.js → chunk-F2VDAG32.js} +3 -3
  40. package/dist/bundle/{chunk-RPMKG63Z.js → chunk-G3NULXOM.js} +4 -4
  41. package/dist/bundle/{chunk-OD4U7GUY.js → chunk-G4KEKKDE.js} +20 -20
  42. package/dist/bundle/{chunk-OTROVC4E.js → chunk-GSMYXGFR.js} +1 -1
  43. package/dist/bundle/{chunk-XZUS7XRO.js → chunk-GW3U6OLD.js} +1 -1
  44. package/dist/bundle/{chunk-6EY46GAN.js → chunk-HW4UPST2.js} +2 -2
  45. package/dist/bundle/{chunk-2HF2MRXI.js → chunk-IDAK4DDK.js} +1 -1
  46. package/dist/bundle/{chunk-27YUUGXQ.js → chunk-IK6KH3RE.js} +1 -1
  47. package/dist/bundle/{chunk-QTI6IVHZ.js → chunk-IX7NQJLY.js} +8 -8
  48. package/dist/bundle/{chunk-YMWENGKH.js → chunk-J62DI53V.js} +1 -1
  49. package/dist/bundle/{chunk-AH5C3D3D.js → chunk-JRXFW7HE.js} +5 -5
  50. package/dist/bundle/{chunk-KLFSRKHB.js → chunk-K6BSB53R.js} +1 -1
  51. package/dist/bundle/{chunk-ONP2IBHY.js → chunk-KE4XPPRQ.js} +98 -81
  52. package/dist/bundle/{chunk-UQLWMGSD.js → chunk-KG2XKEHL.js} +5 -5
  53. package/dist/bundle/{chunk-T5NWWXS2.js → chunk-KIN6PDFE.js} +24 -2
  54. package/dist/bundle/{chunk-QH7DOVO3.js → chunk-KVW4XNKB.js} +45 -29
  55. package/dist/bundle/{chunk-PEQA6LA5.js → chunk-LOMW6F2E.js} +230 -236
  56. package/dist/bundle/{chunk-4SIZEJ3M.js → chunk-M73NNJ3X.js} +2 -2
  57. package/dist/bundle/{chunk-QCKZ3GAA.js → chunk-N622LRPM.js} +4 -4
  58. package/dist/bundle/{chunk-YPFUYQDP.js → chunk-O2QO5UZC.js} +13 -13
  59. package/dist/bundle/{chunk-QCX6XZLA.js → chunk-OEVHZOHC.js} +12 -12
  60. package/dist/bundle/{chunk-VAYB52HF.js → chunk-OH3K2E7X.js} +402 -184
  61. package/dist/bundle/{chunk-YXYTY4GF.js → chunk-P7DEGRZA.js} +21 -21
  62. package/dist/bundle/{chunk-YUWPNG7B.js → chunk-PBMSBCVB.js} +1 -1
  63. package/dist/bundle/{chunk-67ZQCWBV.js → chunk-QEAD2LF4.js} +3 -3
  64. package/dist/bundle/{chunk-JN5TVEEL.js → chunk-QXCKJUZY.js} +124 -22
  65. package/dist/bundle/{chunk-T7X53FCJ.js → chunk-SIOIMO62.js} +37 -37
  66. package/dist/bundle/{chunk-O7ALBI2I.js → chunk-TNV2FXVK.js} +5 -5
  67. package/dist/bundle/chunk-UD55VB2N.js +87 -0
  68. package/dist/bundle/{chunk-L7K2MOIC.js → chunk-UIEA6FIV.js} +22 -22
  69. package/dist/bundle/{chunk-EW7PKB4M.js → chunk-UJR272CP.js} +29 -29
  70. package/dist/bundle/{chunk-YALI4C7C.js → chunk-USLZE36C.js} +6 -6
  71. package/dist/bundle/{chunk-YOJDGAPT.js → chunk-VIJ6ACYB.js} +8 -8
  72. package/dist/bundle/{chunk-MN4VXU3M.js → chunk-VPLFD5RJ.js} +4 -4
  73. package/dist/bundle/{chunk-VQDD64A4.js → chunk-VT2UFYPJ.js} +8 -10
  74. package/dist/bundle/{chunk-CZ2GJHLL.js → chunk-WWCYTMAV.js} +2 -2
  75. package/dist/bundle/{chunk-DJOAMGF4.js → chunk-XPXKD63J.js} +13 -13
  76. package/dist/bundle/{chunk-E43ENLJJ.js → chunk-ZF6GUZCE.js} +1 -1
  77. package/dist/bundle/{chunk-XEW2EN6F.js → chunk-ZRZ4HTCK.js} +60 -34
  78. package/dist/bundle/{chunk-2KN35F32.js → chunk-ZSZJLJIA.js} +10 -10
  79. package/dist/bundle/command-contract-H5OYJOPF.js +38 -0
  80. package/dist/bundle/{decode-WIIX3Y2X.js → decode-HTOQ6S3V.js} +8 -8
  81. package/dist/bundle/{dispatch-GEFIXA6X.js → dispatch-SH5SP6LA.js} +11 -11
  82. package/dist/bundle/drive.js +11 -11
  83. package/dist/bundle/{echarts-OYINM4C4.js → echarts-KFHB6SLX.js} +2 -2
  84. package/dist/bundle/{embed-DWZIYMBX.js → embed-YATFB2PN.js} +9 -9
  85. package/dist/bundle/{embedder-ILWH7ZRM.js → embedder-MQPDFGTJ.js} +12 -12
  86. package/dist/bundle/entry-YZBB647C.js +22 -0
  87. package/dist/bundle/{failure-GV77W3CD.js → failure-4FQL4XJI.js} +4 -4
  88. package/dist/bundle/first-run-5JT3UQZB.js +30 -0
  89. package/dist/bundle/first-screen-BEMDEWO7.js +36 -0
  90. package/dist/bundle/{google-KLZSUAVY.js → google-DVADVICN.js} +13 -13
  91. package/dist/bundle/{google-api-HZQ5R4ZO.js → google-api-QMFGCXBM.js} +55 -57
  92. package/dist/bundle/grants-WKB2E4TA.js +103 -0
  93. package/dist/bundle/{identity-J2DON4IO.js → identity-FYVDK4M2.js} +6 -6
  94. package/dist/bundle/{instructions-HGOJ23AJ.js → instructions-D3GF3B7M.js} +1 -1
  95. package/dist/bundle/{login-BD2TS4GY.js → login-COFZ2IWP.js} +61 -63
  96. package/dist/bundle/{mcp-GWDA3HOA.js → mcp-RKJG22KM.js} +2 -2
  97. package/dist/bundle/{node-CPKTDPH7.js → node-OFICOKX3.js} +2 -2
  98. package/dist/bundle/{node-sqlite-IXDCRLSX.js → node-sqlite-DNBTDOXD.js} +9 -9
  99. package/dist/bundle/oauth-PDQHWFBF.js +22 -0
  100. package/dist/bundle/{open-O7P3ZV3Y.js → open-PTPR2YWX.js} +8 -8
  101. package/dist/bundle/{openai-RCFQKCXC.js → openai-2KV5LUW4.js} +17 -17
  102. package/dist/bundle/{process-KXDRJO22.js → process-EAW6NST2.js} +1 -1
  103. package/dist/bundle/{program-UCHFC7JQ.js → program-6UV5Q5YN.js} +310 -279
  104. package/dist/bundle/prompt-634TPMJK.js +19 -0
  105. package/dist/bundle/{reasons-57J2D77K.js → reasons-DDWCEYSQ.js} +5 -5
  106. package/dist/bundle/{recognize-MRCYGP2J.js → recognize-SJO6QUDW.js} +7 -7
  107. package/dist/bundle/{remote-L3L4PHKF.js → remote-6JXZITKF.js} +10 -10
  108. package/dist/bundle/{rerank-PSOE6XFT.js → rerank-MD5VOPQ6.js} +10 -10
  109. package/dist/bundle/{serve-72OGS3BF.js → serve-LZTROA2M.js} +12 -12
  110. package/dist/bundle/server-GT7X666D.js +69 -0
  111. package/dist/bundle/{server-SCXKYHBO.js → server-NSA3UAFY.js} +43 -44
  112. package/dist/bundle/{services-YAFTELBI.js → services-F5A6XQCV.js} +69 -34
  113. package/dist/bundle/{sqlite-runtime-DLK4SU33.js → sqlite-runtime-7YF6REKS.js} +9 -9
  114. package/dist/bundle/{start-AFFA3LKM.js → start-MUFLE6FA.js} +30 -8
  115. package/dist/bundle/{state-T5VNAJSZ.js → state-UC54F3YZ.js} +9 -9
  116. package/dist/bundle/{store-4OFK7PKQ.js → store-F5FJGWMR.js} +58 -20
  117. package/dist/bundle/{store-R6MSY2IM.js → store-J53YNAH6.js} +43 -18
  118. package/dist/bundle/store-maintenance-command-GJVXLBAB.js +58 -0
  119. package/dist/bundle/tokens-H2EJKGA5.js +101 -0
  120. package/dist/commands/account.d.ts +4 -0
  121. package/dist/commands/account.d.ts.map +1 -0
  122. package/dist/commands/account.js +33 -0
  123. package/dist/commands/account.js.map +1 -0
  124. package/dist/commands/config.d.ts.map +1 -1
  125. package/dist/commands/config.js +5 -1
  126. package/dist/commands/config.js.map +1 -1
  127. package/dist/profile-lock.d.ts +1 -0
  128. package/dist/profile-lock.d.ts.map +1 -1
  129. package/dist/profile-lock.js +1 -0
  130. package/dist/profile-lock.js.map +1 -1
  131. package/dist/program.d.ts.map +1 -1
  132. package/dist/program.js +2 -0
  133. package/dist/program.js.map +1 -1
  134. package/dist/version.d.ts +1 -1
  135. package/dist/version.js +1 -1
  136. package/package.json +3 -3
  137. package/dist/bundle/chunk-AQVUEZEP.js +0 -22
  138. package/dist/bundle/chunk-DRZZBN3V.js +0 -33
  139. package/dist/bundle/chunk-UOXOLGNG.js +0 -42
  140. package/dist/bundle/command-contract-OB5BRABN.js +0 -39
  141. package/dist/bundle/entry-V5V3TOTY.js +0 -22
  142. package/dist/bundle/first-run-V3VVLQF4.js +0 -30
  143. package/dist/bundle/first-screen-Y3RIN7FU.js +0 -37
  144. package/dist/bundle/grants-L7XLHLUT.js +0 -105
  145. package/dist/bundle/oauth-HOGY4YBB.js +0 -22
  146. package/dist/bundle/prompt-EVPPBN5W.js +0 -17
  147. package/dist/bundle/server-C5TGNFXW.js +0 -70
  148. package/dist/bundle/store-maintenance-command-QDMCXGV6.js +0 -60
  149. package/dist/bundle/tokens-HIG36RNS.js +0 -103
  150. /package/dist/bundle/{chunk-ZQ3GWKDQ.js → chunk-SW6C6WH5.js} +0 -0
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  filesPresent,
5
5
  sharedModelsDirectory
6
- } from "./chunk-Q2LRPOKL.js";
6
+ } from "./chunk-66AF4FBW.js";
7
7
  import {
8
8
  PRIORITY_LABELS,
9
9
  TAG_TYPES,
@@ -14,47 +14,70 @@ import {
14
14
  id,
15
15
  text,
16
16
  time
17
- } from "./chunk-CJHY5YIF.js";
17
+ } from "./chunk-CPMRM3GQ.js";
18
+ import {
19
+ readSharedSection,
20
+ sharedConfigPath,
21
+ writeSharedSection
22
+ } from "./chunk-BEZJA44H.js";
23
+ import {
24
+ storePath
25
+ } from "./chunk-DD7EFG6B.js";
18
26
  import {
19
27
  createRecordLog,
20
28
  resolvePaths,
21
29
  writeSecurely
22
- } from "./chunk-OD4U7GUY.js";
30
+ } from "./chunk-G4KEKKDE.js";
23
31
  import {
24
32
  traceIdOf
25
- } from "./chunk-6EY46GAN.js";
33
+ } from "./chunk-HW4UPST2.js";
26
34
  import {
27
35
  array,
28
36
  boolean,
37
+ check,
38
+ getDotPath,
39
+ integer,
40
+ maxLength,
41
+ maxValue,
42
+ minLength,
43
+ minValue,
29
44
  nullable,
30
45
  number,
31
46
  optional,
32
47
  picklist,
48
+ pipe,
49
+ record,
33
50
  reference,
34
- strictObject
35
- } from "./chunk-FEZF3TII.js";
51
+ regex,
52
+ safeParse,
53
+ startsWith,
54
+ strictObject,
55
+ string,
56
+ trim,
57
+ url
58
+ } from "./chunk-BDYWZ7JE.js";
36
59
  import {
37
60
  CliError,
38
61
  isCliError
39
- } from "./chunk-4OSSOWDM.js";
62
+ } from "./chunk-EJ4PNHPP.js";
40
63
  import {
41
64
  __name
42
65
  } from "./chunk-ZVVMGPBJ.js";
43
66
 
44
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/runs/scope.js
67
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/runs/scope.js
45
68
  import { AsyncLocalStorage } from "node:async_hooks";
46
69
  import { randomBytes } from "node:crypto";
47
70
 
48
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/runs/run.js
71
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/runs/run.js
49
72
  import { randomUUID } from "node:crypto";
50
73
  import { appendFileSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
51
74
  import { userInfo } from "node:os";
52
75
  import { join, sep } from "node:path";
53
76
 
54
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/runs/log-keys.js
77
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/runs/log-keys.js
55
78
  var snake = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
56
79
  var camel = /* @__PURE__ */ __name((key) => key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase()), "camel");
57
- var renamed = /* @__PURE__ */ __name((record, name) => Object.fromEntries(Object.entries(record).map(([key, value]) => [name(key), value])), "renamed");
80
+ var renamed = /* @__PURE__ */ __name((record2, name) => Object.fromEntries(Object.entries(record2).map(([key, value]) => [name(key), value])), "renamed");
58
81
  var logAttributes = /* @__PURE__ */ __name((event) => renamed(event, snake), "logAttributes");
59
82
  var fromLogAttributes = /* @__PURE__ */ __name((attributes) => renamed(attributes, camel), "fromLogAttributes");
60
83
  var snakeLogger = /* @__PURE__ */ __name((logger) => ({
@@ -64,7 +87,7 @@ var snakeLogger = /* @__PURE__ */ __name((logger) => ({
64
87
  error: /* @__PURE__ */ __name((event, message) => logger.error(logAttributes(event), message), "error")
65
88
  }), "snakeLogger");
66
89
 
67
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/runs/log-attributes.js
90
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/runs/log-attributes.js
68
91
  var diagnostic = {
69
92
  event: true,
70
93
  operation: true,
@@ -134,7 +157,7 @@ var LOG_ATTRIBUTES = [
134
157
  ...new Set([...Object.keys(diagnostic), ...Object.keys(send), ...background, ...crash, ...dropped].map((key) => Object.keys(logAttributes({ [key]: true }))[0]))
135
158
  ].sort();
136
159
 
137
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/runs/run.js
160
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/runs/run.js
138
161
  var KEEP_RUNS_FOR_DAYS = 30;
139
162
  var KEEP_SUCCESSFUL_RUNS_FOR_DAYS = 7;
140
163
  var RUNS_SIZE_LIMIT_MB = 200;
@@ -250,8 +273,8 @@ var runtime = /* @__PURE__ */ __name(() => {
250
273
  }, "runtime");
251
274
  var newRunId = /* @__PURE__ */ __name((startedAt, command) => {
252
275
  const stamp = startedAt.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
253
- const slug = command.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
254
- return `${stamp}-${slug}-${randomUUID().slice(0, 6)}`;
276
+ const slug2 = command.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
277
+ return `${stamp}-${slug2}-${randomUUID().slice(0, 6)}`;
255
278
  }, "newRunId");
256
279
  var INDEX = "index.jsonl";
257
280
  var appendIndex = /* @__PURE__ */ __name((dayDir, written) => {
@@ -487,7 +510,7 @@ var metadataOf = /* @__PURE__ */ __name((parsed) => {
487
510
  };
488
511
  }, "metadataOf");
489
512
 
490
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/runs/scope.js
513
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/runs/scope.js
491
514
  var scopes = new AsyncLocalStorage();
492
515
  var processScope;
493
516
  var currentRun = /* @__PURE__ */ __name(() => {
@@ -504,7 +527,7 @@ var currentRun = /* @__PURE__ */ __name(() => {
504
527
  }, "currentRun");
505
528
  var inRun = /* @__PURE__ */ __name((scope, body) => scopes.run(scope, body), "inRun");
506
529
  var runEvent = /* @__PURE__ */ __name((event) => scopes.getStore()?.events?.(event), "runEvent");
507
- var typedCommand = /* @__PURE__ */ __name((tool, words, profile = currentRun().profile) => [tool, profile, words].filter((part) => part !== void 0 && part !== "").join(" "), "typedCommand");
530
+ var typedCommand = /* @__PURE__ */ __name((tool, words2, profile = currentRun().profile) => [tool, profile, words2].filter((part) => part !== void 0 && part !== "").join(" "), "typedCommand");
508
531
  var useAsProcessRun = /* @__PURE__ */ __name((scope) => {
509
532
  processScope = scope;
510
533
  }, "useAsProcessRun");
@@ -523,7 +546,7 @@ var attempts = new AsyncLocalStorage();
523
546
  var withAttempt = /* @__PURE__ */ __name((attempt, work) => attempts.run(attempt, work), "withAttempt");
524
547
  var currentAttempt = /* @__PURE__ */ __name(() => attempts.getStore(), "currentAttempt");
525
548
 
526
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/domain/duration.js
549
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/duration.js
527
550
  var DURATION = /^(\d+)(ms|s|m|h|d)$/;
528
551
  var UNIT_MS = { ms: 1, s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
529
552
  var parseDuration = /* @__PURE__ */ __name((value, source) => {
@@ -537,7 +560,269 @@ var parseDuration = /* @__PURE__ */ __name((value, source) => {
537
560
  return ms;
538
561
  }, "parseDuration");
539
562
 
540
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/sends/permissions.js
563
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/embeddings/models.js
564
+ var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
565
+ var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
566
+ var e5Large = huggingFace("Xenova/multilingual-e5-large", "00fc3aeb3dbb95842de2ac1961d33c6319acf57b");
567
+ var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
568
+ var TEXT_MODELS = [
569
+ {
570
+ id: "e5-small",
571
+ title: "multilingual-e5-small, 8-bit",
572
+ size: "small",
573
+ languages: "about 100 languages, Russian and English among them",
574
+ licence: "MIT",
575
+ dims: 384,
576
+ maxTokens: 512,
577
+ // 100k-message corpus, one 8-thread session on Ryzen AI 9 HX 470: 31–32 chunks/s.
578
+ chunksPerSecond: 31,
579
+ pooling: "mean",
580
+ prefix: { query: "query: ", passage: "passage: " },
581
+ onnx: "onnx/model_quantized.onnx",
582
+ files: [
583
+ {
584
+ name: "onnx/model_quantized.onnx",
585
+ url: e5("onnx/model_quantized.onnx"),
586
+ sha256: "f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193",
587
+ bytes: 118308185
588
+ },
589
+ {
590
+ name: "tokenizer.json",
591
+ url: e5("tokenizer.json"),
592
+ sha256: "0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39",
593
+ bytes: 17082730
594
+ },
595
+ {
596
+ name: "tokenizer_config.json",
597
+ url: e5("tokenizer_config.json"),
598
+ sha256: "a1d6bc8734a6f635dc158508bef000f8e2e5a759c7d92f984b2c86e5ff53425b",
599
+ bytes: 443
600
+ }
601
+ ]
602
+ },
603
+ {
604
+ id: "embeddinggemma",
605
+ title: "EmbeddingGemma 300M, 4-bit",
606
+ size: "medium",
607
+ languages: "over 100 languages \u2014 the best of the two on chat, about seven times slower",
608
+ licence: "Gemma Terms of Use",
609
+ terms: "https://ai.google.dev/gemma/terms",
610
+ dims: 768,
611
+ maxTokens: 2048,
612
+ chunksPerSecond: 2,
613
+ pooling: "sentence_embedding",
614
+ prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
615
+ onnx: "onnx/model_q4.onnx",
616
+ externalData: "onnx/model_q4.onnx_data",
617
+ files: [
618
+ {
619
+ name: "onnx/model_q4.onnx",
620
+ url: gemma("onnx/model_q4.onnx"),
621
+ sha256: "ad1dfee81a70f7944b9b9d1cc6e48075b832881cf33fab2f2b248be78f3f0043",
622
+ bytes: 519322
623
+ },
624
+ {
625
+ name: "onnx/model_q4.onnx_data",
626
+ url: gemma("onnx/model_q4.onnx_data"),
627
+ sha256: "599962c3143b040de2dd05e5975be3e9091dd067cacc6a8f7186e3203bab9e02",
628
+ bytes: 196725760
629
+ },
630
+ {
631
+ name: "tokenizer.json",
632
+ url: gemma("tokenizer.json"),
633
+ sha256: "4dda02faaf32bc91031dc8c88457ac272b00c1016cc679757d1c441b248b9c47",
634
+ bytes: 20323312
635
+ },
636
+ {
637
+ name: "tokenizer_config.json",
638
+ url: gemma("tokenizer_config.json"),
639
+ sha256: "3ca953eea6c3c9fcda9cf3df22949ff18b216f7c74bd6459230f3f1013953f3a",
640
+ bytes: 1156830
641
+ }
642
+ ]
643
+ },
644
+ {
645
+ id: "e5-large",
646
+ title: "multilingual-e5-large, 8-bit",
647
+ size: "large",
648
+ languages: "about 100 languages, Russian and English among them \u2014 reads better than e5-small, several times slower",
649
+ licence: "MIT",
650
+ dims: 1024,
651
+ maxTokens: 512,
652
+ // 2026-11-07, one 8-thread session on the Ryzen AI 9 HX 470 while other benchmarks ran: 3.4 chunks/s.
653
+ chunksPerSecond: 4,
654
+ pooling: "mean",
655
+ prefix: { query: "query: ", passage: "passage: " },
656
+ onnx: "onnx/model_quantized.onnx",
657
+ files: [
658
+ {
659
+ name: "onnx/model_quantized.onnx",
660
+ url: e5Large("onnx/model_quantized.onnx"),
661
+ sha256: "0a8d65db9a36f810ba5da15249f13145fcdc7890e6656f1fd38cd8b7c4db1fca",
662
+ bytes: 561768762
663
+ },
664
+ {
665
+ name: "tokenizer.json",
666
+ url: e5Large("tokenizer.json"),
667
+ sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
668
+ bytes: 17082660
669
+ },
670
+ {
671
+ name: "tokenizer_config.json",
672
+ url: e5Large("tokenizer_config.json"),
673
+ sha256: "efb5c0d09722e5fe59a462cd2a9976ee216d55b037597d997cd3fe833216da15",
674
+ bytes: 418
675
+ }
676
+ ]
677
+ }
678
+ ];
679
+ var DEFAULT_TEXT_MODEL = "e5-small";
680
+ var SECTION = "text_models";
681
+ var slug = pipe(string(), regex(/^[a-z0-9][a-z0-9._-]{0,62}$/, "is not a model id: a-z, 0-9, . _ -"));
682
+ var words = pipe(string(), trim(), minLength(1), maxLength(300));
683
+ 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"));
684
+ var modelFile = strictObject({
685
+ name: fileName,
686
+ url: pipe(string(), url(), startsWith("https://", "has to be an https address")),
687
+ sha256: pipe(string(), regex(/^[0-9a-f]{64}$/, "has to be a sha256 in hex")),
688
+ bytes: pipe(number(), integer(), minValue(1))
689
+ });
690
+ var CustomTextModelShape = pipe(strictObject({
691
+ id: slug,
692
+ title: words,
693
+ languages: words,
694
+ licence: words,
695
+ terms: optional(pipe(string(), url())),
696
+ dims: pipe(number(), integer(), minValue(1), maxValue(8192)),
697
+ maxTokens: pipe(number(), integer(), minValue(16), maxValue(32768)),
698
+ chunksPerSecond: optional(pipe(number(), minValue(0.01))),
699
+ pooling: picklist(["mean", "sentence_embedding"]),
700
+ prefix: strictObject({
701
+ query: pipe(string(), maxLength(200)),
702
+ passage: pipe(string(), maxLength(200))
703
+ }),
704
+ onnx: fileName,
705
+ externalData: optional(fileName),
706
+ files: pipe(array(modelFile), minLength(1), maxLength(16))
707
+ }), check((model) => !TEXT_MODELS.some((one) => one.id === model.id), "takes the id of a model this version ships; choose another"), check((model) => {
708
+ const names = model.files.map(({ name }) => name);
709
+ return [model.onnx, model.externalData, "tokenizer.json", "tokenizer_config.json"].every((name) => name === void 0 || names.includes(name));
710
+ }, "has to list its onnx file, its external data and tokenizer.json and tokenizer_config.json among files"));
711
+ var TextModelsSection = strictObject({
712
+ use: optional(slug),
713
+ custom: optional(array(CustomTextModelShape))
714
+ });
715
+ var textModelsFile = /* @__PURE__ */ __name((env = process.env) => sharedConfigPath(storePath(env), env), "textModelsFile");
716
+ var readTextModelsSection = /* @__PURE__ */ __name((env = process.env) => {
717
+ const path = textModelsFile(env);
718
+ const section = readSharedSection(path, SECTION);
719
+ if (section === void 0)
720
+ return {};
721
+ const checked = safeParse(TextModelsSection, section);
722
+ if (!checked.success) {
723
+ const issue = checked.issues[0];
724
+ const at = issue ? getDotPath(issue) : null;
725
+ throw new CliError("configuration_error", `${path}: ${SECTION}${at ? `.${at}` : ""} ${issue?.message ?? "is not valid"}`);
726
+ }
727
+ const ids = checked.output.custom?.map(({ id: id2 }) => id2) ?? [];
728
+ const twice = ids.find((id2, at) => ids.indexOf(id2) !== at);
729
+ if (twice)
730
+ throw new CliError("configuration_error", `${path}: ${SECTION}.custom names ${twice} twice`);
731
+ return checked.output;
732
+ }, "readTextModelsSection");
733
+ var writeTextModelsSection = /* @__PURE__ */ __name((section, env = process.env) => writeSharedSection(textModelsFile(env), SECTION, section.use === void 0 && !section.custom?.length ? void 0 : section), "writeTextModelsSection");
734
+ var textModels = /* @__PURE__ */ __name((env = process.env) => [
735
+ ...TEXT_MODELS,
736
+ ...(readTextModelsSection(env).custom ?? []).map((model) => ({ ...model, custom: true }))
737
+ ], "textModels");
738
+ var textModel = /* @__PURE__ */ __name((id2, env = process.env) => {
739
+ const known = textModels(env);
740
+ const found = known.find((model) => model.id === id2);
741
+ if (!found) {
742
+ throw new CliError("validation_error", `no text model ${id2} \u2014 one of: ${known.map((model) => model.id).join(", ")}`);
743
+ }
744
+ return found;
745
+ }, "textModel");
746
+ var chosenTextModel = /* @__PURE__ */ __name((env = process.env) => {
747
+ const use = readTextModelsSection(env).use;
748
+ return use === void 0 ? { id: DEFAULT_TEXT_MODEL, from: "default" } : { id: use, from: "chosen" };
749
+ }, "chosenTextModel");
750
+ var mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
751
+ var bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
752
+ var RERANK_MODELS = [
753
+ {
754
+ id: "mmarco",
755
+ title: "mMARCO mMiniLMv2-L12 cross-encoder, 8-bit",
756
+ languages: "about 100 languages, Russian and English among them",
757
+ licence: "Apache-2.0",
758
+ maxTokens: 512,
759
+ // The x86 name is the quantizer's target; WebAssembly and native ONNX Runtime both run it on any processor.
760
+ onnx: "onnx/model_quint8_avx2.onnx",
761
+ files: [
762
+ {
763
+ name: "onnx/model_quint8_avx2.onnx",
764
+ url: mmarco("onnx/model_quint8_avx2.onnx"),
765
+ sha256: "6c2513767fb63d008a4377bef7a7a3555433d9436342bb53e35a3a72ffc52d4b",
766
+ bytes: 118620016
767
+ },
768
+ {
769
+ name: "tokenizer.json",
770
+ url: mmarco("tokenizer.json"),
771
+ sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
772
+ bytes: 17082660
773
+ },
774
+ {
775
+ name: "tokenizer_config.json",
776
+ url: mmarco("tokenizer_config.json"),
777
+ sha256: "e7fbfbfa6347b4e414c1cee50d142e2c2f9a895dad68b068ae83a8b564c3837e",
778
+ bytes: 435
779
+ }
780
+ ]
781
+ },
782
+ {
783
+ id: "bge-reranker-v2-m3",
784
+ title: "BGE reranker v2 m3, 8-bit",
785
+ languages: "over 100 languages \u2014 better than mmarco in the benchmark, about seven times slower",
786
+ licence: "Apache-2.0 (BAAI's; the ONNX export declares none)",
787
+ maxTokens: 512,
788
+ onnx: "onnx/model_quantized.onnx",
789
+ files: [
790
+ {
791
+ name: "onnx/model_quantized.onnx",
792
+ url: bge("onnx/model_quantized.onnx"),
793
+ sha256: "912fc1215c2dbff6499700534bd8d31253af01573861abbfc43afd1fab6cce5d",
794
+ bytes: 570727094
795
+ },
796
+ {
797
+ name: "tokenizer.json",
798
+ url: bge("tokenizer.json"),
799
+ sha256: "8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3",
800
+ bytes: 17082900
801
+ },
802
+ {
803
+ name: "tokenizer_config.json",
804
+ url: bge("tokenizer_config.json"),
805
+ sha256: "b87c8703482b0300d3da30e201519aa641f6a450f5eb5bf1e624afbf70c74d80",
806
+ bytes: 1203
807
+ }
808
+ ]
809
+ }
810
+ ];
811
+ var DEFAULT_RERANK_MODEL = "mmarco";
812
+ var rerankModel = /* @__PURE__ */ __name((id2) => {
813
+ const found = RERANK_MODELS.find((model) => model.id === id2);
814
+ if (!found) {
815
+ throw new CliError("validation_error", `no reranker ${id2} \u2014 one of: ${RERANK_MODELS.map((model) => model.id).join(", ")}`);
816
+ }
817
+ return found;
818
+ }, "rerankModel");
819
+ var vectorModelKey = /* @__PURE__ */ __name((model) => {
820
+ const weights = model.custom ? model.files.find(({ name }) => name === model.onnx)?.sha256.slice(0, 12) : void 0;
821
+ return `local:${model.id}${weights ? `@${weights}` : ""}:${model.dims}`;
822
+ }, "vectorModelKey");
823
+ var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
824
+
825
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/sends/permissions.js
541
826
  var LEVELS = ["deny", "readonly", "ask", "allow"];
542
827
  var DANGEROUS = /* @__PURE__ */ new Set(["messages.delete", "bot.messages.delete", "topics.delete", "chats.delete", "chats.clear"]);
543
828
  var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
@@ -566,6 +851,10 @@ var DEFAULT_PERMISSIONS = {
566
851
  "server.stop": "ask",
567
852
  "server.restart": "ask",
568
853
  "models.download": "ask",
854
+ // NEED-2357.f: many MCP clients (ChatGPT) cannot answer a question, and a switch deletes nothing; kept as a key so a
855
+ // profile can still deny it.
856
+ "models.set": "allow",
857
+ "models.add": "ask",
569
858
  "images.models.download": "ask",
570
859
  "schedule.run": "ask",
571
860
  "schedule.exec": "ask",
@@ -933,7 +1222,7 @@ var assertRetentionEvidenceRead = /* @__PURE__ */ __name((permissions) => {
933
1222
  }
934
1223
  }, "assertRetentionEvidenceRead");
935
1224
 
936
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/sends/guarded.js
1225
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/sends/guarded.js
937
1226
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
938
1227
  var sentIds = /* @__PURE__ */ __name((typed, message) => ({
939
1228
  messageId: message.id,
@@ -1039,166 +1328,86 @@ var guardedWrite = /* @__PURE__ */ __name(async (guard, attempt, act, settled =
1039
1328
  }, "guardedWrite");
1040
1329
  var codeOf = /* @__PURE__ */ __name((error) => typeof error?.code === "string" ? error.code : "unknown", "codeOf");
1041
1330
 
1042
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/embeddings/models.js
1043
- var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
1044
- var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
1045
- var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
1046
- var TEXT_MODELS = [
1047
- {
1048
- id: "e5-small",
1049
- title: "multilingual-e5-small, 8-bit",
1050
- languages: "about 100 languages, Russian and English among them",
1051
- licence: "MIT",
1052
- dims: 384,
1053
- maxTokens: 512,
1054
- // 100k-message corpus, one 8-thread session on Ryzen AI 9 HX 470: 31–32 chunks/s.
1055
- chunksPerSecond: 31,
1056
- pooling: "mean",
1057
- prefix: { query: "query: ", passage: "passage: " },
1058
- onnx: "onnx/model_quantized.onnx",
1059
- files: [
1060
- {
1061
- name: "onnx/model_quantized.onnx",
1062
- url: e5("onnx/model_quantized.onnx"),
1063
- sha256: "f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193",
1064
- bytes: 118308185
1065
- },
1066
- {
1067
- name: "tokenizer.json",
1068
- url: e5("tokenizer.json"),
1069
- sha256: "0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39",
1070
- bytes: 17082730
1071
- },
1072
- {
1073
- name: "tokenizer_config.json",
1074
- url: e5("tokenizer_config.json"),
1075
- sha256: "a1d6bc8734a6f635dc158508bef000f8e2e5a759c7d92f984b2c86e5ff53425b",
1076
- bytes: 443
1077
- }
1078
- ]
1079
- },
1080
- {
1081
- id: "embeddinggemma",
1082
- title: "EmbeddingGemma 300M, 4-bit",
1083
- languages: "over 100 languages \u2014 the best of the two on chat, about seven times slower",
1084
- licence: "Gemma Terms of Use",
1085
- terms: "https://ai.google.dev/gemma/terms",
1086
- dims: 768,
1087
- maxTokens: 2048,
1088
- chunksPerSecond: 2,
1089
- pooling: "sentence_embedding",
1090
- prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
1091
- onnx: "onnx/model_q4.onnx",
1092
- externalData: "onnx/model_q4.onnx_data",
1093
- files: [
1094
- {
1095
- name: "onnx/model_q4.onnx",
1096
- url: gemma("onnx/model_q4.onnx"),
1097
- sha256: "ad1dfee81a70f7944b9b9d1cc6e48075b832881cf33fab2f2b248be78f3f0043",
1098
- bytes: 519322
1099
- },
1100
- {
1101
- name: "onnx/model_q4.onnx_data",
1102
- url: gemma("onnx/model_q4.onnx_data"),
1103
- sha256: "599962c3143b040de2dd05e5975be3e9091dd067cacc6a8f7186e3203bab9e02",
1104
- bytes: 196725760
1105
- },
1106
- {
1107
- name: "tokenizer.json",
1108
- url: gemma("tokenizer.json"),
1109
- sha256: "4dda02faaf32bc91031dc8c88457ac272b00c1016cc679757d1c441b248b9c47",
1110
- bytes: 20323312
1111
- },
1112
- {
1113
- name: "tokenizer_config.json",
1114
- url: gemma("tokenizer_config.json"),
1115
- sha256: "3ca953eea6c3c9fcda9cf3df22949ff18b216f7c74bd6459230f3f1013953f3a",
1116
- bytes: 1156830
1117
- }
1118
- ]
1119
- }
1120
- ];
1121
- var DEFAULT_TEXT_MODEL = "e5-small";
1122
- var textModel = /* @__PURE__ */ __name((id2) => {
1123
- const found = TEXT_MODELS.find((model) => model.id === id2);
1124
- if (!found) {
1125
- throw new CliError("validation_error", `no text model ${id2} \u2014 one of: ${TEXT_MODELS.map((model) => model.id).join(", ")}`);
1331
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/models/endpoint.js
1332
+ var endpoint = /* @__PURE__ */ __name((value) => {
1333
+ try {
1334
+ const url2 = new URL(value);
1335
+ return ["https:", "http:"].includes(url2.protocol) && !url2.username && !url2.password && !url2.search && !url2.hash;
1336
+ } catch {
1337
+ return false;
1126
1338
  }
1127
- return found;
1128
- }, "textModel");
1129
- var mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
1130
- var bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
1131
- var RERANK_MODELS = [
1132
- {
1133
- id: "mmarco",
1134
- title: "mMARCO mMiniLMv2-L12 cross-encoder, 8-bit",
1135
- languages: "about 100 languages, Russian and English among them",
1136
- licence: "Apache-2.0",
1137
- maxTokens: 512,
1138
- // The x86 name is the quantizer's target; WebAssembly and native ONNX Runtime both run it on any processor.
1139
- onnx: "onnx/model_quint8_avx2.onnx",
1140
- files: [
1141
- {
1142
- name: "onnx/model_quint8_avx2.onnx",
1143
- url: mmarco("onnx/model_quint8_avx2.onnx"),
1144
- sha256: "6c2513767fb63d008a4377bef7a7a3555433d9436342bb53e35a3a72ffc52d4b",
1145
- bytes: 118620016
1146
- },
1147
- {
1148
- name: "tokenizer.json",
1149
- url: mmarco("tokenizer.json"),
1150
- sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
1151
- bytes: 17082660
1152
- },
1153
- {
1154
- name: "tokenizer_config.json",
1155
- url: mmarco("tokenizer_config.json"),
1156
- sha256: "e7fbfbfa6347b4e414c1cee50d142e2c2f9a895dad68b068ae83a8b564c3837e",
1157
- bytes: 435
1158
- }
1159
- ]
1160
- },
1161
- {
1162
- id: "bge-reranker-v2-m3",
1163
- title: "BGE reranker v2 m3, 8-bit",
1164
- languages: "over 100 languages \u2014 better than mmarco in the benchmark, about seven times slower",
1165
- licence: "Apache-2.0 (BAAI's; the ONNX export declares none)",
1166
- maxTokens: 512,
1167
- onnx: "onnx/model_quantized.onnx",
1168
- files: [
1169
- {
1170
- name: "onnx/model_quantized.onnx",
1171
- url: bge("onnx/model_quantized.onnx"),
1172
- sha256: "912fc1215c2dbff6499700534bd8d31253af01573861abbfc43afd1fab6cce5d",
1173
- bytes: 570727094
1174
- },
1175
- {
1176
- name: "tokenizer.json",
1177
- url: bge("tokenizer.json"),
1178
- sha256: "8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3",
1179
- bytes: 17082900
1180
- },
1181
- {
1182
- name: "tokenizer_config.json",
1183
- url: bge("tokenizer_config.json"),
1184
- sha256: "b87c8703482b0300d3da30e201519aa641f6a450f5eb5bf1e624afbf70c74d80",
1185
- bytes: 1203
1186
- }
1187
- ]
1339
+ }, "endpoint");
1340
+
1341
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/models/settings.js
1342
+ var MODEL_FIELDS = ["provider", "model", "base_url"];
1343
+ var modelSettingsShape = record(pipe(string(), regex(/^[a-z][a-z0-9-]*$/)), strictObject({
1344
+ provider: optional(picklist(["off", "openai", "anthropic"])),
1345
+ model: optional(pipe(string(), trim(), minLength(1), maxLength(200))),
1346
+ base_url: optional(pipe(string(), check((value) => endpoint(value), "use an HTTP/S endpoint without credentials, query or fragment")))
1347
+ }));
1348
+ var resolveModelSettings = /* @__PURE__ */ __name((prefix, layers, env) => {
1349
+ const configured = layers.map(([from, scope]) => [from, scope?.models ?? {}]);
1350
+ const purposes = /* @__PURE__ */ new Set([
1351
+ "default",
1352
+ "analysis",
1353
+ "replies",
1354
+ ...configured.flatMap(([, models2]) => Object.keys(models2))
1355
+ ]);
1356
+ for (const name of Object.keys(env)) {
1357
+ const match = new RegExp(`^${prefix}_MODELS_([A-Z][A-Z0-9_]*)_(PROVIDER|MODEL|BASE_URL)$`).exec(name);
1358
+ if (match?.[1])
1359
+ purposes.add(match[1].toLowerCase().replaceAll("_", "-"));
1188
1360
  }
1189
- ];
1190
- var DEFAULT_RERANK_MODEL = "mmarco";
1191
- var rerankModel = /* @__PURE__ */ __name((id2) => {
1192
- const found = RERANK_MODELS.find((model) => model.id === id2);
1193
- if (!found) {
1194
- throw new CliError("validation_error", `no reranker ${id2} \u2014 one of: ${RERANK_MODELS.map((model) => model.id).join(", ")}`);
1361
+ const models = {};
1362
+ const sources = {};
1363
+ for (const purpose of purposes) {
1364
+ const resolved = {};
1365
+ for (const field of MODEL_FIELDS) {
1366
+ const variable = `${prefix}_MODELS_${purpose.replaceAll("-", "_").toUpperCase()}_${field.toUpperCase()}`;
1367
+ const candidates = [
1368
+ [variable, env[variable]?.trim() || void 0],
1369
+ ...configured.map(([from, model]) => [
1370
+ `${from}: models.${purpose}.${field}`,
1371
+ model[purpose]?.[field]
1372
+ ]),
1373
+ ...purpose === "default" ? [] : [
1374
+ [
1375
+ `${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`,
1376
+ env[`${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`]?.trim() || void 0
1377
+ ],
1378
+ ...configured.map(([from, model]) => [
1379
+ `${from}: models.default.${field}`,
1380
+ model.default?.[field]
1381
+ ])
1382
+ ]
1383
+ ];
1384
+ const selected = candidates.find(([, value]) => value !== void 0);
1385
+ if (selected)
1386
+ resolved[field] = selected[1];
1387
+ sources[`models.${purpose}.${field}`] = selected?.[0] ?? "default";
1388
+ }
1389
+ if (Object.keys(resolved).length)
1390
+ models[purpose] = resolved;
1195
1391
  }
1196
- return found;
1197
- }, "rerankModel");
1198
- var vectorModelKey = /* @__PURE__ */ __name((model) => `local:${model.id}:${model.dims}`, "vectorModelKey");
1199
- var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
1392
+ const checked = safeParse(modelSettingsShape, models);
1393
+ if (!checked.success)
1394
+ throw new CliError("configuration_error", `models.${getDotPath(checked.issues[0]) ?? "settings"} is invalid`);
1395
+ return { models: checked.output, sources };
1396
+ }, "resolveModelSettings");
1397
+ var modelTarget = /* @__PURE__ */ __name((settings, purpose) => {
1398
+ const configured = { ...settings.models?.default, ...settings.models?.[purpose] };
1399
+ if (configured.provider === void 0 || configured.provider === "off")
1400
+ return void 0;
1401
+ if (!configured.model)
1402
+ throw new CliError("configuration_error", `set models.${purpose}.model before calling its provider`);
1403
+ return {
1404
+ provider: configured.provider,
1405
+ model: configured.model,
1406
+ ...configured.base_url === void 0 ? {} : { baseUrl: configured.base_url }
1407
+ };
1408
+ }, "modelTarget");
1200
1409
 
1201
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/services/history-limits.js
1410
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/services/history-limits.js
1202
1411
  var HISTORY_MAX_DAYS = 1095;
1203
1412
  var DEFAULT_HISTORY_LIMITS = { dialogDays: 1095, groupDays: 365, groupMembersMax: 50 };
1204
1413
  var DAY_MS2 = 24 * 60 * 60 * 1e3;
@@ -1245,7 +1454,7 @@ var limitBatch = /* @__PURE__ */ __name((batch, shapes, included, limits, now =
1245
1454
  return { batch: { ...batch, messages }, skipped };
1246
1455
  }, "limitBatch");
1247
1456
 
1248
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/entities/task.js
1457
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/entities/task.js
1249
1458
  var closeSuggestion = strictObject({
1250
1459
  as: picklist(["done", "dismissed"]),
1251
1460
  /** The agent's name. */
@@ -1307,7 +1516,7 @@ var task = strictObject({
1307
1516
  updated_at: optional(time)
1308
1517
  });
1309
1518
 
1310
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/entities/agenda.js
1519
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/entities/agenda.js
1311
1520
  var agendaChat = strictObject({
1312
1521
  chat: reference,
1313
1522
  title: nullable(text),
@@ -1377,7 +1586,7 @@ var agenda = strictObject({
1377
1586
  unlisted_categories: array(strictObject({ name: text, open_tasks: number() }))
1378
1587
  });
1379
1588
 
1380
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/entities/attachment.js
1589
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/entities/attachment.js
1381
1590
  var attachment = strictObject({
1382
1591
  /** The message it came with, as a locator; absent inside that message. */
1383
1592
  message: optional(reference),
@@ -1415,7 +1624,7 @@ var attachment = strictObject({
1415
1624
  });
1416
1625
  var hitFile = strictObject({ position: count, kind: text, name: optional(text), size: optional(count) });
1417
1626
 
1418
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/entities/conversation.js
1627
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/entities/conversation.js
1419
1628
  var conversation = strictObject({
1420
1629
  id,
1421
1630
  chat: reference,
@@ -1430,7 +1639,7 @@ var conversation = strictObject({
1430
1639
  rules_version: count
1431
1640
  });
1432
1641
 
1433
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/entities/tagging.js
1642
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/entities/tagging.js
1434
1643
  var tagging = strictObject({
1435
1644
  tag: text,
1436
1645
  type: picklist(TAG_TYPES),
@@ -1443,7 +1652,7 @@ var tagging = strictObject({
1443
1652
  created_at: time
1444
1653
  });
1445
1654
 
1446
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/images/picture/models.js
1655
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/images/picture/models.js
1447
1656
  import { join as join2 } from "node:path";
1448
1657
  var clip = /* @__PURE__ */ __name((name) => `https://huggingface.co/Xenova/clip-vit-base-patch32/resolve/d15189d7028b43f1d3e65039190477f6af591c2a/${name}`, "clip");
1449
1658
  var IMAGE_MODELS = [
@@ -1497,7 +1706,7 @@ var imageModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedM
1497
1706
  var placedImage = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join2(directory, model.id, file.name)]), "placedImage");
1498
1707
  var isImageModelInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placedImage(model, directory)), "isImageModelInstalled");
1499
1708
 
1500
- // node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/botcheck/reasons.js
1709
+ // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/botcheck/reasons.js
1501
1710
  var WEIGHTS = {
1502
1711
  bot: 3,
1503
1712
  scam: 3,
@@ -1554,10 +1763,19 @@ export {
1554
1763
  currentOperation,
1555
1764
  guardedWrite,
1556
1765
  codeOf,
1766
+ endpoint,
1767
+ modelSettingsShape,
1768
+ resolveModelSettings,
1769
+ modelTarget,
1557
1770
  parseDuration,
1558
- TEXT_MODELS,
1559
1771
  DEFAULT_TEXT_MODEL,
1772
+ CustomTextModelShape,
1773
+ textModelsFile,
1774
+ readTextModelsSection,
1775
+ writeTextModelsSection,
1776
+ textModels,
1560
1777
  textModel,
1778
+ chosenTextModel,
1561
1779
  RERANK_MODELS,
1562
1780
  DEFAULT_RERANK_MODEL,
1563
1781
  rerankModel,