@wirecat/notion-cli 0.1.0 → 0.2.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/CHANGELOG.md +40 -0
- package/README.md +10 -4
- package/contracts/wirecat.json +650 -1
- package/dist/bin/notion.js +2 -2
- package/dist/bundle/{all-profiles-OETMCOLN.js → all-profiles-JGYLQZ5C.js} +9 -9
- package/dist/bundle/{anthropic-5Y3O2TYM.js → anthropic-S2VSMIKQ.js} +5 -5
- package/dist/bundle/{app-server-IVWBIVHC.js → app-server-SASYDBCA.js} +55 -46
- package/dist/bundle/{bun-EO636SAD.js → bun-LU5LP3JI.js} +2 -2
- package/dist/bundle/{bun-sqlite-C2T7QJ2M.js → bun-sqlite-JBSINB4O.js} +6 -6
- package/dist/bundle/{chunk-DIM5YWBU.js → chunk-22QQUKWA.js} +1 -1
- package/dist/bundle/{chunk-B4B65XIO.js → chunk-2F4QQ7WB.js} +3 -3
- package/dist/bundle/{chunk-2YR3RYT4.js → chunk-2F6VO5HA.js} +3 -3
- package/dist/bundle/chunk-2LWO3PDX.js +726 -0
- package/dist/bundle/{chunk-RSIS7BR7.js → chunk-3AL7QUS3.js} +20 -20
- package/dist/bundle/{chunk-RDZ7SVBZ.js → chunk-3Z4YTSRY.js} +3 -3
- package/dist/bundle/{chunk-QBC23NHD.js → chunk-4HWJOU7N.js} +1 -1
- package/dist/bundle/{chunk-WM7663C2.js → chunk-4IPURN72.js} +8 -8
- package/dist/bundle/{chunk-CLG2ISQH.js → chunk-4ZTVJHWU.js} +4 -4
- package/dist/bundle/{chunk-IQWEJEB5.js → chunk-5IYKVRH2.js} +26157 -21070
- package/dist/bundle/{chunk-7FII4DCE.js → chunk-5NFK5EM2.js} +7 -7
- package/dist/bundle/{chunk-K5TWMQSY.js → chunk-5QIQEUOG.js} +8 -8
- package/dist/bundle/{chunk-F6MLJ3V5.js → chunk-5RDNBG7D.js} +2 -2
- package/dist/bundle/{chunk-ST2UC7FS.js → chunk-5RSC54NA.js} +30 -26
- package/dist/bundle/{chunk-7N5QB6NL.js → chunk-6EVKHZKN.js} +5 -3
- package/dist/bundle/{chunk-EU5WCOMQ.js → chunk-6RA3EABS.js} +45 -34
- package/dist/bundle/{chunk-JKIN5TOU.js → chunk-AOCUKEAX.js} +4 -4
- package/dist/bundle/{chunk-OWJDC4CB.js → chunk-B26TQZKZ.js} +12 -12
- package/dist/bundle/{chunk-WK3OSDNV.js → chunk-B7ON6KPT.js} +7 -7
- package/dist/bundle/{chunk-RLSFOR2D.js → chunk-BNPTZ5ZB.js} +4 -4
- package/dist/bundle/{chunk-WVZFXI36.js → chunk-D7QSEEYW.js} +4 -4
- package/dist/bundle/{chunk-JK44XO2S.js → chunk-DH5PRHT4.js} +56 -56
- package/dist/bundle/chunk-EUIVXFLJ.js +259 -0
- package/dist/bundle/{chunk-64D5VUZ4.js → chunk-FPY6EJ7B.js} +67 -63
- package/dist/bundle/{chunk-EGTBL3MJ.js → chunk-FT3LN3HP.js} +1 -1
- package/dist/bundle/{chunk-NLDYZBTC.js → chunk-FWVBPRL4.js} +1129 -2555
- package/dist/bundle/{chunk-UWIA2G6Q.js → chunk-FXEJY4OL.js} +329 -528
- package/dist/bundle/{chunk-R6ZM45NF.js → chunk-G3EZFRSS.js} +88 -30
- package/dist/bundle/{chunk-B2XKEEFX.js → chunk-GZOUFX3C.js} +4 -4
- package/dist/bundle/{chunk-WWMB4UHF.js → chunk-HL52XXZX.js} +1 -1
- package/dist/bundle/{chunk-4GC5DBHW.js → chunk-KCLOUUYF.js} +3 -3
- package/dist/bundle/chunk-KFVDL2QS.js +146 -0
- package/dist/bundle/{chunk-35K5T6WV.js → chunk-KGERXYTV.js} +1 -1
- package/dist/bundle/{chunk-BWICUW7W.js → chunk-KM6WHPHI.js} +2 -2
- package/dist/bundle/{chunk-AE2KQ37N.js → chunk-LAYPFBOM.js} +6 -6
- package/dist/bundle/chunk-LLG2POQ7.js +170 -0
- package/dist/bundle/{chunk-B2WFKFYL.js → chunk-M3KB25D3.js} +20 -116
- package/dist/bundle/{chunk-RAZKIHGH.js → chunk-M7S2NDWB.js} +3 -3
- package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
- package/dist/bundle/chunk-MY742GAD.js +1977 -0
- package/dist/bundle/chunk-MZU2YFBZ.js +823 -0
- package/dist/bundle/{chunk-AQZO3ITW.js → chunk-NOQ7B5N7.js} +2 -2
- package/dist/bundle/{chunk-QC3KOJT4.js → chunk-NQWV4WQO.js} +6 -6
- package/dist/bundle/{chunk-FF4DDBCB.js → chunk-ODBZNSZ6.js} +6 -6
- package/dist/bundle/{chunk-TR7R5DL4.js → chunk-OTV53F34.js} +9 -9
- package/dist/bundle/{chunk-KHOVVPLC.js → chunk-P7CUM5IB.js} +1 -1
- package/dist/bundle/{chunk-CWVAYQXI.js → chunk-RV64YUQX.js} +8 -8
- package/dist/bundle/{chunk-TSCIIXN3.js → chunk-SHJQ6JKG.js} +2 -2
- package/dist/bundle/{chunk-24FAYAML.js → chunk-SWAOWNKW.js} +3 -3
- package/dist/bundle/chunk-SZOVLP44.js +29 -0
- package/dist/bundle/chunk-TPX2M45D.js +385 -0
- package/dist/bundle/{chunk-UWW24JQF.js → chunk-TSDBSIFM.js} +3 -3
- package/dist/bundle/{chunk-YA4LSSDZ.js → chunk-VBHETQVV.js} +1435 -1788
- package/dist/bundle/{chunk-HRTIRRXR.js → chunk-VCIALTEM.js} +33 -6
- package/dist/bundle/{chunk-ESZT4WW3.js → chunk-WCSOH4JS.js} +3 -3
- package/dist/bundle/{chunk-HWRKURQH.js → chunk-WF4D56CA.js} +2 -2
- package/dist/bundle/chunk-WJHZMR2W.js +335 -0
- package/dist/bundle/chunk-X4TIMMKJ.js +16 -0
- package/dist/bundle/{chunk-XL2HXHP3.js → chunk-XF26XKTS.js} +2 -2
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/{chunk-47R43UVJ.js → chunk-YMYUBZWT.js} +19 -19
- package/dist/bundle/{chunk-3D3PFXBP.js → chunk-YNTLT3Z3.js} +10 -15
- package/dist/bundle/{chunk-GA3URWIF.js → chunk-YVI5SQPY.js} +1 -1
- package/dist/bundle/{chunk-XC5CKHX2.js → chunk-Z56QFOBR.js} +1 -1
- package/dist/bundle/{chunk-EPAZ7DJB.js → chunk-ZKAEZXUP.js} +42 -38
- package/dist/bundle/{chunk-66PL7P4C.js → chunk-ZZ32DXTH.js} +1 -1
- package/dist/bundle/command-contract-JS5V27NX.js +38 -0
- package/dist/bundle/{command-server-entry-A66DJ3MH.js → command-server-entry-UFSG7KRO.js} +26 -23
- package/dist/bundle/decode-7LLWTSPT.js +297 -0
- package/dist/bundle/{dispatch-FEKU5UXC.js → dispatch-2GY6JIJH.js} +8 -8
- package/dist/bundle/{dist-YFKABFFF.js → dist-ILNOLGYN.js} +1 -1
- package/dist/bundle/{echarts-XD2JSWU4.js → echarts-BXX4OQWC.js} +2 -2
- package/dist/bundle/{embed-F3HYGAF7.js → embed-JXFNBTKH.js} +6 -6
- package/dist/bundle/{embedder-GSEDDUH7.js → embedder-57YZ44KO.js} +9 -9
- package/dist/bundle/{failure-HDJLR2YJ.js → failure-MYT4HPE3.js} +2 -2
- package/dist/bundle/{first-run-TXNTIUSP.js → first-run-3PF7T74J.js} +12 -11
- package/dist/bundle/first-screen-7BEROEQR.js +36 -0
- package/dist/bundle/{instructions-NZGJ4FW5.js → instructions-2VECIDXF.js} +1 -1
- package/dist/bundle/{mcp-VFIOZDVY.js → mcp-O6ACR2DX.js} +2 -2
- package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
- package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
- package/dist/bundle/meeting-combined-PPUQ3KBR.js +24 -0
- package/dist/bundle/meeting-model-ZNMYKMCD.js +26 -0
- package/dist/bundle/meeting-semantic-ETN3A4BJ.js +22 -0
- package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
- package/dist/bundle/{node-RPKPDYQS.js → node-MPEQSFI3.js} +2 -2
- package/dist/bundle/{node-sqlite-KH2UUYVO.js → node-sqlite-WA32MYSJ.js} +7 -7
- package/dist/bundle/notion.js +13 -13
- package/dist/bundle/{oauth-NKAI7TQD.js → oauth-IAFZG3IR.js} +7 -7
- package/dist/bundle/{open-WSAEAA2V.js → open-M3JQUC5G.js} +5 -5
- package/dist/bundle/{openai-JPVDGHG5.js → openai-HXUEHUSD.js} +30 -28
- package/dist/bundle/{process-5ZFVKOQX.js → process-F6TKXWWA.js} +1 -1
- package/dist/bundle/{program-M3D56D6T.js → program-Y7JAB6TG.js} +5289 -924
- package/dist/bundle/{prompt-FROYQ5LV.js → prompt-IMUQLZD2.js} +5 -5
- package/dist/bundle/{recognize-NYCHQMCX.js → recognize-2MZAYHAA.js} +4 -4
- package/dist/bundle/{remote-4OERF3Z4.js → remote-OV4LB6VR.js} +10 -10
- package/dist/bundle/{rerank-TEGXFUWY.js → rerank-ZIULUS34.js} +7 -7
- package/dist/bundle/{schemas-MZNNOEYN.js → schemas-DIVZS6TU.js} +1 -1
- package/dist/bundle/{serve-HLYYBAXY.js → serve-YU7QBP6L.js} +9 -9
- package/dist/bundle/server-FKQET4ZO.js +71 -0
- package/dist/bundle/{server-D5OYNEUW.js → server-LGMNONSB.js} +47 -38
- package/dist/bundle/services-5WY4DCPJ.js +581 -0
- package/dist/bundle/{sqlite-runtime-H2S5RR2F.js → sqlite-runtime-5MXZDETH.js} +6 -6
- package/dist/bundle/{state-OPOXCDZL.js → state-LWMZH2KI.js} +6 -6
- package/dist/bundle/{store-NHMXEJPD.js → store-EPZYV4VW.js} +17 -13
- package/dist/bundle/{store-Y3KRLCJ7.js → store-QE6FEIZD.js} +25 -20
- package/dist/bundle/store-maintenance-command-ZUUUFCHL.js +62 -0
- package/dist/commands/documents.d.ts +2 -1
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +2 -2
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/library.d.ts +10 -0
- package/dist/commands/library.d.ts.map +1 -0
- package/dist/commands/library.js +468 -0
- package/dist/commands/library.js.map +1 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +4 -3
- package/dist/commands/session.js.map +1 -1
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +12 -3
- package/dist/context.js.map +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -0
- package/dist/identity.js.map +1 -1
- package/dist/knowledge.d.ts +27 -0
- package/dist/knowledge.d.ts.map +1 -0
- package/dist/knowledge.js +87 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/library.d.ts +44 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +149 -0
- package/dist/library.js.map +1 -0
- package/dist/notion/client.d.ts +4 -1
- package/dist/notion/client.d.ts.map +1 -1
- package/dist/notion/client.js +5 -2
- package/dist/notion/client.js.map +1 -1
- package/dist/notion/errors.d.ts.map +1 -1
- package/dist/notion/errors.js +26 -1
- package/dist/notion/errors.js.map +1 -1
- package/dist/notion/reads.d.ts +4 -0
- package/dist/notion/reads.d.ts.map +1 -1
- package/dist/program.js +2 -2
- package/dist/program.js.map +1 -1
- package/dist/sync/cursor.d.ts +81 -0
- package/dist/sync/cursor.d.ts.map +1 -1
- package/dist/sync/cursor.js +63 -2
- package/dist/sync/cursor.js.map +1 -1
- package/dist/sync/files.d.ts +77 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +12 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/markdown.d.ts +4 -1
- package/dist/sync/markdown.d.ts.map +1 -1
- package/dist/sync/markdown.js +8 -6
- package/dist/sync/markdown.js.map +1 -1
- package/dist/sync/source.d.ts +6 -59
- package/dist/sync/source.d.ts.map +1 -1
- package/dist/sync/source.js +616 -255
- package/dist/sync/source.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/notion-cli/SKILL.md +12 -1
- package/dist/bundle/command-contract-6G5DC2FN.js +0 -35
- package/dist/bundle/decode-7XOFRAAT.js +0 -163
- package/dist/bundle/first-screen-JZPJND7J.js +0 -33
- package/dist/bundle/server-LWZGVMNW.js +0 -62
- package/dist/bundle/store-maintenance-command-D4W7WSLQ.js +0 -53
- package/dist/commands/comments.d.ts +0 -3
- package/dist/commands/comments.d.ts.map +0 -1
- package/dist/commands/comments.js +0 -114
- package/dist/commands/comments.js.map +0 -1
- package/dist/sample/comments.d.ts +0 -61
- package/dist/sample/comments.d.ts.map +0 -1
- package/dist/sample/comments.js +0 -39
- package/dist/sample/comments.js.map +0 -1
- package/dist/sample/records.d.ts +0 -16
- package/dist/sample/records.d.ts.map +0 -1
- package/dist/sample/records.js +0 -22
- package/dist/sample/records.js.map +0 -1
- package/dist/sample/transport.d.ts +0 -42
- package/dist/sample/transport.d.ts.map +0 -1
- package/dist/sample/transport.js +0 -153
- package/dist/sample/transport.js.map +0 -1
- /package/dist/bundle/{chunk-ZI3YTXSF.js → chunk-VKE77B3F.js} +0 -0
|
@@ -2,31 +2,31 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
updateCommand
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WCSOH4JS.js";
|
|
6
6
|
import {
|
|
7
7
|
QUESTIONS,
|
|
8
8
|
readSetupAnswers,
|
|
9
9
|
unanswered,
|
|
10
10
|
writeSetupAnswers
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SWAOWNKW.js";
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_STEMMERS,
|
|
14
14
|
LANGUAGES
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YNTLT3Z3.js";
|
|
16
16
|
import {
|
|
17
17
|
sharedConfigPath
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-B7ON6KPT.js";
|
|
19
19
|
import {
|
|
20
20
|
installerOf
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ZZ32DXTH.js";
|
|
22
22
|
import {
|
|
23
23
|
storePath
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WF4D56CA.js";
|
|
25
25
|
import {
|
|
26
26
|
__name
|
|
27
27
|
} from "./chunk-ZVVMGPBJ.js";
|
|
28
28
|
|
|
29
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/cli/first-run.js
|
|
30
30
|
import { spawnSync } from "node:child_process";
|
|
31
31
|
import { accessSync, constants, realpathSync } from "node:fs";
|
|
32
32
|
import { delimiter, join } from "node:path";
|
|
@@ -84,7 +84,7 @@ var suggested = /* @__PURE__ */ __name((env, contentLanguages) => {
|
|
|
84
84
|
return (own.length ? own : LANGUAGES.filter(({ code }) => code === "en" || code === system)).map(({ name }) => name);
|
|
85
85
|
}, "suggested");
|
|
86
86
|
var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLanguages }) => {
|
|
87
|
-
const { openStore } = await import("./store-
|
|
87
|
+
const { openStore } = await import("./store-EPZYV4VW.js");
|
|
88
88
|
const store = await openStore({ env });
|
|
89
89
|
let rebuild = false;
|
|
90
90
|
try {
|
|
@@ -113,8 +113,8 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
|
|
|
113
113
|
if (!rebuild)
|
|
114
114
|
return;
|
|
115
115
|
const [{ openCache }, { buildStems }] = await Promise.all([
|
|
116
|
-
import("./open-
|
|
117
|
-
import("./store-maintenance-command-
|
|
116
|
+
import("./open-M3JQUC5G.js"),
|
|
117
|
+
import("./store-maintenance-command-ZUUUFCHL.js")
|
|
118
118
|
]);
|
|
119
119
|
const database = await openCache(storePath(env));
|
|
120
120
|
try {
|
|
@@ -126,7 +126,7 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
|
|
|
126
126
|
var askTools = /* @__PURE__ */ __name(async (run) => {
|
|
127
127
|
const { command, env, io } = run;
|
|
128
128
|
const installed = run.installed ?? ((name) => onPath(name, env));
|
|
129
|
-
const { WIRECAT_TOOLS } = await import("./first-screen-
|
|
129
|
+
const { WIRECAT_TOOLS } = await import("./first-screen-7BEROEQR.js");
|
|
130
130
|
const others = WIRECAT_TOOLS.filter((tool) => tool.command !== command);
|
|
131
131
|
const missing = others.filter((tool) => !installed(tool.command));
|
|
132
132
|
io.say("Other WireCat tools \u2014 they share this store, so one search finds everything:");
|
|
@@ -199,7 +199,7 @@ var setupAtStart = /* @__PURE__ */ __name(async (start) => {
|
|
|
199
199
|
contentLanguages: start.contentLanguages,
|
|
200
200
|
all: start.path[0] === "setup",
|
|
201
201
|
io: {
|
|
202
|
-
ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-
|
|
202
|
+
ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-IMUQLZD2.js")).readSecret(prompt, { input, echo: true }), "ask"),
|
|
203
203
|
say: /* @__PURE__ */ __name((text) => process.stderr.write(`${text}
|
|
204
204
|
`), "say")
|
|
205
205
|
}
|
|
@@ -2,24 +2,24 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
storePath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WF4D56CA.js";
|
|
6
6
|
import {
|
|
7
7
|
resolvePaths,
|
|
8
8
|
writeSecurely
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3AL7QUS3.js";
|
|
10
10
|
import {
|
|
11
11
|
CliError,
|
|
12
12
|
singleLine
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5RDNBG7D.js";
|
|
14
14
|
import {
|
|
15
15
|
__name
|
|
16
16
|
} from "./chunk-ZVVMGPBJ.js";
|
|
17
17
|
|
|
18
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/store/shared-config.js
|
|
19
19
|
import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
20
20
|
import { dirname, join, resolve } from "node:path";
|
|
21
21
|
|
|
22
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/domain/config-repair.js
|
|
23
23
|
var REPAIR_WORDS = {
|
|
24
24
|
byte_order_mark: "an invisible byte-order mark at the start",
|
|
25
25
|
comment: "a comment, which JSON does not allow",
|
|
@@ -303,7 +303,7 @@ var explainBrokenJson = /* @__PURE__ */ __name((text, result) => {
|
|
|
303
303
|
return `line ${line}, column ${column}: ${why}${around(line)}; likely fix: ${fix ?? "correct that part by hand"}`;
|
|
304
304
|
}, "explainBrokenJson");
|
|
305
305
|
|
|
306
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
306
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/domain/task-categories.js
|
|
307
307
|
var DEFAULT_TASK_CATEGORIES = [
|
|
308
308
|
{
|
|
309
309
|
name: "taxes",
|
|
@@ -1058,7 +1058,7 @@ var storedTaskCategories = /* @__PURE__ */ __name((json) => {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
}, "storedTaskCategories");
|
|
1060
1060
|
|
|
1061
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1061
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/store/shared-config.js
|
|
1062
1062
|
var SECTION = "task_categories";
|
|
1063
1063
|
var sharedConfigPath = /* @__PURE__ */ __name((store, env = process.env) => {
|
|
1064
1064
|
const paths = resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env });
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
readLock,
|
|
6
6
|
releaseLock,
|
|
7
7
|
takeLock
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2F4QQ7WB.js";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
|
|
14
14
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
15
15
|
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
|
|
17
17
|
import { randomBytes } from "node:crypto";
|
|
18
18
|
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
19
19
|
import { dirname } from "node:path";
|
|
@@ -86,7 +86,7 @@ var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
|
|
|
86
86
|
};
|
|
87
87
|
}, "activityRecorder");
|
|
88
88
|
|
|
89
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
89
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
|
|
90
90
|
var ACCESS_SECONDS = 60 * 60;
|
|
91
91
|
var REFRESH_SECONDS = 30 * 24 * 60 * 60;
|
|
92
92
|
var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
|
|
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
wirecatDirectory
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WF4D56CA.js";
|
|
6
6
|
import {
|
|
7
7
|
CliError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5RDNBG7D.js";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/speech/models.js
|
|
14
14
|
var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/csukuangfj/${repository}/resolve/${commit}/${name}`, "huggingFace");
|
|
15
15
|
var gigaam = huggingFace("sherpa-onnx-nemo-transducer-punct-giga-am-v3-russian-2025-12-16", "a6039be7cee829a9044a69ac0ebaf1c191217c97");
|
|
16
16
|
var gigaamCtc = huggingFace("sherpa-onnx-nemo-ctc-punct-giga-am-v3-russian-2025-12-16", "4fb5407ff028a69fec516cdf4c10fac9ddea7c16");
|
|
@@ -137,7 +137,7 @@ var speechModel = /* @__PURE__ */ __name((id) => {
|
|
|
137
137
|
return model;
|
|
138
138
|
}, "speechModel");
|
|
139
139
|
|
|
140
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
140
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/speech/install.js
|
|
141
141
|
import { createHash, randomUUID } from "node:crypto";
|
|
142
142
|
import { createReadStream, createWriteStream, mkdirSync, statSync } from "node:fs";
|
|
143
143
|
import { rename, rm } from "node:fs/promises";
|
|
@@ -2,14 +2,52 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
CliError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5RDNBG7D.js";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-ZVVMGPBJ.js";
|
|
9
9
|
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/atomic-write.js
|
|
11
|
+
import { randomUUID } from "node:crypto";
|
|
11
12
|
import { constants } from "node:fs";
|
|
12
|
-
import {
|
|
13
|
+
import { link, open, realpath, rename, unlink } from "node:fs/promises";
|
|
14
|
+
import { basename, dirname, join } from "node:path";
|
|
15
|
+
var openFolder = /* @__PURE__ */ __name((folder) => process.platform === "win32" ? Promise.resolve(void 0) : open(folder, constants.O_RDONLY | (constants.O_DIRECTORY ?? 0) | (constants.O_NOFOLLOW ?? 0)), "openFolder");
|
|
16
|
+
var writeFileAtomic = /* @__PURE__ */ __name(async (path, content, { mode = 384, overwrite = true, signal, beforePublish } = {}) => {
|
|
17
|
+
signal?.throwIfAborted();
|
|
18
|
+
const folder = await realpath(dirname(path));
|
|
19
|
+
const target = join(folder, basename(path));
|
|
20
|
+
const directory = await openFolder(folder);
|
|
21
|
+
try {
|
|
22
|
+
const temporary = join(folder, `.${basename(path)}.${randomUUID()}.tmp`);
|
|
23
|
+
let handle = await open(temporary, "wx", mode);
|
|
24
|
+
let published = false;
|
|
25
|
+
try {
|
|
26
|
+
await handle.writeFile(content);
|
|
27
|
+
await handle.sync();
|
|
28
|
+
await handle.close();
|
|
29
|
+
handle = void 0;
|
|
30
|
+
signal?.throwIfAborted();
|
|
31
|
+
await beforePublish?.();
|
|
32
|
+
if (overwrite)
|
|
33
|
+
await rename(temporary, target);
|
|
34
|
+
else
|
|
35
|
+
await link(temporary, target);
|
|
36
|
+
published = overwrite;
|
|
37
|
+
await directory?.sync();
|
|
38
|
+
} finally {
|
|
39
|
+
await handle?.close().catch(() => void 0);
|
|
40
|
+
if (!published)
|
|
41
|
+
await unlink(temporary).catch(() => void 0);
|
|
42
|
+
}
|
|
43
|
+
} finally {
|
|
44
|
+
await directory?.close().catch(() => void 0);
|
|
45
|
+
}
|
|
46
|
+
}, "writeFileAtomic");
|
|
47
|
+
|
|
48
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/ordinary-file.js
|
|
49
|
+
import { constants as constants2 } from "node:fs";
|
|
50
|
+
import { lstat, open as open2 } from "node:fs/promises";
|
|
13
51
|
var deviceOf = /* @__PURE__ */ __name((dev) => process.platform === "win32" ? BigInt.asUintN(32, dev) : dev, "deviceOf");
|
|
14
52
|
var sameIdentity = /* @__PURE__ */ __name((left, right) => left.ino === right.ino && deviceOf(left.dev) === deviceOf(right.dev), "sameIdentity");
|
|
15
53
|
var openOrdinaryFile = /* @__PURE__ */ __name(async (path, options = {}) => {
|
|
@@ -18,16 +56,16 @@ var openOrdinaryFile = /* @__PURE__ */ __name(async (path, options = {}) => {
|
|
|
18
56
|
throw new CliError("validation_error", "archive path must be an ordinary file without a symlink");
|
|
19
57
|
if (!before.isFile())
|
|
20
58
|
throw new CliError("validation_error", "archive path must be an ordinary file");
|
|
21
|
-
const access = options.writable ?
|
|
22
|
-
const flags = process.platform === "win32" ? access : access | (
|
|
23
|
-
const file = await
|
|
59
|
+
const access = options.writable ? constants2.O_RDWR : constants2.O_RDONLY;
|
|
60
|
+
const flags = process.platform === "win32" ? access : access | (constants2.O_NOFOLLOW ?? 0) | (constants2.O_NONBLOCK ?? 0);
|
|
61
|
+
const file = await open2(path, flags);
|
|
24
62
|
try {
|
|
25
63
|
const opened = await file.stat({ bigint: true });
|
|
26
64
|
const after = await lstat(path, { bigint: true });
|
|
27
65
|
if (!opened.isFile() || !after.isFile() || before.ino !== opened.ino || before.ino !== after.ino)
|
|
28
66
|
throw new CliError("validation_error", "archive file changed while opening");
|
|
29
67
|
if (process.platform === "win32" && before.dev === 0n && after.dev === 0n) {
|
|
30
|
-
const witness = await
|
|
68
|
+
const witness = await open2(path, flags);
|
|
31
69
|
try {
|
|
32
70
|
const identified = await witness.stat({ bigint: true });
|
|
33
71
|
const final = await lstat(path, { bigint: true });
|
|
@@ -63,7 +101,7 @@ var sameOrdinaryFile = /* @__PURE__ */ __name(async (path, created) => {
|
|
|
63
101
|
var syncDirectory = /* @__PURE__ */ __name(async (path) => {
|
|
64
102
|
if (process.platform === "win32")
|
|
65
103
|
return;
|
|
66
|
-
const directory = await
|
|
104
|
+
const directory = await open2(path, constants2.O_RDONLY | (constants2.O_DIRECTORY ?? 0) | (constants2.O_NOFOLLOW ?? 0));
|
|
67
105
|
try {
|
|
68
106
|
if (!(await directory.stat()).isDirectory())
|
|
69
107
|
throw new CliError("validation_error", "archive publication directory must be ordinary");
|
|
@@ -73,45 +111,7 @@ var syncDirectory = /* @__PURE__ */ __name(async (path) => {
|
|
|
73
111
|
}
|
|
74
112
|
}, "syncDirectory");
|
|
75
113
|
|
|
76
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
77
|
-
import { randomUUID } from "node:crypto";
|
|
78
|
-
import { constants as constants2 } from "node:fs";
|
|
79
|
-
import { link, open as open2, realpath, rename, unlink } from "node:fs/promises";
|
|
80
|
-
import { basename, dirname, join } from "node:path";
|
|
81
|
-
var openFolder = /* @__PURE__ */ __name((folder) => process.platform === "win32" ? Promise.resolve(void 0) : open2(folder, constants2.O_RDONLY | (constants2.O_DIRECTORY ?? 0) | (constants2.O_NOFOLLOW ?? 0)), "openFolder");
|
|
82
|
-
var writeFileAtomic = /* @__PURE__ */ __name(async (path, content, { mode = 384, overwrite = true, signal, beforePublish } = {}) => {
|
|
83
|
-
signal?.throwIfAborted();
|
|
84
|
-
const folder = await realpath(dirname(path));
|
|
85
|
-
const target = join(folder, basename(path));
|
|
86
|
-
const directory = await openFolder(folder);
|
|
87
|
-
try {
|
|
88
|
-
const temporary = join(folder, `.${basename(path)}.${randomUUID()}.tmp`);
|
|
89
|
-
let handle = await open2(temporary, "wx", mode);
|
|
90
|
-
let published = false;
|
|
91
|
-
try {
|
|
92
|
-
await handle.writeFile(content);
|
|
93
|
-
await handle.sync();
|
|
94
|
-
await handle.close();
|
|
95
|
-
handle = void 0;
|
|
96
|
-
signal?.throwIfAborted();
|
|
97
|
-
await beforePublish?.();
|
|
98
|
-
if (overwrite)
|
|
99
|
-
await rename(temporary, target);
|
|
100
|
-
else
|
|
101
|
-
await link(temporary, target);
|
|
102
|
-
published = overwrite;
|
|
103
|
-
await directory?.sync();
|
|
104
|
-
} finally {
|
|
105
|
-
await handle?.close().catch(() => void 0);
|
|
106
|
-
if (!published)
|
|
107
|
-
await unlink(temporary).catch(() => void 0);
|
|
108
|
-
}
|
|
109
|
-
} finally {
|
|
110
|
-
await directory?.close().catch(() => void 0);
|
|
111
|
-
}
|
|
112
|
-
}, "writeFileAtomic");
|
|
113
|
-
|
|
114
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.663.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_8be6aa3a41727a76ce87cf0d5a7bd659/node_modules/@wirecat/cli-core/dist/files/bounded-utf8.js
|
|
114
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/bounded-utf8.js
|
|
115
115
|
var readBoundedUtf8File = /* @__PURE__ */ __name(async (path, { maxBytes }) => {
|
|
116
116
|
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 16 * 1024 * 1024)
|
|
117
117
|
throw new CliError("validation_error", "file maxBytes takes 1\u201316777216 bytes");
|
|
@@ -140,21 +140,21 @@ var readBoundedUtf8File = /* @__PURE__ */ __name(async (path, { maxBytes }) => {
|
|
|
140
140
|
}
|
|
141
141
|
}, "readBoundedUtf8File");
|
|
142
142
|
|
|
143
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
143
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/lock.js
|
|
144
144
|
import { mkdir as mkdir2 } from "node:fs/promises";
|
|
145
145
|
import { basename as basename2, dirname as dirname2 } from "node:path";
|
|
146
146
|
|
|
147
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
147
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
|
|
148
148
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
149
149
|
import { lstat as lstat3, mkdir, open as open3, realpath as realpath3, rmdir as rmdir2, unlink as unlink4 } from "node:fs/promises";
|
|
150
150
|
import { hostname as hostname2 } from "node:os";
|
|
151
151
|
import { join as join3 } from "node:path";
|
|
152
152
|
|
|
153
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
|
|
154
154
|
import { lstat as lstat2, readdir, realpath as realpath2, unlink as unlink2 } from "node:fs/promises";
|
|
155
155
|
import { join as join2 } from "node:path";
|
|
156
156
|
|
|
157
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
157
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/native-lease-owner.js
|
|
158
158
|
import { hostname } from "node:os";
|
|
159
159
|
var missingLeaseFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingLeaseFile");
|
|
160
160
|
var readLeaseOwner = /* @__PURE__ */ __name(async (path, name, signal) => {
|
|
@@ -199,7 +199,7 @@ var leaseOwnerStatus = /* @__PURE__ */ __name((owner) => {
|
|
|
199
199
|
}
|
|
200
200
|
}, "leaseOwnerStatus");
|
|
201
201
|
|
|
202
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
202
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
|
|
203
203
|
var leaseInspection = /* @__PURE__ */ __name((markerDirectory) => {
|
|
204
204
|
const inspect = /* @__PURE__ */ __name(async (destination, options = {}) => {
|
|
205
205
|
options.signal?.throwIfAborted();
|
|
@@ -258,7 +258,7 @@ var leaseInspection = /* @__PURE__ */ __name((markerDirectory) => {
|
|
|
258
258
|
return { inspect, recover };
|
|
259
259
|
}, "leaseInspection");
|
|
260
260
|
|
|
261
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
261
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/native-lease-release.js
|
|
262
262
|
import { rmdir, unlink as unlink3 } from "node:fs/promises";
|
|
263
263
|
var ownedNativeLease = /* @__PURE__ */ __name((path, name, owner, folder, identity) => {
|
|
264
264
|
let releasing;
|
|
@@ -283,7 +283,7 @@ var ownedNativeLease = /* @__PURE__ */ __name((path, name, owner, folder, identi
|
|
|
283
283
|
};
|
|
284
284
|
}, "ownedNativeLease");
|
|
285
285
|
|
|
286
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
286
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
|
|
287
287
|
var validName = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !/[\\/\0:]/.test(value), "validName");
|
|
288
288
|
var nativeWriterLeaseStore = /* @__PURE__ */ __name((layout) => {
|
|
289
289
|
const { markerDirectory, legacyMarker } = layout;
|
|
@@ -354,7 +354,7 @@ var nativeWriterLeaseStore = /* @__PURE__ */ __name((layout) => {
|
|
|
354
354
|
};
|
|
355
355
|
}, "nativeWriterLeaseStore");
|
|
356
356
|
|
|
357
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
357
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/lock.js
|
|
358
358
|
var acquireLock = /* @__PURE__ */ __name(async (path, { signal } = {}) => {
|
|
359
359
|
const folder = dirname2(path);
|
|
360
360
|
await mkdir2(folder, { recursive: true, mode: 448 });
|
|
@@ -369,7 +369,7 @@ var acquireLock = /* @__PURE__ */ __name(async (path, { signal } = {}) => {
|
|
|
369
369
|
});
|
|
370
370
|
}, "acquireLock");
|
|
371
371
|
|
|
372
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
372
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/files/safe-name.js
|
|
373
373
|
import { basename as basename3 } from "node:path";
|
|
374
374
|
var safeName = /* @__PURE__ */ __name((name, platform = process.platform) => {
|
|
375
375
|
let plain = name === void 0 ? "" : basename3(name.replaceAll("\\", "/")).replace(/[\p{Cc}---]/gu, "").replace(/^\.+/, "");
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
textModel,
|
|
5
|
+
vectorModelKey
|
|
6
|
+
} from "./chunk-WJHZMR2W.js";
|
|
7
|
+
import {
|
|
8
|
+
OPENAI_URL,
|
|
9
|
+
openRemote,
|
|
10
|
+
remoteKey,
|
|
11
|
+
remoteModel
|
|
12
|
+
} from "./chunk-RV64YUQX.js";
|
|
13
|
+
import {
|
|
14
|
+
endpointFetch
|
|
15
|
+
} from "./chunk-2F6VO5HA.js";
|
|
16
|
+
import {
|
|
17
|
+
isTextModelInstalled,
|
|
18
|
+
openEmbedder,
|
|
19
|
+
textModelsDirectory
|
|
20
|
+
} from "./chunk-ODBZNSZ6.js";
|
|
21
|
+
import {
|
|
22
|
+
CliError
|
|
23
|
+
} from "./chunk-5RDNBG7D.js";
|
|
24
|
+
import {
|
|
25
|
+
__name
|
|
26
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
27
|
+
|
|
28
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.673.0_@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typ_d24fa0f4f3b37e009a0e8224eb6a2687/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
|
|
29
|
+
var integer = /* @__PURE__ */ __name((value, name, max) => {
|
|
30
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
31
|
+
throw new CliError("validation_error", `Invalid ${name}`);
|
|
32
|
+
return value;
|
|
33
|
+
}, "integer");
|
|
34
|
+
var cancelled = /* @__PURE__ */ __name((signal) => {
|
|
35
|
+
if (signal?.aborted)
|
|
36
|
+
throw new CliError("cancelled", "Meeting embedding was cancelled");
|
|
37
|
+
}, "cancelled");
|
|
38
|
+
var validatedRemote = /* @__PURE__ */ __name((remote) => {
|
|
39
|
+
let url;
|
|
40
|
+
try {
|
|
41
|
+
url = new URL(remote.baseUrl);
|
|
42
|
+
} catch {
|
|
43
|
+
throw new CliError("validation_error", "Invalid embedding endpoint");
|
|
44
|
+
}
|
|
45
|
+
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash)
|
|
46
|
+
throw new CliError("validation_error", "Embedding endpoint requires HTTP/S without credentials, query or fragment");
|
|
47
|
+
if (typeof remote.model !== "string" || !/^[\w./:-]{1,200}$/.test(remote.model))
|
|
48
|
+
throw new CliError("validation_error", "Invalid embedding model name");
|
|
49
|
+
const dims = integer(remote.dims, "embedding dimensions", 8192);
|
|
50
|
+
const baseUrl = remote.baseUrl.replace(/\/+$/, "");
|
|
51
|
+
const result = remoteModel({ model: remote.model, dims, ...baseUrl === OPENAI_URL ? {} : { baseUrl } });
|
|
52
|
+
return result;
|
|
53
|
+
}, "validatedRemote");
|
|
54
|
+
var meetingEmbeddingModel = /* @__PURE__ */ __name((choice, env) => {
|
|
55
|
+
if (typeof choice === "string") {
|
|
56
|
+
const model = textModel(choice, env);
|
|
57
|
+
return { key: vectorModelKey(model), dims: model.dims, kind: "local", model: model.id };
|
|
58
|
+
}
|
|
59
|
+
if (!choice || typeof choice !== "object" || !choice.remote)
|
|
60
|
+
throw new CliError("validation_error", "An explicit embedding model is required");
|
|
61
|
+
const remote = validatedRemote(choice.remote);
|
|
62
|
+
if (choice.concurrency !== void 0 && choice.concurrency !== 1)
|
|
63
|
+
throw new CliError("validation_error", "Meeting embedding supports one remote request worker");
|
|
64
|
+
return { key: remoteKey(remote), dims: remote.dims, kind: "remote", model: remote.model };
|
|
65
|
+
}, "meetingEmbeddingModel");
|
|
66
|
+
var createMeetingRemoteModel = /* @__PURE__ */ __name((input) => {
|
|
67
|
+
try {
|
|
68
|
+
return validatedRemote(remoteModel(input));
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (error instanceof CliError)
|
|
71
|
+
throw error;
|
|
72
|
+
throw new CliError("validation_error", "Invalid embedding endpoint");
|
|
73
|
+
}
|
|
74
|
+
}, "createMeetingRemoteModel");
|
|
75
|
+
var withAbort = /* @__PURE__ */ __name(async (pending, signal) => {
|
|
76
|
+
cancelled(signal);
|
|
77
|
+
if (!signal)
|
|
78
|
+
return pending;
|
|
79
|
+
let onAbort = /* @__PURE__ */ __name(() => {
|
|
80
|
+
}, "onAbort");
|
|
81
|
+
const interrupted = new Promise((_, reject) => {
|
|
82
|
+
onAbort = /* @__PURE__ */ __name(() => reject(new CliError("cancelled", "Meeting embedding was cancelled")), "onAbort");
|
|
83
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
84
|
+
});
|
|
85
|
+
try {
|
|
86
|
+
return await Promise.race([pending, interrupted]);
|
|
87
|
+
} finally {
|
|
88
|
+
signal.removeEventListener("abort", onAbort);
|
|
89
|
+
}
|
|
90
|
+
}, "withAbort");
|
|
91
|
+
var boundedResponse = /* @__PURE__ */ __name(async (response, maxBytes, signal) => {
|
|
92
|
+
const length = response.headers.get("content-length");
|
|
93
|
+
if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
|
|
94
|
+
void response.body?.cancel().catch(() => {
|
|
95
|
+
});
|
|
96
|
+
throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
|
|
97
|
+
}
|
|
98
|
+
if (!response.body)
|
|
99
|
+
throw new CliError("invalid_response", "Embedding response has no body");
|
|
100
|
+
const reader = response.body.getReader();
|
|
101
|
+
const chunks = [];
|
|
102
|
+
let bytes = 0;
|
|
103
|
+
try {
|
|
104
|
+
for (; ; ) {
|
|
105
|
+
cancelled(signal);
|
|
106
|
+
const part = await withAbort(reader.read(), signal);
|
|
107
|
+
cancelled(signal);
|
|
108
|
+
if (part.done)
|
|
109
|
+
break;
|
|
110
|
+
bytes += part.value.byteLength;
|
|
111
|
+
if (bytes > maxBytes)
|
|
112
|
+
throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
|
|
113
|
+
chunks.push(part.value);
|
|
114
|
+
}
|
|
115
|
+
const body = Buffer.concat(chunks, bytes).toString("utf8");
|
|
116
|
+
try {
|
|
117
|
+
return JSON.parse(body);
|
|
118
|
+
} catch {
|
|
119
|
+
throw new CliError("invalid_response", "Embedding response is not JSON");
|
|
120
|
+
}
|
|
121
|
+
} finally {
|
|
122
|
+
void reader.cancel().catch(() => {
|
|
123
|
+
});
|
|
124
|
+
reader.releaseLock();
|
|
125
|
+
}
|
|
126
|
+
}, "boundedResponse");
|
|
127
|
+
var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) => {
|
|
128
|
+
const descriptor = meetingEmbeddingModel(choice, options.env);
|
|
129
|
+
const { signal } = options;
|
|
130
|
+
cancelled(signal);
|
|
131
|
+
const maxInputBytes = integer(options.maxInputBytes ?? 1024 * 1024, "input byte budget", 16 * 1024 * 1024);
|
|
132
|
+
const maxResponseBytes = integer(options.maxResponseBytes ?? 8 * 1024 * 1024, "response byte budget", 64 * 1024 * 1024);
|
|
133
|
+
if (options.threads !== void 0)
|
|
134
|
+
integer(options.threads, "embedding threads", 128);
|
|
135
|
+
let engine;
|
|
136
|
+
let remoteFailure;
|
|
137
|
+
if (typeof choice === "string") {
|
|
138
|
+
const model = textModel(choice, options.env);
|
|
139
|
+
const directory = options.directory ?? textModelsDirectory(options.env);
|
|
140
|
+
if (!isTextModelInstalled(model, directory))
|
|
141
|
+
throw new CliError("configuration_error", "The explicit local embedding model is not installed");
|
|
142
|
+
engine = await openEmbedder(model, directory, {
|
|
143
|
+
...options.threads === void 0 ? {} : { threads: options.threads }
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
const remote = validatedRemote(choice.remote);
|
|
147
|
+
const key = choice.apiKey ?? (remote.provider === "openai" ? (options.env ?? process.env).OPENAI_API_KEY : void 0);
|
|
148
|
+
if (remote.provider === "openai" && !key)
|
|
149
|
+
throw new CliError("authentication_error", "The explicit remote embedding model requires an API key");
|
|
150
|
+
const post = options.fetch ?? endpointFetch(remote.baseUrl, 12e4);
|
|
151
|
+
const guarded = /* @__PURE__ */ __name(async (url, init) => {
|
|
152
|
+
try {
|
|
153
|
+
cancelled(signal);
|
|
154
|
+
const responseTask = post(url, { ...init, redirect: "manual", ...signal ? { signal } : {} }).then((response2) => {
|
|
155
|
+
if (signal?.aborted) {
|
|
156
|
+
void response2.body?.cancel().catch(() => {
|
|
157
|
+
});
|
|
158
|
+
cancelled(signal);
|
|
159
|
+
}
|
|
160
|
+
return response2;
|
|
161
|
+
});
|
|
162
|
+
const response = await withAbort(responseTask, signal);
|
|
163
|
+
if (signal?.aborted) {
|
|
164
|
+
void response.body?.cancel().catch(() => {
|
|
165
|
+
});
|
|
166
|
+
cancelled(signal);
|
|
167
|
+
}
|
|
168
|
+
if (response.status >= 300 && response.status < 400) {
|
|
169
|
+
void response.body?.cancel().catch(() => {
|
|
170
|
+
});
|
|
171
|
+
throw new CliError("invalid_response", "Embedding redirects are refused");
|
|
172
|
+
}
|
|
173
|
+
if (!response.ok) {
|
|
174
|
+
void response.body?.cancel().catch(() => {
|
|
175
|
+
});
|
|
176
|
+
return new Response("{}", { status: response.status });
|
|
177
|
+
}
|
|
178
|
+
const body = await boundedResponse(response, maxResponseBytes, signal);
|
|
179
|
+
if (!body || typeof body !== "object" || !("data" in body) || !Array.isArray(body.data) || body.data.length > 256)
|
|
180
|
+
throw new CliError("invalid_response", "Embedding response lacks vector data");
|
|
181
|
+
for (const entry of body.data) {
|
|
182
|
+
if (!entry || typeof entry !== "object" || !Number.isSafeInteger(entry.index) || entry.index < 0 || !Array.isArray(entry.embedding) || entry.embedding.length !== remote.dims || entry.embedding.some((value) => typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(Math.fround(value))))
|
|
183
|
+
throw new CliError("invalid_response", "Embedding response contains invalid vectors");
|
|
184
|
+
}
|
|
185
|
+
const indices = body.data.map((entry) => entry.index).sort((a, b) => a - b);
|
|
186
|
+
if (indices.some((index, position) => index !== position))
|
|
187
|
+
throw new CliError("invalid_response", "Embedding response contains invalid vector indices");
|
|
188
|
+
return new Response(JSON.stringify({ data: body.data.map((entry) => ({ index: entry.index, embedding: entry.embedding })) }), { status: response.status });
|
|
189
|
+
} catch (error) {
|
|
190
|
+
remoteFailure = error;
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}, "guarded");
|
|
194
|
+
engine = openRemote(remote, key, { concurrency: 1, fetch: guarded, tries: 1, env: options.env ?? process.env });
|
|
195
|
+
}
|
|
196
|
+
if (signal?.aborted) {
|
|
197
|
+
await engine.close();
|
|
198
|
+
cancelled(signal);
|
|
199
|
+
}
|
|
200
|
+
let closed = false;
|
|
201
|
+
let running = false;
|
|
202
|
+
let active = null;
|
|
203
|
+
let closing = null;
|
|
204
|
+
return {
|
|
205
|
+
...descriptor,
|
|
206
|
+
async embed(texts, kind) {
|
|
207
|
+
cancelled(signal);
|
|
208
|
+
if (closed)
|
|
209
|
+
throw new CliError("configuration_error", "Meeting embedder is closed");
|
|
210
|
+
if (!Array.isArray(texts) || texts.length > 1e3 || texts.some((text) => typeof text !== "string") || !["query", "passage"].includes(kind))
|
|
211
|
+
throw new CliError("validation_error", "Invalid meeting embedding inputs");
|
|
212
|
+
if (Buffer.byteLength(JSON.stringify(texts), "utf8") > maxInputBytes || texts.length * descriptor.dims * 4 > maxResponseBytes)
|
|
213
|
+
throw new CliError("validation_error", "Meeting embedding input or vector payload exceeds its byte budget");
|
|
214
|
+
if (running)
|
|
215
|
+
throw new CliError("validation_error", "A meeting embedding request is already running");
|
|
216
|
+
running = true;
|
|
217
|
+
let settled = /* @__PURE__ */ __name(() => {
|
|
218
|
+
}, "settled");
|
|
219
|
+
active = new Promise((resolve) => {
|
|
220
|
+
settled = resolve;
|
|
221
|
+
});
|
|
222
|
+
remoteFailure = void 0;
|
|
223
|
+
try {
|
|
224
|
+
const vectors = await engine.embed([...texts], kind);
|
|
225
|
+
cancelled(signal);
|
|
226
|
+
if (vectors.length !== texts.length || vectors.some((vector) => vector.length !== descriptor.dims || !vector.some((value) => value !== 0) || [...vector].some((value) => !Number.isFinite(value))))
|
|
227
|
+
throw new CliError("invalid_response", "Meeting embedder returned invalid vectors");
|
|
228
|
+
return vectors;
|
|
229
|
+
} catch (error) {
|
|
230
|
+
cancelled(signal);
|
|
231
|
+
if (remoteFailure instanceof CliError)
|
|
232
|
+
throw remoteFailure;
|
|
233
|
+
if (error instanceof CliError)
|
|
234
|
+
throw error;
|
|
235
|
+
throw new CliError("provider_error", "Meeting embedding failed");
|
|
236
|
+
} finally {
|
|
237
|
+
running = false;
|
|
238
|
+
settled();
|
|
239
|
+
active = null;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
async close() {
|
|
243
|
+
if (!closing) {
|
|
244
|
+
closed = true;
|
|
245
|
+
closing = (async () => {
|
|
246
|
+
await active;
|
|
247
|
+
await engine.close();
|
|
248
|
+
})();
|
|
249
|
+
}
|
|
250
|
+
await closing;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}, "openMeetingEmbedder");
|
|
254
|
+
|
|
255
|
+
export {
|
|
256
|
+
meetingEmbeddingModel,
|
|
257
|
+
createMeetingRemoteModel,
|
|
258
|
+
openMeetingEmbedder
|
|
259
|
+
};
|