@wirecat/wordpress-cli 0.0.0-stage → 0.1.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 +27 -0
- package/LICENSE +204 -0
- package/README.md +248 -2
- package/contracts/wirecat.json +2535 -0
- package/dist/bin/wordpress.d.ts +3 -0
- package/dist/bin/wordpress.d.ts.map +1 -0
- package/dist/bin/wordpress.js +40 -0
- package/dist/bin/wordpress.js.map +1 -0
- package/dist/bundle/agent-LKBRYKNB.js +37 -0
- package/dist/bundle/all-profiles-OEV7VFQG.js +320 -0
- package/dist/bundle/anthropic-JKTZP2DW.js +91 -0
- package/dist/bundle/app-server-7LWLDDE2.js +249 -0
- package/dist/bundle/bun-2FLR4IV4.js +169 -0
- package/dist/bundle/bun-sqlite-GRSRX5P4.js +76 -0
- package/dist/bundle/chunk-2BI25SEE.js +259 -0
- package/dist/bundle/chunk-2UEGJ5AJ.js +52 -0
- package/dist/bundle/chunk-2XUV7HNE.js +58 -0
- package/dist/bundle/chunk-2Z7UOXFC.js +16 -0
- package/dist/bundle/chunk-3BM6KBWP.js +2788 -0
- package/dist/bundle/chunk-3BRAZVHR.js +1010 -0
- package/dist/bundle/chunk-3LMW7U7F.js +1233 -0
- package/dist/bundle/chunk-3LVTQFGB.js +2000 -0
- package/dist/bundle/chunk-3TKFFSFU.js +106 -0
- package/dist/bundle/chunk-3UX4VJWD.js +78 -0
- package/dist/bundle/chunk-4HEXAGKT.js +334 -0
- package/dist/bundle/chunk-4HP6KGBI.js +32 -0
- package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
- package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
- package/dist/bundle/chunk-5XPHFV7H.js +2333 -0
- package/dist/bundle/chunk-5Z3P543G.js +80 -0
- package/dist/bundle/chunk-6UYDKCV6.js +794 -0
- package/dist/bundle/chunk-7GNB4LBX.js +50 -0
- package/dist/bundle/chunk-7HJFBOAT.js +161 -0
- package/dist/bundle/chunk-7JVKQ6NM.js +206 -0
- package/dist/bundle/chunk-7QH5BZUG.js +142 -0
- package/dist/bundle/chunk-A474OVIW.js +1392 -0
- package/dist/bundle/chunk-AENEMQL3.js +1068 -0
- package/dist/bundle/chunk-AL7I4DT4.js +65718 -0
- package/dist/bundle/chunk-ARGRGTPX.js +108 -0
- package/dist/bundle/chunk-AV2ZJ4WX.js +7 -0
- package/dist/bundle/chunk-BAXNAOOL.js +76 -0
- package/dist/bundle/chunk-BH63B66W.js +407 -0
- package/dist/bundle/chunk-CCOSG3F2.js +24616 -0
- package/dist/bundle/chunk-CFQQTDSA.js +46 -0
- package/dist/bundle/chunk-CGCUOT67.js +388 -0
- package/dist/bundle/chunk-CHPWBQUK.js +39 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DQSOYH6N.js +20 -0
- package/dist/bundle/chunk-ECYOTDJM.js +14 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-EHW45LLT.js +100 -0
- package/dist/bundle/chunk-F3AV5ZSL.js +338 -0
- package/dist/bundle/chunk-F4BX7TH2.js +15 -0
- package/dist/bundle/chunk-F5ZAN7OC.js +6848 -0
- package/dist/bundle/chunk-FMMYBVCH.js +38 -0
- package/dist/bundle/chunk-FNB4SWTY.js +66 -0
- package/dist/bundle/chunk-FQROWBKV.js +12660 -0
- package/dist/bundle/chunk-FV2HJOSC.js +771 -0
- package/dist/bundle/chunk-GCAJW4SR.js +53 -0
- package/dist/bundle/chunk-GPRJXJC7.js +102 -0
- package/dist/bundle/chunk-HCOZUOSN.js +54 -0
- package/dist/bundle/chunk-HM6AMYHR.js +72 -0
- package/dist/bundle/chunk-HVXOA4FO.js +23 -0
- package/dist/bundle/chunk-HWQ7572G.js +95 -0
- package/dist/bundle/chunk-IJVTN5L3.js +82 -0
- package/dist/bundle/chunk-IZDDBOHU.js +3610 -0
- package/dist/bundle/chunk-JAE5B4G7.js +388 -0
- package/dist/bundle/chunk-K2Y5K37O.js +218 -0
- package/dist/bundle/chunk-KCH224US.js +9581 -0
- package/dist/bundle/chunk-KZJQPJK5.js +230 -0
- package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
- package/dist/bundle/chunk-LECMHK2F.js +18 -0
- package/dist/bundle/chunk-LWEMZJLG.js +1332 -0
- package/dist/bundle/chunk-LWTETL2O.js +185 -0
- package/dist/bundle/chunk-MEYYH47C.js +25 -0
- package/dist/bundle/chunk-MJ6LTG4L.js +170 -0
- package/dist/bundle/chunk-NMQRSEZM.js +37 -0
- package/dist/bundle/chunk-ODVGFCBE.js +557 -0
- package/dist/bundle/chunk-OEQNP56V.js +633 -0
- package/dist/bundle/chunk-OV6WQY3L.js +39 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PPNTY7LD.js +733 -0
- package/dist/bundle/chunk-PRZYRA66.js +358 -0
- package/dist/bundle/chunk-PV5UYGRJ.js +41594 -0
- package/dist/bundle/chunk-QYTOLPNI.js +52 -0
- package/dist/bundle/chunk-R7Y3XU66.js +362 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-SD5CXGIG.js +188 -0
- package/dist/bundle/chunk-SXY5G62I.js +288 -0
- package/dist/bundle/chunk-T37TAXVL.js +29 -0
- package/dist/bundle/chunk-T5SOY3AE.js +1197 -0
- package/dist/bundle/chunk-TJ7OORSO.js +1876 -0
- package/dist/bundle/chunk-TRYYWV7J.js +291 -0
- package/dist/bundle/chunk-U6VLNYCO.js +73 -0
- package/dist/bundle/chunk-UC7JLE6J.js +58 -0
- package/dist/bundle/chunk-UUIOAZPH.js +156 -0
- package/dist/bundle/chunk-UXQ24OY6.js +4072 -0
- package/dist/bundle/chunk-VBRRMGON.js +1007 -0
- package/dist/bundle/chunk-VRIBES2C.js +319 -0
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/chunk-XT5XYQEZ.js +3414 -0
- package/dist/bundle/chunk-XTAS5Z3G.js +2231 -0
- package/dist/bundle/chunk-XYQVVW4R.js +24 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YHWFF6DN.js +39 -0
- package/dist/bundle/chunk-YUDVRFXN.js +63 -0
- package/dist/bundle/chunk-Z3I2MCUT.js +131 -0
- package/dist/bundle/chunk-ZDI3WC7V.js +353 -0
- package/dist/bundle/chunk-ZVQ7KFMT.js +274 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-P7YE4EKS.js +37 -0
- package/dist/bundle/command-server-entry-XIMCBWMV.js +166 -0
- package/dist/bundle/decode-6XK55WYV.js +297 -0
- package/dist/bundle/definitions-GIQCGYPR.js +7986 -0
- package/dist/bundle/dispatch-JQBAZWCL.js +411 -0
- package/dist/bundle/dist-2TV3NVE5.js +7577 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/echarts-YRRVLEX3.js +42501 -0
- package/dist/bundle/embed-L3EEQSGX.js +38 -0
- package/dist/bundle/embedder-BIKLBV3J.js +111 -0
- package/dist/bundle/failure-I6AAF5R5.js +25 -0
- package/dist/bundle/first-run-W6G6TYZ2.js +29 -0
- package/dist/bundle/first-screen-ITIAJIBU.js +37 -0
- package/dist/bundle/hast-util-from-html-ZHU6HGIE.js +10531 -0
- package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
- package/dist/bundle/hast-util-to-mdast-D62XX3NR.js +2272 -0
- package/dist/bundle/instructions-AG7SRWTR.js +11 -0
- package/dist/bundle/mcp-YGOAUNC3.js +167 -0
- package/dist/bundle/mdast-util-from-markdown-WVUJDSUO.js +1900 -0
- package/dist/bundle/mdast-util-gfm-KN2D32QS.js +1040 -0
- package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
- package/dist/bundle/mdast-util-to-markdown-UCAJNHJO.js +18 -0
- package/dist/bundle/meeting-combined-CQJ3JHHU.js +24 -0
- package/dist/bundle/meeting-model-MZ7VVBNK.js +25 -0
- package/dist/bundle/meeting-semantic-DADWRRHP.js +22 -0
- package/dist/bundle/micromark-extension-gfm-EEJRRJ36.js +1771 -0
- package/dist/bundle/node-GJQYN4FT.js +176 -0
- package/dist/bundle/node-JJ3WDCNJ.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-TPR62DT2.js +74 -0
- package/dist/bundle/oauth-WGY7JQVW.js +20 -0
- package/dist/bundle/open-DE7QZNAN.js +23 -0
- package/dist/bundle/openai-NHEFT3HS.js +238 -0
- package/dist/bundle/process-MEKCZMX3.js +91 -0
- package/dist/bundle/program-EP2S5BTM.js +38857 -0
- package/dist/bundle/prompt-PWY53BYH.js +17 -0
- package/dist/bundle/recognize-74TXHKMQ.js +26 -0
- package/dist/bundle/remote-F5TJZ5ER.js +31 -0
- package/dist/bundle/rerank-HWUO52UF.js +52 -0
- package/dist/bundle/schemas-4K6WWS5N.js +2157 -0
- package/dist/bundle/serve-I2USUY4X.js +199 -0
- package/dist/bundle/server-GDYDNO6K.js +79 -0
- package/dist/bundle/server-KYUW2AHB.js +212 -0
- package/dist/bundle/sqlite-runtime-N6VFGBJK.js +20 -0
- package/dist/bundle/state-L6JSCN77.js +36 -0
- package/dist/bundle/store-EPG2YPN3.js +291 -0
- package/dist/bundle/store-SQWQJE32.js +181 -0
- package/dist/bundle/store-maintenance-command-FTGSICVA.js +66 -0
- package/dist/bundle/surface-SNMHY6GP.js +65 -0
- package/dist/bundle/wordpress.js +183 -0
- package/dist/commands/api.d.ts +22 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +37 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/content.d.ts +4 -0
- package/dist/commands/content.d.ts.map +1 -0
- package/dist/commands/content.js +94 -0
- package/dist/commands/content.js.map +1 -0
- package/dist/commands/session.d.ts +8 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +28 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +69 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +31 -0
- package/dist/context.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +7982 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +8830 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +229 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +2019 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +3365 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/generated/wirecat-config.d.ts +11 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +337 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/identity.d.ts +28 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +29 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +53 -0
- package/dist/program.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +87 -4
- package/skills/wordpress-cli/SKILL.md +88 -0
- package/skills/wordpress-cli/references/api/api-block-directory.md +17 -0
- package/skills/wordpress-cli/references/api/api-block-patterns.md +13 -0
- package/skills/wordpress-cli/references/api/api-block-types.md +34 -0
- package/skills/wordpress-cli/references/api/api-blocks.md +159 -0
- package/skills/wordpress-cli/references/api/api-categories.md +69 -0
- package/skills/wordpress-cli/references/api/api-comments.md +79 -0
- package/skills/wordpress-cli/references/api/api-font-collections.md +16 -0
- package/skills/wordpress-cli/references/api/api-font-families.md +122 -0
- package/skills/wordpress-cli/references/api/api-global-styles.md +29 -0
- package/skills/wordpress-cli/references/api/api-media.md +106 -0
- package/skills/wordpress-cli/references/api/api-menu-items.md +115 -0
- package/skills/wordpress-cli/references/api/api-menu-locations.md +22 -0
- package/skills/wordpress-cli/references/api/api-menus.md +69 -0
- package/skills/wordpress-cli/references/api/api-navigation.md +155 -0
- package/skills/wordpress-cli/references/api/api-pages.md +161 -0
- package/skills/wordpress-cli/references/api/api-pattern-directory.md +23 -0
- package/skills/wordpress-cli/references/api/api-plugins.md +25 -0
- package/skills/wordpress-cli/references/api/api-posts.md +166 -0
- package/skills/wordpress-cli/references/api/api-search.md +21 -0
- package/skills/wordpress-cli/references/api/api-settings.md +19 -0
- package/skills/wordpress-cli/references/api/api-sidebars.md +34 -0
- package/skills/wordpress-cli/references/api/api-statuses.md +22 -0
- package/skills/wordpress-cli/references/api/api-tags.md +69 -0
- package/skills/wordpress-cli/references/api/api-taxonomies.md +23 -0
- package/skills/wordpress-cli/references/api/api-template-parts.md +38 -0
- package/skills/wordpress-cli/references/api/api-templates.md +38 -0
- package/skills/wordpress-cli/references/api/api-themes.md +12 -0
- package/skills/wordpress-cli/references/api/api-types.md +22 -0
- package/skills/wordpress-cli/references/api/api-users.md +149 -0
- package/skills/wordpress-cli/references/api/api-widget-types.md +46 -0
- package/skills/wordpress-cli/references/api/api-widgets.md +57 -0
- package/skills/wordpress-cli/references/api/api-wp-pattern-category.md +69 -0
- package/skills/wordpress-cli/references/api.md +44 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CAPABILITY_STATEMENTS,
|
|
5
|
+
storeCapable
|
|
6
|
+
} from "./chunk-HWQ7572G.js";
|
|
7
|
+
import {
|
|
8
|
+
importFrom
|
|
9
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/sqlite-runtime.js
|
|
15
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { dirname } from "node:path";
|
|
18
|
+
var RESTARTED = "CLI_MESSAGING_SQLITE_RESTARTED";
|
|
19
|
+
var USER_LIBRARY_PATH = "CLI_MESSAGING_USER_LD_LIBRARY_PATH";
|
|
20
|
+
var FORWARDED = ["SIGTERM", "SIGHUP", "SIGQUIT"];
|
|
21
|
+
var ensureSqlite = /* @__PURE__ */ __name(async (runtime = nodeRuntime()) => {
|
|
22
|
+
const { env } = runtime;
|
|
23
|
+
if (env[RESTARTED]) {
|
|
24
|
+
if (env[USER_LIBRARY_PATH] === void 0)
|
|
25
|
+
delete env.LD_LIBRARY_PATH;
|
|
26
|
+
else
|
|
27
|
+
env.LD_LIBRARY_PATH = env[USER_LIBRARY_PATH];
|
|
28
|
+
delete env[USER_LIBRARY_PATH];
|
|
29
|
+
delete env[RESTARTED];
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (runtime.bun || runtime.platform !== "linux")
|
|
33
|
+
return;
|
|
34
|
+
const maps = runtime.maps();
|
|
35
|
+
if (!maps.includes("libsqlite3"))
|
|
36
|
+
return;
|
|
37
|
+
if (await runtime.capable())
|
|
38
|
+
return;
|
|
39
|
+
const library = await runtime.library(maps.includes("ld-musl"));
|
|
40
|
+
if (!library)
|
|
41
|
+
return;
|
|
42
|
+
const restarted = {
|
|
43
|
+
...env,
|
|
44
|
+
LD_LIBRARY_PATH: [dirname(library.path), env.LD_LIBRARY_PATH].filter(Boolean).join(":"),
|
|
45
|
+
[RESTARTED]: "1"
|
|
46
|
+
};
|
|
47
|
+
if (env.LD_LIBRARY_PATH !== void 0)
|
|
48
|
+
restarted[USER_LIBRARY_PATH] = env.LD_LIBRARY_PATH;
|
|
49
|
+
if (!runtime.works(restarted, library.version))
|
|
50
|
+
return;
|
|
51
|
+
await runtime.restart(restarted);
|
|
52
|
+
}, "ensureSqlite");
|
|
53
|
+
var trialScript = /* @__PURE__ */ __name((version) => `
|
|
54
|
+
const { DatabaseSync } = await import("node:sqlite")
|
|
55
|
+
const database = new DatabaseSync(":memory:")
|
|
56
|
+
if (database.prepare("SELECT sqlite_version() AS v").get().v !== ${JSON.stringify(version)}) process.exit(1)
|
|
57
|
+
for (const statement of ${JSON.stringify(CAPABILITY_STATEMENTS)}) database.exec(statement)
|
|
58
|
+
`, "trialScript");
|
|
59
|
+
var nodeRuntime = /* @__PURE__ */ __name(() => ({
|
|
60
|
+
env: process.env,
|
|
61
|
+
platform: process.platform,
|
|
62
|
+
bun: "Bun" in globalThis,
|
|
63
|
+
maps: /* @__PURE__ */ __name(() => {
|
|
64
|
+
try {
|
|
65
|
+
return readFileSync("/proc/self/maps", "utf8");
|
|
66
|
+
} catch {
|
|
67
|
+
return "";
|
|
68
|
+
}
|
|
69
|
+
}, "maps"),
|
|
70
|
+
capable: /* @__PURE__ */ __name(() => storeCapable().then(() => true, () => false), "capable"),
|
|
71
|
+
library: /* @__PURE__ */ __name(async (musl) => {
|
|
72
|
+
try {
|
|
73
|
+
const { libraryFor, SQLITE_VERSION } = await importFrom(new URL("sqlite-runtime.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
|
|
74
|
+
const path = libraryFor({ musl });
|
|
75
|
+
return path === void 0 ? void 0 : { path, version: SQLITE_VERSION };
|
|
76
|
+
} catch {
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
}, "library"),
|
|
80
|
+
works: /* @__PURE__ */ __name((env, version) => spawnSync(process.execPath, ["--no-warnings", "--input-type=module", "-e", trialScript(version)], {
|
|
81
|
+
env,
|
|
82
|
+
stdio: "ignore",
|
|
83
|
+
timeout: 1e4
|
|
84
|
+
}).status === 0, "works"),
|
|
85
|
+
restart: /* @__PURE__ */ __name((env) => relay(spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], { env, stdio: "inherit" })), "restart")
|
|
86
|
+
}), "nodeRuntime");
|
|
87
|
+
var relay = /* @__PURE__ */ __name((child, host = process) => new Promise(() => {
|
|
88
|
+
for (const signal of FORWARDED)
|
|
89
|
+
host.on(signal, () => child.kill(signal));
|
|
90
|
+
host.on("SIGINT", () => {
|
|
91
|
+
});
|
|
92
|
+
child.on("error", () => host.exit(1));
|
|
93
|
+
child.on("exit", (code, signal) => {
|
|
94
|
+
if (signal) {
|
|
95
|
+
host.removeAllListeners(signal);
|
|
96
|
+
host.kill(host.pid, signal);
|
|
97
|
+
} else
|
|
98
|
+
host.exit(code ?? 1);
|
|
99
|
+
});
|
|
100
|
+
}), "relay");
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
ensureSqlite,
|
|
104
|
+
nodeRuntime,
|
|
105
|
+
relay
|
|
106
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/http/listen.js
|
|
8
|
+
import { createServer } from "node:http";
|
|
9
|
+
import { Readable } from "node:stream";
|
|
10
|
+
var MAX_BODY = 4 * 1024 * 1024;
|
|
11
|
+
var TooLarge = class extends Error {
|
|
12
|
+
static {
|
|
13
|
+
__name(this, "TooLarge");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var readBody = /* @__PURE__ */ __name((incoming, limit) => new Promise((resolve, reject) => {
|
|
17
|
+
if (Number(incoming.headers["content-length"] ?? 0) > limit)
|
|
18
|
+
return reject(new TooLarge());
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let size = 0;
|
|
21
|
+
incoming.on("data", (chunk) => {
|
|
22
|
+
size += chunk.length;
|
|
23
|
+
if (size > limit) {
|
|
24
|
+
incoming.destroy();
|
|
25
|
+
reject(new TooLarge());
|
|
26
|
+
} else
|
|
27
|
+
chunks.push(chunk);
|
|
28
|
+
});
|
|
29
|
+
incoming.once("end", () => resolve(Buffer.concat(chunks)));
|
|
30
|
+
incoming.once("error", reject);
|
|
31
|
+
}), "readBody");
|
|
32
|
+
var toRequest = /* @__PURE__ */ __name(async (incoming, origin, maxBody) => {
|
|
33
|
+
const headers = new Headers();
|
|
34
|
+
for (const [name, value] of Object.entries(incoming.headers)) {
|
|
35
|
+
if (Array.isArray(value))
|
|
36
|
+
for (const one of value)
|
|
37
|
+
headers.append(name, one);
|
|
38
|
+
else if (value !== void 0)
|
|
39
|
+
headers.set(name, value);
|
|
40
|
+
}
|
|
41
|
+
const method = incoming.method ?? "GET";
|
|
42
|
+
const body = method === "GET" || method === "HEAD" ? void 0 : await readBody(incoming, maxBody);
|
|
43
|
+
if (body)
|
|
44
|
+
headers.set("content-length", String(body.length));
|
|
45
|
+
return new Request(new URL(incoming.url ?? "/", origin), { method, headers, ...body ? { body } : {} });
|
|
46
|
+
}, "toRequest");
|
|
47
|
+
var send = /* @__PURE__ */ __name(async (response, outgoing) => {
|
|
48
|
+
outgoing.writeHead(response.status, Object.fromEntries(response.headers));
|
|
49
|
+
if (!response.body)
|
|
50
|
+
return void outgoing.end();
|
|
51
|
+
const body = Readable.fromWeb(response.body);
|
|
52
|
+
outgoing.once("close", () => body.destroy());
|
|
53
|
+
body.pipe(outgoing);
|
|
54
|
+
}, "send");
|
|
55
|
+
var listen = /* @__PURE__ */ __name((handle, { host, port, maxBody = MAX_BODY }) => new Promise((resolve, reject) => {
|
|
56
|
+
const server = createServer((incoming, outgoing) => {
|
|
57
|
+
toRequest(incoming, `http://${host}`, maxBody).then(handle).then((response) => send(response, outgoing)).catch((error) => {
|
|
58
|
+
if (!outgoing.headersSent)
|
|
59
|
+
outgoing.writeHead(error instanceof TooLarge ? 413 : 500, { connection: "close" });
|
|
60
|
+
outgoing.end();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
server.once("error", reject);
|
|
64
|
+
server.listen(port, host, () => {
|
|
65
|
+
const { port: bound } = server.address();
|
|
66
|
+
resolve({
|
|
67
|
+
url: new URL(`http://${host}:${bound}`),
|
|
68
|
+
close: /* @__PURE__ */ __name(() => new Promise((done) => {
|
|
69
|
+
server.close(() => done());
|
|
70
|
+
server.closeAllConnections();
|
|
71
|
+
}), "close")
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}), "listen");
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
listen
|
|
78
|
+
};
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
readSharedSection,
|
|
5
|
+
sharedConfigPath,
|
|
6
|
+
writeSharedSection
|
|
7
|
+
} from "./chunk-T5SOY3AE.js";
|
|
8
|
+
import {
|
|
9
|
+
filesPresent,
|
|
10
|
+
sharedModelsDirectory
|
|
11
|
+
} from "./chunk-ZVQ7KFMT.js";
|
|
12
|
+
import {
|
|
13
|
+
storePath
|
|
14
|
+
} from "./chunk-HCOZUOSN.js";
|
|
15
|
+
import {
|
|
16
|
+
array,
|
|
17
|
+
check,
|
|
18
|
+
getDotPath,
|
|
19
|
+
integer,
|
|
20
|
+
maxLength,
|
|
21
|
+
maxValue,
|
|
22
|
+
minLength,
|
|
23
|
+
minValue,
|
|
24
|
+
number,
|
|
25
|
+
optional,
|
|
26
|
+
picklist,
|
|
27
|
+
pipe,
|
|
28
|
+
regex,
|
|
29
|
+
safeParse,
|
|
30
|
+
startsWith,
|
|
31
|
+
strictObject,
|
|
32
|
+
string,
|
|
33
|
+
trim,
|
|
34
|
+
url
|
|
35
|
+
} from "./chunk-S4UUN6LD.js";
|
|
36
|
+
import {
|
|
37
|
+
CliError
|
|
38
|
+
} from "./chunk-HM6AMYHR.js";
|
|
39
|
+
import {
|
|
40
|
+
__name
|
|
41
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
42
|
+
|
|
43
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/embeddings/models.js
|
|
44
|
+
import { existsSync } from "node:fs";
|
|
45
|
+
import { join } from "node:path";
|
|
46
|
+
var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
|
|
47
|
+
var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
|
|
48
|
+
var e5Large = huggingFace("Xenova/multilingual-e5-large", "00fc3aeb3dbb95842de2ac1961d33c6319acf57b");
|
|
49
|
+
var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
|
|
50
|
+
var TEXT_MODELS = [
|
|
51
|
+
{
|
|
52
|
+
id: "e5-small",
|
|
53
|
+
title: "multilingual-e5-small, 8-bit",
|
|
54
|
+
size: "small",
|
|
55
|
+
languages: "about 100 languages, Russian and English among them",
|
|
56
|
+
licence: "MIT",
|
|
57
|
+
dims: 384,
|
|
58
|
+
maxTokens: 512,
|
|
59
|
+
// 100k-message corpus, one 8-thread session on Ryzen AI 9 HX 470: 31–32 chunks/s.
|
|
60
|
+
chunksPerSecond: 31,
|
|
61
|
+
pooling: "mean",
|
|
62
|
+
prefix: { query: "query: ", passage: "passage: " },
|
|
63
|
+
onnx: "onnx/model_quantized.onnx",
|
|
64
|
+
files: [
|
|
65
|
+
{
|
|
66
|
+
name: "onnx/model_quantized.onnx",
|
|
67
|
+
url: e5("onnx/model_quantized.onnx"),
|
|
68
|
+
sha256: "f80102d3f2a1229f387d3c81909990d8945513e347b0eab049f7de3c6f98c193",
|
|
69
|
+
bytes: 118308185
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "tokenizer.json",
|
|
73
|
+
url: e5("tokenizer.json"),
|
|
74
|
+
sha256: "0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39",
|
|
75
|
+
bytes: 17082730
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "tokenizer_config.json",
|
|
79
|
+
url: e5("tokenizer_config.json"),
|
|
80
|
+
sha256: "a1d6bc8734a6f635dc158508bef000f8e2e5a759c7d92f984b2c86e5ff53425b",
|
|
81
|
+
bytes: 443
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "embeddinggemma",
|
|
87
|
+
title: "EmbeddingGemma 300M, 4-bit",
|
|
88
|
+
size: "medium",
|
|
89
|
+
languages: "over 100 languages \u2014 the best of the two on chat, about seven times slower",
|
|
90
|
+
licence: "Gemma Terms of Use",
|
|
91
|
+
terms: "https://ai.google.dev/gemma/terms",
|
|
92
|
+
// Gemma Terms of Use §3.1: every copy carries this notice and the use restrictions of §3.2.
|
|
93
|
+
notice: "Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms. Its use is restricted by the Gemma Prohibited Use Policy: https://ai.google.dev/gemma/prohibited_use_policy",
|
|
94
|
+
dims: 768,
|
|
95
|
+
maxTokens: 2048,
|
|
96
|
+
// 2026-11-08, 1,200-character chunks, 8 threads on the Ryzen AI 9 HX 470: 8.3 chunks/s against e5-small's 52.7, so
|
|
97
|
+
// 5 on the scale e5-small's 31 sets. It was 2, which held a memo sync to 39 chunks.
|
|
98
|
+
chunksPerSecond: 5,
|
|
99
|
+
pooling: "sentence_embedding",
|
|
100
|
+
prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
|
|
101
|
+
onnx: "onnx/model_q4.onnx",
|
|
102
|
+
externalData: "onnx/model_q4.onnx_data",
|
|
103
|
+
files: [
|
|
104
|
+
{
|
|
105
|
+
name: "onnx/model_q4.onnx",
|
|
106
|
+
url: gemma("onnx/model_q4.onnx"),
|
|
107
|
+
sha256: "ad1dfee81a70f7944b9b9d1cc6e48075b832881cf33fab2f2b248be78f3f0043",
|
|
108
|
+
bytes: 519322
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "onnx/model_q4.onnx_data",
|
|
112
|
+
url: gemma("onnx/model_q4.onnx_data"),
|
|
113
|
+
sha256: "599962c3143b040de2dd05e5975be3e9091dd067cacc6a8f7186e3203bab9e02",
|
|
114
|
+
bytes: 196725760
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "tokenizer.json",
|
|
118
|
+
url: gemma("tokenizer.json"),
|
|
119
|
+
sha256: "4dda02faaf32bc91031dc8c88457ac272b00c1016cc679757d1c441b248b9c47",
|
|
120
|
+
bytes: 20323312
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "tokenizer_config.json",
|
|
124
|
+
url: gemma("tokenizer_config.json"),
|
|
125
|
+
sha256: "3ca953eea6c3c9fcda9cf3df22949ff18b216f7c74bd6459230f3f1013953f3a",
|
|
126
|
+
bytes: 1156830
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: "e5-large",
|
|
132
|
+
title: "multilingual-e5-large, 8-bit",
|
|
133
|
+
size: "large",
|
|
134
|
+
languages: "about 100 languages, Russian and English among them \u2014 reads better than e5-small, several times slower",
|
|
135
|
+
licence: "MIT",
|
|
136
|
+
dims: 1024,
|
|
137
|
+
maxTokens: 512,
|
|
138
|
+
// 2026-11-07, one 8-thread session on the Ryzen AI 9 HX 470 while other benchmarks ran: 3.4 chunks/s.
|
|
139
|
+
chunksPerSecond: 4,
|
|
140
|
+
pooling: "mean",
|
|
141
|
+
prefix: { query: "query: ", passage: "passage: " },
|
|
142
|
+
onnx: "onnx/model_quantized.onnx",
|
|
143
|
+
files: [
|
|
144
|
+
{
|
|
145
|
+
name: "onnx/model_quantized.onnx",
|
|
146
|
+
url: e5Large("onnx/model_quantized.onnx"),
|
|
147
|
+
sha256: "0a8d65db9a36f810ba5da15249f13145fcdc7890e6656f1fd38cd8b7c4db1fca",
|
|
148
|
+
bytes: 561768762
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "tokenizer.json",
|
|
152
|
+
url: e5Large("tokenizer.json"),
|
|
153
|
+
sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
|
|
154
|
+
bytes: 17082660
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "tokenizer_config.json",
|
|
158
|
+
url: e5Large("tokenizer_config.json"),
|
|
159
|
+
sha256: "efb5c0d09722e5fe59a462cd2a9976ee216d55b037597d997cd3fe833216da15",
|
|
160
|
+
bytes: 418
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
var DEFAULT_TEXT_MODEL = "embeddinggemma";
|
|
166
|
+
var PREVIOUS_DEFAULT_TEXT_MODEL = "e5-small";
|
|
167
|
+
var SECTION = "text_models";
|
|
168
|
+
var slug = pipe(string(), regex(/^[a-z0-9][a-z0-9._-]{0,62}$/, "is not a model id: a-z, 0-9, . _ -"));
|
|
169
|
+
var words = pipe(string(), trim(), minLength(1), maxLength(300));
|
|
170
|
+
var fileName = pipe(string(), check((name) => /^[\w.-]+(\/[\w.-]+)*$/.test(name) && !name.split("/").some((part) => part === ".." || part === "."), "is not a file inside the model's folder"));
|
|
171
|
+
var modelFile = strictObject({
|
|
172
|
+
name: fileName,
|
|
173
|
+
url: pipe(string(), url(), startsWith("https://", "has to be an https address")),
|
|
174
|
+
sha256: pipe(string(), regex(/^[0-9a-f]{64}$/, "has to be a sha256 in hex")),
|
|
175
|
+
bytes: pipe(number(), integer(), minValue(1))
|
|
176
|
+
});
|
|
177
|
+
var CustomTextModelShape = pipe(strictObject({
|
|
178
|
+
id: slug,
|
|
179
|
+
title: words,
|
|
180
|
+
languages: words,
|
|
181
|
+
licence: words,
|
|
182
|
+
terms: optional(pipe(string(), url())),
|
|
183
|
+
dims: pipe(number(), integer(), minValue(1), maxValue(8192)),
|
|
184
|
+
maxTokens: pipe(number(), integer(), minValue(16), maxValue(32768)),
|
|
185
|
+
chunksPerSecond: optional(pipe(number(), minValue(0.01))),
|
|
186
|
+
pooling: picklist(["mean", "sentence_embedding"]),
|
|
187
|
+
prefix: strictObject({
|
|
188
|
+
query: pipe(string(), maxLength(200)),
|
|
189
|
+
passage: pipe(string(), maxLength(200))
|
|
190
|
+
}),
|
|
191
|
+
onnx: fileName,
|
|
192
|
+
externalData: optional(fileName),
|
|
193
|
+
files: pipe(array(modelFile), minLength(1), maxLength(16))
|
|
194
|
+
}), check((model) => !TEXT_MODELS.some((one) => one.id === model.id), "takes the id of a model this version ships; choose another"), check((model) => {
|
|
195
|
+
const names = model.files.map(({ name }) => name);
|
|
196
|
+
return [model.onnx, model.externalData, "tokenizer.json", "tokenizer_config.json"].every((name) => name === void 0 || names.includes(name));
|
|
197
|
+
}, "has to list its onnx file, its external data and tokenizer.json and tokenizer_config.json among files"));
|
|
198
|
+
var TextModelsSection = strictObject({
|
|
199
|
+
use: optional(slug),
|
|
200
|
+
custom: optional(array(CustomTextModelShape))
|
|
201
|
+
});
|
|
202
|
+
var textModelsFile = /* @__PURE__ */ __name((env = process.env) => sharedConfigPath(storePath(env), env), "textModelsFile");
|
|
203
|
+
var readTextModelsSection = /* @__PURE__ */ __name((env = process.env) => {
|
|
204
|
+
const path = textModelsFile(env);
|
|
205
|
+
const section = readSharedSection(path, SECTION);
|
|
206
|
+
if (section === void 0)
|
|
207
|
+
return {};
|
|
208
|
+
const checked = safeParse(TextModelsSection, section);
|
|
209
|
+
if (!checked.success) {
|
|
210
|
+
const issue = checked.issues[0];
|
|
211
|
+
const at = issue ? getDotPath(issue) : null;
|
|
212
|
+
throw new CliError("configuration_error", `${path}: ${SECTION}${at ? `.${at}` : ""} ${issue?.message ?? "is not valid"}`);
|
|
213
|
+
}
|
|
214
|
+
const ids = checked.output.custom?.map(({ id }) => id) ?? [];
|
|
215
|
+
const twice = ids.find((id, at) => ids.indexOf(id) !== at);
|
|
216
|
+
if (twice)
|
|
217
|
+
throw new CliError("configuration_error", `${path}: ${SECTION}.custom names ${twice} twice`);
|
|
218
|
+
return checked.output;
|
|
219
|
+
}, "readTextModelsSection");
|
|
220
|
+
var writeTextModelsSection = /* @__PURE__ */ __name((section, env = process.env) => writeSharedSection(textModelsFile(env), SECTION, section.use === void 0 && !section.custom?.length ? void 0 : section), "writeTextModelsSection");
|
|
221
|
+
var textModels = /* @__PURE__ */ __name((env = process.env) => [
|
|
222
|
+
...TEXT_MODELS,
|
|
223
|
+
...(readTextModelsSection(env).custom ?? []).map((model) => ({ ...model, custom: true }))
|
|
224
|
+
], "textModels");
|
|
225
|
+
var textModel = /* @__PURE__ */ __name((id, env = process.env) => {
|
|
226
|
+
const known = textModels(env);
|
|
227
|
+
const found = known.find((model) => model.id === id);
|
|
228
|
+
if (!found) {
|
|
229
|
+
throw new CliError("validation_error", `no text model ${id} \u2014 one of: ${known.map((model) => model.id).join(", ")}`);
|
|
230
|
+
}
|
|
231
|
+
return found;
|
|
232
|
+
}, "textModel");
|
|
233
|
+
var downloaded = /* @__PURE__ */ __name((id, env) => {
|
|
234
|
+
const model = TEXT_MODELS.find((one) => one.id === id);
|
|
235
|
+
const directory = sharedModelsDirectory("text", env);
|
|
236
|
+
return model !== void 0 && filesPresent(model.files.map((file) => [file, join(directory, model.id, file.name)]));
|
|
237
|
+
}, "downloaded");
|
|
238
|
+
var chosenTextModel = /* @__PURE__ */ __name((env = process.env) => {
|
|
239
|
+
const use = readTextModelsSection(env).use;
|
|
240
|
+
if (use !== void 0)
|
|
241
|
+
return { id: use, from: "chosen" };
|
|
242
|
+
const kept = !downloaded(DEFAULT_TEXT_MODEL, env) && existsSync(join(sharedModelsDirectory("text", env), PREVIOUS_DEFAULT_TEXT_MODEL));
|
|
243
|
+
return { id: kept ? PREVIOUS_DEFAULT_TEXT_MODEL : DEFAULT_TEXT_MODEL, from: "default" };
|
|
244
|
+
}, "chosenTextModel");
|
|
245
|
+
var mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
|
|
246
|
+
var bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
|
|
247
|
+
var RERANK_MODELS = [
|
|
248
|
+
{
|
|
249
|
+
id: "mmarco",
|
|
250
|
+
title: "mMARCO mMiniLMv2-L12 cross-encoder, 8-bit",
|
|
251
|
+
languages: "about 100 languages, Russian and English among them",
|
|
252
|
+
licence: "Apache-2.0",
|
|
253
|
+
maxTokens: 512,
|
|
254
|
+
// The x86 name is the quantizer's target; WebAssembly and native ONNX Runtime both run it on any processor.
|
|
255
|
+
onnx: "onnx/model_quint8_avx2.onnx",
|
|
256
|
+
files: [
|
|
257
|
+
{
|
|
258
|
+
name: "onnx/model_quint8_avx2.onnx",
|
|
259
|
+
url: mmarco("onnx/model_quint8_avx2.onnx"),
|
|
260
|
+
sha256: "6c2513767fb63d008a4377bef7a7a3555433d9436342bb53e35a3a72ffc52d4b",
|
|
261
|
+
bytes: 118620016
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "tokenizer.json",
|
|
265
|
+
url: mmarco("tokenizer.json"),
|
|
266
|
+
sha256: "62c24cdc13d4c9952d63718d6c9fa4c287974249e16b7ade6d5a85e7bbb75626",
|
|
267
|
+
bytes: 17082660
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: "tokenizer_config.json",
|
|
271
|
+
url: mmarco("tokenizer_config.json"),
|
|
272
|
+
sha256: "e7fbfbfa6347b4e414c1cee50d142e2c2f9a895dad68b068ae83a8b564c3837e",
|
|
273
|
+
bytes: 435
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "bge-reranker-v2-m3",
|
|
279
|
+
title: "BGE reranker v2 m3, 8-bit",
|
|
280
|
+
languages: "over 100 languages \u2014 better than mmarco in the benchmark, about seven times slower",
|
|
281
|
+
licence: "Apache-2.0 (BAAI's; the ONNX export declares none)",
|
|
282
|
+
maxTokens: 512,
|
|
283
|
+
onnx: "onnx/model_quantized.onnx",
|
|
284
|
+
files: [
|
|
285
|
+
{
|
|
286
|
+
name: "onnx/model_quantized.onnx",
|
|
287
|
+
url: bge("onnx/model_quantized.onnx"),
|
|
288
|
+
sha256: "912fc1215c2dbff6499700534bd8d31253af01573861abbfc43afd1fab6cce5d",
|
|
289
|
+
bytes: 570727094
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "tokenizer.json",
|
|
293
|
+
url: bge("tokenizer.json"),
|
|
294
|
+
sha256: "8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3",
|
|
295
|
+
bytes: 17082900
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "tokenizer_config.json",
|
|
299
|
+
url: bge("tokenizer_config.json"),
|
|
300
|
+
sha256: "b87c8703482b0300d3da30e201519aa641f6a450f5eb5bf1e624afbf70c74d80",
|
|
301
|
+
bytes: 1203
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
];
|
|
306
|
+
var DEFAULT_RERANK_MODEL = "mmarco";
|
|
307
|
+
var rerankModel = /* @__PURE__ */ __name((id) => {
|
|
308
|
+
const found = RERANK_MODELS.find((model) => model.id === id);
|
|
309
|
+
if (!found) {
|
|
310
|
+
throw new CliError("validation_error", `no reranker ${id} \u2014 one of: ${RERANK_MODELS.map((model) => model.id).join(", ")}`);
|
|
311
|
+
}
|
|
312
|
+
return found;
|
|
313
|
+
}, "rerankModel");
|
|
314
|
+
var vectorModelKey = /* @__PURE__ */ __name((model) => {
|
|
315
|
+
const weights = model.custom ? model.files.find(({ name }) => name === model.onnx)?.sha256.slice(0, 12) : void 0;
|
|
316
|
+
return `local:${model.id}${weights ? `@${weights}` : ""}:${model.dims}`;
|
|
317
|
+
}, "vectorModelKey");
|
|
318
|
+
var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
|
|
319
|
+
|
|
320
|
+
export {
|
|
321
|
+
DEFAULT_TEXT_MODEL,
|
|
322
|
+
PREVIOUS_DEFAULT_TEXT_MODEL,
|
|
323
|
+
CustomTextModelShape,
|
|
324
|
+
readTextModelsSection,
|
|
325
|
+
writeTextModelsSection,
|
|
326
|
+
textModels,
|
|
327
|
+
textModel,
|
|
328
|
+
chosenTextModel,
|
|
329
|
+
RERANK_MODELS,
|
|
330
|
+
DEFAULT_RERANK_MODEL,
|
|
331
|
+
rerankModel,
|
|
332
|
+
vectorModelKey,
|
|
333
|
+
meaningFloor
|
|
334
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.js
|
|
8
|
+
var own = {}.hasOwnProperty;
|
|
9
|
+
function zwitch(key, options) {
|
|
10
|
+
const settings = options || {};
|
|
11
|
+
function one(value, ...parameters) {
|
|
12
|
+
let fn = one.invalid;
|
|
13
|
+
const handlers = one.handlers;
|
|
14
|
+
if (value && own.call(value, key)) {
|
|
15
|
+
const id = String(value[key]);
|
|
16
|
+
fn = own.call(handlers, id) ? handlers[id] : one.unknown;
|
|
17
|
+
}
|
|
18
|
+
if (fn) {
|
|
19
|
+
return fn.call(this, value, ...parameters);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
__name(one, "one");
|
|
23
|
+
one.handlers = settings.handlers || {};
|
|
24
|
+
one.invalid = settings.invalid;
|
|
25
|
+
one.unknown = settings.unknown;
|
|
26
|
+
return one;
|
|
27
|
+
}
|
|
28
|
+
__name(zwitch, "zwitch");
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
zwitch
|
|
32
|
+
};
|