Skip to content

[FEATURE]: Expose V2 session.diff API #34434

Closed

Description

@opencode-agent

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Expose V2 session.diff through packages/protocol, server handlers, and the generated @opencode-ai/client.

From #34359, the TUI currently relies on the legacy session.diff endpoint.

Observed TUI/app usage on origin/v2:

  • packages/tui/src/feature-plugins/system/diff-viewer.tsx uses session.diff({ sessionID, messageID }) for last-turn mode.
  • packages/tui/src/feature-plugins/sidebar/files.tsx renders the session-scoped modified files list from session diff state.
  • packages/tui/src/plugin/adapters.tsx exposes session diff state to TUI plugins.
  • packages/app/src/pages/session.tsx refreshes session.diff for session review state.

Intention:

  • This is session-scoped change summary/diff state, not raw current VCS state.
  • Use this when the UI wants changes attributable to a session or a specific message/turn boundary.
  • Keep it separate from vcs.diff, which represents current repository/worktree state for a location.

Expected scope:

  • Add protocol/server/client surface for session diff.
  • Support optional messageID if that remains the V2 boundary selector.
  • Define how diff state is sourced from V2 session summaries/events.
  • Regenerate @opencode-ai/client.
  • Add tests covering whole-session and message-boundary diff requests.

This issue is split out from the broader TUI client migration umbrella #34359.

Activity

  1. opencode-agent commented on Jul 2, 2026

    @opencode-agent
    ContributorAuthor

    Assigned to @nexxeln from the V2 TODO LIST thread.

    Scope reminder from the original split:

    Aiden noted there was a Dax/Aiden scope discussion in another thread; if found, link it here before finalizing the API shape.

  2. opencode-agent commented on Jul 2, 2026

    @opencode-agent
    ContributorAuthor

    Scope references from Discord:

    1. Original V2 API split:
      https://discord.com/channels/1391832426048651334/1520962938733723720/1521136350936694906

    Relevant distinction:

    • VCS APIs = current repository/worktree status + raw VCS diff for a Location.
    • Session diff API = session-scoped or message-boundary diff, used for last-turn diff, session modified-files sidebar, plugin session diff state, and app review refreshes.
    1. Older snapshot/diff scoping discussion:
      https://discord.com/channels/1391832426048651334/1518799327076810812/1518808524354748446

    Relevant contract:

    • session scope = launch directory
    • snapshot storage/path identity = Git worktree
    • patch files = absolute
    • displayed FileDiff.file = worktree-relative
    • consumers should not need to know both roots, but the implementation must preserve this distinction.
  3. opencode-agent commented on Jul 3, 2026

    @opencode-agent
    ContributorAuthor

    Status from @nexxeln/Shoubhit: session diff APIs are in.

    Source: https://discord.com/channels/1391832426048651334/1520962938733723720/1522589081282937052

    Closing as completed.

  4. opencode-agent commented on Jul 3, 2026

    @opencode-agent
    ContributorAuthor

    Closed because the session diff APIs are reported in/completed by @nexxeln/Shoubhit.

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions