@bendyline/gezk 1.0.1 → 1.0.3

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/index.d.ts CHANGED
@@ -48,6 +48,63 @@ declare const DEFAULT_EMBEDDING_TOKENIZER_FILE = "tokenizer.json";
48
48
  * name or a dimension is unsafe — two 384-dim models do not share a space,
49
49
  * and an instruction-prefix change silently changes vectors.
50
50
  */
51
+ declare const KnowledgeEmbeddingProfileObject: z.ZodObject<{
52
+ id: z.ZodString;
53
+ model: z.ZodObject<{
54
+ repo: z.ZodString;
55
+ revision: z.ZodString;
56
+ onnxFile: z.ZodOptional<z.ZodString>;
57
+ onnxDigest: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strip>;
59
+ tokenizer: z.ZodObject<{
60
+ kind: z.ZodString;
61
+ file: z.ZodOptional<z.ZodString>;
62
+ digest: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>;
64
+ pooling: z.ZodEnum<{
65
+ mean: "mean";
66
+ cls: "cls";
67
+ last: "last";
68
+ }>;
69
+ normalized: z.ZodBoolean;
70
+ dimensions: z.ZodNumber;
71
+ maxTokens: z.ZodNumber;
72
+ queryInstruction: z.ZodString;
73
+ passageInstruction: z.ZodString;
74
+ vectorEncoding: z.ZodEnum<{
75
+ "bit+int8": "bit+int8";
76
+ }>;
77
+ distance: z.ZodObject<{
78
+ stage1: z.ZodLiteral<"hamming">;
79
+ stage2: z.ZodLiteral<"cosine">;
80
+ }, z.core.$strip>;
81
+ quantization: z.ZodObject<{
82
+ int8: z.ZodObject<{
83
+ method: z.ZodLiteral<"symmetric-linear">;
84
+ scale: z.ZodLiteral<127>;
85
+ }, z.core.$strip>;
86
+ binary: z.ZodObject<{
87
+ method: z.ZodEnum<{
88
+ sign: "sign";
89
+ "centered-sign": "centered-sign";
90
+ }>;
91
+ threshold: z.ZodLiteral<0>;
92
+ packing: z.ZodLiteral<"lsb-first">;
93
+ center: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
94
+ }, z.core.$strip>;
95
+ }, z.core.$strip>;
96
+ }, z.core.$strip>;
97
+ type KnowledgeEmbeddingProfile = z.infer<typeof KnowledgeEmbeddingProfileObject>;
98
+ /**
99
+ * The cross-field rule the object schema cannot express on its own: a
100
+ * `centered-sign` profile must carry a center of exactly `dimensions`
101
+ * entries, and a `sign` profile must not carry one. Returns the problem, or
102
+ * null when the profile is consistent.
103
+ */
104
+ declare function embeddingProfileCenterProblem(profile: KnowledgeEmbeddingProfile): string | null;
105
+ /** The profile's binary center as a Float32Array, or null for a plain `sign` profile. */
106
+ declare function embeddingProfileCenter(profile: KnowledgeEmbeddingProfile): Float32Array | null;
107
+ /** The profile schema proper: the object shape plus the center rule above. */
51
108
  declare const KnowledgeEmbeddingProfileSchema: z.ZodObject<{
52
109
  id: z.ZodString;
53
110
  model: z.ZodObject<{
@@ -84,13 +141,16 @@ declare const KnowledgeEmbeddingProfileSchema: z.ZodObject<{
84
141
  scale: z.ZodLiteral<127>;
85
142
  }, z.core.$strip>;
86
143
  binary: z.ZodObject<{
87
- method: z.ZodLiteral<"sign">;
144
+ method: z.ZodEnum<{
145
+ sign: "sign";
146
+ "centered-sign": "centered-sign";
147
+ }>;
88
148
  threshold: z.ZodLiteral<0>;
89
149
  packing: z.ZodLiteral<"lsb-first">;
150
+ center: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
90
151
  }, z.core.$strip>;
91
152
  }, z.core.$strip>;
92
153
  }, z.core.$strip>;
93
- type KnowledgeEmbeddingProfile = z.infer<typeof KnowledgeEmbeddingProfileSchema>;
94
154
  /** The exact repo files a profile pins, with the format defaults applied. */
95
155
  declare function embeddingProfileArtifacts(profile: KnowledgeEmbeddingProfile): {
96
156
  onnxFile: string;
@@ -101,12 +161,19 @@ declare function embeddingProfileArtifacts(profile: KnowledgeEmbeddingProfile):
101
161
  /**
102
162
  * Whether two profiles describe one vector space, so vectors from either
103
163
  * may be compared: same model files at the same revision, same tokenizer,
104
- * pooling, normalization, dimensions, instruction prefixes and encoding.
105
- * The profile id and `maxTokens` are not compared — the first is a label,
106
- * the second a compile-time bound. A digest counts only when both sides
107
- * declare one: two pins at one revision that hash differently name
108
- * different artifacts, whatever the path says; an undeclared digest is
109
- * simply not a claim.
164
+ * pooling, normalization, dimensions, instruction prefixes, encoding and
165
+ * int8 quantization. The profile id and `maxTokens` are not compared — the
166
+ * first is a label, the second a compile-time bound. A digest counts only
167
+ * when both sides declare one: two pins at one revision that hash
168
+ * differently name different artifacts, whatever the path says; an
169
+ * undeclared digest is simply not a claim.
170
+ *
171
+ * The binary (stage-1) parameters are deliberately NOT compared. They
172
+ * describe how a catalog derived its own pre-filter bits, and a reader
173
+ * applies them from the catalog's profile echo; they never change what a
174
+ * query vector is. A daemon that shares a model with a `sign` profile
175
+ * therefore also shares it with the `centered-sign` revision of the same
176
+ * model — same floats in, same int8 rerank, only the bit scan differs.
110
177
  */
111
178
  declare function sameVectorSpace(a: KnowledgeEmbeddingProfile, b: KnowledgeEmbeddingProfile): boolean;
112
179
  /**
@@ -155,10 +222,11 @@ type KnowledgeSignature = z.infer<typeof KnowledgeSignatureSchema>;
155
222
  declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
156
223
  kind: z.ZodLiteral<"gezk-catalog">;
157
224
  formatVersion: z.ZodEnum<{
158
- 0.6: "0.6";
225
+ 0.7: "0.7";
159
226
  0.5: "0.5";
227
+ 0.6: "0.6";
160
228
  }>;
161
- indexSchemaVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<3>]>;
229
+ indexSchemaVersion: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>;
162
230
  id: z.ZodString;
163
231
  version: z.ZodString;
164
232
  name: z.ZodString;
@@ -217,9 +285,13 @@ declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
217
285
  scale: z.ZodLiteral<127>;
218
286
  }, z.core.$strip>;
219
287
  binary: z.ZodObject<{
220
- method: z.ZodLiteral<"sign">;
288
+ method: z.ZodEnum<{
289
+ sign: "sign";
290
+ "centered-sign": "centered-sign";
291
+ }>;
221
292
  threshold: z.ZodLiteral<0>;
222
293
  packing: z.ZodLiteral<"lsb-first">;
294
+ center: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
223
295
  }, z.core.$strip>;
224
296
  }, z.core.$strip>;
225
297
  }, z.core.$strip>;
@@ -269,10 +341,24 @@ declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
269
341
  sizeBytes: z.ZodNumber;
270
342
  sha256: z.ZodString;
271
343
  }, z.core.$strip>>;
344
+ spatial: z.ZodOptional<z.ZodObject<{
345
+ schema: z.ZodLiteral<"document-points@1">;
346
+ crs: z.ZodLiteral<"EPSG:4326">;
347
+ distanceModel: z.ZodLiteral<"sphere-6371000">;
348
+ locationCount: z.ZodNumber;
349
+ locatedDocuments: z.ZodNumber;
350
+ coverage: z.ZodArray<z.ZodObject<{
351
+ west: z.ZodNumber;
352
+ south: z.ZodNumber;
353
+ east: z.ZodNumber;
354
+ north: z.ZodNumber;
355
+ }, z.core.$strict>>;
356
+ }, z.core.$strict>>;
272
357
  requires: z.ZodObject<{
273
358
  formatVersion: z.ZodEnum<{
274
- 0.6: "0.6";
359
+ 0.7: "0.7";
275
360
  0.5: "0.5";
361
+ 0.6: "0.6";
276
362
  }>;
277
363
  features: z.ZodOptional<z.ZodArray<z.ZodString>>;
278
364
  }, z.core.$strip>;
@@ -322,6 +408,12 @@ declare const KnowledgeOrdinalSchema: z.ZodNumber;
322
408
  */
323
409
  declare const KnowledgeDocumentMetaSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
324
410
  type KnowledgeDocumentMeta = z.infer<typeof KnowledgeDocumentMetaSchema>;
411
+ /** An additional TOC placement of the same document, without a second body or index. */
412
+ declare const KnowledgeTocReferenceSchema: z.ZodObject<{
413
+ topicPath: z.ZodArray<z.ZodString>;
414
+ ordinal: z.ZodOptional<z.ZodNumber>;
415
+ }, z.core.$strict>;
416
+ type KnowledgeTocReference = z.infer<typeof KnowledgeTocReferenceSchema>;
325
417
  /** One normalized document streamed into the compiler. */
326
418
  declare const CatalogDocumentSchema: z.ZodObject<{
327
419
  id: z.ZodString;
@@ -330,6 +422,10 @@ declare const CatalogDocumentSchema: z.ZodObject<{
330
422
  summary: z.ZodOptional<z.ZodString>;
331
423
  language: z.ZodString;
332
424
  topicPath: z.ZodArray<z.ZodString>;
425
+ tocReferences: z.ZodOptional<z.ZodArray<z.ZodObject<{
426
+ topicPath: z.ZodArray<z.ZodString>;
427
+ ordinal: z.ZodOptional<z.ZodNumber>;
428
+ }, z.core.$strict>>>;
333
429
  markdown: z.ZodString;
334
430
  sourceUrl: z.ZodOptional<z.ZodString>;
335
431
  sourceRevision: z.ZodOptional<z.ZodString>;
@@ -338,6 +434,16 @@ declare const CatalogDocumentSchema: z.ZodObject<{
338
434
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
339
435
  ordinal: z.ZodOptional<z.ZodNumber>;
340
436
  meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
437
+ locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
438
+ id: z.ZodString;
439
+ latitude: z.ZodNumber;
440
+ longitude: z.ZodNumber;
441
+ role: z.ZodEnum<{
442
+ subject: "subject";
443
+ associated: "associated";
444
+ }>;
445
+ provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
446
+ }, z.core.$strict>>>;
341
447
  }, z.core.$strip>;
342
448
  type CatalogDocument = z.infer<typeof CatalogDocumentSchema>;
343
449
 
@@ -374,8 +480,9 @@ type KnowledgeRegistryEntry = z.infer<typeof KnowledgeRegistryEntrySchema>;
374
480
  declare const KnowledgeRegistryIndexSchema: z.ZodObject<{
375
481
  kind: z.ZodLiteral<"gezk-registry">;
376
482
  formatVersion: z.ZodEnum<{
377
- 0.6: "0.6";
483
+ 0.7: "0.7";
378
484
  0.5: "0.5";
485
+ 0.6: "0.6";
379
486
  }>;
380
487
  publisher: z.ZodObject<{
381
488
  id: z.ZodString;
@@ -438,9 +545,9 @@ declare function parseKnowledgeUri(raw: string): KnowledgeUri | null;
438
545
  * breaking changes may land in any minor until 1.0, and a reader supports
439
546
  * exactly the versions it names (see {@link GEZK_FORMAT_GENERATIONS}).
440
547
  */
441
- declare const GEZK_FORMAT_VERSION = "0.6";
548
+ declare const GEZK_FORMAT_VERSION = "0.7";
442
549
  /** SQLite schema generation this implementation writes (`PRAGMA user_version`). */
443
- declare const GEZK_INDEX_SCHEMA_VERSION = 3;
550
+ declare const GEZK_INDEX_SCHEMA_VERSION = 4;
444
551
  /**
445
552
  * Every (formatVersion, indexSchemaVersion) pairing this implementation
446
553
  * reads. The writer always emits the current pair; older generations stay
@@ -450,6 +557,7 @@ declare const GEZK_INDEX_SCHEMA_VERSION = 3;
450
557
  declare const GEZK_FORMAT_GENERATIONS: {
451
558
  readonly '0.5': 2;
452
559
  readonly '0.6': 3;
560
+ readonly '0.7': 4;
453
561
  };
454
562
  type GezkFormatVersion = keyof typeof GEZK_FORMAT_GENERATIONS;
455
563
  type GezkIndexSchemaVersion = (typeof GEZK_FORMAT_GENERATIONS)[GezkFormatVersion];
@@ -483,16 +591,18 @@ declare const MAX_KNOWLEDGE_TOPIC_DEPTH = 16;
483
591
  declare const ZIP_FIXED_MTIME: Date;
484
592
 
485
593
  /**
486
- * Index schema 3 DDL. Readers never migrate these. Every table is plain
594
+ * Index schema 4 DDL. Readers never migrate these. Every table is plain
487
595
  * SQLite (FTS5 is the only virtual-table module used), so any SQLite client
488
596
  * can read a catalog without extensions.
489
597
  */
490
- declare const ROUTER_DDL = "\nCREATE TABLE meta(key TEXT PRIMARY KEY, value TEXT NOT NULL) WITHOUT ROWID;\n\nCREATE TABLE topics(\n id TEXT PRIMARY KEY, parent_id TEXT, name TEXT NOT NULL,\n description TEXT, sort_key TEXT NOT NULL, document_count INTEGER NOT NULL\n);\n\nCREATE TABLE documents(\n id TEXT PRIMARY KEY,\n title TEXT NOT NULL, slug TEXT NOT NULL, summary TEXT,\n language TEXT NOT NULL, topic_id TEXT NOT NULL REFERENCES topics(id),\n ordinal INTEGER,\n shard_id INTEGER NOT NULL,\n chunk_count INTEGER NOT NULL,\n source_url TEXT, source_revision TEXT, source_updated_at TEXT,\n attribution_json TEXT,\n meta_json TEXT,\n body_codec TEXT NOT NULL CHECK (body_codec IN ('none','br')),\n body_blob BLOB NOT NULL\n);\nCREATE INDEX documents_topic ON documents(topic_id, ordinal, slug);\nCREATE INDEX documents_shard ON documents(shard_id);\n\nCREATE TABLE aliases(alias TEXT NOT NULL, document_id TEXT NOT NULL,\n PRIMARY KEY (alias, document_id)) WITHOUT ROWID;\n\nCREATE TABLE shards(\n id INTEGER PRIMARY KEY,\n path TEXT NOT NULL,\n chunk_count INTEGER NOT NULL, document_count INTEGER NOT NULL,\n topic_ids_json TEXT NOT NULL, centroid_count INTEGER NOT NULL,\n bytes INTEGER NOT NULL\n);\n\nCREATE TABLE route_centroids(\n id INTEGER PRIMARY KEY,\n shard_id INTEGER NOT NULL REFERENCES shards(id),\n embedding BLOB NOT NULL,\n weight INTEGER NOT NULL\n);\nCREATE INDEX route_centroids_shard ON route_centroids(shard_id);\n\nCREATE VIRTUAL TABLE fts_documents USING fts5(\n title, summary, aliases, document_id UNINDEXED,\n tokenize = 'unicode61 remove_diacritics 2', prefix = '2 3'\n);\n";
598
+ declare const ROUTER_DDL = "\nCREATE TABLE meta(key TEXT PRIMARY KEY, value TEXT NOT NULL) WITHOUT ROWID;\n\nCREATE TABLE topics(\n id TEXT PRIMARY KEY, parent_id TEXT, name TEXT NOT NULL,\n description TEXT, sort_key TEXT NOT NULL, document_count INTEGER NOT NULL\n);\n\nCREATE TABLE documents(\n id TEXT PRIMARY KEY,\n title TEXT NOT NULL, slug TEXT NOT NULL, summary TEXT,\n language TEXT NOT NULL, topic_id TEXT NOT NULL REFERENCES topics(id),\n ordinal INTEGER,\n shard_id INTEGER NOT NULL,\n chunk_count INTEGER NOT NULL,\n source_url TEXT, source_revision TEXT, source_updated_at TEXT,\n attribution_json TEXT,\n meta_json TEXT,\n body_codec TEXT NOT NULL CHECK (body_codec IN ('none','br')),\n body_blob BLOB NOT NULL\n);\nCREATE INDEX documents_topic ON documents(topic_id, ordinal, slug);\nCREATE INDEX documents_shard ON documents(shard_id);\n\nCREATE TABLE document_locations(\n document_id TEXT NOT NULL REFERENCES documents(id),\n location_id TEXT NOT NULL,\n latitude REAL NOT NULL CHECK (latitude BETWEEN -90 AND 90),\n longitude REAL NOT NULL CHECK (longitude >= -180 AND longitude < 180),\n role TEXT NOT NULL CHECK (role IN ('subject','associated')),\n provenance_json TEXT,\n PRIMARY KEY (document_id, location_id)\n) WITHOUT ROWID;\nCREATE INDEX document_locations_latitude ON document_locations(latitude, longitude, document_id);\nCREATE INDEX document_locations_longitude ON document_locations(longitude, latitude, document_id);\n\n-- Includes the primary placement in documents.topic_id/ordinal as well as\n-- shared TOC references. Bodies, chunks and vectors remain keyed by document id.\nCREATE TABLE topic_documents(\n topic_id TEXT NOT NULL REFERENCES topics(id),\n document_id TEXT NOT NULL REFERENCES documents(id),\n ordinal INTEGER CHECK (ordinal IS NULL OR\n (typeof(ordinal) = 'integer' AND ordinal BETWEEN -2147483648 AND 2147483647)),\n PRIMARY KEY (topic_id, document_id)\n) WITHOUT ROWID;\nCREATE INDEX topic_documents_document ON topic_documents(document_id);\nCREATE INDEX topic_documents_order ON topic_documents(topic_id, ordinal, document_id);\n\nCREATE TABLE aliases(alias TEXT NOT NULL, document_id TEXT NOT NULL,\n PRIMARY KEY (alias, document_id)) WITHOUT ROWID;\n\nCREATE TABLE shards(\n id INTEGER PRIMARY KEY,\n path TEXT NOT NULL,\n chunk_count INTEGER NOT NULL, document_count INTEGER NOT NULL,\n topic_ids_json TEXT NOT NULL, centroid_count INTEGER NOT NULL,\n bytes INTEGER NOT NULL\n);\n\nCREATE TABLE route_centroids(\n id INTEGER PRIMARY KEY,\n shard_id INTEGER NOT NULL REFERENCES shards(id),\n embedding BLOB NOT NULL,\n weight INTEGER NOT NULL\n);\nCREATE INDEX route_centroids_shard ON route_centroids(shard_id);\n\nCREATE VIRTUAL TABLE fts_documents USING fts5(\n title, summary, aliases, document_id UNINDEXED,\n tokenize = 'unicode61 remove_diacritics 2', prefix = '2 3'\n);\n";
491
599
  /**
492
600
  * Per-shard tables. Vectors are plain BLOB columns keyed by chunk id:
493
- * `chunk_vectors_bit.v` holds ceil(dim/8) bytes of sign bits (LSB-first) and
494
- * `chunk_vectors_int8.v` holds dim signed bytes (symmetric-linear, scale
495
- * 127). Two tables, not one, so a stage-1 scan pages in 48 bytes per row
601
+ * `chunk_vectors_bit.v` holds ceil(dim/8) bytes of sign bits (LSB-first; of
602
+ * the unit vector for a `sign` profile, of `vector − center` for a
603
+ * `centered-sign` profile — the profile echo in the router's meta says
604
+ * which) and `chunk_vectors_int8.v` holds dim signed bytes
605
+ * (symmetric-linear, scale 127, never centered). Two tables, not one, so a stage-1 scan pages in 48 bytes per row
496
606
  * rather than the whole record. Rowid alignment invariant:
497
607
  * chunks.id == chunk_vectors_bit.chunk_id == chunk_vectors_int8.chunk_id ==
498
608
  * fts_chunks.rowid, dense from 1.
@@ -567,9 +677,25 @@ declare function topicSortKeyForOrder(order: number): string;
567
677
  * functions, so extension-internal semantics can never drift the format:
568
678
  * both the compiler (packing) and the reader (query packing + rerank) call
569
679
  * exactly these functions.
680
+ *
681
+ * `quantizeBinary` is the raw sign packing. What a catalog actually stores
682
+ * depends on the profile's `quantization.binary.method`: `sign` packs the
683
+ * unit vector, `centered-sign` packs `vector − center` (see the profile
684
+ * schema for why). `quantizeBinaryForProfile` is the one entry point that
685
+ * applies that rule, so the compiler and every reader derive bits the same
686
+ * way.
570
687
  */
688
+
571
689
  /** int8: symmetric linear, scale 127, −128 never produced. */
572
690
  declare function quantizeInt8(unitVector: ArrayLike<number>): Int8Array;
691
+ /** `vector − center`, the input to a `centered-sign` profile's bits. */
692
+ declare function centerVector(vector: ArrayLike<number>, center: ArrayLike<number>): Float32Array;
693
+ /**
694
+ * The sign bits a profile stores for a unit vector — and, symmetrically,
695
+ * the bits a hamming reader packs for a query: centered first when the
696
+ * profile pins a center, raw otherwise.
697
+ */
698
+ declare function quantizeBinaryForProfile(profile: KnowledgeEmbeddingProfile, unitVector: ArrayLike<number>): Uint8Array;
573
699
  /** binary: sign threshold 0 (exact 0.0 → 0), packed LSB-first. */
574
700
  declare function quantizeBinary(unitVector: ArrayLike<number>): Uint8Array;
575
701
  /**
@@ -599,4 +725,70 @@ declare function canonicalizeJson(value: unknown): string;
599
725
  /** URL-ish slug for a document title (display/dedup aid, not an identity). */
600
726
  declare function documentSlug(title: string): string;
601
727
 
602
- export { ASSETS_PREFIX, ArtifactDigestSchema, BODY_CODEC_MIN_BYTES, type CatalogDocument, CatalogDocumentSchema, DEFAULT_EMBEDDING_ONNX_FILE, DEFAULT_EMBEDDING_TOKENIZER_FILE, GEZK_APPLICATION_ID, GEZK_FORMAT_GENERATIONS, GEZK_FORMAT_VERSION, GEZK_INDEX_SCHEMA_VERSION, GEZK_MANIFEST_KIND, GEZK_MIME_TYPE, GEZK_REGISTRY_KIND, GEZK_SUPPORTED_FORMAT_VERSIONS, GEZK_SUPPORTED_INDEX_SCHEMA_VERSIONS, type GezkFormatVersion, type GezkIndexSchemaVersion, KNOWLEDGE_ASSET_PATH_PATTERN, KNOWLEDGE_ASSET_TYPES, KNOWLEDGE_ID_PATTERN, KNOWLEDGE_MANIFEST_INDEX_SCHEMA_VERSIONS, KNOWLEDGE_VERSION_PATTERN, type KnowledgeAssetExtension, type KnowledgeAssetKind, KnowledgeAssetPathSchema, type KnowledgeCatalogManifest, KnowledgeCatalogManifestSchema, KnowledgeChunkUidSchema, type KnowledgeChunkingProfile, KnowledgeChunkingProfileSchema, KnowledgeDocumentIdSchema, type KnowledgeDocumentMeta, KnowledgeDocumentMetaSchema, type KnowledgeEmbeddingProfile, KnowledgeEmbeddingProfileSchema, KnowledgeIdSchema, KnowledgeManifestFileSchema, KnowledgeOrdinalSchema, type KnowledgeRegistryEntry, KnowledgeRegistryEntrySchema, type KnowledgeRegistryIndex, KnowledgeRegistryIndexSchema, type KnowledgeSignature, KnowledgeSignatureSchema, type KnowledgeUri, type KnowledgeVectorEncoding, KnowledgeVectorEncodingSchema, KnowledgeVersionSchema, LICENSE_NOTICE_PATH, MANIFEST_PATH, MAX_KNOWLEDGE_ASSETS_TOTAL_BYTES, MAX_KNOWLEDGE_ASSET_BYTES, MAX_KNOWLEDGE_ASSET_COUNT, MAX_KNOWLEDGE_ASSET_PATH_LENGTH, MAX_KNOWLEDGE_DOCUMENT_BYTES, MAX_KNOWLEDGE_DOCUMENT_META_BYTES, MAX_KNOWLEDGE_TOPIC_DEPTH, MIMETYPE_PATH, README_PATH, ROUTER_DB_PATH, ROUTER_DDL, RepoRelativePathSchema, SHARD_DDL, SOURCE_NOTICES_PATH, Sha256HexSchema, type SourceNotices, SourceNoticesSchema, ZIP_FIXED_MTIME, assetContentType, assetExtension, assetKindForExtension, canonicalizeJson, documentSlug, embeddingProfileArtifacts, formatKnowledgeUri, isKnowledgeAssetPath, isSupportedFormatVersion, isSupportedIndexSchemaVersion, l2Normalize, parseKnowledgeUri, quantizeBinary, quantizeInt8, rerankScore, sameVectorSpace, sniffAssetType, svgInertnessProblem, topicSortKeyForOrder };
728
+ /**
729
+ * Portable point locations and radius predicates for gezk 0.7. Coordinates
730
+ * are WGS84 degrees; distances use the specified 6,371,000 m sphere. These
731
+ * browser-safe contracts are shared by compilers, readers, and service APIs.
732
+ * Bounds are conservative candidates only: membership always uses distance.
733
+ */
734
+
735
+ declare const GEZK_EARTH_RADIUS_METERS = 6371000;
736
+ declare const MAX_DOCUMENT_LOCATIONS = 256;
737
+ declare const KnowledgeLocationSchema: z.ZodObject<{
738
+ id: z.ZodString;
739
+ latitude: z.ZodNumber;
740
+ longitude: z.ZodNumber;
741
+ role: z.ZodEnum<{
742
+ subject: "subject";
743
+ associated: "associated";
744
+ }>;
745
+ provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
746
+ }, z.core.$strict>;
747
+ type KnowledgeLocation = z.infer<typeof KnowledgeLocationSchema>;
748
+ declare const KnowledgeLocationsSchema: z.ZodArray<z.ZodObject<{
749
+ id: z.ZodString;
750
+ latitude: z.ZodNumber;
751
+ longitude: z.ZodNumber;
752
+ role: z.ZodEnum<{
753
+ subject: "subject";
754
+ associated: "associated";
755
+ }>;
756
+ provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
757
+ }, z.core.$strict>>;
758
+ declare const KnowledgeRadiusSchema: z.ZodObject<{
759
+ latitude: z.ZodNumber;
760
+ longitude: z.ZodNumber;
761
+ radiusMeters: z.ZodNumber;
762
+ }, z.core.$strict>;
763
+ type KnowledgeRadius = z.infer<typeof KnowledgeRadiusSchema>;
764
+ declare const KnowledgeBoundsSchema: z.ZodObject<{
765
+ west: z.ZodNumber;
766
+ south: z.ZodNumber;
767
+ east: z.ZodNumber;
768
+ north: z.ZodNumber;
769
+ }, z.core.$strict>;
770
+ type KnowledgeBounds = z.infer<typeof KnowledgeBoundsSchema>;
771
+ declare const KnowledgeSpatialManifestSchema: z.ZodObject<{
772
+ schema: z.ZodLiteral<"document-points@1">;
773
+ crs: z.ZodLiteral<"EPSG:4326">;
774
+ distanceModel: z.ZodLiteral<"sphere-6371000">;
775
+ locationCount: z.ZodNumber;
776
+ locatedDocuments: z.ZodNumber;
777
+ coverage: z.ZodArray<z.ZodObject<{
778
+ west: z.ZodNumber;
779
+ south: z.ZodNumber;
780
+ east: z.ZodNumber;
781
+ north: z.ZodNumber;
782
+ }, z.core.$strict>>;
783
+ }, z.core.$strict>;
784
+ type KnowledgeSpatialManifest = z.infer<typeof KnowledgeSpatialManifestSchema>;
785
+ declare function normalizeLongitude(longitude: number): number;
786
+ declare function locationDistanceMeters(from: Pick<KnowledgeLocation, 'latitude' | 'longitude'>, to: Pick<KnowledgeLocation, 'latitude' | 'longitude'>): number;
787
+ declare function radiusBounds(raw: KnowledgeRadius): KnowledgeBounds[];
788
+ declare function locationInBounds(location: KnowledgeLocation, bounds: KnowledgeBounds): boolean;
789
+ declare function spatialManifest(locations: Array<{
790
+ documentId: string;
791
+ location: KnowledgeLocation;
792
+ }>): KnowledgeSpatialManifest;
793
+
794
+ export { ASSETS_PREFIX, ArtifactDigestSchema, BODY_CODEC_MIN_BYTES, type CatalogDocument, CatalogDocumentSchema, DEFAULT_EMBEDDING_ONNX_FILE, DEFAULT_EMBEDDING_TOKENIZER_FILE, GEZK_APPLICATION_ID, GEZK_EARTH_RADIUS_METERS, GEZK_FORMAT_GENERATIONS, GEZK_FORMAT_VERSION, GEZK_INDEX_SCHEMA_VERSION, GEZK_MANIFEST_KIND, GEZK_MIME_TYPE, GEZK_REGISTRY_KIND, GEZK_SUPPORTED_FORMAT_VERSIONS, GEZK_SUPPORTED_INDEX_SCHEMA_VERSIONS, type GezkFormatVersion, type GezkIndexSchemaVersion, KNOWLEDGE_ASSET_PATH_PATTERN, KNOWLEDGE_ASSET_TYPES, KNOWLEDGE_ID_PATTERN, KNOWLEDGE_MANIFEST_INDEX_SCHEMA_VERSIONS, KNOWLEDGE_VERSION_PATTERN, type KnowledgeAssetExtension, type KnowledgeAssetKind, KnowledgeAssetPathSchema, type KnowledgeBounds, KnowledgeBoundsSchema, type KnowledgeCatalogManifest, KnowledgeCatalogManifestSchema, KnowledgeChunkUidSchema, type KnowledgeChunkingProfile, KnowledgeChunkingProfileSchema, KnowledgeDocumentIdSchema, type KnowledgeDocumentMeta, KnowledgeDocumentMetaSchema, type KnowledgeEmbeddingProfile, KnowledgeEmbeddingProfileSchema, KnowledgeIdSchema, type KnowledgeLocation, KnowledgeLocationSchema, KnowledgeLocationsSchema, KnowledgeManifestFileSchema, KnowledgeOrdinalSchema, type KnowledgeRadius, KnowledgeRadiusSchema, type KnowledgeRegistryEntry, KnowledgeRegistryEntrySchema, type KnowledgeRegistryIndex, KnowledgeRegistryIndexSchema, type KnowledgeSignature, KnowledgeSignatureSchema, type KnowledgeSpatialManifest, KnowledgeSpatialManifestSchema, type KnowledgeTocReference, KnowledgeTocReferenceSchema, type KnowledgeUri, type KnowledgeVectorEncoding, KnowledgeVectorEncodingSchema, KnowledgeVersionSchema, LICENSE_NOTICE_PATH, MANIFEST_PATH, MAX_DOCUMENT_LOCATIONS, MAX_KNOWLEDGE_ASSETS_TOTAL_BYTES, MAX_KNOWLEDGE_ASSET_BYTES, MAX_KNOWLEDGE_ASSET_COUNT, MAX_KNOWLEDGE_ASSET_PATH_LENGTH, MAX_KNOWLEDGE_DOCUMENT_BYTES, MAX_KNOWLEDGE_DOCUMENT_META_BYTES, MAX_KNOWLEDGE_TOPIC_DEPTH, MIMETYPE_PATH, README_PATH, ROUTER_DB_PATH, ROUTER_DDL, RepoRelativePathSchema, SHARD_DDL, SOURCE_NOTICES_PATH, Sha256HexSchema, type SourceNotices, SourceNoticesSchema, ZIP_FIXED_MTIME, assetContentType, assetExtension, assetKindForExtension, canonicalizeJson, centerVector, documentSlug, embeddingProfileArtifacts, embeddingProfileCenter, embeddingProfileCenterProblem, formatKnowledgeUri, isKnowledgeAssetPath, isSupportedFormatVersion, isSupportedIndexSchemaVersion, l2Normalize, locationDistanceMeters, locationInBounds, normalizeLongitude, parseKnowledgeUri, quantizeBinary, quantizeBinaryForProfile, quantizeInt8, radiusBounds, rerankScore, sameVectorSpace, sniffAssetType, spatialManifest, svgInertnessProblem, topicSortKeyForOrder };