Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 75 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crates/goose-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ regex = "1.11.1"
minijinja = "2.8.0"
nix = { version = "0.30.1", features = ["process", "signal"] }
tar = "0.4"
# Web server dependencies
axum = { version = "0.8.1", features = ["ws", "macros"] }
tower-http = { version = "0.5", features = ["cors", "fs"] }
tokio-stream = "0.1"
bytes = "1.5"
http = "1.0"
webbrowser = "1.0"

indicatif = "0.17.11"

[target.'cfg(target_os = "windows")'.dependencies]
Expand Down
78 changes: 78 additions & 0 deletions crates/goose-cli/WEB_INTERFACE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Goose Web Interface

The `goose web` command provides a (preview) web-based chat interface for interacting with Goose.
Do not expose this publicly - this is in a preview state as an option.

## Usage

```bash
# Start the web server on default port (3000)
goose web

# Start on a specific port
goose web --port 8080

# Start and automatically open in browser
goose web --open

# Bind to a specific host
goose web --host 0.0.0.0 --port 8080
```

## Features

- **Real-time chat interface**: Communicate with Goose through a clean web UI
- **WebSocket support**: Real-time message streaming
- **Session management**: Each browser tab maintains its own session
- **Responsive design**: Works on desktop and mobile devices

## Architecture

The web interface is built with:
- **Backend**: Rust with Axum web framework
- **Frontend**: Vanilla JavaScript with WebSocket communication
- **Styling**: CSS with dark/light mode support

## Development Notes

### Current Implementation

The web interface provides:
1. A simple chat UI similar to the desktop Electron app
2. WebSocket-based real-time communication
3. Basic session management (messages are stored in memory)

### Future Enhancements

- [ ] Persistent session storage
- [ ] Tool call visualization
- [ ] File upload support
- [ ] Multiple session tabs
- [ ] Authentication/authorization
- [ ] Streaming responses with proper formatting
- [ ] Code syntax highlighting
- [ ] Export chat history

### Integration with Goose Agent

The web server creates an instance of the Goose Agent and processes messages through the same pipeline as the CLI. However, some features like:
- Extension management
- Tool confirmations
- File system interactions

...may require additional UI components to be fully functional.

## Security Considerations

Currently, the web interface:
- Binds to localhost by default for security
- Does not include authentication (planned for future)
- Should not be exposed to the internet without proper security measures

## Troubleshooting

If you encounter issues:

1. **Port already in use**: Try a different port with `--port`
2. **Cannot connect**: Ensure no firewall is blocking the port
3. **Agent not configured**: Run `goose configure` first to set up a provider
29 changes: 29 additions & 0 deletions crates/goose-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,31 @@ enum Command {
#[command(subcommand)]
cmd: BenchCommand,
},

/// Start a web server with a chat interface
#[command(about = "Start a web server with a chat interface", hide = true)]
Web {
/// Port to run the web server on
#[arg(
short,
long,
default_value = "3000",
help = "Port to run the web server on"
)]
port: u16,

/// Host to bind the web server to
#[arg(
long,
default_value = "127.0.0.1",
help = "Host to bind the web server to"
)]
host: String,

/// Open browser automatically
#[arg(long, help = "Open browser automatically when server starts")]
open: bool,
},
}

#[derive(clap::ValueEnum, Clone, Debug)]
Expand Down Expand Up @@ -785,6 +810,10 @@ pub async fn cli() -> Result<()> {
}
return Ok(());
}
Some(Command::Web { port, host, open }) => {
crate::commands::web::handle_web(port, host, open).await?;
return Ok(());
}
None => {
return if !Config::global().exists() {
let _ = handle_configure().await;
Expand Down
1 change: 1 addition & 0 deletions crates/goose-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pub mod recipe;
pub mod schedule;
pub mod session;
pub mod update;
pub mod web;
Loading
Loading