@wirecat/drive-cli 0.43.0 → 0.45.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/README.md +1 -1
- package/dist/bin/drive.js +35 -40
- package/dist/bundle/all-profiles-LTHNCWQW.js +26 -0
- package/dist/bundle/anthropic-NOJEF3V2.js +71 -0
- package/dist/bundle/bun-ADJVI4HY.js +169 -0
- package/dist/bundle/bun-sqlite-GNXLBF2A.js +70 -0
- package/dist/bundle/chunk-2FTZBZOB.js +2315 -0
- package/dist/bundle/chunk-2YU3CXFD.js +3391 -0
- package/dist/bundle/chunk-35GRI4DI.js +375 -0
- package/dist/bundle/chunk-37MAA6F2.js +5624 -0
- package/dist/bundle/chunk-3V6NPZY7.js +2352 -0
- package/dist/bundle/chunk-4TIC23D2.js +9 -0
- package/dist/bundle/chunk-4TQSNQVV.js +1071 -0
- package/dist/bundle/chunk-4UE7AVHZ.js +150 -0
- package/dist/bundle/chunk-5DPV7X27.js +663 -0
- package/dist/bundle/chunk-5FONRUG6.js +24805 -0
- package/dist/bundle/chunk-5ZVLM6YR.js +19 -0
- package/dist/bundle/chunk-64WJYT2F.js +3954 -0
- package/dist/bundle/chunk-65GGKAQ7.js +82 -0
- package/dist/bundle/chunk-66N2DGGC.js +515 -0
- package/dist/bundle/chunk-6KFA6HOM.js +2941 -0
- package/dist/bundle/chunk-6Y2BYFXQ.js +65 -0
- package/dist/bundle/chunk-7NCG2SHR.js +74 -0
- package/dist/bundle/chunk-7PVNJAQ2.js +73 -0
- package/dist/bundle/chunk-7XWUOCGW.js +190 -0
- package/dist/bundle/chunk-A6ZKTNTZ.js +168 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AH3SNVCV.js +498 -0
- package/dist/bundle/chunk-AN3GVZTU.js +76 -0
- package/dist/bundle/chunk-BPBIBVFH.js +166 -0
- package/dist/bundle/chunk-C4XP5T73.js +264 -0
- package/dist/bundle/chunk-C6SMAEED.js +18102 -0
- package/dist/bundle/chunk-CDI67JSB.js +1092 -0
- package/dist/bundle/chunk-CEO5HPRL.js +25 -0
- package/dist/bundle/chunk-CFT7UHF6.js +15572 -0
- package/dist/bundle/chunk-DC4T3FNP.js +1913 -0
- package/dist/bundle/chunk-DCTXOMOR.js +35 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-EVWXODYV.js +754 -0
- package/dist/bundle/chunk-GKHM6I64.js +2356 -0
- package/dist/bundle/chunk-GNI7INK6.js +18 -0
- package/dist/bundle/chunk-GTYY6BIE.js +58 -0
- package/dist/bundle/chunk-GX4WEMAG.js +164 -0
- package/dist/bundle/chunk-HA3WCVGY.js +8179 -0
- package/dist/bundle/chunk-HLONHTSG.js +281 -0
- package/dist/bundle/chunk-HOIUIKWS.js +236 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-I5EJHKNC.js +111 -0
- package/dist/bundle/chunk-ICKNJIGE.js +31 -0
- package/dist/bundle/chunk-IGB5CJCA.js +62 -0
- package/dist/bundle/chunk-IP4OK7RQ.js +24 -0
- package/dist/bundle/chunk-IVQ6342B.js +2 -0
- package/dist/bundle/chunk-K4N2DKE5.js +17 -0
- package/dist/bundle/chunk-LNB7BIZL.js +844 -0
- package/dist/bundle/chunk-LVDHWNJF.js +193 -0
- package/dist/bundle/chunk-LW2G4U6W.js +570 -0
- package/dist/bundle/chunk-LWT55XC5.js +60 -0
- package/dist/bundle/chunk-LY26NW3I.js +6848 -0
- package/dist/bundle/chunk-MJR2OTO4.js +1714 -0
- package/dist/bundle/chunk-MWUITL6N.js +42 -0
- package/dist/bundle/chunk-N47CYWEM.js +454 -0
- package/dist/bundle/chunk-NKZ6V4JW.js +263 -0
- package/dist/bundle/chunk-NQ6LLDDC.js +161 -0
- package/dist/bundle/chunk-NZIHPYY5.js +215 -0
- package/dist/bundle/chunk-OECPFZLP.js +3541 -0
- package/dist/bundle/chunk-P5KGFT7U.js +18 -0
- package/dist/bundle/chunk-PDH2QQQV.js +484 -0
- package/dist/bundle/chunk-PIN5RZ3D.js +63 -0
- package/dist/bundle/chunk-PJDO7AFZ.js +421 -0
- package/dist/bundle/chunk-PWKXHDBQ.js +18078 -0
- package/dist/bundle/chunk-QLZGLPJL.js +100 -0
- package/dist/bundle/chunk-SBZB7HMU.js +1055 -0
- package/dist/bundle/chunk-SGOPYPVW.js +835 -0
- package/dist/bundle/chunk-TDC6JGDA.js +630 -0
- package/dist/bundle/chunk-TOYPN2XX.js +288 -0
- package/dist/bundle/chunk-UC44ZMQV.js +78 -0
- package/dist/bundle/chunk-V7GN5BI7.js +99 -0
- package/dist/bundle/chunk-VO4KOLQZ.js +119 -0
- package/dist/bundle/chunk-WPGCDWPU.js +1855 -0
- package/dist/bundle/chunk-WQMVSQPP.js +886 -0
- package/dist/bundle/chunk-WZUJKUBK.js +384 -0
- package/dist/bundle/chunk-X5DFDGWS.js +2 -0
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/chunk-XPEWOPJR.js +431 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-Y5EJSZXV.js +220 -0
- package/dist/bundle/chunk-YE3J6DLY.js +106 -0
- package/dist/bundle/chunk-YFLKH3NZ.js +48 -0
- package/dist/bundle/chunk-YJX4X564.js +138 -0
- package/dist/bundle/chunk-YJZBJ2TM.js +71 -0
- package/dist/bundle/chunk-Z4O6C7WR.js +1973 -0
- package/dist/bundle/chunk-ZIHLE7LG.js +15992 -0
- package/dist/bundle/chunk-ZPMLLONT.js +1054 -0
- package/dist/bundle/chunk-ZQNXKWUY.js +35584 -0
- package/dist/bundle/chunk-ZS635F4O.js +45 -0
- package/dist/bundle/chunk-ZU732VCC.js +122 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-HX35D7KV.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-RFTK737T.js +42501 -0
- package/dist/bundle/embed-5NAGJUMD.js +37 -0
- package/dist/bundle/embedder-EWXLIGBY.js +110 -0
- package/dist/bundle/entry-YCPJ6H6U.js +15 -0
- package/dist/bundle/failure-XBWHHBEW.js +37 -0
- package/dist/bundle/first-run-LNAZDBB4.js +24 -0
- package/dist/bundle/first-screen-P5NNFJD7.js +36 -0
- package/dist/bundle/google-5FFKRHHC.js +32 -0
- package/dist/bundle/google-api-TJCFOOAP.js +82 -0
- package/dist/bundle/identity-53ZMPL2O.js +10 -0
- package/dist/bundle/instructions-FHNL7CMW.js +9 -0
- package/dist/bundle/login-VXXZZR6G.js +158 -0
- package/dist/bundle/mcp-2CJCJXSW.js +95 -0
- package/dist/bundle/mcp-F4XZO76F.js +507 -0
- package/dist/bundle/mcp-IXFC2VVR.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-ZMCACJVS.js +176 -0
- package/dist/bundle/node-sqlite-QJQ5S7KS.js +46 -0
- package/dist/bundle/oauth-TZFDPAFE.js +18 -0
- package/dist/bundle/open-IYM25QTL.js +20 -0
- package/dist/bundle/process-ZPTLNVQS.js +91 -0
- package/dist/bundle/program-YX7DZMPR.js +24100 -0
- package/dist/bundle/prompt-TGWTVIEK.js +13 -0
- package/dist/bundle/reasons-Q5LOQESQ.js +11 -0
- package/dist/bundle/recognize-AGPMWKIY.js +191 -0
- package/dist/bundle/remote-QV7QSLAK.js +28 -0
- package/dist/bundle/rerank-HZKJJCS4.js +51 -0
- package/dist/bundle/serve-NRJQOVT4.js +20 -0
- package/dist/bundle/server-2UQDEWTS.js +818 -0
- package/dist/bundle/server-R4JUHFSW.js +56 -0
- package/dist/bundle/services-NZQWVMOE.js +333 -0
- package/dist/bundle/sqlite-runtime-6MXHTYYU.js +17 -0
- package/dist/bundle/state-IF2FLTSY.js +34 -0
- package/dist/bundle/store-HBD54IRL.js +142 -0
- package/dist/bundle/store-HVIBXOXS.js +125 -0
- package/dist/bundle/store-maintenance-command-U3F4RGJB.js +57 -0
- package/dist/bundle/terminal-TFCTWLOS.js +11 -0
- package/dist/bundle/tokens-5D5YUA2Q.js +103 -0
- package/dist/commands/config.js +1 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +106 -54
- package/dist/commands/mcp.js.map +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +123 -83
- package/dist/contract-overrides.js.map +1 -1
- package/dist/mcp.d.ts +14 -6
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +26 -12
- package/dist/mcp.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +7 -5
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +0 -1
- package/dist/reasons.js.map +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +8 -2
- package/dist/registry.js.map +1 -1
- package/dist/state.d.ts +6 -3
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +6 -3
- package/dist/state.js.map +1 -1
- package/dist/tokens.d.ts +4 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +44 -8
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -5
- package/scenarios/agent-access.md +2 -2
- package/skills/drive-cli/SKILL.md +2 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ installs a newer version with the package manager that installed drive.
|
|
|
33
33
|
|
|
34
34
|
`drive guide` lists scenarios — the commands for a common task, in order — and `drive commands --json` is the full
|
|
35
35
|
command tree. For an agent, `drive skill install` puts drive's instructions where Claude Code, Codex, Gemini CLI and
|
|
36
|
-
OpenClaw look (Hermes with `--for hermes`), `drive personal mcp` serves three MCP tools (search, read, write) —
|
|
36
|
+
OpenClaw look (Hermes with `--for hermes`), `drive personal mcp serve` serves three MCP tools (search, read, write) —
|
|
37
37
|
`--http` serves them to ChatGPT and Claude in the browser ([remote MCP](docs/remote.md)) — and `DRIVE_READ_ONLY=1`
|
|
38
38
|
refuses every change, as `--read-only` does.
|
|
39
39
|
|
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.0\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-LTHNCWQW.js","../bundle/anthropic-NOJEF3V2.js","../bundle/bun-ADJVI4HY.js","../bundle/bun-sqlite-GNXLBF2A.js","../bundle/command-contract-HX35D7KV.js","../bundle/dist-MWTMOYWT.js","../bundle/dist-PY3MVR3G.js","../bundle/echarts-RFTK737T.js","../bundle/embed-5NAGJUMD.js","../bundle/embedder-EWXLIGBY.js","../bundle/entry-YCPJ6H6U.js","../bundle/failure-XBWHHBEW.js","../bundle/first-run-LNAZDBB4.js","../bundle/first-screen-P5NNFJD7.js","../bundle/google-5FFKRHHC.js","../bundle/google-api-TJCFOOAP.js","../bundle/identity-53ZMPL2O.js","../bundle/instructions-FHNL7CMW.js","../bundle/login-VXXZZR6G.js","../bundle/mcp-2CJCJXSW.js","../bundle/mcp-F4XZO76F.js","../bundle/mcp-IXFC2VVR.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-ZMCACJVS.js","../bundle/node-sqlite-QJQ5S7KS.js","../bundle/oauth-TZFDPAFE.js","../bundle/open-IYM25QTL.js","../bundle/process-ZPTLNVQS.js","../bundle/program-YX7DZMPR.js","../bundle/prompt-TGWTVIEK.js","../bundle/reasons-Q5LOQESQ.js","../bundle/recognize-AGPMWKIY.js","../bundle/remote-QV7QSLAK.js","../bundle/rerank-HZKJJCS4.js","../bundle/serve-NRJQOVT4.js","../bundle/server-2UQDEWTS.js","../bundle/server-R4JUHFSW.js","../bundle/services-NZQWVMOE.js","../bundle/sqlite-runtime-6MXHTYYU.js","../bundle/state-IF2FLTSY.js","../bundle/store-HBD54IRL.js","../bundle/store-HVIBXOXS.js","../bundle/store-maintenance-command-U3F4RGJB.js","../bundle/terminal-TFCTWLOS.js","../bundle/tokens-5D5YUA2Q.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-HLONHTSG.js";
|
|
10
|
+
import "./chunk-AN3GVZTU.js";
|
|
11
|
+
import "./chunk-TDC6JGDA.js";
|
|
12
|
+
import "./chunk-5FONRUG6.js";
|
|
13
|
+
import "./chunk-XPEWOPJR.js";
|
|
14
|
+
import "./chunk-K4N2DKE5.js";
|
|
15
|
+
import "./chunk-IVQ6342B.js";
|
|
16
|
+
import "./chunk-6KFA6HOM.js";
|
|
17
|
+
import "./chunk-GKHM6I64.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-ICKNJIGE.js";
|
|
6
|
+
import {
|
|
7
|
+
messagesFor,
|
|
8
|
+
systemFor
|
|
9
|
+
} from "./chunk-ZS635F4O.js";
|
|
10
|
+
import {
|
|
11
|
+
Anthropic
|
|
12
|
+
} from "./chunk-ADLS6FVG.js";
|
|
13
|
+
import "./chunk-6KFA6HOM.js";
|
|
14
|
+
import {
|
|
15
|
+
array,
|
|
16
|
+
optional,
|
|
17
|
+
strictObject,
|
|
18
|
+
string
|
|
19
|
+
} from "./chunk-GKHM6I64.js";
|
|
20
|
+
import "./chunk-Y5E2WNWB.js";
|
|
21
|
+
import {
|
|
22
|
+
__name
|
|
23
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
24
|
+
|
|
25
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/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,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-LY26NW3I.js";
|
|
22
|
+
import {
|
|
23
|
+
__name
|
|
24
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
25
|
+
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/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-GTYY6BIE.js";
|
|
7
|
+
import "./chunk-6KFA6HOM.js";
|
|
8
|
+
import "./chunk-GKHM6I64.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.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/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
|
+
};
|