Skip to content

feat(workspaces): auto-detect installed agent runtimes + frontend install guidance#366

Merged
luokerenx4 merged 3 commits into
masterfrom
claude/agent-runtime-detection-9wu97y
Jun 22, 2026
Merged

feat(workspaces): auto-detect installed agent runtimes + frontend install guidance#366
luokerenx4 merged 3 commits into
masterfrom
claude/agent-runtime-detection-9wu97y

Conversation

@luokerenx4

Copy link
Copy Markdown
Contributor

Summary

  • Detect which agent runtime CLIs (claude/codex/opencode/pi) are actually installed on the host. Before this, the launcher registered all adapters unconditionally, so /api/workspaces/agents listed every runtime as ready even on a fresh box — the only signal a missing CLI gave was a silent ENOENT at spawn time. Bad first-run / bad conversion: the user had no idea what to install.
  • Backend: new agent-detect.ts does a cross-platform PATH probe (POSIX walk + win32 PATH×PATHEXT, so opencode/pi npm .cmd shims resolve). Pure fs lookup, no spawn — cheap enough to re-run per list call, so a CLI installed mid-session shows up on the next poll. CliAdapter.binary declares each adapter's canonical bin (shell omits it → always installed). /agents now returns installed + binPath per agent (additive, backward-compatible).
  • Frontend: quick-chat landing defaults to the first installed runtime, marks missing ones in the picker, and shows install guidance (command + docs link); a prominent nudge when nothing is installed. Template cards dim runtimes not on PATH. Install commands + docs URLs live in agentInstall.ts; i18n across en/zh/zh-Hant/ja. Demo handler reports all installed (no host to probe).
  • Detection is a hint, not a gate — send still attempts (PATH probing can be wrong), it just tells the user what to install. No auto-installer (running a global npm i on the user's machine is a product decision left out by design).

Test plan

  • npx tsc --noEmit clean (Alice src/)
  • cd ui && npx tsc -b clean (UI strict)
  • pnpm test passes (2012 tests, incl. 8 new in agent-detect.spec.ts)
  • Manual: local merge → walk the quick-chat landing + template catalog with a runtime uninstalled to see the guidance

Boundary touch

None — no trading / auth / broker-credential / migration paths touched.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits June 19, 2026 18:36
…tall guidance

The launcher registers all adapters unconditionally (claude/codex/opencode/
pi/shell), so `/api/workspaces/agents` listed every runtime as if it were
ready — even on a fresh box with zero CLIs installed. The only signal a
missing runtime gave was a silent ENOENT at spawn time. Bad first-run / bad
conversion: the user has no idea what to install.

Backend:
- New `agent-detect.ts`: cross-platform PATH probe (POSIX walk + win32
  PATH×PATHEXT, so npm `.cmd` shims for opencode/pi resolve). Pure fs lookup,
  no spawn — cheap enough to re-run per list call, so a CLI installed
  mid-session shows up on the next poll.
- `CliAdapter.binary` declares each adapter's canonical PATH binary; shell
  omits it (runs `$SHELL`, always present → reported installed).
- `WorkspaceService.detectAgents()` + `/agents` now returns `installed` +
  `binPath` per agent (additive, backward-compatible).

Frontend:
- `AgentInfo` gains `installed?`/`binPath?`.
- Quick-chat landing defaults to the first INSTALLED runtime, marks missing
  ones in the picker, and shows install guidance (command + docs link). When
  nothing is installed, a prominent "install a coding-agent CLI" nudge.
- Template cards dim runtimes not on PATH.
- `agentInstall.ts` holds best-effort install commands + authoritative docs
  URLs. i18n keys across en/zh/zh-Hant/ja.
- Demo handler reports all agents installed (no host to probe).

Detection is a hint, not a gate — send still attempts (PATH probing can be
wrong), it just tells the user what to install.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BaBzYZBSrGRMauMkhyDXMh
…ng-agent)

The pi runtime ships its `pi` bin from @earendil-works/pi-coding-agent;
fill in the install hint that was left as docs-link-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BaBzYZBSrGRMauMkhyDXMh
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jun 22, 2026 12:46pm

Request Review

… load

ChatLandingPage derived `anyInstalled` from the agents list, which is `[]`
until the async `/agents` fetch lands — so `[].some(isInstalled)` was false
and the amber "nothing installed, go install something" guidance flashed on
every page load before the real (installed) result arrived.

Gate the nudge on `agentsKnown` (cliAgents.length > 0): the backend registers
claude/codex/opencode/pi/shell unconditionally, so a loaded list always has
≥1 CLI agent; an empty list means "still loading" (or fetch failed) — neither
should assert the host is missing its runtimes. Mirrors the `hasLoaded` guard
the workspaces list already uses against the same empty-initial-state trap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@luokerenx4 luokerenx4 merged commit 5d5a87f into master Jun 22, 2026
4 of 5 checks passed
@luokerenx4 luokerenx4 mentioned this pull request Jun 22, 2026
3 tasks
yodaliu pushed a commit to yodaliu/OpenAlice that referenced this pull request Jun 22, 2026
Since beta.3:
- feat(workspaces): auto-detect installed agent runtimes + install guidance (TraderAlice#366)
- feat(workspaces): quick-chat AI-config injection for loginless runtimes opencode/pi (TraderAlice#367)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants