Skip to content

Add Goose agent mode#606

Draft
AnthonyRonning wants to merge 14 commits into
masterfrom
codex-goose-maple
Draft

Add Goose agent mode#606
AnthonyRonning wants to merge 14 commits into
masterfrom
codex-goose-maple

Conversation

@AnthonyRonning

Copy link
Copy Markdown
Contributor

Summary

  • add a desktop Agent Mode route and chat surface backed by ACP
  • add a Tauri-managed Goose runtime that starts bundled goose serve, configures Goose for Maple's local OpenAI-compatible proxy, and exposes project-root/config/session-log commands to the frontend
  • stage the Goose binary at build time via MAPLE_GOOSE_BINARY or the @aaif/goose-binary-* platform packages
  • add ACP client/runtime services, route/sidebar wiring, and required Tauri dialog capability/dependencies

Validation

  • nix develop -c bun run typecheck
  • nix develop -c cargo check
  • nix develop -c bun run build
  • VITE_OPEN_SECRET_API_URL=http://127.0.0.1:3000 VITE_MAPLE_BILLING_API_URL=http://127.0.0.1:36503 nix develop -c bun tauri build --bundles app --config '{"bundle":{"createUpdaterArtifacts":false}}'
  • launched packaged Maple.app and confirmed it spawned bundled goose serve
  • completed ACP smoke through the packaged app with Maple's local proxy: prompt requested Maple Goose smoke test response and Goose returned exactly that
  • parsed generated JSONL session log successfully and confirmed Goose config/log/session files are written with 0600 permissions

Draft because this is ready for hands-on product/runtime testing today.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 562d4a1d-20f5-4141-b06b-bd208fae3f6a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex-goose-maple

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: daeb20e
Status: ✅  Deploy successful!
Preview URL: https://1085a443.maple-ca8.pages.dev
Branch Preview URL: https://codex-goose-maple.maple-ca8.pages.dev

View logs

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Follow-up refactor pushed.

What changed:

  • Replaced the Goose sidecar/binary path with embedded Goose runtime startup from Tauri.
  • Maple now imports the main AAIF Goose runtime crate from ThirdParties/goose/crates/goose, with ThirdParties/goose pinned as a submodule at v1.41.0 (39c27c387d726ce4605108d2f974d4feec158ed5).
  • Tauri starts the real Goose ACP harness in-process via AcpServer + goose::acp::transport::create_router; the Maple frontend still speaks ACP over the local WebSocket.
  • Removed the npm Goose binary dependency, Tauri resource bundling, and build.rs binary staging.
  • Confirmed crates.io goose is an unrelated load-testing crate and the published AAIF goose-sdk does not expose the full agent/session/tool runtime, so the submodule/path dependency is the current embedded route.

Validation:

  • cd frontend/src-tauri && nix develop -c cargo check
  • cd frontend && nix develop -c bun run typecheck
  • cd frontend/src-tauri && nix develop -c cargo fmt --check

Notes for Goose team discussion:

  • A blessed Rust API for embedded ACP server startup would be ideal.
  • Config/data-dir initialization currently still leans on Goose globals/env; explicit init would be cleaner for embedders.
  • Goose v1.41.0 requires Rust 1.91.1 and needs an exact rmcp = "=1.4.0" pin downstream when built outside Goose's lockfile.

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Pushed a CI fix for the frozen Bun lockfile failure.

Cause: after removing @aaif/goose-sdk, the lockfile still contained stale transitive packages from that dependency (@modelcontextprotocol/*, @oven/bun-*, Express/Hono/etc.). Bun wanted to prune them, so frozenLockfile = true failed in CI.

Fix: regenerated frontend/bun.lock with Bun 1.3.5 using a temporary non-frozen config, then verified the normal frozen install path.

Validation:

  • cd frontend && nix develop -c bun install --frozen-lockfile
  • cd frontend && nix develop -c bun run typecheck
  • git diff --check

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Follow-up pushed in d75780e to keep Goose desktop-only across CI and frontend surfaces.

What changed:

  • Desktop workflows and desktop release/verifier jobs now checkout submodules so embedded Goose resolves in Cargo.
  • Android/iOS/web workflows do not checkout Goose.
  • Cargo path deps cannot be hidden from Cargo metadata by target cfg/optional deps/wrapper crates; Cargo still tries to load missing path manifests. To keep mobile CI submodule-free, Android/iOS CI now temporarily strips the marked desktop Goose dependency block before invoking Tauri mobile builds and restores Cargo.toml on exit.
  • Frontend Agent Mode is gated on isTauriDesktop(): no sidebar item on web/mobile, /agent redirects to /, and the agent runtime service refuses Tauri agent commands off desktop.

Validation:

  • bun install --frozen-lockfile
  • bun run format:check
  • bun run lint (existing warnings only)
  • bun run typecheck
  • cargo metadata --filter-platform x86_64-unknown-linux-gnu --locked
  • cargo check --manifest-path frontend/src-tauri/Cargo.toml --locked
  • no-submodule temp clone: Android and iOS cargo metadata succeed after the mobile helper strips the desktop Goose block.

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Follow-up pushed in 0a9d715 for the Agent Mode UX/logging issues Tony hit:

  • Agent Mode now ensures the Maple proxy is ready on entry and before start/restart/send.
  • If the saved proxy config has no API key, Agent Mode creates a unique maple-agent-YYYYMMDD-xxxxxxxx API key and saves it locally before starting the proxy.
  • Embedded Goose ACP now allows the Tauri production origins (tauri://localhost, http://tauri.localhost, https://tauri.localhost) plus the existing dev/local origins, which should address packaged-app WebSocket origin rejection.
  • Frontend ACP WebSocket lifecycle diagnostics are now written through Tauri into the Agent Mode runtime log with token-redacted URLs.
  • Rust runtime/proxy startup also logs more clearly.

Useful local logs on macOS while testing:

tail -n 200 ~/.config/maple/agent/logs/goose-embedded.log
ls -lt ~/Library/Logs/cloud.opensecret.maple
tail -n 200 ~/Library/Logs/cloud.opensecret.maple/*.log
cat ~/.config/maple/agent/config.json
cat ~/.config/maple/proxy_config.json # contains local API key; don't paste publicly

Validated locally:

cd frontend && nix develop -c bun run typecheck
cd frontend && nix develop -c bun run format:check
cd frontend && nix develop -c bun run lint # 13 existing warnings, 0 errors
nix develop -c cargo fmt --manifest-path frontend/src-tauri/Cargo.toml --check
nix develop -c cargo check --manifest-path frontend/src-tauri/Cargo.toml --locked
git diff --check

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Follow-up pushed in fa716ec for the Agent Mode stream/tool UX from Tony's latest test:

  • ACP assistant/thought chunks now use ACP messageId or Goose _meta.goose.messageId when present.
  • If no message id is present, consecutive chunks of the same role merge into the last message instead of creating one bubble per token.
  • Thought chunks render as a collapsed Thinking disclosure by default.
  • Active tool rows reset when a new prompt is sent, so failed tools from old turns do not keep collecting at the bottom.
  • Failed tool rows auto-expand and now show content, raw input, raw output, locations, and metadata when ACP provides them.
  • Failed tool summaries also get written to ~/.config/maple/agent/logs/goose-embedded.log.

For debugging the underlying Goose/tool issue locally, useful commands on macOS:

tail -n 200 ~/.config/maple/agent/logs/goose-embedded.log
ls -lt ~/.config/maple/agent/sessions
LATEST_SESSION="$(ls -t ~/.config/maple/agent/sessions/*.jsonl | head -1)"
echo "$LATEST_SESSION"
tail -n 200 "$LATEST_SESSION"

If jq is available, this is the fastest summary of the newest session's ACP tool updates:

LATEST_SESSION="$(ls -t ~/.config/maple/agent/sessions/*.jsonl | head -1)"
jq -r '
  select(.event.type == "sessionUpdate")
  | .event.update
  | select(.sessionUpdate == "tool_call" or .sessionUpdate == "tool_call_update")
  | {kind: .sessionUpdate, id: .toolCallId, title, status, rawInput, rawOutput, content, meta: ._meta}
' "$LATEST_SESSION"

Validated locally:

cd frontend && nix develop -c bun run typecheck
cd frontend && nix develop -c bun run format:check
cd frontend && nix develop -c bun run lint # 13 existing warnings, 0 errors
git diff --check

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Updated Agent Mode diagnostics and token cap handling.

Changes:

  • Embedded Goose now clears inherited GOOSE_MAX_TOKENS env/config before configuring the Maple OpenAI-compatible proxy, so the chat-completions request omits max_tokens/max_completion_tokens for auto:powerful unless Goose has a real model limit.
  • Agent Mode UI now renders messages and tool calls in one ordered timeline instead of collecting tool calls at the bottom.
  • Tool rows now show summary/details and explicitly say when ACP did not provide diagnostic fields.
  • Removed the custom Goose extension-notification shortcut that could treat non-standard Goose notifications as standard ACP session updates.
  • Patched the Goose submodule so tool-call parse errors become failed ACP tool calls with rawInput/rawOutput/content diagnostics instead of a title-only error row.

Validation:

  • nix develop -c bun run format:check
  • nix develop -c bun run lint (passes with existing 13 warnings)
  • nix develop -c bun run typecheck
  • nix develop ../.. -c cargo fmt --check from frontend/src-tauri
  • nix develop -c cargo fmt --check --manifest-path ThirdParties/goose/crates/goose/Cargo.toml
  • nix develop -c cargo check --manifest-path frontend/src-tauri/Cargo.toml --locked (passes with existing patched tao warnings)
  • nix develop -c cargo test --manifest-path ThirdParties/goose/crates/goose/Cargo.toml parse_error_tool_request_exposes_acp_diagnostics
  • git diff --check

Goose upstream note:
The Goose patch is pushed to AnthonyRonning/goose branch maple-acp-parse-error-diagnostics at a160f52dc2ccfd8cfc7eaf273867c82f6145a6e1. Direct push to aaif-goose/goose was denied, and gh PR creation against aaif-goose/goose failed with createPullRequest token permissions. To keep Maple CI fetchable, .gitmodules now points at the fork temporarily. Once Goose accepts/applies the patch upstream, switch the submodule URL back to aaif-goose/goose and advance the pointer to the upstream commit.

@AnthonyRonning

Copy link
Copy Markdown
Contributor Author

Added Agent Mode LLM request logging.

What changed:

  • Embedded Goose now calls its provider request logger setup, matching Goose CLI/server behavior.
  • Runtime status now includes llmLogDir and latestLlmLogPath.
  • goose-embedded.log now records both paths at runtime start.

Where to inspect after the next Agent Mode model call:

  • ~/.config/maple/agent/goose/state/logs/llm_request.0.jsonl
  • Rotated previous calls: ~/.config/maple/agent/goose/state/logs/llm_request.1.jsonl through llm_request.9.jsonl

These JSONL files include the outgoing OpenAI-compatible payload under input plus streamed provider message chunks, usage, and errors. They will not exist for already-completed runs before this commit.

Validation:

  • nix develop -c cargo check --manifest-path frontend/src-tauri/Cargo.toml --locked
  • nix develop -c bun run typecheck
  • nix develop -c bun run format:check
  • nix develop ../.. -c cargo fmt --check from frontend/src-tauri
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant