@hydradb/mcp 1.1.1 → 1.2.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/CHANGELOG.md +167 -0
- package/README.md +92 -34
- package/dist/adapters.d.ts +27 -16
- package/dist/adapters.js +58 -54
- package/dist/adapters.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.js +27 -1
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +43 -3
- package/dist/context.js +374 -34
- package/dist/context.js.map +1 -1
- package/dist/descriptions.d.ts +55 -28
- package/dist/descriptions.js +198 -52
- package/dist/descriptions.js.map +1 -1
- package/dist/hydra/client.d.ts +62 -7
- package/dist/hydra/client.js +102 -20
- package/dist/hydra/client.js.map +1 -1
- package/dist/hydra/errors.js +91 -6
- package/dist/hydra/errors.js.map +1 -1
- package/dist/hydra/index.d.ts +2 -2
- package/dist/hydra/index.js +1 -1
- package/dist/hydra/index.js.map +1 -1
- package/dist/index.js +97 -10
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +18 -1
- package/dist/server.js +973 -103
- package/dist/server.js.map +1 -1
- package/dist/tool-names.d.ts +2 -1
- package/dist/tool-names.js +2 -0
- package/dist/tool-names.js.map +1 -1
- package/dist/types.d.ts +8 -51
- package/dist/types.js +6 -5
- package/dist/types.js.map +1 -1
- package/package.json +11 -6
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAE1C,uEAAuE;AACvE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;AACrC,SAAS,WAAW,CAAC,OAAe;IACnC,OAAO,CAAC,KAAK,CAAC,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
|
+
import type { HydraDB as SDK } from "@hydradb/sdk";
|
|
2
|
+
/**
|
|
3
|
+
* The renderer reads SDK payloads directly.
|
|
4
|
+
*
|
|
5
|
+
* There used to be a snake_case mirror of every one of these shapes in
|
|
6
|
+
* `src/types.ts`, with adapters mapping the SDK's camelCase onto it purely so
|
|
7
|
+
* this file could keep its original field names. That bought nothing and cost a
|
|
8
|
+
* translation layer that had to be kept in step with the SDK by hand — and did
|
|
9
|
+
* silently drop a field once (`sourceChunkIds`).
|
|
10
|
+
*
|
|
11
|
+
* Triplet innards stay snake_case even here: the SDK types `relation`/`source`/
|
|
12
|
+
* `target` as `Record<string, unknown>`, so the wire shape passes through
|
|
13
|
+
* untouched and `formatTriplet` needs no translation either.
|
|
14
|
+
*/
|
|
15
|
+
type RecallResponse = SDK.SearchV2RetrievalResult;
|
|
16
|
+
/**
|
|
17
|
+
* How many chunks the renderer will actually emit.
|
|
18
|
+
*
|
|
19
|
+
* The caller needs this for its "Found N" header. Reporting the raw chunk count
|
|
20
|
+
* there while the body shows fewer is the same disagreement the removed summary
|
|
21
|
+
* block had, reintroduced by deduping.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderedChunkCount(response: RecallResponse): number;
|
|
24
|
+
export declare function renderRecalledContext(response: RecallResponse, opts?: Parameters<typeof buildRecalledContext>[1]): {
|
|
25
|
+
text: string;
|
|
26
|
+
shown: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function buildRecalledContext(response: RecallResponse, opts?: Parameters<typeof render>[1]): string;
|
|
29
|
+
declare function render(response: RecallResponse, opts?: {
|
|
3
30
|
maxGroupOccurrences?: number;
|
|
4
31
|
minEvidenceScore?: number;
|
|
5
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Per-chunk body ceiling. Unset renders every chunk in full, which is what
|
|
34
|
+
* `detail: "full"` asks for.
|
|
35
|
+
*/
|
|
36
|
+
maxChunkChars?: number;
|
|
37
|
+
/** Drop the Extra Context blocks entirely (compact mode). */
|
|
38
|
+
includeExtraContext?: boolean;
|
|
39
|
+
/** Total character ceiling for the whole rendering. */
|
|
40
|
+
maxTotalChars?: number;
|
|
41
|
+
}): {
|
|
42
|
+
text: string;
|
|
43
|
+
shown: number;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
package/dist/context.js
CHANGED
|
@@ -1,3 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A chunk's readable text, unwrapping the v2 source envelope when present.
|
|
3
|
+
*
|
|
4
|
+
* Ingest can store a chunk whose body is the serialised source record rather
|
|
5
|
+
* than the text itself:
|
|
6
|
+
*
|
|
7
|
+
* {"id":"s9","tenant_id":"t","content":{"text":"the actual body"}}
|
|
8
|
+
*
|
|
9
|
+
* Rendered verbatim, that ships ids, tenant identifiers and JSON punctuation
|
|
10
|
+
* into the prompt in place of the content, and the reader has to parse it back
|
|
11
|
+
* out. The SDK's own renderer unwraps this (`dist/helpers/buildString.js`);
|
|
12
|
+
* this port keeps the behaviour without taking the rest of that helper, which
|
|
13
|
+
* drops the evidence-score filter, extra context and `raw_predicate` handling
|
|
14
|
+
* below.
|
|
15
|
+
*
|
|
16
|
+
* The wire format is snake_case regardless of SDK casing, so the keys checked
|
|
17
|
+
* here are the wire ones. Anything that does not match the envelope shape is
|
|
18
|
+
* returned untouched — a chunk that legitimately begins and ends with braces is
|
|
19
|
+
* left alone.
|
|
20
|
+
*/
|
|
21
|
+
function extractChunkText(chunkContent) {
|
|
22
|
+
if (!chunkContent)
|
|
23
|
+
return "";
|
|
24
|
+
const trimmed = chunkContent.trim();
|
|
25
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}"))
|
|
26
|
+
return trimmed;
|
|
27
|
+
let parsed;
|
|
28
|
+
try {
|
|
29
|
+
parsed = JSON.parse(trimmed);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return trimmed;
|
|
33
|
+
}
|
|
34
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
35
|
+
return trimmed;
|
|
36
|
+
// Unwrap ONLY when nothing would be lost by doing so.
|
|
37
|
+
//
|
|
38
|
+
// A nested `content.text` is not evidence of an envelope, and neither is an
|
|
39
|
+
// `id` alongside it — a user can legitimately store
|
|
40
|
+
// `{"id":"cfg","content":{"text":"..."},"version":2}`, and unwrapping that
|
|
41
|
+
// discards `version` silently, turning a stored document into one of its
|
|
42
|
+
// fragments. So instead of guessing what an envelope looks like, check the
|
|
43
|
+
// inverse: every key we are about to drop must be one the envelope is known
|
|
44
|
+
// to carry. An unrecognised sibling means this is someone's document, and it
|
|
45
|
+
// is returned untouched.
|
|
46
|
+
//
|
|
47
|
+
// The asymmetry is deliberate. Leaving a real envelope wrapped is ugly;
|
|
48
|
+
// unwrapping a real document destroys data.
|
|
49
|
+
const record = parsed;
|
|
50
|
+
// Only SCOPING keys. These are identifiers the server stamps on a record;
|
|
51
|
+
// they carry nothing the user wrote, so discarding them loses nothing.
|
|
52
|
+
//
|
|
53
|
+
// The previous allowlist also contained `title`, `metadata`, `timestamp` and
|
|
54
|
+
// friends. Those ARE envelope fields, but they also carry user data — so a
|
|
55
|
+
// document with any of them populated was being reduced to its content.text
|
|
56
|
+
// and the rest silently dropped. Three rounds of narrowing the guess did not
|
|
57
|
+
// fix that, because the premise was wrong: the test cannot be "does this look
|
|
58
|
+
// like an envelope", it has to be "is there anything here to lose".
|
|
59
|
+
const SCOPING_KEYS = new Set([
|
|
60
|
+
"content",
|
|
61
|
+
"id",
|
|
62
|
+
"tenant_id",
|
|
63
|
+
"sub_tenant_id",
|
|
64
|
+
"source_id",
|
|
65
|
+
"chunk_id",
|
|
66
|
+
]);
|
|
67
|
+
// Any other key holding an actual value means this is someone's document.
|
|
68
|
+
// Empty strings, nulls and empty objects are not data, so a bare envelope
|
|
69
|
+
// carrying `"title": ""` still unwraps.
|
|
70
|
+
const hasData = (value) => {
|
|
71
|
+
if (value == null)
|
|
72
|
+
return false;
|
|
73
|
+
if (typeof value === "string")
|
|
74
|
+
return value.trim() !== "";
|
|
75
|
+
if (Array.isArray(value))
|
|
76
|
+
return value.length > 0;
|
|
77
|
+
if (typeof value === "object")
|
|
78
|
+
return Object.keys(value).length > 0;
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
const wouldLoseSomething = Object.entries(record).some(([key, value]) => !SCOPING_KEYS.has(key) && hasData(value));
|
|
82
|
+
if (wouldLoseSomething)
|
|
83
|
+
return trimmed;
|
|
84
|
+
// And require a field that is unambiguously OURS. `id` alone is not — a
|
|
85
|
+
// user's own document can carry one. `tenant_id`/`sub_tenant_id` are internal
|
|
86
|
+
// scoping fields the server stamps on; a hand-written document has neither.
|
|
87
|
+
const looksLikeSource = ["tenant_id", "sub_tenant_id"].some((key) => typeof record[key] === "string");
|
|
88
|
+
if (!looksLikeSource)
|
|
89
|
+
return trimmed;
|
|
90
|
+
const content = record.content;
|
|
91
|
+
if (typeof content === "object" && content !== null) {
|
|
92
|
+
for (const key of ["text", "markdown"]) {
|
|
93
|
+
const value = content[key];
|
|
94
|
+
if (typeof value === "string" && value.trim())
|
|
95
|
+
return value.trim();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return trimmed;
|
|
99
|
+
}
|
|
1
100
|
function formatTriplet(triplet) {
|
|
2
101
|
const src = triplet.source?.name ?? "?";
|
|
3
102
|
const rel = triplet.relation;
|
|
@@ -6,57 +105,226 @@ function formatTriplet(triplet) {
|
|
|
6
105
|
const ctx = rel?.context ? ` [${rel.context}]` : "";
|
|
7
106
|
return ` (${src}) —[${predicate}]→ (${tgt})${ctx}`;
|
|
8
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Normalised form for comparing two bodies. Retrieval returns overlapping
|
|
110
|
+
* windows over the same source, and they rarely differ by more than whitespace.
|
|
111
|
+
*/
|
|
112
|
+
function normalise(text) {
|
|
113
|
+
return text.replace(/\s+/g, " ").trim().toLowerCase();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Chunk indices whose body is wholly contained in another chunk's body.
|
|
117
|
+
*
|
|
118
|
+
* The API returns overlapping windows, so a short chunk is frequently a literal
|
|
119
|
+
* substring of a longer one — in a live 15-chunk sample, 4 were fully contained
|
|
120
|
+
* in another, roughly a quarter of the body re-sent for nothing.
|
|
121
|
+
*
|
|
122
|
+
* Ties are resolved by keeping the earlier (higher-ranked) chunk, and identical
|
|
123
|
+
* bodies collapse to one. O(n^2) over at most 50 items is free.
|
|
124
|
+
*/
|
|
125
|
+
function containedChunkIndices(bodies, sourceIds) {
|
|
126
|
+
const normalised = bodies.map(normalise);
|
|
127
|
+
/** duplicate chunk index -> the 1-based chunk number holding the same text. */
|
|
128
|
+
const dropped = new Map();
|
|
129
|
+
for (let i = 0; i < normalised.length; i++) {
|
|
130
|
+
if (dropped.has(i))
|
|
131
|
+
continue;
|
|
132
|
+
const a = normalised[i];
|
|
133
|
+
if (a === "")
|
|
134
|
+
continue;
|
|
135
|
+
for (let j = 0; j < normalised.length; j++) {
|
|
136
|
+
if (i === j || dropped.has(j))
|
|
137
|
+
continue;
|
|
138
|
+
const b = normalised[j];
|
|
139
|
+
if (b === "")
|
|
140
|
+
continue;
|
|
141
|
+
// Only within ONE source. Two different sources can legitimately hold
|
|
142
|
+
// the same sentence — a policy quoted in two documents, the same fact
|
|
143
|
+
// recorded twice — and suppressing one of those does not remove
|
|
144
|
+
// duplication, it removes a MATCH: its id, score and graph relations
|
|
145
|
+
// all disappear, and the caller can no longer discover that source.
|
|
146
|
+
// The duplication this exists to remove is the overlapping windows
|
|
147
|
+
// retrieval returns over a single source.
|
|
148
|
+
const sameSource = sourceIds[i] != null && sourceIds[i] === sourceIds[j];
|
|
149
|
+
if (!sameSource)
|
|
150
|
+
continue;
|
|
151
|
+
// Point BACKWARDS only. Truncation drops sections from the end, so a
|
|
152
|
+
// pointer to an earlier chunk always resolves; one aimed forward can
|
|
153
|
+
// name a chunk the budget removed, leaving the caller told the text is
|
|
154
|
+
// in "Chunk 12" when there is no Chunk 12.
|
|
155
|
+
if (i >= j)
|
|
156
|
+
continue;
|
|
157
|
+
// Keep the longer body; on an exact tie keep whichever ranked first.
|
|
158
|
+
const keepsI = a.length > b.length || (a.length === b.length && i < j);
|
|
159
|
+
if (keepsI && a.includes(b))
|
|
160
|
+
dropped.set(j, i + 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return dropped;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* How many chunks the renderer will actually emit.
|
|
167
|
+
*
|
|
168
|
+
* The caller needs this for its "Found N" header. Reporting the raw chunk count
|
|
169
|
+
* there while the body shows fewer is the same disagreement the removed summary
|
|
170
|
+
* block had, reintroduced by deduping.
|
|
171
|
+
*/
|
|
172
|
+
export function renderedChunkCount(response) {
|
|
173
|
+
const chunks = response.chunks ?? [];
|
|
174
|
+
const contained = containedChunkIndices(chunks.map((c) => extractChunkText(c.chunkContent)), chunks.map((c) => c.id));
|
|
175
|
+
// Every chunk is still rendered; only duplicated BODIES are collapsed.
|
|
176
|
+
return chunks.length;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Render, and report how many chunks the caller can actually see.
|
|
180
|
+
*
|
|
181
|
+
* `buildRecalledContext` returns only the text, so a caller counting chunks had
|
|
182
|
+
* to compute that separately — and any count computed before the total-character
|
|
183
|
+
* budget applies overstates what survived it. The header and the body must
|
|
184
|
+
* describe the same thing.
|
|
185
|
+
*/
|
|
186
|
+
/** Room reserved for the truncation notice itself, so it also fits. */
|
|
187
|
+
const TRUNCATION_NOTE_ALLOWANCE = 240;
|
|
188
|
+
export function renderRecalledContext(response, opts) {
|
|
189
|
+
// The count comes from the renderer, which knows exactly how many sections it
|
|
190
|
+
// emitted. Deriving it by matching /^Chunk \d+/ over the finished text meant a
|
|
191
|
+
// stored body containing a line like "Chunk 5 of the manual" was counted as a
|
|
192
|
+
// rendered section, so `Found N` announced more matches than existed — the
|
|
193
|
+
// same header/body disagreement this PR removed, reintroduced by the fix for
|
|
194
|
+
// it.
|
|
195
|
+
return render(response, opts);
|
|
196
|
+
}
|
|
9
197
|
export function buildRecalledContext(response, opts) {
|
|
198
|
+
return render(response, opts).text;
|
|
199
|
+
}
|
|
200
|
+
function render(response, opts) {
|
|
10
201
|
const minScore = opts?.minEvidenceScore ?? 0.4;
|
|
11
202
|
const maxGroupOccurrences = opts?.maxGroupOccurrences;
|
|
203
|
+
const maxChunkChars = opts?.maxChunkChars;
|
|
204
|
+
const includeExtraContext = opts?.includeExtraContext ?? true;
|
|
12
205
|
const chunks = response.chunks ?? [];
|
|
13
|
-
const graphCtx = response.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
206
|
+
const graphCtx = response.graphContext ?? {
|
|
207
|
+
queryPaths: [],
|
|
208
|
+
chunkRelations: [],
|
|
209
|
+
chunkIdToGroupIds: {},
|
|
17
210
|
};
|
|
18
|
-
const extraContextMap = response.
|
|
19
|
-
const rawRelations = graphCtx.
|
|
211
|
+
const extraContextMap = response.additionalContext ?? {};
|
|
212
|
+
const rawRelations = graphCtx.chunkRelations ?? [];
|
|
20
213
|
const relationIndex = {};
|
|
21
214
|
for (let idx = 0; idx < rawRelations.length; idx++) {
|
|
22
215
|
const relation = rawRelations[idx];
|
|
23
|
-
if ((relation.
|
|
216
|
+
if ((relation.relevancyScore ?? 0) < minScore)
|
|
24
217
|
continue;
|
|
25
|
-
const groupId = relation.
|
|
218
|
+
const groupId = relation.groupId ?? `p_${idx}`;
|
|
26
219
|
relationIndex[groupId] = relation;
|
|
27
220
|
}
|
|
28
|
-
|
|
221
|
+
// Direct chunk → relation links, the mapping the server states explicitly and
|
|
222
|
+
// the one the SDK's own renderer reaches for first. Without it this renderer
|
|
223
|
+
// had only the indirect route (group_id + chunk_id_to_group_ids) and the
|
|
224
|
+
// triplet.chunk_id scan, so any relation the server linked ONLY via
|
|
225
|
+
// source_chunk_ids was silently dropped from the output.
|
|
226
|
+
const directRelations = {};
|
|
227
|
+
for (const [groupId, relation] of Object.entries(relationIndex)) {
|
|
228
|
+
for (const chunkId of relation.sourceChunkIds ?? []) {
|
|
229
|
+
const bucket = directRelations[chunkId];
|
|
230
|
+
if (bucket)
|
|
231
|
+
bucket.push([groupId, relation]);
|
|
232
|
+
else
|
|
233
|
+
directRelations[chunkId] = [[groupId, relation]];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const chunkToGroupIds = graphCtx.chunkIdToGroupIds ?? {};
|
|
29
237
|
const consumedExtraIds = new Set();
|
|
30
238
|
const groupOccurrenceCounts = {};
|
|
31
239
|
const chunkSections = [];
|
|
240
|
+
// Suppress chunks wholly contained in another chunk before rendering any of
|
|
241
|
+
// them, so the numbering reflects what the caller actually receives.
|
|
242
|
+
// Body collapsing is disabled when per-chunk trimming is on. Compact mode
|
|
243
|
+
// already caps each body, so the duplication it would remove is small — and
|
|
244
|
+
// the pointer could name a chunk whose RENDERED body was cut before the
|
|
245
|
+
// shared text, promising content no rendered chunk actually contains.
|
|
246
|
+
const contained = maxChunkChars == null
|
|
247
|
+
? containedChunkIndices(chunks.map((c) => extractChunkText(c.chunkContent)), chunks.map((c) => c.id))
|
|
248
|
+
: new Map();
|
|
249
|
+
// Extra context is deduped by CONTENT as well as by id: the same passage
|
|
250
|
+
// arrives under different ids, and an id-keyed check never notices.
|
|
251
|
+
// Maps a passage to the chunk number that already rendered it, so a later
|
|
252
|
+
// chunk can point at it instead of either repeating it or losing the
|
|
253
|
+
// association entirely.
|
|
254
|
+
const seenExtraContent = new Map();
|
|
255
|
+
let rendered = 0;
|
|
32
256
|
for (let i = 0; i < chunks.length; i++) {
|
|
33
257
|
const chunk = chunks[i];
|
|
258
|
+
rendered++;
|
|
259
|
+
// A contained chunk is rendered, but its BODY is replaced with a pointer.
|
|
260
|
+
// Only the text is duplicated: the id, score, graph relations and
|
|
261
|
+
// extra-context references belong to THIS chunk and exist nowhere else,
|
|
262
|
+
// so dropping the whole section would remove associations rather than
|
|
263
|
+
// repetition — and take a discoverable source id with them.
|
|
264
|
+
const bodyDuplicateOf = contained.get(i);
|
|
34
265
|
const lines = [];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
266
|
+
// The id rides in the chunk header because this block is what a caller
|
|
267
|
+
// actually reads. Without it a recall result is unactionable: there is no
|
|
268
|
+
// value anywhere in the output that `hydradb_inspect` or `hydradb_delete`
|
|
269
|
+
// will accept, so a follow-up means guessing an id or listing everything
|
|
270
|
+
// and matching on prose.
|
|
271
|
+
const chunkId = chunk.id;
|
|
272
|
+
// The score lives here rather than in a separate summary block. It was the
|
|
273
|
+
// only thing that block carried which this one did not, and reproducing it
|
|
274
|
+
// meant re-sending a truncated copy of every chunk body to deliver one
|
|
275
|
+
// percentage per chunk.
|
|
276
|
+
const score = chunk.relevancyScore != null
|
|
277
|
+
? ` (${Math.round(chunk.relevancyScore * 100)}%)`
|
|
278
|
+
: "";
|
|
279
|
+
lines.push(`Chunk ${rendered}${chunkId ? ` [id: ${chunkId}]` : ""}${score}`);
|
|
280
|
+
const meta = chunk.additionalMetadata ?? {};
|
|
281
|
+
const title = chunk.sourceTitle || meta.title;
|
|
38
282
|
if (title) {
|
|
39
283
|
lines.push(`Source: ${title}`);
|
|
40
284
|
}
|
|
41
|
-
|
|
42
|
-
|
|
285
|
+
const bodyText = extractChunkText(chunk.chunkContent);
|
|
286
|
+
if (bodyDuplicateOf != null) {
|
|
287
|
+
lines.push(`(same text as Chunk ${bodyDuplicateOf})`);
|
|
288
|
+
}
|
|
289
|
+
else
|
|
290
|
+
lines.push(maxChunkChars != null && bodyText.length > maxChunkChars
|
|
291
|
+
? `${bodyText.slice(0, maxChunkChars)}… [chunk truncated: ${bodyText.length} chars; ` +
|
|
292
|
+
`use detail:"full" or ${"hydradb_inspect"} for the whole source]`
|
|
293
|
+
: bodyText);
|
|
294
|
+
// The SDK types this optional where the old hand-written mirror had it
|
|
295
|
+
// required. An absent uuid simply matches no relation, which is the
|
|
296
|
+
// correct outcome — it must not throw and must not match everything.
|
|
297
|
+
const chunkUuid = chunk.chunkUuid ?? "";
|
|
43
298
|
const linkedGroupIds = chunkToGroupIds[chunkUuid] ?? [];
|
|
44
299
|
const matchedRelations = [];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
300
|
+
/** Take a relation for this chunk unless its group is already capped. */
|
|
301
|
+
const take = (gid, relation) => {
|
|
302
|
+
const occurrences = groupOccurrenceCounts[gid] ?? 0;
|
|
303
|
+
if (maxGroupOccurrences == null || occurrences < maxGroupOccurrences) {
|
|
304
|
+
matchedRelations.push(relation);
|
|
305
|
+
groupOccurrenceCounts[gid] = occurrences + 1;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
// Preferred route: the server said which chunks this relation came from.
|
|
309
|
+
const direct = directRelations[chunkUuid] ?? [];
|
|
310
|
+
for (const [gid, relation] of direct) {
|
|
311
|
+
take(gid, relation);
|
|
312
|
+
}
|
|
313
|
+
// Track whether a lookup found any candidate groups (even if all were
|
|
314
|
+
// capped) to avoid incorrectly falling through to the fallback path
|
|
48
315
|
const hasLinkedGroups = linkedGroupIds.some((gid) => !!relationIndex[gid]);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
groupOccurrenceCounts[gid] = occurrences + 1;
|
|
316
|
+
// Indirect route, used only when the direct one produced no candidates —
|
|
317
|
+
// running both would attach the same relation twice.
|
|
318
|
+
if (direct.length === 0) {
|
|
319
|
+
for (const gid of linkedGroupIds) {
|
|
320
|
+
if (relationIndex[gid]) {
|
|
321
|
+
take(gid, relationIndex[gid]);
|
|
56
322
|
}
|
|
57
323
|
}
|
|
58
324
|
}
|
|
59
|
-
if (matchedRelations.length === 0 &&
|
|
325
|
+
if (matchedRelations.length === 0 &&
|
|
326
|
+
!hasLinkedGroups &&
|
|
327
|
+
direct.length === 0) {
|
|
60
328
|
for (const [gid, rel] of Object.entries(relationIndex)) {
|
|
61
329
|
const triplets = rel.triplets ?? [];
|
|
62
330
|
const hasChunk = triplets.some((t) => t.relation?.chunk_id === chunkUuid);
|
|
@@ -78,15 +346,15 @@ export function buildRecalledContext(response, opts) {
|
|
|
78
346
|
relationLines.push(formatTriplet(triplet));
|
|
79
347
|
}
|
|
80
348
|
}
|
|
81
|
-
else if (rel.
|
|
82
|
-
relationLines.push(` ${rel.
|
|
349
|
+
else if (rel.combinedContext) {
|
|
350
|
+
relationLines.push(` ${rel.combinedContext}`);
|
|
83
351
|
}
|
|
84
352
|
}
|
|
85
353
|
if (relationLines.length > 0) {
|
|
86
354
|
lines.push("Graph Relations:");
|
|
87
355
|
lines.push(...relationLines);
|
|
88
356
|
}
|
|
89
|
-
const extraIds = chunk.
|
|
357
|
+
const extraIds = includeExtraContext ? (chunk.extraContextIds ?? []) : [];
|
|
90
358
|
if (extraIds.length > 0 && Object.keys(extraContextMap).length > 0) {
|
|
91
359
|
const extraLines = [];
|
|
92
360
|
for (const ctxId of extraIds) {
|
|
@@ -95,8 +363,25 @@ export function buildRecalledContext(response, opts) {
|
|
|
95
363
|
const extraChunk = extraContextMap[ctxId];
|
|
96
364
|
if (extraChunk) {
|
|
97
365
|
consumedExtraIds.add(ctxId);
|
|
98
|
-
const extraContent = extraChunk.
|
|
99
|
-
|
|
366
|
+
const extraContent = extractChunkText(extraChunk.chunkContent);
|
|
367
|
+
// Keying only on id let byte-identical passages through under
|
|
368
|
+
// different ids — three ~700-char duplicates in one live sample.
|
|
369
|
+
// The title is part of the key: the same passage attributed to a
|
|
370
|
+
// different source is not a duplicate, it is a second citation,
|
|
371
|
+
// and dropping it would strip that chunk's attribution.
|
|
372
|
+
// Placement is the ONLY thing tying an extra-context block to its
|
|
373
|
+
// chunk, so suppressing a repeat outright leaves that chunk looking
|
|
374
|
+
// as though it referenced nothing. Cite where it was shown instead:
|
|
375
|
+
// the association survives, and the passage is still sent once.
|
|
376
|
+
const fingerprint = `${extraChunk.sourceTitle ?? ""}\u0000${normalise(extraContent)}`;
|
|
377
|
+
const shownIn = fingerprint !== "" ? seenExtraContent.get(fingerprint) : undefined;
|
|
378
|
+
if (shownIn != null) {
|
|
379
|
+
extraLines.push(` Related Context: (same as Chunk ${shownIn})`);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
if (fingerprint !== "")
|
|
383
|
+
seenExtraContent.set(fingerprint, rendered);
|
|
384
|
+
const extraTitle = extraChunk.sourceTitle ?? "";
|
|
100
385
|
if (extraTitle) {
|
|
101
386
|
extraLines.push(` Related Context (${extraTitle}): ${extraContent}`);
|
|
102
387
|
}
|
|
@@ -113,10 +398,10 @@ export function buildRecalledContext(response, opts) {
|
|
|
113
398
|
chunkSections.push(lines.join("\n"));
|
|
114
399
|
}
|
|
115
400
|
const entityPathLines = [];
|
|
116
|
-
const rawPaths = graphCtx.
|
|
401
|
+
const rawPaths = graphCtx.queryPaths ?? [];
|
|
117
402
|
for (const path of rawPaths) {
|
|
118
|
-
if (path.
|
|
119
|
-
entityPathLines.push(path.
|
|
403
|
+
if (path.combinedContext) {
|
|
404
|
+
entityPathLines.push(path.combinedContext);
|
|
120
405
|
}
|
|
121
406
|
else {
|
|
122
407
|
const triplets = path.triplets ?? [];
|
|
@@ -145,6 +430,61 @@ export function buildRecalledContext(response, opts) {
|
|
|
145
430
|
output.push("=== CONTEXT ===");
|
|
146
431
|
output.push(chunkSections.join("\n\n---\n\n"));
|
|
147
432
|
}
|
|
148
|
-
|
|
433
|
+
const text = output.join("\n");
|
|
434
|
+
const budget = opts?.maxTotalChars;
|
|
435
|
+
if (budget != null && text.length > budget) {
|
|
436
|
+
// A per-chunk cap does not bound the whole: fifty capped chunks still add
|
|
437
|
+
// up. The total ceiling is the one that actually protects the caller.
|
|
438
|
+
//
|
|
439
|
+
// Cut at a CHUNK boundary, not mid-string. Slicing the joined text can
|
|
440
|
+
// sever a chunk header, leaving a partial `[id: …]` the caller might try
|
|
441
|
+
// to use, and it silently removes whole sections the "Found N" header is
|
|
442
|
+
// still counting. Dropping whole chunks and saying how many were dropped
|
|
443
|
+
// keeps the header and the body describing the same thing.
|
|
444
|
+
// The prefix needs its own ceiling, not just a place in the accounting: a
|
|
445
|
+
// graph-heavy result can produce entity paths that exceed the whole budget
|
|
446
|
+
// on their own, and then no amount of dropping chunks brings the total
|
|
447
|
+
// under it. Half the budget leaves room for the chunks the caller asked
|
|
448
|
+
// for.
|
|
449
|
+
const headBudget = Math.floor(budget / 2);
|
|
450
|
+
let head = "";
|
|
451
|
+
if (entityPathLines.length > 0) {
|
|
452
|
+
const keptPaths = [];
|
|
453
|
+
let headUsed = "=== ENTITY PATHS ===\n\n".length;
|
|
454
|
+
for (const line of entityPathLines) {
|
|
455
|
+
if (headUsed + line.length + 1 > headBudget)
|
|
456
|
+
break;
|
|
457
|
+
keptPaths.push(line);
|
|
458
|
+
headUsed += line.length + 1;
|
|
459
|
+
}
|
|
460
|
+
const droppedPaths = entityPathLines.length - keptPaths.length;
|
|
461
|
+
head =
|
|
462
|
+
`=== ENTITY PATHS ===\n${keptPaths.join("\n")}` +
|
|
463
|
+
(droppedPaths > 0 ? `\n[${droppedPaths} more entity path(s) omitted]` : "") +
|
|
464
|
+
"\n\n";
|
|
465
|
+
}
|
|
466
|
+
const kept = [];
|
|
467
|
+
// The prefix and the framing count against the ceiling too. Budgeting only
|
|
468
|
+
// the chunk sections let a graph-heavy result exceed the documented limit
|
|
469
|
+
// by however large its entity paths happened to be.
|
|
470
|
+
let used = head.length + "=== CONTEXT ===\n".length + TRUNCATION_NOTE_ALLOWANCE;
|
|
471
|
+
const separator = "\n\n---\n\n";
|
|
472
|
+
for (const section of chunkSections) {
|
|
473
|
+
const cost = section.length + (kept.length > 0 ? separator.length : 0);
|
|
474
|
+
if (used + cost > budget)
|
|
475
|
+
break;
|
|
476
|
+
kept.push(section);
|
|
477
|
+
used += cost;
|
|
478
|
+
}
|
|
479
|
+
const dropped = chunkSections.length - kept.length;
|
|
480
|
+
return {
|
|
481
|
+
text: `${head}=== CONTEXT ===\n${kept.join(separator)}\n\n` +
|
|
482
|
+
`[response truncated: showing ${kept.length} of ${chunkSections.length} chunks. ` +
|
|
483
|
+
`${dropped} omitted to stay within ${budget} characters. Narrow the query, lower ` +
|
|
484
|
+
`max_results, or fetch a specific source with hydradb_inspect.]`,
|
|
485
|
+
shown: kept.length,
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
return { text, shown: chunkSections.length };
|
|
149
489
|
}
|
|
150
490
|
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAMA,SAAS,aAAa,CAAC,OAAoB;IAC1C,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,GAAG,CAAC;IACxC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC7B,MAAM,SAAS,GACd,GAAG,EAAE,aAAa,IAAI,GAAG,EAAE,mBAAmB,IAAI,YAAY,CAAC;IAChE,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,GAAG,CAAC;IACxC,MAAM,GAAG,GAAG,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,OAAO,MAAM,GAAG,OAAO,SAAS,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,oBAAoB,CACnC,QAAwB,EACxB,IAGC;IAED,MAAM,QAAQ,GAAG,IAAI,EAAE,gBAAgB,IAAI,GAAG,CAAC;IAC/C,MAAM,mBAAmB,GAAG,IAAI,EAAE,mBAAmB,CAAC;IAEtD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,IAAI;QAC1C,WAAW,EAAE,EAAE;QACf,eAAe,EAAE,EAAE;QACnB,qBAAqB,EAAE,EAAE;KACzB,CAAC;I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