feat: @goose in terminal (native terminal support)#5887
Conversation
Term command is a new way to use goose without the builtin REPL - instead the session is tied right into your terminal
- Fix bash/zsh: properly quote goose binary path to handle spaces - Extract session creation logic to ensure_terminal_session helper - Reduces code duplication between handle_term_log and handle_term_run
| chrono::Utc::now().timestamp_millis(), | ||
| vec![MessageContent::text(command)], | ||
| ) | ||
| .with_metadata(MessageMetadata::user_only()); |
There was a problem hiding this comment.
we could leave this out since we truncate again
There was a problem hiding this comment.
do messages have an LLM only state? because these would be weird/spammy if you saw them in a GUI i think
There was a problem hiding this comment.
if they are like what I saw, isn't end of the world.
|
There was a problem hiding this comment.
Pull request overview
This PR adds terminal integration features to Goose, enabling users to interact with Goose directly from their shell prompt without switching to a separate REPL session. The integration tracks shell command history and provides it as context when users ask questions.
Key changes:
- New
SessionType::Terminalenum variant for terminal-specific sessions - New
goose termCLI commands for shell initialization, command logging, and running prompts - Comprehensive documentation explaining setup and usage across multiple shells (bash, zsh, fish, PowerShell)
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
documentation/docs/guides/terminal-integration.md |
Complete user guide for terminal integration feature including setup, usage examples, and technical details |
crates/goose/src/session/session_manager.rs |
Adds SessionType::Terminal variant for terminal-integrated sessions |
crates/goose-cli/src/commands/term.rs |
Core implementation: shell initialization script generation, command logging, and prompt execution with shell history context |
crates/goose-cli/src/commands/mod.rs |
Exports new term command module |
crates/goose-cli/src/cli.rs |
CLI interface for goose term commands with subcommands for init, log, run, and info |
Cargo.lock |
Dependency version update (windows-sys indirect dependency) |
| COUNT(m.id) as message_count | ||
| FROM sessions s | ||
| INNER JOIN messages m ON s.id = m.session_id |
There was a problem hiding this comment.
The INNER JOIN with messages excludes sessions with no messages. This breaks named session lookup - a newly created terminal session won't be found on the next term init call until it has messages. Use LEFT JOIN instead and COALESCE(COUNT(m.id), 0) for the message count.
| COUNT(m.id) as message_count | |
| FROM sessions s | |
| INNER JOIN messages m ON s.id = m.session_id | |
| COALESCE(COUNT(m.id), 0) as message_count | |
| FROM sessions s | |
| LEFT JOIN messages m ON s.id = m.session_id |
There was a problem hiding this comment.
@DOsinga this sounds so convincing but I am not so sure (also if it is true, I don't think this is a bad thing... I was wondering how do we get a fresh session)?
baxen
left a comment
There was a problem hiding this comment.
LGTM!
Feel free to retarget to my outstanding branch/PR and i will address the nits, or if you have time can merge directly
|
|
||
| static BASH_CONFIG: ShellConfig = ShellConfig { | ||
| script_template: r#"export GOOSE_SESSION_ID="{session_id}" | ||
| alias gt='{goose_bin} term run' |
There was a problem hiding this comment.
nit: i'd remove this now, but i like having both @goose and @g
| chrono::Utc::now().timestamp_millis(), | ||
| vec![MessageContent::text(command)], | ||
| ) | ||
| .with_metadata(MessageMetadata::user_only()); |
There was a problem hiding this comment.
do messages have an LLM only state? because these would be weird/spammy if you saw them in a GUI i think
| --- | ||
| unlisted: true | ||
| --- | ||
| # Terminal Integration |
There was a problem hiding this comment.
a todo for future, would be nice to show how to set this up with
https://starship.rs/
and
https://github.com/ianthehenry/zsh-autoquoter
|
ok, needs blessing from @blackgirlbytes (as this is a new PR with doc change) and I think we can get this in |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* origin/main: Feat/automatic update installation (#5345) fix: Added "Merged consecutive assistant messages" to the acceptable issues for moim injection check (#5933) fix: anthropic provider model fetching (#5932) [MCP-UI] add CSP for images to proxy HTML (#5931) fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902) feat: @goose in terminal (native terminal support) (#5887) docs: adding AI-friendly features (#5918) Blog/advent of ai announcement (#5917) Extension selector behind ALPHA flag (#5892)
…nses-streaming * 'main' of github.com:block/goose: Feat/automatic update installation (#5345) fix: Added "Merged consecutive assistant messages" to the acceptable issues for moim injection check (#5933) fix: anthropic provider model fetching (#5932) [MCP-UI] add CSP for images to proxy HTML (#5931) fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902) feat: @goose in terminal (native terminal support) (#5887) docs: adding AI-friendly features (#5918) Blog/advent of ai announcement (#5917) Extension selector behind ALPHA flag (#5892) blog: typo fixes (#5896) blog: fixing img url (#5895) blog: MCPs for Developers (#5884) docs: Extension Manager MCP (#5883) Update cleanup marker logic for Fedora users. (#5868) Improve AWS credential loading and configuration handling in BedrockProvider (#5699)
…0-5147 * 'main' of github.com:block/goose: (243 commits) chore: upgrade npm packages (#5951) feat: ActionRequired (#5897) feat(acp): support loading sessions in acp (#5942) docs: add videos to multi-model page (#5938) docs: promote planning guide (#5934) fix: use a lock to ensure only need to run tunnel just in case multiple go… (#5885) Feat: Added custom headers and toggle keyring CLI options (#5017) Feat/automatic update installation (#5345) fix: Added "Merged consecutive assistant messages" to the acceptable issues for moim injection check (#5933) fix: anthropic provider model fetching (#5932) [MCP-UI] add CSP for images to proxy HTML (#5931) fix: correct typo in blog post (AIMDOEL -> AIMODEL) (#5902) feat: @goose in terminal (native terminal support) (#5887) docs: adding AI-friendly features (#5918) Blog/advent of ai announcement (#5917) Extension selector behind ALPHA flag (#5892) blog: typo fixes (#5896) blog: fixing img url (#5895) blog: MCPs for Developers (#5884) docs: Extension Manager MCP (#5883) ... # Conflicts: # crates/goose-server/src/routes/config_management.rs # crates/goose/src/providers/mod.rs # ui/desktop/openapi.json # ui/desktop/src/api/sdk.gen.ts # ui/desktop/src/api/types.gen.ts # ui/desktop/src/components/ProgressiveMessageList.tsx
Summary
Douwe's take on this saga :)