@mitsein-ai/cli
v0.3.0
Published
Mitsein CLI — dev tooling, API helpers, and workflow automation
Readme
@mitsein-ai/cli
Mitsein CLI — internal dev tool for agent verification and workflow automation.
TypeScript rewrite of backend/apps/mitsein-cli/ (Python), ported to the Bun monorepo.
Install
# From npm (once published)
bunx @mitsein-ai/cli --help
# From monorepo
cd bun-workspace/apps/mitsein-cli
bun install
bun run src/index.ts --helpQuick Start
# Login
mitsein auth login
mitsein auth whoami
# Check backend health
mitsein dev health
# Create a thread, send a message, stream the agent run
TID=$(mitsein --json thread create | jq -r .thread_id)
mitsein agent invoke "$TID" "Hello" --stream
# List threads
mitsein thread list
# Auto-generated API commands from OpenAPI
mitsein api list-tags
mitsein api list-ops threadsCommands
| Command | Description |
|---------|-------------|
| mitsein version | Print CLI version |
| mitsein dev health | Check backend health (GET /health) |
| mitsein dev token | Print resolved dev token |
| mitsein dev openapi | Load and cache OpenAPI spec |
| mitsein api list-tags | List available API tags |
| mitsein api list-ops <tag> | List operations for a tag |
| mitsein api <tag> <operation> | Execute an API operation |
| mitsein thread list | List threads |
| mitsein thread get <id> | Get thread details |
| mitsein thread create [--name] [--agent] | Create a new thread |
| mitsein thread rename <id> <name> | Rename a thread |
| mitsein thread delete <id> | Delete a thread |
| mitsein thread history <id> | Show message history |
| mitsein agent invoke <id> <prompt> | Send message + run agent (SSE) |
| mitsein agent running list | List all active runs for the account |
| mitsein agent running status <tid> | Read active-run state for a thread |
| mitsein agent running tail <tid> | Reconnect to an in-progress run (tail -f) |
| mitsein agent running wait <tid> | Block until the thread's run completes |
| mitsein agent running cancel <tid> | Cancel a thread's running agent |
| mitsein files list/read/write/upload/mkdir/delete/download <tid> | Sandbox file ops |
| mitsein project list | List projects |
| mitsein project get <id> | Get project details |
| mitsein project delete <id> | Delete a project |
| mitsein auth login | Browser or device-code login |
| mitsein auth logout | Remove saved credentials |
| mitsein auth whoami | Show current identity |
Global Flags
| Flag | Description |
|------|-------------|
| --endpoint <url> | API base URL (default: http://localhost:8000) |
| --token <token> | Bearer token |
| --profile <name> | Profile name (default: default) |
| --real | Use real account for dev token |
| --json | Machine-readable JSON output |
| --debug | Log HTTP details to stderr |
| --timeout <sec> | HTTP timeout (0 = no timeout, default: 30) |
Architecture
Credential Provider Chain
Same 4-step chain as the Python CLI:
- ExplicitFlagProvider —
--token/--endpoint - EnvProvider —
MITSEIN_TOKEN/MITSEIN_API_URL - OAuthProvider —
~/.mitsein/oauth/<profile>.json - DevTokenProvider —
scripts/dev-token.sh(localhost only)
agent invoke Modes
agent invoke always hits POST /api/next/chat which streams SSE. The three flags control how the client surfaces those events:
# Default: wait silently, emit a structured result on exit
mitsein agent invoke <tid> "msg"
# Live streaming to stdout (human-readable or NDJSON with --json)
mitsein agent invoke <tid> "msg" --stream
# Event-type filter
mitsein agent invoke <tid> "msg" --stream --filter tool_call,tool_result
# Cancel the run on Ctrl-C (default is detach-only)
mitsein agent invoke <tid> "msg" --stream --cancel-on-interruptExit code: 0 on done.reason == completed, 1 on error, 124 on timeout, 130 on Ctrl-C.
Reconnect / Attach to a Running Agent
Any client can attach to a thread's running agent and keep streaming from the last delivered event:
# Read status (includes last_event_id)
mitsein agent running status <tid>
# Resume from a specific event id
mitsein agent running tail <tid> --since 1775915617543-0
# Or block-wait until the run ends
mitsein agent running wait <tid>OpenAPI Auto-Commands
The api command dynamically generates subcommands from the backend's OpenAPI spec:
mitsein api list-tags
mitsein api list-ops threads
mitsein api threads list-threads --body '{"limit": 10}'
echo '{}' | mitsein api threads list-threads --body-stdinDevelopment
bun run typecheck # TypeScript check
bun test # Run tests
bun run build # Build single binaryCHANGELOG
0.3.0 (2026-04-11) — /api/next migration
Breaking changes — CLI migrated from the deprecated /api/thread/* + /api/message/* + /api/agent-run/* routes to the unified POST /api/next/chat SSE endpoint.
- Removed:
mitsein thread send(was a duplicate ofagent invoke) - Removed:
mitsein messagescommand group entirely (backend no longer has a "add message without run" action;messages listduplicatedthread history) - Added:
mitsein thread rename(PATCH /api/next/threads/{id}),mitsein thread delete - Changed:
mitsein agent running {list,status,tail,wait,cancel}now take<thread_id>instead of<run_id>— the backend no longer exposes per-run endpoints; a thread has at most one active run at a time - Changed:
mitsein agent running listis now account-level (lists all active runs, not per-thread) - Added:
--since <event_id>onrunning tailandrunning waitfor precise reconnect - Internal: removed
core/sse.ts+core/waiters.ts; replaced bycore/chat-stream.ts(SSE reader with event-id support) +core/chat-run.ts(stream consumer with filter/accumulator) +core/chat-output.ts(human/NDJSON formatter)
0.2.3 (2026-04-11)
- Fix: unify profile default from
e2e→default(auth loginwrotedefault.jsonbut other commands reade2e.json, causing "No credentials found" immediately after login) - Fix:
thread list/get/history+messages list+project listmigrated to working routes - Fix:
printDictHumanno longer renders nested objects as[object Object] - Fix:
--debugnow logs method and URL correctly
0.2.0 — 0.2.2
- P5 files command group
- Auth: browser login, device code, whoami
- Initial Python → TS port (0.1.0)
RFC: II95V6
