@wirecat/tg-cli 0.127.0 → 0.129.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-EZFS2UR6.js → adapter-2XFPXBTA.js} +60 -52
- package/dist/bundle/{all-profiles-TNIUBQK6.js → all-profiles-GXFPZLYU.js} +20 -30
- package/dist/bundle/{anthropic-NGIS5LTL.js → anthropic-FHS5XNK5.js} +5 -5
- package/dist/bundle/{app-server-RPU76G7D.js → app-server-IZMFSFP2.js} +56 -63
- package/dist/bundle/{bot-api-QJ6U6BLG.js → bot-api-LQP75V5I.js} +61 -53
- package/dist/bundle/{bot-history-THULK2C6.js → bot-history-EJQOD4AQ.js} +22 -18
- package/dist/bundle/{bun-QLSLLP27.js → bun-GBAZFRCV.js} +2 -2
- package/dist/bundle/{bun-sqlite-SH5245ZY.js → bun-sqlite-JB4BX6X7.js} +6 -6
- package/dist/bundle/chunk-2JZJPVBH.js +334 -0
- package/dist/bundle/{chunk-DNNYE6PS.js → chunk-2LPODKIF.js} +18 -15
- package/dist/bundle/chunk-3KZG63EH.js +170 -0
- package/dist/bundle/chunk-3XMUP55N.js +372 -0
- package/dist/bundle/{chunk-BWHVHPAQ.js → chunk-4BJAQNJ5.js} +9 -9
- package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-66PL7P4C.js} +1 -1
- package/dist/bundle/{chunk-JWEKUAVZ.js → chunk-66UG67CE.js} +12 -12
- package/dist/bundle/{chunk-R52ZZZKZ.js → chunk-6JBRQ6PM.js} +55 -22
- package/dist/bundle/{chunk-Y7UA7HGL.js → chunk-6M3FAHPS.js} +3 -3
- package/dist/bundle/{chunk-TGKTIDYS.js → chunk-7F3LOHRB.js} +290 -504
- package/dist/bundle/{chunk-XS5C5TQ7.js → chunk-AUNNJDVD.js} +25 -8
- package/dist/bundle/{chunk-ERUB3KU3.js → chunk-B5RGPZDZ.js} +7 -7
- package/dist/bundle/{chunk-YRZXOQOB.js → chunk-B6NQJAUC.js} +2 -2
- package/dist/bundle/{chunk-4FFKCC7Y.js → chunk-BMSS3PCY.js} +62 -36
- package/dist/bundle/{chunk-VMV5CMLH.js → chunk-C4ALE7CH.js} +1 -1
- package/dist/bundle/{chunk-K4VO7S6Q.js → chunk-CKJ73EF3.js} +1 -1
- package/dist/bundle/{chunk-IX3GUNGV.js → chunk-CLG2ISQH.js} +4 -4
- package/dist/bundle/{chunk-MTU3UP5U.js → chunk-EB2JE722.js} +1 -1
- package/dist/bundle/{chunk-EGNQSWPH.js → chunk-EUL7HMUL.js} +2 -2
- package/dist/bundle/{chunk-2R6ZSE3O.js → chunk-F6CV4KUN.js} +2 -2
- package/dist/bundle/{chunk-7KCBPAQS.js → chunk-F6MLJ3V5.js} +2 -2
- package/dist/bundle/{chunk-ZSS3BH6Z.js → chunk-FH4YIBBH.js} +4 -4
- package/dist/bundle/chunk-FIO5NMK3.js +771 -0
- package/dist/bundle/{chunk-FSDLSEZA.js → chunk-G2SMVYBU.js} +2 -2
- package/dist/bundle/{chunk-FIVFP53N.js → chunk-GA3URWIF.js} +1 -1
- package/dist/bundle/{chunk-4CQ3PV3V.js → chunk-GGGBPWUS.js} +10 -15
- package/dist/bundle/{chunk-3CV5TBBR.js → chunk-GSHTLLCJ.js} +2 -2
- package/dist/bundle/{chunk-IWJ5OLU6.js → chunk-GYCKRIRK.js} +3 -3
- package/dist/bundle/{chunk-H7GAFD4N.js → chunk-HHUK3XO5.js} +1 -1
- package/dist/bundle/{chunk-NM5GBJME.js → chunk-HT6OFANN.js} +19 -19
- package/dist/bundle/{chunk-GHVRCLJI.js → chunk-I5PILOTU.js} +1 -1
- package/dist/bundle/chunk-IBSHQWIJ.js +29 -0
- package/dist/bundle/{chunk-5SN6KFPC.js → chunk-IRWSZJYL.js} +65 -60
- package/dist/bundle/{chunk-3I3TGKVG.js → chunk-IV6SIKVH.js} +4 -4
- package/dist/bundle/{chunk-URFBZNLU.js → chunk-JUFLELQ7.js} +2 -2
- package/dist/bundle/{chunk-5FDYMMEQ.js → chunk-KY3JLXW2.js} +4 -4
- package/dist/bundle/{chunk-YZGIQY2R.js → chunk-LPT5T6PU.js} +37 -28
- package/dist/bundle/chunk-LQPZDDDP.js +259 -0
- package/dist/bundle/{chunk-CXWAKV2O.js → chunk-M327UNS6.js} +6 -6
- package/dist/bundle/{chunk-4MKRKW6V.js → chunk-MS6YEIG5.js} +13 -13
- package/dist/bundle/{chunk-UY2TRFYN.js → chunk-MVFSWKTM.js} +12 -12
- package/dist/bundle/{chunk-45URY64S.js → chunk-NRCY3WBC.js} +2 -2
- package/dist/bundle/{chunk-SN52ZGFN.js → chunk-O2ULG7OO.js} +3 -3
- package/dist/bundle/{chunk-JF7D2Y4K.js → chunk-OJMDKWWL.js} +670 -519
- package/dist/bundle/{chunk-UW34Z7J3.js → chunk-OKTRB4ZQ.js} +1 -1
- package/dist/bundle/{chunk-7GE6KMLB.js → chunk-OOQVHMCS.js} +15 -15
- package/dist/bundle/{chunk-P5NJECXX.js → chunk-OWVQMK7G.js} +939 -909
- package/dist/bundle/{chunk-YIPOWJPN.js → chunk-P4FZJO5F.js} +2 -2
- package/dist/bundle/{chunk-LD42OGKK.js → chunk-PS7ZS5HD.js} +4 -4
- package/dist/bundle/{chunk-J6FHZXNS.js → chunk-PWQKGFS2.js} +49 -55
- package/dist/bundle/{chunk-APSMQIA4.js → chunk-QBNEWEJC.js} +3 -3
- package/dist/bundle/{chunk-Y65BQJOY.js → chunk-QDEP2QOA.js} +3 -3
- package/dist/bundle/{chunk-FD44T7HC.js → chunk-QFVIHBLD.js} +1 -1
- package/dist/bundle/{chunk-5KZKVKWU.js → chunk-QJDHRBXL.js} +7 -7
- package/dist/bundle/{chunk-LOG65WHO.js → chunk-QJLCEOAP.js} +1 -1
- package/dist/bundle/{chunk-XUAVZ6YX.js → chunk-RAFK5KXU.js} +9 -9
- package/dist/bundle/{chunk-UIQMBOXU.js → chunk-RPWYTOLI.js} +5 -5
- package/dist/bundle/{chunk-QPVCFSVU.js → chunk-RZPMFVWM.js} +6 -6
- package/dist/bundle/chunk-S5UTBEV3.js +1974 -0
- package/dist/bundle/{chunk-X4ECHJNG.js → chunk-SYZXOEHY.js} +98 -6
- package/dist/bundle/{chunk-BNM6KNUQ.js → chunk-SZB5WRMI.js} +2 -2
- package/dist/bundle/{chunk-5AOFOJQA.js → chunk-TGRB4SSZ.js} +4 -4
- package/dist/bundle/{chunk-Y62I2T36.js → chunk-VSPSHBAC.js} +2 -2
- package/dist/bundle/{chunk-JFQZ6BWI.js → chunk-VTJ3AOTT.js} +17 -17
- package/dist/bundle/{chunk-HPM47WO3.js → chunk-VXWDQDRU.js} +6130 -6675
- package/dist/bundle/{chunk-S3XUJPPL.js → chunk-X5H5NERR.js} +6 -6
- package/dist/bundle/{chunk-3WI53AA4.js → chunk-XHX5D5VE.js} +1174 -2636
- package/dist/bundle/chunk-XXW6PFAX.js +16 -0
- package/dist/bundle/{chunk-NBN5OYXH.js → chunk-ZRQQOGAZ.js} +4 -4
- package/dist/bundle/command-contract-G752BLKA.js +37 -0
- package/dist/bundle/{command-server-entry-UG2CLYXI.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-CN6ZVAJZ.js → echarts-GOV5M733.js} +2 -2
- package/dist/bundle/{embed-M4EHIKA5.js → embed-2IVIYNAJ.js} +6 -6
- package/dist/bundle/{embedder-K2XL2UB4.js → embedder-2HU7JYZK.js} +9 -9
- package/dist/bundle/{entry-6M55YL2H.js → entry-CSTCXYI5.js} +9 -9
- package/dist/bundle/{failure-7Y34AUJT.js → failure-GMUQKQ5K.js} +2 -2
- package/dist/bundle/{first-run-TLJILIOF.js → first-run-3IZGXZT5.js} +12 -11
- package/dist/bundle/first-screen-7QSNCZIK.js +35 -0
- package/dist/bundle/{instructions-QLC2AXAB.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-BAA3T4CH.js → node-FMQWCZRS.js} +2 -2
- package/dist/bundle/{node-sqlite-FNYVHQCO.js → node-sqlite-YN5OKOC6.js} +7 -7
- package/dist/bundle/{oauth-32T5KL5E.js → oauth-EW7PTZVT.js} +7 -7
- package/dist/bundle/{open-4VQ6FUEI.js → open-Q2RDY344.js} +5 -5
- package/dist/bundle/{openai-HDOKCN3Z.js → openai-STON6G3O.js} +28 -26
- package/dist/bundle/{process-GOUBIWKC.js → process-OQUC2TW3.js} +1 -1
- package/dist/bundle/{program-QFXJL2R5.js → program-7JJHTZ25.js} +66 -57
- package/dist/bundle/{prompt-YYODWYFO.js → prompt-WHVF7UTW.js} +5 -5
- package/dist/bundle/{proxy-transport-DP7SIMIC.js → proxy-transport-A4MRO3PF.js} +5 -5
- package/dist/bundle/{recognize-7ZULX5HL.js → recognize-YDQWMXNI.js} +4 -4
- package/dist/bundle/{remote-TUG7M5Y5.js → remote-477LQHP6.js} +9 -9
- package/dist/bundle/{rerank-D2EZWG66.js → rerank-4YPB26FG.js} +7 -7
- package/dist/bundle/{serve-MP3GA2XX.js → serve-FXJNUOTS.js} +9 -9
- package/dist/bundle/{server-D277L3H3.js → server-2S6HFBGR.js} +52 -42
- package/dist/bundle/server-UOSUTZNE.js +69 -0
- package/dist/bundle/{sqlite-runtime-XHZXEOLY.js → sqlite-runtime-RXYNJYMC.js} +6 -6
- package/dist/bundle/{state-YI3W6HGO.js → state-I2GGYGRL.js} +6 -6
- package/dist/bundle/{store-CIZPJFWE.js → store-KX3AAQZH.js} +25 -20
- package/dist/bundle/{store-C4RFPYPK.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/dist/bundle/chunk-ZIPUVOGT.js +0 -76
- package/dist/bundle/command-contract-DY6Y4TES.js +0 -34
- package/dist/bundle/decode-3NEUZJ2N.js +0 -162
- package/dist/bundle/first-screen-WME7ILW2.js +0 -32
- package/dist/bundle/server-GEP7QXGI.js +0 -62
- package/dist/bundle/store-maintenance-command-JNDYWFD2.js +0 -52
- /package/dist/bundle/{chunk-XWBPP2HX.js → chunk-ZI3YTXSF.js} +0 -0
|
@@ -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,
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
codeOf,
|
|
37
37
|
currentOperation,
|
|
38
38
|
environmentOf,
|
|
39
|
+
fetchesUnder,
|
|
39
40
|
issueMessage,
|
|
40
41
|
keyForCommand,
|
|
41
42
|
levelFor,
|
|
@@ -47,24 +48,24 @@ import {
|
|
|
47
48
|
rememberAccount,
|
|
48
49
|
rootOf2 as rootOf,
|
|
49
50
|
skipFlagFor
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-7F3LOHRB.js";
|
|
51
52
|
import {
|
|
52
53
|
providerErrorKey
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QJDHRBXL.js";
|
|
54
55
|
import {
|
|
55
56
|
isCliFailure
|
|
56
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-QBNEWEJC.js";
|
|
57
58
|
import {
|
|
58
59
|
resolvePaths
|
|
59
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-HT6OFANN.js";
|
|
60
61
|
import {
|
|
61
62
|
CliError
|
|
62
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
63
64
|
import {
|
|
64
65
|
__name
|
|
65
66
|
} from "./chunk-ZVVMGPBJ.js";
|
|
66
67
|
|
|
67
|
-
// 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
|
|
68
69
|
import { openSync } from "node:fs";
|
|
69
70
|
import { createInterface } from "node:readline";
|
|
70
71
|
import { ReadStream } from "node:tty";
|
|
@@ -119,7 +120,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
|
|
|
119
120
|
throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
|
|
120
121
|
}, "terminalAsker");
|
|
121
122
|
|
|
122
|
-
// 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
|
|
123
124
|
import { readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
124
125
|
import { join } from "node:path";
|
|
125
126
|
var DEFAULT_PACE = { perMinute: 60, burst: 20 };
|
|
@@ -214,7 +215,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
|
|
|
214
215
|
await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
|
|
215
216
|
}, "waitForTurn");
|
|
216
217
|
|
|
217
|
-
// 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
|
|
218
219
|
var pathOf = /* @__PURE__ */ __name((command) => {
|
|
219
220
|
const words = [];
|
|
220
221
|
for (let at = command; at?.parent; at = at.parent)
|
|
@@ -274,7 +275,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
|
|
|
274
275
|
throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
|
|
275
276
|
}, "refuseUnknownPermissionKeys");
|
|
276
277
|
|
|
277
|
-
// 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
|
|
278
279
|
var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
|
|
279
280
|
var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
|
|
280
281
|
var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
|
|
@@ -371,7 +372,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
|
|
|
371
372
|
});
|
|
372
373
|
}, "flooded");
|
|
373
374
|
|
|
374
|
-
// 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
|
|
375
376
|
var observed = /* @__PURE__ */ __name((messenger, events) => {
|
|
376
377
|
const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
|
|
377
378
|
const write = currentOperation();
|
|
@@ -470,7 +471,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
|
|
|
470
471
|
counts[part] = (counts[part] ?? 0) + items.length;
|
|
471
472
|
}, "byPart");
|
|
472
473
|
|
|
473
|
-
// 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
|
|
474
475
|
var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
|
|
475
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" }) => {
|
|
476
477
|
let warned = false;
|
|
@@ -1046,7 +1047,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
|
|
|
1046
1047
|
}
|
|
1047
1048
|
}, "keep");
|
|
1048
1049
|
|
|
1049
|
-
// 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
|
|
1050
1051
|
var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
|
|
1051
1052
|
let opened;
|
|
1052
1053
|
return {
|
|
@@ -1324,6 +1325,8 @@ var refuseLocalWrite = /* @__PURE__ */ __name((context, command, permission) =>
|
|
|
1324
1325
|
const { level, key } = levelFor(settings.permissions, permission);
|
|
1325
1326
|
if (level === "allow" || level === "ask" && context.agent)
|
|
1326
1327
|
return;
|
|
1328
|
+
if (fetchesUnder(level, permission))
|
|
1329
|
+
return;
|
|
1327
1330
|
if (key === CEILING_KEY)
|
|
1328
1331
|
throw ceilingRefusal(permission, command);
|
|
1329
1332
|
throw new CliError(level === "ask" ? "confirmation_required" : "permission_error", `profile ${settings.profile} does not let ${permission} write (permissions.${key} is ${level}, from the ${settings.permissionSources[key ?? ""] ?? "default"}); to allow it: ${command} ${settings.profile} config set permissions.${permission} allow`, { permission });
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
validateVector
|
|
5
|
+
} from "./chunk-3KZG63EH.js";
|
|
6
|
+
import {
|
|
7
|
+
MESSAGE_PARSING,
|
|
8
|
+
RRF_K
|
|
9
|
+
} from "./chunk-FIO5NMK3.js";
|
|
10
|
+
import {
|
|
11
|
+
normalize
|
|
12
|
+
} from "./chunk-XXW6PFAX.js";
|
|
13
|
+
import {
|
|
14
|
+
meaningFloor
|
|
15
|
+
} from "./chunk-2JZJPVBH.js";
|
|
16
|
+
import {
|
|
17
|
+
formatMeetingReference,
|
|
18
|
+
implicitTextTerms,
|
|
19
|
+
liftMeetingFields,
|
|
20
|
+
parseLucene,
|
|
21
|
+
parseMeetingReference,
|
|
22
|
+
walkQuery
|
|
23
|
+
} from "./chunk-XHX5D5VE.js";
|
|
24
|
+
import {
|
|
25
|
+
CliError
|
|
26
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
27
|
+
import {
|
|
28
|
+
__name
|
|
29
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
30
|
+
|
|
31
|
+
// 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-combined.js
|
|
32
|
+
import { createHash } from "node:crypto";
|
|
33
|
+
|
|
34
|
+
// 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/search/question-plan.js
|
|
35
|
+
var words = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
36
|
+
var joinedHyphens = /* @__PURE__ */ __name((text) => (normalize(text).match(new RegExp("(?<![:\\p{L}\\p{N}-])\\p{L}[\\p{L}\\p{N}]*(?:-\\p{L}[\\p{L}\\p{N}]*)+", "gu")) ?? []).map((word) => word.replaceAll("-", "")), "joinedHyphens");
|
|
37
|
+
var scaffolding = new Set(words("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u043E\u0435 \u043A\u0442\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u0447\u0442\u043E \u0432\u043E \u043F\u043E \u043D\u0430 \u0432 \u043A \u0441 \u0443 \u0447\u0435\u0440\u0435\u0437 \u043B\u0438 \u0434\u043E\u043B\u0436\u0435\u043D \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0443\u0436\u043D\u043E \u0438\u0434\u0451\u0442 \u0438\u0434\u0435\u0442 \u043C\u043E\u0436\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043C\u043E\u0433\u0443\u0442"));
|
|
38
|
+
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
39
|
+
var QUESTION_STARTS = new Set(words("what which how who whom whose where when why can could should would did do does is are was were will \u0447\u0442\u043E \u043A\u0442\u043E \u043A\u043E\u0433\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u043E\u0435 \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u0443\u044E \u043A\u0430\u043A\u0438\u043C \u043A\u0430\u043A\u043E\u0433\u043E \u043A\u0430\u043A\u0438\u0445 \u043F\u043E\u0447\u0435\u043C\u0443 \u0437\u0430\u0447\u0435\u043C \u043E\u0442\u043A\u0443\u0434\u0430 \u043A\u0443\u0434\u0430 \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043B\u0438 \u043C\u043E\u0436\u043D\u043E \u0440\u0430\u0437\u0432\u0435 \u0447\u0435\u0439 \u0447\u044C\u044F \u0447\u044C\u0451 \u0447\u044C\u0438"));
|
|
40
|
+
var QUESTION_FILLER = new Set(words("about any did does why whom whose would will \u044D\u0442\u043E \u043C\u044B \u0432\u044B \u044F \u043E\u043D\u0438 \u043E\u043D \u043E\u043D\u0430 \u043E \u043E\u0431 \u043F\u0440\u043E \u043B\u0438"));
|
|
41
|
+
var LINKING = new Set(words("and or but not nor with without this that these those there their they them you your our its his her all any and for into onto over then than also just and \u043F\u0440\u0438 \u0434\u043B\u044F \u0431\u0435\u0437 \u043D\u0430\u0434 \u043F\u043E\u0434 \u0438\u043B\u0438 \u043B\u0438\u0431\u043E \u0435\u0433\u043E \u0435\u0451 \u0438\u0445 \u0432\u0441\u0435 \u0432\u0441\u0451 \u0443\u0436\u0435 \u0435\u0449\u0451 \u0442\u0430\u043A \u0442\u043E\u0436\u0435 \u0442\u0430\u043A\u0436\u0435 \u0431\u044B\u043B \u0431\u044B\u043B\u0430 \u0431\u044B\u043B\u0438 \u0431\u044B\u043B\u043E \u0431\u0443\u0434\u0435\u0442 \u044D\u0442\u043E \u044D\u0442\u0430 \u044D\u0442\u043E\u0442 \u044D\u0442\u0438 \u0442\u0430\u043C \u0442\u0443\u0442"));
|
|
42
|
+
var isFunctionWord = /* @__PURE__ */ __name((word) => scaffolding.has(word) || QUESTION_STARTS.has(word) || QUESTION_FILLER.has(word) || LINKING.has(word), "isFunctionWord");
|
|
43
|
+
var questionTerms = /* @__PURE__ */ __name((text) => /\?\s*$/u.test(text) || QUESTION_STARTS.has(words(text)[0] ?? "") ? words(text).filter((word) => !scaffolding.has(word) && !QUESTION_STARTS.has(word) && !QUESTION_FILLER.has(word)) : null, "questionTerms");
|
|
44
|
+
function planQuestion(text, strict = false) {
|
|
45
|
+
if (strict)
|
|
46
|
+
return {
|
|
47
|
+
changed: false,
|
|
48
|
+
natural: false,
|
|
49
|
+
queries: [text],
|
|
50
|
+
scope: "",
|
|
51
|
+
terms: words(text),
|
|
52
|
+
rankingTerms: words(text),
|
|
53
|
+
removed: [],
|
|
54
|
+
aliases: []
|
|
55
|
+
};
|
|
56
|
+
const inputAst = parseLucene(text, MESSAGE_PARSING);
|
|
57
|
+
const rawTextual = walkQuery(inputAst.root).filter((node) => node.field === "text" || node.field === "exact");
|
|
58
|
+
const body = rawTextual.map((node) => node.value).join(" ");
|
|
59
|
+
const prefix = words(body).slice(0, 2);
|
|
60
|
+
const questionPrefix = [
|
|
61
|
+
"what",
|
|
62
|
+
"which",
|
|
63
|
+
"how",
|
|
64
|
+
"who",
|
|
65
|
+
"where",
|
|
66
|
+
"when",
|
|
67
|
+
"can",
|
|
68
|
+
"could",
|
|
69
|
+
"should",
|
|
70
|
+
"\u0441\u043A\u043E\u043B\u044C\u043A\u043E",
|
|
71
|
+
"\u043A\u0430\u043A\u043E\u0438",
|
|
72
|
+
"\u043A\u0430\u043A\u0430\u044F",
|
|
73
|
+
"\u043A\u0430\u043A\u0438\u0435",
|
|
74
|
+
"\u043A\u0430\u043A\u043E\u0435",
|
|
75
|
+
"\u043A\u0442\u043E",
|
|
76
|
+
"\u043A\u043E\u043C\u0443",
|
|
77
|
+
"\u043A\u0435\u043C",
|
|
78
|
+
"\u0433\u0434\u0435",
|
|
79
|
+
"\u043A\u043E\u0433\u0434\u0430",
|
|
80
|
+
"\u043A\u0430\u043A",
|
|
81
|
+
"\u0447\u0442\u043E",
|
|
82
|
+
"\u043C\u043E\u0436\u043D\u043E",
|
|
83
|
+
"\u043C\u043E\u0436\u0435\u0442",
|
|
84
|
+
"\u043C\u043E\u0433\u0443\u0442"
|
|
85
|
+
].includes(prefix[0] ?? "") || ["\u043A", "\u0432\u043E"].includes(prefix[0] ?? "") && ["\u043A\u043E\u043C\u0443", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E"].includes(prefix[1] ?? "");
|
|
86
|
+
const natural = questionWord.test(body) && (/\?/u.test(body) || questionPrefix);
|
|
87
|
+
let cleaned = text;
|
|
88
|
+
if (natural && !text.includes("\\")) {
|
|
89
|
+
const last = rawTextual.at(-1);
|
|
90
|
+
const mark = (last?.span.end ?? 0) - 1;
|
|
91
|
+
if (last?.operator === "wildcard" && text[mark] === "?")
|
|
92
|
+
cleaned = text.slice(0, mark) + text.slice(mark + 1);
|
|
93
|
+
}
|
|
94
|
+
const ast = cleaned === text ? inputAst : parseLucene(cleaned, MESSAGE_PARSING);
|
|
95
|
+
const predicates = walkQuery(ast.root);
|
|
96
|
+
const textual = predicates.filter((p) => p.field === "text" || p.field === "exact");
|
|
97
|
+
const fields = predicates.filter((p) => p.field !== "text" && p.field !== "exact");
|
|
98
|
+
const scope = fields.map((p) => {
|
|
99
|
+
const raw = cleaned.slice(p.span.start, p.span.end);
|
|
100
|
+
return new RegExp(`^${p.field}[:=<>]`, "u").test(raw) ? raw : `${p.field}:${raw}`;
|
|
101
|
+
}).join(" ");
|
|
102
|
+
const bypass = strict || !natural || implicitTextTerms(cleaned).size === 0 || // A quoted single word is how `plainQuery` keeps `10:30` or `HH:MM` literal; it is no phrase the asker wrote.
|
|
103
|
+
textual.some((p) => !(p.operator === "term" || p.operator === "phrase" && !/\s/u.test(p.value)) || p.field === "exact");
|
|
104
|
+
if (bypass)
|
|
105
|
+
return {
|
|
106
|
+
changed: false,
|
|
107
|
+
natural: false,
|
|
108
|
+
queries: [text],
|
|
109
|
+
scope,
|
|
110
|
+
terms: textual.flatMap((p) => words(p.value)),
|
|
111
|
+
rankingTerms: textual.flatMap((p) => words(p.value)),
|
|
112
|
+
removed: [],
|
|
113
|
+
aliases: []
|
|
114
|
+
};
|
|
115
|
+
const original = textual.flatMap((p) => words(p.value));
|
|
116
|
+
const removed = original.filter((w) => scaffolding.has(w));
|
|
117
|
+
const terms = [...new Set(original.filter((w) => !scaffolding.has(w)))];
|
|
118
|
+
if (!terms.length)
|
|
119
|
+
return {
|
|
120
|
+
changed: false,
|
|
121
|
+
natural: true,
|
|
122
|
+
queries: [text],
|
|
123
|
+
scope,
|
|
124
|
+
terms,
|
|
125
|
+
rankingTerms: original,
|
|
126
|
+
removed,
|
|
127
|
+
aliases: []
|
|
128
|
+
};
|
|
129
|
+
const alias = [...terms];
|
|
130
|
+
const changes = [];
|
|
131
|
+
const replace = /* @__PURE__ */ __name((from, to) => {
|
|
132
|
+
for (let i = 0; i < alias.length; i++)
|
|
133
|
+
if (from.includes(alias[i] ?? "")) {
|
|
134
|
+
changes.push(`${alias[i]} -> ${to}`);
|
|
135
|
+
alias[i] = to;
|
|
136
|
+
}
|
|
137
|
+
}, "replace");
|
|
138
|
+
if (terms.some((w) => ["refund", "euros", "euro", "money", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442\u0430", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442", "\u0435\u0432\u0440\u043E"].includes(w))) {
|
|
139
|
+
replace(["returned", "refunded", "received"], "refund");
|
|
140
|
+
replace(["\u0432\u0435\u0440\u043D\u0443\u043B\u0438", "\u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0435\u043D\u043E", "\u043F\u0435\u0440\u0435\u0447\u0438\u0441\u043B\u0435\u043D\u043E"], "\u0432\u043E\u0437\u0432\u0440\u0430\u0442");
|
|
141
|
+
}
|
|
142
|
+
if (terms.some((w) => ["log", "logs", "retention", "backup", "\u043B\u043E\u0433\u043E\u0432", "\u043B\u043E\u0433\u0438", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F"].includes(w))) {
|
|
143
|
+
replace(["lifetime", "kept", "keep"], "retention");
|
|
144
|
+
replace(["\u0445\u0440\u0430\u043D\u044F\u0442\u0441\u044F", "\u0445\u0440\u0430\u043D\u044F\u0442", "\u0445\u0440\u0430\u043D\u0438\u0442\u044C", "\u0441\u0440\u043E\u043A"], "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435");
|
|
145
|
+
}
|
|
146
|
+
if (terms.includes("service") || terms.includes("build"))
|
|
147
|
+
replace(["currently", "now"], "current");
|
|
148
|
+
const render = /* @__PURE__ */ __name((ws) => [...new Set(ws)].join(" ") + (scope ? ` ${scope}` : ""), "render");
|
|
149
|
+
const queries = [.../* @__PURE__ */ new Set([render(terms), render(alias)])].slice(0, 2);
|
|
150
|
+
return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
|
|
151
|
+
}
|
|
152
|
+
__name(planQuestion, "planQuestion");
|
|
153
|
+
var questionText = /* @__PURE__ */ __name((text) => text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
|
|
154
|
+
var lookupTerms = /* @__PURE__ */ __name((plan) => [
|
|
155
|
+
...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))
|
|
156
|
+
], "lookupTerms");
|
|
157
|
+
var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
|
|
158
|
+
var questionLookup = /* @__PURE__ */ __name((text) => {
|
|
159
|
+
let plan;
|
|
160
|
+
try {
|
|
161
|
+
plan = planQuestion(questionText(text));
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (error instanceof CliError)
|
|
164
|
+
return void 0;
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
const terms = plan.changed ? lookupTerms(plan) : [];
|
|
168
|
+
return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
|
|
169
|
+
}, "questionLookup");
|
|
170
|
+
|
|
171
|
+
// 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-hit-search.js
|
|
172
|
+
var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
|
|
173
|
+
let before = Number.POSITIVE_INFINITY;
|
|
174
|
+
for (; ; ) {
|
|
175
|
+
signal?.throwIfAborted();
|
|
176
|
+
const { indexed, remaining } = await meetings.indexSearch({
|
|
177
|
+
accountId,
|
|
178
|
+
limit: 1e3,
|
|
179
|
+
maxReadBytes: 64 * 1024 ** 2,
|
|
180
|
+
signal
|
|
181
|
+
});
|
|
182
|
+
if (remaining === 0 || indexed === 0 || remaining >= before)
|
|
183
|
+
return;
|
|
184
|
+
before = remaining;
|
|
185
|
+
}
|
|
186
|
+
}, "refreshMeetingIndex");
|
|
187
|
+
var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
|
|
188
|
+
const { project, tag, topic, ...input } = request;
|
|
189
|
+
input.signal?.throwIfAborted();
|
|
190
|
+
if (project !== void 0 && input.projectId !== void 0 || [tag, topic].filter((value) => value !== void 0).length + Number(input.tagId !== void 0) > 1)
|
|
191
|
+
throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
|
|
192
|
+
const selection = [];
|
|
193
|
+
const knowledge = store.knowledge;
|
|
194
|
+
if (!knowledge && [project, tag, topic].some((value) => value !== void 0))
|
|
195
|
+
throw new CliError("configuration_error", "this store cannot resolve project, tag or topic names");
|
|
196
|
+
for (const [kind, name] of [
|
|
197
|
+
["project", project],
|
|
198
|
+
["tag", tag],
|
|
199
|
+
["topic", topic]
|
|
200
|
+
]) {
|
|
201
|
+
if (name === void 0)
|
|
202
|
+
continue;
|
|
203
|
+
if (!knowledge)
|
|
204
|
+
continue;
|
|
205
|
+
const found = await knowledge.resolveVocabulary(name, { kind, signal: input.signal });
|
|
206
|
+
input.signal?.throwIfAborted();
|
|
207
|
+
if (found.ambiguous || found.matches.length !== 1)
|
|
208
|
+
throw new CliError(found.matches.length ? "validation_error" : "not_found", `the ${kind} name needs one canonical record`, {
|
|
209
|
+
candidates: found.matches.map((entry2) => ({ kind: entry2.kind, id: entry2.id, name: entry2.name }))
|
|
210
|
+
});
|
|
211
|
+
const entry = found.matches[0];
|
|
212
|
+
const id = Number(entry?.id);
|
|
213
|
+
if (!entry || entry.kind !== kind || !Number.isSafeInteger(id) || id < 1)
|
|
214
|
+
throw new CliError("invalid_response", "vocabulary resolution returned an invalid canonical record");
|
|
215
|
+
if (kind === "project")
|
|
216
|
+
input.projectId = id;
|
|
217
|
+
else
|
|
218
|
+
input.tagId = id;
|
|
219
|
+
selection.push({ kind, id, name: entry.name, by: "explicit-link" });
|
|
220
|
+
}
|
|
221
|
+
return { input, selection };
|
|
222
|
+
}, "resolveMeetingSelection");
|
|
223
|
+
|
|
224
|
+
// 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-combined.js
|
|
225
|
+
var DEPTH = 200;
|
|
226
|
+
var cursorOf = /* @__PURE__ */ __name((value, key) => {
|
|
227
|
+
if (value === void 0)
|
|
228
|
+
return 0;
|
|
229
|
+
let cursor;
|
|
230
|
+
try {
|
|
231
|
+
cursor = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
|
|
232
|
+
} catch {
|
|
233
|
+
throw new CliError("validation_error", "the cursor is not from a combined meeting search; search again");
|
|
234
|
+
}
|
|
235
|
+
if (cursor?.version !== 1 || cursor.key !== key || !Number.isSafeInteger(cursor.offset) || cursor.offset < 0)
|
|
236
|
+
throw new CliError("validation_error", "the cursor belongs to another query, filter or model; search again");
|
|
237
|
+
return cursor.offset;
|
|
238
|
+
}, "cursorOf");
|
|
239
|
+
var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, typed, request) => {
|
|
240
|
+
const { maxChunks, maxRows, maxTextBytes, ...chosen } = request;
|
|
241
|
+
const { query, request: words2 } = liftMeetingFields(typed, chosen);
|
|
242
|
+
const { input, selection } = await resolveMeetingSelection(store, words2);
|
|
243
|
+
const { after, limit = 20, maxReadBytes, ...filters } = input;
|
|
244
|
+
const terms = questionTerms(query);
|
|
245
|
+
const wordQuery = terms === null ? query : terms.join(" ");
|
|
246
|
+
const key = createHash("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
|
|
247
|
+
const offset = cursorOf(after, key);
|
|
248
|
+
let byWords = [];
|
|
249
|
+
let indexing = "ready";
|
|
250
|
+
let refused;
|
|
251
|
+
if (wordQuery.trim()) {
|
|
252
|
+
await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
|
|
253
|
+
try {
|
|
254
|
+
const page = await store.meetings.searchHits(wordQuery, { ...filters, limit: DEPTH, maxReadBytes });
|
|
255
|
+
byWords = page.items;
|
|
256
|
+
indexing = page.coverage.indexing;
|
|
257
|
+
} catch (error) {
|
|
258
|
+
if (!(error instanceof CliError) || error.code !== "validation_error")
|
|
259
|
+
throw error;
|
|
260
|
+
refused = error.message;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
input.signal?.throwIfAborted();
|
|
264
|
+
const vectors = await embedder.embed([query], "query");
|
|
265
|
+
if (vectors.length !== 1)
|
|
266
|
+
throw new CliError("invalid_response", "Meeting query model returned another vector count");
|
|
267
|
+
const vector = vectors[0];
|
|
268
|
+
const ranked = await store.meetingVectors.ranked(embedder.key, validateVector(vector, embedder.dims), {
|
|
269
|
+
...filters,
|
|
270
|
+
limit: DEPTH,
|
|
271
|
+
...maxChunks === void 0 ? {} : { maxChunks },
|
|
272
|
+
...maxRows === void 0 ? {} : { maxRows },
|
|
273
|
+
...maxTextBytes === void 0 ? {} : { maxTextBytes }
|
|
274
|
+
});
|
|
275
|
+
const floor = meaningFloor(embedder.key);
|
|
276
|
+
const byMeaning = ranked.items.filter(({ score }) => score > floor);
|
|
277
|
+
const merged = /* @__PURE__ */ new Map();
|
|
278
|
+
byMeaning.forEach((hit, rank) => {
|
|
279
|
+
const reference = { type: "meeting", accountId: input.accountId, meetingId: hit.meetingId };
|
|
280
|
+
const first = formatMeetingReference({
|
|
281
|
+
...reference,
|
|
282
|
+
transcriptId: hit.transcriptId,
|
|
283
|
+
cuePosition: hit.firstPosition
|
|
284
|
+
});
|
|
285
|
+
merged.set(`${hit.transcriptId}:${hit.firstPosition}`, {
|
|
286
|
+
ref: first,
|
|
287
|
+
meetingId: hit.meetingId,
|
|
288
|
+
scope: "transcript",
|
|
289
|
+
text: hit.text,
|
|
290
|
+
startMs: null,
|
|
291
|
+
source: { title: hit.title, startedAt: hit.startedAt, url: null },
|
|
292
|
+
by: ["meaning"],
|
|
293
|
+
score: hit.score,
|
|
294
|
+
passage: {
|
|
295
|
+
first,
|
|
296
|
+
last: formatMeetingReference({ ...reference, transcriptId: hit.transcriptId, cuePosition: hit.lastPosition })
|
|
297
|
+
},
|
|
298
|
+
fused: 1 / (RRF_K + rank + 1)
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
byWords.forEach((hit, rank) => {
|
|
302
|
+
const share = 1 / (RRF_K + rank + 1);
|
|
303
|
+
const cue = hit.scope === "transcript" ? parseMeetingReference(hit.ref) : void 0;
|
|
304
|
+
const within = cue?.cuePosition === void 0 ? void 0 : byMeaning.find((passage) => passage.transcriptId === cue.transcriptId && passage.firstPosition <= cue.cuePosition && cue.cuePosition <= passage.lastPosition);
|
|
305
|
+
const held = within && merged.get(`${within.transcriptId}:${within.firstPosition}`);
|
|
306
|
+
const found = {
|
|
307
|
+
ref: hit.ref,
|
|
308
|
+
text: hit.text,
|
|
309
|
+
startMs: hit.startMs,
|
|
310
|
+
...hit.match === void 0 ? {} : { match: hit.match },
|
|
311
|
+
...hit.corrections === void 0 ? {} : { corrections: hit.corrections }
|
|
312
|
+
};
|
|
313
|
+
if (held && !held.by.includes("words")) {
|
|
314
|
+
Object.assign(held, found, { by: ["words", "meaning"], fused: held.fused + share });
|
|
315
|
+
if (hit.source?.url)
|
|
316
|
+
held.source.url = hit.source.url;
|
|
317
|
+
} else if (held)
|
|
318
|
+
held.fused += share;
|
|
319
|
+
else
|
|
320
|
+
merged.set(`w:${hit.ref}:${hit.scope}:${hit.id}`, {
|
|
321
|
+
...found,
|
|
322
|
+
meetingId: hit.meetingId,
|
|
323
|
+
scope: hit.scope,
|
|
324
|
+
source: {
|
|
325
|
+
title: hit.source?.title ?? null,
|
|
326
|
+
startedAt: hit.source?.startedAt ?? null,
|
|
327
|
+
url: hit.source?.url ?? null
|
|
328
|
+
},
|
|
329
|
+
by: ["words"],
|
|
330
|
+
score: null,
|
|
331
|
+
fused: share
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
const ordered = [...merged.values()].sort((a, b) => b.fused - a.fused || Number(b.by.includes("words")) - Number(a.by.includes("words")) || (b.score ?? -2) - (a.score ?? -2));
|
|
335
|
+
const items = ordered.slice(offset, offset + limit).map(({ fused: _, ...hit }) => hit);
|
|
336
|
+
const hasMore = ordered.length > offset + limit;
|
|
337
|
+
return {
|
|
338
|
+
items,
|
|
339
|
+
hasMore,
|
|
340
|
+
nextCursor: hasMore ? Buffer.from(JSON.stringify({ version: 1, key, offset: offset + limit })).toString("base64url") : null,
|
|
341
|
+
selection,
|
|
342
|
+
words: {
|
|
343
|
+
query: wordQuery,
|
|
344
|
+
...terms === null ? {} : { from: "question" },
|
|
345
|
+
...refused === void 0 ? {} : { refused }
|
|
346
|
+
},
|
|
347
|
+
model: { key: embedder.key, model: embedder.model, kind: embedder.kind, dims: embedder.dims },
|
|
348
|
+
coverage: {
|
|
349
|
+
archiveCompleteness: "unknown",
|
|
350
|
+
indexCompleteness: "unknown",
|
|
351
|
+
indexing,
|
|
352
|
+
/** Every vector of the selection was compared; false when `maxChunks` stopped the scan. */
|
|
353
|
+
meaningScanComplete: ranked.complete,
|
|
354
|
+
scanned: ranked.scanned,
|
|
355
|
+
/** Each side ranks this many at most; pages past them hold nothing more. */
|
|
356
|
+
depth: DEPTH
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
}, "searchMeetingsCombined");
|
|
360
|
+
|
|
361
|
+
export {
|
|
362
|
+
words,
|
|
363
|
+
joinedHyphens,
|
|
364
|
+
isFunctionWord,
|
|
365
|
+
planQuestion,
|
|
366
|
+
questionText,
|
|
367
|
+
lookupTerms,
|
|
368
|
+
anyOfTerms,
|
|
369
|
+
questionLookup,
|
|
370
|
+
resolveMeetingSelection,
|
|
371
|
+
searchMeetingsCombined
|
|
372
|
+
};
|