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
Owner

Summary

Implements F3 (#6) — live human/Claude attribution on the F2 model (#4), per vscode-cowriting-plugin-content/specs/coauthoring-attribution.md (§7.2 SLICE-1..6).

  • SLICE-1 src/model.ts — typed AttributionRecord fills the reserved attributions[] (shared anchors/Provenance, schemaVersion stays 1 — INV-4) with stable serialization.
  • SLICE-2 src/attributionTracker.ts — pure span algebra (shift/split/clip/coalesce): char-honest attribution, both author directions (INV-6/INV-7).
  • SLICE-3 src/pendingEdits.ts + src/attributionController.ts — the applyAgentEdit seam (the only machine-edit ingress — INV-9) with a pending-edit registry that mirrors the host's WorkspaceEdit diff-minimization (transport-minimized, intent-honest full-extent attribution); human typing wiring; decorations (Claude tint / human border) + toggle (PUC-5). CoauthorStore.update section-merge + counted self-writes + one shared sidecar watcher so Thread/Attribution controllers co-own the sidecar without clobbering.
  • SLICE-4 save-time fingerprint persistence (updatedAt bumped only on change), load/external-change resolve-or-orphan on the F2 Anchorer ladder (INV-1), disk-compare sync detection (the isDirty heuristic is host-unreliable), orphan status-bar count + output channel.
  • SLICE-5 src/liveTurn.ts — one @cline/sdk Agent turn on the built-in claude-code provider (rides the local Claude Code Pro/Max login; the extension stores zero credentials — INV-8) behind Cowriting: Ask Claude to Edit Selection; fence-aware replacement extraction; graceful failure paths. Live smoke performed and logged (docs/MANUAL-SMOKE-F3.md: PASS, sessionId run_g_rYKGYl, 6.9s).
  • SLICE-6 host E2E (test/e2e/suite/attribution.test.ts): type → human span → seam edit → agent span (incl. via the command wrapper) → save → reload → re-anchor → orphan → toggle. No LLM in CI — E2E drives the seam.

Verification

  • npm run typecheck clean · npx vitest run 69/69 · npm run build (extension.cjs + liveTurn.mjs) · npm run test:e2e 10/10 (F2 threads 4/4 + F3 attribution 6/6)
  • Each slice two-stage reviewed (spec + quality) + final whole-branch review; the host E2E surfaced and fixed two host-only bugs (dirty-flag event ordering; WorkspaceEdit diff-minimization breaking exact seam matching).
  • Plan: docs/superpowers/plans/2026-06-10-f3-live-attribution.md (incl. amendments). Session 0007 transcript to follow at finalize.

F4 (propose/accept) inherits the seam contract and the attribution substrate.

Fixes #6

🤖 Generated with Claude Code

## Summary Implements **F3 (#6) — live human/Claude attribution** on the F2 model (#4), per `vscode-cowriting-plugin-content/specs/coauthoring-attribution.md` (§7.2 SLICE-1..6). - **SLICE-1** `src/model.ts` — typed `AttributionRecord` fills the reserved `attributions[]` (shared `anchors`/`Provenance`, `schemaVersion` stays 1 — INV-4) with stable serialization. - **SLICE-2** `src/attributionTracker.ts` — pure span algebra (shift/split/clip/coalesce): char-honest attribution, both author directions (INV-6/INV-7). - **SLICE-3** `src/pendingEdits.ts` + `src/attributionController.ts` — the **`applyAgentEdit` seam** (the only machine-edit ingress — INV-9) with a pending-edit registry that mirrors the host's WorkspaceEdit diff-minimization (transport-minimized, intent-honest full-extent attribution); human typing wiring; decorations (Claude tint / human border) + toggle (PUC-5). `CoauthorStore.update` section-merge + counted self-writes + one shared sidecar watcher so Thread/Attribution controllers co-own the sidecar without clobbering. - **SLICE-4** save-time fingerprint persistence (`updatedAt` bumped only on change), load/external-change resolve-or-orphan on the F2 Anchorer ladder (INV-1), disk-compare sync detection (the `isDirty` heuristic is host-unreliable), orphan status-bar count + output channel. - **SLICE-5** `src/liveTurn.ts` — one `@cline/sdk` `Agent` turn on the built-in **`claude-code` provider** (rides the local Claude Code Pro/Max login; the extension stores **zero credentials** — INV-8) behind `Cowriting: Ask Claude to Edit Selection`; fence-aware replacement extraction; graceful failure paths. **Live smoke performed and logged** (`docs/MANUAL-SMOKE-F3.md`: PASS, sessionId `run_g_rYKGYl`, 6.9s). - **SLICE-6** host E2E (`test/e2e/suite/attribution.test.ts`): type → human span → seam edit → agent span (incl. via the command wrapper) → save → reload → re-anchor → orphan → toggle. **No LLM in CI** — E2E drives the seam. ## Verification - `npm run typecheck` clean · `npx vitest run` **69/69** · `npm run build` (extension.cjs + liveTurn.mjs) · `npm run test:e2e` **10/10** (F2 threads 4/4 + F3 attribution 6/6) - Each slice two-stage reviewed (spec + quality) + final whole-branch review; the host E2E surfaced and fixed two host-only bugs (dirty-flag event ordering; WorkspaceEdit diff-minimization breaking exact seam matching). - Plan: `docs/superpowers/plans/2026-06-10-f3-live-attribution.md` (incl. amendments). Session 0007 transcript to follow at finalize. F4 (propose/accept) inherits the seam contract and the attribution substrate. Fixes #6 🤖 Generated with [Claude Code](https://claude.com/claude-code)
benstull added 15 commits 2026-06-10 18:11:39 +00:00
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
benstull merged commit 75091202a6 into main 2026-06-10 18:11:47 +00:00
Sign in to join this conversation.