feat(f6): onDidApplyAgentEdit — the single machine-landing signal (SLICE-2)
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user