@bendyline/gezk 1.0.2 → 1.0.4
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 +459 -43
- package/dist/index.js +748 -127
- package/dist/node.d.ts +1 -1
- package/dist/node.js +748 -127
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,60 @@ declare const RepoRelativePathSchema: z.ZodString;
|
|
|
40
40
|
declare const DEFAULT_EMBEDDING_ONNX_FILE = "onnx/model.onnx";
|
|
41
41
|
/** The tokenizer definition a profile pins when `tokenizer.file` is absent. */
|
|
42
42
|
declare const DEFAULT_EMBEDDING_TOKENIZER_FILE = "tokenizer.json";
|
|
43
|
+
/**
|
|
44
|
+
* One more file the runtime loads beside the graph and the tokenizer (0.8).
|
|
45
|
+
* Large graphs keep their weights in an external-data sidecar
|
|
46
|
+
* (`onnx/model.onnx_data`), so a digest of the graph file alone pins a
|
|
47
|
+
* header and none of the weights; configs that steer loading belong here too.
|
|
48
|
+
*/
|
|
49
|
+
declare const EmbeddingModelFileSchema: z.ZodObject<{
|
|
50
|
+
path: z.ZodString;
|
|
51
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
type EmbeddingModelFile = z.infer<typeof EmbeddingModelFileSchema>;
|
|
54
|
+
/**
|
|
55
|
+
* How a multimodal profile turned media into vectors (0.8). Query vectors
|
|
56
|
+
* depend only on the text side, so none of this enters `sameVectorSpace`;
|
|
57
|
+
* it is the provenance a builder needs to reproduce a catalog's media rows,
|
|
58
|
+
* and the settings media floors are calibrated against.
|
|
59
|
+
*/
|
|
60
|
+
declare const EmbeddingMediaSchema: z.ZodObject<{
|
|
61
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
encoder: z.ZodObject<{
|
|
63
|
+
onnxFile: z.ZodString;
|
|
64
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
65
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
path: z.ZodString;
|
|
67
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
tokenBudget: z.ZodNumber;
|
|
71
|
+
resample: z.ZodEnum<{
|
|
72
|
+
bilinear: "bilinear";
|
|
73
|
+
bicubic: "bicubic";
|
|
74
|
+
}>;
|
|
75
|
+
alpha: z.ZodLiteral<"composite-white">;
|
|
76
|
+
}, z.core.$strip>>;
|
|
77
|
+
video: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
framesPerSecond: z.ZodNumber;
|
|
79
|
+
maxFrames: z.ZodNumber;
|
|
80
|
+
tokenBudgetPerFrame: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
audio: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
encoder: z.ZodObject<{
|
|
84
|
+
onnxFile: z.ZodString;
|
|
85
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
86
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
|
+
path: z.ZodString;
|
|
88
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>>>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
sampleRate: z.ZodNumber;
|
|
92
|
+
channels: z.ZodLiteral<1>;
|
|
93
|
+
maxWindowMs: z.ZodNumber;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
type EmbeddingMedia = z.infer<typeof EmbeddingMediaSchema>;
|
|
43
97
|
/**
|
|
44
98
|
* The FULL vector-space identity of a catalog's embeddings, self-describing
|
|
45
99
|
* so any reader can reproduce query vectors: the model by Hugging Face
|
|
@@ -55,6 +109,10 @@ declare const KnowledgeEmbeddingProfileObject: z.ZodObject<{
|
|
|
55
109
|
revision: z.ZodString;
|
|
56
110
|
onnxFile: z.ZodOptional<z.ZodString>;
|
|
57
111
|
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
112
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
113
|
+
path: z.ZodString;
|
|
114
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>>>;
|
|
58
116
|
}, z.core.$strip>;
|
|
59
117
|
tokenizer: z.ZodObject<{
|
|
60
118
|
kind: z.ZodString;
|
|
@@ -68,6 +126,10 @@ declare const KnowledgeEmbeddingProfileObject: z.ZodObject<{
|
|
|
68
126
|
}>;
|
|
69
127
|
normalized: z.ZodBoolean;
|
|
70
128
|
dimensions: z.ZodNumber;
|
|
129
|
+
truncation: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
method: z.ZodLiteral<"prefix">;
|
|
131
|
+
sourceDimensions: z.ZodNumber;
|
|
132
|
+
}, z.core.$strip>>;
|
|
71
133
|
maxTokens: z.ZodNumber;
|
|
72
134
|
queryInstruction: z.ZodString;
|
|
73
135
|
passageInstruction: z.ZodString;
|
|
@@ -93,6 +155,42 @@ declare const KnowledgeEmbeddingProfileObject: z.ZodObject<{
|
|
|
93
155
|
center: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
94
156
|
}, z.core.$strip>;
|
|
95
157
|
}, z.core.$strip>;
|
|
158
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
160
|
+
encoder: z.ZodObject<{
|
|
161
|
+
onnxFile: z.ZodString;
|
|
162
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
163
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
164
|
+
path: z.ZodString;
|
|
165
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
166
|
+
}, z.core.$strip>>>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
tokenBudget: z.ZodNumber;
|
|
169
|
+
resample: z.ZodEnum<{
|
|
170
|
+
bilinear: "bilinear";
|
|
171
|
+
bicubic: "bicubic";
|
|
172
|
+
}>;
|
|
173
|
+
alpha: z.ZodLiteral<"composite-white">;
|
|
174
|
+
}, z.core.$strip>>;
|
|
175
|
+
video: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
framesPerSecond: z.ZodNumber;
|
|
177
|
+
maxFrames: z.ZodNumber;
|
|
178
|
+
tokenBudgetPerFrame: z.ZodNumber;
|
|
179
|
+
}, z.core.$strip>>;
|
|
180
|
+
audio: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
encoder: z.ZodObject<{
|
|
182
|
+
onnxFile: z.ZodString;
|
|
183
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
184
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
185
|
+
path: z.ZodString;
|
|
186
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}, z.core.$strip>>>;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
sampleRate: z.ZodNumber;
|
|
190
|
+
channels: z.ZodLiteral<1>;
|
|
191
|
+
maxWindowMs: z.ZodNumber;
|
|
192
|
+
}, z.core.$strip>>;
|
|
193
|
+
}, z.core.$strip>>;
|
|
96
194
|
}, z.core.$strip>;
|
|
97
195
|
type KnowledgeEmbeddingProfile = z.infer<typeof KnowledgeEmbeddingProfileObject>;
|
|
98
196
|
/**
|
|
@@ -104,7 +202,21 @@ type KnowledgeEmbeddingProfile = z.infer<typeof KnowledgeEmbeddingProfileObject>
|
|
|
104
202
|
declare function embeddingProfileCenterProblem(profile: KnowledgeEmbeddingProfile): string | null;
|
|
105
203
|
/** The profile's binary center as a Float32Array, or null for a plain `sign` profile. */
|
|
106
204
|
declare function embeddingProfileCenter(profile: KnowledgeEmbeddingProfile): Float32Array | null;
|
|
107
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* Truncation keeps a strict prefix of a unit vector and re-normalizes, so it
|
|
207
|
+
* needs a source wider than the stored width and a normalized profile.
|
|
208
|
+
*/
|
|
209
|
+
declare function embeddingProfileTruncationProblem(profile: KnowledgeEmbeddingProfile): string | null;
|
|
210
|
+
/** The width the model itself emits: `truncation.sourceDimensions`, else `dimensions`. */
|
|
211
|
+
declare function embeddingProfileSourceDimensions(profile: KnowledgeEmbeddingProfile): number;
|
|
212
|
+
/**
|
|
213
|
+
* The oldest format version that can describe this profile. Truncation,
|
|
214
|
+
* pinned extra files and a media block are 0.8 vocabulary: an older reader's
|
|
215
|
+
* strip-mode schema would drop them without a word and then embed queries the
|
|
216
|
+
* wrong way, so a catalog using any of them must refuse to open there instead.
|
|
217
|
+
*/
|
|
218
|
+
declare function embeddingProfileMinimumFormat(profile: KnowledgeEmbeddingProfile): '0.5' | '0.8';
|
|
219
|
+
/** The profile schema proper: the object shape plus the cross-field rules above. */
|
|
108
220
|
declare const KnowledgeEmbeddingProfileSchema: z.ZodObject<{
|
|
109
221
|
id: z.ZodString;
|
|
110
222
|
model: z.ZodObject<{
|
|
@@ -112,6 +224,10 @@ declare const KnowledgeEmbeddingProfileSchema: z.ZodObject<{
|
|
|
112
224
|
revision: z.ZodString;
|
|
113
225
|
onnxFile: z.ZodOptional<z.ZodString>;
|
|
114
226
|
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
227
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
228
|
+
path: z.ZodString;
|
|
229
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
230
|
+
}, z.core.$strip>>>;
|
|
115
231
|
}, z.core.$strip>;
|
|
116
232
|
tokenizer: z.ZodObject<{
|
|
117
233
|
kind: z.ZodString;
|
|
@@ -125,6 +241,10 @@ declare const KnowledgeEmbeddingProfileSchema: z.ZodObject<{
|
|
|
125
241
|
}>;
|
|
126
242
|
normalized: z.ZodBoolean;
|
|
127
243
|
dimensions: z.ZodNumber;
|
|
244
|
+
truncation: z.ZodOptional<z.ZodObject<{
|
|
245
|
+
method: z.ZodLiteral<"prefix">;
|
|
246
|
+
sourceDimensions: z.ZodNumber;
|
|
247
|
+
}, z.core.$strip>>;
|
|
128
248
|
maxTokens: z.ZodNumber;
|
|
129
249
|
queryInstruction: z.ZodString;
|
|
130
250
|
passageInstruction: z.ZodString;
|
|
@@ -150,6 +270,42 @@ declare const KnowledgeEmbeddingProfileSchema: z.ZodObject<{
|
|
|
150
270
|
center: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
151
271
|
}, z.core.$strip>;
|
|
152
272
|
}, z.core.$strip>;
|
|
273
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
274
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
275
|
+
encoder: z.ZodObject<{
|
|
276
|
+
onnxFile: z.ZodString;
|
|
277
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
278
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
279
|
+
path: z.ZodString;
|
|
280
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
281
|
+
}, z.core.$strip>>>;
|
|
282
|
+
}, z.core.$strip>;
|
|
283
|
+
tokenBudget: z.ZodNumber;
|
|
284
|
+
resample: z.ZodEnum<{
|
|
285
|
+
bilinear: "bilinear";
|
|
286
|
+
bicubic: "bicubic";
|
|
287
|
+
}>;
|
|
288
|
+
alpha: z.ZodLiteral<"composite-white">;
|
|
289
|
+
}, z.core.$strip>>;
|
|
290
|
+
video: z.ZodOptional<z.ZodObject<{
|
|
291
|
+
framesPerSecond: z.ZodNumber;
|
|
292
|
+
maxFrames: z.ZodNumber;
|
|
293
|
+
tokenBudgetPerFrame: z.ZodNumber;
|
|
294
|
+
}, z.core.$strip>>;
|
|
295
|
+
audio: z.ZodOptional<z.ZodObject<{
|
|
296
|
+
encoder: z.ZodObject<{
|
|
297
|
+
onnxFile: z.ZodString;
|
|
298
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
299
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
300
|
+
path: z.ZodString;
|
|
301
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
302
|
+
}, z.core.$strip>>>;
|
|
303
|
+
}, z.core.$strip>;
|
|
304
|
+
sampleRate: z.ZodNumber;
|
|
305
|
+
channels: z.ZodLiteral<1>;
|
|
306
|
+
maxWindowMs: z.ZodNumber;
|
|
307
|
+
}, z.core.$strip>>;
|
|
308
|
+
}, z.core.$strip>>;
|
|
153
309
|
}, z.core.$strip>;
|
|
154
310
|
/** The exact repo files a profile pins, with the format defaults applied. */
|
|
155
311
|
declare function embeddingProfileArtifacts(profile: KnowledgeEmbeddingProfile): {
|
|
@@ -157,16 +313,26 @@ declare function embeddingProfileArtifacts(profile: KnowledgeEmbeddingProfile):
|
|
|
157
313
|
onnxDigest: string | null;
|
|
158
314
|
tokenizerFile: string;
|
|
159
315
|
tokenizerDigest: string | null;
|
|
316
|
+
/** Further text-model files (sidecars, configs), in the profile's order. */
|
|
317
|
+
files: Array<{
|
|
318
|
+
path: string;
|
|
319
|
+
digest: string | null;
|
|
320
|
+
}>;
|
|
160
321
|
};
|
|
161
322
|
/**
|
|
162
323
|
* Whether two profiles describe one vector space, so vectors from either
|
|
163
324
|
* may be compared: same model files at the same revision, same tokenizer,
|
|
164
325
|
* pooling, normalization, dimensions, instruction prefixes, encoding and
|
|
165
|
-
* int8 quantization
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* undeclared digest is simply not a
|
|
326
|
+
* int8 quantization, and the same truncation from the same source width. The
|
|
327
|
+
* profile id and `maxTokens` are not compared — the first is a label, the
|
|
328
|
+
* second a compile-time bound. A digest counts only when both sides declare
|
|
329
|
+
* one: two pins at one revision that hash differently name different
|
|
330
|
+
* artifacts, whatever the path says; an undeclared digest is simply not a
|
|
331
|
+
* claim. Extra `model.files` follow the same rule, path by path.
|
|
332
|
+
*
|
|
333
|
+
* The `media` block is not compared either: a text query vector is valid
|
|
334
|
+
* against a catalog's media rows however their pixels or samples were
|
|
335
|
+
* encoded.
|
|
170
336
|
*
|
|
171
337
|
* The binary (stage-1) parameters are deliberately NOT compared. They
|
|
172
338
|
* describe how a catalog derived its own pre-filter bits, and a reader
|
|
@@ -222,10 +388,12 @@ type KnowledgeSignature = z.infer<typeof KnowledgeSignatureSchema>;
|
|
|
222
388
|
declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
|
|
223
389
|
kind: z.ZodLiteral<"gezk-catalog">;
|
|
224
390
|
formatVersion: z.ZodEnum<{
|
|
225
|
-
0.6: "0.6";
|
|
226
391
|
0.5: "0.5";
|
|
392
|
+
0.8: "0.8";
|
|
393
|
+
0.6: "0.6";
|
|
394
|
+
0.7: "0.7";
|
|
227
395
|
}>;
|
|
228
|
-
indexSchemaVersion: z.
|
|
396
|
+
indexSchemaVersion: z.ZodLiteral<GezkIndexSchemaVersion>;
|
|
229
397
|
id: z.ZodString;
|
|
230
398
|
version: z.ZodString;
|
|
231
399
|
name: z.ZodString;
|
|
@@ -255,6 +423,10 @@ declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
|
|
|
255
423
|
revision: z.ZodString;
|
|
256
424
|
onnxFile: z.ZodOptional<z.ZodString>;
|
|
257
425
|
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
426
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
427
|
+
path: z.ZodString;
|
|
428
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
429
|
+
}, z.core.$strip>>>;
|
|
258
430
|
}, z.core.$strip>;
|
|
259
431
|
tokenizer: z.ZodObject<{
|
|
260
432
|
kind: z.ZodString;
|
|
@@ -268,6 +440,10 @@ declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
|
|
|
268
440
|
}>;
|
|
269
441
|
normalized: z.ZodBoolean;
|
|
270
442
|
dimensions: z.ZodNumber;
|
|
443
|
+
truncation: z.ZodOptional<z.ZodObject<{
|
|
444
|
+
method: z.ZodLiteral<"prefix">;
|
|
445
|
+
sourceDimensions: z.ZodNumber;
|
|
446
|
+
}, z.core.$strip>>;
|
|
271
447
|
maxTokens: z.ZodNumber;
|
|
272
448
|
queryInstruction: z.ZodString;
|
|
273
449
|
passageInstruction: z.ZodString;
|
|
@@ -293,6 +469,42 @@ declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
|
|
|
293
469
|
center: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
294
470
|
}, z.core.$strip>;
|
|
295
471
|
}, z.core.$strip>;
|
|
472
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
473
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
474
|
+
encoder: z.ZodObject<{
|
|
475
|
+
onnxFile: z.ZodString;
|
|
476
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
477
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
478
|
+
path: z.ZodString;
|
|
479
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
480
|
+
}, z.core.$strip>>>;
|
|
481
|
+
}, z.core.$strip>;
|
|
482
|
+
tokenBudget: z.ZodNumber;
|
|
483
|
+
resample: z.ZodEnum<{
|
|
484
|
+
bilinear: "bilinear";
|
|
485
|
+
bicubic: "bicubic";
|
|
486
|
+
}>;
|
|
487
|
+
alpha: z.ZodLiteral<"composite-white">;
|
|
488
|
+
}, z.core.$strip>>;
|
|
489
|
+
video: z.ZodOptional<z.ZodObject<{
|
|
490
|
+
framesPerSecond: z.ZodNumber;
|
|
491
|
+
maxFrames: z.ZodNumber;
|
|
492
|
+
tokenBudgetPerFrame: z.ZodNumber;
|
|
493
|
+
}, z.core.$strip>>;
|
|
494
|
+
audio: z.ZodOptional<z.ZodObject<{
|
|
495
|
+
encoder: z.ZodObject<{
|
|
496
|
+
onnxFile: z.ZodString;
|
|
497
|
+
onnxDigest: z.ZodOptional<z.ZodString>;
|
|
498
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
499
|
+
path: z.ZodString;
|
|
500
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
501
|
+
}, z.core.$strip>>>;
|
|
502
|
+
}, z.core.$strip>;
|
|
503
|
+
sampleRate: z.ZodNumber;
|
|
504
|
+
channels: z.ZodLiteral<1>;
|
|
505
|
+
maxWindowMs: z.ZodNumber;
|
|
506
|
+
}, z.core.$strip>>;
|
|
507
|
+
}, z.core.$strip>>;
|
|
296
508
|
}, z.core.$strip>;
|
|
297
509
|
chunking: z.ZodObject<{
|
|
298
510
|
id: z.ZodString;
|
|
@@ -334,16 +546,36 @@ declare const KnowledgeCatalogManifestSchema: z.ZodObject<{
|
|
|
334
546
|
chunks: z.ZodNumber;
|
|
335
547
|
shards: z.ZodNumber;
|
|
336
548
|
assets: z.ZodOptional<z.ZodNumber>;
|
|
549
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
550
|
+
image: z.ZodNumber;
|
|
551
|
+
video: z.ZodNumber;
|
|
552
|
+
audio: z.ZodNumber;
|
|
553
|
+
}, z.core.$strip>>;
|
|
337
554
|
}, z.core.$strip>;
|
|
338
555
|
files: z.ZodArray<z.ZodObject<{
|
|
339
556
|
path: z.ZodString;
|
|
340
557
|
sizeBytes: z.ZodNumber;
|
|
341
558
|
sha256: z.ZodString;
|
|
342
559
|
}, z.core.$strip>>;
|
|
560
|
+
spatial: z.ZodOptional<z.ZodObject<{
|
|
561
|
+
schema: z.ZodLiteral<"document-points@1">;
|
|
562
|
+
crs: z.ZodLiteral<"EPSG:4326">;
|
|
563
|
+
distanceModel: z.ZodLiteral<"sphere-6371000">;
|
|
564
|
+
locationCount: z.ZodNumber;
|
|
565
|
+
locatedDocuments: z.ZodNumber;
|
|
566
|
+
coverage: z.ZodArray<z.ZodObject<{
|
|
567
|
+
west: z.ZodNumber;
|
|
568
|
+
south: z.ZodNumber;
|
|
569
|
+
east: z.ZodNumber;
|
|
570
|
+
north: z.ZodNumber;
|
|
571
|
+
}, z.core.$strict>>;
|
|
572
|
+
}, z.core.$strict>>;
|
|
343
573
|
requires: z.ZodObject<{
|
|
344
574
|
formatVersion: z.ZodEnum<{
|
|
345
|
-
0.6: "0.6";
|
|
346
575
|
0.5: "0.5";
|
|
576
|
+
0.8: "0.8";
|
|
577
|
+
0.6: "0.6";
|
|
578
|
+
0.7: "0.7";
|
|
347
579
|
}>;
|
|
348
580
|
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
349
581
|
}, z.core.$strip>;
|
|
@@ -393,6 +625,12 @@ declare const KnowledgeOrdinalSchema: z.ZodNumber;
|
|
|
393
625
|
*/
|
|
394
626
|
declare const KnowledgeDocumentMetaSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
395
627
|
type KnowledgeDocumentMeta = z.infer<typeof KnowledgeDocumentMetaSchema>;
|
|
628
|
+
/** An additional TOC placement of the same document, without a second body or index. */
|
|
629
|
+
declare const KnowledgeTocReferenceSchema: z.ZodObject<{
|
|
630
|
+
topicPath: z.ZodArray<z.ZodString>;
|
|
631
|
+
ordinal: z.ZodOptional<z.ZodNumber>;
|
|
632
|
+
}, z.core.$strict>;
|
|
633
|
+
type KnowledgeTocReference = z.infer<typeof KnowledgeTocReferenceSchema>;
|
|
396
634
|
/** One normalized document streamed into the compiler. */
|
|
397
635
|
declare const CatalogDocumentSchema: z.ZodObject<{
|
|
398
636
|
id: z.ZodString;
|
|
@@ -401,6 +639,10 @@ declare const CatalogDocumentSchema: z.ZodObject<{
|
|
|
401
639
|
summary: z.ZodOptional<z.ZodString>;
|
|
402
640
|
language: z.ZodString;
|
|
403
641
|
topicPath: z.ZodArray<z.ZodString>;
|
|
642
|
+
tocReferences: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
643
|
+
topicPath: z.ZodArray<z.ZodString>;
|
|
644
|
+
ordinal: z.ZodOptional<z.ZodNumber>;
|
|
645
|
+
}, z.core.$strict>>>;
|
|
404
646
|
markdown: z.ZodString;
|
|
405
647
|
sourceUrl: z.ZodOptional<z.ZodString>;
|
|
406
648
|
sourceRevision: z.ZodOptional<z.ZodString>;
|
|
@@ -409,6 +651,16 @@ declare const CatalogDocumentSchema: z.ZodObject<{
|
|
|
409
651
|
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
410
652
|
ordinal: z.ZodOptional<z.ZodNumber>;
|
|
411
653
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
654
|
+
locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
655
|
+
id: z.ZodString;
|
|
656
|
+
latitude: z.ZodNumber;
|
|
657
|
+
longitude: z.ZodNumber;
|
|
658
|
+
role: z.ZodEnum<{
|
|
659
|
+
subject: "subject";
|
|
660
|
+
associated: "associated";
|
|
661
|
+
}>;
|
|
662
|
+
provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
663
|
+
}, z.core.$strict>>>;
|
|
412
664
|
}, z.core.$strip>;
|
|
413
665
|
type CatalogDocument = z.infer<typeof CatalogDocumentSchema>;
|
|
414
666
|
|
|
@@ -445,8 +697,10 @@ type KnowledgeRegistryEntry = z.infer<typeof KnowledgeRegistryEntrySchema>;
|
|
|
445
697
|
declare const KnowledgeRegistryIndexSchema: z.ZodObject<{
|
|
446
698
|
kind: z.ZodLiteral<"gezk-registry">;
|
|
447
699
|
formatVersion: z.ZodEnum<{
|
|
448
|
-
0.6: "0.6";
|
|
449
700
|
0.5: "0.5";
|
|
701
|
+
0.8: "0.8";
|
|
702
|
+
0.6: "0.6";
|
|
703
|
+
0.7: "0.7";
|
|
450
704
|
}>;
|
|
451
705
|
publisher: z.ZodObject<{
|
|
452
706
|
id: z.ZodString;
|
|
@@ -505,28 +759,39 @@ declare function parseKnowledgeUri(raw: string): KnowledgeUri | null;
|
|
|
505
759
|
|
|
506
760
|
/** Container-level constants of the `.gezk` format. */
|
|
507
761
|
/**
|
|
508
|
-
*
|
|
509
|
-
* breaking changes may land in any minor until 1.0, and a reader
|
|
510
|
-
* exactly the versions it names (see {@link GEZK_FORMAT_GENERATIONS}).
|
|
762
|
+
* Newest public format version this implementation writes. `0.x` is
|
|
763
|
+
* preliminary: breaking changes may land in any minor until 1.0, and a reader
|
|
764
|
+
* supports exactly the versions it names (see {@link GEZK_FORMAT_GENERATIONS}).
|
|
765
|
+
* The compiler writes the OLDEST generation that can express a catalog (0.7
|
|
766
|
+
* unless it uses 0.8 vocabulary), so catalog updates keep reaching readers
|
|
767
|
+
* that predate the newest generation.
|
|
511
768
|
*/
|
|
512
|
-
declare const GEZK_FORMAT_VERSION = "0.
|
|
513
|
-
/** SQLite schema generation
|
|
514
|
-
declare const GEZK_INDEX_SCHEMA_VERSION =
|
|
769
|
+
declare const GEZK_FORMAT_VERSION = "0.8";
|
|
770
|
+
/** SQLite schema generation paired with {@link GEZK_FORMAT_VERSION} (`PRAGMA user_version`). */
|
|
771
|
+
declare const GEZK_INDEX_SCHEMA_VERSION = 5;
|
|
515
772
|
/**
|
|
516
773
|
* Every (formatVersion, indexSchemaVersion) pairing this implementation
|
|
517
|
-
* reads. The writer
|
|
518
|
-
* readable so a catalog published under an earlier 0.x
|
|
519
|
-
* a reader upgrade. A manifest that pairs the two
|
|
774
|
+
* reads. The writer emits the oldest pair that can express a catalog; older
|
|
775
|
+
* generations stay readable so a catalog published under an earlier 0.x
|
|
776
|
+
* keeps opening after a reader upgrade. A manifest that pairs the two
|
|
777
|
+
* differently is corrupt.
|
|
520
778
|
*/
|
|
521
779
|
declare const GEZK_FORMAT_GENERATIONS: {
|
|
522
780
|
readonly '0.5': 2;
|
|
523
781
|
readonly '0.6': 3;
|
|
782
|
+
readonly '0.7': 4;
|
|
783
|
+
readonly '0.8': 5;
|
|
524
784
|
};
|
|
525
785
|
type GezkFormatVersion = keyof typeof GEZK_FORMAT_GENERATIONS;
|
|
526
786
|
type GezkIndexSchemaVersion = (typeof GEZK_FORMAT_GENERATIONS)[GezkFormatVersion];
|
|
527
787
|
declare const GEZK_SUPPORTED_FORMAT_VERSIONS: [GezkFormatVersion, ...GezkFormatVersion[]];
|
|
528
788
|
declare const GEZK_SUPPORTED_INDEX_SCHEMA_VERSIONS: [GezkIndexSchemaVersion, ...GezkIndexSchemaVersion[]];
|
|
529
789
|
declare function isSupportedFormatVersion(value: unknown): value is GezkFormatVersion;
|
|
790
|
+
/**
|
|
791
|
+
* Whether `version` is `minimum` or a later generation. Generations are
|
|
792
|
+
* ordered by their index schema, so this never parses version strings.
|
|
793
|
+
*/
|
|
794
|
+
declare function formatAtLeast(version: GezkFormatVersion, minimum: GezkFormatVersion): boolean;
|
|
530
795
|
declare function isSupportedIndexSchemaVersion(value: unknown): value is GezkIndexSchemaVersion;
|
|
531
796
|
/** `PRAGMA application_id` for every database in a catalog: 'GEZK'. */
|
|
532
797
|
declare const GEZK_APPLICATION_ID = 1195727435;
|
|
@@ -554,26 +819,24 @@ declare const MAX_KNOWLEDGE_TOPIC_DEPTH = 16;
|
|
|
554
819
|
declare const ZIP_FIXED_MTIME: Date;
|
|
555
820
|
|
|
556
821
|
/**
|
|
557
|
-
* Index schema
|
|
822
|
+
* Index schema 4 and 5 DDL. Readers never migrate these. Every table is plain
|
|
558
823
|
* SQLite (FTS5 is the only virtual-table module used), so any SQLite client
|
|
559
|
-
* can read a catalog without extensions.
|
|
824
|
+
* can read a catalog without extensions. The router is identical in both
|
|
825
|
+
* generations; schema 5 adds media columns to the shard `chunks` table.
|
|
560
826
|
*/
|
|
561
|
-
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";
|
|
562
|
-
/**
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
* chunks.id == chunk_vectors_bit.chunk_id == chunk_vectors_int8.chunk_id ==
|
|
571
|
-
* fts_chunks.rowid, dense from 1.
|
|
572
|
-
*/
|
|
573
|
-
declare const SHARD_DDL = "\nCREATE TABLE meta(key TEXT PRIMARY KEY, value TEXT NOT NULL) WITHOUT ROWID;\n\nCREATE TABLE chunks(\n id INTEGER PRIMARY KEY,\n chunk_uid TEXT NOT NULL,\n document_id TEXT NOT NULL,\n ordinal INTEGER NOT NULL,\n title TEXT NOT NULL,\n heading_path TEXT NOT NULL,\n heading_text TEXT NOT NULL,\n line_start INTEGER NOT NULL, line_end INTEGER NOT NULL,\n token_count INTEGER NOT NULL,\n content_hash TEXT NOT NULL,\n text TEXT NOT NULL\n);\nCREATE UNIQUE INDEX chunks_uid ON chunks(chunk_uid);\nCREATE INDEX chunks_document ON chunks(document_id, ordinal);\n\nCREATE VIRTUAL TABLE fts_chunks USING fts5(\n title, heading_text, text,\n content = 'chunks', content_rowid = 'id',\n tokenize = 'unicode61 remove_diacritics 2'\n);\n\nCREATE TABLE chunk_vectors_bit(\n chunk_id INTEGER PRIMARY KEY,\n v BLOB NOT NULL\n);\n\nCREATE TABLE chunk_vectors_int8(\n chunk_id INTEGER PRIMARY KEY,\n v BLOB NOT NULL\n);\n";
|
|
827
|
+
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";
|
|
828
|
+
/** Index schema 4 shard DDL (format 0.7): text rows only. */
|
|
829
|
+
declare const SHARD_DDL_V4: string;
|
|
830
|
+
/** Index schema 5 shard DDL (format 0.8): text rows plus media rows. */
|
|
831
|
+
declare const SHARD_DDL_V5: string;
|
|
832
|
+
/** The newest shard DDL. */
|
|
833
|
+
declare const SHARD_DDL: string;
|
|
834
|
+
/** The shard DDL a writer uses for one index schema generation it writes. */
|
|
835
|
+
declare function shardDdlFor(indexSchemaVersion: 4 | 5): string;
|
|
574
836
|
|
|
575
837
|
/**
|
|
576
|
-
* Assets:
|
|
838
|
+
* Assets: files a catalog ships under `assets/` for its document bodies —
|
|
839
|
+
* images since 0.6, and since 0.8 the audio and video its media rows embed.
|
|
577
840
|
* A document references one by its archive path (``),
|
|
578
841
|
* and a reader resolves that against the catalog, never the network. The
|
|
579
842
|
* rules here are the format's: which files may be assets, how large, and
|
|
@@ -590,16 +853,40 @@ declare const KNOWLEDGE_ASSET_TYPES: {
|
|
|
590
853
|
readonly webp: "image/webp";
|
|
591
854
|
readonly svg: "image/svg+xml";
|
|
592
855
|
};
|
|
593
|
-
|
|
594
|
-
|
|
856
|
+
/**
|
|
857
|
+
* Audio and video assets (0.8). A reader hands these bytes to the platform's
|
|
858
|
+
* own media element and never parses them itself; only a catalog builder
|
|
859
|
+
* decodes them, to embed their windows.
|
|
860
|
+
*/
|
|
861
|
+
declare const KNOWLEDGE_MEDIA_ASSET_TYPES: {
|
|
862
|
+
readonly mp4: "video/mp4";
|
|
863
|
+
readonly webm: "video/webm";
|
|
864
|
+
readonly mp3: "audio/mpeg";
|
|
865
|
+
readonly m4a: "audio/mp4";
|
|
866
|
+
readonly ogg: "audio/ogg";
|
|
867
|
+
readonly opus: "audio/ogg";
|
|
868
|
+
readonly wav: "audio/wav";
|
|
869
|
+
readonly flac: "audio/flac";
|
|
870
|
+
};
|
|
871
|
+
type KnowledgeImageAssetExtension = keyof typeof KNOWLEDGE_ASSET_TYPES;
|
|
872
|
+
type KnowledgeMediaAssetExtension = keyof typeof KNOWLEDGE_MEDIA_ASSET_TYPES;
|
|
873
|
+
type KnowledgeAssetExtension = KnowledgeImageAssetExtension | KnowledgeMediaAssetExtension;
|
|
874
|
+
/** What the leading bytes can prove; ISO BMFF covers both mp4 and m4a. */
|
|
875
|
+
type KnowledgeAssetKind = 'png' | 'jpeg' | 'gif' | 'webp' | 'svg' | 'isobmff' | 'webm' | 'mp3' | 'ogg' | 'wav' | 'flac';
|
|
876
|
+
type KnowledgeAssetModality = 'image' | 'video' | 'audio';
|
|
595
877
|
declare const MAX_KNOWLEDGE_ASSET_BYTES: number;
|
|
596
878
|
declare const MAX_KNOWLEDGE_ASSETS_TOTAL_BYTES: number;
|
|
879
|
+
/** Per-file limit for an audio or video asset (0.8). */
|
|
880
|
+
declare const MAX_KNOWLEDGE_MEDIA_ASSET_BYTES: number;
|
|
881
|
+
/** Combined limit for every audio and video asset in one catalog (0.8). */
|
|
882
|
+
declare const MAX_KNOWLEDGE_MEDIA_ASSETS_TOTAL_BYTES: number;
|
|
597
883
|
declare const MAX_KNOWLEDGE_ASSET_COUNT = 8192;
|
|
598
884
|
declare const MAX_KNOWLEDGE_ASSET_PATH_LENGTH = 512;
|
|
599
885
|
/**
|
|
600
886
|
* `assets/(<dir>/)*<name>.<ext>` — up to 15 directory segments, each
|
|
601
887
|
* segment `[A-Za-z0-9._-]` and never starting with a dot (so `.`, `..` and
|
|
602
|
-
* hidden files are impossible by construction), extension from the
|
|
888
|
+
* hidden files are impossible by construction), extension from the image
|
|
889
|
+
* table (every generation since 0.6) or the media table (0.8).
|
|
603
890
|
*/
|
|
604
891
|
declare const KNOWLEDGE_ASSET_PATH_PATTERN: RegExp;
|
|
605
892
|
declare const KnowledgeAssetPathSchema: z.ZodString;
|
|
@@ -607,12 +894,28 @@ declare function isKnowledgeAssetPath(path: string): boolean;
|
|
|
607
894
|
declare function assetExtension(path: string): KnowledgeAssetExtension | null;
|
|
608
895
|
/** The media type an asset path implies, from its extension. */
|
|
609
896
|
declare function assetContentType(path: string): string | null;
|
|
610
|
-
/**
|
|
897
|
+
/** Whether an asset path is audio or video, which only 0.8 catalogs may ship. */
|
|
898
|
+
declare function isKnowledgeMediaAssetPath(path: string): boolean;
|
|
899
|
+
/** What kind of media row an asset can back, from its extension. */
|
|
900
|
+
declare function assetModality(path: string): KnowledgeAssetModality | null;
|
|
901
|
+
/** The per-file size limit for an asset path. */
|
|
902
|
+
declare function maxKnowledgeAssetBytes(path: string): number;
|
|
903
|
+
/**
|
|
904
|
+
* Why a set of asset files breaks the format's size and count limits, or
|
|
905
|
+
* null. Images and media have separate per-file and total budgets; the
|
|
906
|
+
* count limit covers both.
|
|
907
|
+
*/
|
|
908
|
+
declare function knowledgeAssetLimitsProblem(files: ReadonlyArray<{
|
|
909
|
+
path: string;
|
|
910
|
+
sizeBytes: number;
|
|
911
|
+
}>): string | null;
|
|
912
|
+
/** The kind an extension declares, normalized (`jpg`/`jpeg`, `mp4`/`m4a`, `ogg`/`opus`). */
|
|
611
913
|
declare function assetKindForExtension(ext: KnowledgeAssetExtension): KnowledgeAssetKind;
|
|
612
914
|
/**
|
|
613
|
-
* What the leading bytes say the file is. Rasters
|
|
614
|
-
* magic numbers; an SVG is UTF-8 text whose first
|
|
615
|
-
* whitespace, XML declaration, comments and DOCTYPE,
|
|
915
|
+
* What the leading bytes say the file is. Rasters and audio/video containers
|
|
916
|
+
* are recognized by their magic numbers; an SVG is UTF-8 text whose first
|
|
917
|
+
* element, after any BOM, whitespace, XML declaration, comments and DOCTYPE,
|
|
918
|
+
* is `<svg`.
|
|
616
919
|
*/
|
|
617
920
|
declare function sniffAssetType(bytes: Uint8Array): KnowledgeAssetKind | null;
|
|
618
921
|
/**
|
|
@@ -649,6 +952,16 @@ declare function topicSortKeyForOrder(order: number): string;
|
|
|
649
952
|
* way.
|
|
650
953
|
*/
|
|
651
954
|
|
|
955
|
+
/**
|
|
956
|
+
* The unit vector a profile stores or queries with, from the model's raw
|
|
957
|
+
* output: checked against the width the model emits, cut to the stored
|
|
958
|
+
* width when the profile truncates (Matryoshka prefix), then normalized.
|
|
959
|
+
* The compiler (passages and media) and every query embedder call this, so
|
|
960
|
+
* truncation has exactly one definition. The norm is taken over the raw
|
|
961
|
+
* values as given, never over a float32 copy, so a profile without
|
|
962
|
+
* truncation produces bit-for-bit what `l2Normalize` always did.
|
|
963
|
+
*/
|
|
964
|
+
declare function profileUnitVector(profile: KnowledgeEmbeddingProfile, raw: ArrayLike<number>): Float32Array;
|
|
652
965
|
/** int8: symmetric linear, scale 127, −128 never produced. */
|
|
653
966
|
declare function quantizeInt8(unitVector: ArrayLike<number>): Int8Array;
|
|
654
967
|
/** `vector − center`, the input to a `centered-sign` profile's bits. */
|
|
@@ -664,6 +977,8 @@ declare function quantizeBinary(unitVector: ArrayLike<number>): Uint8Array;
|
|
|
664
977
|
/**
|
|
665
978
|
* Rerank score: dot(float32 unit query, dequantized int8 passage). Passages
|
|
666
979
|
* were unit vectors, so this approximates cosine; the query is not quantized.
|
|
980
|
+
* Widths must match: a query from an untruncated model scored against a
|
|
981
|
+
* truncated catalog would otherwise rank plausibly over a silent prefix.
|
|
667
982
|
*/
|
|
668
983
|
declare function rerankScore(query: ArrayLike<number>, passageInt8: Int8Array): number;
|
|
669
984
|
/** L2-normalize in place-free fashion; throws on a degenerate vector. */
|
|
@@ -688,4 +1003,105 @@ declare function canonicalizeJson(value: unknown): string;
|
|
|
688
1003
|
/** URL-ish slug for a document title (display/dedup aid, not an identity). */
|
|
689
1004
|
declare function documentSlug(title: string): string;
|
|
690
1005
|
|
|
691
|
-
|
|
1006
|
+
/**
|
|
1007
|
+
* Portable point locations and radius predicates for gezk 0.7. Coordinates
|
|
1008
|
+
* are WGS84 degrees; distances use the specified 6,371,000 m sphere. These
|
|
1009
|
+
* browser-safe contracts are shared by compilers, readers, and service APIs.
|
|
1010
|
+
* Bounds are conservative candidates only: membership always uses distance.
|
|
1011
|
+
*/
|
|
1012
|
+
|
|
1013
|
+
declare const GEZK_EARTH_RADIUS_METERS = 6371000;
|
|
1014
|
+
declare const MAX_DOCUMENT_LOCATIONS = 256;
|
|
1015
|
+
declare const KnowledgeLocationSchema: z.ZodObject<{
|
|
1016
|
+
id: z.ZodString;
|
|
1017
|
+
latitude: z.ZodNumber;
|
|
1018
|
+
longitude: z.ZodNumber;
|
|
1019
|
+
role: z.ZodEnum<{
|
|
1020
|
+
subject: "subject";
|
|
1021
|
+
associated: "associated";
|
|
1022
|
+
}>;
|
|
1023
|
+
provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1024
|
+
}, z.core.$strict>;
|
|
1025
|
+
type KnowledgeLocation = z.infer<typeof KnowledgeLocationSchema>;
|
|
1026
|
+
declare const KnowledgeLocationsSchema: z.ZodArray<z.ZodObject<{
|
|
1027
|
+
id: z.ZodString;
|
|
1028
|
+
latitude: z.ZodNumber;
|
|
1029
|
+
longitude: z.ZodNumber;
|
|
1030
|
+
role: z.ZodEnum<{
|
|
1031
|
+
subject: "subject";
|
|
1032
|
+
associated: "associated";
|
|
1033
|
+
}>;
|
|
1034
|
+
provenance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1035
|
+
}, z.core.$strict>>;
|
|
1036
|
+
declare const KnowledgeRadiusSchema: z.ZodObject<{
|
|
1037
|
+
latitude: z.ZodNumber;
|
|
1038
|
+
longitude: z.ZodNumber;
|
|
1039
|
+
radiusMeters: z.ZodNumber;
|
|
1040
|
+
}, z.core.$strict>;
|
|
1041
|
+
type KnowledgeRadius = z.infer<typeof KnowledgeRadiusSchema>;
|
|
1042
|
+
declare const KnowledgeBoundsSchema: z.ZodObject<{
|
|
1043
|
+
west: z.ZodNumber;
|
|
1044
|
+
south: z.ZodNumber;
|
|
1045
|
+
east: z.ZodNumber;
|
|
1046
|
+
north: z.ZodNumber;
|
|
1047
|
+
}, z.core.$strict>;
|
|
1048
|
+
type KnowledgeBounds = z.infer<typeof KnowledgeBoundsSchema>;
|
|
1049
|
+
declare const KnowledgeSpatialManifestSchema: z.ZodObject<{
|
|
1050
|
+
schema: z.ZodLiteral<"document-points@1">;
|
|
1051
|
+
crs: z.ZodLiteral<"EPSG:4326">;
|
|
1052
|
+
distanceModel: z.ZodLiteral<"sphere-6371000">;
|
|
1053
|
+
locationCount: z.ZodNumber;
|
|
1054
|
+
locatedDocuments: z.ZodNumber;
|
|
1055
|
+
coverage: z.ZodArray<z.ZodObject<{
|
|
1056
|
+
west: z.ZodNumber;
|
|
1057
|
+
south: z.ZodNumber;
|
|
1058
|
+
east: z.ZodNumber;
|
|
1059
|
+
north: z.ZodNumber;
|
|
1060
|
+
}, z.core.$strict>>;
|
|
1061
|
+
}, z.core.$strict>;
|
|
1062
|
+
type KnowledgeSpatialManifest = z.infer<typeof KnowledgeSpatialManifestSchema>;
|
|
1063
|
+
declare function normalizeLongitude(longitude: number): number;
|
|
1064
|
+
declare function locationDistanceMeters(from: Pick<KnowledgeLocation, 'latitude' | 'longitude'>, to: Pick<KnowledgeLocation, 'latitude' | 'longitude'>): number;
|
|
1065
|
+
declare function radiusBounds(raw: KnowledgeRadius): KnowledgeBounds[];
|
|
1066
|
+
declare function locationInBounds(location: KnowledgeLocation, bounds: KnowledgeBounds): boolean;
|
|
1067
|
+
declare function spatialManifest(locations: Array<{
|
|
1068
|
+
documentId: string;
|
|
1069
|
+
location: KnowledgeLocation;
|
|
1070
|
+
}>): KnowledgeSpatialManifest;
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Words that carry no subject in a search request. Dropping one from an FTS5
|
|
1074
|
+
* OR query is safe: it can only remove hits that matched nothing else, and
|
|
1075
|
+
* anything holding a distinctive term still ranks.
|
|
1076
|
+
*
|
|
1077
|
+
* One list for every keyword-search path — the project index's query builder
|
|
1078
|
+
* and token scorers in the service, the knowledge-catalog reader, and the
|
|
1079
|
+
* phone runtime's memory recall. It lives here, in the format package,
|
|
1080
|
+
* because this is the one package all three can import: the reader must not
|
|
1081
|
+
* depend on core or the service, and core must stay browser-safe.
|
|
1082
|
+
* There were three lists once: a 24-word one behind the project index's FTS5
|
|
1083
|
+
* query, a 14-word one behind area-summary token coverage, and the catalog
|
|
1084
|
+
* reader's function words. Neither project list covered the vocabulary of an
|
|
1085
|
+
* ordinary request, so "Can you create a PowerPoint about France" reached
|
|
1086
|
+
* FTS5 as `"can"* OR "create"* OR "powerpoint"* OR "about"* OR "france"*`.
|
|
1087
|
+
* In the shared library `france` matched nothing at all while
|
|
1088
|
+
* `can`/`about`/`create` matched 66/25/30 rows, so ranking was decided
|
|
1089
|
+
* entirely by the filler: the top document hit was a career memoir, and the
|
|
1090
|
+
* top symbol hit was a heading called "All About DocBlocks" whose only
|
|
1091
|
+
* matched token was `about`. The catalog reader kept `tell`, `please` and
|
|
1092
|
+
* `help` in "Can you tell me how to integrate Azure search with blob
|
|
1093
|
+
* storage?".
|
|
1094
|
+
*
|
|
1095
|
+
* Callers fall back to every token when a query is nothing but these words,
|
|
1096
|
+
* so "how to" and a bare search for "create" still search for what was typed.
|
|
1097
|
+
*
|
|
1098
|
+
* Judgment call worth knowing about: the request verbs `create` and `make`
|
|
1099
|
+
* are stopwords, while `build`, `fix`, `read`, `write`, `update`, `delete`
|
|
1100
|
+
* and `show` are not. The first two are how a user says "produce a thing" and
|
|
1101
|
+
* carry no subject; the rest name real work and real symbols in a codebase.
|
|
1102
|
+
*
|
|
1103
|
+
* Lowercase; compare against a lowercased token.
|
|
1104
|
+
*/
|
|
1105
|
+
declare const QUERY_STOP_WORDS: ReadonlySet<string>;
|
|
1106
|
+
|
|
1107
|
+
export { ASSETS_PREFIX, ArtifactDigestSchema, BODY_CODEC_MIN_BYTES, type CatalogDocument, CatalogDocumentSchema, DEFAULT_EMBEDDING_ONNX_FILE, DEFAULT_EMBEDDING_TOKENIZER_FILE, type EmbeddingMedia, EmbeddingMediaSchema, type EmbeddingModelFile, EmbeddingModelFileSchema, 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_MEDIA_ASSET_TYPES, KNOWLEDGE_VERSION_PATTERN, type KnowledgeAssetExtension, type KnowledgeAssetKind, type KnowledgeAssetModality, KnowledgeAssetPathSchema, type KnowledgeBounds, KnowledgeBoundsSchema, type KnowledgeCatalogManifest, KnowledgeCatalogManifestSchema, KnowledgeChunkUidSchema, type KnowledgeChunkingProfile, KnowledgeChunkingProfileSchema, KnowledgeDocumentIdSchema, type KnowledgeDocumentMeta, KnowledgeDocumentMetaSchema, type KnowledgeEmbeddingProfile, KnowledgeEmbeddingProfileSchema, KnowledgeIdSchema, type KnowledgeImageAssetExtension, type KnowledgeLocation, KnowledgeLocationSchema, KnowledgeLocationsSchema, KnowledgeManifestFileSchema, type KnowledgeMediaAssetExtension, 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_MEDIA_ASSETS_TOTAL_BYTES, MAX_KNOWLEDGE_MEDIA_ASSET_BYTES, MAX_KNOWLEDGE_TOPIC_DEPTH, MIMETYPE_PATH, QUERY_STOP_WORDS, README_PATH, ROUTER_DB_PATH, ROUTER_DDL, RepoRelativePathSchema, SHARD_DDL, SHARD_DDL_V4, SHARD_DDL_V5, SOURCE_NOTICES_PATH, Sha256HexSchema, type SourceNotices, SourceNoticesSchema, ZIP_FIXED_MTIME, assetContentType, assetExtension, assetKindForExtension, assetModality, canonicalizeJson, centerVector, documentSlug, embeddingProfileArtifacts, embeddingProfileCenter, embeddingProfileCenterProblem, embeddingProfileMinimumFormat, embeddingProfileSourceDimensions, embeddingProfileTruncationProblem, formatAtLeast, formatKnowledgeUri, isKnowledgeAssetPath, isKnowledgeMediaAssetPath, isSupportedFormatVersion, isSupportedIndexSchemaVersion, knowledgeAssetLimitsProblem, l2Normalize, locationDistanceMeters, locationInBounds, maxKnowledgeAssetBytes, normalizeLongitude, parseKnowledgeUri, profileUnitVector, quantizeBinary, quantizeBinaryForProfile, quantizeInt8, radiusBounds, rerankScore, sameVectorSpace, shardDdlFor, sniffAssetType, spatialManifest, svgInertnessProblem, topicSortKeyForOrder };
|