Skip to content

feat: add Jcode as a supported TUI agent - #10521

Closed
czzczz wants to merge 13 commits into
stablyai:mainfrom
czzczz:feat/add-jcode-agent
Closed

czzczz wants to merge 13 commits into
stablyai:mainfrom
czzczz:feat/add-jcode-agent

Conversation

@czzczz

@czzczz czzczz commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Jcode is a fast, RAM-efficient AI coding TUI written in Rust. This PR makes it a first-class agent in Orca: launch it from the agent picker, see its live working/waiting/done state in the sidebar, resume sleeping sessions, browse session history in AI Vault, get correct tab-bar identity, and use it for branch naming and AI commit messages.

What Changed

Agent catalog

  • Jcode added to the TuiAgent union with detect/launch config, display name, auto-pick order, icons (desktop + mobile), telemetry kind, and locale entries.

Agent status pipeline (on par with Devin/Kimi)

  • /hook/jcode listener: jcode lifecycle events (session_start / post_tool / turn_end / session_end) normalized into sidebar status rows; user-input tools map to waiting; last user prompt recovered from the session journal with a bounded scan.
  • Managed hook service: installs [hooks] entries in ~/.jcode/config.toml (byte-preserving; keeps jcode's own pre_tool_timeout_ms and user-owned hooks), with local + SSH install and IPC/preload wiring.
  • Session resume via jcode --resume <id> for sleeping/quit sessions.
  • AI Vault: parses ~/.jcode/sessions/session_*.json, local + SSH discovery, native resume commands.
  • Terminal-title recognition and well-known agent type registration.

Per-pane daemon isolation

  • jcode runs one shared server/client daemon per runtime dir; every local pane now gets a JCODE_RUNTIME_DIR (16-hex hash of the pane key, SUN_LEN safe) so each pane keeps its own daemon and hook events are attributed to the right pane. Injected at the provider-spawn chokepoint for both pty:spawn (Cmd+T) and createTerminal paths; SSH excluded.

Source Control AI

  • Jcode added to the non-interactive agent registry (jcode run --json), enabling branch naming, AI commit messages, and resolveConflicts agent selection; output cleanup extracts the JSON result envelope and strips the [Tokens] usage line.

Compatibility

  • Coexists with the rest of the agent catalog (including prime-agent) and with jcode's own configuration; merged against current upstream.

Why

Jcode was launch-only before. This PR gives Orca full visibility and control over jcode sessions — status, resume, history, and Source Control AI — using the same integration patterns as other supported agents.

Linked Issue

Fixes #10830

Visual Proof

N/A — no new UI surfaces; the changes reuse existing components (sidebar status, agent picker, AI Vault, Source Control AI dropdown). Verified live in the orca-dev instance.

Testing

  • Local (macOS): sidebar live status, multi-pane isolation, fresh-worktree initialization, jcode run --json generation.

  • Automated: ~70 new tests (listener normalization, TOML editing, hook service, resume argv, AI Vault parser/discovery, runtime-dir injection, pty:spawn env, commit-message spec/plan/output cleanup, color-query exclusion). Jcode suites: 331+ tests; ai-vault suite: 777 tests.

  • pnpm typecheck, pnpm lint, pnpm test (relevant suites), git diff --check pass.

  • I manually tested these changes locally

  • Automated tests added/updated

AI Disclosure

This PR was implemented with the help of an AI coding agent (opencode / deepseek-v4-flash), including code generation, tests, and conflict resolution. All behavior was manually verified.

Review

  • Cross-platform: runtime-dir injection is non-Windows only; Windows hook scripts reuse the existing .cmd template; paths use path.join.
  • SSH/remote: SSH terminals never receive the host-local socket path; SSH hook installs are POSIX scripts using wslGatedReadFile; AI Vault SSH discovery covered.
  • Agent/integration: jcode normalization is namespaced; coexists with other agents and with jcode's own config.
  • Performance: bounded journal scans, existing AI Vault parse-cache model, fail-open hooks.
  • Security: loopback + token-validated hook POSTs; session-id path-traversal validation; output cleanup.
  • Backwards compatibility: incremental registrations only.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Author

  • X / Twitter: -

Add Jcode (https://github.com/1jehuang/jcode) to Orca's supported agent catalog:

- TuiAgent union: add 'jcode' member to src/shared/types.ts
- Agent config: detectCmd/launchCmd/expectedProcess/promptInjectionMode
  in src/shared/tui-agent-config.ts (launches with stdin-after-start)
- Display name: 'Jcode' in src/shared/tui-agent-display-names.ts
- Auto-pick order: add to TUI_AGENT_AUTO_PICK_ORDER in tui-agent-selection.ts
- Telemetry: add 'jcode' to agentKindSchema and agent-kind mappings
- Catalog entries: desktop (agent-catalog.tsx) and mobile (mobile-tui-agents.ts)
- Icon: bundled 48x48 PNG from jcode.sh in agent-icons/,
  referenced in desktop agent-favicon-assets.ts and mobile icon assets
- Icon enforcement: add to ICONABLE_AGENT_TYPES in agent-status.ts
- Locale: add to never-translate set in locale-translation-policy.mjs
@czzczz
czzczz force-pushed the feat/add-jcode-agent branch from 73497cc to 11f1c89 Compare July 25, 2026 08:37
@czzczz
czzczz marked this pull request as draft July 25, 2026 08:37
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link