feat: complete catalog-driven preprocessing
Publish documentation / publish (push) Successful in 2m12s
Publish documentation / publish (push) Successful in 2m12s
This commit is contained in:
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
|
||||
import { normalize } from "node:path";
|
||||
|
||||
export interface CanonicalEffectiveConfig {
|
||||
schemaVersion: 2;
|
||||
schemaVersion: 3;
|
||||
dwh: CanonicalDwhConfig;
|
||||
vector: CanonicalVectorConfig;
|
||||
embedding: CanonicalEmbeddingConfig;
|
||||
@@ -21,7 +21,10 @@ export interface CanonicalDwhConfig {
|
||||
}
|
||||
|
||||
export interface CanonicalVectorConfig {
|
||||
collection: string;
|
||||
collections: {
|
||||
reference: string;
|
||||
memory: string;
|
||||
};
|
||||
dimensions: number;
|
||||
distance: string;
|
||||
}
|
||||
@@ -120,7 +123,10 @@ function buildVectorConfig(rendered: Record<string, unknown>): CanonicalVectorCo
|
||||
if (!vector) {
|
||||
throw new TypeError("effective config is missing vector resources");
|
||||
}
|
||||
const collection = requireString(vector, "collection");
|
||||
const collections = asRecord(vector.collections);
|
||||
if (!collections) {
|
||||
throw new TypeError("effective config is missing vector collections");
|
||||
}
|
||||
const semanticIndex = asRecord(rendered.semantic_index);
|
||||
const vectorStore = semanticIndex ? asRecord(semanticIndex.vector_store) : undefined;
|
||||
const dimensions = vectorStore
|
||||
@@ -129,7 +135,14 @@ function buildVectorConfig(rendered: Record<string, unknown>): CanonicalVectorCo
|
||||
const distance = vectorStore
|
||||
? requireString(vectorStore, "distance")
|
||||
: (optionalString(vector, "distance") ?? "cosine");
|
||||
return { collection, dimensions, distance };
|
||||
return {
|
||||
collections: {
|
||||
reference: requireString(collections, "reference"),
|
||||
memory: requireString(collections, "memory"),
|
||||
},
|
||||
dimensions,
|
||||
distance,
|
||||
};
|
||||
}
|
||||
|
||||
function buildEmbeddingConfig(rendered: Record<string, unknown>): CanonicalEmbeddingConfig {
|
||||
@@ -169,7 +182,7 @@ export function buildCanonicalEffectiveConfig(renderedConfig: unknown): Canonica
|
||||
throw new TypeError("effective config requires a rendered configuration object");
|
||||
}
|
||||
return {
|
||||
schemaVersion: 2,
|
||||
schemaVersion: 3,
|
||||
dwh: buildDwhConfig(rendered),
|
||||
vector: buildVectorConfig(rendered),
|
||||
embedding: buildEmbeddingConfig(rendered),
|
||||
@@ -220,3 +233,20 @@ export function configFingerprint(renderedConfig: unknown): string {
|
||||
export function inputFingerprint(workspaceId: string, renderedConfig: unknown): string {
|
||||
return sha256(effectiveConfigIdentity(workspaceId, renderedConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fingerprint every non-Catalog input consumed by complete preprocessing. The immutable Git
|
||||
* revision covers the workspace descriptor and its revision-pinned Evidence tree; the effective
|
||||
* configuration identity covers the Catalog-derived DWH binding and semantic runtime contract.
|
||||
*/
|
||||
export function preprocessingInputFingerprint(
|
||||
workspaceId: string,
|
||||
workspaceRevision: string,
|
||||
renderedConfig: unknown,
|
||||
): string {
|
||||
return sha256(JSON.stringify({
|
||||
workspaceId,
|
||||
workspaceRevision,
|
||||
effectiveConfigIdentity: effectiveConfigIdentity(workspaceId, renderedConfig),
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user