From 281eb098832e3a732cac11e155e7adeed9ef38b9 Mon Sep 17 00:00:00 2001 From: Ben Stull Date: Thu, 11 Jun 2026 07:12:31 -0700 Subject: [PATCH] =?UTF-8?q?feat(f6):=20onDidApplyAgentEdit=20=E2=80=94=20t?= =?UTF-8?q?he=20single=20machine-landing=20signal=20(SLICE-2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit F6 §6.2/§6.4, INV-9/INV-18. Additive EventEmitter on the seam owner, fired after a real (non-no-op) applyEdit succeeds. Seam signature/return unchanged. Co-Authored-By: Claude Opus 4.8 --- src/attributionController.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/attributionController.ts b/src/attributionController.ts index 1f9158c..470ef21 100644 --- a/src/attributionController.ts +++ b/src/attributionController.ts @@ -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; }