F4 SLICE-1: typed proposals[] on shared anchors/Provenance (spec §6.3, INV-13) (#12)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-10 22:02:08 -07:00
parent debd09fb97
commit 652f8619d2
2 changed files with 73 additions and 3 deletions
+27 -3
View File
@@ -61,6 +61,22 @@ export interface AttributionRecord {
turnId?: string;
}
/** F4 (spec §6.3, INV-13): a PENDING machine edit — state, not history. */
export interface Proposal {
id: string;
/** shared anchors map; fingerprint.text IS the exact target text (INV-11). */
anchorId: string;
/** the full proposed text for the anchored range. */
replacement: string;
author: Provenance;
/** ISO-8601. */
createdAt: string;
/** groups N proposals born of one live turn. */
turnId?: string;
/** what the human asked for (review context). */
instruction?: string;
}
export interface Artifact {
schemaVersion: number;
/** repo-relative path; the sidecar key. */
@@ -70,8 +86,8 @@ export interface Artifact {
threads: Thread[];
/** F3 fills this (spec §6.3, INV-4): typed attribution records anchored via anchors[]. */
attributions: AttributionRecord[];
/** F4 extension point — reuses anchors[] + provenance; not in F2. */
proposals: unknown[];
/** F4 (spec §6.3, INV-13): pending proposals on shared anchors[] + Provenance. */
proposals: Proposal[];
}
export function emptyArtifact(docPath: string): Artifact {
@@ -139,7 +155,15 @@ export function serializeArtifact(a: Artifact): string {
updatedAt: at.updatedAt,
...(at.turnId !== undefined ? { turnId: at.turnId } : {}),
})),
proposals: a.proposals,
proposals: a.proposals.map((p) => ({
id: p.id,
anchorId: p.anchorId,
replacement: p.replacement,
author: serializeProvenance(p.author),
createdAt: p.createdAt,
...(p.turnId !== undefined ? { turnId: p.turnId } : {}),
...(p.instruction !== undefined ? { instruction: p.instruction } : {}),
})),
};
return JSON.stringify(canonical, null, 2) + "\n";
}