30e4e99908
- RoleOutput gains refs: string[] for CAS reference tracking - RoleDefinition gains extractRefs: ((meta) => string[]) | null - planner: phases.map(p => p.hash), coder: [completedPhase] - Engine persists refs, fork preserves refs - Backward compat: missing refs normalized to [] - 137 tests passing Fixes #31
14 lines
336 B
TypeScript
14 lines
336 B
TypeScript
/** Normalize `refs` from persisted JSONL or IPC payloads (missing or invalid → []). */
|
|
export function normalizeRefsField(value: unknown): string[] {
|
|
if (!Array.isArray(value)) {
|
|
return [];
|
|
}
|
|
const out: string[] = [];
|
|
for (const x of value) {
|
|
if (typeof x === "string") {
|
|
out.push(x);
|
|
}
|
|
}
|
|
return out;
|
|
}
|