npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nexus-code/remote-protocol

v0.41.0

Published

NexusCode's remote protocol: the relay's frames and the end-to-end RPC between a user's devices

Readme

@nexus-code/remote-protocol

The protocol between a NexusCode user's devices and the relay that connects them, as zod schemas.

There are two layers:

  • Relay frames (relay.ts): what a device and its account's room on the relay send each other. The relay reads these: who a message is for, its sequence number, and the account key version it was sealed with. It cannot read the message itself.
  • Sealed messages (sealed.ts, rpc.ts, view.ts): what a sealed frame carries between two devices of the account.
    • A hello that says which protocol version and capabilities a device serves.
    • JSON-RPC 2.0 requests, answers and notifications: list and watch sessions and their changes, read and drive chats, peek at a chat's last turns, read, watch and drive terminals, wait on either, answer the consent prompts waiting on the user, read a workspace's files (find them by name, search their text, read them as text, images or bytes piece by piece) and git (status, diffs, log, a commit and its changes), and list a workspace's notes and put photos into one (with the note a device records into, in the sessions' list). What a device serves is per capability (CAPABILITIES); a hello's schema names the package version it speaks (SCHEMA_VERSION).
    • The chat view: the conversation as the serving device's app already built it, trimmed for drawing.

Beside them:

  • The account key's bundle (account.ts): the account key locked with the account password, as the server keeps it. See ACCOUNT_KEYS.md.
  • The voice socket (voice.ts): audio to the server, text back while the user speaks.
  • Push notifications (push.ts, since 0.18.0) let phones register for APNs and computers ask the server to notify them. /info.push lists the API version and APNs environments. A computer that sends notifications advertises push in its hello. The notification's nx data carries the version and kind.
  • Bug reports (bug-report.ts, since 0.35.0): what a signed-in phone or computer sends the server when its user reports a bug, and the server's answer.
  • Codex client commands (commands.ts): the slash commands a Codex client runs itself (CODEX_COMMANDS: name, aliases, argument hint) and the ones another device may run (CODEX_REMOTE_COMMANDS).

Sealing is XChaCha20-Poly1305. The key is the room key, derived from the account key. The associated data comes from aadOf() and binds a message to its routing. What is sealed is an envelope (SealedEnvelopeSchema): the message, the sender's epoch and the receiver's. Each connection to the relay has a random epoch, which devices learn from each other's hellos in three steps. A device takes a message only when it names its epoch now, is addressed to it, and has a seq higher than the last it took from that sender's epoch, so the relay cannot send an old message again or pass one on to another device. sealed.ts has the rules. Protocol version 2 (0.7.0) brought these; devices of version 1 open nothing of version 2.

Since schema 0.18.0 the envelope also carries conn (SenderConnectionSchema): boot, random and made once as the sender's room starts, and n, its connection count in that run, raised with each new epoch. A device takes nothing of a sender's epoch whose conn has the same boot as the one it heard last and an n no higher (olderConnection()). Otherwise a relay that held an older connection's messages and sent them after the newer's would turn the receiver back to the older epoch, and the receiver would drop the newer connection's messages until one of the two connected again. With another boot (the sender started again) or no conn on either side (a device before 0.18.0), the epochs alone decide, as before. The field is optional and devices before 0.18.0 leave it out when they parse, so the protocol version stays 2.

Schema 0.14.0 adds the files.write capability and file writes from agents: files.write.begin names a destination file whose parent folder exists and its size (at most MAX_FILE_WRITE_BYTES) and gets an uploadId; files.write.chunk sends positioned base64 pieces; files.write.end checks the whole file's sha256 and puts it in place; files.write.abort drops it. files.mkdir makes one folder, and is done when it already is one. begin and mkdir need an agent sender (from) and the method's capability, so a device serves files.write only where it takes agents' requests and chat control; the pieces, end and abort take agents, and an upload keeps the permission its begin got. The destination stays inside the workspace's folder and goes through no symbolic link. With anywhere: true (FileScope.anywhere), files.list, files.read, files.write.begin and files.mkdir take an absolute path on the serving device instead, and need terminal.control. Older devices do not know the methods and drop anywhere.

Schema 0.15.0 adds the agents.cli capability: a device takes the nexus CLI's reads from another device's agents (from, ReadBy) under the receiving device's agent policy. It adds notes.read, notes.transcript and chat.instructions, and ReadBy on profiles.list (which also takes workspaceId and tells workspaceDefault and path), chat.settings, chat.commands, chat.panel and chat.tool (which also takes cli: true for the CLI's form of a call and answers its index). chat.fileSuggestions moves from chat.control to chat.read, and terminal.shells from terminal.control to terminal.read. A CLI asks a device for these only when its hello lists agents.cli.

Schema 0.16.0 adds the settings.instructions capability and RPC. An agent can read the ordered instruction layers and combined text for a new chat in a workspace on another device when that device accepts agent requests. The read accepts an optional profileId. The capability also advertises support for layer: "profile" with a profileId in settings.instructions.set. Profile writes require fresh approval on the receiving device.

Schema 0.17.0 adds the profiles.usage capability and RPC. An agent can read the receiving device's profile names, usage windows, and observation times when that device accepts agent requests. The request can select a workspace host and refresh the snapshot through the provider's CLI.

Schema 0.19.0 adds optional fields only, and no capability. A chat's panel can carry limitResume: when the plan's usage limit stopped a subscription's chat, whether and when the serving app goes on in it by itself. A session can carry limitWait, the time it goes on. A turn's retry can carry at, status (the HTTP status) and reason (rate_limit, overloaded, server, connection, auth or other). Each is left out, not the panel or session, when a device cannot read it.

Schema 0.20.0 requires Zod 4 (^4.6.6) as a peer and keeps the 0.19.0 wire format.

Schema 0.20.1 adds optional status.phaseRevision and panel.limitResume.stopAt fields so remote banner dismissals can distinguish different failures or usage-limit stops with identical copy.

Schema 0.21.0 adds the sessions.reorder capability and RPC. Devices serve it alongside sessions for requests from people. Send { workspaceId, tabIds } with up to 500 tab IDs. The host puts those tabs in the requested order in the slots they already occupy, skipping unknown and duplicate IDs, and returns {}. sessions.list, sessions.watch and sessions.update list each workspace's sessions in its agent sidebar order, followed by any remaining sessions in tab order.

Schema 0.22.0 adds optional failed: true to session listings when the last turn ended in error. The session's state stays compatible with older readers.

Schema 0.23.0 adds the sessions.markSeen capability and RPC. Devices serve it alongside sessions for requests from people. Their lists report unread chat and terminal results as new-result. Send the result's since back as upTo with { workspaceId, tabId }, up to 500 entries in a request. Failed turns stay visible. The RPC returns { marked }.

Session listings can include incompleteWorkspaces when a workspace's rows are partial or come from an earlier watch snapshot. Clients can wait for a complete listing before reconciling saved read receipts there.

Schema 0.24.0 adds optional topLevel to git.status, the absolute root from git rev-parse --show-toplevel (with forward slashes on Windows). Git file paths remain relative to that root. Readers can discard an invalid topLevel and keep the rest of the status.

Schema 0.25.0 adds optional openedBy to session listings and watch updates. It identifies the opener by tab and workspace, with a device ID for an opener on another computer. Large lists can omit opener names or the entire opener to fit the message limit. Older readers ignore the field.

Schema 0.26.0 adds system.stats and its capability: how busy a workspace's host is (CPU share in use, or null, and memory used and total in bytes), as its status bar shows. A device serves it only where it serves files, and only to people: a request with from is refused. Older hosts neither list the capability nor know the method.

Schema 0.27.0 adds chat.peek and its capability: a chat's last turns at a glance, for a preview. Send { workspaceId, tabId, turns? }, 1 to 5 turns, 3 when left out. The serving device reads them from the chat's history without opening the tab, starting its program or connecting to a workspace's host, waits for no subagent and sends no tool results. Each turn has the user's message (up to 1,000 characters, with its image and file counts) or another sender's (up to 300), the agent's last words (up to 2,000) and its tool calls counted by name (the 8 most called, otherTools for the rest). status has running, phase and the end of the reply being written (up to 1,000). more says earlier turns exist, waiting what an open chat waits on, and unavailable why none could be read: offline for a host not connected, missing for no history. The answer, as JSON in UTF-8, fits in 14 KiB (MAX_PEEK_BYTES): the oldest turns go first, then replies, user texts, the reply being written and received texts are cut, in that order. Characters are code points, and a cut text ends with "…" (the reply being written begins with it). fitPeek makes the cuts and fits an answer in the budget, and peekTools counts a turn's tools. An agent's read carries from, as with chat.read. A device serves chat.peek only where it serves chat.read, and reads no more than chat.read does. Ask it only of a device whose hello serves chat.peek, and chat.read of one that does not.

From schema 0.27.0, a host fills a workspace's git in the sessions' list (RemoteWorkspaceSchema.git: branch, ahead, behind, uncommitted) for a root workspace too, not only for a task; none where the folder is no repository. The wire format is unchanged: an older host tells it for tasks only, and a reader shows none where it is absent.

Schema 0.28.0 adds chat.runRead: a page of one of a chat's claude -p or codex exec runs, read from the run's own session, as chat.read gives one of the chat. It needs the chat.read capability, finds the run only among the runs of the chat it names, and answers NotFound for any other run and for one that keeps no session. A request with from goes through the checks chat.read's does. Older hosts do not know the method; chat.run still tells the run's summary.

Schema 0.29.0 takes the time limit off the consent prompts an agent's request (from) waits on. A host asks its user until they answer, the requester sends the request.cancel notification (REQUEST_CANCEL, { id } of the request as last sent), or the requester leaves the room or comes back with a new connection; then it closes the prompt and does nothing. A requester waits for the answer without a limit and sends request.cancel when it stops waiting. Both do so only with a device whose hello says 0.29.0 or later (UNTIMED_CONSENT_SCHEMA); with an older one, the host still turns a prompt down after AGENT_CONSENT_MS and the requester waits that long. In the sessions' list, a host's untimed prompt has expiresAt a day past at, for older readers; a reader should not count prompts down nor drop them by time, as the next list leaves out a prompt that no longer waits. Such a prompt also carries untimed: true, so a reader can tell it from a prompt of an older requester, which a 0.29.0 host still turns down at expiresAt (90 seconds); the field is absent otherwise, and readers before 0.29.0 drop it as an unknown key. Older devices drop request.cancel.

Schema 0.30.0 lets chat.tool and chat.image take an optional runId, the id chat.runs gives one of the chat's claude -p or codex exec runs. With it, the host looks for the tool call or image in that run's own session, as chat.runRead reads it, instead of in the conversation: a toolUseId, or a ref's itemKey and toolUseId, are then the ones a chat.runRead page gives. Both still need the chat.read capability. The host finds the run only among the runs of the chat it names and answers NotFound for any other run, a subagent, and a tool call or image the run does not hold; for a run that keeps no session to read it answers as chat.runRead does (Unavailable while a running run's session may still come, NotFound otherwise). A held ref with runId is never found. A host before 0.30.0 drops runId as an unknown key and looks in the conversation, so a reader sends runId only to a device whose hello says 0.30.0 or later (RUN_ITEMS_SCHEMA). No capability is added. The same version raises PUSH_TTL_SECONDS.consent.max from 120 to 86400 seconds: a computer sends the push for a consent prompt with no time limit for what is left of a day from the prompt's at, and for a prompt with a limit until that limit as before. A server before 0.30.0 clamps the TTL to 120 seconds; a computer that sees a consent push with a TTL over 120 refused with HTTP 400 sends it once more, with the same id and a TTL of 120. Every push for one consent prompt, a retry or the 120-second resend alike, carries the same id (PUSH_EVENT_ID_PATTERN), and a computer stops sending it once the prompt is answered or withdrawn. People may read profiles.usage from 0.30.0 on: a host that takes their requests lists the new capability profiles.usage.people (beside profiles.usage, which hosts since 0.17.0 list and which takes only agents' requests there); an agent's request is taken as before, under the agents capability and its policy. The answer is the same for both and carries no account email or keys: per profile its id, the name the user gave it, agent, status, fetchedAt and the usage limits.

Schema 0.31.0 lets a reader take a note's body and its recordings' transcripts apart, so a long transcript no longer keeps the body from coming: an answer over MAX_FRAME_BYTES is refused whole (Unavailable). notes.read takes an optional withoutTranscript: true: the host leaves transcript empty ("") and still sends markdown. Whether it is set or not, a 0.31.0 host adds recordings, one entry a recording of the note in the order notes.transcript gives them, empty for a note without one: { id, startedAt, ms, lines, participants }, where ms is the recording's length in milliseconds, lines how many transcript lines it has (as notes.transcript counts them, before the Markdown joins a speaker's lines) and participants is "auto", "7+" or a number. transcriptOnly and withoutTranscript together are refused (InvalidParams). notes.transcript takes optional start (a line index from 0) and limit (1 to MAX_TRANSCRIPT_LINES, 1000, which it also is when left out) to read one recording a page at a time; with either, recording is required (InvalidParams otherwise) and recordings holds that one recording. Each recording of a 0.31.0 host's answer carries start, the index of its first line here, and total, how many lines it has; without start and limit they are 0 and the count of the lines it sends, all of them. A page holds lines start up to start + limit, fewer where that is past the end or where more would not fit in a frame: the host leaves lines off the end until the answer fits, so a reader asks again from start plus the lines it got until it has total, and never takes a short page for the end. A start past the end answers no lines, with start set to total. Line ids are the same as in the whole transcript. A host answers Unavailable only when a single line does not fit. notes.read also reads a body a page at a time: with withoutTranscript: true, optional markdownStart (an index into markdown from 0) and markdownLimit (1 to MAX_NOTE_MARKDOWN_PAGE, 262144, which it also is when left out) send markdown from markdownStart for at most markdownLimit characters; either one without withoutTranscript is refused (InvalidParams). Indexes and lengths count UTF-16 code units, as JavaScript, Kotlin and Swift's utf16 view index strings; the host never ends a page between the two halves of a surrogate pair, and a markdownStart that falls between them starts the page one unit earlier, so a page's markdown is always well-formed. A 0.31.0 host's notes.read answer always carries markdownStart, where its markdown begins, and markdownTotal, the length of the whole body (0 and that length when not reading by pages; 0 and 0 with transcriptOnly). A page holds fewer characters where more would not fit in a frame, so a reader asks again from markdownStart plus the length it got until it has markdownTotal, and joins the pages; a markdownStart past the end answers markdown: "" with markdownStart set to markdownTotal. Without markdownStart and markdownLimit a body that does not fit is still refused whole (Unavailable), not cut: a reader before 0.31.0 would drop markdownTotal and take a cut body for the whole one. The note's recordings come with every page. Every page carries the note's updatedAt, which changes whenever its body is saved: a reader compares each page's updatedAt (and markdownTotal) with the first page's and, when they differ, reads the body again from 0, giving up after a few tries if the note keeps changing; otherwise the joined body may match no one version of it. Before 0.33.0 a transcript page carries no such version, and saving a transcript does not change the note's updatedAt. A recording being recorded only grows, so a total larger than on an earlier page is normal and the reader goes on. A reader reads a recording again from 0 when a page's start is not the one it asked for, its total is smaller than before, or it repeats a line id already read; an edit that keeps the count and ids (a speaker renamed) is not seen until the next read, unless the host sends the base and revision of 0.33.0. notes.list adds recordings to each note, how many recordings it has (0 for none). The capability stays notes, and people and agents (from) may read as before; no capability is added. A host before 0.31.0 drops withoutTranscript, markdownStart, markdownLimit, start and limit as unknown keys and answers the whole note or transcript as before, which may then be refused as too large, and sends none of the new result fields; so a reader sends these keys only to a device whose hello says 0.31.0 or later (NOTE_PAGES_SCHEMA), and reads recordings, markdownStart, markdownTotal, start and total as absent from an older one. Readers before 0.31.0 drop the new result fields.

Schema 0.32.0 lets another device show two of a chat's banners as its own computer shows them: how the last turn failed, and a terminal tab running the same session. A chat's status adds optional failure while its last turn ended in a failure the app could name: kind, one of TURN_FAILURE_KINDS (usage_limit, transient, auth, request, other), status, the HTTP status when an answer came, and at, when the turn ended, in Unix milliseconds. It never carries the error's own words, a path or a token: those stay in the conversation's error notice as before. The host may keep sending it while a new turn runs and leaves it out once a turn ends without failing; a reader shows it only while no turn runs, as the desktop does: transient with a way to try again (chat.send of a message that asks the agent to go on from where it stopped), auth and request as an error with the status, and nothing for usage_limit (the plan limit's own banner says that) or other. A Claude chat's panel adds optional twin, { tabId } of a terminal tab in the same workspace whose Claude Code runs the same session, as its hooks told the host: going on in both forks the conversation. The host sends the panel again in chat.update when a terminal starts or stops running the session, and tells only a terminal tab, never another chat. A reader shows that terminal where the sessions' list lists it, as it opens any listed terminal. A failure of a kind this version does not know, or one or a twin it cannot read, is left out, not the status or the panel. A host before 0.32.0 sends neither and a reader before 0.32.0 drops both, so a reader shows the banners only where they come; no method, capability or schema constant is added, and chat.read and chat.control serve them as before.

Schema 0.33.0 lets a reader see that a recording's transcript changed between the pages it reads even where its line count and line ids stay the same: a speaker renamed (by hand or from a remembered voice), a line's text or speaker changed, or its participants set. Each recording of a notes.transcript answer adds optional base and revision, short opaque strings: revision names the recording's lines from 0 through the last line of this answer, and base its lines before start, each as it is when the host answers, with every line's speakerName, speakerLabel and text and the recording's participants. Equal strings mean the same lines; a reader only compares them and never parses them or works one out itself. Without start and limit, base names no lines and revision all of them. A recording being recorded keeps the lines it had while it grows, so the base of its next page is the revision the reader holds and the reader goes on. A reader keeps the revision of the last page it took and, when the next page's base differs from it, reads that recording again from 0, as for a start it did not ask for, giving up after a few tries as before. Each entry of notes.read's recordings adds the same revision, naming all the recording's lines: a reader that has read a recording's transcript compares the revision of its last page with the note's and, when they differ, asks for the note's recordings again to show the length and line count of the version it read. The host works both out from what it sends each time (now the first 16 hex digits of a SHA-256); nothing is stored, and saving a transcript changes them only where its lines, names or participants change. One that is not a string of 1 to 64 characters is left out, not the recording. A host before 0.33.0 sends neither and a reader before 0.33.0 drops both, and a reader compares them only where both values come, reading as before otherwise; so no method, capability or schema constant is added, and a reader still pages only a device whose hello says NOTE_PAGES_SCHEMA or later.

Schema 0.34.0 lets another device show a chat's changed file as the chat's own computer shows it: as the agent wrote it in the tool call. Each entry of a chat panel's changedFiles adds optional rawPath, the path as the first finished change of that file named it, sent only where it differs from path. path stays the key: the host still groups a file's changes by it and opening the file or its change still takes it. Today the two differ only in how a Windows path is written: path has forward slashes and an upper-case drive letter (C:/p/a.ts, //server/share/x.ts), rawPath the agent's backslashes and case (c:\p\a.ts, \\server\share\x.ts), so it tells nothing path does not. A reader shows rawPath where it comes, made relative to the chat's folder as for path, and path otherwise. One that is not a string is left out, not the file. A host before 0.34.0 sends none and a reader before 0.34.0 drops it, so a reader shows path as before; no method, capability or schema constant is added.

Schema 0.35.0 adds the bug report API (bug-report.ts): POST /bug-reports?v=1 (BUG_REPORT_VERSION) takes a BugReportSchema body from a signed-in phone or computer and answers BugReportCreatedSchema, or one of BUG_REPORT_ERRORS. It is an HTTP request to the server, not a relay frame or sealed message: no method, capability or field between devices changes, and PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

Schema 0.36.0 lets a recent error in a bug report carry its message. BugReportRecentErrorSchema adds optional message, one line of 1 to 300 code points (MAX_BUG_REPORT_ERROR_MESSAGE, BUG_REPORT_ERROR_MESSAGE_PATTERN) that a client puts through cleanBugReportErrorMessage (which redacts with redactBugReportText) when it records the error and again when it sends it, and optional count, how many times the same error came, from 1 to 9999 (MAX_BUG_REPORT_ERROR_COUNT). BUG_REPORT_ERROR_AREAS adds app, agent, notes, files and git. MAX_BUG_REPORT_CONTEXT_BYTES goes from 4096 to 8192, and MAX_BUG_REPORT_BODY_BYTES (24 KiB) names the largest body: a client fits its context with fitBugReportContext before sending. The server redacts each message with redactBugReportText again before it keeps it. BUG_REPORT_VERSION stays 1: a 0.35.0 report is still a valid 0.36.0 report, and a server must take 0.36.0 before a client sends a message, a count or a new area, since a 0.35.0 server refuses them as unknown. PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

Schema 0.36.1 makes redactBugReportText and cleanBugReportErrorMessage idempotent: what either gives comes out the same when put through it again, and a cleaned message comes out the same from redactBugReportText, so a client cleaning twice and the server redacting again keep what the first pass kept. Before, a path glued to the <ip> or <email> a later rule put in, a path after a control character turned into a space, and a cut that left a hex run or a password: before the … were only taken out on the second pass. Each function now repeats its rules until the text stops changing, at most 8 times, and gives <secret> if it has not settled by then; a message over 300 code points is cut at a word and ends in …. The schema does not change: BUG_REPORT_VERSION, PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

Schema 0.36.2 makes redactBugReportText take out a home folder's whole name when it has a space. Before, an unquoted C:\Users\John Smith at the end of a path came out as <path> Smith, leaving part of the user's name. After a home folder prefix (C:\Users\ or C:/Users/ on any drive and in either case, with \\?\ in front or JSON's doubled backslashes, /Users/ and /home/), the name now runs over spaces and tabs until a slash or backslash, a quote, a line break, a character Windows refuses in a user name (: ; , = + * ? [ ] < > |), or a word that starts another drive path or a URL; an apostrophe between letters (O'Brien) stays in it. When the name ends the path, the words after it up to that stop go too: cannot access C:\Users\kim because it is locked becomes cannot access <path>. A path that goes on past the home folder ends as before, so the last file name's words after a space can stay (<path> b.txt). The schema does not change: BUG_REPORT_VERSION, PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

Schema 0.37.0 lets another device list a workspace's notes as their own computer lists them, with the same chips and search. Each note of a notes.list answer adds optional counts (NoteCountsSchema: how many sketches, files, images, todos and done todosDone its body has), excerpt (the start of its body as plain text, at most 120 characters, empty for an empty body), recordingMs (the length of all its recordings together, in milliseconds) and people (the most voices one of its recordings tells apart), the last two only for a note with recordings. A value that cannot be read is left out alone, not the note. A host before 0.37.0 sends none of them and a reader before 0.37.0 drops them, so a reader shows the chips and searches the excerpt only where they come, and the title alone otherwise; no method, capability or schema constant is added, and the capability stays notes. PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

Schema 0.37.1 makes redactBugReportText take out the words of an unquoted path's last file name after a space. Before, C:\Users\QA\My Documents\final report.txt came out as <path> report.txt and D:\tmp\보고서 최종.docx as <path> 최종.docx. After an unquoted path, the next one to four words, apart by spaces or tabs, now go with it when the last of them ends in an extension: a dot and 1 to 8 ASCII letters and digits with at least one letter, at the end of the word or before a closing . or ). The words stop where a home folder's name stops since 0.36.2 (a line break, a quote, one of : ; , = + * ? [ ] < > |, or a slash or backslash, so another path or a URL), and at a word that ends in .; none are taken after a path that ends in one of those characters, . or ). So C:\a\b.txt and c.txt becomes <path>, while C:\a\b.txt, and c.txt keeps and c.txt, C:\a\b failed on node 20.11.1 keeps its version, and a file name with five or more words after the path's last space keeps them, as before. The schema does not change: BUG_REPORT_VERSION, PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

Schema 0.38.0 lets another device see the connection of each agent profile, so a user's agent can check a profile there or make the same one on its own computer. profiles.list takes optional connection: true and profile (an id, or a name case aside). With connection, each profile of the answer adds color and connection (ProfileConnectionViewSchema): method (account, api-key or custom) and, for custom, preset, baseUrl, auth, models (each with id and optional label, contextWindow and reasoning), defaultModel, lightModel, the connection's contextWindow, and advanced (timeoutMs, maxOutputTokens, disableExperimentalBetas, retries, streamIdleTimeoutMs, and the names alone of its headers and query, at most 64 each), and hasKey, whether an API key is saved for the profile's address, left out while the host's keychain is locked. An API key never goes to another device, in any form: not its value, length or any part of it. Neither do header or query values, environment variables or the profile's folder. A baseUrl with a user, password, query values or a fragment goes without the user, password and fragment and with each query name's value replaced by ***, and baseUrlRedacted: true says so; an address the host cannot parse is left out with baseUrlRedacted: true. A reader treats a redacted address as unknown: it shows it as hidden and never makes a profile from it, and it redacts again what an older or faulty host sent. With profile, the host answers only the profiles it names. A host that takes connection lists the new capability profiles.connection; a reader sends connection and profile only to such a host. A host before 0.38.0 drops both as unknown keys and answers as before, and a reader before 0.38.0 drops the new fields. A color, connection or hasKey a reader cannot read is left out alone, not the profile. profiles.list keeps its sessions capability and its agent policy, and PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

A consent prompt in the sessions' list (RemoteConsent) is a change waiting on the user of the serving device. An agent of another device of the account may have asked for it, or a nexus command changing another workspace there, or that device's agent manager. The user answers it there, or from the device that lists it when answerable (consent.answer). An agent's request (from, AgentSender) to a control method takes the agents capability instead of the method's own. The serving device may ask its user first or turn the request down. at and expiresAt use the serving device's clock. expiresInMs is expiresAt minus the time the list was sent, so a reader needs no shared clock. A serving device before 0.29.0 turns a prompt down at expiresAt and drops it from the list. AGENT_CONSENT_MS (90 seconds) is how long a host asks a requester before 0.29.0 before turning the request down. Such a requester waits that long, plus a little more.

Since package 0.39.0, RemoteConsent can carry these optional fields:

| Field | Type | Meaning | | --- | --- | --- | | kind | "cross-workspace" | The host treats this as a change to another workspace. change.kind still identifies the action. | | scope | { workspaceName: string; worktreeName?: string } | Display names of the destination workspace and its worktree, when available. For a worktree, workspaceName is its parent and workspaceId is still the destination worktree ID. | | allowScopes | { once: "once"; session?: "chat-session" \| "until-restart" } | The keys match the allowed consent.answer choices. once covers one request. chat-session covers the calling conversation for the destination workspace and its worktrees. until-restart uses the prompt's existing session scope. The reader translates the button labels. If the field is absent, use eachTime to determine whether to offer the legacy session choice. |

sessions.list, sessions.watch, and sessions.update may include consentResolutions?: RemoteConsentResolution[] beside the pending consents array. Each entry is { id: string; reason: "answered" | "timeout" | "cancelled" }. answered includes any accepted answer, including denial, on the host or a peer. timeout means the host's approval prompt expired. cancelled means the request was withdrawn or the host could no longer ask for approval. The host retains up to 64 entries for up to 60 seconds and may repeat them across snapshots. Match by serving device and consent ID, and show a resolution only for a previously seen prompt. A resolved prompt still disappears from consents. If no resolution is available, disappearance by itself provides no reason.

Schema 0.40.0: file grants

Since package 0.40.0, a device can show and open files outside a workspace's folders that a chat names, without reading them on its own. A host that serves it lists the capability files.grants, and only where it serves files and chat.read both. A reader uses the methods and fields below only with such a host. With an older host, it reads as before.

What a reader may read outside the workspace's folders falls into three sets.

  • Standing: read with no grant. These are the paths of finished tool calls, attachments, background job outputs and the local images an answer links. For an agent's request (from), paths only a read-only tool named and answer images are left out.
  • Mentioned: every path the tab's chat names. A reader may ask whether one is there (files.resolve), but not read it.
  • Granted: a file the user opened. files.grant gives a short-lived token for it, and files.read takes the token.

The host resolves every link itself. A reader sends the link as written (href) and where it came from (source, FileLinkSourceSchema). The host resolves a relative link against the session's folder, the tool call's cwd, or the parent file's folder, and answers the path.

Source kinds. Each carries an optional runId, for a claude -p or codex exec run of the chat (as chat.tool takes it):

| kind | Key | The link must be in | | --- | --- | --- | | answer | itemKey | that assistant item's text, in the conversation or a subagent's items | | received | itemKey | that received message's text | | taskEnd | itemKey | that task_end item's summary | | streaming | messageId | the reply being written, or once it ended, every assistant item with that messageId; gone after a rewind | | tool | toolUseId | that tool call's file path, notebook path or SendUserFile paths, or the links of its result | | user | itemKey | that user item's attachments. Each @path at the end of the item's text counts when it is inside the workspace's folder, even with no attach slot copy (readable: true; files.grant answers { path } with no token). Outside the folder only the attach slot copy counts | | job | taskId | that background job's output file | | change | – | the chat's (or run's) changed files | | file | parent, grant? | the parent file's text, its first MAX_FILE_SOURCE_PARENT_BYTES (5 MiB); grant is the parent's token when it needed one. Links inside PDFs and Office documents are not taken |

The host compares links after it cleans both sides the same way:

  1. Undo CommonMark backslash escapes, except in a Windows path target: one that, as written (before entities are decoded) and without <...>, starts with a drive (C:\, C:/) or with two slashes of either kind (\\, //, \/, /\). There every \ stays, so C:\Users\me\.claude\a.png keeps \.claude.
  2. Take off <...>.
  3. Decode HTML entities.
  4. Percent-decode.
  5. Turn \ into /.
  6. Take off a line tail (#L12, #L12-L20, :12, :12:3).

Then they must match exactly.

When a chat view or a held Markdown preview asks the host about an inline or reference file link or image, it sends the target as written. The href comes from the text, or from the definition used by a reference, with only <...> and a line tail taken off. Windows path targets are interpreted as in step 1.

Links are inline link and image targets (balanced parentheses, \), titles in ", ' or (...)), reference links and images through a definition that starts a paragraph or a list item and has nothing after its target but an optional title, autolinks, and backtick paths of files a tool call touched. In an .html parent, href and src values count too. Apart from those backtick paths, nothing inside code or an HTML comment is a link. The host finds them as CommonMark and GFM do in these respects:

  • Fenced code blocks with backticks or tildes, with any line ending, also inside > quotes and list items, opened at most three spaces past the quote or list item's content. A block left open runs to the end of its quote or list item, or of the text.
  • Code spans, and HTML comments in a line or opening a line (such a comment left open runs to the end of its quote or list item, or of the text).
  • A link's text, target and title, a code span and a comment in a line end at a blank line and where another block starts (a quote, a list item, a heading, a fence, an HTML comment).
  • A ]( with no [ before it is no link, nor is a link inside another link's text or an image's alt text.

Where the host still differs: links in a block indented four spaces count, since telling such a block from a list item's text needs the whole list; links in HTML blocks other than comments count; bare https:// and www. addresses are no links; a link whose target holds a backtick that a later backtick closes is taken as code. A reading that runs past a time limit (5 seconds) stops, and links from the block where it stopped on are not found.

A two-slash, device or automount target goes through the host's network and device checks before it is resolved: the host never folds //server/share/x into the local /server/share/x.

files.resolve takes { workspaceId, tabId, links }, with 1 to MAX_FILE_RESOLVE_LINKS (64) entries of { href, source }. It answers { found } in the same order, one entry per link:

| Entry | Meaning | A reader shows | | --- | --- | --- | | { path, readable: true } | The file is there and may be read with no grant | A card and its thumbnail | | { path, readable: false } | The path cannot be read under standing access | An icon card; a tap asks for a grant | | { blocked: true } | An automount, UNC or device path. Decided by the path's shape alone, without touching it, or a symbolic link found to point at one | An icon card; a tap asks for a grant | | null | Not there, or not in that source | No card; the link in the text stays |

readable: false does not only mean outside the standing set. In a local workspace, a path inside the workspace's folder that a symbolic link takes outside it answers readable: false; files.grant for it is Forbidden, with no data and no token.

If the call fails, the reader shows that it could not load. The host only stats files: it neither opens nor reads them, and tells no size or version. An entry a reader cannot parse becomes null (FileResolvedSchema). A reader checks an absolute path inside the workspace's folder itself (files.list, files.read), without files.resolve.

files.grant is sent when the user opens a file. It takes { workspaceId, tabId, href, source, purpose }. purpose is open, original or share, and the host only logs it. It answers { path } for a file read with no grant. For any other file, it also answers grant (FileGrantTokenSchema, 22 to 64 base64url characters), expiresInMs and idleMs. Asking again for the same file from the same device and tab gives back the same live token. An absolute path inside the workspace's folder is read directly, without files.grant.

files.read takes grant. A token is bound to the device, its connection (epoch), the workspace, and the cleaned path and its real path. It ends FILE_GRANT_IDLE_MS (10 minutes) after its last read, at most FILE_GRANT_MAX_MS (60 minutes) after it was given. It also ends when the device leaves or reconnects, the tab closes, or the chat item it came from is rewound or cleared. The same token serves text, images, byte pieces and version checks. files.list takes no grant.

Errors:

  • RpcErrorCode.GrantExpired (1004): the token timed out, or the host dropped it to keep its limit. Within a flow the user started (opening, reading pieces, sharing, paging), a reader asks files.grant once more with the same source and reads again. For a file source, the parent's token may have expired: then files.grant and files.resolve answer GrantExpired, and the reader renews up the chain of parents. Granting a child keeps its parent's token alive.
  • Forbidden with data.grant: "invalid": the token does not match this device, connection, workspace or path, or it was dropped because its source is gone. Do not ask again.
  • Forbidden with data.grant: "required": the path needs a grant. The host decides this before it touches the file. An automatic read (a gallery's neighbors, an image in an opened Markdown file) shows a placeholder instead. A flow the user started asks files.grant once and reads again.
  • NotFound with data.reason: "beyond": a file source's link was not found in the parent's first 5 MiB. This differs from a file that is gone.

FileAccessErrorDataSchema reads that data and drops values it does not know.

files.resolve, files.grant and a files.read with grant are refused (Forbidden) when they carry from: grants are people's only. An agent reads outside the workspace's folders with anywhere and terminal control, as before. Hosts also stop reading the paths named above when they are automount, UNC or device paths, cleaned (escapes, .., slashes) first and followed link by link.

A consent prompt's change adds optional pathKind: "network", when the path it would read or write is a UNC or automount path. A reader shows that as the host's prompt does. An unknown value is left out, not the prompt.

A reader before 0.40.0 drops grant, pathKind and the new answers' fields, and never sees GrantExpired. A host before 0.40.0 drops grant and answers the new methods MethodNotFound. FILE_GRANTS_SCHEMA names the version. A reader still decides by the capability, which a host may turn off.

A device's hello schema is the package version it bundles. So a reader that moves to 0.40.0 must ship file grants in the same release. Until a host serves files.grants, a reader checks a file is there with files.read { as: "bytes", length: 1 }. A zero-length read needs version opt-in, and opting in makes a host hash the whole file. Hosts keep the mentioned set readable for readers before 0.40.0 behind a setting, until readers with grants are out.

PROTOCOL_VERSION, RELAY_VERSION and MAX_FRAME_BYTES stay as they were.

In schema 0.16.0, chat.instructions can also return session, the tab's editable session text, and layers, its ordered persistent layers, including empty layers. The workspace layer comes from the parent for a worktree task. Hosts through desktop 0.36.1 only return the combined instructions text. Treat a response without session as read-only. With chat.control, a person can replace the session layer using chat.instructions.set. Send an empty string to clear it. The 5,000-character limit applies to both people and agents. An edit with from follows the receiving device's agent approval policy.

Until it is published, other repos use it by a local path, e.g. "@nexus-code/remote-protocol": "file:../nexus-code/packages/remote-protocol", after npm run build here: its exports point at dist.

Use and publish

Published as @nexus-code/remote-protocol: ES modules with their type declarations in dist. The desktop app imports src directly; npm run build (run by prepublishOnly) makes dist. Relative imports in src end in .js, as Node's ES modules need them.

A version is published by GitHub Actions (.github/workflows/publish-remote-protocol.yml) when a tag remote-protocol-vX.Y.Z naming the version in package.json is pushed: trusted publishing, with no token or one-time password, and with provenance.

API reference

What each module and export means, by file in src. A name with dots is a field or member of the export before it; "(how it works)" marks what a function does inside.

index.ts

NexusCode's remote protocol, in two layers, and the account key's bundle:

  • ./relay: the frames between a device and its account's room on the relay, which the relay reads and routes;
  • ./sealed, ./rpc, ./view: what a sealed frame carries between two devices of the account, which only they can open; ./peek fits a chat.peek answer in its budget;
  • ./account: the account key, locked with the account password, as the server keeps it;
  • ./device-keys: each device's key, envelopes and rotation, pairing, and the password's proof (account keys v2);
  • ./voice: the voice socket, speech to text while the user speaks;
  • ./push: phone registrations, notification requests and app data;
  • ./bug-report: a user's bug report to the server and its answer;
  • ./info: what the server offers (GET /info);
  • ./commands: the slash commands a Codex client runs itself.

relay.ts

What the relay sees: the frames between a device and its account's room. A device sends sealed messages to another device of the account, or to all of them; the relay checks who sent it, stamps it, and passes it on. It cannot open what a message carries (see ./sealed.ts).

RELAY_VERSION

The version of the frames below; the relay refuses a device that speaks another. A device asks for its ticket with it (POST /relay/ticket?v=2) and opens the socket with it (/relay?v=2&ticket=...). A version the server no longer takes is turned down at the ticket, where a status can be read: 400 with UnsupportedVersionSchema's body. That app must be updated; asking again will not help. Version 2 is NexusCode 0.12.0's: its account keys v2 only, and the protocol package's 0.12.0 or later.

UNSUPPORTED_VERSION

The ticket's answer to a version it no longer takes (400): the one it wants.

DeviceIdSchema

A device's id, as the server gave it when the device signed in.

ALL_DEVICES

Every other device of the account that is in the room.

Base64UrlSchema

Unpadded base64url, as the sealed bytes travel.

OutgoingSchema

A sealed message, as the sender gives it to the relay. to is one device or ALL_DEVICES. seq counts the sender's messages since it connected, from 1: the other side takes them in its order, each once (see ./sealed.ts). kid is the account key's version the message was sealed with, or PAIR_KID (0) for a pairing frame, which goes to one device only (see ./device-keys.ts): the relay refuses one to ALL_DEVICES.

DeliveredSchema

A sealed message as the relay delivers it, with the sender it vouches for.

RoomDeviceSchema

A device of the account, as the relay tells who is in the room.

RoomDeviceSchema.name

The name the device signed in with (its host's, say).

RoomDeviceSchema.alias

The name the user gave it, shown in its place (alias ?? name), with name beside it where devices are looked at closely; null or absent for none. A server before 0.11.0 sends none. Since 0.11.0.

RoomDeviceSchema.platform

darwin, win32, linux, ios, android, web.

PresenceSchema

Who is in the room: sent once a device joins, and again whenever a device comes or goes. self is the device it is sent to.

RelayErrorSchema

The relay could not take a frame: it was malformed, too big, sent to a device not in the room, or the device's sign-in ended (then the relay closes the socket after it).

RelayErrorSchema.seq

The seq of the frame it refuses, when it was a message.

AccountEventSchema

Something that befell the account, which the server tells every device in the room (account keys v2):

  • key-rotated: a rotation put the account key of version kid in place; a device fetches its envelope (GET /devices/current/key-envelopes);
  • key-reset: a reset that waited is in place (version kid);
  • reset-pending: a reset was asked for without the password, and is put in place at appliesAt unless called off;
  • reset-cancelled: it was called off. A device before v2 does not know the frame and drops it.

ClientFrameSchema

What a device sends the relay.

ServerFrameSchema

What the relay sends a device.

MAX_FRAME_BYTES

Most bytes one frame may take as JSON. A chat's whole transcript goes in pages under it (see ./rpc.ts).

sealed.ts

What a sealed message carries, which only the account's devices can open.

Sealing (v2): XChaCha20-Poly1305 with the room key, a fresh random 24-byte nonce per message, and the frame's routing as associated data (aadOf), so the relay can neither read a message nor pass it off as another's. The room key comes from the account key (see the account key design); every device of the account holds it. The bytes sealed are an envelope's JSON in UTF-8 (SealedEnvelopeSchema): the message, and the epochs below.

The relay may keep a frame and send it again, then or days later, or to another device of the account. So a device takes a message only when it was sealed for it, now, and only once:

  • Each connection to the relay has an epoch, random, made as it opens. An envelope names the sender's epoch (epoch) and the epoch of the device it goes to (peer), as that device told it.
  • A device takes a message only when peer is its own epoch now (one sealed before this connection opened names another), and to is itself.
  • It takes a sender's messages only in the order of their seq, each once: a seq no higher than the last it took of that sender's epoch is not taken; once it took one of a sender's newer epoch, it takes none of an older one.
  • Since 0.18.0 an envelope also says which of its sender's connections it comes in (conn: the sender's run, and its connections counted in that run). A device takes nothing of a sender's connection older than one it took of the same run, even one it never heard before: else a relay that held an older connection's messages, and sent them on after the newer's, would turn the device back to the older epoch, and it would drop all of the newer till one of the two connected again. Of another run, or with no conn (a device before 0.18.0), it goes by the epochs alone, as before.

A device learns another's epoch from a hello sent to it, in three steps:

  1. As it joins, A sends ALL_DEVICES its hello with peer: null. No one can tell it is not an old one sent again, so it only asks for theirs.
  2. B answers A alone with its hello: peer A's epoch, reply: true. A takes it, and so knows B's epoch.
  3. A answers B with its hello: peer B's epoch, reply: false. B takes it, and so knows A's. Any hello whose peer is not the receiver's epoch now is answered as in step 2, and is not otherwise taken. Requests, answers and notifications go to one device, with its epoch; none goes to a device whose epoch is not known yet. An answer goes in the epoch its request came in.

PROTOCOL_VERSION

The version of what is sealed; a device tells it in its hello, and it is in the associated data, so a device of another version opens nothing.

SCHEMA_VERSION

This package's version, which a device tells in its hello (schema): the methods a device serves are those of its version, so another can leave out what an older one does not have. Kept equal to package.json's.

ROOM_KEY_INFO

The HKDF info that makes the room key from the account key.

aadOf

The associated data a message is sealed with: its routing, as the relay delivers it. A message the relay sends on to another device, or with another seq, does not open.

CAPABILITIES

What a device can do for another, as it says in its hello. The other side asks only for what is listed; a newer device lists more.

CAPABILITIES

sessions.list and sessions.watch, profiles.list.

CAPABILITIES

sessions.reorder, for the user wherever sessions is served. Since 0.21.0.

CAPABILITIES

User read receipts alongside sessions, with host unread results for chats and terminals. Since 0.23.0.

CAPABILITIES

Reading a chat: chat.read and chat.watch, its settings, commands, panel, images, tool calls; history.list.

CAPABILITIES

Acting in a chat: sending, answering, stopping, settings, commands, opening, resuming, renaming, closing; and answering the consent prompts waiting on the user.

CAPABILITIES

terminal.read and terminal.watch: a terminal's screen, as text.

CAPABILITIES

Typing into a terminal, opening, renaming and closing one.

CAPABILITIES

files.list, files.read, files.find and files.search, in a workspace's folders.

CAPABILITIES

Workspace file writes and directory creation, with agent control. Since 0.14.0.

CAPABILITIES

git.status, git.diff, git.log and git.show of a workspace.

CAPABILITIES

notes.list and notes.attach: a workspace's notes, and photos put into one.

CAPABILITIES

folders.list and workspace.create: going through the device's folders and adding one as a workspace. Only the user's: an agent's request is refused. Served while chat.control is. Since 0.12.0.

CAPABILITIES

Takes agents' requests (from: nexus on another device) to act in its chats and terminals, as the user set it (Settings › Remote: ask or allow). A request with from needs it and the method's own capability (chat.control, terminal.control) both: an agent may do no more than people may from other devices. One with from from a phone (ios, android, web) is refused: no agent runs there.

CAPABILITIES

Extended agent CLI operations, since 0.15.0.

CAPABILITIES

Read the layers for a new chat and edit profile layers, since 0.16.0.

CAPABILITIES

Read profile subscription limits, since 0.17.0.

CAPABILITIES

Sends push notifications to the account's phones for what waits on the user here. Since 0.18.0.

CAPABILITIES

system.stats: how busy a workspace's host is. Only the user's: an agent's request is refused. Served only where files is. Since 0.26.0.

CAPABILITIES

chat.peek: a chat's last turns at a glance, read without opening it. A device serves it only where it serves chat.read, and reads no more than chat.read does; an agent's request (from) is taken as chat.read's is. Since 0.27.0.

CAPABILITIES

profiles.usage.people: profiles.usage is taken from people too, not only from agents. Served wherever profiles.usage is. Since 0.30.0.

CAPABILITIES

profiles.connection: profiles.list takes connection and profile and answers each profile's connection settings and whether a key is saved, never a key. Since 0.38.0.

CAPABILITIES

files.grants: files.resolve and files.grant, and files.read's grant, for files outside the workspace's folders that a chat names. Served only where files and chat.read are, and only to people. Since 0.40.0.

HelloSchema

A device introduces itself: to all the room as it joins, and to one that just joined. What it serves of its own sessions is serves; a device that only watches others (a phone) serves nothing.

HelloSchema.app.theme

The app's color theme now, by its id ("github-dark"): a phone may follow it.

HelloSchema.schema

The protocol package's version it speaks (SCHEMA_VERSION, "0.7.1"); absent before 0.2.0. A method it does not have is answered MethodNotFound.

HelloSchema.reply

Whether it wants the other's hello back: true as it joins (to all), and as it answers a hello it could not take (see the top of this file).

SealedMessageSchema

A sealed message's content.

EPOCH_BYTES

The random bytes of a connection's epoch, which goes as unpadded base64url.

EpochSchema

A connection's epoch (see the top of this file).

SenderConnectionSchema

Which of its sender's connections a message comes in (see the top of this file). Since 0.18.0.

SenderConnectionSchema.boot

The sender's run: random, as an epoch is, made once as its room starts.

SenderConnectionSchema.n

The connection's number in that run, counted from 1: each new one is higher.

olderConnection

Whether a message of a sender's epoch not heard yet comes in a connection older than the one of the epoch heard of it now, so it is not taken: only when both say their connection, of the same run.

SealedEnvelopeSchema

What is sealed: a message, with the epochs that tell it fresh (see the top of this file).

SealedEnvelopeSchema.epoch

The sender's epoch now.

SealedEnvelopeSchema.conn

The sender's connection it comes in; absent before 0.18.0.

SealedEnvelopeSchema.peer

The receiver's epoch, as it told it; null only in a hello to ALL_DEVICES.

rpc.ts

What one device asks another, sealed: JSON-RPC 2.0 requests, their answers, and the notifications a watch sends. The device that runs the sessions serves; the one that shows them asks.

A session is named by the serving device's own ids: its workspace's and its tab's. The same folder has other ids on another device.

JSON-RPC 2.0 shapes

RpcResponseSchema

The error first: result: z.unknown() takes an object without one too, and would strip an error answer's error.

RpcErrorCode

The error codes: JSON-RPC's own, and the protocol's from 1000.

RpcErrorCode.NotFound

No such workspace, tab or watch on the serving device.

RpcErrorCode.Forbidden

The serving device does not let this device do it.

RpcErrorCode.Unavailable

The session cannot do it now: a chat with no request waiting, one whose program is gone.

RpcErrorCode.GrantExpired

A file grant timed out or was dropped to keep the host's limit: ask files.grant again, once, in a flow the user started. Since 0.40.0.

Sessions

readableList

A list a newer version may add to: an item this version cannot read, as one of a kind or state it does not know, is left out rather than failing the whole answer, and the list is cut to max. So a device of a newer version that adds an agent's state hides that agent from an older one, not every session of the computer. Since 0.12.1.

RemoteWorkspaceSchema

A workspace of the serving device.

RemoteWorkspaceSchema.path

Its folder, on the serving device.

RemoteWorkspaceSchema.parentId

A task: a workspace on a git worktree of the workspace parentId, on its own branch.

RemoteWorkspaceSchema.manager

The agent manager's own workspace, where the session that directs the others runs.

RemoteWorkspaceSchema.pinned

Pinned to the top of the sidebar. The list comes in the sidebar's order (pinned first, a task after its workspace). Since 0.11.0.

RemoteWorkspaceSchema.git

Its branch and how it stands against its upstream, with how many files it changed and did not commit. Looked at now and then, not live. A device may tell it for tasks only, and none where it is no repository.

SessionStateSchema

Where a session stands, as the agent lists show it.

MAX_SESSION_AGENTS

Most agents a session's entry lists.

MAX_AGENT_DESCRIPTION

Longest an agent's description is, in characters.

MAX_CHAT_RUNS

Most claude -p and codex exec runs chat.runs tells.

MAX_RUN_TEXT

Longest a run's prompt, answer or message is told, in characters.

ChatRunSchema

A claude -p or codex exec run a chat's session started, as the serving app recorded it and its chat shows it beside its subagents: as chat.runs lists it, what its row shows; chat.run tells its tools, messages and answer too.

ChatRunSchema.program

"codex" for a codex exec run; absent for claude -p.

ChatRunSchema.endpoint

Where its model is served when not by its program's own API: the gateway's host.

ChatRunSchema.prompt

What it was asked: its start, as chat.runs tells it; all of it (to MAX_RUN_TEXT) from chat.run.

ChatRunSchema.toolsTold

Whether its tools are told (its output is a stream of events).

ChatRunSchema.sessionId

Its session's id, which chat.resume goes on with in a tab of its own.

ChatRunSchema.current

The tool it runs now, as "Bash npm test"; from chat.runs.

ChatRunSchema.last

What it wrote last: its answer once it ended; its start, from chat.runs.

ChatRunSchema.tools

Its latest tools, oldest first; from chat.run.

ChatRunSchema.messages

Its latest messages, oldest first; from chat.run.

ChatRunSchema.answer

Its answer, once it ended; from chat.run.

RemoteSessionAgentSchema

An agent a session runs beside its turn, as the serving app's agent list shows it under the session's row: a subagent of its Claude Code, or a claude -p or codex exec run started inside it ("print").

RemoteSessionAgentSchema.id

The subagent's agent_id, or the run's own id.

RemoteSessionAgentSchema.program

For a run: the program it runs; "codex" for a codex exec run.

RemoteSessionAgentSchema.type

The subagent's type, as "Explore".

RemoteSessionAgentSchema.description

What it was asked to do, on one line; for a run told nothing more, its prompt's start.

RemoteSessionAgentSchema.start

When it started, in Unix milliseconds.

RemoteSessionSchema

An agent session or terminal of the serving device.

RemoteSessionSchema.failed

The last turn ended in error. Keep state as before for older readers. Since 0.22.0.

RemoteSessionSchema.since

When it came to that state, in Unix milliseconds. Hosts serving sessions.markSeen report unread chat and terminal results as new-result, with their result time here. Return that time as upTo to mark the result seen. Failures keep their prior state.

RemoteSessionSchema.last

The last thing it said, a line.

RemoteSessionSchema.profile

The agent profile it runs with.

RemoteSessionSchema.cwd

The folder a chat runs in, when it is not its workspace's (a folder under it, or one it was given): its links are written from there. Since 0.11.0.

RemoteSessionSchema.agent

The agent a terminal runs (claude, codex), or another that notifies ("agent"); absent for a terminal that only has its shell, which the lists keep out of sight until asked for. Never on a chat.

RemoteSessionSchema.waiting

What it waits on the user for, when it does. Since 0.12.1, one this version cannot read (a kind it does not know) is left out, and the session stays: one that waits on the user is the last to hide.

RemoteSessionSchema.waiting.requestId

A terminal's Claude Code asking: the request terminal.answer answers.

RemoteSessionSchema.waiting.always

With a requestId: whether its Claude Code offers to allow it always (terminal.answer's allowAlways). Since 0.13.2; absent before, when it may or may not.

RemoteSessionSchema.waiting.subagent

With a requestId: a subagent's reques