@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
child_process,
|
|
5
|
+
crypto,
|
|
6
|
+
fs,
|
|
7
|
+
os,
|
|
8
|
+
path,
|
|
9
|
+
stream,
|
|
10
|
+
util
|
|
11
|
+
} from "./chunk-DFDN6AUB.js";
|
|
12
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
export {
|
|
14
|
+
child_process,
|
|
15
|
+
crypto,
|
|
16
|
+
fs,
|
|
17
|
+
os,
|
|
18
|
+
path,
|
|
19
|
+
stream,
|
|
20
|
+
util
|
|
21
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
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/node.js
|
|
27
|
+
import { DatabaseSync } from "node:sqlite";
|
|
28
|
+
var nodeSQLiteCodecs = 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 NodeSQLiteSession = class extends SQLiteAsyncSession {
|
|
53
|
+
static {
|
|
54
|
+
__name(this, "NodeSQLiteSession");
|
|
55
|
+
}
|
|
56
|
+
client;
|
|
57
|
+
relations;
|
|
58
|
+
options;
|
|
59
|
+
static [entityKind] = "SQLJsSession";
|
|
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
|
+
prepareQuery(query, mode, _prepare, executeMethod, mapper, queryMetadata) {
|
|
69
|
+
let stmt;
|
|
70
|
+
try {
|
|
71
|
+
stmt = this.client.prepare(query.sql);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
throw new DrizzleQueryError(query.sql, this.options.paramsInErrors ? query.params : void 0, e);
|
|
74
|
+
}
|
|
75
|
+
return new SQLiteAsyncPreparedQuery("sync", executeMethod, {
|
|
76
|
+
all: /* @__PURE__ */ __name((params) => {
|
|
77
|
+
stmt.setReturnArrays(mode === "arrays");
|
|
78
|
+
const res = stmt.all(...params);
|
|
79
|
+
if (mode === "objects") return res.map((row) => ({ ...row }));
|
|
80
|
+
return res;
|
|
81
|
+
}, "all"),
|
|
82
|
+
get: /* @__PURE__ */ __name((params) => {
|
|
83
|
+
stmt.setReturnArrays(mode === "arrays");
|
|
84
|
+
const res = stmt.get(...params);
|
|
85
|
+
if (res && mode === "objects") return { ...res };
|
|
86
|
+
return res;
|
|
87
|
+
}, "get"),
|
|
88
|
+
run: /* @__PURE__ */ __name((params) => {
|
|
89
|
+
stmt.setReturnArrays(false);
|
|
90
|
+
return stmt.run(...params);
|
|
91
|
+
}, "run")
|
|
92
|
+
}, query, mapper, mode, this.logger, void 0, queryMetadata, void 0, this.options.paramsInErrors);
|
|
93
|
+
}
|
|
94
|
+
transaction(transaction, config = {}) {
|
|
95
|
+
if (config?.behavior === "concurrent") throw new Error("Concurrent transactions are not supported by driver");
|
|
96
|
+
const tx = new NodeSQLiteTransaction("sync", this.dialect, this, this.relations);
|
|
97
|
+
this.run(sql.raw(`begin${config.behavior ? ` ${config.behavior}` : ""}`));
|
|
98
|
+
try {
|
|
99
|
+
const result = transaction(tx);
|
|
100
|
+
this.run(sql`commit`);
|
|
101
|
+
return result;
|
|
102
|
+
} catch (err) {
|
|
103
|
+
try {
|
|
104
|
+
this.run(sql`rollback`);
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var NodeSQLiteTransaction = class NodeSQLiteTransaction2 extends SQLiteAsyncTransaction {
|
|
112
|
+
static {
|
|
113
|
+
__name(this, "NodeSQLiteTransaction2");
|
|
114
|
+
}
|
|
115
|
+
static [entityKind] = "SQLJsTransaction";
|
|
116
|
+
transaction(transaction) {
|
|
117
|
+
const savepointName = `sp${this.nestedIndex + 1}`;
|
|
118
|
+
const tx = new NodeSQLiteTransaction2("sync", this.dialect, this.session, this._.relations, this.nestedIndex + 1);
|
|
119
|
+
tx.run(sql.raw(`savepoint ${savepointName}`));
|
|
120
|
+
try {
|
|
121
|
+
const result = transaction(tx);
|
|
122
|
+
tx.run(sql.raw(`release savepoint ${savepointName}`));
|
|
123
|
+
return result;
|
|
124
|
+
} catch (err) {
|
|
125
|
+
try {
|
|
126
|
+
tx.run(sql.raw(`rollback to savepoint ${savepointName}`));
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var NodeSQLiteDatabase = class extends SQLiteAsyncDatabase {
|
|
134
|
+
static {
|
|
135
|
+
__name(this, "NodeSQLiteDatabase");
|
|
136
|
+
}
|
|
137
|
+
static [entityKind] = "NodeSQLiteDatabase";
|
|
138
|
+
};
|
|
139
|
+
function construct(client, config = {}) {
|
|
140
|
+
const dialect = new SQLiteDialect({
|
|
141
|
+
codecs: config.codecs ?? nodeSQLiteCodecs,
|
|
142
|
+
useJitMappers: jitCompatCheck(config.jit)
|
|
143
|
+
});
|
|
144
|
+
let logger;
|
|
145
|
+
if (config.logger === true) logger = new DefaultLogger();
|
|
146
|
+
else if (config.logger !== false) logger = config.logger;
|
|
147
|
+
const relations = config.relations ?? {};
|
|
148
|
+
const db = new NodeSQLiteDatabase("sync", dialect, new NodeSQLiteSession(client, dialect, relations, {
|
|
149
|
+
logger,
|
|
150
|
+
paramsInErrors: config.paramsInErrors
|
|
151
|
+
}), relations);
|
|
152
|
+
db.$client = client;
|
|
153
|
+
return db;
|
|
154
|
+
}
|
|
155
|
+
__name(construct, "construct");
|
|
156
|
+
function drizzle(...params) {
|
|
157
|
+
if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new DatabaseSync(":memory:") : new DatabaseSync(params[0]), params[1]);
|
|
158
|
+
const { connection, client, ...config } = params[0];
|
|
159
|
+
if (client) return construct(client, config);
|
|
160
|
+
if (typeof connection === "object") {
|
|
161
|
+
const { path, ...options } = connection;
|
|
162
|
+
return construct(new DatabaseSync(path ?? ":memory:", options), config);
|
|
163
|
+
}
|
|
164
|
+
return construct(new DatabaseSync(connection ?? ":memory:"), config);
|
|
165
|
+
}
|
|
166
|
+
__name(drizzle, "drizzle");
|
|
167
|
+
(function(_drizzle) {
|
|
168
|
+
function mock(config) {
|
|
169
|
+
return construct({}, config);
|
|
170
|
+
}
|
|
171
|
+
__name(mock, "mock");
|
|
172
|
+
_drizzle.mock = mock;
|
|
173
|
+
})(drizzle || (drizzle = {}));
|
|
174
|
+
export {
|
|
175
|
+
drizzle
|
|
176
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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 "./chunk-Y5E2WNWB.js";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
|
|
14
|
+
// 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/node-sqlite.js
|
|
15
|
+
import { DatabaseSync } from "node:sqlite";
|
|
16
|
+
var openWithNodeSqlite = /* @__PURE__ */ __name(async (path) => cacheOverNodeSqlite(await nodeClient(path)), "openWithNodeSqlite");
|
|
17
|
+
var nodeClient = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
18
|
+
const extension = await vectorExtension();
|
|
19
|
+
const client = new DatabaseSync(path, { readOnly, allowExtension: true });
|
|
20
|
+
try {
|
|
21
|
+
loadVectorExtension(client, extension);
|
|
22
|
+
return client;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
client.close();
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}, "nodeClient");
|
|
28
|
+
var cacheOverNodeSqlite = /* @__PURE__ */ __name((database) => {
|
|
29
|
+
return {
|
|
30
|
+
exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
|
|
31
|
+
prepare: /* @__PURE__ */ __name((sql) => {
|
|
32
|
+
const statement = database.prepare(sql);
|
|
33
|
+
return {
|
|
34
|
+
run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
|
|
35
|
+
get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters), "get"),
|
|
36
|
+
all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
|
|
37
|
+
};
|
|
38
|
+
}, "prepare"),
|
|
39
|
+
close: /* @__PURE__ */ __name(() => database.close(), "close")
|
|
40
|
+
};
|
|
41
|
+
}, "cacheOverNodeSqlite");
|
|
42
|
+
export {
|
|
43
|
+
cacheOverNodeSqlite,
|
|
44
|
+
nodeClient,
|
|
45
|
+
openWithNodeSqlite
|
|
46
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ownerLogin,
|
|
5
|
+
revokeAll
|
|
6
|
+
} from "./chunk-NLEB26GA.js";
|
|
7
|
+
import "./chunk-5FONRUG6.js";
|
|
8
|
+
import "./chunk-3HRDEJJW.js";
|
|
9
|
+
import "./chunk-NP3XLLN3.js";
|
|
10
|
+
import "./chunk-AIXLOMH4.js";
|
|
11
|
+
import "./chunk-VHT2WI4I.js";
|
|
12
|
+
import "./chunk-BJ3JRO34.js";
|
|
13
|
+
import "./chunk-Y5E2WNWB.js";
|
|
14
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
15
|
+
export {
|
|
16
|
+
ownerLogin,
|
|
17
|
+
revokeAll
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CAPABILITY_STATEMENTS,
|
|
5
|
+
assertStoreCapable,
|
|
6
|
+
openCache,
|
|
7
|
+
openFile,
|
|
8
|
+
storeCapable
|
|
9
|
+
} from "./chunk-VYBOYBLX.js";
|
|
10
|
+
import "./chunk-VHT2WI4I.js";
|
|
11
|
+
import "./chunk-BJ3JRO34.js";
|
|
12
|
+
import "./chunk-Y5E2WNWB.js";
|
|
13
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
14
|
+
export {
|
|
15
|
+
CAPABILITY_STATEMENTS,
|
|
16
|
+
assertStoreCapable,
|
|
17
|
+
openCache,
|
|
18
|
+
openFile,
|
|
19
|
+
storeCapable
|
|
20
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import "./chunk-Y5E2WNWB.js";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
7
|
+
|
|
8
|
+
// 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/embeddings/process.js
|
|
9
|
+
import { spawn } from "node:child_process";
|
|
10
|
+
import { createInterface } from "node:readline";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
var openProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
|
|
13
|
+
const child = await modelProcess({ model, directory, threads });
|
|
14
|
+
return {
|
|
15
|
+
model,
|
|
16
|
+
embed: /* @__PURE__ */ __name(async (texts, kind) => ((await child.ask({ texts, kind })).vectors ?? []).map((vector) => Float32Array.from(vector)), "embed"),
|
|
17
|
+
close: child.close
|
|
18
|
+
};
|
|
19
|
+
}, "openProcess");
|
|
20
|
+
var openRerankerProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
|
|
21
|
+
const child = await modelProcess({ model, directory, threads, rerank: true });
|
|
22
|
+
return {
|
|
23
|
+
model,
|
|
24
|
+
score: /* @__PURE__ */ __name(async (question, passages) => (await child.ask({ question, texts: passages })).scores ?? [], "score"),
|
|
25
|
+
close: child.close
|
|
26
|
+
};
|
|
27
|
+
}, "openRerankerProcess");
|
|
28
|
+
var modelProcess = /* @__PURE__ */ __name(async (setup) => {
|
|
29
|
+
const child = spawn(process.execPath, [fileURLToPath(new URL("./child.js", new URL("embeddings/process.js", import.meta.resolve("@wirecat/cli-core")).href)), JSON.stringify(setup)], { stdio: ["pipe", "pipe", "pipe"] });
|
|
30
|
+
const pending = /* @__PURE__ */ new Map();
|
|
31
|
+
let said = "";
|
|
32
|
+
child.stderr.setEncoding("utf8").on("data", (text) => {
|
|
33
|
+
said = (said + text).slice(-2e3);
|
|
34
|
+
});
|
|
35
|
+
let ready = /* @__PURE__ */ __name(() => {
|
|
36
|
+
}, "ready");
|
|
37
|
+
let refused = /* @__PURE__ */ __name((_error) => {
|
|
38
|
+
}, "refused");
|
|
39
|
+
const started = new Promise((resolve, reject) => {
|
|
40
|
+
ready = resolve;
|
|
41
|
+
refused = reject;
|
|
42
|
+
});
|
|
43
|
+
let gone;
|
|
44
|
+
const stopped = /* @__PURE__ */ __name((error) => {
|
|
45
|
+
gone ??= error;
|
|
46
|
+
refused(error);
|
|
47
|
+
for (const job of pending.values())
|
|
48
|
+
job.reject(error);
|
|
49
|
+
pending.clear();
|
|
50
|
+
}, "stopped");
|
|
51
|
+
const exited = new Promise((resolve) => {
|
|
52
|
+
child.once("exit", (code) => {
|
|
53
|
+
const last = said.trim().split("\n").at(-1);
|
|
54
|
+
stopped(new Error(`the embedding process stopped (exit ${code})${last ? `: ${last}` : ""}`));
|
|
55
|
+
resolve();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
child.once("error", stopped);
|
|
59
|
+
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
60
|
+
const answer = JSON.parse(line);
|
|
61
|
+
if ("ready" in answer)
|
|
62
|
+
return ready();
|
|
63
|
+
const job = pending.get(answer.id);
|
|
64
|
+
pending.delete(answer.id);
|
|
65
|
+
if (answer.error !== void 0 || !(answer.vectors ?? answer.scores))
|
|
66
|
+
job?.reject(new Error(answer.error ?? "no answer"));
|
|
67
|
+
else
|
|
68
|
+
job?.resolve(answer);
|
|
69
|
+
});
|
|
70
|
+
await started;
|
|
71
|
+
let next = 0;
|
|
72
|
+
return {
|
|
73
|
+
ask: /* @__PURE__ */ __name((request) => new Promise((resolve, reject) => {
|
|
74
|
+
if (gone)
|
|
75
|
+
return reject(gone);
|
|
76
|
+
const id = next++;
|
|
77
|
+
pending.set(id, { resolve, reject });
|
|
78
|
+
child.stdin.write(`${JSON.stringify({ id, ...request })}
|
|
79
|
+
`);
|
|
80
|
+
}), "ask"),
|
|
81
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
82
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
83
|
+
child.stdin.end();
|
|
84
|
+
await exited;
|
|
85
|
+
}, "close")
|
|
86
|
+
};
|
|
87
|
+
}, "modelProcess");
|
|
88
|
+
export {
|
|
89
|
+
openProcess,
|
|
90
|
+
openRerankerProcess
|
|
91
|
+
};
|