@wirecat/drive-cli 0.44.0 → 0.45.1
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/dist/bin/drive.js +35 -40
- package/dist/bundle/all-profiles-O7CNQ7FO.js +26 -0
- package/dist/bundle/anthropic-6T67J2CE.js +71 -0
- package/dist/bundle/app-server-BVBZT3UY.js +237 -0
- package/dist/bundle/bun-O6RL6LRQ.js +169 -0
- package/dist/bundle/bun-sqlite-54W7JUY3.js +70 -0
- package/dist/bundle/chunk-2DLAJGRN.js +62 -0
- package/dist/bundle/chunk-37MAA6F2.js +5624 -0
- package/dist/bundle/chunk-3HRDEJJW.js +161 -0
- package/dist/bundle/chunk-3Z7WSD2A.js +433 -0
- package/dist/bundle/chunk-44FV5JAS.js +1855 -0
- package/dist/bundle/chunk-4DW6QGEV.js +164 -0
- package/dist/bundle/chunk-4NGLRHWO.js +24 -0
- package/dist/bundle/chunk-5DPV7X27.js +663 -0
- package/dist/bundle/chunk-5FONRUG6.js +24805 -0
- package/dist/bundle/chunk-5MGIL5LW.js +846 -0
- package/dist/bundle/chunk-5TC3NCAF.js +42 -0
- package/dist/bundle/chunk-6Y2BYFXQ.js +65 -0
- package/dist/bundle/chunk-A3FU4RR6.js +150 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AIXLOMH4.js +63 -0
- package/dist/bundle/chunk-AOOD3RMK.js +384 -0
- package/dist/bundle/chunk-AUS6TKP5.js +1975 -0
- package/dist/bundle/chunk-B2J6FJNL.js +19 -0
- package/dist/bundle/chunk-BEXHAGXH.js +3542 -0
- package/dist/bundle/chunk-BHE7ZY2N.js +2352 -0
- package/dist/bundle/chunk-BJ3JRO34.js +2356 -0
- package/dist/bundle/chunk-BQUPOB5H.js +2315 -0
- package/dist/bundle/chunk-CFZWPIVC.js +1092 -0
- package/dist/bundle/chunk-CKR3DVUK.js +754 -0
- package/dist/bundle/chunk-CVIKKIGE.js +76 -0
- package/dist/bundle/chunk-D67JGWSC.js +190 -0
- package/dist/bundle/chunk-DDYR6DYL.js +78 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DL7D6Y3B.js +18102 -0
- package/dist/bundle/chunk-DORXXBFC.js +484 -0
- package/dist/bundle/chunk-DXKVEOSS.js +53 -0
- package/dist/bundle/chunk-DXQEJWI3.js +522 -0
- package/dist/bundle/chunk-FEULDMWM.js +35598 -0
- package/dist/bundle/chunk-G3FAOS52.js +630 -0
- package/dist/bundle/chunk-GHOWRW7E.js +237 -0
- package/dist/bundle/chunk-GNFHZZ55.js +264 -0
- package/dist/bundle/chunk-GNI7INK6.js +18 -0
- package/dist/bundle/chunk-GOR3Z2FR.js +17 -0
- package/dist/bundle/chunk-GQW4GRYR.js +886 -0
- package/dist/bundle/chunk-GWPKIRNQ.js +220 -0
- package/dist/bundle/chunk-GYCUY4CL.js +9 -0
- package/dist/bundle/chunk-HEPIOCHN.js +8181 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IAW5A7OR.js +1913 -0
- package/dist/bundle/chunk-IGMRWQP3.js +1071 -0
- package/dist/bundle/chunk-IKNU5A5Y.js +82 -0
- package/dist/bundle/chunk-JVTVAZ5X.js +1054 -0
- package/dist/bundle/chunk-K74PQVQZ.js +168 -0
- package/dist/bundle/chunk-K7FRUB33.js +795 -0
- package/dist/bundle/chunk-KADPV4YA.js +45 -0
- package/dist/bundle/chunk-KJMBV574.js +16225 -0
- package/dist/bundle/chunk-LHIL46I3.js +31 -0
- package/dist/bundle/chunk-LJARCTGL.js +60 -0
- package/dist/bundle/chunk-LOTQ2HMT.js +3954 -0
- package/dist/bundle/chunk-MAXN7COO.js +99 -0
- package/dist/bundle/chunk-MFS52LTZ.js +570 -0
- package/dist/bundle/chunk-MFSIOSUM.js +1714 -0
- package/dist/bundle/chunk-NB2N6L3R.js +138 -0
- package/dist/bundle/chunk-NDNTLUPS.js +58 -0
- package/dist/bundle/chunk-NLEB26GA.js +288 -0
- package/dist/bundle/chunk-NP3XLLN3.js +73 -0
- package/dist/bundle/chunk-NW7IMGRR.js +6848 -0
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/chunk-OWXTPXIQ.js +215 -0
- package/dist/bundle/chunk-PDBBBUY7.js +166 -0
- package/dist/bundle/chunk-PH74B2VZ.js +122 -0
- package/dist/bundle/chunk-PJ7IQVOM.js +421 -0
- package/dist/bundle/chunk-Q2Z3VCM4.js +2 -0
- package/dist/bundle/chunk-QTJUH3LS.js +15572 -0
- package/dist/bundle/chunk-QW36EOAM.js +106 -0
- package/dist/bundle/chunk-QWSRPXCJ.js +281 -0
- package/dist/bundle/chunk-R2A3K7ZF.js +193 -0
- package/dist/bundle/chunk-R2QRP7EJ.js +835 -0
- package/dist/bundle/chunk-RCS2SCX5.js +375 -0
- package/dist/bundle/chunk-RJ633GFA.js +25 -0
- package/dist/bundle/chunk-SBZB7HMU.js +1055 -0
- package/dist/bundle/chunk-SMHQA5J6.js +459 -0
- package/dist/bundle/chunk-SWMMR3FR.js +48 -0
- package/dist/bundle/chunk-TRMIV3OA.js +18 -0
- package/dist/bundle/chunk-VAGF723Z.js +74 -0
- package/dist/bundle/chunk-VCYFEWPD.js +18078 -0
- package/dist/bundle/chunk-VHQNVG3J.js +263 -0
- package/dist/bundle/chunk-VHT2WI4I.js +2941 -0
- package/dist/bundle/chunk-VYBOYBLX.js +100 -0
- package/dist/bundle/chunk-WUFCYDKB.js +71 -0
- package/dist/bundle/chunk-XAZQTJXR.js +3402 -0
- package/dist/bundle/chunk-XEBFFKXO.js +111 -0
- package/dist/bundle/chunk-XF5MFUEB.js +498 -0
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZBM4GEV2.js +120 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-MXCBV3GJ.js +38 -0
- package/dist/bundle/dist-MWTMOYWT.js +7577 -0
- package/dist/bundle/dist-PY3MVR3G.js +21 -0
- package/dist/bundle/drive.js +50 -0
- package/dist/bundle/echarts-LD3AI55P.js +42501 -0
- package/dist/bundle/embed-FJKIIM43.js +37 -0
- package/dist/bundle/embedder-NNQ5ZC25.js +110 -0
- package/dist/bundle/entry-ZYSNPDSD.js +15 -0
- package/dist/bundle/failure-MJJXFR63.js +37 -0
- package/dist/bundle/first-run-KA2UPZAU.js +24 -0
- package/dist/bundle/first-screen-VQ3RXDMF.js +36 -0
- package/dist/bundle/google-ZYDFTHLN.js +32 -0
- package/dist/bundle/google-api-2GT5PAW2.js +82 -0
- package/dist/bundle/identity-JQFQXQIR.js +10 -0
- package/dist/bundle/instructions-RZMSW3OC.js +11 -0
- package/dist/bundle/login-JU6NKW5P.js +158 -0
- package/dist/bundle/mcp-2PZDI7WE.js +501 -0
- package/dist/bundle/mcp-JOQMFGBC.js +95 -0
- package/dist/bundle/mcp-OQBZXELQ.js +165 -0
- package/dist/bundle/mdast-util-from-markdown-FXEPSNER.js +1958 -0
- package/dist/bundle/mdast-util-gfm-SZM5GBDF.js +2103 -0
- package/dist/bundle/micromark-extension-gfm-GRL24TU6.js +1838 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-ZRLYQL7J.js +176 -0
- package/dist/bundle/node-sqlite-TXPSRROT.js +46 -0
- package/dist/bundle/oauth-NAIBKERJ.js +18 -0
- package/dist/bundle/open-3P5EPXPV.js +20 -0
- package/dist/bundle/process-LL77573L.js +91 -0
- package/dist/bundle/program-CZ55L6EW.js +24078 -0
- package/dist/bundle/prompt-3TX2SWOY.js +13 -0
- package/dist/bundle/reasons-GF2TYGX6.js +11 -0
- package/dist/bundle/recognize-IFXOJHEA.js +191 -0
- package/dist/bundle/remote-663M42Y5.js +28 -0
- package/dist/bundle/rerank-OT2F2DBV.js +51 -0
- package/dist/bundle/serve-PDNNI6O6.js +20 -0
- package/dist/bundle/server-BFOEPMR7.js +56 -0
- package/dist/bundle/server-K566PJ7H.js +69 -0
- package/dist/bundle/services-5MCTECBU.js +333 -0
- package/dist/bundle/sqlite-runtime-BF3KDM7W.js +17 -0
- package/dist/bundle/state-SZX65E74.js +34 -0
- package/dist/bundle/store-TCWNLA3V.js +125 -0
- package/dist/bundle/store-UKPGGAPW.js +142 -0
- package/dist/bundle/store-maintenance-command-QHLUVBTJ.js +57 -0
- package/dist/bundle/terminal-TFCTWLOS.js +11 -0
- package/dist/bundle/tokens-DFCFRF7I.js +103 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +82 -36
- package/dist/commands/mcp.js.map +1 -1
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +59 -53
- package/dist/contract-overrides.js.map +1 -1
- package/dist/mcp.d.ts +6 -5
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +13 -10
- package/dist/mcp.js.map +1 -1
- package/dist/program.js +4 -4
- package/dist/program.js.map +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +3 -3
- package/dist/registry.js.map +1 -1
- package/dist/state.d.ts +13 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +12 -2
- package/dist/state.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -5
- package/skills/drive-cli/SKILL.md +1 -0
package/dist/bin/drive.js
CHANGED
|
@@ -1,41 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
processStreams.diagnostic(renderError(object, { cli: DRIVE_APP.command, interactive: interactiveOf(entry.args, entry.tty) }));
|
|
38
|
-
return exitCodeOfError(object);
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=drive.js.map
|
|
2
|
+
// cli-dev bundle loader
|
|
3
|
+
import * as module from "node:module"
|
|
4
|
+
|
|
5
|
+
const words = process.argv.slice(2)
|
|
6
|
+
// As the CLI answers it, unless a test records the argv: then the CLI writes the record too.
|
|
7
|
+
if (
|
|
8
|
+
words.length === 1 &&
|
|
9
|
+
(words[0] === "--version" || words[0] === "-V") &&
|
|
10
|
+
!Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
|
|
11
|
+
) {
|
|
12
|
+
process.stdout.write("0.45.1\n")
|
|
13
|
+
} else {
|
|
14
|
+
// Before the bundle compiles: the bundle's own call comes after its chunks.
|
|
15
|
+
module.enableCompileCache()
|
|
16
|
+
const serves = ((words) => {
|
|
17
|
+
const plain = words.filter((word) => !word.startsWith("-"));
|
|
18
|
+
return plain
|
|
19
|
+
.slice(0, 4)
|
|
20
|
+
.some((word, at) => word === "serve" || word === "watch" || (word === "mcp" && plain[at + 1] === undefined));
|
|
21
|
+
})(words)
|
|
22
|
+
if (serves && module.registerHooks) {
|
|
23
|
+
const bundle = new URL("../bundle/", import.meta.url).href
|
|
24
|
+
module.registerHooks({
|
|
25
|
+
resolve: (specifier, context, next) =>
|
|
26
|
+
specifier.startsWith("./") && context.parentURL?.startsWith(bundle)
|
|
27
|
+
? { url: new URL(specifier, context.parentURL).href, format: "module", shortCircuit: true }
|
|
28
|
+
: next(specifier, context),
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
const running = import("../bundle/drive.js")
|
|
32
|
+
const chunks = ["../bundle/all-profiles-O7CNQ7FO.js","../bundle/anthropic-6T67J2CE.js","../bundle/app-server-BVBZT3UY.js","../bundle/bun-O6RL6LRQ.js","../bundle/bun-sqlite-54W7JUY3.js","../bundle/command-contract-MXCBV3GJ.js","../bundle/dist-MWTMOYWT.js","../bundle/dist-PY3MVR3G.js","../bundle/echarts-LD3AI55P.js","../bundle/embed-FJKIIM43.js","../bundle/embedder-NNQ5ZC25.js","../bundle/entry-ZYSNPDSD.js","../bundle/failure-MJJXFR63.js","../bundle/first-run-KA2UPZAU.js","../bundle/first-screen-VQ3RXDMF.js","../bundle/google-ZYDFTHLN.js","../bundle/google-api-2GT5PAW2.js","../bundle/identity-JQFQXQIR.js","../bundle/instructions-RZMSW3OC.js","../bundle/login-JU6NKW5P.js","../bundle/mcp-2PZDI7WE.js","../bundle/mcp-JOQMFGBC.js","../bundle/mcp-OQBZXELQ.js","../bundle/mdast-util-from-markdown-FXEPSNER.js","../bundle/mdast-util-gfm-SZM5GBDF.js","../bundle/micromark-extension-gfm-GRL24TU6.js","../bundle/node-P4E63KXA.js","../bundle/node-TLZSIHIJ.js","../bundle/node-ZRLYQL7J.js","../bundle/node-sqlite-TXPSRROT.js","../bundle/oauth-NAIBKERJ.js","../bundle/open-3P5EPXPV.js","../bundle/process-LL77573L.js","../bundle/program-CZ55L6EW.js","../bundle/prompt-3TX2SWOY.js","../bundle/reasons-GF2TYGX6.js","../bundle/recognize-IFXOJHEA.js","../bundle/remote-663M42Y5.js","../bundle/rerank-OT2F2DBV.js","../bundle/serve-PDNNI6O6.js","../bundle/server-BFOEPMR7.js","../bundle/server-K566PJ7H.js","../bundle/services-5MCTECBU.js","../bundle/sqlite-runtime-BF3KDM7W.js","../bundle/state-SZX65E74.js","../bundle/store-TCWNLA3V.js","../bundle/store-UKPGGAPW.js","../bundle/store-maintenance-command-QHLUVBTJ.js","../bundle/terminal-TFCTWLOS.js","../bundle/tokens-DFCFRF7I.js"]
|
|
33
|
+
// After the server answers its first request, so it starts no later.
|
|
34
|
+
if (serves) setTimeout(() => void Promise.allSettled(chunks.map((chunk) => import(chunk))), 2000).unref()
|
|
35
|
+
await running
|
|
36
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CHILD_IDLE_MS,
|
|
5
|
+
allProfilesServer,
|
|
6
|
+
serveAllProfilesOverHttp,
|
|
7
|
+
serveAllProfilesOverStdio,
|
|
8
|
+
withProfile
|
|
9
|
+
} from "./chunk-QWSRPXCJ.js";
|
|
10
|
+
import "./chunk-CVIKKIGE.js";
|
|
11
|
+
import "./chunk-G3FAOS52.js";
|
|
12
|
+
import "./chunk-5FONRUG6.js";
|
|
13
|
+
import "./chunk-3Z7WSD2A.js";
|
|
14
|
+
import "./chunk-GOR3Z2FR.js";
|
|
15
|
+
import "./chunk-O5EHUB2V.js";
|
|
16
|
+
import "./chunk-VHT2WI4I.js";
|
|
17
|
+
import "./chunk-BJ3JRO34.js";
|
|
18
|
+
import "./chunk-Y5E2WNWB.js";
|
|
19
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
20
|
+
export {
|
|
21
|
+
CHILD_IDLE_MS,
|
|
22
|
+
allProfilesServer,
|
|
23
|
+
serveAllProfilesOverHttp,
|
|
24
|
+
serveAllProfilesOverStdio,
|
|
25
|
+
withProfile
|
|
26
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
checkedOptions
|
|
5
|
+
} from "./chunk-LHIL46I3.js";
|
|
6
|
+
import {
|
|
7
|
+
messagesFor,
|
|
8
|
+
systemFor
|
|
9
|
+
} from "./chunk-KADPV4YA.js";
|
|
10
|
+
import {
|
|
11
|
+
Anthropic
|
|
12
|
+
} from "./chunk-ADLS6FVG.js";
|
|
13
|
+
import "./chunk-VHT2WI4I.js";
|
|
14
|
+
import {
|
|
15
|
+
array,
|
|
16
|
+
optional,
|
|
17
|
+
strictObject,
|
|
18
|
+
string
|
|
19
|
+
} from "./chunk-BJ3JRO34.js";
|
|
20
|
+
import "./chunk-Y5E2WNWB.js";
|
|
21
|
+
import {
|
|
22
|
+
__name
|
|
23
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
24
|
+
|
|
25
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/models/anthropic.js
|
|
26
|
+
var options = strictObject({
|
|
27
|
+
stop_sequences: optional(array(string()))
|
|
28
|
+
});
|
|
29
|
+
var anthropic = {
|
|
30
|
+
images: true,
|
|
31
|
+
baseUrl: "https://api.anthropic.com",
|
|
32
|
+
validate: /* @__PURE__ */ __name((given) => checkedOptions("anthropic", options, given), "validate"),
|
|
33
|
+
complete: /* @__PURE__ */ __name(async (target, request, checked, apiKey, fetcher) => {
|
|
34
|
+
const client = new Anthropic({
|
|
35
|
+
apiKey: apiKey ?? "",
|
|
36
|
+
authToken: null,
|
|
37
|
+
fetch: /* @__PURE__ */ __name((input, init) => fetcher(input, { ...init, redirect: "error" }), "fetch"),
|
|
38
|
+
baseURL: target.baseUrl,
|
|
39
|
+
maxRetries: 0,
|
|
40
|
+
logLevel: "off",
|
|
41
|
+
timeout: 12e4
|
|
42
|
+
});
|
|
43
|
+
const response = await client.messages.stream({
|
|
44
|
+
...checked,
|
|
45
|
+
model: target.model,
|
|
46
|
+
system: systemFor(request),
|
|
47
|
+
messages: [
|
|
48
|
+
...messagesFor(request),
|
|
49
|
+
...request.images === void 0 ? [] : [
|
|
50
|
+
{
|
|
51
|
+
role: "user",
|
|
52
|
+
content: request.images.map((image) => ({
|
|
53
|
+
type: "image",
|
|
54
|
+
source: { type: "base64", media_type: image.mimeType, data: image.data }
|
|
55
|
+
}))
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
],
|
|
59
|
+
max_tokens: request.maxTokens
|
|
60
|
+
}).finalMessage();
|
|
61
|
+
if (response.stop_reason !== "end_turn")
|
|
62
|
+
throw new Error("incomplete response");
|
|
63
|
+
return {
|
|
64
|
+
text: response.content.filter((block) => block.type === "text").map((block) => block.text).join(""),
|
|
65
|
+
tokens: response.usage.input_tokens + response.usage.output_tokens + (response.usage.cache_creation_input_tokens ?? 0) + (response.usage.cache_read_input_tokens ?? 0)
|
|
66
|
+
};
|
|
67
|
+
}, "complete")
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
anthropic
|
|
71
|
+
};
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
PER_RUN,
|
|
5
|
+
envelope
|
|
6
|
+
} from "./chunk-K7FRUB33.js";
|
|
7
|
+
import "./chunk-IGMRWQP3.js";
|
|
8
|
+
import {
|
|
9
|
+
mcpUrlOf
|
|
10
|
+
} from "./chunk-SWMMR3FR.js";
|
|
11
|
+
import {
|
|
12
|
+
answeredWire
|
|
13
|
+
} from "./chunk-CVIKKIGE.js";
|
|
14
|
+
import {
|
|
15
|
+
answered,
|
|
16
|
+
failed,
|
|
17
|
+
registerCommands,
|
|
18
|
+
runCommandForAgent,
|
|
19
|
+
toolsFromCommands
|
|
20
|
+
} from "./chunk-XAZQTJXR.js";
|
|
21
|
+
import {
|
|
22
|
+
agentJson,
|
|
23
|
+
skillResource
|
|
24
|
+
} from "./chunk-XF5MFUEB.js";
|
|
25
|
+
import {
|
|
26
|
+
StdioServerTransport,
|
|
27
|
+
serveStdio
|
|
28
|
+
} from "./chunk-G3FAOS52.js";
|
|
29
|
+
import "./chunk-GHOWRW7E.js";
|
|
30
|
+
import {
|
|
31
|
+
appInstructions
|
|
32
|
+
} from "./chunk-DXKVEOSS.js";
|
|
33
|
+
import {
|
|
34
|
+
McpServer
|
|
35
|
+
} from "./chunk-5FONRUG6.js";
|
|
36
|
+
import {
|
|
37
|
+
mcpHttpMarker
|
|
38
|
+
} from "./chunk-3HRDEJJW.js";
|
|
39
|
+
import "./chunk-IAW5A7OR.js";
|
|
40
|
+
import "./chunk-JVTVAZ5X.js";
|
|
41
|
+
import "./chunk-NP3XLLN3.js";
|
|
42
|
+
import "./chunk-DL7D6Y3B.js";
|
|
43
|
+
import "./chunk-VCYFEWPD.js";
|
|
44
|
+
import "./chunk-DORXXBFC.js";
|
|
45
|
+
import "./chunk-5MGIL5LW.js";
|
|
46
|
+
import "./chunk-K74PQVQZ.js";
|
|
47
|
+
import "./chunk-BEXHAGXH.js";
|
|
48
|
+
import {
|
|
49
|
+
DEFAULT_OUTPUT_BYTES,
|
|
50
|
+
changesAuthorityAt,
|
|
51
|
+
environmentOf,
|
|
52
|
+
fetchesOnlyAt,
|
|
53
|
+
judgedTargets,
|
|
54
|
+
rootOf2 as rootOf
|
|
55
|
+
} from "./chunk-AUS6TKP5.js";
|
|
56
|
+
import "./chunk-3Z7WSD2A.js";
|
|
57
|
+
import {
|
|
58
|
+
describeProgram
|
|
59
|
+
} from "./chunk-LOTQ2HMT.js";
|
|
60
|
+
import "./chunk-AIXLOMH4.js";
|
|
61
|
+
import "./chunk-CFZWPIVC.js";
|
|
62
|
+
import "./chunk-GOR3Z2FR.js";
|
|
63
|
+
import "./chunk-PJ7IQVOM.js";
|
|
64
|
+
import "./chunk-ZBM4GEV2.js";
|
|
65
|
+
import "./chunk-A3FU4RR6.js";
|
|
66
|
+
import "./chunk-MFS52LTZ.js";
|
|
67
|
+
import "./chunk-LJARCTGL.js";
|
|
68
|
+
import {
|
|
69
|
+
readOnlyLockOf
|
|
70
|
+
} from "./chunk-RJ633GFA.js";
|
|
71
|
+
import "./chunk-WUFCYDKB.js";
|
|
72
|
+
import "./chunk-KADPV4YA.js";
|
|
73
|
+
import "./chunk-PH74B2VZ.js";
|
|
74
|
+
import "./chunk-RCS2SCX5.js";
|
|
75
|
+
import "./chunk-5DPV7X27.js";
|
|
76
|
+
import "./chunk-GNFHZZ55.js";
|
|
77
|
+
import "./chunk-FEULDMWM.js";
|
|
78
|
+
import "./chunk-5TC3NCAF.js";
|
|
79
|
+
import "./chunk-AOOD3RMK.js";
|
|
80
|
+
import "./chunk-NB2N6L3R.js";
|
|
81
|
+
import "./chunk-BHE7ZY2N.js";
|
|
82
|
+
import "./chunk-R2QRP7EJ.js";
|
|
83
|
+
import "./chunk-O5EHUB2V.js";
|
|
84
|
+
import "./chunk-BQUPOB5H.js";
|
|
85
|
+
import "./chunk-GQW4GRYR.js";
|
|
86
|
+
import "./chunk-TRMIV3OA.js";
|
|
87
|
+
import "./chunk-VYBOYBLX.js";
|
|
88
|
+
import {
|
|
89
|
+
mcpErrorResult
|
|
90
|
+
} from "./chunk-VHT2WI4I.js";
|
|
91
|
+
import {
|
|
92
|
+
CliError
|
|
93
|
+
} from "./chunk-BJ3JRO34.js";
|
|
94
|
+
import "./chunk-Y5E2WNWB.js";
|
|
95
|
+
import "./chunk-NW7IMGRR.js";
|
|
96
|
+
import {
|
|
97
|
+
__name
|
|
98
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
99
|
+
|
|
100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/mcp/app-server.js
|
|
101
|
+
var EXCLUDED = [["mcp"]];
|
|
102
|
+
var createAppServer = /* @__PURE__ */ __name((command, context, options) => {
|
|
103
|
+
const { app } = options;
|
|
104
|
+
const root = rootOf(command);
|
|
105
|
+
const environment = environmentOf(command);
|
|
106
|
+
if (!environment.runCommand)
|
|
107
|
+
throw new Error("the MCP server runs inside run(), which hands it the program");
|
|
108
|
+
const program = { run: environment.runCommand, commands: describeProgram(root) };
|
|
109
|
+
const flags = command.optsWithGlobals();
|
|
110
|
+
const overrides = flags.permission ?? [];
|
|
111
|
+
const { settings } = context;
|
|
112
|
+
const levels = /* @__PURE__ */ __name(() => options.resolveSettings(flags, { env: context.env }).permissions, "levels");
|
|
113
|
+
const readOnly = /* @__PURE__ */ __name(() => readOnlyLockOf(app, context.env) !== void 0, "readOnly");
|
|
114
|
+
const authority = changesAuthorityAt(root);
|
|
115
|
+
const targets = judgedTargets(root);
|
|
116
|
+
const passed = Object.fromEntries(Object.entries(environment).filter(([key]) => !PER_RUN.has(key)));
|
|
117
|
+
const tools = toolsFromCommands(program.commands, {
|
|
118
|
+
includeUnavailable: true,
|
|
119
|
+
exclude: EXCLUDED,
|
|
120
|
+
levels: settings.permissions,
|
|
121
|
+
currentLevels: levels,
|
|
122
|
+
readOnly: readOnly(),
|
|
123
|
+
authority,
|
|
124
|
+
fetchOnly: fetchesOnlyAt(root),
|
|
125
|
+
permissions: options.permissions
|
|
126
|
+
});
|
|
127
|
+
const availability = /* @__PURE__ */ __name((one) => () => {
|
|
128
|
+
const permitted = one.availability?.() ?? { available: true };
|
|
129
|
+
if (!permitted.available)
|
|
130
|
+
return permitted;
|
|
131
|
+
return options.availability?.(one.path, settings.profile) ?? permitted;
|
|
132
|
+
}, "availability");
|
|
133
|
+
const commands = Object.fromEntries(tools.map((one) => [
|
|
134
|
+
one.command,
|
|
135
|
+
{
|
|
136
|
+
title: one.title,
|
|
137
|
+
description: one.description,
|
|
138
|
+
writes: one.writes,
|
|
139
|
+
availability: availability(one),
|
|
140
|
+
input: one.input,
|
|
141
|
+
run: /* @__PURE__ */ __name(async (input, ctx) => {
|
|
142
|
+
const own = options.availability?.(one.path, settings.profile);
|
|
143
|
+
if (own && !own.available)
|
|
144
|
+
return failed(new CliError("permission_error", `${one.command}: ${own.reason ?? "unavailable for this profile"}`, {
|
|
145
|
+
...own.permission ? { permission: own.permission } : {}
|
|
146
|
+
}), app.errors);
|
|
147
|
+
const traceparent = ctx?.mcpReq?._meta?.traceparent;
|
|
148
|
+
const env = typeof traceparent === "string" ? { ...context.env, TRACEPARENT: traceparent } : context.env;
|
|
149
|
+
const answer = await runCommandForAgent(program, one.path, input, {
|
|
150
|
+
profile: settings.profile,
|
|
151
|
+
readOnly: readOnly(),
|
|
152
|
+
env,
|
|
153
|
+
levels,
|
|
154
|
+
overrides,
|
|
155
|
+
authority,
|
|
156
|
+
permissions: options.permissions,
|
|
157
|
+
environment: passed
|
|
158
|
+
});
|
|
159
|
+
if ("error" in answer)
|
|
160
|
+
return mcpErrorResult(JSON.parse(agentJson(answer.error)));
|
|
161
|
+
try {
|
|
162
|
+
return answered(envelope(one.command, answer.result), DEFAULT_OUTPUT_BYTES, targets);
|
|
163
|
+
} catch (error) {
|
|
164
|
+
return failed(error, app.errors);
|
|
165
|
+
}
|
|
166
|
+
}, "run")
|
|
167
|
+
}
|
|
168
|
+
]));
|
|
169
|
+
const skill = options.skill ? skillResource(app, options.skill) : void 0;
|
|
170
|
+
const build = /* @__PURE__ */ __name(() => {
|
|
171
|
+
const server = new McpServer({ name: app.command, version: app.version }, {
|
|
172
|
+
instructions: appInstructions({
|
|
173
|
+
command: app.command,
|
|
174
|
+
name: options.name,
|
|
175
|
+
profile: settings.profile,
|
|
176
|
+
untrusted: options.untrusted,
|
|
177
|
+
...skill ? { skill: skill.instruction } : {}
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
registerCommands(server, app.command, commands, app.errors, void 0, app.messenger);
|
|
181
|
+
if (skill) {
|
|
182
|
+
const { uri, name, title, description, mimeType, read } = skill;
|
|
183
|
+
server.registerResource(name, uri, { title, description, mimeType }, read);
|
|
184
|
+
}
|
|
185
|
+
return server;
|
|
186
|
+
}, "build");
|
|
187
|
+
return { build, offered: Object.keys(commands) };
|
|
188
|
+
}, "createAppServer");
|
|
189
|
+
var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options) => {
|
|
190
|
+
const { build } = createAppServer(command, context, options);
|
|
191
|
+
const { stdin, stdout, signal } = environmentOf(command);
|
|
192
|
+
const own = stdin && stdout && stdin !== process.stdin;
|
|
193
|
+
const wire = answeredWire(own ? stdin : process.stdin, own ? stdout : process.stdout);
|
|
194
|
+
const handle = serveStdio(build, {
|
|
195
|
+
transport: new StdioServerTransport(wire.input, wire.output),
|
|
196
|
+
onerror: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onerror")
|
|
197
|
+
});
|
|
198
|
+
const ended = await new Promise((resolve) => {
|
|
199
|
+
wire.ended.then(() => resolve("input"));
|
|
200
|
+
if (own)
|
|
201
|
+
signal?.addEventListener("abort", () => resolve("stopped"), { once: true });
|
|
202
|
+
else {
|
|
203
|
+
process.once("SIGINT", () => resolve("stopped"));
|
|
204
|
+
process.once("SIGTERM", () => resolve("stopped"));
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
if (ended === "input")
|
|
208
|
+
await wire.answered();
|
|
209
|
+
wire.release();
|
|
210
|
+
await handle.close();
|
|
211
|
+
}, "serveAppOverStdio");
|
|
212
|
+
var serveAppOverHttp = /* @__PURE__ */ __name(async (command, context, options, http) => {
|
|
213
|
+
const { app } = options;
|
|
214
|
+
const { build } = createAppServer(command, context, options);
|
|
215
|
+
const { serveOverHttp } = await import("./serve-PDNNI6O6.js");
|
|
216
|
+
const listening = await serveOverHttp(build, {
|
|
217
|
+
...http,
|
|
218
|
+
appName: app.command,
|
|
219
|
+
onCode: /* @__PURE__ */ __name((code, expires) => context.renderer.note(context.env[mcpHttpMarker(app.envPrefix)] === void 0 ? `login code for a new browser app: ${code} (until ${expires.toTimeString().slice(0, 5)}; a new one after each login)` : `a new login code for a browser app: \`${app.command} ${context.settings.profile} mcp server status\``), "onCode"),
|
|
220
|
+
onError: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onError")
|
|
221
|
+
}).catch((error) => {
|
|
222
|
+
if (error.code === "EADDRINUSE")
|
|
223
|
+
throw new CliError("configuration_error", `port ${http.port} is in use \u2014 pass another with --port`);
|
|
224
|
+
throw error;
|
|
225
|
+
});
|
|
226
|
+
context.renderer.note(`serving on ${listening.url.href} \u2014 point your tunnel at it; connectors use ${mcpUrlOf(http.publicUrl).href}`);
|
|
227
|
+
await new Promise((resolve) => {
|
|
228
|
+
process.once("SIGINT", resolve);
|
|
229
|
+
process.once("SIGTERM", resolve);
|
|
230
|
+
});
|
|
231
|
+
await listening.close();
|
|
232
|
+
}, "serveAppOverHttp");
|
|
233
|
+
export {
|
|
234
|
+
createAppServer,
|
|
235
|
+
serveAppOverHttp,
|
|
236
|
+
serveAppOverStdio
|
|
237
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DefaultLogger,
|
|
5
|
+
DrizzleQueryError,
|
|
6
|
+
NoopLogger,
|
|
7
|
+
SQLiteAsyncDatabase,
|
|
8
|
+
SQLiteAsyncPreparedQuery,
|
|
9
|
+
SQLiteAsyncSession,
|
|
10
|
+
SQLiteAsyncTransaction,
|
|
11
|
+
SQLiteDialect,
|
|
12
|
+
booleanFromInteger,
|
|
13
|
+
bufferFromBytes,
|
|
14
|
+
castToText,
|
|
15
|
+
dateFromStoredMilliseconds,
|
|
16
|
+
dateFromStoredSeconds,
|
|
17
|
+
entityKind,
|
|
18
|
+
jitCompatCheck,
|
|
19
|
+
refineSqliteCodecs,
|
|
20
|
+
sql
|
|
21
|
+
} from "./chunk-NW7IMGRR.js";
|
|
22
|
+
import {
|
|
23
|
+
__name
|
|
24
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
25
|
+
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
|
|
27
|
+
import { Database } from "bun:sqlite";
|
|
28
|
+
var bunSQLiteCodecs = refineSqliteCodecs({
|
|
29
|
+
"integer:boolean": { normalize: booleanFromInteger },
|
|
30
|
+
"integer:timestamp": { normalize: dateFromStoredSeconds },
|
|
31
|
+
"integer:timestamp_ms": { normalize: dateFromStoredMilliseconds },
|
|
32
|
+
"text:json": { normalize: JSON.parse },
|
|
33
|
+
blob: { normalize: bufferFromBytes },
|
|
34
|
+
"blob:json": {
|
|
35
|
+
cast: castToText,
|
|
36
|
+
normalize: JSON.parse
|
|
37
|
+
},
|
|
38
|
+
"blob:bigint": {
|
|
39
|
+
cast: castToText,
|
|
40
|
+
normalize: BigInt
|
|
41
|
+
},
|
|
42
|
+
numeric: {
|
|
43
|
+
cast: castToText,
|
|
44
|
+
normalize: String
|
|
45
|
+
},
|
|
46
|
+
"numeric:number": { normalize: Number },
|
|
47
|
+
"numeric:bigint": {
|
|
48
|
+
cast: castToText,
|
|
49
|
+
normalize: BigInt
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var SQLiteBunSession = class extends SQLiteAsyncSession {
|
|
53
|
+
static {
|
|
54
|
+
__name(this, "SQLiteBunSession");
|
|
55
|
+
}
|
|
56
|
+
client;
|
|
57
|
+
relations;
|
|
58
|
+
options;
|
|
59
|
+
static [entityKind] = "SQLiteBunSession";
|
|
60
|
+
logger;
|
|
61
|
+
constructor(client, dialect, relations, options = {}) {
|
|
62
|
+
super(dialect, "sync");
|
|
63
|
+
this.client = client;
|
|
64
|
+
this.relations = relations;
|
|
65
|
+
this.options = options;
|
|
66
|
+
this.logger = options.logger ?? new NoopLogger();
|
|
67
|
+
}
|
|
68
|
+
exec(query) {
|
|
69
|
+
this.client.exec(query);
|
|
70
|
+
}
|
|
71
|
+
prepareQuery(query, mode, _prepare, executeMethod, mapper, queryMetadata) {
|
|
72
|
+
let stmt;
|
|
73
|
+
try {
|
|
74
|
+
stmt = this.client.query(query.sql);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
throw new DrizzleQueryError(query.sql, this.options.paramsInErrors ? query.params : void 0, e);
|
|
77
|
+
}
|
|
78
|
+
return new SQLiteAsyncPreparedQuery("sync", executeMethod, {
|
|
79
|
+
all: /* @__PURE__ */ __name((params) => {
|
|
80
|
+
if (mode === "arrays") return stmt.values(...params);
|
|
81
|
+
return stmt.all(...params);
|
|
82
|
+
}, "all"),
|
|
83
|
+
get: /* @__PURE__ */ __name((params) => {
|
|
84
|
+
if (mode === "arrays") return stmt.values(...params)[0];
|
|
85
|
+
return stmt.get(...params);
|
|
86
|
+
}, "get"),
|
|
87
|
+
run: /* @__PURE__ */ __name((params) => {
|
|
88
|
+
return stmt.run(...params);
|
|
89
|
+
}, "run")
|
|
90
|
+
}, query, mapper, mode, this.logger, void 0, queryMetadata, void 0, this.options.paramsInErrors);
|
|
91
|
+
}
|
|
92
|
+
transaction(transaction, config = {}) {
|
|
93
|
+
const tx = new SQLiteBunTransaction("sync", this.dialect, this, this.relations);
|
|
94
|
+
let result;
|
|
95
|
+
const nativeTx = this.client.transaction(() => {
|
|
96
|
+
result = transaction(tx);
|
|
97
|
+
});
|
|
98
|
+
if (config.behavior === "concurrent") throw new Error("Concurrent transactions are not supported by driver");
|
|
99
|
+
nativeTx[config.behavior ?? "deferred"]();
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var SQLiteBunTransaction = class SQLiteBunTransaction2 extends SQLiteAsyncTransaction {
|
|
104
|
+
static {
|
|
105
|
+
__name(this, "SQLiteBunTransaction2");
|
|
106
|
+
}
|
|
107
|
+
static [entityKind] = "SQLiteBunTransaction";
|
|
108
|
+
transaction(transaction) {
|
|
109
|
+
const savepointName = `sp${this.nestedIndex}`;
|
|
110
|
+
const tx = new SQLiteBunTransaction2("sync", this.dialect, this.session, this._.relations, this.nestedIndex + 1);
|
|
111
|
+
this.session.run(sql.raw(`savepoint ${savepointName}`));
|
|
112
|
+
try {
|
|
113
|
+
const result = transaction(tx);
|
|
114
|
+
this.session.run(sql.raw(`release savepoint ${savepointName}`));
|
|
115
|
+
return result;
|
|
116
|
+
} catch (err) {
|
|
117
|
+
try {
|
|
118
|
+
this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
|
|
119
|
+
} catch {
|
|
120
|
+
}
|
|
121
|
+
throw err;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var SQLiteBunDatabase = class extends SQLiteAsyncDatabase {
|
|
126
|
+
static {
|
|
127
|
+
__name(this, "SQLiteBunDatabase");
|
|
128
|
+
}
|
|
129
|
+
static [entityKind] = "SQLiteBunDatabase";
|
|
130
|
+
};
|
|
131
|
+
function construct(client, config = {}) {
|
|
132
|
+
const dialect = new SQLiteDialect({
|
|
133
|
+
codecs: config.codecs ?? bunSQLiteCodecs,
|
|
134
|
+
useJitMappers: jitCompatCheck(config.jit)
|
|
135
|
+
});
|
|
136
|
+
let logger;
|
|
137
|
+
if (config.logger === true) logger = new DefaultLogger();
|
|
138
|
+
else if (config.logger !== false) logger = config.logger;
|
|
139
|
+
const relations = config.relations ?? {};
|
|
140
|
+
const db = new SQLiteBunDatabase("sync", dialect, new SQLiteBunSession(client, dialect, relations, {
|
|
141
|
+
logger,
|
|
142
|
+
paramsInErrors: config.paramsInErrors
|
|
143
|
+
}), relations);
|
|
144
|
+
db.$client = client;
|
|
145
|
+
return db;
|
|
146
|
+
}
|
|
147
|
+
__name(construct, "construct");
|
|
148
|
+
function drizzle(...params) {
|
|
149
|
+
if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new Database() : new Database(params[0]), params[1]);
|
|
150
|
+
const { connection, client, ...DrizzleSQLiteConfig } = params[0];
|
|
151
|
+
if (client) return construct(client, DrizzleSQLiteConfig);
|
|
152
|
+
if (typeof connection === "object") {
|
|
153
|
+
const { source, ...opts } = connection;
|
|
154
|
+
const options = Object.values(opts).filter((v) => v !== void 0).length ? opts : void 0;
|
|
155
|
+
return construct(new Database(source, options), DrizzleSQLiteConfig);
|
|
156
|
+
}
|
|
157
|
+
return construct(new Database(connection), DrizzleSQLiteConfig);
|
|
158
|
+
}
|
|
159
|
+
__name(drizzle, "drizzle");
|
|
160
|
+
(function(_drizzle) {
|
|
161
|
+
function mock(config) {
|
|
162
|
+
return construct({}, config);
|
|
163
|
+
}
|
|
164
|
+
__name(mock, "mock");
|
|
165
|
+
_drizzle.mock = mock;
|
|
166
|
+
})(drizzle || (drizzle = {}));
|
|
167
|
+
export {
|
|
168
|
+
drizzle
|
|
169
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
loadVectorExtension,
|
|
5
|
+
vectorExtension
|
|
6
|
+
} from "./chunk-NDNTLUPS.js";
|
|
7
|
+
import "./chunk-VHT2WI4I.js";
|
|
8
|
+
import "./chunk-BJ3JRO34.js";
|
|
9
|
+
import {
|
|
10
|
+
importFrom
|
|
11
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
15
|
+
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
|
|
17
|
+
var customised = false;
|
|
18
|
+
var ownLibrary = /* @__PURE__ */ __name(async () => {
|
|
19
|
+
try {
|
|
20
|
+
const { libraryFor } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
|
|
21
|
+
return libraryFor();
|
|
22
|
+
} catch {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
}, "ownLibrary");
|
|
26
|
+
var bunDatabase = /* @__PURE__ */ __name(async () => {
|
|
27
|
+
const specifier = "bun:sqlite";
|
|
28
|
+
const { Database } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, specifier);
|
|
29
|
+
if (process.platform === "darwin" && !customised) {
|
|
30
|
+
customised = true;
|
|
31
|
+
const library = await ownLibrary();
|
|
32
|
+
if (library)
|
|
33
|
+
Database.setCustomSQLite(library);
|
|
34
|
+
}
|
|
35
|
+
return Database;
|
|
36
|
+
}, "bunDatabase");
|
|
37
|
+
var openWithBunSqlite = /* @__PURE__ */ __name(async (path) => cacheOverBunSqlite(await bunClient(path)), "openWithBunSqlite");
|
|
38
|
+
var bunClient = /* @__PURE__ */ __name(async (path, options) => {
|
|
39
|
+
const Database = await bunDatabase();
|
|
40
|
+
const extension = await vectorExtension();
|
|
41
|
+
const client = options ? new Database(path, options) : new Database(path);
|
|
42
|
+
try {
|
|
43
|
+
loadVectorExtension(client, extension);
|
|
44
|
+
return client;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
client.close();
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}, "bunClient");
|
|
50
|
+
var cacheOverBunSqlite = /* @__PURE__ */ __name((database) => {
|
|
51
|
+
return {
|
|
52
|
+
exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
|
|
53
|
+
prepare: /* @__PURE__ */ __name((sql) => {
|
|
54
|
+
const statement = database.query(sql);
|
|
55
|
+
return {
|
|
56
|
+
run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
|
|
57
|
+
// Bun answers null for no row; the seam promises undefined, and `!== undefined` checks rely on it.
|
|
58
|
+
get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters) ?? void 0, "get"),
|
|
59
|
+
all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
|
|
60
|
+
};
|
|
61
|
+
}, "prepare"),
|
|
62
|
+
close: /* @__PURE__ */ __name(() => database.close(), "close")
|
|
63
|
+
};
|
|
64
|
+
}, "cacheOverBunSqlite");
|
|
65
|
+
export {
|
|
66
|
+
bunClient,
|
|
67
|
+
bunDatabase,
|
|
68
|
+
cacheOverBunSqlite,
|
|
69
|
+
openWithBunSqlite
|
|
70
|
+
};
|