@wirecat/tg-cli 0.128.0 → 0.130.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.
- package/contracts/wirecat.json +26 -0
- package/dist/bin/tg.js +2 -2
- package/dist/bundle/{adapter-JOI34QLS.js → adapter-2XFPXBTA.js} +60 -52
- package/dist/bundle/{all-profiles-2BZEE7J2.js → all-profiles-GXFPZLYU.js} +9 -9
- package/dist/bundle/{anthropic-NW7DL3S3.js → anthropic-FHS5XNK5.js} +5 -5
- package/dist/bundle/{app-server-RUTYKELF.js → app-server-IZMFSFP2.js} +54 -46
- package/dist/bundle/{bot-api-DW6NAZAQ.js → bot-api-V3ZJ75KE.js} +61 -53
- package/dist/bundle/{bot-history-FAJ2W42U.js → bot-history-EJQOD4AQ.js} +22 -18
- package/dist/bundle/{bun-IVP5LSVI.js → bun-GBAZFRCV.js} +2 -2
- package/dist/bundle/{bun-sqlite-ATPCJ4CT.js → bun-sqlite-JB4BX6X7.js} +6 -6
- package/dist/bundle/chunk-2JZJPVBH.js +334 -0
- package/dist/bundle/{chunk-FHGAJK4I.js → chunk-2LPODKIF.js} +15 -15
- package/dist/bundle/chunk-3KZG63EH.js +170 -0
- package/dist/bundle/chunk-3XMUP55N.js +372 -0
- package/dist/bundle/{chunk-OX6574YV.js → chunk-42LRWOTT.js} +15 -15
- package/dist/bundle/{chunk-MDGLKMLD.js → chunk-4BJAQNJ5.js} +9 -9
- package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-66PL7P4C.js} +1 -1
- package/dist/bundle/{chunk-MOUPWPNL.js → chunk-66UG67CE.js} +12 -12
- package/dist/bundle/{chunk-R4QVV3LN.js → chunk-6JBRQ6PM.js} +41 -19
- package/dist/bundle/{chunk-GYO4WXLG.js → chunk-6M3FAHPS.js} +3 -3
- package/dist/bundle/{chunk-WMF6SL5D.js → chunk-6WGAWISN.js} +2 -2
- package/dist/bundle/{chunk-2QHIOPSA.js → chunk-7F3LOHRB.js} +261 -501
- package/dist/bundle/{chunk-XS5C5TQ7.js → chunk-AUNNJDVD.js} +25 -8
- package/dist/bundle/{chunk-7D6LI2N7.js → chunk-B5RGPZDZ.js} +7 -7
- package/dist/bundle/{chunk-YRZXOQOB.js → chunk-B6NQJAUC.js} +2 -2
- package/dist/bundle/{chunk-IV2KJQ5F.js → chunk-BMSS3PCY.js} +58 -33
- package/dist/bundle/{chunk-LTADKMP5.js → chunk-C4ALE7CH.js} +1 -1
- package/dist/bundle/{chunk-WG3BF7SA.js → chunk-CKJ73EF3.js} +1 -1
- package/dist/bundle/{chunk-IX3GUNGV.js → chunk-CLG2ISQH.js} +4 -4
- package/dist/bundle/{chunk-G3PL3R45.js → chunk-EB2JE722.js} +1 -1
- package/dist/bundle/{chunk-J3SX36NE.js → chunk-EUL7HMUL.js} +2 -2
- package/dist/bundle/{chunk-PJA43HVE.js → chunk-F6CV4KUN.js} +2 -2
- package/dist/bundle/{chunk-7KCBPAQS.js → chunk-F6MLJ3V5.js} +2 -2
- package/dist/bundle/{chunk-3UGRMFWK.js → chunk-FH4YIBBH.js} +4 -4
- package/dist/bundle/chunk-FIO5NMK3.js +771 -0
- package/dist/bundle/{chunk-7I5NMVX7.js → chunk-G2SMVYBU.js} +2 -2
- package/dist/bundle/{chunk-FIVFP53N.js → chunk-GA3URWIF.js} +1 -1
- package/dist/bundle/{chunk-2A3TC52A.js → chunk-GGGBPWUS.js} +10 -15
- package/dist/bundle/{chunk-KKZQK6IK.js → chunk-GSHTLLCJ.js} +2 -2
- package/dist/bundle/{chunk-F4UIBEQK.js → chunk-GYCKRIRK.js} +3 -3
- package/dist/bundle/{chunk-WPMJQIEU.js → chunk-HHUK3XO5.js} +1 -1
- package/dist/bundle/{chunk-NM5GBJME.js → chunk-HT6OFANN.js} +19 -19
- package/dist/bundle/{chunk-ODBK56ZR.js → chunk-I5PILOTU.js} +1 -1
- package/dist/bundle/chunk-IBSHQWIJ.js +29 -0
- package/dist/bundle/{chunk-RZFIQMOA.js → chunk-IRWSZJYL.js} +60 -58
- package/dist/bundle/{chunk-BVCRDHI2.js → chunk-IV6SIKVH.js} +4 -4
- package/dist/bundle/{chunk-URFBZNLU.js → chunk-JUFLELQ7.js} +2 -2
- package/dist/bundle/{chunk-XYAH6QQO.js → chunk-KY3JLXW2.js} +4 -4
- package/dist/bundle/{chunk-YSXDCSBP.js → chunk-LPT5T6PU.js} +29 -30
- package/dist/bundle/chunk-LQPZDDDP.js +259 -0
- package/dist/bundle/{chunk-JI2PFQFL.js → chunk-M327UNS6.js} +6 -6
- package/dist/bundle/{chunk-SDLJJF7E.js → chunk-MS6YEIG5.js} +13 -13
- package/dist/bundle/{chunk-WMUPZ3IY.js → chunk-MVFSWKTM.js} +12 -12
- package/dist/bundle/{chunk-YVV5S2QA.js → chunk-NRCY3WBC.js} +2 -2
- package/dist/bundle/{chunk-2IL4YDGG.js → chunk-O2ULG7OO.js} +3 -3
- package/dist/bundle/{chunk-E56QE3UC.js → chunk-OJMDKWWL.js} +627 -503
- package/dist/bundle/{chunk-UURJO46N.js → chunk-OKTRB4ZQ.js} +1 -1
- package/dist/bundle/{chunk-IIHCSJV2.js → chunk-OWVQMK7G.js} +700 -837
- package/dist/bundle/{chunk-LD42OGKK.js → chunk-PS7ZS5HD.js} +4 -4
- package/dist/bundle/{chunk-EAUHYQUK.js → chunk-PWQKGFS2.js} +36 -34
- package/dist/bundle/{chunk-MGBVVQTU.js → chunk-QBNEWEJC.js} +3 -3
- package/dist/bundle/{chunk-QYN5RDTZ.js → chunk-QDEP2QOA.js} +3 -3
- package/dist/bundle/{chunk-QO4ON2X7.js → chunk-QFVIHBLD.js} +1 -1
- package/dist/bundle/{chunk-ZVLYK6CZ.js → chunk-QJDHRBXL.js} +7 -7
- package/dist/bundle/{chunk-IHLNXL2D.js → chunk-QJLCEOAP.js} +1 -1
- package/dist/bundle/{chunk-KF2Q776U.js → chunk-RAFK5KXU.js} +9 -9
- package/dist/bundle/{chunk-RIGNCUZD.js → chunk-RPWYTOLI.js} +5 -5
- package/dist/bundle/{chunk-4DSIGS2E.js → chunk-RZPMFVWM.js} +6 -6
- package/dist/bundle/chunk-S5UTBEV3.js +1974 -0
- package/dist/bundle/{chunk-MC6FOTCV.js → chunk-SYZXOEHY.js} +3 -3
- package/dist/bundle/{chunk-5AP25FMW.js → chunk-SZB5WRMI.js} +2 -2
- package/dist/bundle/{chunk-Q3ZO6Q3M.js → chunk-TGRB4SSZ.js} +4 -4
- package/dist/bundle/{chunk-TQFUAKU6.js → chunk-VSPSHBAC.js} +2 -2
- package/dist/bundle/{chunk-TGUXKG4B.js → chunk-VTJ3AOTT.js} +17 -17
- package/dist/bundle/{chunk-T2CWSFGY.js → chunk-VXWDQDRU.js} +6341 -6902
- package/dist/bundle/{chunk-JJGPU24U.js → chunk-X5H5NERR.js} +6 -6
- package/dist/bundle/{chunk-AF2XVV5P.js → chunk-XHX5D5VE.js} +727 -2598
- package/dist/bundle/chunk-XXW6PFAX.js +16 -0
- package/dist/bundle/{chunk-NXDQXDRN.js → chunk-ZRQQOGAZ.js} +4 -4
- package/dist/bundle/command-contract-G752BLKA.js +37 -0
- package/dist/bundle/{command-server-entry-BU3X4XNL.js → command-server-entry-YR6ONDWO.js} +27 -24
- package/dist/bundle/decode-VUKGWFSW.js +296 -0
- package/dist/bundle/{dispatch-PRAIGIFS.js → dispatch-ST5FK2KI.js} +8 -8
- package/dist/bundle/{echarts-NAXLKJLA.js → echarts-GOV5M733.js} +2 -2
- package/dist/bundle/{embed-LB6ONWHX.js → embed-2IVIYNAJ.js} +6 -6
- package/dist/bundle/{embedder-WE7B2RU5.js → embedder-2HU7JYZK.js} +9 -9
- package/dist/bundle/{entry-W6Y52ZRN.js → entry-CSTCXYI5.js} +9 -9
- package/dist/bundle/{failure-7Y34AUJT.js → failure-GMUQKQ5K.js} +2 -2
- package/dist/bundle/{first-run-NVYNZZA6.js → first-run-3IZGXZT5.js} +12 -11
- package/dist/bundle/first-screen-7QSNCZIK.js +35 -0
- package/dist/bundle/{instructions-MRUC57NS.js → instructions-YSXV6FAC.js} +1 -1
- package/dist/bundle/{mcp-TDKGDB4V.js → mcp-VFIOZDVY.js} +2 -2
- package/dist/bundle/meeting-combined-X4E3LSIJ.js +23 -0
- package/dist/bundle/meeting-model-FQBDHGRU.js +24 -0
- package/dist/bundle/meeting-semantic-ONNEOJX5.js +21 -0
- package/dist/bundle/{node-G7PMDYQV.js → node-FMQWCZRS.js} +2 -2
- package/dist/bundle/{node-sqlite-RXWQ3SES.js → node-sqlite-YN5OKOC6.js} +7 -7
- package/dist/bundle/{oauth-6ZWOL6KX.js → oauth-EW7PTZVT.js} +7 -7
- package/dist/bundle/{open-V7LMZCFI.js → open-Q2RDY344.js} +5 -5
- package/dist/bundle/{openai-P472V4ZM.js → openai-STON6G3O.js} +28 -26
- package/dist/bundle/{process-GSNPENHL.js → process-OQUC2TW3.js} +1 -1
- package/dist/bundle/{program-IELITPKT.js → program-N5BT75OC.js} +66 -57
- package/dist/bundle/{prompt-2CP6CQ5N.js → prompt-WHVF7UTW.js} +5 -5
- package/dist/bundle/{proxy-transport-DP7SIMIC.js → proxy-transport-A4MRO3PF.js} +5 -5
- package/dist/bundle/{recognize-R2DEQ5TC.js → recognize-YDQWMXNI.js} +4 -4
- package/dist/bundle/{remote-JG3POFES.js → remote-477LQHP6.js} +9 -9
- package/dist/bundle/{rerank-TVMR3OLL.js → rerank-4YPB26FG.js} +7 -7
- package/dist/bundle/{serve-DBWSMLPH.js → serve-FXJNUOTS.js} +9 -9
- package/dist/bundle/{server-EXJ2WNZY.js → server-2S6HFBGR.js} +44 -36
- package/dist/bundle/server-UOSUTZNE.js +69 -0
- package/dist/bundle/{sqlite-runtime-AWMY7W4Q.js → sqlite-runtime-RXYNJYMC.js} +6 -6
- package/dist/bundle/{state-HN44BWNQ.js → state-I2GGYGRL.js} +6 -6
- package/dist/bundle/{store-LOVKYQDC.js → store-KX3AAQZH.js} +25 -20
- package/dist/bundle/{store-GIYS3LHV.js → store-VQXIB6KV.js} +17 -13
- package/dist/bundle/store-maintenance-command-LW2MMDLY.js +60 -0
- package/dist/bundle/tg.js +13 -13
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/tg-cli/SKILL.md +11 -4
- package/dist/bundle/command-contract-3BSXDYBC.js +0 -34
- package/dist/bundle/decode-NXB7E46F.js +0 -162
- package/dist/bundle/first-screen-Z6TVHK6I.js +0 -32
- package/dist/bundle/server-SXNFFAIR.js +0 -61
- package/dist/bundle/store-maintenance-command-X3VOYNCG.js +0 -52
- /package/dist/bundle/{chunk-XWBPP2HX.js → chunk-ZI3YTXSF.js} +0 -0
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
jitCompatCheck,
|
|
19
19
|
refineSqliteCodecs,
|
|
20
20
|
sql
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-CKJ73EF3.js";
|
|
22
22
|
import {
|
|
23
23
|
__name
|
|
24
24
|
} from "./chunk-ZVVMGPBJ.js";
|
|
25
25
|
|
|
26
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
|
|
27
27
|
import { Database } from "bun:sqlite";
|
|
28
28
|
var bunSQLiteCodecs = refineSqliteCodecs({
|
|
29
29
|
"integer:boolean": { normalize: booleanFromInteger },
|
|
@@ -3,21 +3,21 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
loadVectorExtension,
|
|
5
5
|
vectorExtension
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EUL7HMUL.js";
|
|
7
7
|
import {
|
|
8
8
|
refuseOwnerStoreInTests
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-VSPSHBAC.js";
|
|
10
|
+
import "./chunk-HT6OFANN.js";
|
|
11
|
+
import "./chunk-AUNNJDVD.js";
|
|
12
12
|
import {
|
|
13
13
|
importFrom
|
|
14
14
|
} from "./chunk-Y5E2WNWB.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-F6MLJ3V5.js";
|
|
16
16
|
import {
|
|
17
17
|
__name
|
|
18
18
|
} from "./chunk-ZVVMGPBJ.js";
|
|
19
19
|
|
|
20
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
|
|
21
21
|
var customised = false;
|
|
22
22
|
var ownLibrary = /* @__PURE__ */ __name(async () => {
|
|
23
23
|
try {
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
filesPresent,
|
|
5
|
+
sharedModelsDirectory
|
|
6
|
+
} from "./chunk-IV6SIKVH.js";
|
|
7
|
+
import {
|
|
8
|
+
readSharedSection,
|
|
9
|
+
sharedConfigPath,
|
|
10
|
+
writeSharedSection
|
|
11
|
+
} from "./chunk-B5RGPZDZ.js";
|
|
12
|
+
import {
|
|
13
|
+
storePath
|
|
14
|
+
} from "./chunk-VSPSHBAC.js";
|
|
15
|
+
import {
|
|
16
|
+
array,
|
|
17
|
+
check,
|
|
18
|
+
getDotPath,
|
|
19
|
+
integer,
|
|
20
|
+
maxLength,
|
|
21
|
+
maxValue,
|
|
22
|
+
minLength,
|
|
23
|
+
minValue,
|
|
24
|
+
number,
|
|
25
|
+
optional,
|
|
26
|
+
picklist,
|
|
27
|
+
pipe,
|
|
28
|
+
regex,
|
|
29
|
+
safeParse,
|
|
30
|
+
startsWith,
|
|
31
|
+
strictObject,
|
|
32
|
+
string,
|
|
33
|
+
trim,
|
|
34
|
+
url
|
|
35
|
+
} from "./chunk-AUNNJDVD.js";
|
|
36
|
+
import {
|
|
37
|
+
CliError
|
|
38
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
39
|
+
import {
|
|
40
|
+
__name
|
|
41
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
42
|
+
|
|
43
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/embeddings/models.js
|
|
44
|
+
import { existsSync } from "node:fs";
|
|
45
|
+
import { join } from "node:path";
|
|
46
|
+
var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
|
|
47
|
+
var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
|
|
48
|
+
var e5Large = huggingFace("Xenova/multilingual-e5-large", "00fc3aeb3dbb95842de2ac1961d33c6319acf57b");
|
|
49
|
+
var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
|
|
50
|
+
var TEXT_MODELS = [
|
|
51
|
+
{
|
|
52
|
+
id: "e5-small",
|
|
53
|
+
title: "multilingual-e5-small, 8-bit",
|
|
54
|
+
size: "small",
|
|
55
|
+
languages: "about 100 languages, Russian and English among them",
|
|
56
|
+
licence: "MIT",
|
|
57
|
+
dims: 384,
|
|
58
|
+
maxTokens: 512,
|
|
59
|
+
// 100k-message corpus, one 8-thread session on Ryzen AI 9 HX 470: 31–32 chunks/s.
|
|
60
|
+
chunksPerSecond: 31,
|
|
61
|
+
pooling: "mean",
|
|
62
|
+
prefix: { query: "query: ", passage: "passage: " },
|
|
63
|
+
onnx: "onnx/model_quantized.onnx",
|
|
64
|
+
files: [
|
|
65
|
+
{
|
|
66
|
+
name: "onnx/model_quantized.onnx",
|
|
67
|
+
url: e5("onnx/model_quantized.onnx"),
|
|
68
|
+
sha256: "f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193",
|
|
69
|
+
bytes: 118308185
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "tokenizer.json",
|
|
73
|
+
url: e5("tokenizer.json"),
|
|
74
|
+
sha256: "0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39",
|
|
75
|
+
bytes: 17082730
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "tokenizer_config.json",
|
|
79
|
+
url: e5("tokenizer_config.json"),
|
|
80
|
+
sha256: "a1d6bc8734a6f635dc158508bef000f8e2e5a759c7d92f984b2c86e5ff53425b",
|
|
81
|
+
bytes: 443
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "embeddinggemma",
|
|
87
|
+
title: "EmbeddingGemma 300M, 4-bit",
|
|
88
|
+
size: "medium",
|
|
89
|
+
languages: "over 100 languages \u2014 the best of the two on chat, about seven times slower",
|
|
90
|
+
licence: "Gemma Terms of Use",
|
|
91
|
+
terms: "https://ai.google.dev/gemma/terms",
|
|
92
|
+
// Gemma Terms of Use §3.1: every copy carries this notice and the use restrictions of §3.2.
|
|
93
|
+
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",
|
|
94
|
+
dims: 768,
|
|
95
|
+
maxTokens: 2048,
|
|
96
|
+
// 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
|
|
97
|
+
// 5 on the scale e5-small's 31 sets. It was 2, which held a memo sync to 39 chunks.
|
|
98
|
+
chunksPerSecond: 5,
|
|
99
|
+
pooling: "sentence_embedding",
|
|
100
|
+
prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
|
|
101
|
+
onnx: "onnx/model_q4.onnx",
|
|
102
|
+
externalData: "onnx/model_q4.onnx_data",
|
|
103
|
+
files: [
|
|
104
|
+
{
|
|
105
|
+
name: "onnx/model_q4.onnx",
|
|
106
|
+
url: gemma("onnx/model_q4.onnx"),
|
|
107
|
+
sha256: "ad1dfee81a70f7944b9b9d1cc6e48075b832881cf33fab2f2b248be78f3f0043",
|
|
108
|
+
bytes: 519322
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "onnx/model_q4.onnx_data",
|
|
112
|
+
url: gemma("onnx/model_q4.onnx_data"),
|
|
113
|
+
sha256: "599962c3143b040de2dd05e5975be3e9091dd067cacc6a8f7186e3203bab9e02",
|
|
114
|
+
bytes: 196725760
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "tokenizer.json",
|
|
118
|
+
url: gemma("tokenizer.json"),
|
|
119
|
+
sha256: "4dda02faaf32bc91031dc8c88457ac272b00c1016cc679757d1c441b248b9c47",
|
|
120
|
+
bytes: 20323312
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "tokenizer_config.json",
|
|
124
|
+
url: gemma("tokenizer_config.json"),
|
|
125
|
+
sha256: "3ca953eea6c3c9fcda9cf3df22949ff18b216f7c74bd6459230f3f1013953f3a",
|
|
126
|
+
bytes: 1156830
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: "e5-large",
|
|
132
|
+
title: "multilingual-e5-large, 8-bit",
|
|
133
|
+
size: "large",
|
|
134
|
+
languages: "about 100 languages, Russian and English among them \u2014 reads better than e5-small, several times slower",
|
|
135
|
+
licence: "MIT",
|
|
136
|
+
dims: 1024,
|
|
137
|
+
maxTokens: 512,
|
|
138
|
+
// 2026-11-07, one 8-thread session on the Ryzen AI 9 HX 470 while other benchmarks ran: 3.4 chunks/s.
|
|
139
|
+
chunksPerSecond: 4,
|
|
140
|
+
pooling: "mean",
|
|
141
|
+
prefix: { query: "query: ", passage: "passage: " },
|
|
142
|
+
onnx: "onnx/model_quantized.onnx",
|
|
143
|
+
files: [
|
|
144
|
+
{
|
|
145
|
+
name: "onnx/model_quantized.onnx",
|
|
146
|
+
url: e5Large("onnx/model_quantized.onnx"),
|
|
147
|
+
sha256: "0a8d65db9a36f810ba5da15249f13145fcdc7890e6656f1fd38cd8b7c4db1fca",
|
|
148
|
+
bytes: 561768762
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "tokenizer.json",
|
|
152
|
+
url: e5Large("tokenizer.json"),
|
|
153
|
+
sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
|
|
154
|
+
bytes: 17082660
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "tokenizer_config.json",
|
|
158
|
+
url: e5Large("tokenizer_config.json"),
|
|
159
|
+
sha256: "efb5c0d09722e5fe59a462cd2a9976ee216d55b037597d997cd3fe833216da15",
|
|
160
|
+
bytes: 418
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
var DEFAULT_TEXT_MODEL = "embeddinggemma";
|
|
166
|
+
var PREVIOUS_DEFAULT_TEXT_MODEL = "e5-small";
|
|
167
|
+
var SECTION = "text_models";
|
|
168
|
+
var slug = pipe(string(), regex(/^[a-z0-9][a-z0-9._-]{0,62}$/, "is not a model id: a-z, 0-9, . _ -"));
|
|
169
|
+
var words = pipe(string(), trim(), minLength(1), maxLength(300));
|
|
170
|
+
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"));
|
|
171
|
+
var modelFile = strictObject({
|
|
172
|
+
name: fileName,
|
|
173
|
+
url: pipe(string(), url(), startsWith("https://", "has to be an https address")),
|
|
174
|
+
sha256: pipe(string(), regex(/^[0-9a-f]{64}$/, "has to be a sha256 in hex")),
|
|
175
|
+
bytes: pipe(number(), integer(), minValue(1))
|
|
176
|
+
});
|
|
177
|
+
var CustomTextModelShape = pipe(strictObject({
|
|
178
|
+
id: slug,
|
|
179
|
+
title: words,
|
|
180
|
+
languages: words,
|
|
181
|
+
licence: words,
|
|
182
|
+
terms: optional(pipe(string(), url())),
|
|
183
|
+
dims: pipe(number(), integer(), minValue(1), maxValue(8192)),
|
|
184
|
+
maxTokens: pipe(number(), integer(), minValue(16), maxValue(32768)),
|
|
185
|
+
chunksPerSecond: optional(pipe(number(), minValue(0.01))),
|
|
186
|
+
pooling: picklist(["mean", "sentence_embedding"]),
|
|
187
|
+
prefix: strictObject({
|
|
188
|
+
query: pipe(string(), maxLength(200)),
|
|
189
|
+
passage: pipe(string(), maxLength(200))
|
|
190
|
+
}),
|
|
191
|
+
onnx: fileName,
|
|
192
|
+
externalData: optional(fileName),
|
|
193
|
+
files: pipe(array(modelFile), minLength(1), maxLength(16))
|
|
194
|
+
}), check((model) => !TEXT_MODELS.some((one) => one.id === model.id), "takes the id of a model this version ships; choose another"), check((model) => {
|
|
195
|
+
const names = model.files.map(({ name }) => name);
|
|
196
|
+
return [model.onnx, model.externalData, "tokenizer.json", "tokenizer_config.json"].every((name) => name === void 0 || names.includes(name));
|
|
197
|
+
}, "has to list its onnx file, its external data and tokenizer.json and tokenizer_config.json among files"));
|
|
198
|
+
var TextModelsSection = strictObject({
|
|
199
|
+
use: optional(slug),
|
|
200
|
+
custom: optional(array(CustomTextModelShape))
|
|
201
|
+
});
|
|
202
|
+
var textModelsFile = /* @__PURE__ */ __name((env = process.env) => sharedConfigPath(storePath(env), env), "textModelsFile");
|
|
203
|
+
var readTextModelsSection = /* @__PURE__ */ __name((env = process.env) => {
|
|
204
|
+
const path = textModelsFile(env);
|
|
205
|
+
const section = readSharedSection(path, SECTION);
|
|
206
|
+
if (section === void 0)
|
|
207
|
+
return {};
|
|
208
|
+
const checked = safeParse(TextModelsSection, section);
|
|
209
|
+
if (!checked.success) {
|
|
210
|
+
const issue = checked.issues[0];
|
|
211
|
+
const at = issue ? getDotPath(issue) : null;
|
|
212
|
+
throw new CliError("configuration_error", `${path}: ${SECTION}${at ? `.${at}` : ""} ${issue?.message ?? "is not valid"}`);
|
|
213
|
+
}
|
|
214
|
+
const ids = checked.output.custom?.map(({ id }) => id) ?? [];
|
|
215
|
+
const twice = ids.find((id, at) => ids.indexOf(id) !== at);
|
|
216
|
+
if (twice)
|
|
217
|
+
throw new CliError("configuration_error", `${path}: ${SECTION}.custom names ${twice} twice`);
|
|
218
|
+
return checked.output;
|
|
219
|
+
}, "readTextModelsSection");
|
|
220
|
+
var writeTextModelsSection = /* @__PURE__ */ __name((section, env = process.env) => writeSharedSection(textModelsFile(env), SECTION, section.use === void 0 && !section.custom?.length ? void 0 : section), "writeTextModelsSection");
|
|
221
|
+
var textModels = /* @__PURE__ */ __name((env = process.env) => [
|
|
222
|
+
...TEXT_MODELS,
|
|
223
|
+
...(readTextModelsSection(env).custom ?? []).map((model) => ({ ...model, custom: true }))
|
|
224
|
+
], "textModels");
|
|
225
|
+
var textModel = /* @__PURE__ */ __name((id, env = process.env) => {
|
|
226
|
+
const known = textModels(env);
|
|
227
|
+
const found = known.find((model) => model.id === id);
|
|
228
|
+
if (!found) {
|
|
229
|
+
throw new CliError("validation_error", `no text model ${id} \u2014 one of: ${known.map((model) => model.id).join(", ")}`);
|
|
230
|
+
}
|
|
231
|
+
return found;
|
|
232
|
+
}, "textModel");
|
|
233
|
+
var downloaded = /* @__PURE__ */ __name((id, env) => {
|
|
234
|
+
const model = TEXT_MODELS.find((one) => one.id === id);
|
|
235
|
+
const directory = sharedModelsDirectory("text", env);
|
|
236
|
+
return model !== void 0 && filesPresent(model.files.map((file) => [file, join(directory, model.id, file.name)]));
|
|
237
|
+
}, "downloaded");
|
|
238
|
+
var chosenTextModel = /* @__PURE__ */ __name((env = process.env) => {
|
|
239
|
+
const use = readTextModelsSection(env).use;
|
|
240
|
+
if (use !== void 0)
|
|
241
|
+
return { id: use, from: "chosen" };
|
|
242
|
+
const kept = !downloaded(DEFAULT_TEXT_MODEL, env) && existsSync(join(sharedModelsDirectory("text", env), PREVIOUS_DEFAULT_TEXT_MODEL));
|
|
243
|
+
return { id: kept ? PREVIOUS_DEFAULT_TEXT_MODEL : DEFAULT_TEXT_MODEL, from: "default" };
|
|
244
|
+
}, "chosenTextModel");
|
|
245
|
+
var mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
|
|
246
|
+
var bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
|
|
247
|
+
var RERANK_MODELS = [
|
|
248
|
+
{
|
|
249
|
+
id: "mmarco",
|
|
250
|
+
title: "mMARCO mMiniLMv2-L12 cross-encoder, 8-bit",
|
|
251
|
+
languages: "about 100 languages, Russian and English among them",
|
|
252
|
+
licence: "Apache-2.0",
|
|
253
|
+
maxTokens: 512,
|
|
254
|
+
// The x86 name is the quantizer's target; WebAssembly and native ONNX Runtime both run it on any processor.
|
|
255
|
+
onnx: "onnx/model_quint8_avx2.onnx",
|
|
256
|
+
files: [
|
|
257
|
+
{
|
|
258
|
+
name: "onnx/model_quint8_avx2.onnx",
|
|
259
|
+
url: mmarco("onnx/model_quint8_avx2.onnx"),
|
|
260
|
+
sha256: "6c2513767fb63d008a4377bef7a7a3555433d9436342bb53e35a3a72ffc52d4b",
|
|
261
|
+
bytes: 118620016
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "tokenizer.json",
|
|
265
|
+
url: mmarco("tokenizer.json"),
|
|
266
|
+
sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
|
|
267
|
+
bytes: 17082660
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: "tokenizer_config.json",
|
|
271
|
+
url: mmarco("tokenizer_config.json"),
|
|
272
|
+
sha256: "e7fbfbfa6347b4e414c1cee50d142e2c2f9a895dad68b068ae83a8b564c3837e",
|
|
273
|
+
bytes: 435
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "bge-reranker-v2-m3",
|
|
279
|
+
title: "BGE reranker v2 m3, 8-bit",
|
|
280
|
+
languages: "over 100 languages \u2014 better than mmarco in the benchmark, about seven times slower",
|
|
281
|
+
licence: "Apache-2.0 (BAAI's; the ONNX export declares none)",
|
|
282
|
+
maxTokens: 512,
|
|
283
|
+
onnx: "onnx/model_quantized.onnx",
|
|
284
|
+
files: [
|
|
285
|
+
{
|
|
286
|
+
name: "onnx/model_quantized.onnx",
|
|
287
|
+
url: bge("onnx/model_quantized.onnx"),
|
|
288
|
+
sha256: "912fc1215c2dbff6499700534bd8d31253af01573861abbfc43afd1fab6cce5d",
|
|
289
|
+
bytes: 570727094
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "tokenizer.json",
|
|
293
|
+
url: bge("tokenizer.json"),
|
|
294
|
+
sha256: "8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3",
|
|
295
|
+
bytes: 17082900
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "tokenizer_config.json",
|
|
299
|
+
url: bge("tokenizer_config.json"),
|
|
300
|
+
sha256: "b87c8703482b0300d3da30e201519aa641f6a450f5eb5bf1e624afbf70c74d80",
|
|
301
|
+
bytes: 1203
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
];
|
|
306
|
+
var DEFAULT_RERANK_MODEL = "mmarco";
|
|
307
|
+
var rerankModel = /* @__PURE__ */ __name((id) => {
|
|
308
|
+
const found = RERANK_MODELS.find((model) => model.id === id);
|
|
309
|
+
if (!found) {
|
|
310
|
+
throw new CliError("validation_error", `no reranker ${id} \u2014 one of: ${RERANK_MODELS.map((model) => model.id).join(", ")}`);
|
|
311
|
+
}
|
|
312
|
+
return found;
|
|
313
|
+
}, "rerankModel");
|
|
314
|
+
var vectorModelKey = /* @__PURE__ */ __name((model) => {
|
|
315
|
+
const weights = model.custom ? model.files.find(({ name }) => name === model.onnx)?.sha256.slice(0, 12) : void 0;
|
|
316
|
+
return `local:${model.id}${weights ? `@${weights}` : ""}:${model.dims}`;
|
|
317
|
+
}, "vectorModelKey");
|
|
318
|
+
var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
|
|
319
|
+
|
|
320
|
+
export {
|
|
321
|
+
DEFAULT_TEXT_MODEL,
|
|
322
|
+
PREVIOUS_DEFAULT_TEXT_MODEL,
|
|
323
|
+
CustomTextModelShape,
|
|
324
|
+
readTextModelsSection,
|
|
325
|
+
writeTextModelsSection,
|
|
326
|
+
textModels,
|
|
327
|
+
textModel,
|
|
328
|
+
chosenTextModel,
|
|
329
|
+
RERANK_MODELS,
|
|
330
|
+
DEFAULT_RERANK_MODEL,
|
|
331
|
+
rerankModel,
|
|
332
|
+
vectorModelKey,
|
|
333
|
+
meaningFloor
|
|
334
|
+
};
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
servicesFor,
|
|
17
17
|
throughWrapper,
|
|
18
18
|
withFileLockAsync
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OWVQMK7G.js";
|
|
20
20
|
import {
|
|
21
21
|
servingProfiles
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-O2ULG7OO.js";
|
|
23
23
|
import {
|
|
24
24
|
chatReferenceOf,
|
|
25
25
|
ensureAccount,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
isId,
|
|
28
28
|
openStore,
|
|
29
29
|
pickPerson
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-VXWDQDRU.js";
|
|
31
31
|
import {
|
|
32
32
|
CEILING_KEY,
|
|
33
33
|
WRITE_KEYS,
|
|
@@ -48,24 +48,24 @@ import {
|
|
|
48
48
|
rememberAccount,
|
|
49
49
|
rootOf2 as rootOf,
|
|
50
50
|
skipFlagFor
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-7F3LOHRB.js";
|
|
52
52
|
import {
|
|
53
53
|
providerErrorKey
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QJDHRBXL.js";
|
|
55
55
|
import {
|
|
56
56
|
isCliFailure
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-QBNEWEJC.js";
|
|
58
58
|
import {
|
|
59
59
|
resolvePaths
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-HT6OFANN.js";
|
|
61
61
|
import {
|
|
62
62
|
CliError
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
64
64
|
import {
|
|
65
65
|
__name
|
|
66
66
|
} from "./chunk-ZVVMGPBJ.js";
|
|
67
67
|
|
|
68
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
68
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
|
|
69
69
|
import { openSync } from "node:fs";
|
|
70
70
|
import { createInterface } from "node:readline";
|
|
71
71
|
import { ReadStream } from "node:tty";
|
|
@@ -120,7 +120,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
|
|
|
120
120
|
throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
|
|
121
121
|
}, "terminalAsker");
|
|
122
122
|
|
|
123
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
123
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/pace.js
|
|
124
124
|
import { readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
125
125
|
import { join } from "node:path";
|
|
126
126
|
var DEFAULT_PACE = { perMinute: 60, burst: 20 };
|
|
@@ -215,7 +215,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
|
|
|
215
215
|
await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
|
|
216
216
|
}, "waitForTurn");
|
|
217
217
|
|
|
218
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
218
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
|
|
219
219
|
var pathOf = /* @__PURE__ */ __name((command) => {
|
|
220
220
|
const words = [];
|
|
221
221
|
for (let at = command; at?.parent; at = at.parent)
|
|
@@ -275,7 +275,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
|
|
|
275
275
|
throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
|
|
276
276
|
}, "refuseUnknownPermissionKeys");
|
|
277
277
|
|
|
278
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
278
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
|
|
279
279
|
var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
|
|
280
280
|
var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
|
|
281
281
|
var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
|
|
@@ -372,7 +372,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
|
|
|
372
372
|
});
|
|
373
373
|
}, "flooded");
|
|
374
374
|
|
|
375
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
375
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
|
|
376
376
|
var observed = /* @__PURE__ */ __name((messenger, events) => {
|
|
377
377
|
const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
|
|
378
378
|
const write = currentOperation();
|
|
@@ -471,7 +471,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
|
|
|
471
471
|
counts[part] = (counts[part] ?? 0) + items.length;
|
|
472
472
|
}, "byPart");
|
|
473
473
|
|
|
474
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
474
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
|
|
475
475
|
var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
|
|
476
476
|
var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false, historyLimits, command = "cli" }) => {
|
|
477
477
|
let warned = false;
|
|
@@ -1047,7 +1047,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
|
|
|
1047
1047
|
}
|
|
1048
1048
|
}, "keep");
|
|
1049
1049
|
|
|
1050
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1050
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
|
|
1051
1051
|
var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
|
|
1052
1052
|
let opened;
|
|
1053
1053
|
return {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
formatMeetingReference
|
|
5
|
+
} from "./chunk-XHX5D5VE.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
|
|
14
|
+
var positive = /* @__PURE__ */ __name((value, name, max) => {
|
|
15
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
16
|
+
throw new CliError("validation_error", `Invalid ${name}`);
|
|
17
|
+
return value;
|
|
18
|
+
}, "positive");
|
|
19
|
+
var cancel = /* @__PURE__ */ __name((signal) => {
|
|
20
|
+
if (signal?.aborted)
|
|
21
|
+
throw new CliError("cancelled", "Meeting semantic operation was cancelled");
|
|
22
|
+
}, "cancel");
|
|
23
|
+
var account = /* @__PURE__ */ __name((accountId) => positive(accountId, "authorized meeting account", Number.MAX_SAFE_INTEGER), "account");
|
|
24
|
+
var descriptor = /* @__PURE__ */ __name((model) => {
|
|
25
|
+
if (!model || typeof model.key !== "string" || !model.key.trim() || model.key.length > 1e3 || typeof model.model !== "string" || !model.model.trim() || !["local", "remote"].includes(model.kind))
|
|
26
|
+
throw new CliError("validation_error", "An explicit meeting embedding model is required");
|
|
27
|
+
return { key: model.key, model: model.model, kind: model.kind, dims: positive(model.dims, "model dimensions", 8192) };
|
|
28
|
+
}, "descriptor");
|
|
29
|
+
var textBudget = /* @__PURE__ */ __name((options) => ({
|
|
30
|
+
maxRows: positive(options.maxRows ?? 1e4, "transcript row budget", 1e5),
|
|
31
|
+
maxTextBytes: positive(options.maxTextBytes ?? 4 * 1024 * 1024, "transcript text byte budget", 64 * 1024 * 1024)
|
|
32
|
+
}), "textBudget");
|
|
33
|
+
var validateVector = /* @__PURE__ */ __name((vector, dims) => {
|
|
34
|
+
if (!(vector instanceof Float32Array) || vector.length !== dims || !vector.some((value) => value !== 0) || vector.some((value) => !Number.isFinite(value)))
|
|
35
|
+
throw new CliError("invalid_response", "Meeting model returned an invalid vector");
|
|
36
|
+
return vector;
|
|
37
|
+
}, "validateVector");
|
|
38
|
+
var readMeetingSemantic = /* @__PURE__ */ __name(async (store, accountId, query, embedder, options = {}) => {
|
|
39
|
+
const accountIdSnapshot = account(accountId);
|
|
40
|
+
const model = descriptor(embedder);
|
|
41
|
+
if (typeof query !== "string" || !query.trim() || Buffer.byteLength(query, "utf8") > 64 * 1024)
|
|
42
|
+
throw new CliError("validation_error", "Meeting semantic query requires 1\u201365536 UTF-8 bytes");
|
|
43
|
+
const limit = positive(options.limit ?? 20, "semantic result limit", 1e3);
|
|
44
|
+
const maxChunks = positive(options.maxChunks ?? 1e3, "semantic candidate budget", 1e4);
|
|
45
|
+
const afterChunkId = options.afterChunkId === void 0 ? void 0 : positive(options.afterChunkId, "semantic candidate cursor", Number.MAX_SAFE_INTEGER);
|
|
46
|
+
const budget = textBudget(options);
|
|
47
|
+
const signal = options.signal;
|
|
48
|
+
cancel(signal);
|
|
49
|
+
const vectors = await embedder.embed([query], "query");
|
|
50
|
+
cancel(signal);
|
|
51
|
+
if (vectors.length !== 1)
|
|
52
|
+
throw new CliError("invalid_response", "Meeting query model returned another vector count");
|
|
53
|
+
const vector = validateVector(vectors[0], model.dims);
|
|
54
|
+
const result = await store.nearest(model.key, vector, {
|
|
55
|
+
accountId: accountIdSnapshot,
|
|
56
|
+
limit,
|
|
57
|
+
maxChunks,
|
|
58
|
+
...budget,
|
|
59
|
+
...afterChunkId === void 0 ? {} : { afterChunkId },
|
|
60
|
+
...signal ? { signal } : {}
|
|
61
|
+
});
|
|
62
|
+
cancel(signal);
|
|
63
|
+
const items = result.items.map((hit) => {
|
|
64
|
+
positive(hit.meetingId, "semantic meeting ID", Number.MAX_SAFE_INTEGER);
|
|
65
|
+
positive(hit.transcriptId, "semantic transcript ID", Number.MAX_SAFE_INTEGER);
|
|
66
|
+
if (!Number.isSafeInteger(hit.firstPosition) || hit.firstPosition < 0 || !Number.isSafeInteger(hit.lastPosition) || hit.lastPosition < hit.firstPosition || !Number.isFinite(hit.score))
|
|
67
|
+
throw new CliError("invalid_response", "Meeting semantic hit contains invalid provenance");
|
|
68
|
+
const ref = {
|
|
69
|
+
type: "meeting",
|
|
70
|
+
accountId: accountIdSnapshot,
|
|
71
|
+
meetingId: hit.meetingId,
|
|
72
|
+
transcriptId: hit.transcriptId
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
...hit,
|
|
76
|
+
reference: formatMeetingReference(ref),
|
|
77
|
+
firstCueReference: formatMeetingReference({ ...ref, cuePosition: hit.firstPosition }),
|
|
78
|
+
lastCueReference: formatMeetingReference({ ...ref, cuePosition: hit.lastPosition })
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
...result,
|
|
83
|
+
accountId: accountIdSnapshot,
|
|
84
|
+
model,
|
|
85
|
+
items,
|
|
86
|
+
coverage: {
|
|
87
|
+
scope: "current-indexed-vectors",
|
|
88
|
+
candidateScanComplete: result.complete,
|
|
89
|
+
indexCompleteness: "unknown",
|
|
90
|
+
archiveCompleteness: "unknown"
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}, "readMeetingSemantic");
|
|
94
|
+
var proposeMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, selected, options = {}) => {
|
|
95
|
+
const accountIdSnapshot = account(accountId);
|
|
96
|
+
const model = descriptor(selected);
|
|
97
|
+
const signal = options.signal;
|
|
98
|
+
cancel(signal);
|
|
99
|
+
const status = await store.status({ accountId: accountIdSnapshot, model: model.key, ...signal ? { signal } : {} });
|
|
100
|
+
cancel(signal);
|
|
101
|
+
return {
|
|
102
|
+
accountId: accountIdSnapshot,
|
|
103
|
+
model,
|
|
104
|
+
status,
|
|
105
|
+
applied: false,
|
|
106
|
+
scope: "existing-current-chunks",
|
|
107
|
+
rebuildRequired: "explicit"
|
|
108
|
+
};
|
|
109
|
+
}, "proposeMeetingEmbedding");
|
|
110
|
+
var applyMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, embedder, options = {}) => {
|
|
111
|
+
const accountIdSnapshot = account(accountId);
|
|
112
|
+
const model = descriptor(embedder);
|
|
113
|
+
const maxChunks = positive(options.maxChunks ?? 100, "embedding chunk budget", 1e3);
|
|
114
|
+
const budget = textBudget(options);
|
|
115
|
+
const maxVectorBytes = positive(options.maxVectorBytes ?? 8 * 1024 * 1024, "vector payload byte budget", 64 * 1024 * 1024);
|
|
116
|
+
const afterHash = options.afterHash;
|
|
117
|
+
if (afterHash !== void 0 && !/^[0-9a-f]{64}$/.test(afterHash))
|
|
118
|
+
throw new CliError("validation_error", "Invalid embedding chunk cursor");
|
|
119
|
+
const signal = options.signal;
|
|
120
|
+
cancel(signal);
|
|
121
|
+
const page = await store.chunksToEmbed(model.key, {
|
|
122
|
+
accountId: accountIdSnapshot,
|
|
123
|
+
limit: maxChunks,
|
|
124
|
+
...budget,
|
|
125
|
+
...afterHash === void 0 ? {} : { afterHash },
|
|
126
|
+
...signal ? { signal } : {}
|
|
127
|
+
});
|
|
128
|
+
cancel(signal);
|
|
129
|
+
if (typeof page.hasMore !== "boolean" || page.nextHash !== void 0 && !/^[0-9a-f]{64}$/.test(page.nextHash) || page.hasMore && (page.items.length === 0 || page.nextHash === void 0))
|
|
130
|
+
throw new CliError("invalid_response", "Meeting chunk page cannot advance");
|
|
131
|
+
if (page.items.length > maxChunks || page.items.length * model.dims * 4 > maxVectorBytes)
|
|
132
|
+
throw new CliError("validation_error", "Embedding batch exceeds its chunk or vector payload budget");
|
|
133
|
+
const items = page.items.map(({ hash, text }) => ({ hash, text }));
|
|
134
|
+
if (items.some(({ hash, text }) => !/^[0-9a-f]{64}$/.test(hash) || typeof text !== "string") || new Set(items.map(({ hash }) => hash)).size !== items.length)
|
|
135
|
+
throw new CliError("invalid_response", "Meeting chunk page is invalid");
|
|
136
|
+
if (items.reduce((bytes, item) => bytes + Buffer.byteLength(item.text, "utf8"), 0) > budget.maxTextBytes)
|
|
137
|
+
throw new CliError("validation_error", "Embedding batch exceeds its text byte budget");
|
|
138
|
+
if (!items.length)
|
|
139
|
+
return {
|
|
140
|
+
accountId: accountIdSnapshot,
|
|
141
|
+
model,
|
|
142
|
+
saved: 0,
|
|
143
|
+
skipped: 0,
|
|
144
|
+
hasMore: page.hasMore,
|
|
145
|
+
...page.nextHash === void 0 ? {} : { nextHash: page.nextHash }
|
|
146
|
+
};
|
|
147
|
+
const vectors = await embedder.embed(items.map(({ text }) => text), "passage");
|
|
148
|
+
cancel(signal);
|
|
149
|
+
if (vectors.length !== items.length)
|
|
150
|
+
throw new CliError("invalid_response", "Meeting model returned another vector count");
|
|
151
|
+
const rows = items.map(({ hash }, index) => ({ hash, vector: validateVector(vectors[index], model.dims) }));
|
|
152
|
+
const saved = await store.saveCurrent(model.key, model.dims, rows, {
|
|
153
|
+
accountId: accountIdSnapshot,
|
|
154
|
+
...signal ? { signal } : {}
|
|
155
|
+
});
|
|
156
|
+
return {
|
|
157
|
+
accountId: accountIdSnapshot,
|
|
158
|
+
model,
|
|
159
|
+
...saved,
|
|
160
|
+
hasMore: page.hasMore,
|
|
161
|
+
...page.nextHash === void 0 ? {} : { nextHash: page.nextHash }
|
|
162
|
+
};
|
|
163
|
+
}, "applyMeetingEmbedding");
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
validateVector,
|
|
167
|
+
readMeetingSemantic,
|
|
168
|
+
proposeMeetingEmbedding,
|
|
169
|
+
applyMeetingEmbedding
|
|
170
|
+
};
|