Implement Studio root and placement capabilities on the replica graph (WI-10)

This commit is contained in:
Timothy J. Aveni
2026-09-21 16:37:00 -07:00
parent 2cf53280e4
commit e1ad15c620
9 changed files with 103 additions and 19 deletions
+28
View File
@@ -0,0 +1,28 @@
import type { ValueType, WorkspaceRevision } from "../capability-model/types.js";
import { ExecutionPlanError } from "./plan.js";
const string: ValueType = { kind: "scalar", name: "string" };
/** Narrow immutable installation metadata. No graph enumeration or live reflection. */
export function portableReflectionType(selector: string): ValueType {
if (selector !== "presentations")
throw new ExecutionPlanError(
"UNSUPPORTED_PORTABLE_REFLECTION",
selector,
"Only checked presentation metadata is portable",
);
return {
kind: "list",
value: { kind: "record", fields: { id: string, subject: string, atoms: { kind: "list", value: string } } },
};
}
export function portableReflectionValue(workspace: WorkspaceRevision, selector: string) {
portableReflectionType(selector);
return (workspace.presentations ?? [])
.map((p) => ({
id: p.id,
subject: p.subject,
atoms: [
...new Set(workspace.conformances.filter((c) => c.interfaceRevisionId === p.subject).map((c) => c.atomId)),
].sort(),
}))
.sort((a, b) => a.id.localeCompare(b.id));
}