F3: live human/Claude attribution on @cline/sdk claude-code (Feature #6) #7

Merged
benstull merged 15 commits from feat/f3-live-attribution into main 2026-06-10 18:11:47 +00:00
2 changed files with 31 additions and 1 deletions
Showing only changes of commit d85194224f - Show all commits
+3 -1
View File
@@ -326,7 +326,9 @@ export class AttributionController implements vscode.Disposable {
editor.setDecorations(this.humanType, humanRanges); editor.setDecorations(this.humanType, humanRanges);
} }
} }
this.renderStatus(s); if (document === vscode.window.activeTextEditor?.document) {
this.renderStatus(s);
}
} }
private renderStatus(s: DocAttribution | undefined): void { private renderStatus(s: DocAttribution | undefined): void {
+28
View File
@@ -131,4 +131,32 @@ suite("F3 live attribution (host E2E — seam-driven, no LLM)", () => {
assert.ok(!spans.some((s) => s.authorKind === "agent"), "mangled agent span not rendered"); assert.ok(!spans.some((s) => s.authorKind === "agent"), "mangled agent span not rendered");
assert.ok(api.attributionController.getOrphanCount(DOC_REL) >= 1, "…it is orphaned instead (INV-1)"); assert.ok(api.attributionController.getOrphanCount(DOC_REL) >= 1, "…it is orphaned instead (INV-1)");
}); });
test("the applyAgentEdit command wrapper and the toggle command work end-to-end", async () => {
const doc = await openDoc();
const api = await getApi();
const anchor = "stable first paragraph";
const start = doc.getText().indexOf(anchor);
const ok = await vscode.commands.executeCommand<boolean>("cowriting.applyAgentEdit", {
uri: doc.uri.toString(),
start,
end: start + anchor.length,
newText: "stable COMMAND-EDITED paragraph",
model: "sonnet",
sessionId: "e2e-cmd",
turnId: "turn-e2e-cmd",
});
assert.strictEqual(ok, true, "command wrapper applies via the seam");
await settle();
const spans = api.attributionController.getSpans(DOC_REL);
const agent = spans.find((s) => s.turnId === "turn-e2e-cmd");
assert.ok(agent, "command-driven agent span exists");
assert.strictEqual(agent!.authorKind, "agent");
assert.strictEqual(api.attributionController.isVisible(), true);
await vscode.commands.executeCommand("cowriting.toggleAttribution");
assert.strictEqual(api.attributionController.isVisible(), false, "toggle hides (PUC-5)");
await vscode.commands.executeCommand("cowriting.toggleAttribution");
assert.strictEqual(api.attributionController.isVisible(), true, "toggle restores");
});
}); });