Skip to content

feat: add MiMo Code (mimo CLI) support as a third local agent - #239

Open
luokexiaoguo wants to merge 6 commits into
zarazhangrui:mainfrom
luokexiaoguo:feat/mimo-support
Open

feat: add MiMo Code (mimo CLI) support as a third local agent#239
luokexiaoguo wants to merge 6 commits into
zarazhangrui:mainfrom
luokexiaoguo:feat/mimo-support

Conversation

@luokexiaoguo

Copy link
Copy Markdown

Adds MiMo Code as a supported local agent alongside Claude Code and Codex, bridged through the standard AgentAdapter interface.

What's included

  • New MimoAdapter (src/agent/mimo/): spawns mimo run --format json with the bridge system prompt on stdin; a JSONL translator maps mimo events (text / reasoning / tool_use / step_finish) to bridge AgentEvents.
  • Sessions: resumed via mimo's --session flag; the session catalog stores the mimo sessionId (same shape as claude), and /resume gains a mimo branch.
  • Permissions: full access maps to --dangerously-skip-permissions; stricter modes leave the flag off (mimo v0.1.x exposes no other permission switch).
  • Background checkpoint-writer handling: mimo keeps the process alive after the answer is done while its memory writer runs. A configurable idle timeout (25s default) after the last streaming event finishes the run, so the bridge card doesn't sit on "streaming" for a minute.
  • Full surface integration: --agent mimo on run/migrate/profile/start, agent detection, profile bootstrap (mimo.binaryPath), registry/lock metadata, web onboarding, service display name, model picker, README (EN/ZH).

Testing

  • Unit tests: argv builder, JSONL translator.
  • Process tests: fake-binary adapter contract (fresh run, resume, permission mapping, stderr on failure, interrupted stop, idle timeout).
  • Real-binary e2e: isolated MIMOCODE_HOME run verifying the full event stream + session continuity; gated on a local mimo provider config + auth and NEWAPI_API_KEY so CI always skips it.
  • Verified locally: 646 tests pass, tsc --noEmit clean.

Notes for reviewers

  • mimo's headless protocol has no terminal stream event — completion is signalled by process exit. The translator flushes final_text + done on exit (or on idle timeout).
  • MiMo Code is a separate CLI (mimo) with its own provider/auth model; it is only detected/used when a mimo profile is created with --agent mimo.

Add a third AgentAdapter implementation alongside claude and codex that
spawns the local `mimo` CLI in headless mode (`mimo run --format json`)
with the bridge system prompt on stdin.

MiMo's protocol differs from claude/codex in one way: there is no terminal
stream event — completion is signalled by the process exiting. The JSONL
translator streams text/tool events live and flushes final_text + done when
the child exits. It also handles mimo's background checkpoint-writer, which
keeps the process alive after the answer is done: a configurable idle timeout
(25s default) after the last streaming event finishes the run instead of
letting the card sit on "streaming" for a minute.
Extend the agent kind surface so a profile can be created with
agentKind=mimo and runs wire through the new adapter:

- profile schema: AgentKind includes 'mimo' with a MimoConfig
  (binaryPath, optional --thinking) and validation
- runtime: createRuntimeAgent builds a MimoAdapter; preflight and
  capability registries recognize 'mimo'
- sessions: mimo uses sessionId in the catalog (like claude) and the
  /resume command gains a mimo branch; run-flow resumes from the
  catalog entry and forwards image attachments via --file
- models: mimo picker options (mimo-auto / provider models)
- --agent accepts mimo on run/migrate/profile create/start; first-run
  agent detection probes the mimo binary (LARK_CHANNEL_MIMO_BIN)
- profile bootstrap resolves and persists mimo.binaryPath
- registry and lock metadata accept the mimo agent kind so its
  processes and per-profile locks are tracked correctly
- web onboarding and QR registration forward agentKind=mimo
- service status shows the MiMo Code display name
- argv builder unit tests
- JSONL translator unit tests (text/reasoning/tool_use/step_finish,
  session capture, terminal semantics, non-JSON banner lines)
- process-level adapter tests with a fake mimo binary (fresh run,
  resume, permissions mapping, stderr on failure, idle timeout,
  interrupted stop)
- real-binary e2e against an isolated MIMOCODE_HOME; gated on a local
  mimo provider config + auth and NEWAPI_API_KEY so CI always skips it
Mention MiMo Code as a supported local agent, add the mimo profile
examples, the --agent flag values, and the permission-mode mapping
(mimo only exposes --dangerously-skip-permissions in v0.1.x, and the
profile's model must be configured since the free tier is retired).
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