@askdb/rag 0.2.0-beta.1

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.
Files changed (73) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +10 -0
  3. package/README.md +76 -0
  4. package/bin/askdb-rag.js +2 -0
  5. package/dist/bin.d.ts +3 -0
  6. package/dist/bin.d.ts.map +1 -0
  7. package/dist/bin.js +7 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/chunker/chunker.d.ts +36 -0
  10. package/dist/chunker/chunker.d.ts.map +1 -0
  11. package/dist/chunker/chunker.js +426 -0
  12. package/dist/chunker/chunker.js.map +1 -0
  13. package/dist/chunker/index.d.ts +10 -0
  14. package/dist/chunker/index.d.ts.map +1 -0
  15. package/dist/chunker/index.js +14 -0
  16. package/dist/chunker/index.js.map +1 -0
  17. package/dist/chunker/options.d.ts +24 -0
  18. package/dist/chunker/options.d.ts.map +1 -0
  19. package/dist/chunker/options.js +3 -0
  20. package/dist/chunker/options.js.map +1 -0
  21. package/dist/chunker/sources.d.ts +30 -0
  22. package/dist/chunker/sources.d.ts.map +1 -0
  23. package/dist/chunker/sources.js +68 -0
  24. package/dist/chunker/sources.js.map +1 -0
  25. package/dist/cli.d.ts +11 -0
  26. package/dist/cli.d.ts.map +1 -0
  27. package/dist/cli.js +332 -0
  28. package/dist/cli.js.map +1 -0
  29. package/dist/embedders/ai-sdk.d.ts +22 -0
  30. package/dist/embedders/ai-sdk.d.ts.map +1 -0
  31. package/dist/embedders/ai-sdk.js +36 -0
  32. package/dist/embedders/ai-sdk.js.map +1 -0
  33. package/dist/embedders/openai.d.ts +21 -0
  34. package/dist/embedders/openai.d.ts.map +1 -0
  35. package/dist/embedders/openai.js +24 -0
  36. package/dist/embedders/openai.js.map +1 -0
  37. package/dist/index.d.ts +6 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +13 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/indexer/hash.d.ts +3 -0
  42. package/dist/indexer/hash.d.ts.map +1 -0
  43. package/dist/indexer/hash.js +6 -0
  44. package/dist/indexer/hash.js.map +1 -0
  45. package/dist/indexer/index.d.ts +72 -0
  46. package/dist/indexer/index.d.ts.map +1 -0
  47. package/dist/indexer/index.js +196 -0
  48. package/dist/indexer/index.js.map +1 -0
  49. package/dist/indexer/lock-file.d.ts +23 -0
  50. package/dist/indexer/lock-file.d.ts.map +1 -0
  51. package/dist/indexer/lock-file.js +33 -0
  52. package/dist/indexer/lock-file.js.map +1 -0
  53. package/dist/log-events.d.ts +23 -0
  54. package/dist/log-events.d.ts.map +1 -0
  55. package/dist/log-events.js +22 -0
  56. package/dist/log-events.js.map +1 -0
  57. package/dist/stores/file.d.ts +42 -0
  58. package/dist/stores/file.d.ts.map +1 -0
  59. package/dist/stores/file.js +127 -0
  60. package/dist/stores/file.js.map +1 -0
  61. package/dist/stores/memory.d.ts +34 -0
  62. package/dist/stores/memory.d.ts.map +1 -0
  63. package/dist/stores/memory.js +118 -0
  64. package/dist/stores/memory.js.map +1 -0
  65. package/dist/stores/pgvector.d.ts +41 -0
  66. package/dist/stores/pgvector.d.ts.map +1 -0
  67. package/dist/stores/pgvector.js +176 -0
  68. package/dist/stores/pgvector.js.map +1 -0
  69. package/dist/types.d.ts +89 -0
  70. package/dist/types.d.ts.map +1 -0
  71. package/dist/types.js +9 -0
  72. package/dist/types.js.map +1 -0
  73. package/package.json +100 -0
@@ -0,0 +1,426 @@
1
+ import { DEFAULT_CHUNK_MAX_CHARS, } from "./options.js";
2
+ /**
3
+ * Deterministic chunker for a Schema v2 artifact.
4
+ *
5
+ * Inputs are pre-loaded sources (the `loadSchema` normalized form **plus** the
6
+ * raw parsed markdowns — the normalized form intentionally drops example
7
+ * questions, business context, and column-notes which the chunker needs).
8
+ *
9
+ * Determinism is a contract: same artifact → same chunk ids and same chunk
10
+ * texts on every run, regardless of file-system ordering, OS, or Node version.
11
+ * The final chunk array is sorted by id.
12
+ */
13
+ export function chunkSchema(sources, options = {}) {
14
+ const includeSensitive = options.includeSensitiveDescribable === true;
15
+ const maxChars = options.chunkSizeMaxChars ?? DEFAULT_CHUNK_MAX_CHARS;
16
+ const emitRelationships = options.emitRelationships === true;
17
+ const chunks = [];
18
+ const stats = {
19
+ totalChunks: 0,
20
+ byType: {
21
+ table: 0,
22
+ column: 0,
23
+ cql: 0,
24
+ question: 0,
25
+ concept: 0,
26
+ relationship: 0,
27
+ },
28
+ sensitiveExcluded: 0,
29
+ sensitiveIncluded: 0,
30
+ };
31
+ const { schema, tables: tableMarkdowns, concepts } = sources;
32
+ for (const table of schema.tables) {
33
+ const md = tableMarkdowns[table.id];
34
+ const sensitiveColumnNames = table.columns
35
+ .filter((c) => c.sensitive)
36
+ .map((c) => c.name);
37
+ if (table.sensitive && !includeSensitive) {
38
+ stats.sensitiveExcluded++;
39
+ }
40
+ else {
41
+ chunks.push(buildTableChunk(table, schema.schemaId, includeSensitive, schema));
42
+ }
43
+ // Column chunks — one per column. Identifier + type always; describable
44
+ // fields only when not sensitive (or when opted in).
45
+ for (const col of table.columns) {
46
+ const colNote = readColumnNote(md, col.name);
47
+ const colSensitive = col.sensitive || table.sensitive;
48
+ if (colSensitive && !includeSensitive) {
49
+ stats.sensitiveExcluded++;
50
+ continue;
51
+ }
52
+ else if (colSensitive && includeSensitive) {
53
+ if (col.description || (col.aliases && col.aliases.length) || (col.enum && col.enum.length) || colNote) {
54
+ stats.sensitiveIncluded++;
55
+ }
56
+ }
57
+ chunks.push(buildColumnChunk(table, col, schema.schemaId, colNote, includeSensitive));
58
+ }
59
+ // CQL chunk — excluded entirely if the body mentions a sensitive column by name.
60
+ if (table.commonQueryLanguage) {
61
+ const mentionsSensitive = mentionsAnyName(table.commonQueryLanguage, sensitiveColumnNames);
62
+ const tableLevelSensitive = table.sensitive;
63
+ const skip = (tableLevelSensitive || mentionsSensitive) && !includeSensitive;
64
+ if (skip) {
65
+ stats.sensitiveExcluded++;
66
+ }
67
+ else {
68
+ if (tableLevelSensitive || mentionsSensitive) {
69
+ stats.sensitiveIncluded++;
70
+ }
71
+ for (const part of splitLong(table.commonQueryLanguage, maxChars)) {
72
+ chunks.push(buildCqlChunk(table, part.text, part.suffix, schema.schemaId, tableLevelSensitive || mentionsSensitive));
73
+ }
74
+ }
75
+ }
76
+ // Example-question chunks — one per bullet item.
77
+ if (md) {
78
+ const questions = extractExampleQuestions(md);
79
+ const businessContext = md.sections["Business context"]?.trim() ?? "";
80
+ const questionsMentionSensitive = questions.some((q) => mentionsAnyName(q, sensitiveColumnNames));
81
+ const bizMentionsSensitive = mentionsAnyName(businessContext, sensitiveColumnNames);
82
+ // Per-table sensitive gate: if table is sensitive OR mentions exist, skip
83
+ // the *whole* describable layer for that table by default. Authoring rule
84
+ // in the contract notes the chunker excludes whole chunks rather than
85
+ // partially redacting prose.
86
+ const skipQuestions = (table.sensitive || questionsMentionSensitive) && !includeSensitive;
87
+ if (questions.length > 0) {
88
+ if (skipQuestions) {
89
+ stats.sensitiveExcluded += questions.length;
90
+ }
91
+ else {
92
+ if (table.sensitive || questionsMentionSensitive) {
93
+ stats.sensitiveIncluded += questions.length;
94
+ }
95
+ questions.forEach((q, i) => {
96
+ chunks.push(buildQuestionChunk(table, q, i + 1, schema.schemaId, table.sensitive || mentionsAnyName(q, sensitiveColumnNames)));
97
+ });
98
+ }
99
+ }
100
+ // Business-context chunks are part of the describable layer; same gate.
101
+ if (businessContext) {
102
+ const skipBiz = (table.sensitive || bizMentionsSensitive) && !includeSensitive;
103
+ if (skipBiz) {
104
+ stats.sensitiveExcluded++;
105
+ }
106
+ else {
107
+ if (table.sensitive || bizMentionsSensitive) {
108
+ stats.sensitiveIncluded++;
109
+ }
110
+ for (const part of splitLong(businessContext, maxChars)) {
111
+ chunks.push(buildBusinessContextChunk(table, part.text, part.suffix, schema.schemaId, table.sensitive || bizMentionsSensitive));
112
+ }
113
+ }
114
+ }
115
+ }
116
+ // Optional relationship chunks
117
+ if (emitRelationships && table.relationships) {
118
+ for (const rel of table.relationships) {
119
+ const chunk = buildRelationshipChunk(table, rel, schema, schema.schemaId);
120
+ if (chunk.sensitive && !includeSensitive) {
121
+ stats.sensitiveExcluded++;
122
+ continue;
123
+ }
124
+ if (chunk.sensitive)
125
+ stats.sensitiveIncluded++;
126
+ chunks.push(chunk);
127
+ }
128
+ }
129
+ }
130
+ // Concept chunks. Concepts that link to sensitive columns include link
131
+ // metadata but their description is filtered if it names a sensitive col.
132
+ if (concepts?.frontmatter.concepts) {
133
+ const allSensitiveColumnNames = collectSensitiveColumnNames(schema);
134
+ for (const concept of concepts.frontmatter.concepts) {
135
+ const conceptResult = buildConceptChunk(concept, schema.schemaId, schema, allSensitiveColumnNames, includeSensitive);
136
+ if (conceptResult.excluded) {
137
+ stats.sensitiveExcluded++;
138
+ if (includeSensitive) {
139
+ stats.sensitiveIncluded++;
140
+ chunks.push(conceptResult.chunk);
141
+ }
142
+ }
143
+ else {
144
+ if (conceptResult.sensitive)
145
+ stats.sensitiveIncluded++;
146
+ chunks.push(conceptResult.chunk);
147
+ }
148
+ }
149
+ }
150
+ // Final ordering: stable by id (string compare). The chunker itself emits in
151
+ // deterministic order already, but a final sort guards against future
152
+ // reorderings of the source iteration.
153
+ chunks.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
154
+ for (const c of chunks) {
155
+ stats.byType[c.type]++;
156
+ }
157
+ stats.totalChunks = chunks.length;
158
+ return { chunks, stats };
159
+ }
160
+ // ---------- chunk builders ----------
161
+ function buildTableChunk(table, schemaId, includeSensitive, schema) {
162
+ const lines = [];
163
+ const qualified = `${table.schema}.${table.name}`;
164
+ lines.push(`# ${qualified}`);
165
+ if (!table.sensitive) {
166
+ if (table.description)
167
+ lines.push(table.description);
168
+ if (table.aliases?.length)
169
+ lines.push(`Aliases: ${table.aliases.join(", ")}`);
170
+ if (table.primaryEntity)
171
+ lines.push(`Primary entity: ${table.primaryEntity}`);
172
+ }
173
+ if (table.relationships?.length) {
174
+ lines.push("Relationships:");
175
+ for (const r of table.relationships) {
176
+ if (!includeSensitive && (isSensitiveId(r.from, schema) || isSensitiveId(r.to, schema))) {
177
+ continue;
178
+ }
179
+ lines.push(`- ${r.from} -> ${r.to}`);
180
+ }
181
+ }
182
+ lines.push("Columns:");
183
+ const referencedColumns = [];
184
+ for (const c of table.columns) {
185
+ if ((c.sensitive || table.sensitive) && !includeSensitive)
186
+ continue;
187
+ referencedColumns.push(c.id);
188
+ const flags = [];
189
+ if (c.primaryKey)
190
+ flags.push("PK");
191
+ flags.push(c.nullable ? "NULL" : "NOT NULL");
192
+ const tag = c.sensitive || table.sensitive ? " (sensitive)" : "";
193
+ const desc = !table.sensitive && !c.sensitive && c.description
194
+ ? ` — ${c.description}`
195
+ : "";
196
+ lines.push(`- ${c.name} ${c.type} (${flags.join(" ")})${tag}${desc}`);
197
+ }
198
+ return {
199
+ id: `chunk:${table.id}`,
200
+ type: "table",
201
+ text: lines.join("\n").trim(),
202
+ schemaId,
203
+ refs: [table.id, ...referencedColumns],
204
+ sensitive: table.sensitive,
205
+ };
206
+ }
207
+ function buildColumnChunk(table, col, schemaId, columnNote, includeSensitive) {
208
+ const sensitive = col.sensitive || table.sensitive;
209
+ const flags = [];
210
+ if (col.primaryKey)
211
+ flags.push("PK");
212
+ flags.push(col.nullable ? "NULL" : "NOT NULL");
213
+ const lines = [];
214
+ const qualified = `${table.schema}.${table.name}.${col.name}`;
215
+ lines.push(`Column: ${qualified} ${col.type} (${flags.join(" ")})${sensitive ? " (sensitive)" : ""}`);
216
+ lines.push(`Id: ${col.id}`);
217
+ if (!sensitive || includeSensitive) {
218
+ if (col.description)
219
+ lines.push(col.description);
220
+ if (col.aliases?.length)
221
+ lines.push(`Aliases: ${col.aliases.join(", ")}`);
222
+ if (col.enum?.length)
223
+ lines.push(`Values: ${col.enum.join(", ")}`);
224
+ if (columnNote)
225
+ lines.push(`Note: ${columnNote}`);
226
+ }
227
+ return {
228
+ id: `chunk:${col.id}`,
229
+ type: "column",
230
+ text: lines.join("\n").trim(),
231
+ schemaId,
232
+ refs: [table.id, col.id],
233
+ sensitive,
234
+ };
235
+ }
236
+ function buildCqlChunk(table, body, suffix, schemaId, sensitive) {
237
+ const aliasNote = table.aliases?.length
238
+ ? ` (also: ${table.aliases.join(", ")})`
239
+ : "";
240
+ const text = `# ${table.schema}.${table.name}${aliasNote} — common query language\n${body.trim()}`;
241
+ const id = `chunk:${table.id}#cql${suffix}`;
242
+ return {
243
+ id,
244
+ type: "cql",
245
+ text,
246
+ schemaId,
247
+ refs: [table.id],
248
+ sensitive,
249
+ };
250
+ }
251
+ function buildQuestionChunk(table, question, index, schemaId, sensitive) {
252
+ const entity = table.primaryEntity ? ` [${table.primaryEntity}]` : "";
253
+ const text = `# ${table.schema}.${table.name}${entity} — example question\n${question.trim()}`;
254
+ return {
255
+ id: `chunk:${table.id}#q:${index}`,
256
+ type: "question",
257
+ text,
258
+ schemaId,
259
+ refs: [table.id],
260
+ sensitive,
261
+ };
262
+ }
263
+ function buildBusinessContextChunk(table, body, suffix, schemaId, sensitive) {
264
+ const text = `# ${table.schema}.${table.name} — business context\n${body.trim()}`;
265
+ return {
266
+ id: `chunk:${table.id}#biz${suffix}`,
267
+ type: "table",
268
+ text,
269
+ schemaId,
270
+ refs: [table.id],
271
+ sensitive,
272
+ };
273
+ }
274
+ function buildRelationshipChunk(table, rel, schema, schemaId) {
275
+ const fromCol = parseColumnId(rel.from);
276
+ const toCol = parseColumnId(rel.to);
277
+ const fromTable = schema.tables.find((t) => t.id === fromCol.tableId);
278
+ const toTable = schema.tables.find((t) => t.id === toCol.tableId);
279
+ const fromName = fromTable ? `${fromTable.schema}.${fromTable.name}` : fromCol.tableId;
280
+ const toName = toTable ? `${toTable.schema}.${toTable.name}` : toCol.tableId;
281
+ const text = `Relationship: ${fromName}.${fromCol.column} references ${toName}.${toCol.column}`;
282
+ const sensitive = (fromTable?.sensitive ?? false) || (toTable?.sensitive ?? false);
283
+ return {
284
+ id: `chunk:${rel.from}->${rel.to}`,
285
+ type: "relationship",
286
+ text,
287
+ schemaId,
288
+ refs: [fromCol.tableId, toCol.tableId, rel.from, rel.to],
289
+ sensitive,
290
+ };
291
+ }
292
+ function buildConceptChunk(concept, schemaId, schema, allSensitiveColumnNames, includeSensitive) {
293
+ const linkedSensitive = (concept.links ?? []).some((id) => isSensitiveId(id, schema));
294
+ const descriptionMentionsSensitive = concept.description
295
+ ? mentionsAnyName(concept.description, allSensitiveColumnNames)
296
+ : false;
297
+ const lines = [];
298
+ lines.push(`# Concept: ${concept.label}`);
299
+ lines.push(`Id: ${concept.id}`);
300
+ if (concept.synonyms?.length)
301
+ lines.push(`Synonyms: ${concept.synonyms.join(", ")}`);
302
+ if (concept.links?.length)
303
+ lines.push(`Links: ${concept.links.join(", ")}`);
304
+ const excludeForSensitive = (linkedSensitive || descriptionMentionsSensitive) && !includeSensitive;
305
+ if (concept.description && (!descriptionMentionsSensitive || includeSensitive)) {
306
+ lines.push(concept.description);
307
+ }
308
+ return {
309
+ chunk: {
310
+ id: `chunk:${concept.id}`,
311
+ type: "concept",
312
+ text: lines.join("\n").trim(),
313
+ schemaId,
314
+ refs: [concept.id, ...(concept.links ?? [])],
315
+ sensitive: linkedSensitive || descriptionMentionsSensitive,
316
+ },
317
+ sensitive: linkedSensitive || descriptionMentionsSensitive,
318
+ excluded: excludeForSensitive,
319
+ };
320
+ }
321
+ // ---------- helpers ----------
322
+ function readColumnNote(md, columnName) {
323
+ const body = md?.sections["Column notes"];
324
+ if (!body)
325
+ return undefined;
326
+ const lines = body.split("\n");
327
+ for (const raw of lines) {
328
+ const line = raw.trim();
329
+ if (!line.startsWith("-"))
330
+ continue;
331
+ const stripped = line.slice(1).trim();
332
+ // Match `column_name`: ... or `column_name` — ...
333
+ const match = stripped.match(/^`([^`]+)`\s*[:\-—]\s*(.+)$/);
334
+ if (match && match[1] === columnName) {
335
+ return match[2].trim();
336
+ }
337
+ }
338
+ return undefined;
339
+ }
340
+ function extractExampleQuestions(md) {
341
+ const body = md.sections["Example questions"];
342
+ if (!body)
343
+ return [];
344
+ const out = [];
345
+ for (const raw of body.split("\n")) {
346
+ const line = raw.trim();
347
+ if (line.startsWith("- "))
348
+ out.push(line.slice(2).trim());
349
+ else if (line.startsWith("* "))
350
+ out.push(line.slice(2).trim());
351
+ }
352
+ return out;
353
+ }
354
+ function mentionsAnyName(text, names) {
355
+ if (!text || names.length === 0)
356
+ return false;
357
+ for (const name of names) {
358
+ // Word-boundary match (also matches when wrapped in backticks).
359
+ const pattern = new RegExp(`(^|[^a-zA-Z0-9_])${escapeRegex(name)}([^a-zA-Z0-9_]|$)`);
360
+ if (pattern.test(text))
361
+ return true;
362
+ }
363
+ return false;
364
+ }
365
+ function escapeRegex(s) {
366
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
367
+ }
368
+ /** Split a long body on paragraph boundaries; suffix is `""` for single-chunk, `#bc:N` (1-indexed) otherwise. */
369
+ function splitLong(body, maxChars) {
370
+ const trimmed = body.trim();
371
+ if (trimmed.length <= maxChars)
372
+ return [{ text: trimmed, suffix: "" }];
373
+ const paragraphs = trimmed.split(/\n\s*\n/);
374
+ const out = [];
375
+ let buf = [];
376
+ let bufLen = 0;
377
+ let idx = 1;
378
+ const flush = () => {
379
+ if (buf.length === 0)
380
+ return;
381
+ out.push({ text: buf.join("\n\n").trim(), suffix: `#bc:${idx++}` });
382
+ buf = [];
383
+ bufLen = 0;
384
+ };
385
+ for (const p of paragraphs) {
386
+ const pLen = p.length;
387
+ if (bufLen + pLen > maxChars && buf.length > 0) {
388
+ flush();
389
+ }
390
+ buf.push(p);
391
+ bufLen += pLen + 2;
392
+ }
393
+ flush();
394
+ return out;
395
+ }
396
+ function parseColumnId(columnId) {
397
+ const hashIdx = columnId.indexOf("#");
398
+ if (hashIdx === -1)
399
+ return { tableId: columnId, column: "" };
400
+ return {
401
+ tableId: columnId.slice(0, hashIdx),
402
+ column: columnId.slice(hashIdx + 1),
403
+ };
404
+ }
405
+ function collectSensitiveColumnNames(schema) {
406
+ const names = new Set();
407
+ for (const t of schema.tables) {
408
+ for (const c of t.columns) {
409
+ if (c.sensitive || t.sensitive)
410
+ names.add(c.name);
411
+ }
412
+ }
413
+ return Array.from(names);
414
+ }
415
+ function isSensitiveId(id, schema) {
416
+ for (const t of schema.tables) {
417
+ if (t.id === id)
418
+ return t.sensitive;
419
+ for (const c of t.columns) {
420
+ if (c.id === id)
421
+ return c.sensitive || t.sensitive;
422
+ }
423
+ }
424
+ return false;
425
+ }
426
+ //# sourceMappingURL=chunker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunker.js","sourceRoot":"","sources":["../../src/chunker/chunker.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,uBAAuB,GAExB,MAAM,cAAc,CAAC;AAyBtB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CACzB,OAAuB,EACvB,UAAwB,EAAE;IAE1B,MAAM,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,KAAK,IAAI,CAAC;IACtE,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,IAAI,uBAAuB,CAAC;IACtE,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,KAAK,IAAI,CAAC;IAE7D,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAe;QACxB,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;YACN,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,GAAG,EAAE,CAAC;YACN,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;YACV,YAAY,EAAE,CAAC;SAChB;QACD,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;KACrB,CAAC;IAEF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC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@@
1
+ export { chunkSchema, type ChunkResult, type ChunkStats } from "./chunker.js";
2
+ export { loadChunkerSourcesFromDir, loadChunkerSourcesFromBundleJson, type ChunkerSources, } from "./sources.js";
3
+ export { DEFAULT_CHUNK_MAX_CHARS, type ChunkOptions, } from "./options.js";
4
+ import { type ChunkResult } from "./chunker.js";
5
+ import type { ChunkOptions } from "./options.js";
6
+ /** Convenience: load + chunk a v2 directory in one call. */
7
+ export declare function chunkSchemaDir(dir: string, options?: ChunkOptions): ChunkResult;
8
+ /** Convenience: load + chunk a v2 bundle JSON string in one call. */
9
+ export declare function chunkSchemaBundle(raw: string, options?: ChunkOptions): ChunkResult;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chunker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uBAAuB,EACvB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAK7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,4DAA4D;AAC5D,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CAE/E;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CAElF"}
@@ -0,0 +1,14 @@
1
+ export { chunkSchema } from "./chunker.js";
2
+ export { loadChunkerSourcesFromDir, loadChunkerSourcesFromBundleJson, } from "./sources.js";
3
+ export { DEFAULT_CHUNK_MAX_CHARS, } from "./options.js";
4
+ import { chunkSchema } from "./chunker.js";
5
+ import { loadChunkerSourcesFromDir, loadChunkerSourcesFromBundleJson, } from "./sources.js";
6
+ /** Convenience: load + chunk a v2 directory in one call. */
7
+ export function chunkSchemaDir(dir, options) {
8
+ return chunkSchema(loadChunkerSourcesFromDir(dir), options);
9
+ }
10
+ /** Convenience: load + chunk a v2 bundle JSON string in one call. */
11
+ export function chunkSchemaBundle(raw, options) {
12
+ return chunkSchema(loadChunkerSourcesFromBundleJson(raw), options);
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chunker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqC,MAAM,cAAc,CAAC;AAC9E,OAAO,EACL,yBAAyB,EACzB,gCAAgC,GAEjC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uBAAuB,GAExB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAoB,MAAM,cAAc,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,cAAc,CAAC;AAGtB,4DAA4D;AAC5D,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAsB;IAChE,OAAO,WAAW,CAAC,yBAAyB,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,OAAsB;IACnE,OAAO,WAAW,CAAC,gCAAgC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /** Default character ceiling for a chunk before paragraph-boundary splitting kicks in. */
2
+ export declare const DEFAULT_CHUNK_MAX_CHARS = 1000;
3
+ /** Options accepted by `chunkSchema` / `chunkSchemaDir`. */
4
+ export type ChunkOptions = {
5
+ /**
6
+ * When true, describable-layer chunks for sensitive columns/tables are
7
+ * **included**. Off by default per `docs/contracts/schema-v2.md`.
8
+ * Flipping this on emits a `askdb.rag.sensitive_chunks_included` warning.
9
+ */
10
+ includeSensitiveDescribable?: boolean;
11
+ /**
12
+ * Character ceiling for a single chunk's text. Long bodies (e.g.
13
+ * `Business context`) are split on paragraph boundaries and suffixed
14
+ * `#bc:1`, `#bc:2`, etc. Default {@link DEFAULT_CHUNK_MAX_CHARS}.
15
+ */
16
+ chunkSizeMaxChars?: number;
17
+ /**
18
+ * Emit `relationship` chunks (one per FK). Default `false` — table chunks
19
+ * already include a relationship summary; the dedicated chunks are useful
20
+ * for retrieval over very large schemas.
21
+ */
22
+ emitRelationships?: boolean;
23
+ };
24
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/chunker/options.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Default character ceiling for a chunk before paragraph-boundary splitting kicks in. */
2
+ export const DEFAULT_CHUNK_MAX_CHARS = 1000;
3
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/chunker/options.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { NormalizedSchemaV2, ParsedConceptsMarkdown, ParsedTableMarkdown } from "@askdb/core";
2
+ /**
3
+ * The chunker consumes both the normalized v2 form **and** the parsed
4
+ * markdown bodies (for `Example questions`, `Business context`, `Column notes`
5
+ * which the normalized form intentionally drops). This bundle is what
6
+ * higher-level helpers assemble before calling the pure chunker.
7
+ */
8
+ export type ChunkerSources = {
9
+ schema: NormalizedSchemaV2;
10
+ /** Keyed by table id (`table:<schema>.<name>`). Missing when no `tables/<x>.md` exists. */
11
+ tables: Record<string, ParsedTableMarkdown>;
12
+ concepts?: ParsedConceptsMarkdown;
13
+ };
14
+ /**
15
+ * Load a v2 schema directory into the form the chunker expects.
16
+ *
17
+ * Directory layout matches the schema-v2 contract:
18
+ * `<schemaId>.schema/`
19
+ * `schema.json`
20
+ * `tables/*.md`
21
+ * `concepts.md` (optional)
22
+ */
23
+ export declare function loadChunkerSourcesFromDir(dir: string): ChunkerSources;
24
+ /**
25
+ * Load a v2 bundle (`*.bundle.json` produced by `askdb bundle`) into the
26
+ * chunker's source shape. Bundles preserve the raw markdown bodies under
27
+ * `tables: { filename: content }` so the chunker can re-parse them.
28
+ */
29
+ export declare function loadChunkerSourcesFromBundleJson(raw: string): ChunkerSources;
30
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../src/chunker/sources.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CACnC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA8BrE;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA0B5E"}
@@ -0,0 +1,68 @@
1
+ import { readFileSync, readdirSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { loadSchema, loadSchemaFromJson, parseConceptsMarkdown, parseTableMarkdown, } from "@askdb/core";
4
+ /**
5
+ * Load a v2 schema directory into the form the chunker expects.
6
+ *
7
+ * Directory layout matches the schema-v2 contract:
8
+ * `<schemaId>.schema/`
9
+ * `schema.json`
10
+ * `tables/*.md`
11
+ * `concepts.md` (optional)
12
+ */
13
+ export function loadChunkerSourcesFromDir(dir) {
14
+ const resolved = resolve(dir);
15
+ const schema = loadSchema(resolved);
16
+ const tables = {};
17
+ const tableDir = join(resolved, "tables");
18
+ let entries = [];
19
+ try {
20
+ entries = readdirSync(tableDir).sort();
21
+ }
22
+ catch {
23
+ entries = [];
24
+ }
25
+ for (const entry of entries) {
26
+ if (!entry.endsWith(".md"))
27
+ continue;
28
+ const filePath = join(tableDir, entry);
29
+ const content = readFileSync(filePath, "utf8");
30
+ const parsed = parseTableMarkdown(content, filePath);
31
+ tables[parsed.frontmatter.id] = parsed;
32
+ }
33
+ let concepts;
34
+ try {
35
+ const conceptsPath = join(resolved, "concepts.md");
36
+ const content = readFileSync(conceptsPath, "utf8");
37
+ concepts = parseConceptsMarkdown(content, conceptsPath);
38
+ }
39
+ catch {
40
+ // optional
41
+ }
42
+ return { schema, tables, concepts };
43
+ }
44
+ /**
45
+ * Load a v2 bundle (`*.bundle.json` produced by `askdb bundle`) into the
46
+ * chunker's source shape. Bundles preserve the raw markdown bodies under
47
+ * `tables: { filename: content }` so the chunker can re-parse them.
48
+ */
49
+ export function loadChunkerSourcesFromBundleJson(raw) {
50
+ const parsed = JSON.parse(raw);
51
+ if (!parsed.bundled) {
52
+ throw new Error("Expected a bundled schema JSON (missing `bundled: true`).");
53
+ }
54
+ const schema = loadSchemaFromJson(raw);
55
+ const tables = {};
56
+ const filenames = Object.keys(parsed.tables ?? {}).sort();
57
+ for (const filename of filenames) {
58
+ const content = parsed.tables[filename];
59
+ const parsedMd = parseTableMarkdown(content, filename);
60
+ tables[parsedMd.frontmatter.id] = parsedMd;
61
+ }
62
+ let concepts;
63
+ if (parsed.concepts) {
64
+ concepts = parseConceptsMarkdown(parsed.concepts, "concepts.md");
65
+ }
66
+ return { schema, tables, concepts };
67
+ }
68
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/chunker/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAoBrB;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEpC,MAAM,MAAM,GAAwC,EAAE,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1C,IAAI,OAAO,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC;QACH,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,SAAS;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,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C;IAED,IAAI,QAA4C,CAAC;IACjD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,QAAQ,GAAG,qBAAqB,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACtC,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { Embedder } from "./types.js";
2
+ export declare function runRagCli(argv: readonly string[]): Promise<number>;
3
+ /**
4
+ * Deterministic mock embedder used for tests, CI, and quick smoke-checks.
5
+ *
6
+ * Produces a stable lexical bag-of-words vector by hashing normalized tokens;
7
+ * same text always yields the same vector. Not a real embedder, but useful for
8
+ * local smoke tests because shared terms like "revenue" can rank related chunks.
9
+ */
10
+ export declare function createMockEmbedder(dim?: number): Embedder;
11
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,QAAQ,EAIT,MAAM,YAAY,CAAC;AAuBpB,wBAAsB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA2BxE;AAqHD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,SAAK,GAAG,QAAQ,CAYrD"}