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; }