@wirecat/cli-template 0.9.0 → 0.11.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/.github/workflows/ci.yml +18 -0
- package/.github/workflows/release.yml +63 -0
- package/CHANGELOG.md +72 -1
- package/CLAUDE.md +1 -3
- package/bin/release +5 -3
- package/contracts/help.snap +2 -0
- package/dist/bin/clidev.js +34 -12
- package/dist/bundle/all-profiles-MJ6XSFOO.js +24 -0
- package/dist/bundle/anthropic-W5UKBZUB.js +70 -0
- package/dist/bundle/app-server-EZ46JAHB.js +217 -0
- package/dist/bundle/bun-HB6O2TTT.js +169 -0
- package/dist/bundle/bun-sqlite-KBXOW2ES.js +69 -0
- package/dist/bundle/chunk-2B5U4Z5H.js +100 -0
- package/dist/bundle/chunk-35KYY65W.js +122 -0
- package/dist/bundle/chunk-4LURWBVV.js +752 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-7IXL4UFK.js +158 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AK257OMS.js +8353 -0
- package/dist/bundle/chunk-CXQXVKUY.js +24 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-E42W72PQ.js +151 -0
- package/dist/bundle/chunk-EFHLQXG6.js +5104 -0
- package/dist/bundle/chunk-EGRB55FF.js +264 -0
- package/dist/bundle/chunk-ERGB4NJA.js +53 -0
- package/dist/bundle/chunk-ERKR3VJ5.js +1146 -0
- package/dist/bundle/chunk-FDBINRWA.js +884 -0
- package/dist/bundle/chunk-FZZIU4B7.js +34514 -0
- package/dist/bundle/chunk-GOO67PDU.js +2 -0
- package/dist/bundle/chunk-HDY5X3WQ.js +281 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IBBN7Z3A.js +630 -0
- package/dist/bundle/chunk-IDWW4TU2.js +18 -0
- package/dist/bundle/chunk-IGHEW777.js +164 -0
- package/dist/bundle/chunk-IN3FVRPK.js +76 -0
- package/dist/bundle/chunk-JAOGZMKQ.js +48 -0
- package/dist/bundle/chunk-JHO2LL2J.js +459 -0
- package/dist/bundle/chunk-JRK73FOW.js +78 -0
- package/dist/bundle/chunk-KAREKBUZ.js +24 -0
- package/dist/bundle/chunk-KJTNT4SW.js +82 -0
- package/dist/bundle/chunk-L5WWMP5M.js +1904 -0
- package/dist/bundle/chunk-MFS52LTZ.js +570 -0
- package/dist/bundle/chunk-MJRSEUKG.js +442 -0
- package/dist/bundle/chunk-MUSYGFCY.js +3556 -0
- package/dist/bundle/chunk-N2Z3MCOF.js +779 -0
- package/dist/bundle/chunk-NOVLCHDV.js +45 -0
- package/dist/bundle/chunk-O3UXNU3S.js +54 -0
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/chunk-OV6PHTAY.js +36226 -0
- package/dist/bundle/chunk-PBN4RBHS.js +2315 -0
- package/dist/bundle/chunk-PDGXMKJS.js +31 -0
- package/dist/bundle/chunk-PJOVK7PG.js +191 -0
- package/dist/bundle/chunk-QBP7OMN5.js +58 -0
- package/dist/bundle/chunk-QJ6XW4DM.js +7556 -0
- package/dist/bundle/chunk-QKWRL4OD.js +1028 -0
- package/dist/bundle/chunk-RUKDZEID.js +73 -0
- package/dist/bundle/chunk-SVDF6NJF.js +215 -0
- package/dist/bundle/chunk-TAYOKLGF.js +193 -0
- package/dist/bundle/chunk-TGB5F7NC.js +288 -0
- package/dist/bundle/chunk-V3ZTQ24B.js +161 -0
- package/dist/bundle/chunk-VLNKTMV7.js +3103 -0
- package/dist/bundle/chunk-VYSUKHKL.js +63 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YJNUDHJD.js +3390 -0
- package/dist/bundle/chunk-Z7MSIRSQ.js +6848 -0
- package/dist/bundle/chunk-ZLY6GUAS.js +82 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/clidev.js +22 -0
- package/dist/bundle/command-contract-75VJ36U4.js +29 -0
- package/dist/bundle/decode-AMXUVKNY.js +158 -0
- package/dist/bundle/dist-ESHIQU4M.js +7577 -0
- package/dist/bundle/echarts-GJDMQ2AQ.js +42501 -0
- package/dist/bundle/embed-L4CRZ2XQ.js +35 -0
- package/dist/bundle/embedder-IBGV4M2K.js +108 -0
- package/dist/bundle/first-run-VTKC2IBV.js +23 -0
- package/dist/bundle/first-screen-X5IJKBSU.js +27 -0
- package/dist/bundle/instructions-YJECS4KN.js +11 -0
- package/dist/bundle/mcp-G6XP2IRO.js +151 -0
- package/dist/bundle/mcp-OQBZXELQ.js +165 -0
- package/dist/bundle/mcp-RDZGYPSY.js +78 -0
- package/dist/bundle/node-NQG4EVZR.js +176 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-BR7F3BLB.js +61 -0
- package/dist/bundle/oauth-J7UAWNIK.js +17 -0
- package/dist/bundle/open-BR47R5UE.js +19 -0
- package/dist/bundle/process-66I7RDPJ.js +91 -0
- package/dist/bundle/program-K6347XBZ.js +17279 -0
- package/dist/bundle/prompt-NE5JJ7UP.js +12 -0
- package/dist/bundle/recognize-GC3YFVIA.js +21 -0
- package/dist/bundle/remote-QELOMKQM.js +26 -0
- package/dist/bundle/rerank-BH6TZ2SP.js +49 -0
- package/dist/bundle/serve-WWLRNDT2.js +19 -0
- package/dist/bundle/server-DE6NLNUF.js +52 -0
- package/dist/bundle/server-ZPSQKOAH.js +39 -0
- package/dist/bundle/state-2BEGXAMO.js +33 -0
- package/dist/bundle/store-AH6WZMCF.js +120 -0
- package/dist/bundle/store-maintenance-command-PBXX3IEV.js +40 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/docs/commands.md +9 -13
- package/docs/dev/TESTING.md +10 -0
- package/docs/dev/reference-clis.md +7 -5
- package/docs/dev/skills/release/SKILL.md +15 -8
- package/docs/dev/skills/release/fresh-audit.md +4 -0
- package/docs/dev/test-matrix.md +1 -1
- package/kit/dist/new.js +1 -0
- package/package.json +8 -5
- package/scripts/audit.sh +14 -3
- package/scripts/smoke-bundle.ts +64 -0
- package/scripts/smoke.ts +18 -0
- package/scripts/test-matrix-untested.ts +1 -1
- package/scripts/version-level.test.ts +17 -1
- package/scripts/version-level.ts +35 -7
- package/skills/clidev-cli/SKILL.md +8 -0
- package/src/version.ts +1 -1
- package/lint/baseline/unknown-verb.json +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError,
|
|
5
|
+
finite,
|
|
6
|
+
getDotPath,
|
|
7
|
+
maxValue,
|
|
8
|
+
minValue,
|
|
9
|
+
number,
|
|
10
|
+
optional,
|
|
11
|
+
pipe,
|
|
12
|
+
safeParse
|
|
13
|
+
} from "./chunk-EFHLQXG6.js";
|
|
14
|
+
import {
|
|
15
|
+
__name
|
|
16
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
17
|
+
|
|
18
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/models/options.js
|
|
19
|
+
var checkedOptions = /* @__PURE__ */ __name((provider, schema, options) => {
|
|
20
|
+
const parsed = safeParse(schema, options);
|
|
21
|
+
if (!parsed.success) {
|
|
22
|
+
throw new CliError("validation_error", `${provider} option ${getDotPath(parsed.issues[0]) ?? "options"} is unknown or has the wrong type`);
|
|
23
|
+
}
|
|
24
|
+
return parsed.output;
|
|
25
|
+
}, "checkedOptions");
|
|
26
|
+
var range = /* @__PURE__ */ __name((min, max) => optional(pipe(number(), finite(), minValue(min), maxValue(max))), "range");
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
checkedOptions,
|
|
30
|
+
range
|
|
31
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-EFHLQXG6.js";
|
|
6
|
+
import {
|
|
7
|
+
importFrom
|
|
8
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
17
|
+
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
18
|
+
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
19
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
20
|
+
let offset = 0;
|
|
21
|
+
let serial;
|
|
22
|
+
let packet = 0;
|
|
23
|
+
let length = 0;
|
|
24
|
+
const prefix = [];
|
|
25
|
+
while (offset < bytes.length) {
|
|
26
|
+
if (offset + 27 > bytes.length || view.getUint32(offset, false) !== 1332176723 || bytes[offset + 4] !== 0)
|
|
27
|
+
throw invalid();
|
|
28
|
+
const stream = view.getUint32(offset + 14, true);
|
|
29
|
+
if (serial !== void 0 && serial !== stream)
|
|
30
|
+
throw invalid();
|
|
31
|
+
serial = stream;
|
|
32
|
+
const segments = bytes[offset + 26] ?? 0;
|
|
33
|
+
let data = offset + 27 + segments;
|
|
34
|
+
if (data > bytes.length || Boolean((bytes[offset + 5] ?? 0) & 1) !== length > 0)
|
|
35
|
+
throw invalid();
|
|
36
|
+
for (let index = 0; index < segments; index++) {
|
|
37
|
+
const size = bytes[offset + 27 + index] ?? 0;
|
|
38
|
+
if (data + size > bytes.length)
|
|
39
|
+
throw invalid();
|
|
40
|
+
const take = Math.min(size, 19 - prefix.length);
|
|
41
|
+
for (let i = 0; i < take; i++)
|
|
42
|
+
prefix.push(bytes[data + i] ?? 0);
|
|
43
|
+
length += size;
|
|
44
|
+
data += size;
|
|
45
|
+
if (size === 255)
|
|
46
|
+
continue;
|
|
47
|
+
if (packet === 0) {
|
|
48
|
+
if (length < 19 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusHead" || ![1, 2].includes(prefix[9] ?? 0) || prefix[18] !== 0)
|
|
49
|
+
throw invalid();
|
|
50
|
+
} else if (packet === 1) {
|
|
51
|
+
if (length < 8 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusTags")
|
|
52
|
+
throw invalid();
|
|
53
|
+
} else {
|
|
54
|
+
if (length < 1)
|
|
55
|
+
throw invalid();
|
|
56
|
+
const toc = prefix[0] ?? 0;
|
|
57
|
+
const config = toc >> 3;
|
|
58
|
+
const frame = config >= 16 ? 120 << (config & 3) : config >= 12 ? 480 << (config & 1) : (config & 3) === 3 ? 2880 : 480 << (config & 3);
|
|
59
|
+
const count = (toc & 3) === 0 ? 1 : (toc & 3) === 3 ? length >= 2 ? (prefix[1] ?? 0) & 63 : 0 : 2;
|
|
60
|
+
if (count < 1 || frame * count > 5760)
|
|
61
|
+
throw invalid();
|
|
62
|
+
}
|
|
63
|
+
packet++;
|
|
64
|
+
length = 0;
|
|
65
|
+
prefix.length = 0;
|
|
66
|
+
}
|
|
67
|
+
offset = data;
|
|
68
|
+
}
|
|
69
|
+
if (length !== 0 || packet < 3)
|
|
70
|
+
throw invalid();
|
|
71
|
+
}, "checkOggDuration");
|
|
72
|
+
|
|
73
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
74
|
+
var SAMPLE_RATE = 16e3;
|
|
75
|
+
var LEAD = SAMPLE_RATE / 2;
|
|
76
|
+
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|
|
77
|
+
const step = rate / SAMPLE_RATE;
|
|
78
|
+
const length = Math.floor(samples.length / step);
|
|
79
|
+
const pcm = new Float32Array(LEAD + length);
|
|
80
|
+
for (let i = 0; i < length; i++) {
|
|
81
|
+
const from = Math.floor(i * step);
|
|
82
|
+
const to = Math.max(from + 1, Math.floor((i + 1) * step));
|
|
83
|
+
let sum = 0;
|
|
84
|
+
for (let j = from; j < to; j++)
|
|
85
|
+
sum += samples[j] ?? 0;
|
|
86
|
+
pcm[LEAD + i] = sum / (to - from);
|
|
87
|
+
}
|
|
88
|
+
return pcm;
|
|
89
|
+
}, "toModelRate");
|
|
90
|
+
var decodeOgg = /* @__PURE__ */ __name(async (bytes) => {
|
|
91
|
+
checkOggDuration(bytes);
|
|
92
|
+
const { OggOpusDecoder } = await importFrom(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href, "ogg-opus-decoder");
|
|
93
|
+
const decoder = new OggOpusDecoder();
|
|
94
|
+
await decoder.ready;
|
|
95
|
+
try {
|
|
96
|
+
const { channelData, sampleRate, samplesDecoded } = await decoder.decodeFile(bytes);
|
|
97
|
+
const samples = channelData[0];
|
|
98
|
+
if (!samples || samplesDecoded === 0)
|
|
99
|
+
throw new Error("no Ogg Opus audio in it");
|
|
100
|
+
return { samples, rate: sampleRate };
|
|
101
|
+
} finally {
|
|
102
|
+
decoder.free();
|
|
103
|
+
}
|
|
104
|
+
}, "decodeOgg");
|
|
105
|
+
var WINDOW = 512;
|
|
106
|
+
var detector = /* @__PURE__ */ __name((vadModel) => ({
|
|
107
|
+
sileroVad: {
|
|
108
|
+
model: vadModel,
|
|
109
|
+
// At the default 0.5 a quietly spoken stretch in the middle of a voice message never counted as
|
|
110
|
+
// speech and was lost; 0.3 keeps it for both models and changes nothing on clear speech (126508, 2026-09-30).
|
|
111
|
+
threshold: 0.3,
|
|
112
|
+
minSilenceDuration: 0.5,
|
|
113
|
+
minSpeechDuration: 0.25,
|
|
114
|
+
maxSpeechDuration: 20,
|
|
115
|
+
windowSize: WINDOW
|
|
116
|
+
},
|
|
117
|
+
sampleRate: SAMPLE_RATE,
|
|
118
|
+
numThreads: 1,
|
|
119
|
+
provider: "cpu",
|
|
120
|
+
debug: 0,
|
|
121
|
+
bufferSizeInSeconds: 30
|
|
122
|
+
}), "detector");
|
|
123
|
+
var loaded;
|
|
124
|
+
var loadSherpa = /* @__PURE__ */ __name(() => {
|
|
125
|
+
if (loaded)
|
|
126
|
+
return loaded;
|
|
127
|
+
const load = createRequire(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href);
|
|
128
|
+
const wasm = {};
|
|
129
|
+
load("sherpa-onnx/sherpa-onnx-wasm-nodejs.js")(wasm);
|
|
130
|
+
const stdout = wasm.FS?.getStream(1);
|
|
131
|
+
if (stdout)
|
|
132
|
+
stdout.nfd = 2;
|
|
133
|
+
const asr = load("sherpa-onnx/sherpa-onnx-asr.js");
|
|
134
|
+
const vad = load("sherpa-onnx/sherpa-onnx-vad.js");
|
|
135
|
+
loaded = {
|
|
136
|
+
createOfflineRecognizer: /* @__PURE__ */ __name((config) => new asr.OfflineRecognizer(config, wasm), "createOfflineRecognizer"),
|
|
137
|
+
createVad: /* @__PURE__ */ __name((config) => vad.createVad(wasm, config), "createVad")
|
|
138
|
+
};
|
|
139
|
+
return loaded;
|
|
140
|
+
}, "loadSherpa");
|
|
141
|
+
var openRecognizer = /* @__PURE__ */ __name((model, path, vadModel) => {
|
|
142
|
+
const sherpa = loadSherpa();
|
|
143
|
+
const engine = sherpa.createOfflineRecognizer({
|
|
144
|
+
featConfig: { sampleRate: SAMPLE_RATE, featureDim: model.featureDim },
|
|
145
|
+
modelConfig: { ...model.config(path), numThreads: 1, provider: "cpu", debug: 0 },
|
|
146
|
+
decodingMethod: "greedy_search"
|
|
147
|
+
});
|
|
148
|
+
const vad = sherpa.createVad(detector(vadModel));
|
|
149
|
+
const piece = /* @__PURE__ */ __name((samples) => {
|
|
150
|
+
const stream = engine.createStream();
|
|
151
|
+
try {
|
|
152
|
+
stream.acceptWaveform(SAMPLE_RATE, samples);
|
|
153
|
+
engine.decode(stream);
|
|
154
|
+
return engine.getResult(stream).text.trim();
|
|
155
|
+
} finally {
|
|
156
|
+
stream.free();
|
|
157
|
+
}
|
|
158
|
+
}, "piece");
|
|
159
|
+
return {
|
|
160
|
+
recognize: /* @__PURE__ */ __name((pcm) => {
|
|
161
|
+
vad.reset();
|
|
162
|
+
const parts = [];
|
|
163
|
+
const drain = /* @__PURE__ */ __name(() => {
|
|
164
|
+
while (!vad.isEmpty()) {
|
|
165
|
+
parts.push(piece(vad.front().samples));
|
|
166
|
+
vad.pop();
|
|
167
|
+
}
|
|
168
|
+
}, "drain");
|
|
169
|
+
for (let i = 0; i + WINDOW <= pcm.length; i += WINDOW) {
|
|
170
|
+
vad.acceptWaveform(pcm.subarray(i, i + WINDOW));
|
|
171
|
+
drain();
|
|
172
|
+
}
|
|
173
|
+
vad.flush();
|
|
174
|
+
drain();
|
|
175
|
+
return parts.filter(Boolean).join(" ");
|
|
176
|
+
}, "recognize"),
|
|
177
|
+
free: /* @__PURE__ */ __name(() => {
|
|
178
|
+
vad.free();
|
|
179
|
+
engine.free();
|
|
180
|
+
}, "free")
|
|
181
|
+
};
|
|
182
|
+
}, "openRecognizer");
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
SAMPLE_RATE,
|
|
186
|
+
toModelRate,
|
|
187
|
+
decodeOgg,
|
|
188
|
+
detector,
|
|
189
|
+
loadSherpa,
|
|
190
|
+
openRecognizer
|
|
191
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-EFHLQXG6.js";
|
|
6
|
+
import {
|
|
7
|
+
importFrom
|
|
8
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
15
|
+
var musl = /* @__PURE__ */ __name(() => {
|
|
16
|
+
if (process.platform !== "linux")
|
|
17
|
+
return false;
|
|
18
|
+
try {
|
|
19
|
+
return readFileSync("/proc/self/maps", "utf8").includes("ld-musl");
|
|
20
|
+
} catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}, "musl");
|
|
24
|
+
var found;
|
|
25
|
+
var vectorExtension = /* @__PURE__ */ __name(() => {
|
|
26
|
+
found ??= locate();
|
|
27
|
+
return found;
|
|
28
|
+
}, "vectorExtension");
|
|
29
|
+
var locate = /* @__PURE__ */ __name(async () => {
|
|
30
|
+
const onMusl = musl();
|
|
31
|
+
const target = `${process.platform}-${process.arch}${onMusl ? "-musl" : ""}`;
|
|
32
|
+
let path;
|
|
33
|
+
try {
|
|
34
|
+
const { extensionFor } = await importFrom(new URL("store/vector-extension.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
|
|
35
|
+
path = extensionFor({ musl: onMusl });
|
|
36
|
+
} catch {
|
|
37
|
+
path = void 0;
|
|
38
|
+
}
|
|
39
|
+
if (path === void 0) {
|
|
40
|
+
found = void 0;
|
|
41
|
+
throw new CliError("configuration_error", `the message store needs the sqlite-vec extension, and @wirecat/cli-core-sqlite has none for ${target} \u2014 reinstall the CLI so its dependencies install with it (an install that skips optional or native packages leaves it out)`, { reason: "store.vector-extension-missing", target });
|
|
42
|
+
}
|
|
43
|
+
return path;
|
|
44
|
+
}, "locate");
|
|
45
|
+
var loadVectorExtension = /* @__PURE__ */ __name((database, path) => {
|
|
46
|
+
try {
|
|
47
|
+
database.loadExtension(path);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
throw new CliError("configuration_error", `the sqlite-vec extension did not load on ${process.platform}-${process.arch} \u2014 reinstall the CLI; on macOS under Bun, @wirecat/cli-core-sqlite's SQLite must be installed, since the system's cannot load extensions`, { reason: "store.vector-extension-failed", cause: error instanceof Error ? error.message : String(error) });
|
|
50
|
+
} finally {
|
|
51
|
+
database.enableLoadExtension?.(false);
|
|
52
|
+
}
|
|
53
|
+
}, "loadVectorExtension");
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
vectorExtension,
|
|
57
|
+
loadVectorExtension
|
|
58
|
+
};
|