Add 'displayInput' to bash tool schema
This keeps tool metadata callbacks in sync with the in-memory toolcall state so display inputs can be passed through to completion. processor.ts now prefers a metadata-updated input when finishing a tool call, allowing modified displays of commands without changing the actual execution.
-
packages/opencode/src/session/prompt.ts: metadata callback updates the live toolcall entry (input/metadata/title/time/displayInput) before persisting, keeping the processor’s map aligned. -
packages/opencode/src/session/processor.ts: completion/error handling usesmatch.state.displayInput(from metadata), so the UI shows the plugin-provided display args.
Use case: nix develop bash wrapper plugin
A plugin can wrap the bash tool and modify the final displayed command via displayInput. This is shown to the user through the UI and also modifies the agent history:
"tool.execute.before": async ({ tool }, state) => {
if (tool.toLowerCase() !== "bash") return
const command = state.args?.command
if (!command) return
// Show the unwrapped command in the UI
state.args.displayInput = { ...state.args }
// Run the wrapped command for execution
state.args.command = `nix develop --quiet -c bash -c "${command.replace(/"/g, '\\"')}"`
}
Before:
$ nix develop --quiet -c bash -c "echo \"hello\""
After:
$ echo "hello"
This has many use cases other than just nix, e.g. sandbox-esque wrappers where the full wrapped command is not relevant enough to be constantly showing to the user or agent, and would otherwise clutter history.
/review
/review
idk if that was worth it edit: yeah that broke it
should be good to go tmr if i forget just @ me or dm