@bendyline/gezel-knowledge 1.1.0 → 1.1.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.
- package/README.md +1 -1
- package/dist/index.d.ts +238 -12
- package/dist/index.js +1336 -95
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install @bendyline/gezel-knowledge
|
|
|
12
12
|
|
|
13
13
|
## What a `.gezk` is
|
|
14
14
|
|
|
15
|
-
An open format (gezk 0.
|
|
15
|
+
An open format (gezk 0.6, preliminary until 1.0; 0.5 archives still open): a ZIP whose first entry is
|
|
16
16
|
the stored `mimetype` magic (`application/vnd.gezk+zip`), then
|
|
17
17
|
`manifest.json`, `README.md`, `LICENSES/`, a `router.db` (topics, document
|
|
18
18
|
directory, brotli bodies, routing centroids) and shard SQLite databases with
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CatalogDocument, KnowledgeEmbeddingProfile, KnowledgeChunkingProfile, KnowledgeCatalogManifest, KnowledgeRegistryIndex, KnowledgeRegistryEntry } from '@bendyline/gezk';
|
|
2
|
-
export { BODY_CODEC_MIN_BYTES, CatalogDocument, GEZK_APPLICATION_ID, GEZK_FORMAT_VERSION, GEZK_INDEX_SCHEMA_VERSION, GEZK_MIME_TYPE, KnowledgeCatalogManifest, KnowledgeChunkingProfile, KnowledgeEmbeddingProfile, KnowledgeRegistryEntry, KnowledgeRegistryIndex, LICENSE_NOTICE_PATH, MANIFEST_PATH, MAX_KNOWLEDGE_DOCUMENT_BYTES, MIMETYPE_PATH, README_PATH, ROUTER_DB_PATH, ROUTER_DDL, SHARD_DDL, SOURCE_NOTICES_PATH, ZIP_FIXED_MTIME, canonicalizeJson, documentSlug, l2Normalize, quantizeBinary, quantizeInt8, rerankScore } from '@bendyline/gezk';
|
|
1
|
+
import { CatalogDocument, KnowledgeEmbeddingProfile, KnowledgeChunkingProfile, KnowledgeCatalogManifest, GezkIndexSchemaVersion, KnowledgeRegistryIndex, KnowledgeRegistryEntry } from '@bendyline/gezk';
|
|
2
|
+
export { BODY_CODEC_MIN_BYTES, CatalogDocument, GEZK_APPLICATION_ID, GEZK_FORMAT_GENERATIONS, GEZK_FORMAT_VERSION, GEZK_INDEX_SCHEMA_VERSION, GEZK_MIME_TYPE, GEZK_SUPPORTED_FORMAT_VERSIONS, GEZK_SUPPORTED_INDEX_SCHEMA_VERSIONS, GezkFormatVersion, GezkIndexSchemaVersion, KnowledgeCatalogManifest, KnowledgeChunkingProfile, KnowledgeEmbeddingProfile, KnowledgeRegistryEntry, KnowledgeRegistryIndex, LICENSE_NOTICE_PATH, MANIFEST_PATH, MAX_KNOWLEDGE_DOCUMENT_BYTES, MAX_KNOWLEDGE_DOCUMENT_META_BYTES, MAX_KNOWLEDGE_TOPIC_DEPTH, MIMETYPE_PATH, README_PATH, ROUTER_DB_PATH, ROUTER_DDL, SHARD_DDL, SOURCE_NOTICES_PATH, ZIP_FIXED_MTIME, canonicalizeJson, documentSlug, isSupportedFormatVersion, isSupportedIndexSchemaVersion, l2Normalize, quantizeBinary, quantizeInt8, rerankScore } from '@bendyline/gezk';
|
|
3
3
|
import { KnowledgeTrustAnchor } from '@bendyline/gezk/node';
|
|
4
4
|
export { KnowledgeTrustAnchor, ManifestSignatureVerdict, chunkContentHash, chunkUid, generateKnowledgeSigningKeyPair, knowledgeKeyId, manifestSigningPayload, signManifest, signRegistryIndex, verifyManifestSignature, verifyRegistryIndex } from '@bendyline/gezk/node';
|
|
5
5
|
import { DatabaseSync as DatabaseSync$1 } from 'node:sqlite';
|
|
@@ -68,7 +68,7 @@ type ChunkerOptions = CharChunkerOptions | TokenChunkerOptions;
|
|
|
68
68
|
declare function chunkMarkdownProfile(md: string, opts: ChunkerOptions): MarkdownChunk[];
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* `.gezk` compiler (gezk 0.
|
|
71
|
+
* `.gezk` compiler (gezk 0.6; spec in bendyline/gezk). One owner of normalization, chunk
|
|
72
72
|
* ids, embedding-profile conformance, SQLite schema, shard assignment,
|
|
73
73
|
* centroid routing, and deterministic archive layout — the CLI's Markdown
|
|
74
74
|
* adapter and Qualla's Wikipedia adapter both feed this API.
|
|
@@ -93,6 +93,13 @@ interface CompileTopic {
|
|
|
93
93
|
description?: string;
|
|
94
94
|
sortKey?: string;
|
|
95
95
|
}
|
|
96
|
+
interface CompileAsset {
|
|
97
|
+
/** Archive path, `assets/…`, matching the format's asset path grammar. */
|
|
98
|
+
path: string;
|
|
99
|
+
/** Exactly one of `absPath` / `content`. */
|
|
100
|
+
absPath?: string;
|
|
101
|
+
content?: Buffer;
|
|
102
|
+
}
|
|
96
103
|
interface CompileKnowledgeCatalogOptions {
|
|
97
104
|
catalog: {
|
|
98
105
|
id: string;
|
|
@@ -160,9 +167,17 @@ interface CompileKnowledgeCatalogOptions {
|
|
|
160
167
|
/**
|
|
161
168
|
* Extra archive files (path → utf8 content). `README.md` and
|
|
162
169
|
* `LICENSES/catalog.txt` are always shipped: minimal ones are generated
|
|
163
|
-
* from the catalog block unless supplied here.
|
|
170
|
+
* from the catalog block unless supplied here. Paths under `assets/` are
|
|
171
|
+
* refused here — images go through `assets`.
|
|
164
172
|
*/
|
|
165
173
|
extraFiles?: Record<string, string>;
|
|
174
|
+
/**
|
|
175
|
+
* Images shipped under `assets/` for document bodies to reference by
|
|
176
|
+
* archive path. Each is validated against the format's asset rules
|
|
177
|
+
* (path grammar, size, leading bytes matching the extension, inert SVG)
|
|
178
|
+
* and declared in `manifest.files` like every other entry.
|
|
179
|
+
*/
|
|
180
|
+
assets?: CompileAsset[];
|
|
166
181
|
/**
|
|
167
182
|
* Last touch before the manifest is archived — the signing seam
|
|
168
183
|
* (signatures/signing.ts `signManifest`). Must only add/replace the
|
|
@@ -269,7 +284,7 @@ type DatabaseSync = DatabaseSync$1;
|
|
|
269
284
|
* publisher artifact: it mkdirs the parent, switches on WAL (sidecar files),
|
|
270
285
|
* and quarantine-RENAMES a corrupt database. A catalog reader must fail
|
|
271
286
|
* with a typed reason and never touch the bytes. No extension is loaded:
|
|
272
|
-
* every table in a
|
|
287
|
+
* every table in a catalog is plain SQLite (plus FTS5).
|
|
273
288
|
*/
|
|
274
289
|
|
|
275
290
|
declare class CatalogOpenError extends Error {
|
|
@@ -278,6 +293,8 @@ declare class CatalogOpenError extends Error {
|
|
|
278
293
|
}
|
|
279
294
|
interface CatalogDb {
|
|
280
295
|
db: DatabaseSync;
|
|
296
|
+
/** The `PRAGMA user_version` generation the file was written with. */
|
|
297
|
+
schemaVersion: GezkIndexSchemaVersion;
|
|
281
298
|
close(): void;
|
|
282
299
|
}
|
|
283
300
|
/**
|
|
@@ -303,13 +320,17 @@ declare function openCatalogDatabase(absPath: string): CatalogDb;
|
|
|
303
320
|
* the daemon confines every handle to its knowledge worker thread; the CLI
|
|
304
321
|
* and tests call it directly.
|
|
305
322
|
*/
|
|
323
|
+
|
|
306
324
|
interface CatalogTopic {
|
|
307
325
|
id: string;
|
|
308
326
|
parentId: string | null;
|
|
309
327
|
name: string;
|
|
310
328
|
description: string | null;
|
|
311
329
|
sortKey: string;
|
|
330
|
+
/** Documents filed directly at this topic (`topics.document_count`). */
|
|
312
331
|
documentCount: number;
|
|
332
|
+
/** Direct plus every descendant topic's documents (computed at read time). */
|
|
333
|
+
totalDocumentCount: number;
|
|
313
334
|
}
|
|
314
335
|
interface CatalogDocumentMeta {
|
|
315
336
|
id: string;
|
|
@@ -317,11 +338,26 @@ interface CatalogDocumentMeta {
|
|
|
317
338
|
slug: string;
|
|
318
339
|
summary: string | null;
|
|
319
340
|
language: string;
|
|
341
|
+
/** The topic the document is filed at — the leaf of its path on 0.6, the root on 0.5. */
|
|
320
342
|
topicId: string;
|
|
343
|
+
/** Listing position among the documents of its topic; null when unordered. */
|
|
344
|
+
ordinal: number | null;
|
|
321
345
|
sourceUrl: string | null;
|
|
322
346
|
sourceRevision: string | null;
|
|
323
347
|
sourceUpdatedAt: string | null;
|
|
324
348
|
attribution: Record<string, string> | null;
|
|
349
|
+
/** Producer-defined metadata (`meta_json`), opaque to the reader. */
|
|
350
|
+
meta: Record<string, unknown> | null;
|
|
351
|
+
}
|
|
352
|
+
interface CatalogAssetInfo {
|
|
353
|
+
/** Archive path under `assets/`. */
|
|
354
|
+
path: string;
|
|
355
|
+
contentType: string;
|
|
356
|
+
sizeBytes: number;
|
|
357
|
+
sha256: string;
|
|
358
|
+
}
|
|
359
|
+
interface CatalogAssetRead extends CatalogAssetInfo {
|
|
360
|
+
bytes: Uint8Array;
|
|
325
361
|
}
|
|
326
362
|
interface CatalogChunkHit {
|
|
327
363
|
chunkUid: string;
|
|
@@ -346,8 +382,11 @@ declare class CatalogHandle {
|
|
|
346
382
|
private readonly router;
|
|
347
383
|
private readonly connections;
|
|
348
384
|
private readonly bitIndexes;
|
|
385
|
+
private assetsByPath;
|
|
349
386
|
readonly meta: Record<string, string>;
|
|
350
387
|
readonly shards: ShardInfo[];
|
|
388
|
+
/** The router's `PRAGMA user_version` generation; decides which columns exist. */
|
|
389
|
+
readonly schemaVersion: GezkIndexSchemaVersion;
|
|
351
390
|
private constructor();
|
|
352
391
|
/** Open a catalog's extracted version directory (the dir holding manifest.json). */
|
|
353
392
|
static open(rootDir: string): CatalogHandle;
|
|
@@ -371,11 +410,24 @@ declare class CatalogHandle {
|
|
|
371
410
|
private dimensions;
|
|
372
411
|
/** Resolve a manifest/router path without allowing it to escape the catalog. */
|
|
373
412
|
resolveCatalogPath(path: string): string;
|
|
413
|
+
/** The format version the router was written with (`meta.format_version`). */
|
|
414
|
+
get formatVersion(): string;
|
|
415
|
+
private documentColumns;
|
|
416
|
+
private documentOrder;
|
|
417
|
+
/**
|
|
418
|
+
* Every topic with its direct count and a rollup over its subtree. On a
|
|
419
|
+
* 0.5 catalog every document sits at a root, so both counts agree there.
|
|
420
|
+
*/
|
|
374
421
|
topics(): CatalogTopic[];
|
|
422
|
+
/**
|
|
423
|
+
* A page of documents, by default including those filed under the topic's
|
|
424
|
+
* descendants (`descendants: false` lists only the topic's own).
|
|
425
|
+
*/
|
|
375
426
|
documentsPage(opts?: {
|
|
376
427
|
topicId?: string;
|
|
377
428
|
offset?: number;
|
|
378
429
|
limit?: number;
|
|
430
|
+
descendants?: boolean;
|
|
379
431
|
}): {
|
|
380
432
|
documents: CatalogDocumentMeta[];
|
|
381
433
|
total: number;
|
|
@@ -383,6 +435,32 @@ declare class CatalogHandle {
|
|
|
383
435
|
getDocument(id: string): (CatalogDocumentMeta & {
|
|
384
436
|
markdown: string;
|
|
385
437
|
}) | null;
|
|
438
|
+
/** Documents whose `topic_id` names no declared topic (a validator check). */
|
|
439
|
+
documentsWithUndeclaredTopic(): number;
|
|
440
|
+
/**
|
|
441
|
+
* Validator support: every `meta_json` must be a JSON object within the
|
|
442
|
+
* byte limit. Returns the offending ids (capped) rather than throwing.
|
|
443
|
+
*/
|
|
444
|
+
checkDocumentMeta(maxBytes: number, cap?: number): {
|
|
445
|
+
invalid: string[];
|
|
446
|
+
oversize: string[];
|
|
447
|
+
};
|
|
448
|
+
/** Validator support: decoded bodies, streamed one at a time. */
|
|
449
|
+
documentBodies(): IterableIterator<{
|
|
450
|
+
id: string;
|
|
451
|
+
markdown: string;
|
|
452
|
+
}>;
|
|
453
|
+
private decodeBody;
|
|
454
|
+
/**
|
|
455
|
+
* The manifest's `files` entries under `assets/`, read lazily: the
|
|
456
|
+
* declaration in the manifest is what authorizes serving a file, since
|
|
457
|
+
* extraction reconciled and hashed every declared entry.
|
|
458
|
+
*/
|
|
459
|
+
private assetIndex;
|
|
460
|
+
/** Declared assets, sorted by path. */
|
|
461
|
+
assets(): CatalogAssetInfo[];
|
|
462
|
+
/** One declared asset's bytes, or null when the catalog declares no such asset. */
|
|
463
|
+
readAsset(path: string): CatalogAssetRead | null;
|
|
386
464
|
/** Catalog-wide title/summary/alias FTS — always runs regardless of routing. */
|
|
387
465
|
searchDocumentsFts(query: string, limit?: number): Array<{
|
|
388
466
|
documentId: string;
|
|
@@ -457,6 +535,8 @@ interface ValidateCatalogOptions {
|
|
|
457
535
|
deep?: boolean;
|
|
458
536
|
}
|
|
459
537
|
declare function validateExtractedCatalog(rootDir: string, opts?: ValidateCatalogOptions): Promise<CatalogValidationReport>;
|
|
538
|
+
/** `[…](assets/…)` and `` targets in a body, deduplicated. */
|
|
539
|
+
declare function assetReferences(markdown: string): string[];
|
|
460
540
|
|
|
461
541
|
/**
|
|
462
542
|
* Stage-1 retrieval over a shard's sign-bit vectors, in memory. A full
|
|
@@ -529,7 +609,7 @@ declare function runDuckdbScript(cli: DuckdbCli, sql: string): Promise<string>;
|
|
|
529
609
|
* bytes.
|
|
530
610
|
*/
|
|
531
611
|
|
|
532
|
-
declare const PARQUET_EXPORT_VERSION =
|
|
612
|
+
declare const PARQUET_EXPORT_VERSION = 2;
|
|
533
613
|
type ParquetExportSource = {
|
|
534
614
|
archivePath: string;
|
|
535
615
|
} | {
|
|
@@ -820,28 +900,174 @@ declare function createProfileEmbedder(profile: KnowledgeEmbeddingProfile, opts?
|
|
|
820
900
|
transformers?: TransformersModule;
|
|
821
901
|
}): Promise<ProfileEmbedder>;
|
|
822
902
|
|
|
903
|
+
/**
|
|
904
|
+
* Tables of contents that documentation trees already carry. Each parser
|
|
905
|
+
* turns one tool's outline into the same shape — a tree of topics holding
|
|
906
|
+
* ordered document entries — which the Markdown adapter lays over its
|
|
907
|
+
* folder-derived tree: a file the outline names is filed where the outline
|
|
908
|
+
* puts it, with the outline's title and position, and a file it omits stays
|
|
909
|
+
* in its folder. Parsers are pure: they see text and the list of Markdown
|
|
910
|
+
* files, never the disk, so an outline can be checked in a test without a
|
|
911
|
+
* tree on disk.
|
|
912
|
+
*/
|
|
913
|
+
type TableOfContentsFormat = 'folders' | 'hugo' | 'gitbook' | 'mkdocs' | 'jupyter-book';
|
|
914
|
+
type OutlineFormat = Exclude<TableOfContentsFormat, 'folders' | 'hugo'>;
|
|
915
|
+
interface OutlineEntry {
|
|
916
|
+
/** Root-relative POSIX path of the Markdown file, extension included. */
|
|
917
|
+
file: string;
|
|
918
|
+
/** The title the outline gives the page; wins over the file's own. */
|
|
919
|
+
title?: string;
|
|
920
|
+
/** Listing position among the documents of the containing topic. */
|
|
921
|
+
order?: number;
|
|
922
|
+
}
|
|
923
|
+
interface OutlineTopic {
|
|
924
|
+
name: string;
|
|
925
|
+
description?: string;
|
|
926
|
+
/** Position among sibling topics. */
|
|
927
|
+
order?: number;
|
|
928
|
+
/** When set, the topic takes the resolved title of this document (a root-relative file). */
|
|
929
|
+
titleFromFile?: string;
|
|
930
|
+
children: OutlineTopic[];
|
|
931
|
+
entries: OutlineEntry[];
|
|
932
|
+
}
|
|
933
|
+
interface Outline {
|
|
934
|
+
format: OutlineFormat;
|
|
935
|
+
/** Top-level documents and topics; `root.name` is unused. */
|
|
936
|
+
root: OutlineTopic;
|
|
937
|
+
/** Root-relative files that are the outline itself and never documents. */
|
|
938
|
+
consumed: string[];
|
|
939
|
+
warnings: string[];
|
|
940
|
+
}
|
|
941
|
+
declare function newOutlineTopic(name: string): OutlineTopic;
|
|
942
|
+
/**
|
|
943
|
+
* A link target relative to `baseDir` (root-relative POSIX, `''` for the
|
|
944
|
+
* root) as a root-relative POSIX path, or null when it is empty, absolute
|
|
945
|
+
* or leaves the root. Fragments and queries are dropped.
|
|
946
|
+
*/
|
|
947
|
+
declare function resolveOutlinePath(baseDir: string, target: string): string | null;
|
|
948
|
+
/**
|
|
949
|
+
* Positions become orders wherever the outline gave none. Entries and
|
|
950
|
+
* child topics are ranked separately, each 1-based, because the catalog
|
|
951
|
+
* orders documents by ordinal and topics by sort key.
|
|
952
|
+
*/
|
|
953
|
+
declare function assignOutlineOrders(topic: OutlineTopic): void;
|
|
954
|
+
/**
|
|
955
|
+
* `getting-started` → `Getting Started`. Separators become spaces and each
|
|
956
|
+
* all-lowercase word is capitalized; a word that already carries a capital
|
|
957
|
+
* (`API`, `iPhone`) is left as written.
|
|
958
|
+
*/
|
|
959
|
+
declare function titleFromFolderName(name: string): string;
|
|
960
|
+
/**
|
|
961
|
+
* GitBook's `SUMMARY.md`: a nested list of `[Title](page.md)` items, where a
|
|
962
|
+
* `## Heading` opens a part. An item with children becomes a topic; when
|
|
963
|
+
* it links a page, that page leads the topic. Plain-text items are groups.
|
|
964
|
+
*/
|
|
965
|
+
declare function parseGitbookSummary(text: string, summaryFile: string): Outline;
|
|
966
|
+
/**
|
|
967
|
+
* The `nav` list of an `mkdocs.yml`: `- page.md`, `- Title: page.md`, and
|
|
968
|
+
* `- Section: [ … ]`. Returns null when the config has no `nav`, which in
|
|
969
|
+
* MkDocs means the folder tree is the outline — the adapter's default too.
|
|
970
|
+
* `docsDir` is the docs directory relative to the content root.
|
|
971
|
+
*/
|
|
972
|
+
declare function parseMkdocsNav(config: unknown, docsDir: string, configFile?: string): Outline | null;
|
|
973
|
+
/**
|
|
974
|
+
* Jupyter Book's `_toc.yml`: `format: jb-book` (`root`, `parts` with a
|
|
975
|
+
* `caption`, `chapters`, nested `sections`) or `jb-article` (`root`,
|
|
976
|
+
* `sections`); the pre-1.0 list form is read too. Files are named without
|
|
977
|
+
* extension and resolved against the Markdown files of the tree, so a
|
|
978
|
+
* notebook entry is skipped with a warning. A chapter with sections becomes
|
|
979
|
+
* a topic, led by its own page; `glob` entries expand in sorted order;
|
|
980
|
+
* `url` entries are links, not pages.
|
|
981
|
+
*/
|
|
982
|
+
declare function parseJupyterBookToc(doc: unknown, tocDir: string, files: readonly string[], tocFile?: string): Outline;
|
|
983
|
+
|
|
823
984
|
/**
|
|
824
985
|
* Markdown-folder catalog source — the `gezel knowledge build` input adapter.
|
|
825
986
|
* Folders become the shipped table of contents (a format requirement:
|
|
826
|
-
* the gezk spec §5.2), files become documents
|
|
827
|
-
*
|
|
828
|
-
*
|
|
987
|
+
* the gezk spec §5.2), files become documents, images the bodies reference
|
|
988
|
+
* become assets. A flat corpus — files at the root with no subfolders —
|
|
989
|
+
* gets the single root topic the compiler demands.
|
|
990
|
+
*
|
|
991
|
+
* A tree that already carries an outline keeps it: GitBook's `SUMMARY.md`,
|
|
992
|
+
* an `mkdocs.yml` nav and Jupyter Book's `_toc.yml` are read into the same
|
|
993
|
+
* topic tree (`outline.ts`), and Hugo's conventions — `_index.md` section
|
|
994
|
+
* pages, `weight`, `draft` — are honored on top of the folders. A file an
|
|
995
|
+
* outline omits stays in its folder, with a warning, so nothing is lost.
|
|
996
|
+
*
|
|
997
|
+
* Front matter carries what a documentation tree knows about itself: the
|
|
998
|
+
* title and summary, an explicit `id`, an `order` (the listing ordinal), a
|
|
999
|
+
* `subcategory` shelf below the folder topic, and anything else as opaque
|
|
1000
|
+
* metadata. Two passes keep it deterministic: the first walks files in
|
|
1001
|
+
* sorted order and fixes every id; the second rewrites relative image and
|
|
1002
|
+
* article links now that every target is known.
|
|
829
1003
|
*/
|
|
830
1004
|
|
|
831
1005
|
interface MarkdownCatalogSource {
|
|
832
1006
|
topics: CompileTopic[];
|
|
833
1007
|
documents: CatalogDocument[];
|
|
1008
|
+
/** Images referenced by the bodies, resolved to files under the root. */
|
|
1009
|
+
assets: CompileAsset[];
|
|
1010
|
+
/** The outline that shaped the topics, with its file when it came from one. */
|
|
1011
|
+
toc: {
|
|
1012
|
+
format: TableOfContentsFormat;
|
|
1013
|
+
path?: string;
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
interface TopicOverride {
|
|
1017
|
+
name?: string;
|
|
1018
|
+
/** Listing position among sibling topics; encoded into the sort key. */
|
|
1019
|
+
order?: number;
|
|
1020
|
+
description?: string;
|
|
1021
|
+
}
|
|
1022
|
+
interface TableOfContentsOptions {
|
|
1023
|
+
format: TableOfContentsFormat;
|
|
1024
|
+
/**
|
|
1025
|
+
* The outline file for `gitbook` (`SUMMARY.md`), `mkdocs` (`mkdocs.yml`)
|
|
1026
|
+
* and `jupyter-book` (`_toc.yml`), absolute or relative to the root. By
|
|
1027
|
+
* default the root is searched, and for mkdocs its parent as well.
|
|
1028
|
+
*/
|
|
1029
|
+
path?: string;
|
|
834
1030
|
}
|
|
835
1031
|
interface LoadMarkdownCatalogOptions {
|
|
836
1032
|
language: string;
|
|
837
1033
|
/** Topic id used for root-level files (default `general`). */
|
|
838
1034
|
rootTopicId?: string;
|
|
839
1035
|
rootTopicName?: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* Root-relative POSIX directory path → overrides. An explicit entry wins
|
|
1038
|
+
* over a `_topic.yaml` sidecar in that directory.
|
|
1039
|
+
*/
|
|
1040
|
+
topics?: Record<string, TopicOverride>;
|
|
1041
|
+
/** Root-relative files (POSIX) to leave out, e.g. `['README.md']`. */
|
|
1042
|
+
ignore?: string[];
|
|
1043
|
+
/** Where the table of contents comes from (default: the folders). */
|
|
1044
|
+
toc?: TableOfContentsOptions;
|
|
1045
|
+
/**
|
|
1046
|
+
* When set, relative links to other Markdown files in the tree are
|
|
1047
|
+
* rewritten to `knowledge://` references so a viewer can follow them.
|
|
1048
|
+
*/
|
|
1049
|
+
uri?: {
|
|
1050
|
+
publisherId: string;
|
|
1051
|
+
catalogId: string;
|
|
1052
|
+
};
|
|
1053
|
+
/** What to do with an image link whose file is missing (default `error`). */
|
|
1054
|
+
missingAssets?: 'error' | 'warn';
|
|
1055
|
+
onWarning?: (message: string) => void;
|
|
840
1056
|
}
|
|
1057
|
+
/** The docs directory an `mkdocs.yml` names (`docs_dir`, default `docs`), absolute. */
|
|
1058
|
+
declare function readMkdocsDocsDir(mkdocsPath: string): Promise<string>;
|
|
1059
|
+
/**
|
|
1060
|
+
* Which outline a tree carries: GitBook's `SUMMARY.md` or Jupyter Book's
|
|
1061
|
+
* `_toc.yml` at the root, an `mkdocs.yml` at the root, the project folder
|
|
1062
|
+
* or the root's parent, Hugo's `_index.md` section pages anywhere in the
|
|
1063
|
+
* tree — else the folders themselves.
|
|
1064
|
+
*/
|
|
1065
|
+
declare function detectTableOfContents(rootDir: string, projectDir?: string): Promise<TableOfContentsOptions>;
|
|
841
1066
|
/**
|
|
842
1067
|
* Load a folder of Markdown into compiler inputs. Directory chain → topic
|
|
843
|
-
* chain; the relative path (without
|
|
844
|
-
* document id
|
|
1068
|
+
* chain unless an outline places the file; the relative path (without
|
|
1069
|
+
* extension, `/`-separated) is the stable document id unless the front
|
|
1070
|
+
* matter names one.
|
|
845
1071
|
*/
|
|
846
1072
|
declare function loadMarkdownCatalog(rootDir: string, opts: LoadMarkdownCatalogOptions): Promise<MarkdownCatalogSource>;
|
|
847
1073
|
|
|
@@ -924,4 +1150,4 @@ declare function newerRegistryEntries(registry: KnowledgeRegistryIndex, installe
|
|
|
924
1150
|
|
|
925
1151
|
declare const BUILTIN_KNOWLEDGE_TRUST_ANCHORS: readonly KnowledgeTrustAnchor[];
|
|
926
1152
|
|
|
927
|
-
export { type ArchiveEntry, type ArtifactCheck, type ArtifactRole, BGE_SMALL_EN_V15_1, BUILTIN_KNOWLEDGE_TRUST_ANCHORS, CENTROID_CHUNKS_PER, CENTROID_KMEANS_MAX_ITER, CENTROID_MAX_PER_SHARD, CENTROID_SAMPLE_MAX, type CatalogCheck, type CatalogChunkHit, type CatalogDb, type CatalogDocumentMeta, CatalogHandle, CatalogOpenError, type CatalogTopic, type CatalogValidationReport, type CharChunkerOptions, type ChunkerOptions, type CompileKnowledgeCatalogOptions, type CompileReport, type CompileTopic, type DuckdbCli, DuckdbError, EmbedderArtifactError, EmbedderUnavailableError, type FetchKnowledgeRegistryOptions, GEZEL_BGE_SMALL_EN_V15_1, GEZEL_MARKDOWN_CHUNKS_2, GEZEL_MULTILINGUAL_E5_SMALL_1, GEZK_ARCHIVE_LIMITS, GezkArchiveError, type GezkArchiveInspection, type HammingHit, KNOWLEDGE_EMBEDDING_PROFILES, KNOWLEDGE_TOOLCHAIN, type KnowledgeRegistryFetchCode, KnowledgeRegistryFetchError, type LoadMarkdownCatalogOptions, MARKDOWN_CHUNKS_2, MULTILINGUAL_E5_SMALL_1, type MarkdownCatalogSource, type MarkdownChunk, PARQUET_EXPORT_VERSION, PARQUET_REPORT_PATH, type ParquetExportFile, type ParquetExportOptions, type ParquetExportProgress, type ParquetExportReport, type ParquetExportSource, type ParquetTable, type PipelineFn, type ProfileEmbedder, RERANK_FINAL_K, ROUTE_SHARDS_EXPLICIT, ROUTE_SHARDS_PROACTIVE, SHARD_MAX_CHUNKS, SHARD_TARGET_CHUNKS, type ShardBitIndex, type TokenChunkerOptions, type TokenizerFn, type TransformersModelOptions, type TransformersModule, type ValidateCatalogOptions, type VerifiedArtifacts, assertDuckdbCli, chunkMarkdownProfile, compareCatalogVersions, compileKnowledgeCatalog, createProfileEmbedder, duckdbVersion, exportCatalogParquet, extractGezkVerified, fetchKnowledgeRegistry, findDuckdbBinary, findRegistryEntry, hammingTopK, inspectGezkArchive, knowledgeEmbeddingProfile, loadMarkdownCatalog, newerRegistryEntries, openCatalogDatabase, readGezkManifest, rerankK, resolveTransformersModelOptions, runDuckdbScript, transformersCachePath, validateExtractedCatalog, verifyProfileArtifacts, writeGezkArchive };
|
|
1153
|
+
export { type ArchiveEntry, type ArtifactCheck, type ArtifactRole, BGE_SMALL_EN_V15_1, BUILTIN_KNOWLEDGE_TRUST_ANCHORS, CENTROID_CHUNKS_PER, CENTROID_KMEANS_MAX_ITER, CENTROID_MAX_PER_SHARD, CENTROID_SAMPLE_MAX, type CatalogAssetInfo, type CatalogAssetRead, type CatalogCheck, type CatalogChunkHit, type CatalogDb, type CatalogDocumentMeta, CatalogHandle, CatalogOpenError, type CatalogTopic, type CatalogValidationReport, type CharChunkerOptions, type ChunkerOptions, type CompileAsset, type CompileKnowledgeCatalogOptions, type CompileReport, type CompileTopic, type DuckdbCli, DuckdbError, EmbedderArtifactError, EmbedderUnavailableError, type FetchKnowledgeRegistryOptions, GEZEL_BGE_SMALL_EN_V15_1, GEZEL_MARKDOWN_CHUNKS_2, GEZEL_MULTILINGUAL_E5_SMALL_1, GEZK_ARCHIVE_LIMITS, GezkArchiveError, type GezkArchiveInspection, type HammingHit, KNOWLEDGE_EMBEDDING_PROFILES, KNOWLEDGE_TOOLCHAIN, type KnowledgeRegistryFetchCode, KnowledgeRegistryFetchError, type LoadMarkdownCatalogOptions, MARKDOWN_CHUNKS_2, MULTILINGUAL_E5_SMALL_1, type MarkdownCatalogSource, type MarkdownChunk, type Outline, type OutlineEntry, type OutlineFormat, type OutlineTopic, PARQUET_EXPORT_VERSION, PARQUET_REPORT_PATH, type ParquetExportFile, type ParquetExportOptions, type ParquetExportProgress, type ParquetExportReport, type ParquetExportSource, type ParquetTable, type PipelineFn, type ProfileEmbedder, RERANK_FINAL_K, ROUTE_SHARDS_EXPLICIT, ROUTE_SHARDS_PROACTIVE, SHARD_MAX_CHUNKS, SHARD_TARGET_CHUNKS, type ShardBitIndex, type TableOfContentsFormat, type TableOfContentsOptions, type TokenChunkerOptions, type TokenizerFn, type TopicOverride, type TransformersModelOptions, type TransformersModule, type ValidateCatalogOptions, type VerifiedArtifacts, assertDuckdbCli, assetReferences, assignOutlineOrders, chunkMarkdownProfile, compareCatalogVersions, compileKnowledgeCatalog, createProfileEmbedder, detectTableOfContents, duckdbVersion, exportCatalogParquet, extractGezkVerified, fetchKnowledgeRegistry, findDuckdbBinary, findRegistryEntry, hammingTopK, inspectGezkArchive, knowledgeEmbeddingProfile, loadMarkdownCatalog, newOutlineTopic, newerRegistryEntries, openCatalogDatabase, parseGitbookSummary, parseJupyterBookToc, parseMkdocsNav, readGezkManifest, readMkdocsDocsDir, rerankK, resolveOutlinePath, resolveTransformersModelOptions, runDuckdbScript, titleFromFolderName, transformersCachePath, validateExtractedCatalog, verifyProfileArtifacts, writeGezkArchive };
|