@remnic/core 9.3.579 → 9.3.581
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/access-cli.js +2 -2
- package/dist/{chunk-IOTTZLFF.js → chunk-7ZGA7YTS.js} +2 -2
- package/dist/{chunk-TDKQGLJW.js → chunk-E3VODCC3.js} +2 -2
- package/dist/chunk-E3VODCC3.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/orchestrator.js +2 -2
- package/dist/rerank.js +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/transfer/types.d.ts +12 -12
- package/package.json +1 -1
- package/src/rerank.test.ts +52 -0
- package/src/rerank.ts +8 -9
- package/dist/chunk-TDKQGLJW.js.map +0 -1
- /package/dist/{chunk-IOTTZLFF.js.map → chunk-7ZGA7YTS.js.map} +0 -0
package/dist/access-cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Orchestrator
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7ZGA7YTS.js";
|
|
4
4
|
import "./chunk-5RIRL3XL.js";
|
|
5
5
|
import "./chunk-KVEVLBKC.js";
|
|
6
6
|
import "./chunk-BFBF3XEF.js";
|
|
@@ -34,7 +34,7 @@ import "./chunk-V3RXWQIE.js";
|
|
|
34
34
|
import "./chunk-5IZL4DCV.js";
|
|
35
35
|
import "./chunk-X7XN6YU4.js";
|
|
36
36
|
import "./chunk-452WDNFO.js";
|
|
37
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-E3VODCC3.js";
|
|
38
38
|
import "./chunk-YDBIWGNI.js";
|
|
39
39
|
import "./chunk-7DHTMOND.js";
|
|
40
40
|
import "./chunk-2IT7WFYE.js";
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
import {
|
|
96
96
|
RerankCache,
|
|
97
97
|
rerankLocalOrNoop
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-E3VODCC3.js";
|
|
99
99
|
import {
|
|
100
100
|
reorderRecallResultsWithMmr
|
|
101
101
|
} from "./chunk-YDBIWGNI.js";
|
|
@@ -12405,4 +12405,4 @@ export {
|
|
|
12405
12405
|
resolvePersistedMemoryRelativePath,
|
|
12406
12406
|
Orchestrator
|
|
12407
12407
|
};
|
|
12408
|
-
//# sourceMappingURL=chunk-
|
|
12408
|
+
//# sourceMappingURL=chunk-7ZGA7YTS.js.map
|
|
@@ -47,7 +47,7 @@ function parseRerankResponse(raw, candidates) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
function stableKey(query, ids) {
|
|
50
|
-
return
|
|
50
|
+
return JSON.stringify([query.trim().toLowerCase(), ids]);
|
|
51
51
|
}
|
|
52
52
|
function clampSnippet(snippet, maxChars) {
|
|
53
53
|
const s = snippet.replace(/\s+/g, " ").trim();
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
parseRerankResponse,
|
|
115
115
|
rerankLocalOrNoop
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
117
|
+
//# sourceMappingURL=chunk-E3VODCC3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rerank.ts"],"sourcesContent":["export interface RerankCandidate {\n id: string;\n originalIndex: number;\n}\n\nexport interface RerankScore {\n id: string;\n score: number;\n}\n\nexport interface RerankCacheEntry {\n expiresAtMs: number;\n rankedIds: string[];\n}\n\nexport class RerankCache {\n private entries = new Map<string, RerankCacheEntry>();\n\n get(key: string): string[] | null {\n const e = this.entries.get(key);\n if (!e) return null;\n if (Date.now() > e.expiresAtMs) {\n this.entries.delete(key);\n return null;\n }\n return e.rankedIds.slice();\n }\n\n set(key: string, rankedIds: string[], ttlMs: number): void {\n this.entries.set(key, { rankedIds: rankedIds.slice(), expiresAtMs: Date.now() + ttlMs });\n }\n}\n\n/**\n * Parse a rerank response (JSON) and return candidates sorted by score.\n *\n * Rules:\n * - Unknown IDs in the response are ignored.\n * - Candidates missing from the response keep relative order after scored ones.\n * - Stable tie-breaker: originalIndex ascending.\n */\nexport function parseRerankResponse(\n raw: string,\n candidates: RerankCandidate[]\n): Array<RerankCandidate & { score?: number }> {\n const byId = new Map<string, RerankCandidate>();\n for (const c of candidates) byId.set(c.id, c);\n\n const scores = new Map<string, number>();\n try {\n const parsed = JSON.parse(raw) as { scores?: Array<Partial<RerankScore>> };\n if (Array.isArray(parsed.scores)) {\n for (const s of parsed.scores) {\n if (!s || typeof s.id !== \"string\") continue;\n if (!byId.has(s.id)) continue;\n if (typeof s.score !== \"number\" || !Number.isFinite(s.score)) continue;\n scores.set(s.id, s.score);\n }\n }\n } catch {\n // Ignore parse errors and fall back to original order.\n }\n\n const withScore = candidates.map((c) => ({\n ...c,\n score: scores.get(c.id),\n }));\n\n return withScore.sort((a, b) => {\n const as = a.score;\n const bs = b.score;\n if (typeof as === \"number\" && typeof bs === \"number\") {\n if (bs !== as) return bs - as;\n return a.originalIndex - b.originalIndex;\n }\n if (typeof as === \"number\") return -1;\n if (typeof bs === \"number\") return 1;\n return a.originalIndex - b.originalIndex;\n });\n}\n\nfunction stableKey(query: string, ids: string[]): string {\n // Keep candidate boundaries explicit; candidate IDs are arbitrary strings.\n return JSON.stringify([query.trim().toLowerCase(), ids]);\n}\n\nfunction clampSnippet(snippet: string, maxChars: number): string {\n const s = snippet.replace(/\\s+/g, \" \").trim();\n return s.length > maxChars ? s.slice(0, maxChars) : s;\n}\n\nexport async function rerankLocalOrNoop(opts: {\n query: string;\n candidates: Array<{ id: string; snippet: string }>;\n local: {\n chatCompletion: (\n messages: Array<{ role: string; content: string }>,\n options?: {\n maxTokens?: number;\n temperature?: number;\n timeoutMs?: number;\n operation?: string;\n priority?: \"recall-critical\" | \"background\";\n }\n ) => Promise<{ content: string } | null>;\n };\n enabled: boolean;\n timeoutMs: number;\n maxCandidates: number;\n cache?: RerankCache;\n cacheEnabled: boolean;\n cacheTtlMs: number;\n}): Promise<string[] | null> {\n if (!opts.enabled) return null;\n\n const ids = opts.candidates.slice(0, opts.maxCandidates).map((c) => c.id);\n if (ids.length <= 1) return ids;\n\n const key = stableKey(opts.query, ids);\n if (opts.cache && opts.cacheEnabled) {\n const cached = opts.cache.get(key);\n if (cached) return cached;\n }\n\n const payload = opts.candidates.slice(0, opts.maxCandidates).map((c) => ({\n id: c.id,\n snippet: clampSnippet(c.snippet, 400),\n }));\n\n const system = \"You are a ranking system. Return JSON only. No markdown, no commentary.\";\n const user = JSON.stringify(\n {\n task: \"rerank\",\n query: opts.query,\n candidates: payload,\n output: {\n scores: [{ id: \"string\", score: \"number 0-100\" }],\n },\n rules: [\n \"Assign higher score to more relevant candidates.\",\n \"Prefer durability and direct relevance to the query.\",\n \"If unsure, keep scores close together.\",\n ],\n },\n null,\n 0\n );\n\n const res = await opts.local.chatCompletion(\n [\n { role: \"system\", content: system },\n { role: \"user\", content: user },\n ],\n {\n maxTokens: 800,\n temperature: 0.0,\n timeoutMs: opts.timeoutMs,\n operation: \"rerank\",\n priority: \"recall-critical\",\n }\n );\n if (!res?.content) return null;\n\n const parsed = parseRerankResponse(\n res.content,\n ids.map((id, i) => ({ id, originalIndex: i }))\n );\n const rankedIds = parsed.map((p) => p.id);\n\n if (opts.cache && opts.cacheEnabled) {\n opts.cache.set(key, rankedIds, opts.cacheTtlMs);\n }\n\n return rankedIds;\n}\n"],"mappings":";AAeO,IAAM,cAAN,MAAkB;AAAA,EACf,UAAU,oBAAI,IAA8B;AAAA,EAEpD,IAAI,KAA8B;AAChC,UAAM,IAAI,KAAK,QAAQ,IAAI,GAAG;AAC9B,QAAI,CAAC,EAAG,QAAO;AACf,QAAI,KAAK,IAAI,IAAI,EAAE,aAAa;AAC9B,WAAK,QAAQ,OAAO,GAAG;AACvB,aAAO;AAAA,IACT;AACA,WAAO,EAAE,UAAU,MAAM;AAAA,EAC3B;AAAA,EAEA,IAAI,KAAa,WAAqB,OAAqB;AACzD,SAAK,QAAQ,IAAI,KAAK,EAAE,WAAW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,QAAS,QAAO;AAE1B,QAAM,SAAS;AAAA,IACb,IAAI;AAAA,IACJ,IAAI,IAAI,CAAC,IAAI,OAAO,EAAE,IAAI,eAAe,EAAE,EAAE;AAAA,EAC/C;AACA,QAAM,YAAY,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE;AAExC,MAAI,KAAK,SAAS,KAAK,cAAc;AACnC,SAAK,MAAM,IAAI,KAAK,WAAW,KAAK,UAAU;AAAA,EAChD;AAEA,SAAO;AACT;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
saveTaxonomy,
|
|
183
183
|
validateSlug,
|
|
184
184
|
validateTaxonomy
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-7ZGA7YTS.js";
|
|
186
186
|
import "./chunk-5RIRL3XL.js";
|
|
187
187
|
import {
|
|
188
188
|
migrateFromEngram,
|
|
@@ -232,7 +232,7 @@ import "./chunk-V3RXWQIE.js";
|
|
|
232
232
|
import "./chunk-5IZL4DCV.js";
|
|
233
233
|
import "./chunk-X7XN6YU4.js";
|
|
234
234
|
import "./chunk-452WDNFO.js";
|
|
235
|
-
import "./chunk-
|
|
235
|
+
import "./chunk-E3VODCC3.js";
|
|
236
236
|
import "./chunk-YDBIWGNI.js";
|
|
237
237
|
import "./chunk-7DHTMOND.js";
|
|
238
238
|
import "./chunk-2IT7WFYE.js";
|
package/dist/orchestrator.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
sanitizeSessionKeyForFilename,
|
|
27
27
|
shouldFilterLifecycleRecallCandidate,
|
|
28
28
|
summarizeGraphShadowComparison
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-7ZGA7YTS.js";
|
|
30
30
|
import "./chunk-5RIRL3XL.js";
|
|
31
31
|
import "./chunk-KVEVLBKC.js";
|
|
32
32
|
import "./chunk-BFBF3XEF.js";
|
|
@@ -60,7 +60,7 @@ import "./chunk-V3RXWQIE.js";
|
|
|
60
60
|
import "./chunk-5IZL4DCV.js";
|
|
61
61
|
import "./chunk-X7XN6YU4.js";
|
|
62
62
|
import "./chunk-452WDNFO.js";
|
|
63
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-E3VODCC3.js";
|
|
64
64
|
import "./chunk-YDBIWGNI.js";
|
|
65
65
|
import "./chunk-7DHTMOND.js";
|
|
66
66
|
import "./chunk-2IT7WFYE.js";
|
package/dist/rerank.js
CHANGED
package/dist/schemas.d.ts
CHANGED
|
@@ -275,12 +275,12 @@ declare const EntityMentionSchema: z.ZodObject<{
|
|
|
275
275
|
title: z.ZodString;
|
|
276
276
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
277
277
|
}, "strip", z.ZodTypeAny, {
|
|
278
|
-
title: string;
|
|
279
278
|
key: string;
|
|
279
|
+
title: string;
|
|
280
280
|
facts: string[];
|
|
281
281
|
}, {
|
|
282
|
-
title: string;
|
|
283
282
|
key: string;
|
|
283
|
+
title: string;
|
|
284
284
|
facts: string[];
|
|
285
285
|
}>, "many">>>;
|
|
286
286
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -288,8 +288,8 @@ declare const EntityMentionSchema: z.ZodObject<{
|
|
|
288
288
|
name: string;
|
|
289
289
|
facts: string[];
|
|
290
290
|
structuredSections?: {
|
|
291
|
-
title: string;
|
|
292
291
|
key: string;
|
|
292
|
+
title: string;
|
|
293
293
|
facts: string[];
|
|
294
294
|
}[] | null | undefined;
|
|
295
295
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -298,8 +298,8 @@ declare const EntityMentionSchema: z.ZodObject<{
|
|
|
298
298
|
name: string;
|
|
299
299
|
facts: string[];
|
|
300
300
|
structuredSections?: {
|
|
301
|
-
title: string;
|
|
302
301
|
key: string;
|
|
302
|
+
title: string;
|
|
303
303
|
facts: string[];
|
|
304
304
|
}[] | null | undefined;
|
|
305
305
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -584,12 +584,12 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
584
584
|
title: z.ZodString;
|
|
585
585
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
586
586
|
}, "strip", z.ZodTypeAny, {
|
|
587
|
-
title: string;
|
|
588
587
|
key: string;
|
|
588
|
+
title: string;
|
|
589
589
|
facts: string[];
|
|
590
590
|
}, {
|
|
591
|
-
title: string;
|
|
592
591
|
key: string;
|
|
592
|
+
title: string;
|
|
593
593
|
facts: string[];
|
|
594
594
|
}>, "many">>>;
|
|
595
595
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -597,8 +597,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
597
597
|
name: string;
|
|
598
598
|
facts: string[];
|
|
599
599
|
structuredSections?: {
|
|
600
|
-
title: string;
|
|
601
600
|
key: string;
|
|
601
|
+
title: string;
|
|
602
602
|
facts: string[];
|
|
603
603
|
}[] | null | undefined;
|
|
604
604
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -607,8 +607,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
607
607
|
name: string;
|
|
608
608
|
facts: string[];
|
|
609
609
|
structuredSections?: {
|
|
610
|
-
title: string;
|
|
611
610
|
key: string;
|
|
611
|
+
title: string;
|
|
612
612
|
facts: string[];
|
|
613
613
|
}[] | null | undefined;
|
|
614
614
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -665,8 +665,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
665
665
|
name: string;
|
|
666
666
|
facts: string[];
|
|
667
667
|
structuredSections?: {
|
|
668
|
-
title: string;
|
|
669
668
|
key: string;
|
|
669
|
+
title: string;
|
|
670
670
|
facts: string[];
|
|
671
671
|
}[] | null | undefined;
|
|
672
672
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -714,8 +714,8 @@ declare const ProactiveExtractionResultSchema: z.ZodObject<{
|
|
|
714
714
|
name: string;
|
|
715
715
|
facts: string[];
|
|
716
716
|
structuredSections?: {
|
|
717
|
-
title: string;
|
|
718
717
|
key: string;
|
|
718
|
+
title: string;
|
|
719
719
|
facts: string[];
|
|
720
720
|
}[] | null | undefined;
|
|
721
721
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -952,12 +952,12 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
952
952
|
title: z.ZodString;
|
|
953
953
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
954
954
|
}, "strip", z.ZodTypeAny, {
|
|
955
|
-
title: string;
|
|
956
955
|
key: string;
|
|
956
|
+
title: string;
|
|
957
957
|
facts: string[];
|
|
958
958
|
}, {
|
|
959
|
-
title: string;
|
|
960
959
|
key: string;
|
|
960
|
+
title: string;
|
|
961
961
|
facts: string[];
|
|
962
962
|
}>, "many">>>;
|
|
963
963
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -965,8 +965,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
965
965
|
name: string;
|
|
966
966
|
facts: string[];
|
|
967
967
|
structuredSections?: {
|
|
968
|
-
title: string;
|
|
969
968
|
key: string;
|
|
969
|
+
title: string;
|
|
970
970
|
facts: string[];
|
|
971
971
|
}[] | null | undefined;
|
|
972
972
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -975,8 +975,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
975
975
|
name: string;
|
|
976
976
|
facts: string[];
|
|
977
977
|
structuredSections?: {
|
|
978
|
-
title: string;
|
|
979
978
|
key: string;
|
|
979
|
+
title: string;
|
|
980
980
|
facts: string[];
|
|
981
981
|
}[] | null | undefined;
|
|
982
982
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -1047,8 +1047,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
1047
1047
|
name: string;
|
|
1048
1048
|
facts: string[];
|
|
1049
1049
|
structuredSections?: {
|
|
1050
|
-
title: string;
|
|
1051
1050
|
key: string;
|
|
1051
|
+
title: string;
|
|
1052
1052
|
facts: string[];
|
|
1053
1053
|
}[] | null | undefined;
|
|
1054
1054
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -1102,8 +1102,8 @@ declare const ExtractionResultSchema: z.ZodObject<{
|
|
|
1102
1102
|
name: string;
|
|
1103
1103
|
facts: string[];
|
|
1104
1104
|
structuredSections?: {
|
|
1105
|
-
title: string;
|
|
1106
1105
|
key: string;
|
|
1106
|
+
title: string;
|
|
1107
1107
|
facts: string[];
|
|
1108
1108
|
}[] | null | undefined;
|
|
1109
1109
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -1172,12 +1172,12 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
1172
1172
|
title: z.ZodString;
|
|
1173
1173
|
facts: z.ZodArray<z.ZodString, "many">;
|
|
1174
1174
|
}, "strip", z.ZodTypeAny, {
|
|
1175
|
-
title: string;
|
|
1176
1175
|
key: string;
|
|
1176
|
+
title: string;
|
|
1177
1177
|
facts: string[];
|
|
1178
1178
|
}, {
|
|
1179
|
-
title: string;
|
|
1180
1179
|
key: string;
|
|
1180
|
+
title: string;
|
|
1181
1181
|
facts: string[];
|
|
1182
1182
|
}>, "many">>>;
|
|
1183
1183
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1185,8 +1185,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
1185
1185
|
name: string;
|
|
1186
1186
|
facts: string[];
|
|
1187
1187
|
structuredSections?: {
|
|
1188
|
-
title: string;
|
|
1189
1188
|
key: string;
|
|
1189
|
+
title: string;
|
|
1190
1190
|
facts: string[];
|
|
1191
1191
|
}[] | null | undefined;
|
|
1192
1192
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -1195,8 +1195,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
1195
1195
|
name: string;
|
|
1196
1196
|
facts: string[];
|
|
1197
1197
|
structuredSections?: {
|
|
1198
|
-
title: string;
|
|
1199
1198
|
key: string;
|
|
1199
|
+
title: string;
|
|
1200
1200
|
facts: string[];
|
|
1201
1201
|
}[] | null | undefined;
|
|
1202
1202
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -1215,8 +1215,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
1215
1215
|
name: string;
|
|
1216
1216
|
facts: string[];
|
|
1217
1217
|
structuredSections?: {
|
|
1218
|
-
title: string;
|
|
1219
1218
|
key: string;
|
|
1219
|
+
title: string;
|
|
1220
1220
|
facts: string[];
|
|
1221
1221
|
}[] | null | undefined;
|
|
1222
1222
|
promptedByQuestion?: string | null | undefined;
|
|
@@ -1235,8 +1235,8 @@ declare const ConsolidationResultSchema: z.ZodObject<{
|
|
|
1235
1235
|
name: string;
|
|
1236
1236
|
facts: string[];
|
|
1237
1237
|
structuredSections?: {
|
|
1238
|
-
title: string;
|
|
1239
1238
|
key: string;
|
|
1239
|
+
title: string;
|
|
1240
1240
|
facts: string[];
|
|
1241
1241
|
}[] | null | undefined;
|
|
1242
1242
|
promptedByQuestion?: string | null | undefined;
|
package/dist/transfer/types.d.ts
CHANGED
|
@@ -313,13 +313,13 @@ declare const CapsuleBlockSchema: z.ZodObject<{
|
|
|
313
313
|
peerProfiles: boolean;
|
|
314
314
|
}>;
|
|
315
315
|
}, "strip", z.ZodTypeAny, {
|
|
316
|
-
schemaVersion: string;
|
|
317
316
|
includes: {
|
|
318
317
|
procedural: boolean;
|
|
319
318
|
taxonomy: boolean;
|
|
320
319
|
identityAnchors: boolean;
|
|
321
320
|
peerProfiles: boolean;
|
|
322
321
|
};
|
|
322
|
+
schemaVersion: string;
|
|
323
323
|
id: string;
|
|
324
324
|
description: string;
|
|
325
325
|
version: string;
|
|
@@ -334,13 +334,13 @@ declare const CapsuleBlockSchema: z.ZodObject<{
|
|
|
334
334
|
directAnswerEnabled: boolean;
|
|
335
335
|
};
|
|
336
336
|
}, {
|
|
337
|
-
schemaVersion: string;
|
|
338
337
|
includes: {
|
|
339
338
|
procedural: boolean;
|
|
340
339
|
taxonomy: boolean;
|
|
341
340
|
identityAnchors: boolean;
|
|
342
341
|
peerProfiles: boolean;
|
|
343
342
|
};
|
|
343
|
+
schemaVersion: string;
|
|
344
344
|
id: string;
|
|
345
345
|
description: string;
|
|
346
346
|
version: string;
|
|
@@ -464,13 +464,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
464
464
|
peerProfiles: boolean;
|
|
465
465
|
}>;
|
|
466
466
|
}, "strip", z.ZodTypeAny, {
|
|
467
|
-
schemaVersion: string;
|
|
468
467
|
includes: {
|
|
469
468
|
procedural: boolean;
|
|
470
469
|
taxonomy: boolean;
|
|
471
470
|
identityAnchors: boolean;
|
|
472
471
|
peerProfiles: boolean;
|
|
473
472
|
};
|
|
473
|
+
schemaVersion: string;
|
|
474
474
|
id: string;
|
|
475
475
|
description: string;
|
|
476
476
|
version: string;
|
|
@@ -485,13 +485,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
485
485
|
directAnswerEnabled: boolean;
|
|
486
486
|
};
|
|
487
487
|
}, {
|
|
488
|
-
schemaVersion: string;
|
|
489
488
|
includes: {
|
|
490
489
|
procedural: boolean;
|
|
491
490
|
taxonomy: boolean;
|
|
492
491
|
identityAnchors: boolean;
|
|
493
492
|
peerProfiles: boolean;
|
|
494
493
|
};
|
|
494
|
+
schemaVersion: string;
|
|
495
495
|
id: string;
|
|
496
496
|
description: string;
|
|
497
497
|
version: string;
|
|
@@ -518,13 +518,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
518
518
|
pluginVersion: string;
|
|
519
519
|
includesTranscripts: boolean;
|
|
520
520
|
capsule: {
|
|
521
|
-
schemaVersion: string;
|
|
522
521
|
includes: {
|
|
523
522
|
procedural: boolean;
|
|
524
523
|
taxonomy: boolean;
|
|
525
524
|
identityAnchors: boolean;
|
|
526
525
|
peerProfiles: boolean;
|
|
527
526
|
};
|
|
527
|
+
schemaVersion: string;
|
|
528
528
|
id: string;
|
|
529
529
|
description: string;
|
|
530
530
|
version: string;
|
|
@@ -551,13 +551,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
551
551
|
pluginVersion: string;
|
|
552
552
|
includesTranscripts: boolean;
|
|
553
553
|
capsule: {
|
|
554
|
-
schemaVersion: string;
|
|
555
554
|
includes: {
|
|
556
555
|
procedural: boolean;
|
|
557
556
|
taxonomy: boolean;
|
|
558
557
|
identityAnchors: boolean;
|
|
559
558
|
peerProfiles: boolean;
|
|
560
559
|
};
|
|
560
|
+
schemaVersion: string;
|
|
561
561
|
id: string;
|
|
562
562
|
description: string;
|
|
563
563
|
version: string;
|
|
@@ -683,13 +683,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
683
683
|
peerProfiles: boolean;
|
|
684
684
|
}>;
|
|
685
685
|
}, "strip", z.ZodTypeAny, {
|
|
686
|
-
schemaVersion: string;
|
|
687
686
|
includes: {
|
|
688
687
|
procedural: boolean;
|
|
689
688
|
taxonomy: boolean;
|
|
690
689
|
identityAnchors: boolean;
|
|
691
690
|
peerProfiles: boolean;
|
|
692
691
|
};
|
|
692
|
+
schemaVersion: string;
|
|
693
693
|
id: string;
|
|
694
694
|
description: string;
|
|
695
695
|
version: string;
|
|
@@ -704,13 +704,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
704
704
|
directAnswerEnabled: boolean;
|
|
705
705
|
};
|
|
706
706
|
}, {
|
|
707
|
-
schemaVersion: string;
|
|
708
707
|
includes: {
|
|
709
708
|
procedural: boolean;
|
|
710
709
|
taxonomy: boolean;
|
|
711
710
|
identityAnchors: boolean;
|
|
712
711
|
peerProfiles: boolean;
|
|
713
712
|
};
|
|
713
|
+
schemaVersion: string;
|
|
714
714
|
id: string;
|
|
715
715
|
description: string;
|
|
716
716
|
version: string;
|
|
@@ -737,13 +737,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
737
737
|
pluginVersion: string;
|
|
738
738
|
includesTranscripts: boolean;
|
|
739
739
|
capsule: {
|
|
740
|
-
schemaVersion: string;
|
|
741
740
|
includes: {
|
|
742
741
|
procedural: boolean;
|
|
743
742
|
taxonomy: boolean;
|
|
744
743
|
identityAnchors: boolean;
|
|
745
744
|
peerProfiles: boolean;
|
|
746
745
|
};
|
|
746
|
+
schemaVersion: string;
|
|
747
747
|
id: string;
|
|
748
748
|
description: string;
|
|
749
749
|
version: string;
|
|
@@ -770,13 +770,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
770
770
|
pluginVersion: string;
|
|
771
771
|
includesTranscripts: boolean;
|
|
772
772
|
capsule: {
|
|
773
|
-
schemaVersion: string;
|
|
774
773
|
includes: {
|
|
775
774
|
procedural: boolean;
|
|
776
775
|
taxonomy: boolean;
|
|
777
776
|
identityAnchors: boolean;
|
|
778
777
|
peerProfiles: boolean;
|
|
779
778
|
};
|
|
779
|
+
schemaVersion: string;
|
|
780
780
|
id: string;
|
|
781
781
|
description: string;
|
|
782
782
|
version: string;
|
|
@@ -815,13 +815,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
815
815
|
pluginVersion: string;
|
|
816
816
|
includesTranscripts: boolean;
|
|
817
817
|
capsule: {
|
|
818
|
-
schemaVersion: string;
|
|
819
818
|
includes: {
|
|
820
819
|
procedural: boolean;
|
|
821
820
|
taxonomy: boolean;
|
|
822
821
|
identityAnchors: boolean;
|
|
823
822
|
peerProfiles: boolean;
|
|
824
823
|
};
|
|
824
|
+
schemaVersion: string;
|
|
825
825
|
id: string;
|
|
826
826
|
description: string;
|
|
827
827
|
version: string;
|
|
@@ -854,13 +854,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
854
854
|
pluginVersion: string;
|
|
855
855
|
includesTranscripts: boolean;
|
|
856
856
|
capsule: {
|
|
857
|
-
schemaVersion: string;
|
|
858
857
|
includes: {
|
|
859
858
|
procedural: boolean;
|
|
860
859
|
taxonomy: boolean;
|
|
861
860
|
identityAnchors: boolean;
|
|
862
861
|
peerProfiles: boolean;
|
|
863
862
|
};
|
|
863
|
+
schemaVersion: string;
|
|
864
864
|
id: string;
|
|
865
865
|
description: string;
|
|
866
866
|
version: string;
|
package/package.json
CHANGED
package/src/rerank.test.ts
CHANGED
|
@@ -86,3 +86,55 @@ test("rerankLocalOrNoop cache is isolated from caller mutations", async () => {
|
|
|
86
86
|
assert.deepEqual(second, ["a", "b"]);
|
|
87
87
|
assert.equal(calls, 1);
|
|
88
88
|
});
|
|
89
|
+
|
|
90
|
+
test("rerankLocalOrNoop cache keys distinguish candidate IDs containing commas", async () => {
|
|
91
|
+
let calls = 0;
|
|
92
|
+
const cache = new RerankCache();
|
|
93
|
+
const commonOptions = {
|
|
94
|
+
query: "API rate limit issue",
|
|
95
|
+
local: {
|
|
96
|
+
async chatCompletion() {
|
|
97
|
+
calls += 1;
|
|
98
|
+
return {
|
|
99
|
+
content: JSON.stringify({
|
|
100
|
+
scores:
|
|
101
|
+
calls === 1
|
|
102
|
+
? [
|
|
103
|
+
{ id: "c", score: 90 },
|
|
104
|
+
{ id: "a,b", score: 10 },
|
|
105
|
+
]
|
|
106
|
+
: [
|
|
107
|
+
{ id: "b,c", score: 90 },
|
|
108
|
+
{ id: "a", score: 10 },
|
|
109
|
+
],
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
enabled: true,
|
|
115
|
+
timeoutMs: 1_500,
|
|
116
|
+
maxCandidates: 5,
|
|
117
|
+
cache,
|
|
118
|
+
cacheEnabled: true,
|
|
119
|
+
cacheTtlMs: 60_000,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const first = await rerankLocalOrNoop({
|
|
123
|
+
...commonOptions,
|
|
124
|
+
candidates: [
|
|
125
|
+
{ id: "a,b", snippet: "API rate limit is 1000 requests per minute." },
|
|
126
|
+
{ id: "c", snippet: "Deployment note." },
|
|
127
|
+
],
|
|
128
|
+
});
|
|
129
|
+
assert.deepEqual(first, ["c", "a,b"]);
|
|
130
|
+
|
|
131
|
+
const second = await rerankLocalOrNoop({
|
|
132
|
+
...commonOptions,
|
|
133
|
+
candidates: [
|
|
134
|
+
{ id: "a", snippet: "API rate limit is 1000 requests per minute." },
|
|
135
|
+
{ id: "b,c", snippet: "Deployment note." },
|
|
136
|
+
],
|
|
137
|
+
});
|
|
138
|
+
assert.deepEqual(second, ["b,c", "a"]);
|
|
139
|
+
assert.equal(calls, 2);
|
|
140
|
+
});
|
package/src/rerank.ts
CHANGED
|
@@ -41,7 +41,7 @@ export class RerankCache {
|
|
|
41
41
|
*/
|
|
42
42
|
export function parseRerankResponse(
|
|
43
43
|
raw: string,
|
|
44
|
-
candidates: RerankCandidate[]
|
|
44
|
+
candidates: RerankCandidate[]
|
|
45
45
|
): Array<RerankCandidate & { score?: number }> {
|
|
46
46
|
const byId = new Map<string, RerankCandidate>();
|
|
47
47
|
for (const c of candidates) byId.set(c.id, c);
|
|
@@ -80,8 +80,8 @@ export function parseRerankResponse(
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function stableKey(query: string, ids: string[]): string {
|
|
83
|
-
// Keep
|
|
84
|
-
return
|
|
83
|
+
// Keep candidate boundaries explicit; candidate IDs are arbitrary strings.
|
|
84
|
+
return JSON.stringify([query.trim().toLowerCase(), ids]);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
function clampSnippet(snippet: string, maxChars: number): string {
|
|
@@ -101,7 +101,7 @@ export async function rerankLocalOrNoop(opts: {
|
|
|
101
101
|
timeoutMs?: number;
|
|
102
102
|
operation?: string;
|
|
103
103
|
priority?: "recall-critical" | "background";
|
|
104
|
-
}
|
|
104
|
+
}
|
|
105
105
|
) => Promise<{ content: string } | null>;
|
|
106
106
|
};
|
|
107
107
|
enabled: boolean;
|
|
@@ -127,8 +127,7 @@ export async function rerankLocalOrNoop(opts: {
|
|
|
127
127
|
snippet: clampSnippet(c.snippet, 400),
|
|
128
128
|
}));
|
|
129
129
|
|
|
130
|
-
const system =
|
|
131
|
-
"You are a ranking system. Return JSON only. No markdown, no commentary.";
|
|
130
|
+
const system = "You are a ranking system. Return JSON only. No markdown, no commentary.";
|
|
132
131
|
const user = JSON.stringify(
|
|
133
132
|
{
|
|
134
133
|
task: "rerank",
|
|
@@ -144,7 +143,7 @@ export async function rerankLocalOrNoop(opts: {
|
|
|
144
143
|
],
|
|
145
144
|
},
|
|
146
145
|
null,
|
|
147
|
-
0
|
|
146
|
+
0
|
|
148
147
|
);
|
|
149
148
|
|
|
150
149
|
const res = await opts.local.chatCompletion(
|
|
@@ -158,13 +157,13 @@ export async function rerankLocalOrNoop(opts: {
|
|
|
158
157
|
timeoutMs: opts.timeoutMs,
|
|
159
158
|
operation: "rerank",
|
|
160
159
|
priority: "recall-critical",
|
|
161
|
-
}
|
|
160
|
+
}
|
|
162
161
|
);
|
|
163
162
|
if (!res?.content) return null;
|
|
164
163
|
|
|
165
164
|
const parsed = parseRerankResponse(
|
|
166
165
|
res.content,
|
|
167
|
-
ids.map((id, i) => ({ id, originalIndex: i }))
|
|
166
|
+
ids.map((id, i) => ({ id, originalIndex: i }))
|
|
168
167
|
);
|
|
169
168
|
const rankedIds = parsed.map((p) => p.id);
|
|
170
169
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rerank.ts"],"sourcesContent":["export interface RerankCandidate {\n id: string;\n originalIndex: number;\n}\n\nexport interface RerankScore {\n id: string;\n score: number;\n}\n\nexport interface RerankCacheEntry {\n expiresAtMs: number;\n rankedIds: string[];\n}\n\nexport class RerankCache {\n private entries = new Map<string, RerankCacheEntry>();\n\n get(key: string): string[] | null {\n const e = this.entries.get(key);\n if (!e) return null;\n if (Date.now() > e.expiresAtMs) {\n this.entries.delete(key);\n return null;\n }\n return e.rankedIds.slice();\n }\n\n set(key: string, rankedIds: string[], ttlMs: number): void {\n this.entries.set(key, { rankedIds: rankedIds.slice(), expiresAtMs: Date.now() + ttlMs });\n }\n}\n\n/**\n * Parse a rerank response (JSON) and return candidates sorted by score.\n *\n * Rules:\n * - Unknown IDs in the response are ignored.\n * - Candidates missing from the response keep relative order after scored ones.\n * - Stable tie-breaker: originalIndex ascending.\n */\nexport function parseRerankResponse(\n raw: string,\n candidates: RerankCandidate[],\n): Array<RerankCandidate & { score?: number }> {\n const byId = new Map<string, RerankCandidate>();\n for (const c of candidates) byId.set(c.id, c);\n\n const scores = new Map<string, number>();\n try {\n const parsed = JSON.parse(raw) as { scores?: Array<Partial<RerankScore>> };\n if (Array.isArray(parsed.scores)) {\n for (const s of parsed.scores) {\n if (!s || typeof s.id !== \"string\") continue;\n if (!byId.has(s.id)) continue;\n if (typeof s.score !== \"number\" || !Number.isFinite(s.score)) continue;\n scores.set(s.id, s.score);\n }\n }\n } catch {\n // Ignore parse errors and fall back to original order.\n }\n\n const withScore = candidates.map((c) => ({\n ...c,\n score: scores.get(c.id),\n }));\n\n return withScore.sort((a, b) => {\n const as = a.score;\n const bs = b.score;\n if (typeof as === \"number\" && typeof bs === \"number\") {\n if (bs !== as) return bs - as;\n return a.originalIndex - b.originalIndex;\n }\n if (typeof as === \"number\") return -1;\n if (typeof bs === \"number\") return 1;\n return a.originalIndex - b.originalIndex;\n });\n}\n\nfunction stableKey(query: string, ids: string[]): string {\n // Keep it simple and deterministic; this is not a security boundary.\n return `${query.trim().toLowerCase()}|${ids.join(\",\")}`;\n}\n\nfunction clampSnippet(snippet: string, maxChars: number): string {\n const s = snippet.replace(/\\s+/g, \" \").trim();\n return s.length > maxChars ? s.slice(0, maxChars) : s;\n}\n\nexport async function rerankLocalOrNoop(opts: {\n query: string;\n candidates: Array<{ id: string; snippet: string }>;\n local: {\n chatCompletion: (\n messages: Array<{ role: string; content: string }>,\n options?: {\n maxTokens?: number;\n temperature?: number;\n timeoutMs?: number;\n operation?: string;\n priority?: \"recall-critical\" | \"background\";\n },\n ) => Promise<{ content: string } | null>;\n };\n enabled: boolean;\n timeoutMs: number;\n maxCandidates: number;\n cache?: RerankCache;\n cacheEnabled: boolean;\n cacheTtlMs: number;\n}): Promise<string[] | null> {\n if (!opts.enabled) return null;\n\n const ids = opts.candidates.slice(0, opts.maxCandidates).map((c) => c.id);\n if (ids.length <= 1) return ids;\n\n const key = stableKey(opts.query, ids);\n if (opts.cache && opts.cacheEnabled) {\n const cached = opts.cache.get(key);\n if (cached) return cached;\n }\n\n const payload = opts.candidates.slice(0, opts.maxCandidates).map((c) => ({\n id: c.id,\n snippet: clampSnippet(c.snippet, 400),\n }));\n\n const system =\n \"You are a ranking system. Return JSON only. No markdown, no commentary.\";\n const user = JSON.stringify(\n {\n task: \"rerank\",\n query: opts.query,\n candidates: payload,\n output: {\n scores: [{ id: \"string\", score: \"number 0-100\" }],\n },\n rules: [\n \"Assign higher score to more relevant candidates.\",\n \"Prefer durability and direct relevance to the query.\",\n \"If unsure, keep scores close together.\",\n ],\n },\n null,\n 0,\n );\n\n const res = await opts.local.chatCompletion(\n [\n { role: \"system\", content: system },\n { role: \"user\", content: user },\n ],\n {\n maxTokens: 800,\n temperature: 0.0,\n timeoutMs: opts.timeoutMs,\n operation: \"rerank\",\n priority: \"recall-critical\",\n },\n );\n if (!res?.content) return null;\n\n const parsed = parseRerankResponse(\n res.content,\n ids.map((id, i) => ({ id, originalIndex: i })),\n );\n const rankedIds = parsed.map((p) => p.id);\n\n if (opts.cache && opts.cacheEnabled) {\n opts.cache.set(key, rankedIds, opts.cacheTtlMs);\n }\n\n return rankedIds;\n}\n"],"mappings":";AAeO,IAAM,cAAN,MAAkB;AAAA,EACf,UAAU,oBAAI,IAA8B;AAAA,EAEpD,IAAI,KAA8B;AAChC,UAAM,IAAI,KAAK,QAAQ,IAAI,GAAG;AAC9B,QAAI,CAAC,EAAG,QAAO;AACf,QAAI,KAAK,IAAI,IAAI,EAAE,aAAa;AAC9B,WAAK,QAAQ,OAAO,GAAG;AACvB,aAAO;AAAA,IACT;AACA,WAAO,EAAE,UAAU,MAAM;AAAA,EAC3B;AAAA,EAEA,IAAI,KAAa,WAAqB,OAAqB;AACzD,SAAK,QAAQ,IAAI,KAAK,EAAE,WAAW,UAAU,M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