The stdio bridge exposes Hugind operations over newline-delimited JSON (NDJSON) and also supports MCP JSON-RPC 2.0.
hugind stdioEach input line must be one JSON object. Each output line is one JSON object.
{"id":"req-1","method":"model.list","params":{}}{"id":"req-1","ok":true,"result":{...},"schema_version":"1"}{"id":"req-1","ok":false,"error":{"code":"internal_error","message":"..."},"schema_version":"1"}{"event":"status","id":"req-1","data":{...},"schema_version":"1"}Event types currently emitted:
statusprogresslogagent_event(agentic loop events — see below)
agent.list(no params)agent.runparams:{ "path": string, "args"?: string[] }events:status(agent.run.start/agent.run.finish),log,agent_eventagent.installparams:{ "path": string, "approve_permissions": bool, "overwrite": bool }agent.removeparams:{ "name": string }
config.list(no params)config.validateparams:{ "path": string }config.info(no params)config.removeparams:{ "name": string, "confirm": bool }config.defaultsparams:{ "hf_token"?: string }config.initparams:{ "name": string, "model_path": string, "ctx"?: number, "mmproj_path"?: string, "overwrite"?: bool, "n_slots"?: number, "enable_fit"?: bool, "fit_target_mib"?: number[] }
model.list(no params)model.showparams:{ "repo": string }model.addparams:{ "repo": string, "files": string[] }events:status,progressmodel.removeparams:{ "repo": string, "files"?: string[], "delete_repo"?: bool, "delete_if_empty"?: bool }
server.list(no params)server.startparams:{ "config": string, "port"?: number }events:status(data.status: "started"when server port is reachable)server.stopparams:{ "config": string }events:status(data.status: "stopped" | "already_stopped" | "stop_timeout")
agent.list->{ agents: [{ name, path }] }config.list->{ configs: [{ name, path }] }model.list->{ repos: [{ name, path }] }server.list->{ servers: [{ name, host, port, status, config_name? }] }
Other methods return operation-specific objects (for example removed, valid,
deleted_files, status).
When running an agentic agent via agent.run, the stdio bridge emits structured
agent_event events during the agentic loop. These allow a UI to show real-time
progress.
{"event":"agent_event","id":"req-1","data":{"type":"agent.turn",...},"schema_version":"1"}The data.type field identifies the event kind.
| type | data fields | description |
|---|---|---|
agent.setup |
tool_count |
Emitted after tools are registered and the loop begins |
agent.turn |
turn, max_turns, message_count |
Emitted at the start of each LLM turn |
agent.tool_call |
name, args |
Emitted before a tool is executed |
agent.tool_result |
name, result, duration_ms |
Emitted after a tool finishes (result truncated to 2KB) |
agent.progress |
message |
Agent progress/thinking lines (from eprint() in JS) |
agent.complete |
turns, final_len |
Emitted when the agent produces a final answer |
← {"event":"status","id":"req-1","data":{"message":"agent.run.start"},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.progress","message":" → Scanning project structure..."},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.setup","tool_count":5},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.turn","turn":0,"max_turns":10,"message_count":2},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.tool_call","name":"run","args":{"command":"ls /Applications"}},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.progress","message":" → Running: ls /Applications"},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.tool_result","name":"run","result":"Android Studio.app\n...","duration_ms":18},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.turn","turn":1,"max_turns":10,"message_count":4},...}
← {"event":"agent_event","id":"req-1","data":{"type":"agent.complete","turns":2,"final_len":307},...}
← {"event":"status","id":"req-1","data":{"message":"agent.run.finish"},...}
← {"id":"req-1","ok":true,"result":{"status":"ok","result":"## Answer\n..."},...}
agent.progressevents carry theeprint()output from agent JS code (the→progress lines). In CLI mode, these go to stderr instead.agent.tool_result.resultis truncated to 2KB to avoid flooding the transport. The full result is available in the agent log file.- Events are only emitted for agentic agents (
mode: agentic). Script mode agents only producestatusandlogevents.
Messages with "jsonrpc":"2.0" are handled as MCP JSON-RPC.
initializenotifications/initializedtools/listtools/call
tools/call expects:
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"model.list","arguments":{}}}The tool result is returned as MCP content with stringified JSON payload.
notifications/hugind.statusnotifications/hugind.progressnotifications/hugind.lognotifications/hugind.agent_event— agentic loop events (samedata.typevalues as the NDJSONagent_eventabove)
Each includes the request id in params.id.