janua
v0.6.3Persistent interactive terminals for agents: spawn once, then write and read across calls.
Persistent interactive terminals for agents: spawn once, then write and read across calls. Add the MCP server with the official OpenCode command, then restart your client: Add --global to write the server into your global config instead of the project config. For a remote server, use --url instead of a command.
Summary extracted from the README.
Install
Add the MCP server with the official OpenCode command, then restart your client:
opencode mcp add janua -- npx -y @nathwn12/janua
Add --global to write the server into your global config instead of the project config. For a remote server, use --url <url> instead of a command.
Or add the server block to your config yourself:
{
"mcp": {
"servers": {
"janua": {
"type": "local",
"command": ["npx", "-y", "@nathwn12/janua"]
}
}
}
}
Config file: %USERPROFILE%\.config\opencode\opencode.jsonc on Windows or ~/.config/opencode/opencode.jsonc on macOS/Linux.
Inside config values OpenCode also substitutes {env:USERPROFILE} (Windows) and {env:HOME} (macOS/Linux) — config-string syntax, not shell syntax.
For the janua run CLI without an MCP client, install the package with npm i @nathwn12/janua.
First use
Start a session, write to it, and read the answer in later calls:
{"command":"node","args":["--interactive"],"name":"scratch-repl","title":"scratch-repl"}
// -> {"sessionId":"c91d...","pid":3312,"reused":false}
{"sessionId":"scratch-repl","data":"const answer = 42"} // pty_write
{"sessionId":"scratch-repl","cursor":0,"waitMs":1000} // pty_read
{"sessionId":"scratch-repl"} // pty_kill
The six tools are pty_spawn, pty_write, pty_read, pty_resize, pty_kill and pty_list. Pass a session id or a chosen name to any of them. A spawn that reuses a live name returns that session with reused: true instead of starting a second copy.
For a one-shot command, use the CLI:
janua run -- node -v
janua run --json --match "FAIL|failing" -- npm test
janua run --timeout 30000 -- node slow.js
janua run --tty -- node --interactive
run writes stdout with no added newline and exits with the child's code. A match or timeout kills the process tree. --tty uses a real PTY; pipes are the default.
Configure it
No config file. The MCP client block above is the whole setup. These environment variables change the defaults:
| Variable | Default | Effect |
|---|---|---|
JANUA_HOME |
per-user data dir | Where installed versions and current.json live. |
JANUA_MAX_SESSIONS |
32 | Concurrent session cap. |
JANUA_MAX_BUFFER_BYTES |
1 MiB | Retained output per session. |
janua upgrade installs a new version beside the running one, verifies it, then moves the pointer. Pass a version to pin one.
Requirements
- Node
^22.23.4 || ^24.22.1 || >=26.12.1. - Windows, Linux or macOS. Windows uses ConPTY; a bare command name is resolved through
PATHxPATHEXT. - An MCP client that speaks stdio, or a shell for the CLI.
Status
Unverified — as-is, use at your own risk.