F6: diff-view toggle (Feature #17) #18

Merged
benstull merged 9 commits from f6-diff-view-toggle into main 2026-06-11 14:21:46 +00:00
Showing only changes of commit 281eb09883 - Show all commits
+16 -1
View File
@@ -63,12 +63,21 @@ export class AttributionController implements vscode.Disposable {
private readonly output = vscode.window.createOutputChannel("Cowriting Attribution");
private visible = true;
/**
* F6 (§6.2/§6.4): the single machine-landing signal. Fired after a real
* (non-no-op) seam apply succeeds. INV-9 makes the seam the sole machine-edit
* ingress, so this is the sole signal — DiffViewController subscribes to
* advance the baseline; no call-site wiring, no future driver can forget it.
*/
private readonly applyEmitter = new vscode.EventEmitter<{ document: vscode.TextDocument }>();
readonly onDidApplyAgentEdit: vscode.Event<{ document: vscode.TextDocument }> = this.applyEmitter.event;
constructor(
private readonly store: CoauthorStore,
private readonly rootDir: string,
private readonly guard: VersionGuard,
) {
this.disposables.push(this.agentType, this.humanType, this.statusItem, this.output);
this.disposables.push(this.agentType, this.humanType, this.statusItem, this.output, this.applyEmitter);
this.disposables.push(
vscode.commands.registerCommand("cowriting.toggleAttribution", () => this.toggle()),
vscode.workspace.onDidChangeTextDocument((e) => this.onDidChange(e)),
@@ -275,6 +284,12 @@ export class AttributionController implements vscode.Disposable {
"(host minimized differently?) — the edit may be mis-attributed (INV-9).",
);
}
if (ok) {
// F6 (INV-18): a real machine landing — signal the baseline to advance so
// this text never shows as a change in the diff view. Fire regardless of
// attribution-match bookkeeping above; the landing happened either way.
this.applyEmitter.fire({ document });
}
return ok;
}