Skip to content

feat: file-tool verification diffs, TUI model picker, and file viewer - #378

Merged
rschardosin merged 7 commits into
mainfrom
feat/file-tool-diff-verification-and-tui-model-picker
Jul 30, 2026
Merged

feat: file-tool verification diffs, TUI model picker, and file viewer#378
rschardosin merged 7 commits into
mainfrom
feat/file-tool-diff-verification-and-tui-model-picker

Conversation

@rschardosin

Copy link
Copy Markdown
Contributor

Summary

  • Agent file tools: edit_file and write_file return unified-style verification_context hunks (modify / insert / delete / multi-line / regex; create / overwrite) so agents can confirm changes without a follow-up read_file.
  • Sandbox dev loop: make docker-incus builds the host-native Linux binary, --loads into the local Docker daemon, and retags :latest so Docker+Incus runtimes pick up local tool changes.
  • Terminal chat:
    • Main-thread dual-gutter file diffs for successful edits/writes (no diff on failed tools; activity fold keeps raw request/response).
    • /model provider → model picker with client API support for listing models and pinning provider/model on chat turns.
    • Clickable Files generated list with a full-screen artifact/report viewer (Esc to return).

Test plan

  • Unit: go test ./pkg/tools -run 'EditFile|WriteFile|Verification'
  • Unit: go test ./pkg/tui/...
  • Manual TUI: successful edit_file / write_file shows dual-gutter diff on main thread; failed permission write does not
  • Manual TUI: activity expand shows raw args/result, not the visual diff
  • Manual TUI: /model lists providers/models and pins for the next turn
  • Manual TUI: generated file / report appears under Files generated; click opens viewer; Esc returns
  • Docker+Incus: after make docker-incus + container recreate + sandbox refresh --force, sandbox edit_file returns (line N) + hunk verification

Return OpenCode-style verification_context hunks from edit_file (modify,
insert, delete, multi-line, regex) and write_file (create/overwrite) so
agents can confirm changes without re-reading files. Fix make docker-incus
to build the host-native Linux binary, load the image into the local
Docker daemon, and retag :latest for dev runtimes.

Also add a terminal /model provider→model picker with client API support
for listing models and pinning provider/model on chat turns.
Prefer tool result verification_context (real line numbers and
surrounding context) when available; fall back to args while tools are
still running. Display ---/+++/@@ ± body with colored markers and wire
activity +N/−M stats from the same source.
Promote successful edit_file/write_file changes to ItemFileDiff on the
transcript (editor-style old/new line gutters + ± content). Keep the
activity fold for raw request args and response JSON only. Layout:
user → activity → file_diff(s) → agent.
Do not use the total composer line count for [Pasted: N lines]. Single-line pastes and line-by-line injection stay expanded; only a multi-line paste insert collapses.
Only emit ItemFileDiff when verification_context is present (set after a
successful write/edit). Failed tools still carry content in args; using
args alone incorrectly showed a diff. Also treat common Go error strings
like "failed to write … permission denied" as tool errors.
Add a clickable "Files generated" list in the chat transcript with a
full-screen file viewer (Esc to return). Wire Studio artifact/report_marker
SSE events and session history artifacts through the platform backend, and
fetch content via GET /api/studio/artifacts/content.
@rschardosin
rschardosin merged commit 8c64137 into main Jul 30, 2026
5 checks passed
@rschardosin
rschardosin deleted the feat/file-tool-diff-verification-and-tui-model-picker branch July 30, 2026 02:16
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