Skip to content

feat(toolpath-desktop): chat transcript + Edit-tool diffs#34

Merged
eliothedeman merged 1 commit intomainfrom
eliot/practical-blackburn-db264d
Apr 22, 2026
Merged

feat(toolpath-desktop): chat transcript + Edit-tool diffs#34
eliothedeman merged 1 commit intomainfrom
eliot/practical-blackburn-db264d

Conversation

@eliothedeman
Copy link
Copy Markdown
Collaborator

Summary

Turns the Preview into a native-Claude-style chat transcript (primary) with the DAG graph hidden behind a toggle, and teaches the Claude/convo derivers to actually capture file-edit diffs so the UI has something to show.

  • Chat view — right-aligned user bubbles (road-wash), left-aligned assistant bubbles (water-wash), model label, "Used Edit · Read · Bash" chip summary. Tool invocations fold inline inside their parent assistant bubble (Claude emits them as siblings that don't advance HEAD; tree.ts attaches them via a new toolInvocations field instead of scattering them as loose cards). Markdown bodies via marked + DOMPurify.
  • Graph view — toggleable, same DAG as before plus / % / + zoom (CSS zoom so the scroll container sees correct bounds), ⌘/ctrl + wheel pinch-zoom, resizable pane.
  • Step tree sidebar — searchable, filter tabs (all / on HEAD / dead ends), DFS connectors, actor-coloured names, short UUIDs with full id on hover.
  • Edit-tool diffstoolpath-convo now exports file_write_diff / unified_diff (via similar). Handles Edit (old/new_string), Write (content), MultiEdit (per-hunk with # edit N/total headers). Both toolpath-convo::derive_path and toolpath-claude::derive_path populate ArtifactChange.raw for file-write tools, so inline diff blocks render in the chat + the Inspector side panel. Previously every file-edit tool was emitted with raw: None.
  • Shared classification — new lib/classify.ts (user / assistant / tool / system) breaks the import cycle between viz.ts and tree.ts and stays in lockstep with StructuralChange's #[serde(flatten)] shape.
  • Role palette unified — user = road, agent = water — across chat bubbles, graph cards, tree actor colours, and the graph legend.

Test plan

  • cargo test --workspace (all green; adds 3 unit tests in toolpath-convo for Edit/Write/MultiEdit + an end-to-end test in toolpath-claude proving derive_path emits a unified diff for an Edit tool use)
  • cargo clippy -p toolpath-convo -- -D warnings
  • bun run check (0 errors; 4 pre-existing a11y warnings in BrowseClaude.svelte / BrowsePi.svelte)
  • bun run build
  • Manual: derive a real Claude session in the Tauri app → transcript shows user/assistant bubbles, inline tool cards with unified diffs, model labels, markdown formatting, searchable tree sidebar, graph view with pan + zoom

… diffs

Adds a Claude-style chat transcript as the primary Preview view, with the
existing DAG hidden behind a "Graph view" toggle. Changes span the Tauri
frontend, shared conversation derivation, and the Claude-specific deriver.

Desktop / frontend
  - ChatView.svelte: HEAD-path transcript. User messages render as
    right-aligned road-wash bubbles, assistants as left-aligned water-wash
    bubbles with model label. Tool invocations fold inline inside the
    parent assistant bubble (Claude emits them as siblings that don't
    advance HEAD; tree.ts now attaches them via the assistant's
    toolInvocations field rather than scattering them as separate cards).
  - Markdown rendering (marked + DOMPurify) for user / assistant / thinking
    bodies, plus a compact variant used inside graph cards so headings,
    code blocks and lists stay on scale with body text.
  - StepTree.svelte: searchable sidebar with filter tabs (all / on HEAD /
    dead ends), DFS tree connectors, actor-coloured names. Short UUIDs on
    face, full id on title tooltip.
  - Graph view now scrolls + zooms (CSS `zoom` for correct scrollbar
    bounds), with a - / % / + toolbar and ⌘/ctrl + wheel.
  - Role palette unified across chat + cards + tree: user → road, agent
    → water.
  - pg-card: dropped the UUID header, serif message body with fade mask
    + line clamp, tool-use chips, kind-specific shapes for tool / system
    steps.
  - lib/classify.ts: shared step classification (user / assistant / tool
    / system) reading structural.type + role. Avoids the tree↔viz import
    cycle.

Derivation / Rust
  - toolpath-convo: new `file_write_diff(tool_name, input, path)` +
    `unified_diff(path, before, after)` exported from derive.rs. Handles
    Edit (old_string/new_string), Write (content), and MultiEdit (per-hunk
    with `# edit N/total` headers). Conversation-path derivations populate
    ArtifactChange.raw with the unified diff and keep structured
    before/after/edits in structural.extra.
  - toolpath-claude: tool.invoke steps for file-write tools (Edit / Write
    / MultiEdit / NotebookEdit) now also carry ArtifactChange.raw via
    file_write_diff. MultiEdit added to the file_write category match arm.
  - Tests: unit tests for Edit / Write / MultiEdit diff generation in
    toolpath-convo; end-to-end test in toolpath-claude that exercises
    derive_path with an Edit tool use.
@github-actions
Copy link
Copy Markdown

🔍 Preview deployed: https://367b8171.toolpath.pages.dev

@eliothedeman eliothedeman merged commit 1c72036 into main Apr 22, 2026
2 checks passed
eliothedeman added a commit that referenced this pull request Apr 22, 2026
…tenChatHead

Regression coverage for two pure-TS modules added in #34 that hit real
bugs during development — both would have been caught by a ~20-line
test. Wires up Vitest as the frontend test runner (Node environment,
no jsdom needed for these pure-TS tests).

classify.ts: five cases covering user / assistant / tool / system
branches plus readStructural's preference for conversation-type
payloads over sibling file artifacts.

tree.ts: five cases covering flattenChatHead's HEAD-chain lineariser,
the tool.invoke sibling attachment, the non-tool-sibling filter, the
bare-Step fallback, and the detached-HEAD fallback.

Closes #40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant