Copy Full Agent Command
Issue 13 adds a portability affordance for configured agents: the agent advanced settings panel can copy a provider command that resumes the same provider session in an external terminal.
Scope
The button is available only while configuring an existing agent. Spawn-time advanced settings do not have a durable Wardian session id, workspace, or provider resume id yet, so they do not show the control.
The copied command is generated by the Rust backend from the saved agent config after the UI sends only the agent session id. Unsaved edits in the configuration form are not included until the user saves them. The command includes:
- the provider executable and resume arguments
- the agent workspace or provider habitat working directory
- Wardian identity environment such as
WARDIAN_SESSION_ID - provider-specific environment needed to preserve Wardian projections, such as
CODEX_HOMEfor Codex
External Terminal Contract
The copied text is a pasteable command for the user's configured shell. It changes to the same working directory context Wardian would use, sets required environment variables, and launches the provider command.
Provider arguments that exist only to support Wardian's embedded terminal stream are not copied into the external-terminal command. For example, Claude's embedded stream-json flags are stripped, and Codex's embedded no-alt-screen and plugin/app disable flags are omitted.
If the backend cannot identify a provider resume session, or if provider custom arguments are malformed, it returns an error and the UI leaves the clipboard unchanged.
Verification
Frontend tests cover button placement, copy success, spawn-form gating, and copy failure handling. Rust tests cover command generation for configured agents, loading saved agent config by session id, Codex environment/cwd behavior, malformed custom argument rejection, and Claude embedded flag stripping.