@wirecat/notion-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 +33 -0
- package/LICENSE +204 -0
- package/README.md +36 -2
- package/contracts/wirecat.json +1315 -0
- package/dist/bin/notion.d.ts +3 -0
- package/dist/bin/notion.d.ts.map +1 -0
- package/dist/bin/notion.js +40 -0
- package/dist/bin/notion.js.map +1 -0
- package/dist/bundle/all-profiles-OETMCOLN.js +278 -0
- package/dist/bundle/anthropic-5Y3O2TYM.js +91 -0
- package/dist/bundle/app-server-IVWBIVHC.js +231 -0
- package/dist/bundle/bun-EO636SAD.js +169 -0
- package/dist/bundle/bun-sqlite-C2T7QJ2M.js +76 -0
- package/dist/bundle/chunk-24FAYAML.js +52 -0
- package/dist/bundle/chunk-2YR3RYT4.js +73 -0
- package/dist/bundle/chunk-35K5T6WV.js +24 -0
- package/dist/bundle/chunk-3D3PFXBP.js +2315 -0
- package/dist/bundle/chunk-47R43UVJ.js +1068 -0
- package/dist/bundle/chunk-4GC5DBHW.js +100 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-64D5VUZ4.js +9564 -0
- package/dist/bundle/chunk-66PL7P4C.js +23 -0
- package/dist/bundle/chunk-7FII4DCE.js +362 -0
- package/dist/bundle/chunk-7N5QB6NL.js +156 -0
- package/dist/bundle/chunk-AE2KQ37N.js +95 -0
- package/dist/bundle/chunk-AQZO3ITW.js +58 -0
- package/dist/bundle/chunk-B2WFKFYL.js +1488 -0
- package/dist/bundle/chunk-B2XKEEFX.js +230 -0
- package/dist/bundle/chunk-B4B65XIO.js +73 -0
- package/dist/bundle/chunk-BWICUW7W.js +288 -0
- package/dist/bundle/chunk-CLG2ISQH.js +206 -0
- package/dist/bundle/chunk-CWVAYQXI.js +185 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DIM5YWBU.js +53 -0
- package/dist/bundle/chunk-EGTBL3MJ.js +6848 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-EPAZ7DJB.js +783 -0
- package/dist/bundle/chunk-ESZT4WW3.js +142 -0
- package/dist/bundle/chunk-EU5WCOMQ.js +4001 -0
- package/dist/bundle/chunk-F6MLJ3V5.js +72 -0
- package/dist/bundle/chunk-FF4DDBCB.js +1028 -0
- package/dist/bundle/chunk-GA3URWIF.js +46 -0
- package/dist/bundle/chunk-HRTIRRXR.js +3112 -0
- package/dist/bundle/chunk-HWRKURQH.js +54 -0
- package/dist/bundle/chunk-IQWEJEB5.js +39724 -0
- package/dist/bundle/chunk-JK44XO2S.js +392 -0
- package/dist/bundle/chunk-JKIN5TOU.js +131 -0
- package/dist/bundle/chunk-K5TWMQSY.js +188 -0
- package/dist/bundle/chunk-KHOVVPLC.js +18 -0
- package/dist/bundle/chunk-NLDYZBTC.js +5862 -0
- package/dist/bundle/chunk-OWJDC4CB.js +217 -0
- package/dist/bundle/chunk-QBC23NHD.js +38 -0
- package/dist/bundle/chunk-QC3KOJT4.js +300 -0
- package/dist/bundle/chunk-R6ZM45NF.js +1239 -0
- package/dist/bundle/chunk-RAZKIHGH.js +76 -0
- package/dist/bundle/chunk-RDZ7SVBZ.js +731 -0
- package/dist/bundle/chunk-RLSFOR2D.js +161 -0
- package/dist/bundle/chunk-RSIS7BR7.js +2778 -0
- package/dist/bundle/chunk-ST2UC7FS.js +1324 -0
- package/dist/bundle/chunk-TR7R5DL4.js +370 -0
- package/dist/bundle/chunk-TSCIIXN3.js +106 -0
- package/dist/bundle/chunk-UWIA2G6Q.js +12737 -0
- package/dist/bundle/chunk-UWW24JQF.js +66 -0
- package/dist/bundle/chunk-WK3OSDNV.js +1197 -0
- package/dist/bundle/chunk-WM7663C2.js +1221 -0
- package/dist/bundle/chunk-WVZFXI36.js +274 -0
- package/dist/bundle/chunk-WWMB4UHF.js +78 -0
- package/dist/bundle/chunk-XC5CKHX2.js +63 -0
- package/dist/bundle/chunk-XL2HXHP3.js +82 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-XYIT2XB3.js +1372 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YA4LSSDZ.js +64499 -0
- package/dist/bundle/chunk-ZI3YTXSF.js +2 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-6G5DC2FN.js +35 -0
- package/dist/bundle/command-server-entry-A66DJ3MH.js +164 -0
- package/dist/bundle/decode-7XOFRAAT.js +163 -0
- package/dist/bundle/definitions-M3U4UYHN.js +45607 -0
- package/dist/bundle/dispatch-FEKU5UXC.js +411 -0
- package/dist/bundle/dist-YFKABFFF.js +7577 -0
- package/dist/bundle/echarts-XD2JSWU4.js +42501 -0
- package/dist/bundle/embed-F3HYGAF7.js +38 -0
- package/dist/bundle/embedder-GSEDDUH7.js +111 -0
- package/dist/bundle/failure-HDJLR2YJ.js +25 -0
- package/dist/bundle/first-run-TXNTIUSP.js +28 -0
- package/dist/bundle/first-screen-JZPJND7J.js +33 -0
- package/dist/bundle/instructions-NZGJ4FW5.js +11 -0
- package/dist/bundle/mcp-VFIOZDVY.js +167 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-RPKPDYQS.js +176 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-KH2UUYVO.js +74 -0
- package/dist/bundle/notion.js +185 -0
- package/dist/bundle/oauth-NKAI7TQD.js +20 -0
- package/dist/bundle/open-WSAEAA2V.js +23 -0
- package/dist/bundle/openai-JPVDGHG5.js +238 -0
- package/dist/bundle/process-5ZFVKOQX.js +91 -0
- package/dist/bundle/program-M3D56D6T.js +28854 -0
- package/dist/bundle/prompt-FROYQ5LV.js +17 -0
- package/dist/bundle/recognize-NYCHQMCX.js +26 -0
- package/dist/bundle/remote-4OERF3Z4.js +32 -0
- package/dist/bundle/rerank-TEGXFUWY.js +52 -0
- package/dist/bundle/schemas-MZNNOEYN.js +12214 -0
- package/dist/bundle/serve-HLYYBAXY.js +199 -0
- package/dist/bundle/server-D5OYNEUW.js +193 -0
- package/dist/bundle/server-LWZGVMNW.js +62 -0
- package/dist/bundle/sqlite-runtime-H2S5RR2F.js +20 -0
- package/dist/bundle/state-OPOXCDZL.js +36 -0
- package/dist/bundle/store-NHMXEJPD.js +164 -0
- package/dist/bundle/store-Y3KRLCJ7.js +281 -0
- package/dist/bundle/store-maintenance-command-D4W7WSLQ.js +53 -0
- package/dist/commands/api.d.ts +4 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +140 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/databases.d.ts +3 -0
- package/dist/commands/databases.d.ts.map +1 -0
- package/dist/commands/databases.js +65 -0
- package/dist/commands/databases.js.map +1 -0
- package/dist/commands/documents.d.ts +3 -0
- package/dist/commands/documents.d.ts.map +1 -0
- package/dist/commands/documents.js +41 -0
- package/dist/commands/documents.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +104 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +46 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +58 -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 +45603 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +3 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +2089 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/metadata.d.ts +6 -0
- package/dist/generated/metadata.d.ts.map +1 -0
- package/dist/generated/metadata.js +24 -0
- package/dist/generated/metadata.js.map +1 -0
- package/dist/generated/schemas.d.ts +1223 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +11557 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +11120 -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/identity.d.ts +7 -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/notion/client.d.ts +42 -0
- package/dist/notion/client.d.ts.map +1 -0
- package/dist/notion/client.js +118 -0
- package/dist/notion/client.js.map +1 -0
- package/dist/notion/errors.d.ts +24 -0
- package/dist/notion/errors.d.ts.map +1 -0
- package/dist/notion/errors.js +102 -0
- package/dist/notion/errors.js.map +1 -0
- package/dist/notion/ids.d.ts +7 -0
- package/dist/notion/ids.d.ts.map +1 -0
- package/dist/notion/ids.js +37 -0
- package/dist/notion/ids.js.map +1 -0
- package/dist/notion/links.d.ts +6 -0
- package/dist/notion/links.d.ts.map +1 -0
- package/dist/notion/links.js +22 -0
- package/dist/notion/links.js.map +1 -0
- package/dist/notion/notion.d.ts +95 -0
- package/dist/notion/notion.d.ts.map +1 -0
- package/dist/notion/notion.js +269 -0
- package/dist/notion/notion.js.map +1 -0
- package/dist/notion/port.d.ts +13 -0
- package/dist/notion/port.d.ts.map +1 -0
- package/dist/notion/port.js +60 -0
- package/dist/notion/port.js.map +1 -0
- package/dist/notion/read-posts.d.ts +36 -0
- package/dist/notion/read-posts.d.ts.map +1 -0
- package/dist/notion/read-posts.js +24 -0
- package/dist/notion/read-posts.js.map +1 -0
- package/dist/notion/reads.d.ts +327 -0
- package/dist/notion/reads.d.ts.map +1 -0
- package/dist/notion/reads.js +18 -0
- package/dist/notion/reads.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +62 -0
- package/dist/program.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/sync/cursor.d.ts +54 -0
- package/dist/sync/cursor.d.ts.map +1 -0
- package/dist/sync/cursor.js +52 -0
- package/dist/sync/cursor.js.map +1 -0
- package/dist/sync/front-matter.d.ts +10 -0
- package/dist/sync/front-matter.d.ts.map +1 -0
- package/dist/sync/front-matter.js +114 -0
- package/dist/sync/front-matter.js.map +1 -0
- package/dist/sync/markdown.d.ts +8 -0
- package/dist/sync/markdown.d.ts.map +1 -0
- package/dist/sync/markdown.js +40 -0
- package/dist/sync/markdown.js.map +1 -0
- package/dist/sync/source.d.ts +64 -0
- package/dist/sync/source.d.ts.map +1 -0
- package/dist/sync/source.js +634 -0
- package/dist/sync/source.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 +85 -4
- package/skills/notion-cli/SKILL.md +34 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
WARM_IDLE_MS,
|
|
5
|
+
defaultThreads,
|
|
6
|
+
isTextModelInstalled,
|
|
7
|
+
loadModel,
|
|
8
|
+
meanOf,
|
|
9
|
+
openEmbedder,
|
|
10
|
+
placedText,
|
|
11
|
+
runEmbedders,
|
|
12
|
+
textModelsDirectory,
|
|
13
|
+
truncated,
|
|
14
|
+
unit,
|
|
15
|
+
warmEmbedders
|
|
16
|
+
} from "./chunk-FF4DDBCB.js";
|
|
17
|
+
import "./chunk-WVZFXI36.js";
|
|
18
|
+
import "./chunk-HWRKURQH.js";
|
|
19
|
+
import "./chunk-RSIS7BR7.js";
|
|
20
|
+
import "./chunk-WM7663C2.js";
|
|
21
|
+
import "./chunk-XYIT2XB3.js";
|
|
22
|
+
import "./chunk-Y5E2WNWB.js";
|
|
23
|
+
import "./chunk-F6MLJ3V5.js";
|
|
24
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
25
|
+
export {
|
|
26
|
+
WARM_IDLE_MS,
|
|
27
|
+
defaultThreads,
|
|
28
|
+
isTextModelInstalled,
|
|
29
|
+
loadModel,
|
|
30
|
+
meanOf,
|
|
31
|
+
openEmbedder,
|
|
32
|
+
placedText,
|
|
33
|
+
runEmbedders,
|
|
34
|
+
textModelsDirectory,
|
|
35
|
+
truncated,
|
|
36
|
+
unit,
|
|
37
|
+
warmEmbedders
|
|
38
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
openSession,
|
|
5
|
+
truncated,
|
|
6
|
+
unit
|
|
7
|
+
} from "./chunk-FF4DDBCB.js";
|
|
8
|
+
import "./chunk-WVZFXI36.js";
|
|
9
|
+
import "./chunk-HWRKURQH.js";
|
|
10
|
+
import "./chunk-RSIS7BR7.js";
|
|
11
|
+
import "./chunk-WM7663C2.js";
|
|
12
|
+
import "./chunk-XYIT2XB3.js";
|
|
13
|
+
import {
|
|
14
|
+
importFrom
|
|
15
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
16
|
+
import {
|
|
17
|
+
CliError
|
|
18
|
+
} from "./chunk-F6MLJ3V5.js";
|
|
19
|
+
import {
|
|
20
|
+
__name
|
|
21
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
22
|
+
|
|
23
|
+
// 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/images/picture/embedder.js
|
|
24
|
+
import { readFileSync } from "node:fs";
|
|
25
|
+
import { join } from "node:path";
|
|
26
|
+
|
|
27
|
+
// 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/images/picture/preprocess.js
|
|
28
|
+
var SIZE = 224;
|
|
29
|
+
var MEAN = [0.48145466, 0.4578275, 0.40821073];
|
|
30
|
+
var STD = [0.26862954, 0.26130258, 0.27577711];
|
|
31
|
+
var importCanvas = /* @__PURE__ */ __name(async () => {
|
|
32
|
+
try {
|
|
33
|
+
return await importFrom(new URL("images/picture/preprocess.js", import.meta.resolve("@wirecat/cli-core")).href, "@napi-rs/canvas");
|
|
34
|
+
} catch {
|
|
35
|
+
throw new CliError("validation_error", "searching pictures needs the optional package @napi-rs/canvas to read an image \u2014 install it next to this tool");
|
|
36
|
+
}
|
|
37
|
+
}, "importCanvas");
|
|
38
|
+
var preprocess = /* @__PURE__ */ __name(async (bytes, load = importCanvas) => {
|
|
39
|
+
const { createCanvas, loadImage } = await load();
|
|
40
|
+
let image;
|
|
41
|
+
try {
|
|
42
|
+
image = await loadImage(bytes);
|
|
43
|
+
} catch {
|
|
44
|
+
throw new CliError("invalid_response", "the file is not an image this tool can read");
|
|
45
|
+
}
|
|
46
|
+
const scale = SIZE / Math.min(image.width, image.height);
|
|
47
|
+
const width = Math.max(SIZE, Math.round(image.width * scale));
|
|
48
|
+
const height = Math.max(SIZE, Math.round(image.height * scale));
|
|
49
|
+
const surface = createCanvas(SIZE, SIZE);
|
|
50
|
+
const context = surface.getContext("2d");
|
|
51
|
+
context.fillStyle = "#ffffff";
|
|
52
|
+
context.fillRect(0, 0, SIZE, SIZE);
|
|
53
|
+
context.imageSmoothingQuality = "high";
|
|
54
|
+
context.drawImage(image, 0, 0, image.width, image.height, Math.round((SIZE - width) / 2), Math.round((SIZE - height) / 2), width, height);
|
|
55
|
+
const { data } = context.getImageData(0, 0, SIZE, SIZE);
|
|
56
|
+
const plane = SIZE * SIZE;
|
|
57
|
+
const pixels = new Float32Array(3 * plane);
|
|
58
|
+
for (let at = 0; at < plane; at++) {
|
|
59
|
+
for (let channel = 0; channel < 3; channel++) {
|
|
60
|
+
pixels[channel * plane + at] = (data[at * 4 + channel] / 255 - MEAN[channel]) / STD[channel];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return pixels;
|
|
64
|
+
}, "preprocess");
|
|
65
|
+
|
|
66
|
+
// 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/images/picture/embedder.js
|
|
67
|
+
var openPictureEmbedder = /* @__PURE__ */ __name(async (model, directory, { threads = 4, canvas } = {}) => {
|
|
68
|
+
const { Tokenizer } = await importFrom(new URL("images/picture/embedder.js", import.meta.resolve("@wirecat/cli-core")).href, "@huggingface/tokenizers");
|
|
69
|
+
const path = /* @__PURE__ */ __name((name) => join(directory, model.id, name), "path");
|
|
70
|
+
const tokenizer = new Tokenizer(JSON.parse(readFileSync(path("tokenizer.json"), "utf8")), JSON.parse(readFileSync(path("tokenizer_config.json"), "utf8")));
|
|
71
|
+
const sessions = [];
|
|
72
|
+
const lazy = /* @__PURE__ */ __name((name) => {
|
|
73
|
+
let opened;
|
|
74
|
+
return () => {
|
|
75
|
+
opened ??= openSession(readFileSync(path(name)), threads).then((created) => {
|
|
76
|
+
sessions.push(created.session);
|
|
77
|
+
return created;
|
|
78
|
+
});
|
|
79
|
+
return opened;
|
|
80
|
+
};
|
|
81
|
+
}, "lazy");
|
|
82
|
+
const vision = lazy(model.vision);
|
|
83
|
+
const text = lazy(model.text);
|
|
84
|
+
return {
|
|
85
|
+
model,
|
|
86
|
+
embedImage: /* @__PURE__ */ __name(async (bytes) => {
|
|
87
|
+
const pixels = await preprocess(bytes, canvas);
|
|
88
|
+
const { ort, session } = await vision();
|
|
89
|
+
const output = await session.run({ pixel_values: new ort.Tensor("float32", pixels, [1, 3, SIZE, SIZE]) });
|
|
90
|
+
return unit(Float32Array.from(output.image_embeds?.data));
|
|
91
|
+
}, "embedImage"),
|
|
92
|
+
embedQuery: /* @__PURE__ */ __name(async (query) => {
|
|
93
|
+
const ids = truncated(tokenizer.encode(query.toLowerCase()).ids, model.maxTokens);
|
|
94
|
+
const shape = [1, ids.length];
|
|
95
|
+
const { ort, session } = await text();
|
|
96
|
+
const feeds = {
|
|
97
|
+
input_ids: new ort.Tensor("int64", BigInt64Array.from(ids, BigInt), shape)
|
|
98
|
+
};
|
|
99
|
+
if (session.inputNames.includes("attention_mask"))
|
|
100
|
+
feeds.attention_mask = new ort.Tensor("int64", new BigInt64Array(ids.length).fill(1n), shape);
|
|
101
|
+
const output = await session.run(feeds);
|
|
102
|
+
return unit(Float32Array.from(output.text_embeds?.data));
|
|
103
|
+
}, "embedQuery"),
|
|
104
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
105
|
+
await Promise.all(sessions.map((session) => session.release()));
|
|
106
|
+
}, "close")
|
|
107
|
+
};
|
|
108
|
+
}, "openPictureEmbedder");
|
|
109
|
+
export {
|
|
110
|
+
openPictureEmbedder
|
|
111
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
catchCrashes,
|
|
5
|
+
errorObjectOf,
|
|
6
|
+
errorRecordOf,
|
|
7
|
+
exitCodeOfAnswer,
|
|
8
|
+
exitCodeOfError,
|
|
9
|
+
mcpErrorResult,
|
|
10
|
+
renderError,
|
|
11
|
+
retryOf
|
|
12
|
+
} from "./chunk-WM7663C2.js";
|
|
13
|
+
import "./chunk-XYIT2XB3.js";
|
|
14
|
+
import "./chunk-F6MLJ3V5.js";
|
|
15
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
16
|
+
export {
|
|
17
|
+
catchCrashes,
|
|
18
|
+
errorObjectOf,
|
|
19
|
+
errorRecordOf,
|
|
20
|
+
exitCodeOfAnswer,
|
|
21
|
+
exitCodeOfError,
|
|
22
|
+
mcpErrorResult,
|
|
23
|
+
renderError,
|
|
24
|
+
retryOf
|
|
25
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
askSetupQuestions,
|
|
5
|
+
asksAtStart,
|
|
6
|
+
setupAtStart,
|
|
7
|
+
systemLanguage
|
|
8
|
+
} from "./chunk-OWJDC4CB.js";
|
|
9
|
+
import "./chunk-ESZT4WW3.js";
|
|
10
|
+
import "./chunk-GA3URWIF.js";
|
|
11
|
+
import "./chunk-24FAYAML.js";
|
|
12
|
+
import "./chunk-3D3PFXBP.js";
|
|
13
|
+
import "./chunk-WK3OSDNV.js";
|
|
14
|
+
import "./chunk-66PL7P4C.js";
|
|
15
|
+
import "./chunk-D72URWJE.js";
|
|
16
|
+
import "./chunk-HWRKURQH.js";
|
|
17
|
+
import "./chunk-RSIS7BR7.js";
|
|
18
|
+
import "./chunk-WM7663C2.js";
|
|
19
|
+
import "./chunk-XYIT2XB3.js";
|
|
20
|
+
import "./chunk-Y5E2WNWB.js";
|
|
21
|
+
import "./chunk-F6MLJ3V5.js";
|
|
22
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
23
|
+
export {
|
|
24
|
+
askSetupQuestions,
|
|
25
|
+
asksAtStart,
|
|
26
|
+
setupAtStart,
|
|
27
|
+
systemLanguage
|
|
28
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
WIRECAT_TOOLS,
|
|
5
|
+
firstScreen,
|
|
6
|
+
installHelp
|
|
7
|
+
} from "./chunk-TR7R5DL4.js";
|
|
8
|
+
import "./chunk-JKIN5TOU.js";
|
|
9
|
+
import "./chunk-EH6ZEJGT.js";
|
|
10
|
+
import "./chunk-UWIA2G6Q.js";
|
|
11
|
+
import "./chunk-7FII4DCE.js";
|
|
12
|
+
import "./chunk-XC5CKHX2.js";
|
|
13
|
+
import "./chunk-24FAYAML.js";
|
|
14
|
+
import "./chunk-UWW24JQF.js";
|
|
15
|
+
import "./chunk-NLDYZBTC.js";
|
|
16
|
+
import "./chunk-7N5QB6NL.js";
|
|
17
|
+
import "./chunk-2YR3RYT4.js";
|
|
18
|
+
import "./chunk-WK3OSDNV.js";
|
|
19
|
+
import "./chunk-WVZFXI36.js";
|
|
20
|
+
import "./chunk-ZI3YTXSF.js";
|
|
21
|
+
import "./chunk-QC3KOJT4.js";
|
|
22
|
+
import "./chunk-HWRKURQH.js";
|
|
23
|
+
import "./chunk-RSIS7BR7.js";
|
|
24
|
+
import "./chunk-WM7663C2.js";
|
|
25
|
+
import "./chunk-XYIT2XB3.js";
|
|
26
|
+
import "./chunk-Y5E2WNWB.js";
|
|
27
|
+
import "./chunk-F6MLJ3V5.js";
|
|
28
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
29
|
+
export {
|
|
30
|
+
WIRECAT_TOOLS,
|
|
31
|
+
firstScreen,
|
|
32
|
+
installHelp
|
|
33
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
appInstructions,
|
|
5
|
+
instructions
|
|
6
|
+
} from "./chunk-DIM5YWBU.js";
|
|
7
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
8
|
+
export {
|
|
9
|
+
appInstructions,
|
|
10
|
+
instructions
|
|
11
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
executableEnvironment,
|
|
5
|
+
executableOnPath
|
|
6
|
+
} from "./chunk-GA3URWIF.js";
|
|
7
|
+
import {
|
|
8
|
+
require_cross_spawn
|
|
9
|
+
} from "./chunk-D72URWJE.js";
|
|
10
|
+
import {
|
|
11
|
+
__name,
|
|
12
|
+
__toESM
|
|
13
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
14
|
+
|
|
15
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/mcp/index.js
|
|
16
|
+
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
17
|
+
var realRun = /* @__PURE__ */ __name((file, args) => {
|
|
18
|
+
const result = import_cross_spawn.default.sync(executableOnPath(file, process.env), args, {
|
|
19
|
+
encoding: "utf8",
|
|
20
|
+
timeout: 1e4,
|
|
21
|
+
maxBuffer: 256e3,
|
|
22
|
+
env: executableEnvironment(process.env)
|
|
23
|
+
});
|
|
24
|
+
return { status: result.status, error: result.error, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
25
|
+
}, "realRun");
|
|
26
|
+
var executable = /* @__PURE__ */ __name((client) => client === "codex" ? "codex" : "claude", "executable");
|
|
27
|
+
var presentIn = /* @__PURE__ */ __name((client, name, run) => {
|
|
28
|
+
const state = lookUp(client, name, run);
|
|
29
|
+
if (state === "unavailable")
|
|
30
|
+
throw new Error(`${executable(client)} is not installed or could not be started`);
|
|
31
|
+
return state === "registered";
|
|
32
|
+
}, "presentIn");
|
|
33
|
+
var setupArguments = /* @__PURE__ */ __name((client, name, entry) => {
|
|
34
|
+
const variables = Object.entries(entry.env ?? {}).flatMap(([key, value]) => ["--env", `${key}=${value}`]);
|
|
35
|
+
if (client === "codex")
|
|
36
|
+
return ["mcp", "add", name, ...variables, "--", entry.command, ...entry.args];
|
|
37
|
+
return ["mcp", "add", "--scope", "user", name, ...variables, "--", entry.command, ...entry.args];
|
|
38
|
+
}, "setupArguments");
|
|
39
|
+
var checkName = /* @__PURE__ */ __name((name) => {
|
|
40
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name))
|
|
41
|
+
throw new Error("the MCP name must be letters, digits, _ or -");
|
|
42
|
+
}, "checkName");
|
|
43
|
+
var lookUp = /* @__PURE__ */ __name((client, name, run) => {
|
|
44
|
+
const file = executable(client);
|
|
45
|
+
const existing = run(file, ["mcp", "get", name, ...client === "codex" ? ["--json"] : []]);
|
|
46
|
+
if (existing.error)
|
|
47
|
+
return "unavailable";
|
|
48
|
+
if (existing.status === 0)
|
|
49
|
+
return "registered";
|
|
50
|
+
if (!/No MCP server named/i.test(existing.stdout + existing.stderr)) {
|
|
51
|
+
throw new Error(`${file} could not check its MCP configuration`);
|
|
52
|
+
}
|
|
53
|
+
return "missing";
|
|
54
|
+
}, "lookUp");
|
|
55
|
+
var stdioEntryStatus = /* @__PURE__ */ __name((client, name, { run = realRun } = {}) => {
|
|
56
|
+
checkName(name);
|
|
57
|
+
return { client, name, state: lookUp(client, name, run) };
|
|
58
|
+
}, "stdioEntryStatus");
|
|
59
|
+
var removeArguments = /* @__PURE__ */ __name((client, name) => (
|
|
60
|
+
// Claude Code without a scope removes from whichever scope holds the name, which may be a project's own entry.
|
|
61
|
+
client === "codex" ? ["mcp", "remove", name] : ["mcp", "remove", "--scope", "user", name]
|
|
62
|
+
), "removeArguments");
|
|
63
|
+
var removeStdioEntry = /* @__PURE__ */ __name((client, name, { run = realRun } = {}) => {
|
|
64
|
+
checkName(name);
|
|
65
|
+
if (!presentIn(client, name, run))
|
|
66
|
+
return { client, name, removed: false };
|
|
67
|
+
const file = executable(client);
|
|
68
|
+
const removed = run(file, removeArguments(client, name));
|
|
69
|
+
if (removed.status !== 0 || removed.error)
|
|
70
|
+
throw new Error(`${file} could not remove ${name}`);
|
|
71
|
+
return { client, name, removed: true };
|
|
72
|
+
}, "removeStdioEntry");
|
|
73
|
+
var installStdioEntry = /* @__PURE__ */ __name((client, name, entry, { run = realRun } = {}) => {
|
|
74
|
+
checkName(name);
|
|
75
|
+
if (!entry.command || entry.args.some((arg) => arg.includes("\0")))
|
|
76
|
+
throw new Error("invalid MCP command");
|
|
77
|
+
const file = executable(client);
|
|
78
|
+
if (presentIn(client, name, run))
|
|
79
|
+
throw new Error(`${name} is already configured in ${file}; remove it there first`);
|
|
80
|
+
const args = setupArguments(client, name, entry);
|
|
81
|
+
const added = run(file, args);
|
|
82
|
+
if (added.status !== 0 || added.error)
|
|
83
|
+
throw new Error(`${file} could not add ${name}`);
|
|
84
|
+
return { client, name, command: [entry.command, ...entry.args] };
|
|
85
|
+
}, "installStdioEntry");
|
|
86
|
+
var probeStdio = /* @__PURE__ */ __name(async (entry, { timeoutMs = 1e4, start = /* @__PURE__ */ __name((file, args, env) => (0, import_cross_spawn.default)(executableOnPath(file, env), args, {
|
|
87
|
+
env: executableEnvironment(env),
|
|
88
|
+
stdio: "pipe"
|
|
89
|
+
}), "start") } = {}) => {
|
|
90
|
+
const child = start(entry.command, entry.args, { ...process.env, ...entry.env });
|
|
91
|
+
let buffer = "";
|
|
92
|
+
let timer;
|
|
93
|
+
const pending = /* @__PURE__ */ new Map();
|
|
94
|
+
const request = /* @__PURE__ */ __name((id, method, params) => new Promise((resolve, reject) => {
|
|
95
|
+
pending.set(id, { resolve, reject });
|
|
96
|
+
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}
|
|
97
|
+
`);
|
|
98
|
+
}), "request");
|
|
99
|
+
const fail = /* @__PURE__ */ __name((error) => {
|
|
100
|
+
for (const waiter of pending.values())
|
|
101
|
+
waiter.reject(error);
|
|
102
|
+
pending.clear();
|
|
103
|
+
}, "fail");
|
|
104
|
+
child.on("error", () => fail(new Error("the MCP server could not be started")));
|
|
105
|
+
child.on("exit", () => fail(new Error("the MCP server exited before answering")));
|
|
106
|
+
child.stdin.on("error", () => fail(new Error("the MCP server closed its input")));
|
|
107
|
+
child.stdout.setEncoding("utf8");
|
|
108
|
+
child.stdout.on("data", (chunk) => {
|
|
109
|
+
buffer += chunk;
|
|
110
|
+
if (buffer.length > 1e6)
|
|
111
|
+
return fail(new Error("the MCP server sent too much output"));
|
|
112
|
+
for (let newline = buffer.indexOf("\n"); newline !== -1; newline = buffer.indexOf("\n")) {
|
|
113
|
+
const line = buffer.slice(0, newline);
|
|
114
|
+
buffer = buffer.slice(newline + 1);
|
|
115
|
+
try {
|
|
116
|
+
const value = JSON.parse(line);
|
|
117
|
+
if (typeof value.id !== "number")
|
|
118
|
+
continue;
|
|
119
|
+
const waiter = pending.get(value.id);
|
|
120
|
+
if (!waiter)
|
|
121
|
+
continue;
|
|
122
|
+
pending.delete(value.id);
|
|
123
|
+
if (value.error)
|
|
124
|
+
waiter.reject(new Error("the MCP server rejected the handshake"));
|
|
125
|
+
else
|
|
126
|
+
waiter.resolve(value.result ?? {});
|
|
127
|
+
} catch {
|
|
128
|
+
fail(new Error("the MCP server sent invalid JSON"));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
try {
|
|
133
|
+
timer = setTimeout(() => fail(new Error("the MCP server did not answer in time")), timeoutMs);
|
|
134
|
+
await request(1, "initialize", {
|
|
135
|
+
protocolVersion: "2025-11-25",
|
|
136
|
+
capabilities: {},
|
|
137
|
+
clientInfo: { name: "cli-base-mcp-doctor", version: "1" }
|
|
138
|
+
});
|
|
139
|
+
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })}
|
|
140
|
+
`);
|
|
141
|
+
const result = await request(2, "tools/list", {});
|
|
142
|
+
const tools = result.tools;
|
|
143
|
+
if (!Array.isArray(tools))
|
|
144
|
+
throw new Error("the MCP server returned no tool list");
|
|
145
|
+
const named = tools.filter((item) => item !== null && typeof item === "object" && "name" in item && typeof item.name === "string");
|
|
146
|
+
if (named.length !== tools.length)
|
|
147
|
+
throw new Error("the MCP server returned an invalid tool list");
|
|
148
|
+
return {
|
|
149
|
+
tools: named.map((item) => item.name),
|
|
150
|
+
potentialWrites: named.filter((item) => item.annotations?.readOnlyHint !== true).map((item) => item.name)
|
|
151
|
+
};
|
|
152
|
+
} finally {
|
|
153
|
+
if (timer)
|
|
154
|
+
clearTimeout(timer);
|
|
155
|
+
pending.clear();
|
|
156
|
+
child.stdin.end();
|
|
157
|
+
child.kill();
|
|
158
|
+
}
|
|
159
|
+
}, "probeStdio");
|
|
160
|
+
export {
|
|
161
|
+
installStdioEntry,
|
|
162
|
+
probeStdio,
|
|
163
|
+
removeArguments,
|
|
164
|
+
removeStdioEntry,
|
|
165
|
+
setupArguments,
|
|
166
|
+
stdioEntryStatus
|
|
167
|
+
};
|