@askexenow/exe-os 0.9.269 → 0.9.270
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/deploy/compose/.env.customer.example +2 -0
- package/deploy/compose/.env.default +1 -0
- package/deploy/compose/.env.example +2 -0
- package/deploy/compose/docker-compose.yml +1 -0
- package/deploy/compose/generate-env.ts +5 -0
- package/deploy/compose/init-db.sql +236 -56
- package/dist/bin/cli.js +1 -1
- package/dist/bin/exe-forget.js +1 -1
- package/dist/bin/exe-new-employee.js +1 -1
- package/dist/bin/exe-search.js +1 -1
- package/dist/bin/exe-start.sh +28 -1
- package/dist/bin/install.js +1 -1
- package/dist/bin/setup.js +1 -1
- package/dist/bin/stack-update.js +2 -2
- package/dist/bin/vps-health-gate.js +1 -1
- package/dist/catchup-brief-7G3HIQT3.js +151 -0
- package/dist/catchup-brief-IA2K5RYM.js +151 -0
- package/dist/catchup-brief-KABFKY7U.js +151 -0
- package/dist/chunk-4GJHWD4H.js +1148 -0
- package/dist/chunk-6H7PZOYD.js +58 -0
- package/dist/chunk-AQU2CVD4.js +1148 -0
- package/dist/chunk-AX6EKVRZ.js +13696 -0
- package/dist/chunk-DFI2IZXM.js +1395 -0
- package/dist/chunk-EM4EYF3P.js +149 -0
- package/dist/chunk-F7RM3Z4R.js +230 -0
- package/dist/chunk-LMYSCMSQ.js +1148 -0
- package/dist/chunk-RJVFHGFD.js +13696 -0
- package/dist/chunk-U2O2UXVQ.js +13696 -0
- package/dist/chunk-X56OLWQS.js +58 -0
- package/dist/chunk-YYO5RQRT.js +1021 -0
- package/dist/chunk-ZFHXFDWX.js +58 -0
- package/dist/hooks/error-recall.js +1 -1
- package/dist/hooks/manifest.json +4 -4
- package/dist/hooks/prompt-submit.js +1 -1
- package/dist/hooks/session-start.js +1 -1
- package/dist/lib/exe-daemon.js +49 -3
- package/dist/lib/hybrid-search.js +1 -1
- package/dist/lib/session-wrappers.js +1 -1
- package/dist/mcp/register-tools.js +3 -3
- package/dist/mcp/server.js +3 -3
- package/dist/reranker-7GCUQ6LC.js +19 -0
- package/dist/reranker-NLH3VBTN.js +19 -0
- package/dist/reranker-RUOD4YHZ.js +19 -0
- package/dist/setup-wizard-M7A7MXH4.js +12 -0
- package/dist/stack-update-MYPMZQEI.js +52 -0
- package/dist/task-enforcement-CJKWU43B.js +364 -0
- package/dist/task-enforcement-FYDLTS3R.js +391 -0
- package/dist/task-enforcement-YXKZYS5L.js +369 -0
- package/package.json +1 -1
- package/release-notes.json +33 -14
- package/stack.release.json +48 -48
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MODELS_DIR
|
|
3
|
+
} from "./chunk-VXIMSRTO.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/reranker.ts
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { existsSync } from "fs";
|
|
8
|
+
var RERANKER_MODEL_FILE = "jina-reranker-v3-q4_k_m.gguf";
|
|
9
|
+
function isRerankerAvailable() {
|
|
10
|
+
return existsSync(path.join(MODELS_DIR, RERANKER_MODEL_FILE));
|
|
11
|
+
}
|
|
12
|
+
function getRerankerModelPath() {
|
|
13
|
+
return path.join(MODELS_DIR, RERANKER_MODEL_FILE);
|
|
14
|
+
}
|
|
15
|
+
async function disposeReranker() {
|
|
16
|
+
}
|
|
17
|
+
async function rerankWithScores(query, texts, topK) {
|
|
18
|
+
if (texts.length === 0) return [];
|
|
19
|
+
const { rerankViaWorker } = await import("./lib/exe-daemon.js");
|
|
20
|
+
const scored = await rerankViaWorker(query, texts, topK);
|
|
21
|
+
return scored.map((s) => ({
|
|
22
|
+
text: texts[s.index] ?? "",
|
|
23
|
+
score: s.score,
|
|
24
|
+
index: s.index
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
async function rerank(query, candidates, topK = 5) {
|
|
28
|
+
if (candidates.length === 0) return [];
|
|
29
|
+
if (candidates.length <= topK) return candidates;
|
|
30
|
+
const scored = await rerankWithScores(
|
|
31
|
+
query,
|
|
32
|
+
candidates.map((c) => c.raw_text),
|
|
33
|
+
topK
|
|
34
|
+
);
|
|
35
|
+
return scored.map((s) => candidates[s.index]);
|
|
36
|
+
}
|
|
37
|
+
async function rerankWithContext(query, candidates, topK) {
|
|
38
|
+
if (candidates.length === 0) return [];
|
|
39
|
+
const formattedTexts = candidates.map(
|
|
40
|
+
(c) => c.context ? `[${c.context}] ${c.text.slice(0, 460)}` : c.text.slice(0, 512)
|
|
41
|
+
);
|
|
42
|
+
const { rerankViaWorker } = await import("./lib/exe-daemon.js");
|
|
43
|
+
const scored = await rerankViaWorker(query, formattedTexts, topK);
|
|
44
|
+
return scored.map((s) => ({
|
|
45
|
+
text: candidates[s.index]?.text ?? "",
|
|
46
|
+
score: s.score,
|
|
47
|
+
index: s.index
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
isRerankerAvailable,
|
|
53
|
+
getRerankerModelPath,
|
|
54
|
+
disposeReranker,
|
|
55
|
+
rerankWithScores,
|
|
56
|
+
rerank,
|
|
57
|
+
rerankWithContext
|
|
58
|
+
};
|