Docs assistant

Searches these docs locally; a configured answer service can generate responses.

Ask about this page or the wider Carina docs. Try: “How do I roll back a patch?”

llms.txt

Skip to content

Markdown

Runtime API overview

JSON-RPC over unix socket/stdio, optional Gateway, scopes, and SDK surfaces.

Transport (MVP): JSON-RPC 2.0 over unix socket (~/.carina/daemon.sock) or stdio. Bare TCP is restricted to explicit loopback for diagnostics. Network-facing clients use the authenticated WebSocket or HTTP Gateway. All optional listeners are disabled by default.

  • Machine-readable registry: protocol/jsonrpc/methods.json (and dual catalogs under apps/docs/public/data/)
  • Narrative: docs/rpc-api.md
  • Live exploration: Method catalog (Playground Mock/Live)
SurfaceUse when
JSON-RPC (local)Primary embed path for IDE, TUI, custom clients
WebSocket GatewayOptional; requires signed scoped token, first frame gateway.hello
HTTP GatewayAgent-first /v1 + read-only /tools/invoke when explicitly enabled
MCP server/clientTool interoperability under policy
SDKs (TS / Python / Go)Typed attach, events, fork, cost, steering
  1. Local authority — remote sync never silently overrides policy on the machine
  2. Descriptor catalog — remote exposure and scope come from method descriptors; unclassified handlers refused in strict mode
  3. Typed events — stream structured items, not opaque text-only logs
  4. Capability-scoped — every attach carries an explicit profile; kernel remains final side-effect authority
ScopeMeaning
readstatus, list, replay, catalog, audit, results
writemutating session/task/workspace actions in the local operator boundary
admincontrol-plane, secret, config, policy, plugin, or approval actions
workerremote worker lease protocol
streamlong-lived event subscriptions

Some methods use dynamic scopes (e.g. workspace.patch.propose escalates to admin for empty/absolute/.. paths). The resolver is classification only — the kernel remains final authority.

gateway.sh
carina gateway hello # versioned contract snapshot (not an auth grant)
carina gateway methods # live method catalog

gateway.hello is a transport-neutral contract snapshot. Actual authority is enforced by transport origin, method descriptors, and the capability kernel.

  • Enable: carina-daemon -gateway-ws 127.0.0.1:8777 -gateway-token-signing-key-file ~/.carina/gateway-token.key
  • Path: /gateway
  • First text frame: JSON-RPC gateway.hello with signed scoped token bound to transport: "ws"
  • Browser Origin rejected unless allowlisted
  • Startup fails closed without token signing key
  • Enable: carina-daemon -gateway-http 127.0.0.1:8787 + signing key
  • Every request: Authorization: Bearer <gw1 token> with transport: "http", matching route grant, and scope
RoutePurposeScopeRoute grant
GET /v1/modelslist agent targets (carina, carina/default, carina/&lt;agent_id&gt;)read/v1/models or /v1/*
POST /v1/chat/completionsOpenAI-style chat → Carina agent taskswrite/v1/chat/completions or /v1/*
POST /v1/responsesOpenAI-style responses + bounded continuitywrite/v1/responses or /v1/*
POST /tools/invokeread-only allowlist via daemon/kernelread/tools/invoke
/plugins/*reserved fail-closed plugin surfaceread/plugins/*

The /v1 facade is agent-first, not provider-first. model selects a Carina agent target, not a backend provider model.

/tools/invoke only allows read-only methods (status, listing, workspace tree/search/file reads). Process execution, shell, writes, patches, session injection, and secret reads are denied.

GroupExamples
Runtime / Gatewayruntime.initialize, gateway.hello, daemon.status, daemon.doctor
Sessionsession.create, session.attach/get/list/close, session.replay, session.items
Taskexecution.start, execution.cancel, governance.action.approve / deny
Workspaceworkspace.tree, workspace.search, workspace.file.get, workspace.patch.*
Memorymemory.list, memory.write, memory.projection.*
Workerworker.register, work.poll / renew / report
Workflowworkflow.run, workflow.list, workflow.pause / stop
Auditaudit.report, audit.export
session.create.json
{"jsonrpc":"2.0","id":1,"method":"session.create",
"params":{"workspace_root":"/repo","profile":"safe-edit"}}
client.ts
import { CarinaClient } from '@nebutra/carina-sdk';
const client = await CarinaClient.connect();
const session = await client.sessions.create({
workspace_root: process.cwd(),
profile: 'safe-edit',
});
session-cli.sh
carina session start --cwd . --profile safe-edit
carina gateway hello

Was this page helpful?

One vote per page is recorded during this session.