Repository navigation
feat(remote-access): cross-network remote access to the EduWork agent (minimal prototype, Draft) - #180
feat(remote-access): cross-network remote access to the EduWork agent (minimal prototype, Draft)#180Paraso42 wants to merge 51 commits into
Conversation
…pairing First slice of the remote-access plugin: the two pieces that do not depend on the DSH runtime, so they can be verified on their own before any of the transport work starts. lib/registry.js owns the durable device list. A device reaches `trusted` only through a local confirmation, never because a relay said so, and the host management surface stays closed by default. Revocation returns the revoked record, because revoking is not finished by writing a file: the caller must also close every live connection that device holds. A revoked device id cannot be revived by re-pairing. lib/pairing.js owns one-time invitations. Redemption consumes the invitation before validating it, so a replay, a late attempt and a typo all leave the same state behind and nothing distinguishes them. Codes are stored as digests, so a leaked registry does not hand out live invitations. Invitations are deliberately separate from the device credential they help create, and from relay access keys, which authorize relay use only. Both modules are pure apart from node:crypto and take the current time from the caller, which is what makes the pairing and revocation semantics testable. Tests run with `node --test` (47 cases). Not yet implemented: the protocol, the encrypted channel, the settings panel and the relay. No configuration change.
…registry The two pieces that decide whether the remote-access acceptance items can hold, kept pure so they can be tested rather than argued about. lib/gate.js is the only place that decides what a remote device may ask the Host to do. The layer below admits every request as the operator once the Host fence and browser authentication pass, so narrowing has to happen here or not at all. It is deny-by-default: an operation absent from the table is refused, a surface absent from the grant is refused, and the host management surface is unreachable in v1 no matter what a device record contains. Narrowing is a table edit, which is the point — the diff is the review. lib/connections.js tracks live connections per device. Revocation is not finished by rewriting a record: upstream states that existing requests continue when a listener refuses subsequent requests, and an established stream keeps delivering events until it is closed. Revocation therefore seals the device and closes everything it holds, and a connection attempted during the sweep loses rather than slipping through. Together these cover the acceptance items "an unauthorised device cannot reach sessions or files" and "a revoked device's connection stops working" at the level where they can be decided without a network. Tests run with `node --test` (76 cases across four modules). Not yet implemented: the listener, the loopback forwarding, the client and the protocol. No configuration change.
The four credential kinds are deliberately independent and the review direction is that they never collapse into one token: the pairing invitation admits a device once, the device credential proves which device is calling, the relay access key says only "you may use this relay", and the browser session is what the Host itself issues. Collapsing any two means one leak escalates into the other, so this store owns exactly one of them and the device registry owns none. Two properties carry the acceptance items. Only a digest is stored, so a file that yields working credentials cannot turn any read of the Host into a permanent impersonation; a secret is returned once, at mint, and is never recoverable. Comparison is constant time, because a byte-by-byte comparison leaks the matching prefix through timing and that is enough to walk a credential out one character at a time. Re-issuing replaces a device's credential rather than adding a second one, so a re-paired device does not leave its previous secret working. Revoking drops the credential outright rather than disabling it, so "revoked" and "has no way to authenticate" are the same state and cannot drift apart. Tests run with `node --test` (94 cases across five modules). Not yet implemented: the gated relay that consumes these, the client and the protocol. No configuration change.
The package had no entry point and no written contract, which made it a set of modules rather than something another DSH application could adopt. `docs/protocol.md` fixes the contract between device, relay and host. Three points in it are decisions rather than descriptions, and each one exists because the obvious alternative fails: - The gate runs **before** the host: an unauthorised request is answered by the relay and never reaches the host. If the 401 came from the host the request had already arrived, and the acceptance item would be satisfied only on paper. - Revocation is **three** actions: drop the credential, seal the device id so a connection mid-handshake loses, and close every connection the device holds. A stream that survives keeps delivering events, so refusing the next request alone is not revocation. - The relay does **not** deduplicate. It never re-sends, never rewrites the payload, and forwards a repeated `requestId` rather than swallowing it — only the host can judge whether a second send is a repeat. The README pair follows the repository convention: Chinese entry with a `README_EN.md` companion, identical heading structure and matching commands. Both state plainly which parts are implemented and which are planned. `scripts/check-source-docs.mjs` reports 767 links, 38 README pairs, no broken links and no README issues. Tests run with `node --test` (94 cases).
Two problems found reviewing the implementation against its own protocol notes. The device list answered every caller that could reach the relay port, so an unpaired one could enumerate the paired devices by name and id. Device names are not secrets, but the list is the operator's view of this machine and a remote client has no use for it. It is now restricted to a loopback peer, with the mapped `::ffff:` form unwrapped — a comparison that forgets to do that locks the operator out of their own list on a dual-stack listener. Pairing redirected straight at the host, which is wrong while the device is still pending: the browser holds the request open until somebody presses y on this machine, and times out if they take a moment. It now lands on a self-contained waiting page that polls `/__remote/status` and moves on when the decision arrives. `/__remote/status` answers only the caller about itself, so it cannot be used to observe another device. The launcher also prints one pairing link per reachable address rather than only the top-ranked one. The invitation is single use, so one code across several links is correct — a link that never leaves the laptop costs nothing, while a user whose phone sits on a different network than the address that happened to sort first would otherwise be stuck. Tests run with `node --test` (25 cases for the relay, 94 for the plugin) and the launcher passes 18 end-to-end checks against an isolated DSH home.
The relay lived outside the repository while the protocol document describing it lived inside, so the repository shipped a contract with no implementation behind it. It is now `lib/listener.js` with its tests in `test/listener.test.mjs`, importing the registry, pairing, credentials and connection modules through ordinary relative imports rather than absolute paths resolved at runtime. The honest split is by what holds a resource. The logic modules still perform no I/O and take the current time from the caller, which is what lets the pairing and revocation semantics be tested directly. The listener is the one module that opens a file and a socket, and it leaves storage location, listening port and topology to the deployment — the harness that drives it for phone testing stays outside the repository and now imports the gate instead of carrying a copy. Full suite: 119 cases pass, up from 94, because the relay's own tests moved in alongside the code rather than being left behind with it. The launcher that wires this to a real DSH host still passes its 18 end-to-end checks against an isolated home.
…packages/ The package was named `@chatecnu-work/dsh-remote-access` and lived in `dsh-plugins/`, which is the institution-specific location and scope. That contradicts the point of the work: the protocol is meant to be usable by any DSH application, and `docs/PACKAGES.md` puts it plainly — public plugins are maintained here under `@eduwork/*`, while "机构专属实现留在 EduWork-ECNU". Moved to `packages/dsh-remote-access` and renamed. `src/` is what the tests run against; `lib/` is the published artifact, produced by `scripts/build.mjs`. The build is a copy rather than a bundle, deliberately: with no transform in between, the artifact under test and the artifact published cannot diverge. Registered in `scripts/packages/catalog.mjs` so the package tooling sees it, and added the `LICENSE` and `NOTICE` the other public packages carry. `CHANGELOG.md` and `cordis.patch.yml` are not added: both describe a released, assembled package, and this one is neither. Verified: `npm run build`, 119 tests, `manage.mjs list` reports the new id, `check-source-docs.mjs` clean (767 links, 38 README pairs), and the phone-access harness passes its 19 end-to-end checks against the built `lib/`.
…cuted `src/index.js` is what `main` and every `exports` path lead to, and it had only ever been syntax-checked. Importing it needs the three peers installed, and nothing in the test run installed them, so the entry point was the one file in the package no test had ever run. Installing them and adding `test/index.test.mjs` turned up three defects in `DeviceRegistry.upsert`, all in the same method: - It documented itself as "record a device that has been seen" and then threw when the caller omitted `status`, because the registry layer requires one. - It passed the caller's object straight through, and `upsertDevice` swaps the whole record, so a device reconnecting lost `pairedAt` — the record of when it was admitted — along with any other field the caller had not sent. - It accepted a caller-supplied status, which cuts both ways: a habitual `status: 'pending'` silently withdraws a device the operator confirmed, and a `'trusted'` in the same position grants access with nobody having confirmed anything. Status is now decided by the method, not the caller: a new device is pending, an existing one keeps its status, the value sent is ignored, and the record is merged rather than replaced. A revoked device id refuses an upsert outright — recording another sighting would let a caller rewrite the identity behind a credential that was withdrawn. Two smaller corrections found by the same test. The settings namespace was `chatecnu-remote-access`, which puts a school's name into a package that is supposed to be institution-neutral. And `dsh-settings` was pinned to a single version where the repository convention is a `||` range. The protocol document was wrong too: the device record carries `pairedAt` and `lastSeenAt`, not the `createdAt`/`confirmedAt`/`revokedAt` it described. It now states what the fields are, that revocation time is only reachable through `lastSeenAt`, and why an unreadable stored row stops the registry rather than being skipped. 132 tests pass, up from 119; build, `check-source-docs.mjs` and the phone-access harness's 19 end-to-end checks are unchanged and green.
…ge's check Two things the last round's document audit turned up. The protocol document promises that a wrong invitation code, a spent one, an expired one and a missing one cannot be told apart. That is a security property rather than a nicety: answers that differed would confirm which guesses were closer and reveal whether an invitation had ever been issued at all. It held — `DeviceStore.redeem` collapses every cause into one reason, and the relay answers a single 403 — but it held in prose, with nothing to stop a later edit from splitting the cases apart. The test now spends all four against a live relay and requires one status, one body and no credential, and it checks that the failures register no device. It closes the servers before asserting, so a failure reports itself instead of hanging the run. `manage.mjs check` had never been run against this package, and could not be: the `group`-to-scripts map is hard-coded, so an unregistered group reached `for (const script of undefined)` and died as `scripts[selected.group] is not iterable` — a message pointing at the loop rather than at the missing entry. The entry is added, and the absent case now says which group has no check registered. `dsh-remote-access` checks clean: build and 133 tests. Also verified, though nothing here needed changing: no tracked file carries a local machine path, this machine's addresses, its domains or account names, and none of the files this branch touches does either. The two credential-shaped matches are the repository's own detectors.
The host serves live session output over a WebSocket at `/api/remote.mux`, admitted by the same host check as everything else. The relay only ever listened for `upgrade` on its upstream request, and Node emits that event for a 101 alone. When the host refuses — its admission check answering 403, say — it sends an ordinary HTTP response, no event fires, and the relay wrote nothing at all to the phone's socket. Nothing upstream of that is visibly wrong. The page loads, `/` returns 200, the session list arrives, and then the connection that carries every subsequent update never finishes its handshake. On a phone that reads as an app which opened and then quietly stopped changing, with no error on either side to explain it. It is the kind of failure that gets blamed on the network for a week. The refusal is now written back through the socket before it is closed, so the client fails where the failure is. Two tests cover the channel: one drives a host that refuses the upgrade and requires the 403 to arrive rather than the socket to sit there, and one pairs a device without confirming it and requires that it reaches neither a response nor the host. The second one passes without any change, which is the answer to a question worth asking — the gate already covered upgrades, because it was written to before the forwarding was. The stream a revoked device held is also already torn down, since `closeAll` tracks upgrades alongside requests. 135 tests pass, up from 133. The end-to-end probe against a real host and a real launcher now also establishes the WebSocket through the relay — `101 Switching Protocols` — and confirms that a revoked device cannot reopen it.
…s not enforce The README described the operation fence as working — "a remote client cannot reach host management" — and listed it as implemented. `docs/protocol.md` called it a hard gate. None of that was true. `decide()` in `./gate` had no caller, and `./listener` admits by path and never looks at an operation. This is the most serious kind of defect a security-adjacent package can carry: not a hole, but a document telling its reader there is a wall where there is only a drawing of one. The correction is not "wire it up", because wiring it would not take the authority back. For the phone to get through the host's own door, the relay has to hand it the host's launch credential — that is what the `/__remote/pair` redirect carries. The phone therefore holds a full host browser session, and no HTTP relay standing in front of it can subtract from what the host has already granted. A real fence has to run inside the host's own authorization layer. Saying so is more useful than adding a path table in front of a door that is already open. So the four places that asserted enforcement now state the actual position: `./gate` is implemented but unwired, it is input for the host-side fence rather than this stage's boundary, and a reader should not take its existence as protection. The English README mirrors all of it, and a "Known trade-offs" section now holds the three decisions that were previously only in unpublished notes — the phone holding host authority, the relay declining to deduplicate for the host, and the status of `./gate`. Two smaller corrections in the same vein. The launcher's confirmation prompt told the operator the device would not receive the host management surface; it now says what the device actually receives. And the README's opening line no longer lists the fence among the package's working parts. A test records the limitation instead of leaving it to prose. It asserts that paths naming host management are forwarded today, so the gap appears in test output rather than only in a document, and it fails the day someone wires the fence — that change should be a decision, not a surprise. 136 tests pass, up from 135. `check-source-docs.mjs` reports 38 README pairs and no issues, and both READMEs still have nine headings each.
…/api once it has Two defects, both invisible to a test suite that talks to the relay with `fetch`, and both fatal to the phone the feature exists for. Found by putting a real browser in front of a real host through the real launcher. **Pairing never completed.** The waiting page polls `/__remote/status` and nothing else, and the confirmation prompt hung off an *armed* request arriving at the gate. A browser sitting on the waiting page never sends one, so the operator was never asked: the phone waited on its page, nothing appeared on the machine, and both sides sat there indefinitely. That is not a slow path — it is the entire pairing flow failing to complete, and it would have looked to the operator like the feature simply not working. It survived every earlier check for a reason worth recording. The tests confirm devices by calling `store.confirm()` directly, so they never walk the flow a person walks, and the end-to-end probe fetched an armed path immediately after pairing, which triggered the prompt by a route the waiting page does not have. One run even appeared to succeed because the browser asked for `/favicon.ico` — an armed path — and that fetched the prompt as a side effect; the second run reused the cached 404 and hung. A flow that only works when something incidental knocks on the right door is not working. `/__remote/status` now asks the operator when the device is still pending, which is the question the page is actually asking. Two consequences had to be handled with it. A refusal is now recorded by revoking the device, because the page polls every second and a half and a device left pending would put the same question to the operator forever; revoking also gives the page the one answer it can display, which is that the device was turned down and has to pair again. And a relay configured with no `onRequest` does not revoke anything — having nowhere to ask is a deployment that cannot confirm, not an operator saying no, and it must not start withdrawing devices on its own. **Every /api call from a browser was a 403.** The host's fence requires an attached Origin to be same-origin with the Host it is given. The relay rewrote Host to the loopback authority and forwarded Origin untouched, so the two could not agree. Node's `fetch` sends no Origin at all, and the fence returns true the instant it is absent — which is exactly how this passed every test here while turning a real browser's session into a page that loads and then does nothing. Origin now moves with Host, and `sec-fetch-site` deliberately does not: a request the browser marked cross-site must keep saying so, because that check is what still stops a hostile page from driving the host through the relay. Both are covered by tests written in the shape that finds them — one follows the waiting page's own polling to the end, one drives a request carrying a browser's headers through a fake host that applies the host's real rules. Both were confirmed to fail against the unfixed code before being kept. Also verified against the running system rather than asserted: through the relay, a real browser paired, reached the client, rendered it, issued 62 `/api` calls with no console errors at all, and opened the session multiplexer's WebSocket. After `revoke`, the same browser got 401 for `/`, 401 for `/api/session/list`, and had its WebSocket refused. 139 tests pass, up from 136.
…ables The package ships two places a device can be recorded and nothing said so. `DeviceRegistry` in `./` is the product-facing service: it lives in the host's settings and holds devices only. `DeviceStore` in `./listener` is the one the relay actually consults: a single file holding devices, credentials and invitations together, so a revocation cannot leave the first two disagreeing. The relay cannot use settings — it runs standalone, with no Cordis host to inject one. Neither is wrong on its own, and the split is not an accident. What is wrong is reading the README's quick start, wiring up `DeviceStore`, and assuming that is the whole table. A device confirmed through one store is unknown to the other, and nothing in this package keeps them in step. Anyone assembling the plugin into the product has to decide which one is authoritative and make the other follow; the package does not do it and until now did not say it needed doing. Worth stating plainly because the failure mode is quiet in the worst direction: a device the operator revokes through the settings panel would keep working through the relay, since the relay never asked settings. That is a security-relevant silence, not a bookkeeping one. Documented in both READMEs under known trade-offs, and pinned by a test in `test/index.test.mjs` that drives both stores and asserts neither sees the other's device. The test deliberately records the separation rather than the wiring: if someone later unifies the two, its failure is the signal that this section and the integration contract have to change together. 140 tests pass, up from 139.
… socket The gate covers upgrades as well as requests, which is right, but the two refusal paths did not agree on how to say no. An ordinary request got `send(response, status, body)` — a real 401 or 403. An upgrade had `socket.destroy()` and nothing else, so the same device making the same rejected request got a status over HTTP and a bare reset over WebSocket. In a packet capture a bare reset is indistinguishable from the network having dropped, which is the one thing a refusal should never look like. The upgrade path now answers through a response-shaped object that writes to the raw socket, so a refused upgrade carries the same status the request would have. Two things this got wrong on the way, both worth recording: Passing that object to `gate` does nothing. `gate` only returns a verdict; answering is the caller's job, exactly as it is for ordinary requests. The first attempt handed the writing object to `gate` and left it unused, so the socket stayed silent and the change looked like it had been applied. It had not. Writing the status and then calling `socket.destroy()` discards it. `destroy` drops whatever has not been flushed, so the status line goes with it and the client is back to seeing nothing — the failure the branch exists to prevent, reached by a subtler route. It uses `socket.end()`. The existing test asserted the old behaviour (`assert.equal(answer, '')`, "a device that is not confirmed should not get any response"). That assertion was a choice, not a requirement, and it was pinning the inconsistency. It now asserts a 401 or 403. 140 tests pass.
…ng two known bugs `docs/protocol.md` was thorough about roles, credentials, the control plane, revocation, idempotency and versioning, and silent about the data plane. Read as an outside implementer would read it — "can I write a client from this?" — it left three gaps, two of which are bugs this work already hit and fixed. **`Origin` was never mentioned.** The document said a forwarded request has its `Host` rewritten to the loopback authority. That is necessary and not sufficient: the host's trust fence also requires the request's `Origin` to match the `Host` it sees, so rewriting `Host` alone makes every `/api` call fail with 403 — the page loads, nothing in it works, and neither side says anything useful. Anyone implementing a relay from this document would have reproduced exactly that. Why it survived review is the part worth writing down: Node's `fetch` sends no `Origin` at all, and the fence passes when it is absent. Every verification built on `fetch`, including this package's own relay tests, is structurally blind to that check. Only a real browser can prove it, which is how it was found. **`sec-fetch-site` is not to be normalised.** It now says so, and says what the check is for: a page inside the phone's browser being induced to drive the host. A relay that smooths it over signs on that page's behalf. **Upgrades.** The document mentioned WebSocket once, while describing revocation. It did not say that the upgrade path goes through the same gate — an implementer who gated requests and let upgrades past would have a silent authorisation bypass — nor that Node emits `upgrade` only for a 101, so an upgrade the host refuses is invisible to the client unless the relay writes the refusal back. **The line format belongs to the host.** §4 now records the v1 envelope, the response shape, the live-channel path and the fact that the parameter name inside `args` differs per method, while stating plainly that `@deepseek-ai/dsh-api-*` owns all of it. The relay must not parse it: a relay that understands payloads inherits the obligation to stay in step with host versions, which it cannot discharge. Verified against the implementation rather than written from memory: `Origin` is rewritten alongside `Host` on both paths (`src/listener.js:444`, `:497`), `sec-fetch-site` appears only in the comment explaining why it is left alone, refusals from the host are relayed (`:524`), and the upgrade handler calls the same `gate` (`:489`). This is the check that matters — an earlier README described a fence that had no caller, and a protocol document that states requirements the code does not meet would be the same mistake in a new place.
…pace events arrive Every upgrade test until now stopped at a refusal. The accepted path was never exercised by this suite: it was proven once by a harness probe against a real host, and otherwise taken on faith. That is the wrong way round, because the live channel is not an extra. The host exposes no endpoint that lists a workspace. Workspace results reach the client as `workspace/changes` events over this WebSocket, so a device that cannot hold the stream open cannot see what is in its workspace — not slowly, but not at all. Verifying it in a browser this round made the same point from the other side: of 353 `/api` calls the remote client made, exactly three concerned workspaces (`initializeDefault`, `fileReferences/list`, `sessionReferenceResolver/candidates`), and `fileReferences/list` answers per session and returns empty for a fresh one — correctly, since it lists what a session has referenced rather than what a directory holds. There is no listing call to find. The new test drives a fake host that accepts the upgrade and then closes it the way the real host does when a frame does not parse, and asserts three things: - the 101 and its `sec-websocket-accept` reach the device, so a real client can complete the handshake rather than merely receive a status line; - the close frame arrives **as its own bytes**, found by index rather than re-encoded — the relay must not understand the frame well enough to rewrite it; - the code `1008` and the reason survive. The close frame is the part worth pinning. A code and a reason are the only way a client tells a protocol error from the network having dropped, and a middle layer that pipes messages while swallowing the closing handshake leaves the device unable to say which happened, with everything it already received looking fine. `docs/protocol.md` now states both obligations, since they are the relay's and not the host's: the live channel carries workspace results, and close frames travel with their code and reason. One thing the test had to get right and this records: `server.close()` does not close sockets that have been upgraded. The first version passed and then never exited, and the fix is to keep the upgraded sockets and destroy them. 141 tests pass, up from 140.
…nd actually publish them
Compared against the five sibling packages, this one was missing exactly two files that
all five carry: `cordis.patch.yml` and `CHANGELOG.md`.
`cordis.patch.yml` is the functional one. It inserts the plugin row the host reads, and it
keeps the default off with the reason stated where an operator will see it: the plugin
publishes the device registry and opens nothing — no port, no listener, no network. The
gated relay in `./listener` is a separate module a deployment constructs explicitly. Remote
reach must not appear as a side effect of an upgrade.
Both files were checked rather than assumed. The patch parses under the runtime's own YAML
parser, its `name` equals the package name, and its `id` equals the `name` export in
`src/index.js` — the relationship `dsh-mail` shows at `src/host/index.js:7` against its own
patch row. `config: {}` yields `{enabled: false, devices: []}` from `SettingsSchema`, so an
unconfigured install is off.
**The part worth reading: adding them was not enough.** `npm pack --dry-run` listed
`LICENSE`, the READMEs, `docs/protocol.md`, `lib/*.js` and `package.json` — and not
`cordis.patch.yml`, because `files` did not name it. `npm pack` ignores what `files` omits
without saying so, so the package would have been published without the one file that tells
a host how to load it: installable-looking and uninstallable. All four siblings list
`cordis.patch.yml` in `files`; this one now does too, along with `CHANGELOG.md`,
`CHANGELOG_EN.md` and `NOTICE`. Verified by re-running the dry run and asserting each of the
six must-ship files is present.
The changelog records the unreleased state rather than a release. It says what exists, what
exists but is unwired, what is planned, and the two known limitations, and it says in the
first paragraph that it is not release notes to be copied — release notes are written once
a maintainer confirms them.
`docs/protocol.md` is deliberately unchanged: describing what assembly will involve belongs
in working notes, not on a user-facing page. Recorded outside the repository instead.
141 tests pass; the documentation check reports 38 README pairs with no broken links.
The protocol document said the host has no endpoint that lists a workspace, and that workspace results therefore reach the client only as events over the live channel. That is wrong, and a real phone disproved it: typing `@` in the mobile client listed a file created minutes earlier in the desktop workspace, over ordinary HTTP (`/api/fileReferences/list`). The conclusion was drawn from a probe in which that endpoint returned an empty array for a freshly created session. The empty array was real; the inference from it was not. An observation with an unexplained confound cannot establish that something does not exist — least of all when the endpoint is right there in the capture, having answered. Rewritten to separate the two questions they were conflated into: what a workspace *contains* travels over HTTP and survives the live channel dropping; what a workspace is *doing* travels as events on the live channel and does not. The earlier text predicted an empty workspace forever if the WebSocket failed, which is now known to be false. The document also records how the error happened, because the failure mode is the more useful part: one green-looking probe, one plausible story, and a requirement written into a contract on the strength of it.
… that cannot read it The package so far could identify a device and refuse an operation, but nothing could actually travel. This adds the two halves that make remote access real, with no runtime dependency added: only WebCrypto, which both Node and the browser already have. `src/channel/` is the end-to-end layer, deliberately transport-agnostic so one implementation serves the desktop Host and the browser client: - P-256 ECDSA proves identity, P-256 ECDH (ephemeral mixed with static-static) derives the secret, HMAC-SHA256 expands it, and AES-GCM seals each frame. `@noble/*` would have been the obvious choice and is excluded by the "no new runtime dependency" constraint, so this stays on the intersection of what both ends support. ChaCha20-Poly1305 and BLAKE2s are missing on both. The one real weakening is identity hiding, and only that. - Both sides sign the same transcript covering both ephemeral keys, so a relay that substitutes either key is caught rather than silently trusted. - Frames are a plain byte string: an 11-byte header plus AES-GCM ciphertext. The nonce is derived from the direction and sequence rather than sliced out of the header, because slicing it produced a 10-byte IV and every frame failed. `src/relay/` is the minimal self-hosted relay: a hand-rolled RFC 6455 server, the control protocol, and the forwarding that keeps a Host reachable without an inbound port, a dynamic DNS name or a certificate on the Host. The part worth reading before touching this is the control hand-off. Control frames and end-to-end frames share one socket, so each end says `ready` once. The device's READY is the hinge; the Host's only means it has finished reading control frames and is per-device, so `peer-gone` clears it. Two consequences are load-bearing and were both found by tests rather than by reasoning: - The Host routinely answers `hello` before the relay has parsed the device's READY, because the two sockets advance independently. Those frames are held and released in order once READY lands. An earlier version dropped them, which lost real traffic and killed the first handshake round. - Nothing else may be dropped silently. A frame that cannot be forwarded now closes the sender with a reason, because an endpoint waiting for an answer that cannot arrive cannot tell that apart from a slow peer. Tests are synthetic throughout: loopback only, temporary directories, generated keys. 175 pass, including two handshakes agreeing through the relay on an encrypted RPC in both directions.
…hat can The gate table has listed what a device may do since this package began, but nothing ever asked it: `listener.js` admitted by credential and path, and no module in the package joined a Host endpoint to an operation. A remote call therefore had no name as far as the fence was concerned, and a fence that is never consulted is not a fence. `src/channel/operations.js` is that join. The Host's endpoint names and the granted operation ids differ by one mechanical substitution — `session/list` is the endpoint for `session:list` — so the mapping lives beside the table it is checked against rather than being recomputed at each call site. Two properties matter more than the mapping itself: - It is a lookup, never an inference. An endpoint absent from the table is refused, so the reachable set stays a list someone wrote down. A probe with a name that merely looks plausible gets the same answer as a typo. - The device is judged before the endpoint is. This is `decide`'s order and it is preserved: an untrusted device asking for a nonsense endpoint and the same device asking for a real one must not be distinguishable, or the pair of answers becomes an endpoint oracle. The endpoint names are the Host's, not ours, and were read from the `typert.host.js` bindings shipped alongside the controllers rather than guessed. That matters for the failure mode: when the Host renames one, this table stops matching and the call is refused, instead of the mapping quietly continuing to name something that now means a different operation. Deliberately absent, and asserted as refused: `session/create`, `workspace/delete` and the whole host-management surface. The `session:prompt` and `session:cancel` entries are the reason a name-based fence is needed at all — they are the calls that make the Host act. Nine tests, exercising the refusals as hard as the allowances, including a check that every mapping entry names an operation the gate table actually lists.
…hrough a relay
This is the Host half: connect to a relay, prove which host id it is, complete an
end-to-end handshake with a device, and carry that device's calls to the local
RPC. The Host still listens on nothing. It dials out, which is why a relay can be
somebody else's machine without holding anything worth stealing.
The order of the last stage is the acceptance criterion and is written into the
code rather than left to call sites: decrypt, judge the device, judge the
operation, dispatch, encrypt. A refused call is answered by the Host itself, so
the device's bytes never reach the RPC - and that is asserted by watching the
dispatcher stay empty, not by reading the reply. A reply saying "refused" after
the call already ran is precisely the failure this test exists to catch.
Three real defects surfaced while testing this, all of which produced a link that
looked fine and then went quiet:
- binaryType defaults to blob, and new Uint8Array(blob) is an *empty* array
rather than an error. Every sealed frame therefore arrived as zero bytes and
failed as "shorter than its header and tag" - a socket setting wearing the
costume of a protocol bug. Set once, on both the tunnel and the test device.
- The WebSocket API rejects protocol-error close codes: close(1008) throws
DOMException: invalid code. The throw happened inside the handler that was
trying to report a bad frame, so the socket was never closed and a revocation
or a frame error silently failed to end the connection. Closing now goes
through one place that cannot throw, and the code travels in the reason.
- A refusal was returned as { ok, response } while the call sites sealed the
wrapper, so the whole error path shipped an envelope with no result. The
device could see that something was refused but not what.
Two relay changes were needed for the same reason, in the other direction. Device
frames that arrive before the relay has parsed the device own READY are now held
rather than punished, because a device sends READY and its first handshake frame
back to back and the relay may read them in either order - closing it for a race
it cannot observe is the same mistake as dropping the Host answer. And when a
Host disconnects, the relay now closes the device instead of only sending
peer-gone: a device left holding an open socket after its Host is gone waits for
a reply nothing can produce, and cannot tell that apart from a slow Host.
Seven tunnel tests, against a real relay on a real socket with a real device
handshake, covering the registration, an allowed call, four kinds of refusal, an
unpaired device, a device revoked mid-session, a replayed frame, and a relay that
refuses the host id.
…ransport
The tunnel decides whether a call may proceed and speaks the wire protocol; it
has no idea how to reach a DSH Host, and it must not learn. That contract changes
between releases, and a wire protocol that absorbed it would have to change with
it. This adds the one module that knows both, and wires it into the plugin entry.
A call travels as a synthetic browser request. The kernel mounts its RPC on /api
behind a fence that asks whether the target authority is trusted, whether the
request carries that authority's cookie, and whether the path names a registered
endpoint. The other way to answer on the Host's behalf is to intercept /api, which
is the single slot the browser transport already occupies and the design notes
forbid taking. So this becomes a browser for the length of one request: it mints
the cookie the Host would have given one, then hands a normal Request to the same
shared handler that serves the real one. A remote call therefore passes the same
checks as a local one rather than a parallel door that would need keeping in step.
The cookie is a real credential in this process, so it is never logged, never
sealed into a reply, and dropped when the authority it was bound to changes. The
cache holds the *promise*, not the value, so three concurrent calls mint one
cookie instead of racing into three.
Wiring, deliberately narrow: the tunnel starts only when remote access is enabled
AND a relay URL and host id are set AND the kernel exposes a connection. Any one
missing means nothing dials - and there is no fallback to listening, because
"remote reach appeared after an upgrade" is the outcome this design exists to
prevent. Those conditions are read inside the effect rather than before
registering it, so an operator who turns the setting on does not have to restart
to be believed.
`admit()` returns `{ peer }` or `{ rejection }`. Both are truthy, so reading it as
a boolean admits everything; the adapter reads the field, and a test asserts the
trap by checking the refusal object is truthy.
Package now declares `dsh.bundle`, which the loader requires, and exports the
relay modules. Eleven adapter tests run against a double that reimplements the
kernel contract from the kernel's side - deriving the authority from the Host
header, jarring cookies per authority, refusing a method that disagrees with its
path - because a double that echoed this module back would pass while it was
wrong. What these cannot show is that the running Host behaves this way: the
launch token is random process memory, so that check can only happen in-client,
which is why wiring to a profile is its own step.
…ntrol phase
The relay has two READY flags and worked out that only the device's READY opens
the link, so that the Host can answer `hello` before the device's READY has been
parsed. That reasoning is right, and the code did not follow it: `evaluate`
released held device frames with `link.host.forward(...)`, bypassing the
`forwarding()` gate that requires the Host to be ready. A Host that had not sent
READY received device traffic on a socket it was still reading as the relay's
control channel, and its own READY then arrived as data traffic.
Nothing threw. The device stalled against a Host that never saw its `hello`,
which is the worst shape a bug can have: it presents as a phone that connects and
does nothing.
Three things were wrong together:
* `evaluate` released both directions on the device's READY alone. Releasing is
per direction, because each READY releases a different one.
* `evaluate` returned early once `link.open` was set, so the Host's READY never
flushed anything. Flushing is now separate from opening and unconditional.
* The device handler forwarded on `link.open` without checking `hostReady`, and
closed the device when it could not forward. It now holds the frame in the
queue it was already using.
`test/relay-e2e.test.mjs` is new and is what caught it. It drives a real relay over
a socket with a real `HostHandshake` and a real `PeerHandshake`, so the ordering of
two independently-advancing sockets is real rather than simulated. The old
in-process tests passed throughout.
Also adds the operator side: `deploy/server.mjs`, a systemd unit, and
`scripts/build-deploy.ps1`, which assembles the tree `server.mjs` imports against
and refuses the placeholder bootstrap. The bootstrap itself stays out of this tree
— it is deployment-specific and the relay operator can replace it, so shipping a
default would be shipping everybody's configuration.
The relay injects a bootstrap <script> into the page it serves, and that address has to be one a *browser* can fetch. It is not always the path the relay serves the file on: when a reverse proxy publishes the relay under a prefix and strips that prefix before forwarding, the relay never sees the prefix, so its own idea of the path is the unprefixed one. The hardcoded default was therefore a 404 as soon as the relay was published under `/eduwork`, and the failure is silent in the worst way — the page loads, looks correct, and never connects. `EDUWORK_RELAY_BOOTSTRAP_SCRIPT` now sets it, validated as an absolute path at startup and echoed in the log so a deployment can see what it is actually telling browsers. The default stays the root-mounted path, which is right for a relay served at the root. Caught by `deploy/verify-public.mjs`, which checks the injected address rather than assuming it. The old build-deploy check asserted the constant this commit removes, so it now checks that the setting is read at all instead of pinning a value.
…ernel has
`resolveAuthority` read `webServer.url` and `webServer.address()`. The service
publishes neither — its surface is `{ port, host, register, registerUpgrade,
registerFallback, renderIndex, collectIndexInjections }`. The authority came back
undefined, the tunnel never started, and nothing reported it: remote access simply
did nothing, which is indistinguishable from the setting being off.
The shape is now the one the kernel itself uses. `dsh-desktop-host` builds the same
string as `http://127.0.0.1:${webServer.port}` before handing it to the shell, so
that is what this does, with a wildcard bind translated to loopback because the
cookie name is a hash of the authority and `0.0.0.0` names one the kernel never
sees. A kernel that grows a richer accessor is still honoured.
Two things made this survivable-but-silent, and both are fixed here. The startup
promise was `void`ed with no rejection handler, so a refused relay, a wrong URL or a
rejected host id all looked like the feature being switched off; failures now reach
the log. And the authority being absent is now reported rather than returned from
quietly.
The tests did not catch this because they supplied the shape the code expected
rather than the shape the kernel has — a stub cannot fail on a wrong shape it
invented. The new cases use the real surface, and the pre-fix code fails them.
`peerDependencies` were also stale: they pinned `@deepseek-ai/dsh-settings` to a
0.1.x range and cordis to 4.0.2, against a runtime of dsh 0.2.0-rc.2 and cordis
4.0.4. `evaluatePluginCompatibility` throws on a non-exempt mismatch, so installing
this package into a profile would have stopped it from starting. The ranges now match
what the shipped plugins declare.
The deployed relay publishes under `/eduwork`, so the address it injects has to carry that prefix even though the relay itself is mounted at the root. The value was set on the server by hand; this puts it where the next deployment reads it, so a redeploy does not reintroduce the silent 404.
…the boot The tunnel now carries the Gateway's logical streams — open, items, uplink, half-close and cancel — through the same sealed channel as unary calls. The stream modules are the adapter between the frame vocabulary and the remote channel; they do not replace the protocol, only the WebSocket carrier. Inbound frames are routed in arrival order. Decryption is asynchronous, so handling each message in its own task let two frames that arrived in order complete out of order. For a unary call that only reorders replies; for a logical stream it loses data — an item routed before the open that created its stream has nothing to join and is dropped, and the Host method waits forever for a value the device already sent. The regression test fails without the serialization and passes with it. The boot probe records four checkpoints and tries three destinations, because the application this work observes restarts the session that reads the result. Under a test runner it writes nothing unless a directory is given explicitly, so a test marker cannot be mistaken for a real boot that stopped halfway. The distribution assembly rows are updated to include the package.
The relay binds a host id to the public key of the first registration and refuses a different one forever; devices pin the same key. A fresh identity per boot therefore works exactly once — the next boot is refused with host-id-taken and every paired device is locked out. DESIGN.md 4.1 and 6.5 require the key to persist, and this is the module that does it. generateIdentity gains an extractable option. A device keeps all four private keys non-extractable; the Host is the one caller that must serialize them once, and only into the credential vault. importIdentity rebuilds the pairs as non-extractable and checks that each public half belongs to its private half: a record whose halves disagree would otherwise surface much later as an unexplained signature or decryption failure. loadHostIdentity stores the identity as an owner-scoped grant record, creates it atomically on first use (modifyRecord is an exclusive read-decide-replace), and refuses to replace a record it cannot read. Rotating a corrupt key would repeat the failure this module exists to prevent. A host without a credential store falls back to an ephemeral identity and says so in the trace instead of looking like a normal boot.
…he link
The plugin published a device registry as a service but nothing in the desktop
composition called it, so a device had no way in and the operator had no way to
revoke one. This adds the smallest surface that closes both: a loopback page on
the kernel's existing web server, reached through a per-boot token in the path.
A device that is not paired yet is recorded as pending from its `hello`, capped,
and still refused — asking is not trust. A paired device is authorized with one
click; revocation closes the device socket immediately through a new relay
control frame (`drop-peer`) rather than waiting for its next call.
Four defects found by running the real protocol are fixed here, because each one
made the feature look wired while it was not:
* `normalizeDevice` dropped `agreementKey`, so every confirmed device failed
its next handshake with peer-signature-invalid. The field is preserved and
covered by a regression test.
* A handshake failure closed the Host's whole relay connection, so one
unpaired device could bounce the Host (and anything it was serving). The
Host now asks the relay to refuse just that peer.
* The relay suppressed `peer-gone` once the link was forwarding, so the Host
kept a dead session and parsed the next device's hello as sealed traffic.
A device leaving is now always reported.
* `liveHandle.close()` closed the shared relay socket, not the device, so
every disconnect and revocation kicked the Host offline. Connections now
have `detach()` (forget) versus `close()` (revoke, which sends drop-peer).
Also fixed while the trace was in hand: device rows are written under the
namespace the host actually serves (`remote-access`), not the package's own
name; and a side-effecting call is executed at most once per `rpcId`, cached in
the kernel adapter, because the kernel's /api handler does not remember request
ids — a retried prompt would otherwise run twice.
The relay served the static dist, so a remote page died on the first missing global: the index injections, the boot graph and every /plugins bundle are Host-owned. Add an operator-triggered export of the Host's rendered index plus the assets it names, and mirror it onto the relay. Combo URLs (/plugins/??a,b&rev=...) are dynamic concatenations, not files. The snapshot stores the exact response under a hash of path plus query and the relay answers the same hash, so a preload or a later fetch resolves. Also authorize session/control and the two userQuestions endpoints on the Agent surface (approvals and questions are what a paired terminal answers), and replace a same-key host connection instead of refusing it: an application restart can outrun the relay's close handling and would otherwise leave the new instance offline for good.
A confirmed device now gets the narrow host surface the remote workspace browser needs (directory:list, workspace:create), while credential, pairing, plugin and terminal operations stay outside the code-level allowlist. The Agent surface gains session:create and the read-only session/catalog endpoints the Web UI paints from (session/follow, session/modelCatalog, llm provider lists, job/list). Confirmation grants the narrow host surface by default; stripHostSurface remains for callers that want to withhold it. The stream opener now speaks as the operator peer, because the device-shaped peer made every Gateway stream fail while unary calls worked.
…tstrap The package README, changelog and protocol still described the legacy listener/launch-token design and said the gate was not wired. Replace them with the current architecture: host-rendered web-shell reuse, relay, E2EE tunnel, logical streams, the wired gate and the narrow host surface. Add the deployment sample (Caddy, frontend mirror, troubleshooting) and the public bootstrap the relay serves, stripped of the on-screen mux diagnostics. The proposal fixes the public interface, trust boundary and acceptance conditions; the v1 listener protocol is archived as protocol-v1.md.
…t catalog and assembly The package is 0.1.0-dev and not published. Registering it in scripts/packages/catalog.mjs broke tests/package-maintenance (5/6 groups/packages vs 6/7) and required repository/publishConfig/assembly npm locks that the package does not have. The assembly and generic distribution also pointed at dsh-plugins/remote-access, a path that only exists as an untracked local copy, so a clean checkout could not assemble or release. The package stays in packages/dsh-remote-access; catalog/assembly/publish integration is a separate, authorized change once the package is published.
The approval waterfall's answer channel (\/result) now requires session:prompt instead of session:read, so a read-only device cannot approve tool execution. session:create is removed from the default agent surface until its cwd/agentPreset payload is constrained; a pending device is refused at the handshake instead of occupying the single device slot; the admin can remove a pending device, remove closes the live connection, and re-confirmation clears the revocation seal. Data-phase errors and unexpected text frames now drop only the peer, not the shared relay link; the send queue is bound to the session/socket it was created for; a deliberate 1000 replacement stops reconnecting; the dispatch path rechecks the gate. The relay returns 404 for a malformed percent escape and fails closed on a corrupt host store. The probe is opt-in and no longer records the admin token; the README trust boundary now says the relay sees handshake metadata.
freedomkk-qfeng
left a comment
There was a problem hiding this comment.
感谢推进这个原型。独立插件、浏览器接入、自托管中继、加密通信和本机授权,整体方向与前面的讨论一致。目前连接管理、官方接口适配和协议约定还有一些实质问题,建议继续保留 Draft,修正并完成关键流程验证后再考虑合入。
“远端申请、本机确认”的配对方式可以接受,不必强求一次性邀请链接。关键是本机明确授权具体设备,设备重新连接时证明自己持有对应私钥,并支持本机撤销。中继服务可以另设部署者发放的接入 Key,与设备配对凭据分开。
目前需要优先处理以下问题:
-
补齐官方 DSH 的
Peer接入。当前调用
wireStream.open()和共享请求处理器时,没有传入当前版本要求的Peer。它不仅表示调用者身份,也承载连接生命周期、取消信号和交互能力。对当前发布的 DSH 运行时进行验证时,已出现读取peer.signal失败。建议通过官方连接机制创建并管理远端连接的 Peer,让 RPC、事件和审批回答使用一致的连接上下文,并在断开或撤销时正确清理。配对后可以沿用本机 Agent 权限,但仍应遵守原有的操作审批。
-
修复中继端的 Host 注册验证。
目前注册流程接收签名字段,但没有实际验证;使用相同公钥提交无效签名,也可以替换已有 Host 连接。本地测试已经复现。
公钥可以被复制,因此替换连接前,需要验证申请者确实持有对应私钥。建议验证对本次挑战及注册身份的签名,并明确重连和重复注册的处理规则。中继接入 Key 不能替代这一验证。
-
将异步请求的响应绑定到原连接。
当前存在这样的路径:设备 A 发起请求后断开,设备 B 接入,A 的请求随后完成,结果却通过当前连接发送给 B。使用两个已配对的测试设备,已复现这一情况。
请求、响应、事件订阅和取消信号应属于明确的连接实例;旧连接结束后,迟到的结果不能进入新连接。这里需要统一处理连接生命周期,避免各层分别依赖可变的“当前连接”。
-
完善重试与去重的约定。
目前只缓存已成功完成的请求,没有处理正在执行中的相同请求;并发发送相同
rpcId仍可能执行两次。缓存也没有绑定调用设备和请求内容。建议明确断线后哪些操作可以重试、如何保留同一次操作的 ID,以及如何处理“已提交但结果未知”。去重需要覆盖执行中的请求,并明确缓存失效或宿主重启后的边界,避免自动把不确定的操作当作新请求再次提交。
-
移除对官方构建产物内部实现的脆弱依赖,恢复可复现验证。
当前部分辅助路径会读取官方包里的
lib/client.js,通过正则提取函数并执行,而新版官方包已经调整了文件布局。这种方式容易随上游升级失效,应优先使用公开导出或明确的协议格式。同时需要修正依赖与锁文件,恢复干净安装,并让关键测试覆盖实际网页使用的代码路径。目前辅助客户端与网页中的实现并不完全相同,辅助客户端通过测试,还不足以证明网页路径正常。
架构上,建议这轮先做一次收敛。主要问题在于目前同时保留了旧代理入口和新加密隧道,浏览器又维护了一份加密、握手实现,连接状态也分散在多个模块。修改一种行为时,需要同步维护多条路径,测试也容易覆盖不到实际运行的组合。
建议围绕一条实际使用的接入路径整理:
- 协议与加密公共模块:浏览器和插件共享实现,避免手工复制。
- 宿主适配层:统一对接官方 DSH 的 Peer、RPC、事件和权限交互。
- 连接管理层:管理每条连接的请求、订阅、取消和资源清理。
- Web 客户端:通过明确的协议使用宿主能力,减少对特定宿主构建文件和内部变量的依赖。
- 中继服务:承担连接接入和密文转发。
复用官方界面仍然值得保留。不过,当前页面快照、资源镜像、全局 WebSocket 替换等接入方式,需要进一步评估升级维护成本。希望网页与宿主能够依据协议分别维护,减少必须同步复制、替换内部文件的情况。
协议文档建议只保留本次实现实际采用的版本,旧 v1 和过程性设计留在 Git 历史即可。
现有协议需要结合实现进一步细化,重点明确宿主注册与设备认证、握手完成条件、断线重连、请求重试及设备撤销的行为。例如,当前握手签名未覆盖参与密钥协商的双方长期协商公钥,网页发出 prove 后也未等待验证宿主最终确认;这些需要与协议描述一起修正。文档中的保证应与实际实现一致,“至多执行一次”等表述需要说明适用范围。
协议中应写清必要的消息格式、状态转换和版本兼容约定;页面快照、脚本注入等具体方式放入实现说明。协议可以随原型迭代,但文档、代码和对应验证应同步更新。DSH 已有的业务请求与事件格式尽量复用,避免再定义一套平行接口。
第一版功能可以适当收窄:支持选择已有工作区、查看或新建会话、继续和取消任务、审批或回答问题、查看和下载产物。暂缓远端浏览本机目录、注册新工作区,以及修改插件、凭据等管理能力。这个边界需要由宿主落实,不能只隐藏网页入口。
下一步建议先完成一条闭环:
打开 URL → 本机批准配对 → 继续任务 → 远端审批或回答 → 获取结果 → 断线重连 → 撤销设备。
重点验证连接切换不会串消息、重试不会重复提交操作、撤销立即生效,并分别在官方 DSH 与 EduWork 上验证。原型阶段先把这条路径做稳,再扩展其他能力。
EduWork 0.4.6 ships DSH 0.2.1-rc.2, whose base bundle adds \id: remote-access\ for \@deepseek-ai/dsh-api-remote-access\. The plugin bundle and the desktop profile both reused that id, so the later row replaced the base plugin; its Client half never mounted and 24 UI entries stayed pending on \
emoteAccess\. The plugin also called \ctx.provide('remoteAccess', registry)\, which collided with the official policy service.
Give the bundle row and the published service their own names, update the profile example, and assert in tests that \
emoteAccess\ is not provided. The settings registry still tries both row spellings, so profiles written before the rename keep working.
0.2.1 also split the client connection into \client.node.js\ / \client.browser.js\; the decoder loader and its test hard-coded \lib/client.js\. Resolve the \./client\ export first, keep the old file as a fallback, and extract \parseConnectionResponse\ by balancing braces instead of a formatting-sensitive regex.
Verified against the installed 0.2.1-rc.2 runtime: 310/310 package tests, docs gate 280 files / 795 links / 41 pairs, no broken links.
增加独立远程访问插件与可自托管中继,支持端到端加密、本机配对、设备撤销、远程审批与任务继续,以及机构 OIDC 和子路径配置。 保留现有 DSH UI 复用机制。远程访问默认关闭,npm 发布和产品装配后续推进;ChatECNU iframe 嵌入策略在中继服务侧继续跟进。 设计沿用了 @Paraso42 在 #180 中梳理的宿主接入点、门禁与验收场景。 Co-authored-by: 冯骐 <[email protected]>
Record the integration mapping, endpoint gate, device lifecycle and validation scenarios contributed in #180 and carried forward into #192. Keep both language entries aligned and refresh the source receipt without changing runtime code. Co-authored-by: Paraso42 <[email protected]>
问题与修改
Issue #116:让另一台设备跨网络访问本机 EduWork/DSH Agent 的工作区、会话与任务。本分支是最小可用实现 / 原型(Draft;安全模型尚未签字;不关闭 #116)。
范围、本机影响与部署形态(请按此评审)
Refs,合并后 issue 保持打开。剩余优化(邀请码、中继访问密钥、审批/提问端到端、PC 原生目录、iOS 后台重连、多设备、性能、CI/文档)作为后续工作项,不在本 PR 假装完成。eduwork-directory-picker/eduwork-directory-flow,改用dsh-host-directory-picker-browse+dsh-client-ui-directory-picker-browse;因此电脑端“创建新工作区”也变成应用内对话框,不再是 Windows 原生对话框。回滚方式:恢复上面两个禁用项。后续按客户端条件化(本机isLoopback用原生、远端用 browse)或提供远端专用入口,让电脑端独立保留原创建方式。已实现
packages/dsh-remote-access:设备登记、凭据存储、逐设备撤销、活动连接管理;宿主身份持久化在ctx.credentials;本机管理页(loopback、per-boot token)。eduwork-relay/2:/host注册与 hostId 绑定、对 nonce+hostId+publicKey 的持有证明验签、/peer接入、同键重连替换、单设备链路、Web 壳与/pluginscombo 服务、bootstrap 注入。connection.browserPeer(兼容旧operator)取得官方 ownerPeer,传给wireStream.open与共享 fetch 处理器;响应信封按公开契约严格解码,不读取客户端私有 bundle 路径。/pluginscombo;远端浏览器跑宿主自己的 UI。workspace/follow、session/follow、session/control、$events;Agent 面只读 + prompt/cancel/create,host 面只放行directory:list/workspace:create。本轮安全修复
$events/result(审批 waterfall 的答复)改为要求session:prompt;只读设备不能批准工具执行。session:create回到默认 Agent 面,但隧道层只接受已注册工作区的workspaceId,拒绝直接携带cwd的创建请求;远端不能借会话创建选择任意宿主路径。drop-peer,不再关宿主共享 relay 链路;握手后 text 帧按协议错误处理;channel.receive捕获帧内 channel。sendChain绑定 session/socket 世代;1000 替换后不再重连;dispatch 前重新检查allowed。(deviceId, rpcId, endpoint, payload)去重并合并并发同键请求;失败不缓存;缓存有界且不跨进程重启。%返回 404、坏 store fail closed;WebSocket 升级前原始套接字重置不再终止中继进程;probe 默认关闭且不记录 admin token。未实现 / 后续
npm ci仍 ERESOLVE;依赖本机产品 junction,不能把当前测试结果当作干净安装证明。Xh(安全签字前补);协议文档需随实现同步。验证
node --test(packages/dsh-remote-access):321/321 通过,14 suites;含 pending、sendChain、relay%、admin remove/sealed、Peer 来源、注册验签、workspace 作用域和原始套接字重置回归。node scripts/check-source-docs.mjs:280 files / 796 links / 41 README pairs,0 broken / 0 readme issues。end-to-end channel established,无peer.signal。eduwork-relay/2,Host 同批升级;真实 Edge 打开公网 URL 后加载完整工作区 UI,日志收到 workspacebaseline、sessionsnapshot/emit流式 item,页面显示“远程接入:已连接”,无peer.signal或注册验签失败。remote-workspaces.png为远端侧边栏同步宿主工作区的合成数据截图(工作区/会话名替换为Workspace A…/Session 1…,相对时长替换为—,裁剪到侧边栏);采集前在 DOM 完成替换并做 fail-closed 断言,上传前经 Windows OCR 与路径/域名/ID 模式扫描复核。Xh。兼容性与后续事项
0.1.0-dev未发布 npm;包已从 catalog/默认装配撤回;依赖锁/Release 由维护者确认后单独执行。docs/proposals/remote-access/README.md(中英)随分支提交,建议作为第一段评审。Xh、clean install/CI、审批提问端到端和文档补齐前,不请求安全签字、不标 ready。Refs #116(原型阶段;v1 的邀请/访问密钥/审批提问另开工作项)。