fix: render registry workspaces for harness
This commit is contained in:
@@ -10,6 +10,16 @@ export interface RuntimePaths {
|
||||
indexes: string;
|
||||
}
|
||||
|
||||
export interface RuntimeIdentity {
|
||||
workspaceId: string;
|
||||
workspaceRevision: string;
|
||||
}
|
||||
|
||||
export interface RuntimeInstallationOverlay {
|
||||
session_storage?: unknown;
|
||||
profile?: unknown;
|
||||
}
|
||||
|
||||
function seconds(timeoutMs: number | undefined): number | undefined {
|
||||
return timeoutMs === undefined ? undefined : Math.max(1, Math.ceil(timeoutMs / 1_000));
|
||||
}
|
||||
@@ -73,6 +83,8 @@ export function renderRuntimeConfig(
|
||||
workspace: WorkspaceDescriptor,
|
||||
bindings: RuntimeBindings,
|
||||
paths: RuntimePaths,
|
||||
identity?: RuntimeIdentity,
|
||||
installation: RuntimeInstallationOverlay = {},
|
||||
): string {
|
||||
const canonical = validateCanonicalWorkspace(workspace);
|
||||
if ([...bindings.dwh.missing, ...bindings.vector.missing, ...bindings.embedding.missing].length > 0) {
|
||||
@@ -113,10 +125,20 @@ export function renderRuntimeConfig(
|
||||
if (embeddingTimeout !== undefined) embedding.timeout = embeddingTimeout;
|
||||
|
||||
const rendered: Record<string, unknown> = {
|
||||
...(identity ? {
|
||||
runtime_identity: {
|
||||
workspace_id: identity.workspaceId,
|
||||
workspace_revision: identity.workspaceRevision,
|
||||
},
|
||||
} : {}),
|
||||
...(installation.session_storage === undefined
|
||||
? {} : { session_storage: installation.session_storage }),
|
||||
...(installation.profile === undefined ? {} : { profile: installation.profile }),
|
||||
language: canonical.workspace.language,
|
||||
database,
|
||||
vector_db: vectorDb,
|
||||
embeddings: embedding,
|
||||
roots: paths,
|
||||
paths,
|
||||
};
|
||||
if (dwhDirect) {
|
||||
|
||||
@@ -266,8 +266,9 @@ export function parseWorkspaceYaml(source: string): WorkspaceDescriptor {
|
||||
const documents = parseAllDocuments(source, { uniqueKeys: true });
|
||||
if (documents.length !== 1) throw new Error("Workspace YAML must contain exactly one document");
|
||||
const document = documents[0];
|
||||
if (document.errors.length > 0) {
|
||||
throw new Error(`Invalid workspace YAML: ${document.errors.map((error) => error.message).join("; ")}`);
|
||||
if (document.errors.length > 0 || document.warnings.length > 0) {
|
||||
throw new Error(`Invalid workspace YAML: ${[...document.errors, ...document.warnings]
|
||||
.map((error) => error.message).join("; ")}`);
|
||||
}
|
||||
return validateWorkspaceDescriptor(document.toJSON());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user