@linxin666/dsh-remote-bridge 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: f79b8b30293f2d7759144b3f5e2f804aedbc7bf8
6
- README.zh.md: 7b7e8820352a8ce666b066473072d1bee146516b
5
+ README.md: 4ac34e22ce14f44e8a6c9b5a2cef26301ea656b8
6
+ README.zh.md: a08320748e936ef80372a3274c4af31d6e4788d0
package/README.md CHANGED
@@ -20,8 +20,10 @@ The package publishes one protocol and, beside it, one small browser surface. Wh
20
20
 
21
21
  - **One surface.** A WebSocket at `/ios/v1`, registered as an exact upgrade route on the host webserver; frames are text, one JSON object each, at most 10 MiB (10485760 bytes).
22
22
  - **A session surface.** `session.list`, `session.titles`, `session.snapshot`, `session.prompt` and `session.interrupt` cover the roster with its workspace, lineage and archive metadata, a batch of session titles, a full baseline plus a live subscription, a queued prompt with an idempotency key, and turn cancellation.
23
+ - **An agent surface.** `presets.list` forwards the host's Agent-preset roster and `session.create` forwards one creation request, so a phone instantiates an Agent from a preset the way the desktop does; neither body is interpreted here.
24
+ - **A fork surface.** `session.fork` branches one session into a new one that inherits its context; the fork point and the new session's identity are the host's, so the request and the answer cross verbatim.
23
25
  - **A subscription, not a poll.** `session.snapshot` opens the harness follow stream and keeps it, so the baseline and every later increment arrive over the same socket.
24
- - **Approvals reach the client.** A tool that asks for permission arrives as an `approval.request` event and is answered with `approval.resolve`; a request nobody answers is rejected.
26
+ - **Approvals reach the client, and a reconnecting phone is handed the ones still waiting.** A tool that asks for permission arrives as an `approval.request` event and is answered with `approval.resolve`; a request nobody answers is rejected, and a connection that declared `approvals.v1` receives every unsettled approval again after its handshake.
25
27
  - **Pairing.** A one-time bootstrap token plus a P-256 challenge-response mint a revocable device token; an unpaired connection reaches three methods only.
26
28
  - **A pairing panel.** The same plugin row declares a `dsh.client` browser half: a sidebar-foot panel that shows the operator the live one-time code as a QR symbol and in plaintext, with its 30 s countdown and a mint-again action.
27
29
  - **No relay change.** The protocol rides whatever origin the instance already publishes, and the relay hop forwards it exactly as it forwards everything else.
@@ -35,34 +37,50 @@ The package publishes one protocol and, beside it, one small browser surface. Wh
35
37
  | event | `{"t":"ev","seq":<uint>,"m":"<topic>","p":{...}}` |
36
38
  | heartbeat | `{"t":"ping","ts":<ms>}` and `{"t":"pong","ts":<ms>}` |
37
39
 
38
- `seq` is per connection and starts at 1: it numbers the events that connection received, not the harness's own history. Frames are text, one JSON object per frame, at most 10 MiB (10485760 bytes). Idle connections are probed every 20 s; a client answers a ping with a pong of its own and a bridge answers the same way.
40
+ `seq` is per connection and starts at 1: it numbers the events that connection received, not the harness's own history. Frames are text, one JSON object per frame, at most 10 MiB (10485760 bytes). Idle connections are probed every 20 s; a client answers a ping with a pong of its own and a bridge answers the same way. A client that sends no frame at all within 10 s of a ping is closed with code 4000; a pong that answers no ping is still ignored.
39
41
 
40
42
  ## Methods
41
43
 
42
44
  | method | request `p` | response `r` |
43
45
  | --- | --- | --- |
44
- | `hello` | `{proto:1, minor:0, client:"ios/0.1", cap:["session.stream.v1","session.snapshot.trim.v1"]}` | `{proto:1, minor:0, server:"dsh-remote-bridge", resume:"snapshot", auth:"paired" or "unpaired"}` |
45
- | `session.list` | `{}` | `{sessions:[{id, title, updatedAt, agentRunning, cwd?, parentSessionId?, origin?, blank, archived?}]}` |
46
+ | `hello` | `{proto:1, minor:11, client:"ios/0.1", cap:["session.snapshot.trim.v1","subagent.thread.v1"]}` | `{proto:1, minor:11, server:"dsh-remote-bridge", capabilities:["session.snapshot.trim.v1","session.snapshot.page.v1","questions.v1","subagent.thread.v1","jobs.v1","agents.v1","delta.v1","session.list.omit-archived.v1","session.deep-history.v1","frame.deflate.v1","session.list.compact.v1","session.snapshot.since.v1","session.fork.v1"], resume:"snapshot", auth:"paired" or "unpaired"}` |
47
+ | `session.list` | `{since?, cwd?, maxRows?, after?}` | `{mode, token, sessions:[{id, title, updatedAt, agentRunning, cwd?, parentSessionId?, origin?, blank, archived?}]}`, or `{mode:"reset", token:"", compact:true, sessions:[...], nextAfter?}` for a compact page |
46
48
  | `session.titles` | `{ids:[<sessionId>, ...]}` | `{titles:{"<id>":"<title>", ...}}` |
47
- | `session.snapshot` | `{sessionId, maxBytes?}` | `{turns:[...], lastSeq:<uint>, hasMore?}` |
49
+ | `session.snapshot` | `{sessionId, sinceSeq?, maxBytes?}` | `{turns:[...], lastSeq:<uint>, hasMore?}`, plus `mode:"since", reset:false` for an increment and `mode:"full", reset:true` for a baseline that replaces the copy a client holds |
48
50
  | `session.history` | `{sessionId, before?, maxBytes?}` | `{turns:[...], nextBefore?:<uint>, hasMore:<bool>}` |
51
+ | `session.history.deep` | `{sessionId, before?, maxBytes?}` | `{turns:[...], nextBefore?:<uint>, hasMore:<bool>}` |
49
52
  | `session.prompt` | `{sessionId, text, requestId}` | `{accepted:true}` |
50
53
  | `session.interrupt` | `{sessionId}` | `{ok:true}` |
54
+ | `presets.list` | `{}` | the host's `agentPresets/list` body verbatim |
55
+ | `session.create` | the host's `SessionCreateRequest` | the host's `session/create` body verbatim |
56
+ | `session.fork` | `{sessionId, atSeq?}` | the host's `session/fork` body verbatim, its `SessionForkValue` |
51
57
  | `pair.begin` | `{token}` | `{nonce, expiresAt}` |
52
58
  | `pair.finish` | `{devicePubKey, signature}` | `{deviceToken, deviceId}` |
53
59
  | `approval.resolve` | `{id, decision}` | `{ok:true}` |
54
60
 
55
61
  `hello` is callable without a device token and reports the connection's own `auth` state. `session.snapshot` maps the harness follow stream's opening snapshot into `turns`, reports its cursor as `lastSeq` and then keeps that stream open as this connection's subscription for the session; `session.prompt` ensures the same subscription idempotently, so a client may skip the snapshot. The prompt mode is fixed to queue, `clientTimeZone` is filled server-side with the host's IANA zone, and `requestId` is an idempotency key: the same `requestId` in the same session is sent once, and a repeat answers `{accepted:true}` without sending anything again. `session.interrupt` cancels the turn; it does not drop the subscription.
56
62
 
57
- `hello` also carries the client's capabilities, and a capability is an announcement rather than a negotiation: the handshake answers the same frame whatever `cap` holds, an unknown name is ignored, and the frame cap is one constant in both directions — the 10 MiB that bounds a received frame is the same budget that fits a snapshot and that drops an oversized outbound event. The one capability this protocol version recognizes is `session.snapshot.trim.v1`. A client that does not declare it — including every client written before it existed — is served exactly the baseline protocol v1 always served. A client that does declare it is sent a trimmed baseline: inside every turn, only the entries it renders (`user/message`, `assistant/message`, `tool/call`, `tool/result`) survive, and the harness's own bookkeeping records (`system/message`, `request/header` and the like) are dropped before the frame is measured. Nothing else about the snapshot changes: which turns are kept, their order, and each turn's `seq`, `endSeq`, `reason` and `time` are the projection's own values, a turn whose entries are all bookkeeping stays as a turn with an empty `entries` array, and `lastSeq` is still the harness cursor. The frame budget applies afterwards — entries are trimmed first, then whole oldest turns are dropped, and only then does a snapshot that still does not fit answer `snapshot-too-large`.
63
+ The two agent methods interpret nothing. `presets.list` answers the host's `agentPresets/list` body as it arrived — that endpoint takes no request, so a preset row is whatever the registry publishes, its plugin list included — and `session.create` sends the client's payload as that endpoint's single `request` argument and answers the host's own reply. The field names, the defaults and the refusal codes are the host's: a client validates a creation request against the host's own `SessionCreateRequest`, never against a copy kept here, and a rejection reaches it as the host's `code` and `msg` — an uncoded failure crosses as this bridge's `internal`, with the host's text. Both methods exist only for a client that declared `agents.v1`: without it each answers `unknown-method` and nothing is sent, and a connection that declared it and never calls them costs the host no read at all.
58
64
 
59
- A second capability bounds the opening screen itself: `session.snapshot.page.v1`. Without it a snapshot stays the whole opening window, byte for byte, exactly as before. With it, `session.snapshot` answers with the newest page only, measured against `maxBytes` (default 524288 = 512 KiB, and refused rather than clamped when it is not a usable budget), cut by the very same entry-level slice `session.history` uses: a turn's entries may split between this page and the next one while that turn keeps its own fields, an entry larger than the whole budget is a page of its own, and `snapshot-too-large` can no longer answer such a connection. The page carries `lastSeq` and `hasMore`, and the cursor for the next, older page is the `seq` of its own oldest entry — the same value `session.history` takes as `before`, which is why no `nextBefore` field restates it. Opening a session then costs one page, and `session.history` walks the rest of the window back in the same 512 KiB pages.
65
+ The fork method interprets nothing either. `session.fork` sends `sessionId` and, only when the client named one, `atSeq` — the source event seq the fork includes — as that endpoint's single `request` argument, and answers the host's own `SessionForkValue`. An omitted `atSeq` stays omitted: the host reads an absent fork point as its newest finished turn, and inventing one here would move the cut silently. A cut that is not a positive integer is refused here as `invalid-args`, because no event log has such a seq; what the host refuses crosses with the host's own `code` and `msg`, and an uncoded failure as this bridge's `internal`. The method exists only for a client that declared `session.fork.v1`: without it the answer is `unknown-method` and the host is asked nothing.
60
66
 
61
- `session.snapshot` and `session.history` address a session the way the harness demands. An ordinary session is addressed by its own id; a delegated child — a roster row carrying `origin:"subagent"` — is addressable only through its durable parent, and the harness answers `session/agent-busy` when a child is asked as an ordinary session. The bridge learns that from the harness's own refusal rather than guessing: it retries that one session with the delegated address `{kind:"subagent", parentSessionId, childSessionId, mode:"unknown"}` and serves the child's real history. The parent comes from the roster, the only endpoint that carries lineage — a client that listed sessions before opening one pays no extra read, and the roster is read at most once per connection. Roots never pay for this: they open on the first attempt. A session with nothing to show is not a failure either: one whose log holds only the harness's own bookkeeping answers a real projection with an empty turn, and only a missing opening frame or a failure raised by the harness itself is refused.
67
+ `hello` also carries the client's capabilities, and a capability is an announcement rather than a negotiation: the handshake answers the same frame whatever `cap` holds, an unknown name is ignored, and the frame cap is one constant in both directions — the 10 MiB that bounds a received frame is the same budget that fits a snapshot and that drops an oversized outbound event. This bridge serves thirteen capabilities and advertises them in `hello`'s `capabilities`: `session.snapshot.trim.v1`, `session.snapshot.page.v1`, `questions.v1`, `subagent.thread.v1`, `jobs.v1`, `agents.v1`, `delta.v1`, `session.list.omit-archived.v1`, `session.deep-history.v1`, `frame.deflate.v1`, `session.list.compact.v1`, `session.snapshot.since.v1` and `session.fork.v1` — a capability a mounted plugin adds is not on that list, because the bridge is not its author. Nor is `approvals.v1`, which a client declares and this bridge deliberately never advertises: it gates a replay rather than the channel, so the handshake stays the same frame for every client (see the approval channel below). The first is the trimmed baseline. A client that does not declare it — including every client written before it existed — is served exactly the baseline protocol v1 always served. A client that does declare it is sent a trimmed baseline: inside every turn, only the entries it renders (`user/message`, `assistant/message`, `tool/call`, `tool/result`, `subagent/catalog`) survive, and the harness's own bookkeeping records (`system/message`, `request/header` and the like) are dropped before the frame is measured. Nothing else about the snapshot changes: which turns are kept, their order, and each turn's `seq`, `endSeq`, `reason` and `time` are the projection's own values, a turn whose entries are all bookkeeping stays as a turn with an empty `entries` array, and `lastSeq` is still the harness cursor. The frame budget applies afterwards — entries are trimmed first, then whole oldest turns are dropped, and only then does a snapshot that still does not fit answer `snapshot-too-large`.
68
+
69
+ A second capability bounds the opening screen itself: `session.snapshot.page.v1`. Without it a snapshot stays the whole opening window, byte for byte, exactly as before. With it, `session.snapshot` answers with the newest page only, measured against `maxBytes` (default 524288 = 512 KiB, and refused rather than clamped when it is not a usable budget), cut by the very same entry-level slice `session.history` uses: a turn's entries may split between this page and the next one while that turn keeps its own fields, an entry larger than the whole budget is a page of its own, and `snapshot-too-large` can no longer answer such a connection. The budget is measured on the whole encoded answer and never per turn, so what it bounds is the page rather than an entry: a page is inside `maxBytes` unless the newest entry alone is past it, and then the page is exactly as large as that entry — a 2.2 MB newest message answers a 2.2 MB page against the 512 KiB default, while a window of ordinary entries answers 513794 bytes. That is the one cost a paged snapshot can still carry. The page carries `lastSeq` and `hasMore`, and the cursor for the next, older page is the `seq` of its own oldest entry — the same value `session.history` takes as `before`, which is why no `nextBefore` field restates it. Opening a session then costs one page, and `session.history` walks the rest of the window back in the same 512 KiB pages. The capability that makes a reconnect cheap is `session.snapshot.since.v1`, and it takes two declarations to change anything: the capability in the handshake AND a `sinceSeq` in the request. A request missing either is answered byte for byte what protocol v1 answered before it existed, with no field added, so a client can adopt the name before it relies on any of it. Behind both, the client names the durable `lastSeq` of a snapshot it already holds — the harness cursor, never the connection's own event seq — and the bridge proves continuity against the current follow window: only when that window's oldest entry sits at or below `sinceSeq + 1`, or the window is empty, is the answer the increment `{turns:[...], lastSeq, mode:"since", reset:false}` carrying nothing but the entries above that watermark, each turn keeping its own `seq`, `endSeq`, `reason` and `time` exactly as the baseline presented it. An entry the client never renders still counts as an entry the window holds, so the proof is read off the untrimmed window and can only be conservative. A window that has scrolled past the watermark cannot prove the chain is unbroken, so there — and when the increment would not fit one 10 MiB frame — the answer is the baseline this connection would have received anyway, carrying `mode:"full"` and `reset:true`, the one answer that tells a client to throw its copy away. Trim, the page budget and the frame cap are untouched: the increment is cut from the same projection, and a reset reply is exactly today's reply plus those two fields.
70
+
71
+ `frame.deflate.v1` changes the form of a frame rather than its content, and it is the one capability that has to exist at this layer: the 101 response advertises no `Sec-WebSocket-Extensions`, this carrier rejects every RSV bit, and a client whose WebSocket API cannot offer `permessage-deflate` at all has no way to ask for it, so the compression the wire carries is decided here. A client that declares the capability may be answered in WebSocket binary frames whose payload is raw DEFLATE (RFC 1951, no zlib header and no adler32 trailer) of exactly the JSON text the text path would have written: `inflateRaw` of that payload is that frame, byte for byte. Only a frame whose UTF-8 text reaches 1024 bytes is considered at all, a frame that does not get smaller is still sent as text — a binary frame larger than the text it replaces would save nothing — and the direction is one way, because a client keeps sending text frames. The 10 MiB cap is unchanged and still measured on the text, so every budget in this document stays a budget of uncompressed JSON. A client that does not declare the capability receives byte for byte the text frames protocol v1 always wrote, and nothing about the handshake changes either way.
72
+
73
+ `subagent.thread.v1` makes one delta kind exist: the harness's durable `subagent/catalog` event registers a delegated child, and the bridge publishes `subagent` with `{childId, label?, mode?, callId?}`. `callId` is the `tool/call` that spawned the child, and the spawn's own result is asked first: a `tool/result` that names the child — the activation handle `{"kind":"activation","subagentId":…}` the `subagent` tool returns, alone or nested in a `run_code` answer, or the plain `started subagent …` notice it prints — decides it even in a step that issued several calls or spawned a whole team of children. When no result names the child the pre-existing rule answers: the one call the same turn and step issued, and nothing at all when that step issued several calls or the call already produced another child, because a guessed id would hang the thread on the wrong card. A spawn can be projected before its own result, so a live delta answers from the events this stream has carried so far while a baseline answers from the whole session — one rule and one `SpawnCallIndex` behind both. A `subagent/catalog` entry is therefore one of the entry types a trimmed baseline keeps, and it carries the spawning call in `data.callId`: a phone that opens a session after children were spawned reads their labels, their modes and the call that made them instead of inferring the thread from agent messages. The `actor` of a `user-message` is not gated by any capability: a delta and a snapshot `user/message` entry both carry `{kind, sourceKind, sessionId?, label?}` derived mechanically from the harness's own `source` record — `user` and `user-approval` are `human`, `agent-message` and `subagent-settled` are `agent`, every other source kind is `system` with its own name verbatim — so a message is never dropped for carrying an origin this protocol has not classified, and an event with no readable source kind carries no `actor` at all. Following a session is authorized rather than assumed: a session this connection already opened and an ordinary session the roster names may be followed, and a delegated child only while the parent it hangs off is one of those. A child whose parent no roster resolves answers `session-not-followable` and opens no stream, so relaxing the child gate cannot become a way to read a session the caller was never authorized for.
74
+
75
+ `session.list.omit-archived.v1` is the one capability here that negotiates nothing. The bridge never transfers an archived session — the host's archive set is read once per listing and every id it names is skipped before that row is built — whether or not a client declares the capability, so a client written before it receives the shorter roster it would have filtered away itself. Behind it, no `session.list` row is a session the archive set names, a surviving row still carries `archived: false` under the unchanged schema, and a listing that cannot read the archive set drops nothing at all. A live child of an archived parent is still a row of its own and still names that parent's id: the parent id is what the child's own row carries, so an archived parent never costs a child its lineage. The roster is also the set the delta machine diffs, so a session archived between two listings arrives as a removal and a restored one as a change, with no special case in either.
76
+
77
+ `session.snapshot` and `session.history` address a session the way the harness demands. An ordinary session is addressed by its own id; a delegated child — a roster row carrying `origin:"subagent"` — is addressable only through its durable parent, and the harness answers `session/agent-busy` when a child is asked as an ordinary session. The parent comes from the roster, the only endpoint that carries lineage, and the bridge reads it before the first attempt, so a child whose parent the roster names is addressed with `{kind:"subagent", parentSessionId, childSessionId, mode:"unknown"}` straight away and its real history is served. When that read resolved no parent, the harness's own refusal is the signal instead: it retries that one session with the delegated address. A client that listed sessions before opening one pays no extra read, and the roster is read at most once per connection. Roots never pay for this: they open on the first attempt with their own id. A session with nothing to show is not a failure either: one whose log holds only the harness's own bookkeeping answers a real projection with an empty turn, and only a missing opening frame or a failure raised by the harness itself is refused.
62
78
 
63
79
  `session.history` reads a session's history backwards in pages, and it is a pure read: it never opens, drops or re-addresses a subscription, and the same cursor always answers the same page. It is served from the very opening baseline `session.snapshot` uses, so the two can never disagree about a turn or an entry — `history` only slices that projection. Pages are cut BY ENTRY, not by turn: a page carries the newest entries below the caller's cursor until the encoded page reaches `maxBytes` (default 524288 = 512 KiB), a turn's entries may therefore be split across pages while that turn keeps its own `seq`, `endSeq`, `reason` and `time`, and a single entry larger than the whole budget is a page of its own rather than a refusal. `before` is a durable watermark, not an index: the page carries the entries whose `seq` is strictly below it, so a cursor stays meaningful across connections and across a projection that changed shape under it. Omit `before` for the newest page; `hasMore` says whether anything older remains, and `nextBefore` — the cursor for the next, older page — is present exactly while `hasMore` is true. The trim capability applies here exactly as it does to a snapshot.
64
80
 
65
- `session.list` carries the roster's own fields plus the metadata a phone groups and labels by: `cwd`, `parentSessionId` and `origin` are present only when the host reported them, `blank` is always present, and `archived` is present only when this process can read the host's archive set — a bridge that cannot tell omits the key instead of answering `false`. `title` stays `""` unless this connection has already resolved that id through `session.titles`, so listing sessions stays one call and never puts a title read on every row. `session.titles` answers a batch of one to 100 ids out of the host's own title service — the live sessions of this process, never one follow stream per session — and every requested id becomes a key: an id this host does not hold live, or one whose title has not landed yet, answers `""`. One resolved title is served for 10 s before the service is asked again, so a rename can take that long to show. Like every other session method, both answer `unpaired` without a device token.
81
+ `session.list` carries the roster's own fields plus the metadata a phone groups and labels by: `cwd`, `parentSessionId` and `origin` are present only when the host reported them, `blank` is always present, and `archived` is present only when this process can read the host's archive set — a bridge that cannot tell omits the key instead of answering `false`. An archived session is not a row at all: the archive set is read once per listing and every id in it is skipped before its row is built, so the flag that does cross is always `false` and the rows a phone would have hidden cost it nothing. The one read that this makes shorter is the roster: nothing else about the row, the lineage it carries or the delta the connection holds changes. `title` stays `""` unless this connection has already resolved that id through `session.titles`, so listing sessions stays one call and never puts a title read on every row. `session.titles` answers a batch of one to 100 ids out of the host's own title service — the live sessions of this process, never one follow stream per session — and every requested id becomes a key: an id this host does not hold live, or one whose title has not landed yet, answers `""`. One resolved title is served for 10 s before the service is asked again, so a rename can take that long to show. Like every other session method, both answer `unpaired` without a device token.
82
+
83
+ A compact listing is the roster's other form, and it takes both halves to appear: the `session.list.compact.v1` capability and at least one compact parameter. `cwd` is a boolean that decides whether the absolute directory crosses, `maxRows` cuts the roster into pages of that many rows, and `after` is the id of the last row the previous page carried, so a page is continued rather than re-requested. Rows are ordered most recent first with the id as the tiebreak, which is what makes `after` a cursor instead of a position; `nextAfter` is present exactly while rows remain, and a cursor naming no row of this roster answers a first page again, the way a delta token this window never issued answers a reset. `updatedAt` is present only when this connection has not already sent this client that exact value for that id, so a repeated listing carries none of them; `compact:true` says the rows are in this schema, so an absent `updatedAt` is never mistaken for a value the host never had. A listing that names no compact parameter, and every listing from a client that did not declare the capability, is answered the whole roster under the schema above, byte for byte. A compact page and a `since` token are two different answers to two different questions, and a request naming both is refused with `invalid-args`.
66
84
 
67
85
  ## Events
68
86
 
@@ -80,8 +98,23 @@ A second capability bounds the opening screen itself: `session.snapshot.page.v1`
80
98
  | `tool-call` | `{callId, name, argumentsDelta}` | incremental tool call; `argumentsDelta` may be an empty string |
81
99
  | `tool-result` | `{callId, output, isError}` | tool result |
82
100
  | `turn-end` | `{reason}` | turn finished; anything other than `completed` is an abnormal end |
101
+ | `user-message` | `{text, messageId?, attachments?, actor?}` | a user message; `actor` says where it came from |
102
+ | `subagent` | `{childId, label?, mode?, callId?}` | the harness registered a delegated child; capability `subagent.thread.v1` |
103
+
104
+ An `approval.request` carries a summary taken from the harness's display reason in the client's language, falling back to English and then to the tool name, plus the tool name itself. The client answers it with `approval.resolve`, whose `decision` is either `allowed-once` or `rejected`; an unknown or expired `id` is refused, and a request nobody answers is resolved after two minutes as unavailable, which the harness reads as a rejection. Every paired connection receives the event the moment the tool asks — the first broadcast is behind no capability — and a connection that declared `approvals.v1` in `hello` is handed every still-waiting request again, so a phone that reconnected, or a session screen opened after the fact, still holds a card. Only an unsettled request is replayed: one that was answered, timed out or withdrawn is gone from the claim registry, and re-handing a request never moves its two-minute deadline. The capability gates that second delivery and nothing else, which is why it is absent from `hello`'s `capabilities` and leaves `minor` alone: the handshake answers every client the same frame. The bridge claims a request only while a paired client is connected: with none, the request is left to the next answerer instead of waiting out a phone that is not there.
105
+
106
+ ## Extension seam
107
+
108
+ The package publishes one generic seam and puts no vocabulary of its own in it. Mounted plugins resolve the cordis service `remoteBridge` and add methods and events to protocol v1 without the bridge learning what they mean:
109
+
110
+ | member | contract |
111
+ | --- | --- |
112
+ | `registerMethods({capability?, methods})` | adds a table of client-callable methods and returns the disposer that withdraws them; a name inside `KNOWN_METHODS`, an empty name or a name another table already owns is refused, and the whole table is refused with it |
113
+ | `broadcast(topic, payload, capability?)` | pushes one event to the connections that are paired — and, when a capability is named, declared it — and returns how many took the frame |
114
+
115
+ A registered method is dispatched after both protocol gates: a name no plugin registered answers `unknown-method` before anything else runs, a client without a live device token answers `unpaired` exactly as it does for a protocol method, and a client that never declared the table's capability is told `unknown-method` — the method is absent from its protocol rather than forbidden to it. The handler receives the request payload and the calling connection's id, and answers `{ok:true, r}` or `{ok:false, code, msg}`; the bridge forwards either verbatim, because refusal codes belong to the registering plugin. A handler that throws, or answers neither shape, crosses as the bridge's own `internal`.
83
116
 
84
- An `approval.request` carries a summary taken from the harness's display reason in the client's language, falling back to English and then to the tool name, plus the tool name itself. The client answers it with `approval.resolve`, whose `decision` is either `allowed-once` or `rejected`; an unknown or expired `id` is refused, and a request nobody answers is resolved after two minutes as unavailable, which the harness reads as a rejection. The bridge claims a request only while a paired client is connected: with none, the request is left to the next answerer instead of waiting out a phone that is not there.
117
+ `hello` answers `minor:11` since the fork channel shipped, one step above the snapshot-`since` channel that landed on the integration branch first: behind `session.fork.v1` a client may call `session.fork` and be answered the host's own fork result. `minor:10` was when the snapshot became incremental on request: behind `session.snapshot.since.v1` a `session.snapshot` that names `sinceSeq` is answered either the entries above that watermark or a full baseline carrying `mode` and `reset`, so the number rises for a reply shape a client reads off the wire. `minor:9` was when the compact roster shipped: behind `session.list.compact.v1` a listing that names `cwd`, `maxRows` or `after` is answered a shorter row that may be paged, so the number rises for a row schema a client reads off the wire. `minor:8` was when the outbound frame form became a capability: behind `frame.deflate.v1` a declaring client may be answered in binary frames carrying raw DEFLATE of the text, so the number is raised for something a client reads off the wire. `minor:7` was when the two channels met; `minor:6` was either channel on its own — the agent channel on dev and durable history paging on its branch; `minor:5` was when the roster stopped carrying archived sessions. Behind `agents.v1`, `presets.list` and `session.create` forward the host's preset roster and one creation request; behind `session.deep-history.v1`, `session.history.deep` pages a session's durable store back to its first entry; behind `session.fork.v1`, `session.fork` branches one session into a new one that inherits it. `minor:4` added byte-level increments, `minor:3` the background-job channel, `minor:2` the subagent thread, and `minor:1` was this seam. Major 1 and every frozen field, method name and topic name are unchanged by all of them. The one body that shrank for every client rather than only for those that declare a capability is the roster itself, which no longer names an archived session; every other answer a client that declares nothing receives is protocol v1's own.
85
118
 
86
119
  ## Error codes
87
120
 
@@ -207,7 +240,7 @@ pnpm install && pnpm -r build
207
240
  dsh plugin --profile web add link:$(pwd)/packages/dsh-remote-bridge
208
241
  ```
209
242
 
210
- The family aggregate package `@linxin666/dsh-web-all` installs this plugin together with the rest of the family. Restart `dsh web` after installing or updating — the host half registers its routes when the plugin row mounts, so the running host is what serves them — then reload the Web GUI page, which is when the browser half's sidebar-foot trigger appears.
243
+ This plugin is a family member: the aggregate bundle `@linxin666/dsh-web-all` installs it as its `remote-bridge` row together with the rest of the family, so adding the bundle is enough. Installing this package on its own stays supported, and remains the route for following this plugin's own version instead of the bundle's. Both routes load the same npm package, so a profile that carries both rows at once still registers the host half exactly once — `/ios/v1` and the token route belong to whichever source mounts first, and the family's single-instance guard replays a refused mount when that owner is torn down while the host keeps running. Restart `dsh web` after installing or updating — the host half registers its routes when the plugin row mounts, so the running host is what serves them — then reload the Web GUI page, which is when the browser half's sidebar-foot trigger appears.
211
244
 
212
245
  ## Configuration
213
246
 
@@ -229,10 +262,11 @@ The bridge is mounted like any other host plugin row. It carries no user-facing
229
262
 
230
263
  - **A title belongs to a live session.** `session.titles` reads the titles of the sessions this host process holds live; the roster still lists persisted sessions that are not attached, and their ids answer `""` until the host attaches them.
231
264
  - **A served title can be up to 10 s old.** One resolved title is served for 10 s before the title service is asked again, so a rename or a newly generated title can take that long to appear.
232
- - **`archived` is absent when the archive set cannot be read.** The flag comes from the host's workspace registry; when that service is not mounted, every row omits the key instead of answering `false`.
265
+ - **`archived` is absent when the archive set cannot be read.** The flag comes from the host's workspace registry; when that service is not mounted, every row omits the key instead of answering `false`, and nothing is dropped — a bridge that cannot tell does not answer a shorter roster.
266
+ - **An archived parent authorizes nothing.** A live child of an archived parent is still listed and still names that parent, but following the child answers `session-not-followable` until the parent is restored: the roster is what authorizes a session, and an archived one is no longer on it.
233
267
  - **`lastSeq` and `seq` are different counters.** `session.snapshot`'s `lastSeq` is the harness stream cursor; the event `seq` is this connection's own event number. They must not be compared, and resume state belongs to the client.
234
- - **No incremental replay.** A client that detects a gap or reconnects calls `session.snapshot` again and takes the full baseline; the bridge does not buffer deltas for a disconnected client.
235
- - **A delegated child costs one roster read per connection at the most.** A child's durable parent is only published by `session.list`, so the first child a connection opens without a prior listing pays for one roster read; every later child of any parent is free, and a client that lists before it opens pays nothing. A roster that does not name the child's parent leaves the harness's own refusal (`session/agent-busy`) crossing unchanged rather than inventing an address.
268
+ - **A delta exists only where continuity is provable.** The proof is the current follow window's oldest entry, so a reconnect into a window that has already scrolled past `sinceSeq` — or a delta that would not fit one frame — is answered the full baseline with `reset:true`. The bridge still buffers nothing for a disconnected client: it reads the same window it would have opened anyway.
269
+ - **A delegated child costs one roster read per connection at the most.** A child's durable parent is only published by `session.list`, so the first child a connection opens without a prior listing pays for one roster read; every later child of any parent is free, and a client that lists before it opens pays nothing. A roster that resolves no parent for the child answers `session-not-followable` instead of inventing an address, and a child whose parent is not a session this connection is authorized for answers the same.
236
270
  - **`session.history` cannot reach below the opening window.** Pages walk the same baseline `session.snapshot` serves, so the oldest reachable entry is the oldest entry of that window — bounded by the harness's own `maxMessages` window (200 messages). The opening frame's `hasMore` is the harness's answer about anything older, and the bridge does not fetch beyond it.
237
271
  - **An entry larger than one frame cannot be made to fit.** The paged first screen and `session.history` both give such an entry a page of its own rather than refusing, so that one page can exceed the 10 MiB frame cap; every other page stays inside its budget.
238
272
  - **Tool-call arguments arrive as deltas.** A `tool-call` delta may carry an empty `argumentsDelta`, and the client assembles the arguments; a whole call is never re-sent.
package/README.zh.md CHANGED
@@ -20,8 +20,10 @@
20
20
 
21
21
  - **一个面。** 宿主 WebServer 上以精确路径注册的 `/ios/v1` WebSocket;帧为文本帧,一帧一个 JSON 对象,单帧上限 10 MiB(10485760 字节)。
22
22
  - **会话面。** `session.list`、`session.titles`、`session.snapshot`、`session.prompt`、`session.interrupt` 分别覆盖带工作区、谱系与归档元数据的名册、一批会话标题、完整基线加实时订阅、带幂等键的排队发言,以及回合取消。
23
+ - **agent 面。** `presets.list` 转发宿主的 Agent 预设名册,`session.create` 转发一次创建请求,手机因此能像桌面一样从预设实例化一个 Agent;这两个身体在桥里都不被解释。
24
+ - **fork 面。** `session.fork` 把一条会话分叉成继承它上下文的新会话;切点与新会话的身份都属于宿主,因此请求与回包逐字穿过。
23
25
  - **订阅而非轮询。** `session.snapshot` 打开宿主的 follow 流并保持它,基线与其后的每一条增量都走同一条 socket。
24
- - **审批直达客户端。** 需要授权的工具以 `approval.request` 事件到达,客户端用 `approval.resolve` 作答;无人应答的请求按拒绝处理。
26
+ - **审批直达客户端,重连的手机还能拿回仍悬着的那些。** 需要授权的工具以 `approval.request` 事件到达,客户端用 `approval.resolve` 作答;无人应答的请求按拒绝处理,而声明了 `approvals.v1` 的连接会在握手之后再次收到所有未结算的审批。
25
27
  - **配对。** 一次性 bootstrap token 加 P-256 挑战应答产出可吊销的设备令牌;未配对连接只能触达三个方法。
26
28
  - **一个配对面板。** 同一插件行声明 `dsh.client` 浏览器半区:侧栏底部一个面板,把当前的一次性配对码同时以二维码与明文呈现给操作者,配 30 秒倒计时与「重新取码」。
27
29
  - **中继无需改动。** 协议搭在实例本来就发布的那个 origin 上,中继这一跳照原样转发它,与其他所有请求无异。
@@ -35,34 +37,48 @@
35
37
  | 事件 | `{"t":"ev","seq":<uint>,"m":"<topic>","p":{...}}` |
36
38
  | 心跳 | `{"t":"ping","ts":<ms>}` 与 `{"t":"pong","ts":<ms>}` |
37
39
 
38
- `seq` 属于每个连接,自 1 起单调递增:它给的是该连接收到的事件序号,不是宿主自身的历史。帧为文本帧、一帧一个 JSON 对象、单帧上限 10 MiB(10485760 字节)。空闲连接每 20 秒探活一次;客户端以 pong 回应 ping,桥接侧同样如此。
40
+ `seq` 属于每个连接,自 1 起单调递增:它给的是该连接收到的事件序号,不是宿主自身的历史。帧为文本帧、一帧一个 JSON 对象、单帧上限 10 MiB(10485760 字节)。空闲连接每 20 秒探活一次;客户端以 pong 回应 ping,桥接侧同样如此。客户端在收到 ping 后 10 秒内一帧都没发,连接会以关闭码 4000 关闭;没有对应 ping 的 pong 仍被忽略。
39
41
 
40
42
  ## 方法集
41
43
 
42
44
  | 方法 | 请求 `p` | 响应 `r` |
43
45
  | --- | --- | --- |
44
- | `hello` | `{proto:1, minor:0, client:"ios/0.1", cap:["session.stream.v1","session.snapshot.trim.v1"]}` | `{proto:1, minor:0, server:"dsh-remote-bridge", resume:"snapshot", auth:"paired" 或 "unpaired"}` |
45
- | `session.list` | `{}` | `{sessions:[{id, title, updatedAt, agentRunning, cwd?, parentSessionId?, origin?, blank, archived?}]}` |
46
+ | `hello` | `{proto:1, minor:11, client:"ios/0.1", cap:["session.snapshot.trim.v1","subagent.thread.v1"]}` | `{proto:1, minor:11, server:"dsh-remote-bridge", capabilities:["session.snapshot.trim.v1","session.snapshot.page.v1","questions.v1","subagent.thread.v1","jobs.v1","agents.v1","delta.v1","session.list.omit-archived.v1","session.deep-history.v1","frame.deflate.v1","session.list.compact.v1","session.snapshot.since.v1","session.fork.v1"], resume:"snapshot", auth:"paired" 或 "unpaired"}` |
47
+ | `session.list` | `{since?, cwd?, maxRows?, after?}` | `{mode, token, sessions:[{id, title, updatedAt, agentRunning, cwd?, parentSessionId?, origin?, blank, archived?}]}`;紧凑页为 `{mode:"reset", token:"", compact:true, sessions:[...], nextAfter?}` |
46
48
  | `session.titles` | `{ids:[<sessionId>, ...]}` | `{titles:{"<id>":"<title>", ...}}` |
47
- | `session.snapshot` | `{sessionId, maxBytes?}` | `{turns:[...], lastSeq:<uint>, hasMore?}` |
49
+ | `session.snapshot` | `{sessionId, sinceSeq?, maxBytes?}` | `{turns:[...], lastSeq:<uint>, hasMore?}`;增量另加 `mode:"since", reset:false`,替换客户端副本的基线另加 `mode:"full", reset:true` |
48
50
  | `session.history` | `{sessionId, before?, maxBytes?}` | `{turns:[...], nextBefore?:<uint>, hasMore:<bool>}` |
51
+ | `session.history.deep` | `{sessionId, before?, maxBytes?}` | `{turns:[...], nextBefore?:<uint>, hasMore:<bool>}` |
49
52
  | `session.prompt` | `{sessionId, text, requestId}` | `{accepted:true}` |
50
53
  | `session.interrupt` | `{sessionId}` | `{ok:true}` |
54
+ | `presets.list` | `{}` | 宿主 `agentPresets/list` 的身体,逐字转发 |
55
+ | `session.create` | 宿主自己的 `SessionCreateRequest` | 宿主 `session/create` 的身体,逐字转发 |
56
+ | `session.fork` | `{sessionId, atSeq?}` | 宿主 `session/fork` 的身体(`SessionForkValue`),逐字转发 |
51
57
  | `pair.begin` | `{token}` | `{nonce, expiresAt}` |
52
58
  | `pair.finish` | `{devicePubKey, signature}` | `{deviceToken, deviceId}` |
53
59
  | `approval.resolve` | `{id, decision}` | `{ok:true}` |
54
60
 
55
61
  `hello` 无需设备令牌即可调用,并回报本连接自身的 `auth` 状态。`session.snapshot` 把宿主 follow 流的开帧快照映射成 `turns`,把它的 cursor 作为 `lastSeq` 回报,随后保持该流作为本连接对该会话的订阅;`session.prompt` 幂等地确保同一条订阅,因此客户端可以跳过 snapshot。发言模式固定为排队,`clientTimeZone` 由服务端填本机 IANA 时区,`requestId` 是幂等键:同名 `requestId` 在同一会话内只发一次,重复调用直接回 `{accepted:true}` 且不再发送。`session.interrupt` 取消回合,不拆除订阅。
56
62
 
57
- `hello` 还携带客户端的能力声明,而能力是公告而非协商:无论 `cap` 里是什么,握手都回同一个帧,未知名字被忽略;单帧上限在两个方向上都是同一个常量——约束接收帧的 10 MiB,同时也是拟合快照、以及丢弃超限出站事件的同一份预算。本协议版本认识的能力只有一个:`session.snapshot.trim.v1`。未声明它的客户端——包括该能力出现之前写下的所有客户端——拿到的基线与协议 v1 一直以来提供的逐字节一致。声明了它的客户端拿到的是裁剪过的基线:每个回合内部只保留它能渲染的 entry(`user/message`、`assistant/message`、`tool/call`、`tool/result`),宿主自己的记账记录(`system/message`、`request/header` 之类)在量帧大小之前就被剔除。快照的其余部分不变:保留哪些回合、它们的顺序,以及每个回合的 `seq`、`endSeq`、`reason`、`time` 都是投影自己的取值;一个回合的 entry 若全是记账记录,该回合仍保留为 `entries` 为空的回合;`lastSeq` 仍是宿主游标。帧预算在其后生效——先裁 entry,再丢最旧的整回合,仍然装不下才回 `snapshot-too-large`。
63
+ agent 的两个方法什么都不解释。`presets.list` 把宿主 `agentPresets/list` 的身体原样回给客户端——该端点不收请求,所以一行预设就是注册表发布的东西,连它的插件清单一起——`session.create` 把客户端的身体作为该端点唯一的 `request` 参数送出,再把宿主自己的回包原样回给客户端。字段名、默认值与拒绝码都属于宿主:客户端对着宿主自己的 `SessionCreateRequest` 校验创建请求,而不是对着桥里留的一份副本;宿主拒绝时它拿到的是宿主的 `code` 与 `msg`——没有错误码的失败以本桥的 `internal` 穿出,但消息仍是宿主的原文。两个方法只对声明了 `agents.v1` 的客户端存在:没声明时各自回 `unknown-method`,且什么都不发;声明了却从不调用,则宿主一次读取都不会发生。
58
64
 
59
- 第二个能力 `session.snapshot.page.v1` 给首屏本身加上页预算。不声明时,一次快照仍是整个开帧窗口,逐字节与今天一致。声明之后,`session.snapshot` 只回最新一页,按 `maxBytes`(默认 524288,即 512 KiB;不是可用预算就拒绝,而不是悄悄夹取)衡量,并用 `session.history` 那同一套按 entry 的切片来切:一个回合的 entry 可以跨在这一页与下一页之间,而该回合保留自己的字段;比整页预算还大的单条 entry 独占一页;`snapshot-too-large` 再也不会回给这样的连接。这一页带 `lastSeq` 与 `hasMore`,而它继续往回的游标就是它自己最旧那条 entry 的 `seq`——正是 `session.history` 的 `before` 所取的值,所以不再用 `nextBefore` 重述一遍。于是打开一个会话只需一页,`session.history` 以同样的 512 KiB 页把窗口其余部分往回走完。
65
+ fork 的方法同样什么都不解释。`session.fork` 把 `sessionId` 与客户端真的点名时才有的 `atSeq`(fork 包含的源事件 seq)作为该端点唯一的 `request` 参数送出,再把宿主自己的 `SessionForkValue` 原样回给客户端。省略的 `atSeq` 就保持省略:宿主把缺席的切点读成最新一个已完成轮,在这里补一个等于悄悄挪动切点。不是正整数的切点在这里以 `invalid-args` 拒绝,因为任何事件日志都没有这样的 seq;宿主拒绝的请求带着宿主自己的 `code` 与 `msg` 穿出,没有错误码的失败以本桥的 `internal` 穿出。该方法只对声明了 `session.fork.v1` 的客户端存在:没声明时回 `unknown-method`,且什么都不发。
60
66
 
61
- `session.snapshot` 与 `session.history` 按宿主要求的方式寻址会话。普通会话用它自己的 id 寻址;被委派的子会话——名册行带 `origin:"subagent"` 的那些——只能通过它的持久父会话寻址,而把一个子会话当作普通会话来问,宿主会回 `session/agent-busy`。桥依据宿主自己的这条拒绝来判定,而不是去猜:它只对这一个会话改用委派地址 `{kind:"subagent", parentSessionId, childSessionId, mode:"unknown"}` 重试一次,并把子会话的真实历史交给客户端。父 id 来自名册——唯一携带谱系的端点:先列会话再打开会话的客户端不会多付一次读取,而每个连接最多读一次名册。普通会话永远不为此付费:它们第一次尝试就打开。没有内容可看的会话也不等于失败:日志里只有宿主自己记账记录的会话,回的是真实投影加一个空回合;只有拿不到开帧、或宿主自己抛错,才会被拒绝。
67
+ `hello` 还携带客户端的能力声明,而能力是公告而非协商:无论 `cap` 里是什么,握手都回同一个帧,未知名字被忽略;单帧上限在两个方向上都是同一个常量——约束接收帧的 10 MiB,同时也是拟合快照、以及丢弃超限出站事件的同一份预算。本桥自己服务十三个能力,并在 `hello` 的 `capabilities` 里公告它们:`session.snapshot.trim.v1`、`session.snapshot.page.v1`、`questions.v1`、`subagent.thread.v1`、`jobs.v1`、`agents.v1`、`delta.v1`、`session.list.omit-archived.v1`、`session.deep-history.v1`、`frame.deflate.v1`、`session.list.compact.v1`、`session.snapshot.since.v1`、`session.fork.v1`——插件注册的能力不在其中,因为桥不是它的作者。`approvals.v1` 也不在其中,它由客户端声明、本桥刻意从不公告:它门控的是一次重放而不是通道本身,因此握手对每个客户端都是同一个帧(见下文审批通道)。第一个就是裁剪基线。未声明它的客户端——包括该能力出现之前写下的所有客户端——拿到的基线与协议 v1 一直以来提供的逐字节一致。声明了它的客户端拿到的是裁剪过的基线:每个回合内部只保留它能渲染的 entry(`user/message`、`assistant/message`、`tool/call`、`tool/result`、`subagent/catalog`),宿主自己的记账记录(`system/message`、`request/header` 之类)在量帧大小之前就被剔除。快照的其余部分不变:保留哪些回合、它们的顺序,以及每个回合的 `seq`、`endSeq`、`reason`、`time` 都是投影自己的取值;一个回合的 entry 若全是记账记录,该回合仍保留为 `entries` 为空的回合;`lastSeq` 仍是宿主游标。帧预算在其后生效——先裁 entry,再丢最旧的整回合,仍然装不下才回 `snapshot-too-large`。
68
+
69
+ 第二个能力 `session.snapshot.page.v1` 给首屏本身加上页预算。不声明时,一次快照仍是整个开帧窗口,逐字节与今天一致。声明之后,`session.snapshot` 只回最新一页,按 `maxBytes`(默认 524288,即 512 KiB;不是可用预算就拒绝,而不是悄悄夹取)衡量,并用 `session.history` 那同一套按 entry 的切片来切:一个回合的 entry 可以跨在这一页与下一页之间,而该回合保留自己的字段;比整页预算还大的单条 entry 独占一页;`snapshot-too-large` 再也不会回给这样的连接。预算按整个编码后的应答计量、从不按回合计量,因此它约束的是页而不是 entry:除最新那条 entry 自己就超过预算的情况之外,一页都在 `maxBytes` 之内,而那种情况下这一页就等于该 entry 的大小——一条 2.2 MB 的最新消息对着 512 KiB 的默认预算,回的是 2.2 MB 的一页,而一窗普通 entry 只回 513794 字节。这是分页快照仍可能付出的唯一代价。这一页带 `lastSeq` 与 `hasMore`,而它继续往回的游标就是它自己最旧那条 entry 的 `seq`——正是 `session.history` 的 `before` 所取的值,所以不再用 `nextBefore` 重述一遍。于是打开一个会话只需一页,`session.history` 以同样的 512 KiB 页把窗口其余部分往回走完。 让重连变便宜的能力是 `session.snapshot.since.v1`,而它要两处声明同时成立才改变任何东西:握手里的能力,以及请求里的 `sinceSeq`;缺任何一处,应答逐字节等于该能力出现之前的协议 v1,且不加任何字段,因此客户端可以先接受这个名字,再逐项依赖它。两处都成立时,客户端报出它已持有的那份快照的持久 `lastSeq`——宿主 cursor,从不是本连接自己的事件序号——桥则对着当前 follow 窗口证明连续性:只有当该窗口最旧那条 entry 的 seq 小于等于 `sinceSeq + 1`,或窗口为空时,应答才是增量 `{turns:[...], lastSeq, mode:"since", reset:false}`,只携带该水位之上被发出的 entry,且每个回合保留自己原本的 `seq`、`endSeq`、`reason` 与 `time`,与基线所呈现的形状一致。客户端从不渲染的 entry 仍是窗口持有的 entry,所以这个证明读的是未裁剪的窗口,只可能更保守。窗口若已经滚过该水位,就无法证明链条没断,此时——以及增量装不进一帧 10 MiB 时——应答是本连接本来就会收到的那份基线,另加 `mode:"full"` 与 `reset:true`,这是唯一让客户端丢弃自己副本的应答。裁剪、分页预算与单帧上限都没有动:增量切自同一份投影,而 reset 应答就是今天的应答加上这两个字段。
70
+
71
+ `frame.deflate.v1` 改的是帧的形态而不是内容,而它必须存在于这一层:101 响应不公告任何 `Sec-WebSocket-Extensions`,这个承载层拒绝所有 RSV 位,而 WebSocket API 无法提供 `permessage-deflate` 的客户端根本无从协商,因此线上走什么压缩只能在这里决定。声明了该能力的客户端可能会收到 WebSocket 二进制帧,其载荷是本该写成文本的那段 JSON 的裸 DEFLATE(RFC 1951,不带 zlib 头、不带 adler32 尾):对载荷做 `inflateRaw` 得到的就是那一帧本身,逐字节一致。只有 UTF-8 文本达到 1024 字节的帧才会被考虑;压缩后没有变小的帧仍按文本发送——比原文更大的二进制帧什么也省不下来;方向是单向的,客户端一律继续发文本帧。10 MiB 上限不变,且仍按文本计量,所以本文档里的每一份预算都还是未压缩 JSON 的预算。未声明该能力的客户端拿到的,与协议 v1 一直以来写出的文本帧逐字节一致,握手在两种情况下也完全一样。
72
+
73
+ `subagent.thread.v1` 让一种 delta 存在:宿主持久事件 `subagent/catalog` 登记一个被委派的子会话,桥据此发 `subagent`,载荷 `{childId, label?, mode?, callId?}`。`callId` 是派生出该子会话的那次 `tool/call`,判定按两级、先问 spawn 自己的结果:某条 `tool/result` 点名了这个 child——`subagent` 工具返回的激活句柄 `{"kind":"activation","subagentId":…}`(单独返回,或嵌在 `run_code` 的答案里),或它打印的 `started subagent …` 通知——就由那次调用决定,哪怕这一步发过多条调用、或一次调用起了一整队子会话。没有任何结果点名该 child 时,退回原有判据:同一个 turn+step 里恰好一条 `tool/call` 时才给;那一步发过两条以上、或该 call 已经关联过另一个 child 时一律省略,因为猜出来的 id 会把线程挂到错的卡片上。spawn 的 catalog 事件可能先于它自己的结果被投影,因此实时 delta 只能用这条流到目前为止带过的内容作答,而基线用整个会话作答——两边是同一条规则、同一个 `SpawnCallIndex`。`subagent/catalog` 因此也成了裁剪基线保留的 entry 类型之一,并在 `data.callId` 里带上派生它的那次调用:在子会话已经被派生之后才打开会话的手机,直接读到标签、模式与造出它们的调用,而不是从 agent 消息反推线程。`user-message` 的 `actor` 不受任何能力约束:delta 与快照里的 `user/message` entry 都带 `{kind, sourceKind, sessionId?, label?}`,机械地取自宿主自己的 `source` 记录——`user` 与 `user-approval` 是 `human`,`agent-message` 与 `subagent-settled` 是 `agent`,其余来源种类一律 `system` 并保留原文——所以一条消息不会因为来源种类没被本协议分类过就被丢弃,而 source kind 不可读的事件干脆不带 `actor`。跟随一个会话需要授权,而不是默认成立:本连接已经打开过的会话、以及名册里作为普通会话列出的会话可以直接跟随;被委派的子会话只有它挂靠的父会话属于这两者之一时才可跟随。父会话无法由任何名册解析出来的子会话回 `session-not-followable`,且不为它打开任何流,因此放宽子会话这道闸门不会变成读取调用方从未被授权会话的通道。普通会话用它自己的 id 寻址;被委派的子会话——名册行带 `origin:"subagent"` 的那些——只能通过它的持久父会话寻址,而把一个子会话当作普通会话来问,宿主会回 `session/agent-busy`。父 id 来自名册——唯一携带谱系的端点——而桥在第一次尝试之前就读它,因此名册指明了父的子会话直接用 `{kind:"subagent", parentSessionId, childSessionId, mode:"unknown"}` 寻址,并拿到自己的真实历史。那次读取没解析出父时,改由宿主自己的拒绝当信号:只对这一个会话用委派地址重试一次。先列会话再打开会话的客户端不会多付一次读取,而每个连接最多读一次名册。普通会话永远不为此付费:它们用自己的 id 第一次尝试就打开。没有内容可看的会话也不等于失败:日志里只有宿主自己记账记录的会话,回的是真实投影加一个空回合;只有拿不到开帧、或宿主自己抛错,才会被拒绝。
74
+
75
+ `session.list.omit-archived.v1` 是这里唯一不协商任何东西的能力。桥从不传输已归档的会话——宿主归档集在每次列出时读一次,其中每个 id 都在该行构造之前被跳过——无论客户端是否声明该能力,因此那之后写下的客户端拿到的就是它本来要自己过滤掉的较短名册。在它之后:没有任何 `session.list` 行是归档集点名的会话;存活行在不变的 schema 下仍携带 `archived: false`;读不到归档集的那次列出则一行都不丢。已归档父会话的活跃子会话仍是自己的一行,并仍然点出那个父 id:父 id 由子会话自己的行走带,因此父被归档从不会让子会话失去谱系。名册同时也是 delta 机器做差分的那一集,所以两次列出之间被归档的会话以移除的形式到达,被恢复的则以变更的形式到达,两者都不需要任何特例。
62
76
 
63
77
  `session.history` 以分页方式往回读一个会话的历史,而且它是纯读:既不打开、也不丢弃或改指任何订阅,同一个游标永远给出同一页。它的数据来自 `session.snapshot` 所用的那份开帧基线,因此两者永远不会在某个回合或某条 entry 上给出不同答案——`history` 只是对这份投影做切片。分页按 **entry** 切,不按回合切:一页从调用方游标之下取最新的 entry,直到编码后的页达到 `maxBytes`(默认 524288,即 512 KiB);因此一个回合的 entry 可以跨页,而该回合仍保留自己的 `seq`、`endSeq`、`reason` 与 `time`;单条 entry 若比整页预算还大,就独占一页,而不是被拒绝。`before` 是持久水位而非下标:这一页取 `seq` 严格小于它的 entry,所以游标跨连接仍然有意义,投影在它之下改变形状也不会让分页跳号或重复。省略 `before` 即取最新一页;`hasMore` 说明下面是否还有更旧的 entry,而下一页的游标 `nextBefore` 恰好在 `hasMore` 为真时出现。裁剪能力在这里的生效方式与快照完全一致。
64
78
 
65
- `session.list` 除名册自身字段外还带上手机用来分组与命名的元数据:`cwd`、`parentSessionId`、`origin` 只在宿主确实上报时才出现,`blank` 始终存在,`archived` 只在本次进程能读到宿主归档集时出现——读不到就省略该键,而不是回 `false`。`title` 在本连接尚未通过 `session.titles` 解析过该 id 时保持 `""`,因此列名册仍然只是一次调用,且不会给每一行挂上一次标题读取。`session.titles` 用宿主自己的标题服务回答一批 1 到 100 个 id——读的是本进程的活跃会话,绝不为每个会话各开一条 follow 流——且每个被请求的 id 都是键:本宿主没有活跃持有的 id、或标题尚未落地的 id,一律回 `""`。一个已解析的标题会在 10 秒内被直接复用,之后才再问服务,因此重命名最多要等这么久才可见。与其它会话方法一样,没有设备令牌时两者都回 `unpaired`。
79
+ `session.list` 除名册自身字段外还带上手机用来分组与命名的元数据:`cwd`、`parentSessionId`、`origin` 只在宿主确实上报时才出现,`blank` 始终存在,`archived` 只在本次进程能读到宿主归档集时出现——读不到就省略该键,而不是回 `false`。已归档的会话根本不是一行:归档集每次列出只读一次,其中的 id 在构造该行之前就被跳过,因此真正穿过去的标记永远是 `false`,而手机本来要藏起来的那些行一个字节都不再花。`title` 在本连接尚未通过 `session.titles` 解析过该 id 时保持 `""`,因此列名册仍然只是一次调用,且不会给每一行挂上一次标题读取。`session.titles` 用宿主自己的标题服务回答一批 1 到 100 个 id——读的是本进程的活跃会话,绝不为每个会话各开一条 follow 流——且每个被请求的 id 都是键:本宿主没有活跃持有的 id、或标题尚未落地的 id,一律回 `""`。一个已解析的标题会在 10 秒内被直接复用,之后才再问服务,因此重命名最多要等这么久才可见。与其它会话方法一样,没有设备令牌时两者都回 `unpaired`。
80
+
81
+ 紧凑名册是同一份名册的另一种形态,需要两半同时出现:`session.list.compact.v1` 能力,以及请求里至少一个紧凑参数。`cwd` 是布尔值,决定绝对目录是否过线;`maxRows` 把名册切成每页这么多行;`after` 是上一页最后一行的 id,因此是续页而不是重取。行按最近优先排序、id 作平手判据,这正是 `after` 成为游标而不是位置的原因;`nextAfter` 只在后面还有行时出现,而指不到任何行的游标回第一页——就像本窗口从未签发过的 delta 令牌回 reset。`updatedAt` 只在本连接尚未把该 id 的这个值发给该客户端时出现,因此重复列出时一个都不带;`compact:true` 表明这些行就在这个 schema 下,于是缺失的 `updatedAt` 永远不会被误读成宿主从来没有的值。不带任何紧凑参数的请求,以及未声明该能力的客户端发出的每一次请求,都按上面的 schema 得到整份名册,逐字节相同。紧凑页与 `since` 令牌是两个不同问题各自的答案,同时出现的请求以 `invalid-args` 拒绝。
66
82
 
67
83
  ## 事件
68
84
 
@@ -80,8 +96,23 @@
80
96
  | `tool-call` | `{callId, name, argumentsDelta}` | 工具调用增量;`argumentsDelta` 可为空串 |
81
97
  | `tool-result` | `{callId, output, isError}` | 工具结果 |
82
98
  | `turn-end` | `{reason}` | 回合结束;`completed` 之外都算异常结束 |
99
+ | `user-message` | `{text, messageId?, attachments?, actor?}` | 一条用户消息;`actor` 说明它从哪来 |
100
+ | `subagent` | `{childId, label?, mode?, callId?}` | 宿主登记了一个被委派的子会话;需能力 `subagent.thread.v1` |
101
+
102
+ `approval.request` 的摘要取自宿主按客户端语言给出的显示理由,缺失时回落英文、再回落工具名,并附带工具名本身。客户端用 `approval.resolve` 作答,`decision` 取 `allowed-once` 或 `rejected`;未知或过期的 `id` 会被拒绝,而无人应答的请求在两分钟后按 unavailable 结算,宿主视之为拒绝。工具发起请求的那一刻,每一条已配对连接都会收到该事件——首播不在任何能力名之后——而声明了 `approvals.v1` 的连接会在 `hello` 之后再次收到所有仍在等待的请求,因此重连过的手机、或事后才打开该会话的界面,手里依然有卡片。只有未结算的请求会被重放:已作答、已超时、已撤回的请求早已离开认领表,而重新递一次请求绝不会挪动它的两分钟截止时间。该能力只门控这第二次送达,因此它不出现在 `hello` 的 `capabilities` 里、也不改动 `minor`:握手对每个客户端都回同一个帧。桥只在下游有已配对客户端连接时才认领请求:一个都没有时,请求交给下一个应答者,而不是干等一台不在场的手机。
103
+
104
+ ## 扩展缝
105
+
106
+ 本包只发布一道通用扩展缝,自己的词表里不放任何业务词。已挂载的插件解析 cordis 服务 `remoteBridge`,即可向协议 v1 增加方法与事件,而桥不需要知道它们是什么意思:
107
+
108
+ | 成员 | 契约 |
109
+ | --- | --- |
110
+ | `registerMethods({capability?, methods})` | 增加一张客户端可调用的方法表,返回撤回它们的 disposer;`KNOWN_METHODS` 里的名字、空名字或另一张表已占用的名字一律拒绝,且整张表一起拒绝 |
111
+ | `broadcast(topic, payload, capability?)` | 向已配对的连接推送一个事件(指名能力时只投给声明了它的连接),返回实际收下该帧的连接数 |
112
+
113
+ 已注册方法的派发排在两道协议闸门之后:没有插件注册的名字最先回 `unknown-method`;没有有效设备令牌的连接回 `unpaired`,与协议方法完全一致;从未声明该表所需能力的客户端同样回 `unknown-method`——方法对它而言不存在,而不是没有权限。处理器收到请求载荷与本连接 id,回 `{ok:true, r}` 或 `{ok:false, code, msg}`;两种都原样穿过,因为错误码归注册它的插件所有。处理器抛错、或两种形状都没回时,以桥自己的 `internal` 穿过。
83
114
 
84
- `approval.request` 的摘要取自宿主按客户端语言给出的显示理由,缺失时回落英文、再回落工具名,并附带工具名本身。客户端用 `approval.resolve` 作答,`decision` 取 `allowed-once` 或 `rejected`;未知或过期的 `id` 会被拒绝,而无人应答的请求在两分钟后按 unavailable 结算,宿主视之为拒绝。桥只在下游有已配对客户端连接时才认领请求:一个都没有时,请求交给下一个应答者,而不是干等一台不在场的手机。
115
+ `hello` 现在回 `minor:11`,起自 fork 通道落地(比先一步在集成分支上落地的快照增量通道高一位):`session.fork.v1` 背后,客户端可以调 `session.fork` 并拿到宿主自己的 fork 结果。`minor:10` 是快照可按请求增量之时:`session.snapshot.since.v1` 背后,带 `sinceSeq` 的 `session.snapshot` 要么只回该水位之上的 entry,要么回一份带 `mode` 与 `reset` 的完整基线,所以这一位是为客户端能从线上读到的应答形状而提的。`minor:9` 是紧凑名册之时:`session.list.compact.v1` 背后,带 `cwd`、`maxRows` 或 `after` 的列出得到更短、且可分页的行,所以这一位是为客户端能从线上读到的行 schema 而提的。`minor:8` 是下行帧的形态本身成为一种能力之时:`frame.deflate.v1` 背后,声明了的客户端可能收到承载裸 DEFLATE 的 binary 帧,所以这一位是为客户端能从线上读到的东西而提的。`minor:7` 是两条通道汇合之时;`minor:6` 是其中任一条单独在位——agent 通道在 dev 上,持久历史分页在它自己的分支上;`minor:5` 时是名册不再携带已归档会话。`agents.v1` 背后,`presets.list` 与 `session.create` 转发宿主的预设名册与一次创建请求;`session.deep-history.v1` 背后,`session.history.deep` 把会话的持久存储一直翻到最早一条 entry;`session.fork.v1` 背后,`session.fork` 把一条会话分叉成继承它的新会话。`minor:4` 加了字节级增量,`minor:3` 是后台作业通道,`minor:2` 是子代理线程,`minor:1` 是本扩展缝。它们都没有改动主版本 1、任何冻结字段、方法名或主题名。唯一对每个客户端都变短的响应体是名册本身,它不再点名已归档会话;其余答案对什么都不声明的客户端仍是协议 v1 自己的。
85
116
 
86
117
  ## 错误码
87
118
 
@@ -207,7 +238,7 @@ pnpm install && pnpm -r build
207
238
  dsh plugin --profile web add link:$(pwd)/packages/dsh-remote-bridge
208
239
  ```
209
240
 
210
- 家族聚合包 `@linxin666/dsh-web-all` 会连同家族其余内容一起装上本插件。安装或更新后需重启 `dsh web`——宿主半区在插件行挂载时注册路由,提供服务的就是那个运行中的宿主——随后刷新 Web GUI 页面,浏览器半区在侧栏底部的触发器才会出现。
241
+ 本插件是家族成员:聚合包 `@linxin666/dsh-web-all` 会把它作为 `remote-bridge` 行连同家族其余内容一起装上,因此装上聚合包就够了。单装本包仍然受支持,且仍是只跟随本插件自身版本、不跟聚合包版本的做法。两条路加载的是同一个 npm 包,所以 profile 里同时存在两行时宿主半区仍只注册一份——`/ios/v1` 与 token 路由归先挂载的那个来源,家族的单实例守卫会在该来源在宿主运行期间被拆除时重放那次被拒的挂载。安装或更新后需重启 `dsh web`——宿主半区在插件行挂载时注册路由,提供服务的就是那个运行中的宿主——随后刷新 Web GUI 页面,浏览器半区在侧栏底部的触发器才会出现。
211
242
 
212
243
  ## 配置
213
244
 
@@ -229,10 +260,11 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-remote-bridge
229
260
 
230
261
  - **标题属于活跃会话。** `session.titles` 读的是本宿主进程活跃持有的会话的标题;名册仍会列出未被挂载的持久会话,这些 id 在宿主挂载它们之前一律回 `""`。
231
262
  - **已服务过的标题最多可能旧 10 秒。** 一个已解析的标题在 10 秒内被直接复用,之后才再问标题服务,因此重命名或刚生成的标题最多要等这么久才出现。
232
- - **读不到归档集时没有 `archived` 键。** 该标记来自宿主的 workspace registry;该服务未挂载时,每一行都省略此键,而不是回 `false`。
263
+ - **读不到归档集时没有 `archived` 键。** 该标记来自宿主的 workspace registry;该服务未挂载时,每一行都省略此键,而不是回 `false`,并且一行都不丢——读不到的桥不会给出更短的名册。
264
+ - **已归档的父会话不授权任何东西。** 已归档父会话的活跃子会话仍会被列出、也仍点出那个父,但在父被恢复之前跟随该子会话会回 `session-not-followable`:授权一个会话的是名册,而已归档的那个已不在名册上。
233
265
  - **`lastSeq` 与 `seq` 是两个计数器。** `session.snapshot` 的 `lastSeq` 是宿主流的 cursor,事件的 `seq` 是本连接自己的事件序号,二者不可比较;续传状态属于客户端。
234
- - **不做增量补发。** 发现跳号或重连的客户端重新调 `session.snapshot` 拿完整基线;本包不为断开的客户端缓存 delta。
235
- - **被委派的子会话每个连接最多付一次名册读取。** 子会话的持久父 id 只有 `session.list` 会发布,所以一个连接在没先列名册的情况下打开的第一个子会话,要付一次名册读取;此后任何父名下的任何子会话都不再付费,而先列名册再打开的客户端一分不付。名册若没有指明该子会话的父,桥会让宿主自己的拒绝(`session/agent-busy`)原样穿过,而不是编造一个地址。
266
+ - **增量只在连续性可证之处存在。** 证明取的是当前 follow 窗口最旧那条 entry,因此重连进一个已经滚过 `sinceSeq` 的窗口、或增量装不进一帧时,应答是带 `reset:true` 的完整基线;本包仍不为断开的客户端缓存任何东西,它读的就是本来也会打开的那个窗口。
267
+ - **被委派的子会话每个连接最多付一次名册读取。** 子会话的持久父 id 只有 `session.list` 会发布,所以一个连接在没先列名册的情况下打开的第一个子会话,要付一次名册读取;此后任何父名下的任何子会话都不再付费,而先列名册再打开的客户端一分不付。名册若解析不出该子会话的父,桥回 `session-not-followable`,而不是编造一个地址;父不是本连接已授权会话的子会话同样如此。
236
268
  - **`session.history` 到不了开帧窗口之下。** 分页走的就是 `session.snapshot` 所用的那份基线,因此最旧可达的 entry 就是那个窗口里最旧的 entry——受宿主自己的 `maxMessages` 窗口(200 条消息)限制。开帧上的 `hasMore` 是宿主对更旧内容的回答,桥不会越过它去取。
237
269
  - **比一帧还大的单条 entry 无法被塞进预算。** 分页首屏与 `session.history` 都会让这样的 entry 独占一页而不是拒绝,因此承载它的那一页可能超过 10 MiB 单帧上限;其余每一页都留在自己的预算之内。
238
270
  - **工具调用参数以增量到达。** `tool-call` 增量的 `argumentsDelta` 可以为空串,参数由客户端拼装;整次调用不会被重发。
package/icon.svg ADDED
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <path fill="#4d6bfe" fill-rule="evenodd" d="M 67.5 120 L 70.5 120 L 72.5 121 L 80.5 129 L 81.5 129 L 84.5 132 L 85.5 132 L 90.5 136 L 93.5 137 L 95.5 139 L 101.5 142 L 103.5 142 L 106.5 144 L 111.5 145 L 112.5 146 L 115.5 146 L 119.5 148 Q 122.75 147.25 123.5 149 L 127.5 149 L 128.5 150 L 133.5 150 L 134.5 151 L 140.5 151 L 141.5 152 L 150.5 152 L 151.5 153 L 160.5 153 L 161.5 154 L 171.5 154 L 172.5 155 L 178.5 155 L 179.5 156 Q 183.5 155 184.5 157 L 189.5 157 Q 190.5 159 194.5 158 L 195.5 159 L 197.5 159 L 198.5 160 L 200.5 160 L 201.5 161 L 206.5 162 L 209.5 164 L 211.5 164 L 219.5 168 L 224.5 172 L 227.5 173 L 247 191.5 L 247 192.5 L 253 199.5 L 255.5 204 L 258 201.5 L 263 193.5 L 272.5 183 L 273.5 183 L 280.5 176 L 281.5 176 L 292.5 168 L 300.5 164 L 302.5 164 L 305.5 162 L 307.5 162 L 308.5 161 L 310.5 161 L 314.5 159 L 317.5 159 L 318.5 158 Q 321.75 158.75 322.5 157 L 326.5 157 L 327.5 156 L 331.5 156 L 332.5 155 L 337.5 155 L 338.5 154 L 348.5 154 L 349.5 153 L 358.5 153 L 359.5 152 L 368.5 152 L 369.5 151 L 376.5 151 L 377.5 150 L 383.5 150 L 384.5 149 L 388.5 149 L 389.5 148 L 392.5 148 L 393.5 147 L 396.5 147 L 397.5 146 L 399.5 146 L 400.5 145 L 405.5 144 L 423.5 135 L 426.5 132 L 431.5 129 L 439.5 121 L 441.5 120 L 444.5 120 L 448 123.5 L 448 140.5 L 447 141.5 L 447 149.5 L 446 150.5 L 446 154.5 L 445 155.5 Q 445.75 158.75 444 159.5 L 444 163.5 Q 442.25 164.25 443 167.5 L 440 173.5 L 439 178.5 L 435 185.5 L 435 187.5 L 432 193.5 L 430 195.5 L 429 198.5 L 427 200.5 L 425 204.5 L 419 211.5 L 419 212.5 L 402.5 229 L 401.5 229 L 394.5 235 L 393.5 235 L 388.5 239 L 385.5 240 L 383.5 242 L 371.5 248 L 369.5 248 L 364.5 251 L 362.5 251 L 361.5 252 L 359.5 252 L 358.5 253 L 356.5 253 L 355.5 254 L 353.5 254 L 349.5 256 L 342.5 257 L 338.5 259 L 335.5 259 L 334.5 260 L 327.5 261 L 326.5 262 L 324.5 262 L 323.5 263 L 321.5 263 L 320.5 264 L 318.5 264 L 317.5 265 L 312.5 266 L 309.5 268 L 307.5 268 L 295.5 275 L 288 282.5 Q 287.5 286 285 287.5 Q 285.5 290 284 290.5 L 284 293.5 L 283 294.5 L 283 311.5 L 284 312.5 L 284 318.5 L 285 319.5 L 285 323.5 L 286 324.5 L 286 328.5 Q 288 329.5 287 333.5 L 288 334.5 L 288 337.5 L 289 338.5 L 289 341.5 L 290 342.5 L 290 345.5 L 291 346.5 L 292 353.5 L 293 354.5 L 293 356.5 L 295 360.5 L 295 363.5 L 296 364.5 L 296 367.5 L 297 368.5 L 297 370.5 L 298 371.5 L 298 373.5 L 299 374.5 L 299 376.5 L 301 380.5 L 301 386.5 L 298.5 389 L 294.5 391 Q 292 390.5 291.5 392 L 286.5 392 L 285.5 393 L 272.5 393 L 271.5 394 L 240.5 394 L 239.5 393 L 227.5 393 L 226.5 392 L 221.5 392 Q 220.75 390.25 217.5 391 L 212 387.5 L 211 385.5 L 211 381.5 L 212 380.5 Q 211.5 378 213 377.5 L 213 374.5 L 214 373.5 L 214 371.5 L 216 367.5 L 216 364.5 L 217 363.5 L 217 361.5 L 219 357.5 L 219 354.5 L 221 350.5 L 221 347.5 L 222 346.5 L 222 343.5 L 223 342.5 L 223 339.5 L 224 338.5 L 224 335.5 L 225 334.5 Q 224.25 331.25 226 330.5 L 226 326.5 L 227 325.5 Q 226 321.5 228 320.5 L 228 315.5 L 229 314.5 L 229 292.5 L 228 291.5 L 227 286.5 L 225 284.5 L 223 280.5 L 219.5 277 L 218.5 277 L 212.5 272 L 202.5 267 L 200.5 267 L 197.5 265 L 194.5 265 L 193.5 264 L 191.5 264 L 190.5 263 L 188.5 263 L 184.5 261 L 181.5 261 L 180.5 260 L 173.5 259 L 172.5 258 L 170.5 258 L 166.5 256 L 159.5 255 L 158.5 254 L 156.5 254 L 155.5 253 L 150.5 252 L 147.5 250 L 145.5 250 L 142.5 248 L 140.5 248 L 128.5 242 L 123.5 238 L 120.5 237 L 109.5 228 L 108.5 228 L 95 214.5 L 95 213.5 L 87 204.5 L 84 198.5 L 82 196.5 L 80 191.5 L 77 187.5 L 77 185.5 L 72 175.5 L 72 173.5 L 71 172.5 L 71 170.5 L 69 166.5 L 69 163.5 L 68 162.5 Q 68.75 159.25 67 158.5 L 67 154.5 L 66 153.5 L 66 148.5 L 65 147.5 L 65 139.5 L 64 138.5 L 64 124.5 L 67.5 120 Z"/>
3
+ </svg>