F3 SLICE-1: typed attributions[] model (spec §6.3, INV-4) (#6)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-10 09:43:13 -07:00
parent 9c7860a776
commit 4afe97c9a8
2 changed files with 56 additions and 3 deletions
+24 -3
View File
@@ -47,6 +47,20 @@ export interface Thread {
messages: Message[];
}
/** F3 (spec §6.3): an anchored, author-attributed span — state, not history. */
export interface AttributionRecord {
id: string;
/** shared anchors map — same Fingerprint primitive (INV-4). */
anchorId: string;
author: Provenance;
/** ISO-8601. */
createdAt: string;
/** ISO-8601; bumped when the span's extent/fingerprint changes. */
updatedAt: string;
/** groups all spans applied by one live turn. */
turnId?: string;
}
export interface Artifact {
schemaVersion: number;
/** repo-relative path; the sidecar key. */
@@ -54,8 +68,8 @@ export interface Artifact {
/** SHARED primitive (INV-4). */
anchors: Record<string, Anchor>;
threads: Thread[];
/** F3 extension point — reuses anchors[]; not implemented in F2. */
attributions: unknown[];
/** 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[];
}
@@ -117,7 +131,14 @@ export function serializeArtifact(a: Artifact): string {
createdAt: m.createdAt,
})),
})),
attributions: a.attributions,
attributions: a.attributions.map((at) => ({
id: at.id,
anchorId: at.anchorId,
author: serializeProvenance(at.author),
createdAt: at.createdAt,
updatedAt: at.updatedAt,
...(at.turnId !== undefined ? { turnId: at.turnId } : {}),
})),
proposals: a.proposals,
};
return JSON.stringify(canonical, null, 2) + "\n";