@@ -819,6 +819,8 @@ or removing a command fails until the table changes in the same commit.
819819| `remote.startForward` | Forward a local port to a port as the remote host sees it |
820820| `remote.stopForward` | Stop one port forward and close its local port |
821821| `remote.forwards` | List the running port forwards of one connection |
822+ | `remote.connections` | Read the SSH connections the user saved |
823+ | `remote.editConnections` | Save, remove or record a folder on one saved SSH connection |
822824| `git.historyRewritePreview` | Review undo, message edit, squash, or drop with complete messages, eligibility, and an immutable checkout expectation |
823825| `git.remotes` | Return configured fetch remote names and URLs |
824826| `git.tags` | Return tag names, tag object IDs, target IDs, dates, and annotations |
@@ -5664,10 +5666,28 @@ place.
56645666
56655667`remote.probe` checks a saved SSH connection before a remote workspace is
56665668opened. The request is `{ connection: { host, port?, user?, authentication?,
5667- identityFile?, connectTimeoutSeconds?, keepAliveSeconds? } }`; unknown fields,
5668- including any password, are rejected. `authentication` is `auto` (default),
5669- `agent`, `privateKey` (requires `identityFile`), or `password`. `host` is a
5670- name, address, or SSH configuration alias without a user.
5669+ identityFile?, proxyJump?, connectTimeoutSeconds?, keepAliveSeconds? } }`;
5670+ unknown fields, including any password, are rejected. `authentication` is
5671+ `auto` (default), `agent`, `privateKey` (requires `identityFile`), or
5672+ `password`. `host` is a name, address, or SSH configuration alias without a
5673+ user. Text fields are trimmed and empty optional fields dropped first;
5674+ `identityFile` is dropped unless `authentication` is `privateKey`. Then:
5675+
5676+ | Field | Accepted |
5677+ | --- | --- |
5678+ | `host` | 1 to 1024 bytes of ASCII letters, digits and `._-:%`, not starting with `-` |
5679+ | `port` | 1 to 65535; absent keeps the SSH configuration's port |
5680+ | `user` | at most 1024 bytes of ASCII letters, digits and `._-`, starting with a letter, digit or `_` |
5681+ | `identityFile` | at most 1024 bytes, no control characters; quoted for OpenSSH when it has spaces |
5682+ | `proxyJump` | `none`, or comma-separated `[user@]host[:port]`; absent keeps the SSH configuration's jump hosts |
5683+ | `connectTimeoutSeconds` | 1 to 600; absent is 15 |
5684+ | `keepAliveSeconds` | 1 to 3600; absent keeps the transport's default |
5685+
5686+ A refused connection is `invalid_request` whose `details` is the JSON
5687+ `{ field, reason }`, where `reason` is `required`, `invalid` or `tooLong`.
5688+ Every field becomes an allowlisted SSH option; options that run a local
5689+ command, such as `ProxyCommand`, are only read from the user's own SSH
5690+ configuration.
56715691
56725692Core runs the system `ssh` with the probe of
56735693[`remote-workspace-protocol-v1`](remote-workspace-protocol-v1.md)'s bootstrap
@@ -5692,7 +5712,7 @@ The result is `{ status, host, diagnostics }`:
56925712`host` is `{ system, machine, homeDirectory, serverTarget }` from `uname -s`,
56935713`uname -m` and `$HOME`; `serverTarget` is the server's Rust target or `null`.
56945714`diagnostics` is the redacted end of OpenSSH's standard error (at most
5695- 4 KiB). A malformed connection is `invalid_request`, a missing `ssh` is
5715+ 4 KiB). A malformed connection is `invalid_request` as above , a missing `ssh` is
56965716`runtime_missing`, and cancellation or the five-minute bound are `cancelled`
56975717and `timed_out`.
56985718
@@ -5701,19 +5721,75 @@ and `timed_out`.
57015721`diskTotalBytes` and `diskAvailableBytes` (the file system holding `$HOME`),
57025722and `uptimeSeconds`.
57035723
5724+ #### Saved connections
5725+
5726+ The connection window lists the SSH connections the user saved. Native
5727+ clients keep them in one machine-local document, read it, and publish the
5728+ `document` an edit returns atomically, as for the trust decisions; Core
5729+ validates the document and applies every edit.
5730+
5731+ `remote.connections` accepts `{ document: string|null }` and returns
5732+ `{ connections, storage: { relativePath: "remote/connections.json",
5733+ maximumBytes: 262144 } }`. `connections` is the list in the user's order;
5734+ each entry is `{ id, name, connection, recentFolders? }`, where `connection`
5735+ is the object `remote.probe` takes and `recentFolders` holds at most 10
5736+ normalized absolute host paths, most recent first.
5737+
5738+ `remote.editConnections` accepts `{ document }` with exactly one of:
5739+
5740+ - `save: { id?, name, connection }` normalizes and checks the connection,
5741+ then adds an entry with a new id or replaces the entry `id` in place.
5742+ `name` is trimmed, 1 to 128 characters without control characters, and
5743+ unique among the entries regardless of case. Replacing an entry with
5744+ another `host`, `port`, `user` or `proxyJump` clears its recent folders,
5745+ which belong to the target and not to the name.
5746+ - `remove: { id }` removes the entry; an absent id changes nothing.
5747+ - `rememberFolder: { id, path }` moves `path` to the front of the entry's
5748+ recent folders and keeps 10.
5749+
5750+ The result is `{ changed, document: string|null, connections, id? }`; `id`
5751+ names the entry a save wrote. An unchanged edit returns a `null` document and
5752+ must not create a source. Requests never carry a secret: a password field is
5753+ an unknown field and is rejected.
5754+
5755+ Bounds: 256 KiB per document and 128 entries. A document that cannot be
5756+ decoded, has duplicate keys, unknown fields, another version, a malformed
5757+ entry, or an id or name used twice is `parse_failed`; a malformed request or a
5758+ refused edit is `invalid_request`. Both carry `details` as the JSON
5759+ `{ field, reason }`, where `reason` is `required`, `invalid`, `tooLong`,
5760+ `duplicate`, `full` (128 entries) or `unknown` (no entry has the id).
5761+
5762+ Native clients keep the document below their platform user-preference
5763+ directory, never on a host, in a workspace or in an installed package. This
5764+ user-settings resource does not affect code signatures or update deltas.
5765+
57045766#### Remote connections that stay open
57055767
5706- `remote.connect` takes `{ connection, servers: [{ target, path }],
5768+ `remote.connect` takes `{ connection, servers: [{ target, path, sha256 }],
57075769serverVersion, installRoot? }`. `servers` are the read-only server builds the
5708- host ships, by Rust target; `installRoot` defaults to `$HOME/.lithe-server`.
5709- One OpenSSH process probes the host, keeps an installed server whose
5710- `--identity` reports the same SHA-256 or uploads the matching build through
5711- the same stream, and starts it, so the user authenticates once. Prompts are
5712- relayed as for `remote.probe`. The result is `{ status, session, host,
5713- diagnostics }`; `session` is `{ id, uploaded, hostName, userName,
5770+ host ships, by Rust target; `sha256` is the build's SHA-256 as 64 hexadecimal
5771+ digits, taken from the manifest the application ships and signs with the
5772+ builds, never computed from the file Core is about to send. `installRoot`
5773+ defaults to `$HOME/.lithe-server`. One OpenSSH process probes the host, then
5774+ Core reads the build for the host's platform once and compares it with its
5775+ `sha256`; the bytes it checked are the bytes it sends. The host keeps an
5776+ installed server only when its own `sha256sum` or `shasum` computes that
5777+ SHA-256; otherwise it receives the build through the same stream, checks it
5778+ the same way (a host with neither tool checks the size and `--identity`, and
5779+ never reuses that upload), and starts it, so the user authenticates once.
5780+ Prompts are relayed as for `remote.probe`. The result is `{ status, session,
5781+ host, diagnostics }`; `session` is `{ id, uploaded, hostName, userName,
57145782homeDirectory }` and is set only for `connected`. A host without a matching
57155783build is `unsupportedPlatform` and nothing is uploaded.
57165784
5785+ A malformed connection, an unknown `target` or a `sha256` that is not 64
5786+ hexadecimal digits is `invalid_request`, before OpenSSH starts. A missing
5787+ `ssh` is `runtime_missing`. When the build for the host's platform cannot be
5788+ read or its SHA-256 differs, the attempt ends as `remote_server_invalid`
5789+ without sending anything; `details` says which of the two happened and, for a
5790+ mismatch, the SHA-256 Core computed, but never the path. Cancellation and the
5791+ five-minute bound are `cancelled` and `timed_out`.
5792+
57175793Core keeps an open connection until `remote.disconnect` (`{ sessionId }`,
57185794returning `{ closed }`) or until the host process exits; ending it terminates
57195795the OpenSSH process tree. `remote.closeAll` (no payload, returning
@@ -5730,8 +5806,8 @@ the remote server running. Requests over it take `sessionId`:
57305806| `remote.hostInfo` | `{ sessionId }` | the original connection's handshake `host`, including OS, architecture, home and features |
57315807| `remote.uploadFile` | `{ sessionId, sourcePath, path, sha256, mode }` | verified `{ size, sha256 }` |
57325808| `remote.runWatch` | `{ sessionId, params: { root, excludeNames? } }` | waits until root removal or cancellation; relays `watch.started`, `watch.changed`, `watch.error` |
5733- | `remote.runProcess` | `{ sessionId, params: { argv, cwd?, environment?, env?, pipeStdin? } }` | leader exit; relays `process.started`, `process.output`, `process.exit` |
5734- | `remote.runTerminal` | `{ sessionId, params: { argv?, cwd?, env?, columns, rows } }` | leader exit; relays `terminal.started`, `terminal.output`, `terminal.exit` |
5809+ | `remote.runProcess` | `{ sessionId, params: { argv, cwd?, environment?, env?, pipeStdin?, label? } }` | leader exit; relays `process.started`, `process.output`, `process.exit` |
5810+ | `remote.runTerminal` | `{ sessionId, params: { argv?, cwd?, env?, columns, rows, label? } }` | leader exit; relays `terminal.started`, `terminal.output`, `terminal.exit` |
57355811| `remote.captureProcess` | `{ sessionId, params, timeoutMilliseconds, maxOutputBytes }` | base64 `stdout`, `stderr`, nullable `exitCode` and `signal` |
57365812
57375813`remote.writeFile` replaces the file atomically on the host. With
@@ -5742,7 +5818,9 @@ fails with `connection_closed` and is forgotten, so the host reconnects; an
57425818unknown or closed `sessionId` is also `connection_closed`.
57435819
57445820`remote.hostRequest` accepts finite filesystem, environment and port queries,
5745- plus controls of existing processes and terminals. Creating a watch, process,
5821+ `server.state` (what still runs, with the `label` given at start, so the host
5822+ can ask before closing a window), plus controls of existing processes and
5823+ terminals. Creating a watch, process,
57465824terminal, walk or tunnel through that command is `invalid_request`; creation
57475825requires an owner that subscribes before sending the start request. Streamed
57485826Core events use `{ type: "remote", event, params }`. Resource IDs are allocated
0 commit comments