Skip to content

fix(tui): render commands as attachments - #43528

Closed
kitlangton wants to merge 4 commits into
v2from
command-display
Closed

fix(tui): render commands as attachments#43528
kitlangton wants to merge 4 commits into
v2from
command-display

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What

Render slash commands as first-class command attachments instead of exposing their expanded model-facing templates as user prose.

Before / After

Before: submitting /mycmd hello evaluated the command template and persisted only the expanded text. The model received the correct prompt, but the transcript also displayed THIS IS THE EXPANDED TEMPLATE. Argument: hello.

After: the same submission persists { name: "mycmd", arguments: "hello" } as command provenance alongside the expanded model text. Like a user message containing only a skill attachment, the message has no visible prose and renders only the command attachment badge.

How

  • Schema adds optional command provenance to durable prompts and projected user messages.
  • Core commands retain the evaluated template in text for the model and persist the original command name and arguments separately.
  • TUI optimistic rendering, durable replay, queued previews, history, exports, and the App restoration path format the compact invocation from command provenance.
  • The normal user-message surface renders the command as an attachment badge, matching skill-only submission while preserving files, skills, pending controls, and message actions.
  • Generated client types expose the optional command invocation.

Scope

This does not change command template evaluation or the model-visible prompt. Existing messages without command provenance continue rendering their stored text.

Testing

  • bun turbo typecheck --concurrency=3 (pre-push hook, 33 packages)
  • bun run test session-prompt.test.ts session-projector.test.ts in packages/core (55 passed)
  • bun run test test/mini/session.shared.test.ts test/mini/stream-v2.transport.test.ts test/mini/runtime.queue.test.ts in packages/tui (78 passed)
  • App unit and browser suites covering submission and message presentation (553 unit and 60 browser tests passed)
  • opencode-drive run ./.scripts/command-display.drive.ts against this worktree, asserting /mycmd hello is visible and the expanded template is absent
  • bun run test:bench before and after: all 42 performance unit checks passed both times; Playwright preview startup failed identically both times on the existing bun: ESM loader error

Demo

Deterministic OpenCode Drive reproduction with a simulated model.

Before

Expanded command template shown in the transcript

After

Slash command invocation rendered as a command attachment

Flow

sequenceDiagram
    participant UI as TUI / App
    participant Session as Session.command
    participant Store as Inbox / Message projection
    participant Model as Model runner

    UI->>Session: /mycmd hello
    Session->>Session: evaluate command template
    Session->>Store: text = expanded template<br/>command = { name, arguments }
    Store-->>UI: render command attachment
    Store-->>Model: send text
Loading

@kitlangton kitlangton changed the title fix(tui): show command invocation instead of template fix(tui): render commands as attachments Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant