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
7 changes: 5 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ Before calling any change done, `cargo fmt --all`, the `clippy` line above, and
- `goat-config` — config, `ThemeChoice`, `~/.goat-code` paths, log directory; no TUI deps; leaf.
- `goat-core` — `Session` and the `Engine` trait; depends on `goat-protocol` only.
- `goat-tui` — full-screen ratatui app (The Elm Architecture); depends on `goat-protocol`, `goat-commands`, and `goat-config`, not `goat-core` or any engine crate.
- `goat-code` — the `goat` binary; wires the channels, logging, and CLI; depends on all.
- `goat-code` — the `goat` binary; wires the CLI, logging, and `goat daemon` subcommands; runs as a thin client that connects to (or auto-spawns) the daemon.
- `goat-wire` — daemon/client wire contract; leaf (depends on `goat-protocol` only). The `ClientFrame`/`ServerFrame` envelope ({`SessionId`/`ClientId`/`seq` + payload `Op`/`Event`}), length-delimited JSON codec (`WireConn`), and protocol-version handshake. `Op`/`Event` bodies are wrapped, never modified.
- `goat-daemon` — the resident `goatd` (`goat daemon serve`); machine-wide single daemon holding N live sessions keyed by cwd. Owns the session registry, a single seq-stamping event-log pump per session (stamp→log→fan-out), per-window bounded delivery with disconnect-on-overflow, presence broadcast, idle eviction (kept alive while a turn runs or a window is attached or an Ask/Plan is open), orphaned-turn sweep on startup, and the unix-socket listener (`~/.goat-code/daemon.sock`, 0600). Allocates per-session `TaskId`s and echoes a correlation token.
- `goat-client` — thin transport the TUI talks to; auto-spawns the daemon if absent, performs the handshake, opens/reattaches a session, and exposes the same `Op`/`Event` channels the TUI already consumes. Owns the bidirectional `IdMap` (client-local ↔ daemon `TaskId`) and seq-gap resync.
- `goat-update` — executable replacement helper for `goat update`; small CLI-only crate with no app-state ownership.
- `goat-worktree` — git-worktree management (`enter`/`list`/`remove`); leaf crate (std + `ignore` + `serde`, shells out to `git`); `goat-code` keeps the clap `WorktreeCommand` and dispatches into it.
- `goat-worktree` — git-worktree management (`enter`/`list`/`remove`); `enter` resolves and returns the worktree path (the agent cwd is injected explicitly, not via process `set_current_dir` for the engine).

**Providers**
- `goat-provider` — the `Provider` trait; leaf. Key types: `Provider`, `Request` (incl. `ToolChoice`), `StreamEvent`, `StreamError`, `Message`, `Capabilities`, `Model`, `ProviderId`, `ContentBlock`. Providers classify their own wire errors into `StreamError` structurally (`error.rs` per provider); the engine never inspects error strings.
Expand Down
53 changes: 50 additions & 3 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ goat-command-app = { path = "crates/goat-command-app" }
goat-commands = { path = "crates/goat-commands" }
goat-update = { path = "crates/goat-update" }
goat-worktree = { path = "crates/goat-worktree" }
goat-wire = { path = "crates/goat-wire" }
goat-daemon = { path = "crates/goat-daemon" }
goat-client = { path = "crates/goat-client" }

tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "signal", "net", "io-util"] }
tokio-util = { version = "0.7", features = ["rt"] }
tokio-util = { version = "0.7", features = ["rt", "codec"] }
bytes = "1"
futures = "0.3"

ratatui = "0.30"
Expand Down
6 changes: 2 additions & 4 deletions crates/goat-agent/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ use crate::Ctx;
pub(crate) async fn restore_target(
store: &Store,
credentials: &CredentialStore,
cwd: &std::path::Path,
) -> Option<ModelTarget> {
let cwd = std::env::current_dir()
.ok()
.map(|path| path.display().to_string())
.unwrap_or_default();
let cwd = cwd.display().to_string();
let thread = store.latest_thread_in(cwd).await.ok().flatten()?;
let provider = Registry::load(credentials, &thread.account)
.get(&goat_provider::ProviderId::from(thread.provider.as_str()))?;
Expand Down
Loading
Loading