@wirecat/cli-template 0.8.0 → 0.10.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 +3 -3
- package/.github/workflows/release.yml +63 -0
- package/.gitleaks.toml +18 -0
- package/AGENTS.md +9 -15
- package/CHANGELOG.md +87 -1
- package/README.md +4 -3
- package/bin/release +5 -3
- package/contracts/plan.json +2 -2
- package/dist/bin/clidev.js +34 -12
- package/dist/bundle/all-profiles-XHC7BG3P.js +24 -0
- package/dist/bundle/anthropic-N6B3ZZHQ.js +70 -0
- package/dist/bundle/bun-HUJLS7KP.js +169 -0
- package/dist/bundle/bun-sqlite-OWFO2TVR.js +69 -0
- package/dist/bundle/chunk-222FANS2.js +161 -0
- package/dist/bundle/chunk-2CFBHYFA.js +884 -0
- package/dist/bundle/chunk-2KQZ24GI.js +82 -0
- package/dist/bundle/chunk-2TBVT4SZ.js +31 -0
- package/dist/bundle/chunk-437W3Z2M.js +76 -0
- package/dist/bundle/chunk-4QRLPOJ7.js +18 -0
- package/dist/bundle/chunk-54AJONOM.js +54 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-6CBWO7OF.js +73 -0
- package/dist/bundle/chunk-75LVQQEK.js +35782 -0
- package/dist/bundle/chunk-7RB76E2L.js +264 -0
- package/dist/bundle/chunk-7RXBN7HP.js +63 -0
- package/dist/bundle/chunk-ABP7FDMJ.js +122 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AP7QKYBG.js +3531 -0
- package/dist/bundle/chunk-ASMH7JWZ.js +288 -0
- package/dist/bundle/chunk-B4EED2RF.js +100 -0
- package/dist/bundle/chunk-B4LM2B6F.js +1900 -0
- package/dist/bundle/chunk-BDSDQCV4.js +281 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DMCN22H6.js +35 -0
- package/dist/bundle/chunk-E42W72PQ.js +151 -0
- package/dist/bundle/chunk-EFHLQXG6.js +5104 -0
- package/dist/bundle/chunk-FIHDGZIB.js +34352 -0
- package/dist/bundle/chunk-FWVKHD2L.js +48 -0
- package/dist/bundle/chunk-FXS3X76A.js +193 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IJ3IA7EK.js +24 -0
- package/dist/bundle/chunk-JEBSORH7.js +3379 -0
- package/dist/bundle/chunk-JTTW5ZKF.js +45 -0
- package/dist/bundle/chunk-LSEF4QC3.js +3075 -0
- package/dist/bundle/chunk-LY7GS2YI.js +58 -0
- package/dist/bundle/chunk-MFS52LTZ.js +570 -0
- package/dist/bundle/chunk-MNSD5BX2.js +78 -0
- package/dist/bundle/chunk-MTGLJCAZ.js +24 -0
- package/dist/bundle/chunk-MZVV2JZT.js +744 -0
- package/dist/bundle/chunk-NE3NSB5O.js +8341 -0
- package/dist/bundle/chunk-NTLPDH76.js +440 -0
- package/dist/bundle/chunk-O3PBQVAB.js +447 -0
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/chunk-O5LMDQTO.js +82 -0
- package/dist/bundle/chunk-OPJ24VGH.js +1028 -0
- package/dist/bundle/chunk-OPPMGPFW.js +164 -0
- package/dist/bundle/chunk-QGNNMPUB.js +158 -0
- package/dist/bundle/chunk-QVJLOUQB.js +2 -0
- package/dist/bundle/chunk-S57AMKLX.js +6848 -0
- package/dist/bundle/chunk-TARN7CHN.js +215 -0
- package/dist/bundle/chunk-TJLGI3N6.js +1095 -0
- package/dist/bundle/chunk-VMTM46FH.js +7532 -0
- package/dist/bundle/chunk-W2IDKBNB.js +2315 -0
- package/dist/bundle/chunk-XFXBXQBS.js +630 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/clidev.js +22 -0
- package/dist/bundle/command-contract-PEM3S634.js +29 -0
- package/dist/bundle/dist-ESHIQU4M.js +7577 -0
- package/dist/bundle/echarts-2QGL2JP5.js +42501 -0
- package/dist/bundle/embed-HHAAGHA6.js +35 -0
- package/dist/bundle/embedder-W2OGVVYH.js +108 -0
- package/dist/bundle/first-run-WCJUDUBU.js +23 -0
- package/dist/bundle/first-screen-U4DFUKUC.js +27 -0
- package/dist/bundle/instructions-OTZHT6NV.js +9 -0
- package/dist/bundle/mcp-OQBZXELQ.js +165 -0
- package/dist/bundle/mcp-VVF6J7SQ.js +151 -0
- package/dist/bundle/mcp-Y7VCIZ2J.js +78 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-SYD4GX5O.js +176 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-X2DGRFOZ.js +45 -0
- package/dist/bundle/oauth-42M34GQ5.js +17 -0
- package/dist/bundle/open-SWXRCDLN.js +19 -0
- package/dist/bundle/process-KAFGXZ7Q.js +91 -0
- package/dist/bundle/program-EHR4G7VN.js +16967 -0
- package/dist/bundle/prompt-ZQTMHRGX.js +12 -0
- package/dist/bundle/recognize-TTED4SE3.js +190 -0
- package/dist/bundle/remote-C37XJ4BP.js +26 -0
- package/dist/bundle/rerank-APFZAMQL.js +49 -0
- package/dist/bundle/serve-DDPIHDVZ.js +19 -0
- package/dist/bundle/server-L5GNG7KC.js +793 -0
- package/dist/bundle/server-LKVYA2AE.js +39 -0
- package/dist/bundle/state-WWPPHERF.js +33 -0
- package/dist/bundle/store-H6UIA4PK.js +120 -0
- package/dist/bundle/store-maintenance-command-EYBT64A2.js +40 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +45 -30
- package/dist/commands/mcp.js.map +1 -1
- 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 +38 -22
- package/docs/dev/TESTING.md +14 -3
- package/docs/dev/reference-clis.md +17 -9
- package/docs/dev/skills/release/SKILL.md +9 -6
- package/docs/dev/skills/release/fresh-audit.md +4 -0
- package/docs/dev/test-matrix.md +10 -11
- package/docs/security.md +4 -0
- package/docs/usage.md +7 -6
- package/kit/dist/new.js +17 -2
- package/package.json +7 -5
- package/scripts/audit.sh +5 -3
- package/scripts/smoke-bundle.ts +63 -0
- package/scripts/test-matrix-untested.ts +4 -10
- 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/commands/mcp.ts +54 -33
- package/src/mcp-http.test.ts +20 -13
- package/src/mcp.test.ts +3 -3
- package/src/program.test.ts +8 -2
- package/src/roots.test.ts +2 -7
- package/src/version.ts +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
readSecret
|
|
5
|
+
} from "./chunk-2KQZ24GI.js";
|
|
6
|
+
import "./chunk-O5LMDQTO.js";
|
|
7
|
+
import "./chunk-EFHLQXG6.js";
|
|
8
|
+
import "./chunk-Y5E2WNWB.js";
|
|
9
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
10
|
+
export {
|
|
11
|
+
readSecret
|
|
12
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
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.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/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.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/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
|
+
export {
|
|
184
|
+
SAMPLE_RATE,
|
|
185
|
+
decodeOgg,
|
|
186
|
+
detector,
|
|
187
|
+
loadSherpa,
|
|
188
|
+
openRecognizer,
|
|
189
|
+
toModelRate
|
|
190
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_OPENAI_MODEL,
|
|
5
|
+
OPENAI_MODELS,
|
|
6
|
+
OPENAI_URL,
|
|
7
|
+
isLocal,
|
|
8
|
+
openRemote,
|
|
9
|
+
remoteKey,
|
|
10
|
+
remoteModel
|
|
11
|
+
} from "./chunk-ABP7FDMJ.js";
|
|
12
|
+
import "./chunk-OPJ24VGH.js";
|
|
13
|
+
import "./chunk-7RB76E2L.js";
|
|
14
|
+
import "./chunk-4QRLPOJ7.js";
|
|
15
|
+
import "./chunk-EFHLQXG6.js";
|
|
16
|
+
import "./chunk-Y5E2WNWB.js";
|
|
17
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
18
|
+
export {
|
|
19
|
+
DEFAULT_OPENAI_MODEL,
|
|
20
|
+
OPENAI_MODELS,
|
|
21
|
+
OPENAI_URL,
|
|
22
|
+
isLocal,
|
|
23
|
+
openRemote,
|
|
24
|
+
remoteKey,
|
|
25
|
+
remoteModel
|
|
26
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
defaultThreads,
|
|
5
|
+
loadModel,
|
|
6
|
+
truncated
|
|
7
|
+
} from "./chunk-OPJ24VGH.js";
|
|
8
|
+
import "./chunk-7RB76E2L.js";
|
|
9
|
+
import "./chunk-4QRLPOJ7.js";
|
|
10
|
+
import "./chunk-EFHLQXG6.js";
|
|
11
|
+
import "./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_esbuild@0.28.2_type_9d12b0091b773232c527328da5835651/node_modules/@wirecat/cli-core/dist/embeddings/rerank.js
|
|
17
|
+
var openReranker = /* @__PURE__ */ __name(async (model, directory, { threads = defaultThreads() } = {}) => {
|
|
18
|
+
const { ort, tokenizer, session } = await loadModel(model, directory, threads);
|
|
19
|
+
const typeIds = session.inputNames.includes("token_type_ids");
|
|
20
|
+
const output = session.outputNames[0];
|
|
21
|
+
const one = /* @__PURE__ */ __name(async (question, passage) => {
|
|
22
|
+
const encoded = tokenizer.encode(question, { text_pair: passage, return_token_type_ids: true });
|
|
23
|
+
const ids = truncated(encoded.ids, model.maxTokens);
|
|
24
|
+
const shape = [1, ids.length];
|
|
25
|
+
const feeds = {
|
|
26
|
+
input_ids: new ort.Tensor("int64", BigInt64Array.from(ids, BigInt), shape),
|
|
27
|
+
attention_mask: new ort.Tensor("int64", new BigInt64Array(ids.length).fill(1n), shape)
|
|
28
|
+
};
|
|
29
|
+
if (typeIds)
|
|
30
|
+
feeds.token_type_ids = new ort.Tensor("int64", BigInt64Array.from(truncated(encoded.token_type_ids, model.maxTokens), BigInt), shape);
|
|
31
|
+
const logit = (await session.run(feeds))[output]?.data[0];
|
|
32
|
+
if (typeof logit !== "number" || !Number.isFinite(logit))
|
|
33
|
+
throw new Error(`${model.id} gave no score`);
|
|
34
|
+
return logit;
|
|
35
|
+
}, "one");
|
|
36
|
+
return {
|
|
37
|
+
model,
|
|
38
|
+
score: /* @__PURE__ */ __name(async (question, passages) => {
|
|
39
|
+
const scores = [];
|
|
40
|
+
for (const passage of passages)
|
|
41
|
+
scores.push(await one(question, passage));
|
|
42
|
+
return scores;
|
|
43
|
+
}, "score"),
|
|
44
|
+
close: /* @__PURE__ */ __name(() => session.release(), "close")
|
|
45
|
+
};
|
|
46
|
+
}, "openReranker");
|
|
47
|
+
export {
|
|
48
|
+
openReranker
|
|
49
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
MCP_PATH,
|
|
5
|
+
serveOverHttp
|
|
6
|
+
} from "./chunk-FXS3X76A.js";
|
|
7
|
+
import "./chunk-MNSD5BX2.js";
|
|
8
|
+
import "./chunk-ASMH7JWZ.js";
|
|
9
|
+
import "./chunk-5D4AEUVA.js";
|
|
10
|
+
import "./chunk-222FANS2.js";
|
|
11
|
+
import "./chunk-6CBWO7OF.js";
|
|
12
|
+
import "./chunk-7RXBN7HP.js";
|
|
13
|
+
import "./chunk-EFHLQXG6.js";
|
|
14
|
+
import "./chunk-Y5E2WNWB.js";
|
|
15
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
16
|
+
export {
|
|
17
|
+
MCP_PATH,
|
|
18
|
+
serveOverHttp
|
|
19
|
+
};
|