@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,185 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
PLAIN_HTTP_REFUSED,
|
|
5
|
+
modelAddressAllowed,
|
|
6
|
+
onThisComputer
|
|
7
|
+
} from "./chunk-JAE5B4G7.js";
|
|
8
|
+
import {
|
|
9
|
+
readSharedSection,
|
|
10
|
+
sharedConfigPath,
|
|
11
|
+
writeSharedSection
|
|
12
|
+
} from "./chunk-T5SOY3AE.js";
|
|
13
|
+
import {
|
|
14
|
+
unit
|
|
15
|
+
} from "./chunk-VBRRMGON.js";
|
|
16
|
+
import {
|
|
17
|
+
storePath
|
|
18
|
+
} from "./chunk-HCOZUOSN.js";
|
|
19
|
+
import {
|
|
20
|
+
boolean,
|
|
21
|
+
isoTimestamp,
|
|
22
|
+
pipe,
|
|
23
|
+
safeParse,
|
|
24
|
+
strictObject,
|
|
25
|
+
string
|
|
26
|
+
} from "./chunk-S4UUN6LD.js";
|
|
27
|
+
import {
|
|
28
|
+
CliError
|
|
29
|
+
} from "./chunk-HM6AMYHR.js";
|
|
30
|
+
import {
|
|
31
|
+
__name
|
|
32
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
33
|
+
|
|
34
|
+
// 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/remote.js
|
|
35
|
+
import { setTimeout } from "node:timers/promises";
|
|
36
|
+
|
|
37
|
+
// 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/models/local-only.js
|
|
38
|
+
var SECTION = "local_only";
|
|
39
|
+
var Setting = strictObject({
|
|
40
|
+
on: boolean(),
|
|
41
|
+
at: pipe(string(), isoTimestamp())
|
|
42
|
+
});
|
|
43
|
+
var pathOf = /* @__PURE__ */ __name((env) => sharedConfigPath(storePath(env), env), "pathOf");
|
|
44
|
+
var readLocalOnly = /* @__PURE__ */ __name((env) => {
|
|
45
|
+
const section = readSharedSection(pathOf(env), SECTION);
|
|
46
|
+
if (section === void 0 || section === null)
|
|
47
|
+
return void 0;
|
|
48
|
+
const checked = safeParse(Setting, section);
|
|
49
|
+
return checked.success ? checked.output : { on: true, at: (/* @__PURE__ */ new Date(0)).toISOString() };
|
|
50
|
+
}, "readLocalOnly");
|
|
51
|
+
var localOnly = /* @__PURE__ */ __name((env) => readLocalOnly(env)?.on === true, "localOnly");
|
|
52
|
+
var writeLocalOnly = /* @__PURE__ */ __name((env, on) => writeSharedSection(pathOf(env), SECTION, on ? { on: true, at: (/* @__PURE__ */ new Date()).toISOString() } : void 0), "writeLocalOnly");
|
|
53
|
+
var localOnlyRefusal = /* @__PURE__ */ __name((what, where) => new CliError("permission_error", `local only is on: ${what} would go to ${where}, which is not this computer; nothing was sent. Choose a model on this computer, or turn local only off with \`models local-only set off\``, { reason: "local-only.refused" }), "localOnlyRefusal");
|
|
54
|
+
var refuseOffComputer = /* @__PURE__ */ __name((env, address, what) => {
|
|
55
|
+
if (!onThisComputer(address) && localOnly(env))
|
|
56
|
+
throw localOnlyRefusal(what, hostOf(address));
|
|
57
|
+
}, "refuseOffComputer");
|
|
58
|
+
var hostOf = /* @__PURE__ */ __name((address) => {
|
|
59
|
+
try {
|
|
60
|
+
return new URL(address).host;
|
|
61
|
+
} catch {
|
|
62
|
+
return address;
|
|
63
|
+
}
|
|
64
|
+
}, "hostOf");
|
|
65
|
+
var refuseModelAddress = /* @__PURE__ */ __name((env, address, what) => {
|
|
66
|
+
if (!modelAddressAllowed(address))
|
|
67
|
+
throw new CliError("validation_error", PLAIN_HTTP_REFUSED, { reason: "model.address-refused" });
|
|
68
|
+
refuseOffComputer(env, address, what);
|
|
69
|
+
}, "refuseModelAddress");
|
|
70
|
+
|
|
71
|
+
// 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/remote.js
|
|
72
|
+
var OPENAI_URL = "https://api.openai.com/v1";
|
|
73
|
+
var OPENAI_MODELS = {
|
|
74
|
+
"text-embedding-3-small": { dims: 1536, perMillion: 0.02 },
|
|
75
|
+
"text-embedding-3-large": { dims: 3072, perMillion: 0.13 }
|
|
76
|
+
};
|
|
77
|
+
var DEFAULT_OPENAI_MODEL = "text-embedding-3-small";
|
|
78
|
+
var PER_REQUEST = 256;
|
|
79
|
+
var isLocal = /* @__PURE__ */ __name((baseUrl) => onThisComputer(baseUrl), "isLocal");
|
|
80
|
+
var remoteModel = /* @__PURE__ */ __name(({ model = DEFAULT_OPENAI_MODEL, baseUrl, dims }) => {
|
|
81
|
+
const known = baseUrl === void 0 ? OPENAI_MODELS[model] : void 0;
|
|
82
|
+
if (baseUrl === void 0 && !known) {
|
|
83
|
+
throw new CliError("validation_error", `OpenAI has no embedding model ${model} here \u2014 one of: ${Object.keys(OPENAI_MODELS).join(", ")}; another server takes --base-url`);
|
|
84
|
+
}
|
|
85
|
+
const size = dims ?? known?.dims;
|
|
86
|
+
if (size === void 0)
|
|
87
|
+
throw new CliError("validation_error", "with --base-url, say the vector size with --dims");
|
|
88
|
+
return {
|
|
89
|
+
provider: baseUrl === void 0 ? "openai" : `url:${new URL(baseUrl).host}`,
|
|
90
|
+
model,
|
|
91
|
+
dims: size,
|
|
92
|
+
baseUrl: baseUrl ?? OPENAI_URL,
|
|
93
|
+
shorten: known !== void 0 && size !== known.dims,
|
|
94
|
+
...known ? { price: { perMillion: known.perMillion, read: "2026-10-02" } } : {}
|
|
95
|
+
};
|
|
96
|
+
}, "remoteModel");
|
|
97
|
+
var remoteKey = /* @__PURE__ */ __name(({ provider, model, dims }) => `${provider}:${model}:${dims}`, "remoteKey");
|
|
98
|
+
var openRemote = /* @__PURE__ */ __name((remote, apiKey, { concurrency = 4, fetch: post = fetch, tries = 5, env }) => {
|
|
99
|
+
refuseModelAddress(env ?? process.env, remote.baseUrl, "text to embed");
|
|
100
|
+
const request = /* @__PURE__ */ __name(async (input) => {
|
|
101
|
+
for (let attempt = 1; ; attempt++) {
|
|
102
|
+
let response;
|
|
103
|
+
try {
|
|
104
|
+
response = await post(`${remote.baseUrl.replace(/\/$/, "")}/embeddings`, {
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: {
|
|
107
|
+
"content-type": "application/json",
|
|
108
|
+
...apiKey ? { authorization: `Bearer ${apiKey}` } : {}
|
|
109
|
+
},
|
|
110
|
+
body: JSON.stringify({
|
|
111
|
+
model: remote.model,
|
|
112
|
+
input,
|
|
113
|
+
encoding_format: "float",
|
|
114
|
+
...remote.shorten ? { dimensions: remote.dims } : {}
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
} catch {
|
|
118
|
+
if (attempt >= tries)
|
|
119
|
+
throw new CliError("network_error", `${remote.provider} could not be reached`);
|
|
120
|
+
await setTimeout(1e3 * attempt);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (response.ok) {
|
|
124
|
+
const body = await response.json();
|
|
125
|
+
const data = [...body.data ?? []].sort((a, b) => a.index - b.index);
|
|
126
|
+
if (data.length !== input.length || data.some(({ embedding }) => embedding.length !== remote.dims)) {
|
|
127
|
+
throw new CliError("invalid_response", `${remote.provider} answered with vectors of another number or size than ${input.length} \xD7 ${remote.dims}`);
|
|
128
|
+
}
|
|
129
|
+
return data.map(({ embedding }) => unit(Float32Array.from(embedding)));
|
|
130
|
+
}
|
|
131
|
+
const code = await errorCode(response);
|
|
132
|
+
if (response.status === 401 || response.status === 403) {
|
|
133
|
+
throw new CliError("authentication_error", `${remote.provider} refused the key (HTTP ${response.status}${code}) \u2014 set it again with \`models keys set\``);
|
|
134
|
+
}
|
|
135
|
+
const again = response.status === 429 || response.status >= 500;
|
|
136
|
+
if (!again || attempt >= tries) {
|
|
137
|
+
throw new CliError(response.status === 429 ? "rate_limited" : "provider_error", `${remote.provider} answered HTTP ${response.status}${code}`);
|
|
138
|
+
}
|
|
139
|
+
const wait = Number(response.headers.get("retry-after"));
|
|
140
|
+
await setTimeout(Number.isFinite(wait) && wait > 0 ? wait * 1e3 : 1e3 * 2 ** attempt);
|
|
141
|
+
}
|
|
142
|
+
}, "request");
|
|
143
|
+
return {
|
|
144
|
+
model: { id: remote.model, dims: remote.dims },
|
|
145
|
+
embed: /* @__PURE__ */ __name(async (texts) => {
|
|
146
|
+
const parts = [];
|
|
147
|
+
for (let start = 0; start < texts.length; start += PER_REQUEST)
|
|
148
|
+
parts.push(texts.slice(start, start + PER_REQUEST));
|
|
149
|
+
const results = new Array(parts.length);
|
|
150
|
+
let next = 0;
|
|
151
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, parts.length) }, async () => {
|
|
152
|
+
for (let index = next++; index < parts.length; index = next++)
|
|
153
|
+
results[index] = await request(parts[index]);
|
|
154
|
+
}));
|
|
155
|
+
return results.flat();
|
|
156
|
+
}, "embed"),
|
|
157
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
158
|
+
}, "close")
|
|
159
|
+
};
|
|
160
|
+
}, "openRemote");
|
|
161
|
+
var errorCode = /* @__PURE__ */ __name(async (response) => {
|
|
162
|
+
try {
|
|
163
|
+
const body = await response.json();
|
|
164
|
+
const code = body.error?.code ?? body.error?.type;
|
|
165
|
+
return typeof code === "string" && /^[\w.-]{1,64}$/.test(code) ? `, ${code}` : "";
|
|
166
|
+
} catch {
|
|
167
|
+
return "";
|
|
168
|
+
}
|
|
169
|
+
}, "errorCode");
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
readLocalOnly,
|
|
173
|
+
localOnly,
|
|
174
|
+
writeLocalOnly,
|
|
175
|
+
localOnlyRefusal,
|
|
176
|
+
refuseOffComputer,
|
|
177
|
+
refuseModelAddress,
|
|
178
|
+
OPENAI_URL,
|
|
179
|
+
OPENAI_MODELS,
|
|
180
|
+
DEFAULT_OPENAI_MODEL,
|
|
181
|
+
isLocal,
|
|
182
|
+
remoteModel,
|
|
183
|
+
remoteKey,
|
|
184
|
+
openRemote
|
|
185
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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/ccount@2.0.1/node_modules/ccount/index.js
|
|
8
|
+
function ccount(value, character) {
|
|
9
|
+
const source = String(value);
|
|
10
|
+
if (typeof character !== "string") {
|
|
11
|
+
throw new TypeError("Expected character");
|
|
12
|
+
}
|
|
13
|
+
let count = 0;
|
|
14
|
+
let index = source.indexOf(character);
|
|
15
|
+
while (index !== -1) {
|
|
16
|
+
count++;
|
|
17
|
+
index = source.indexOf(character, index + character.length);
|
|
18
|
+
}
|
|
19
|
+
return count;
|
|
20
|
+
}
|
|
21
|
+
__name(ccount, "ccount");
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
ccount
|
|
25
|
+
};
|
|
@@ -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-UXQ24OY6.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-HM6AMYHR.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// 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/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,37 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
convert
|
|
5
|
+
} from "./chunk-TRYYWV7J.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.js
|
|
8
|
+
var phrasing = (
|
|
9
|
+
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
10
|
+
convert([
|
|
11
|
+
"break",
|
|
12
|
+
"delete",
|
|
13
|
+
"emphasis",
|
|
14
|
+
// To do: next major: removed since footnotes were added to GFM.
|
|
15
|
+
"footnote",
|
|
16
|
+
"footnoteReference",
|
|
17
|
+
"image",
|
|
18
|
+
"imageReference",
|
|
19
|
+
"inlineCode",
|
|
20
|
+
// Enabled by `mdast-util-math`:
|
|
21
|
+
"inlineMath",
|
|
22
|
+
"link",
|
|
23
|
+
"linkReference",
|
|
24
|
+
// Enabled by `mdast-util-mdx`:
|
|
25
|
+
"mdxJsxTextElement",
|
|
26
|
+
// Enabled by `mdast-util-mdx`:
|
|
27
|
+
"mdxTextExpression",
|
|
28
|
+
"strong",
|
|
29
|
+
"text",
|
|
30
|
+
// Enabled by `mdast-util-directive`:
|
|
31
|
+
"textDirective"
|
|
32
|
+
])
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
phrasing
|
|
37
|
+
};
|