Cell - Ta Protocol
Protocol between ta serve and clients: types and constants only, with no pi or Node.js modules loaded, so it works in browsers.
- Transport: one WebSocket (
TA_WEBSOCKET_PATH) with JSON-RPC 2.0 messages. Method names are<service>/<method>, and the server pushesTaClient/onEventsetc. HTTP-based calls are not offered; only workspace file bytes travel HTTP (TA_FILES_PATH, for images and iframes in pages to load via relative URLs). - Services:
TaServer(sessions—pi's RPC commands),TaWorkspaceServer(files and commands in directories),TaTerminalServer(terminals),TaSettingsServer(pi'ssettings.json),TaPackageServer(packages, web extensions, and package data),TaAuthServer(login to model services, same as pi's/loginand/logout),TaRelayServer(paired devices via Relay, same asta pair),TaRemoteServer(hosts forssh://directories, ssh prompts, port forwarding). Capabilities outside sessions split into separate services by responsibility, not added toTaServer. TaServermethods: besidesopenSession,closeSession,listSessions,attach,detach,respondUi, andrespondClientTool, the rest are pi RPC mode commands with the same name (snake_case → camelCase, seePiCommandMethod). The first parameter issessionId, and return values match pi's; when pi adds an RPC command andTaServerlacks the method, this package's tests won't compile.setWorkingDirectorysets ta serve's working directory (TaServerInfo.cwd, used when clients don't specify one, persists across restarts). Session operations not in pi RPC:forkToFile(saves the forked session to a file, current session untouched, then open withopenSession),navigateTree(same as pi's/tree, returnseditorText),forkhas an optionalposition(atkeeps the selected item, like pi's/clonebut optional for any item).- Events:
TaEventEnvelope { sessionId, seq, event }, whereeventis a pi JSON/RPC mode event orextension_ui_request. Ta adds onlyui_request_resolved,extension_error,session_replaced,session_closed, andclient_tool_request(reserved). prompt/steer/followUp: carry client-generatedclientMessageId. Retrying with the same ID returnsduplicateand doesn't re-execute. Receipt only means accepted; the round end is marked by theagent_settledevent.- Locations (
cwd): a path is either local or on another machine in the formssh://<host>/<absolute-path>(TaLocationparses, handles parent/child, and names). - Errors: the JSON-RPC error code is
TA_RPC_ERROR_CODE. Thedatafield includes a stablecode(TaErrorCode, e.g.,CELL_TA_SESSION_LOCKED) and a one-line handling hint. When no model is available or the model service isn't signed in, the code isCELL_TA_NOT_SIGNED_IN; clients open the login page accordingly.CELL_TA_CONNECTION_LOSTis client-generated: the call didn't reach ta serve, or the connection dropped before the result arrived.