zcode-acp-server 0.5.0 → 0.7.0
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.md +16 -4
- package/dist/backend/types.d.ts +17 -0
- package/dist/backend/types.d.ts.map +1 -1
- package/dist/handlers/io.d.ts +13 -0
- package/dist/handlers/io.d.ts.map +1 -1
- package/dist/handlers/io.js +36 -0
- package/dist/handlers/io.js.map +1 -1
- package/dist/handlers/replay.d.ts.map +1 -1
- package/dist/handlers/replay.js +131 -20
- package/dist/handlers/replay.js.map +1 -1
- package/dist/handlers/session.d.ts.map +1 -1
- package/dist/handlers/session.js +5 -0
- package/dist/handlers/session.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/remote/broadcast.d.ts +11 -0
- package/dist/remote/broadcast.d.ts.map +1 -1
- package/dist/remote/broadcast.js +21 -0
- package/dist/remote/broadcast.js.map +1 -1
- package/dist/remote/endpoint.d.ts +32 -8
- package/dist/remote/endpoint.d.ts.map +1 -1
- package/dist/remote/endpoint.js +113 -17
- package/dist/remote/endpoint.js.map +1 -1
- package/dist/remote/file-endpoint.d.ts +23 -0
- package/dist/remote/file-endpoint.d.ts.map +1 -0
- package/dist/remote/file-endpoint.js +348 -0
- package/dist/remote/file-endpoint.js.map +1 -0
- package/dist/remote/hub-server.d.ts.map +1 -1
- package/dist/remote/hub-server.js +55 -2
- package/dist/remote/hub-server.js.map +1 -1
- package/dist/remote/session-liveness.d.ts +19 -0
- package/dist/remote/session-liveness.d.ts.map +1 -0
- package/dist/remote/session-liveness.js +70 -0
- package/dist/remote/session-liveness.js.map +1 -0
- package/dist/server.d.ts +10 -8
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +16 -9
- package/dist/server.js.map +1 -1
- package/docs/ARCHITECTURE.md +12 -6
- package/docs/REMOTE-CLIENTS.md +65 -8
- package/docs/REPLAY-GUIDE.md +45 -15
- package/docs/adr/0004-session-scoped-readonly-file-access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,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -101,12 +101,12 @@ export declare class ZcodeAcpServer {
|
|
|
101
101
|
/**
|
|
102
102
|
* Lightweight session summaries for the remote hub's discovery API
|
|
103
103
|
* (acp_sid → { title, updatedAt, hasActivity }). In-memory only — the hub
|
|
104
|
-
* holds no business state and the bridge dies with its editor, so
|
|
105
|
-
* would buy nothing. Maintained by `touchSessionSummary` at
|
|
106
|
-
* registration, title set, and turn completion. `hasActivity` gates
|
|
107
|
-
* discovery payload: an editor restart auto-resumes its stored
|
|
108
|
-
* materializing an empty backend session — never-used sessions
|
|
109
|
-
* to remote clients until first real use.
|
|
104
|
+
* holds no business state and the bridge dies with its editor, so
|
|
105
|
+
* persistence would buy nothing. Maintained by `touchSessionSummary` at
|
|
106
|
+
* session registration, title set, and turn completion. `hasActivity` gates
|
|
107
|
+
* the discovery payload: an editor restart auto-resumes its stored
|
|
108
|
+
* placeholder, materializing an empty backend session — never-used sessions
|
|
109
|
+
* stay invisible to remote clients until first real use.
|
|
110
110
|
*/
|
|
111
111
|
readonly sessionSummaries: Map<string, {
|
|
112
112
|
title?: string;
|
|
@@ -186,9 +186,11 @@ export declare class ZcodeAcpServer {
|
|
|
186
186
|
*/
|
|
187
187
|
markSessionActive(acpSid: string): void;
|
|
188
188
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
189
|
+
* The bridge's project directory: first known session cwd, else the bridge
|
|
190
|
+
* process cwd (Zed spawns the server with the worktree root as cwd).
|
|
191
191
|
*/
|
|
192
|
+
projectCwd(): string;
|
|
193
|
+
/** Best-effort workspace label for the hub discovery payload. */
|
|
192
194
|
workspaceLabel(): string;
|
|
193
195
|
/**
|
|
194
196
|
* Ensure a background-task listener is registered for the session. Idempotent
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA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kBAAkB,CAAC;CAoCjF"}
|
package/dist/server.js
CHANGED
|
@@ -65,12 +65,12 @@ export class ZcodeAcpServer {
|
|
|
65
65
|
/**
|
|
66
66
|
* Lightweight session summaries for the remote hub's discovery API
|
|
67
67
|
* (acp_sid → { title, updatedAt, hasActivity }). In-memory only — the hub
|
|
68
|
-
* holds no business state and the bridge dies with its editor, so
|
|
69
|
-
* would buy nothing. Maintained by `touchSessionSummary` at
|
|
70
|
-
* registration, title set, and turn completion. `hasActivity` gates
|
|
71
|
-
* discovery payload: an editor restart auto-resumes its stored
|
|
72
|
-
* materializing an empty backend session — never-used sessions
|
|
73
|
-
* to remote clients until first real use.
|
|
68
|
+
* holds no business state and the bridge dies with its editor, so
|
|
69
|
+
* persistence would buy nothing. Maintained by `touchSessionSummary` at
|
|
70
|
+
* session registration, title set, and turn completion. `hasActivity` gates
|
|
71
|
+
* the discovery payload: an editor restart auto-resumes its stored
|
|
72
|
+
* placeholder, materializing an empty backend session — never-used sessions
|
|
73
|
+
* stay invisible to remote clients until first real use.
|
|
74
74
|
*/
|
|
75
75
|
sessionSummaries = new Map();
|
|
76
76
|
/** Session titles already set, to enforce set-once (acp_sid → title). */
|
|
@@ -177,12 +177,16 @@ export class ZcodeAcpServer {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
180
|
+
* The bridge's project directory: first known session cwd, else the bridge
|
|
181
|
+
* process cwd (Zed spawns the server with the worktree root as cwd).
|
|
182
182
|
*/
|
|
183
|
-
|
|
183
|
+
projectCwd() {
|
|
184
184
|
return this.sessionCwds.values().next().value ?? process.cwd();
|
|
185
185
|
}
|
|
186
|
+
/** Best-effort workspace label for the hub discovery payload. */
|
|
187
|
+
workspaceLabel() {
|
|
188
|
+
return this.projectCwd();
|
|
189
|
+
}
|
|
186
190
|
/**
|
|
187
191
|
* Ensure a background-task listener is registered for the session. Idempotent
|
|
188
192
|
* — returns the existing listener if already registered (covers resume/load
|
|
@@ -284,6 +288,9 @@ export class ZcodeAcpServer {
|
|
|
284
288
|
promptCapabilities: { image: true, audio: false, embeddedContext: false },
|
|
285
289
|
mcpCapabilities: { http: false, sse: false },
|
|
286
290
|
sessionCapabilities: { list: {}, resume: {}, fork: {} },
|
|
291
|
+
// Read-only session file access lives on the bridge's loopback /fs
|
|
292
|
+
// endpoint, hub-proxied at /api/instances/{id}/fs/* (ADR-0004).
|
|
293
|
+
_meta: { zcode: { fs: true } },
|
|
287
294
|
},
|
|
288
295
|
// The GLM API key is read from ~/.zcode/v2/config.json by the ZCode
|
|
289
296
|
// backend subprocess; the editor never needs to supply credentials.
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AA0B/D,MAAM,OAAO,cAAc;IACzB,iEAAiE;IACjE,OAAO,GAAwB,IAAI,CAAC;IACpC,4EAA4E;IACnE,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IAChD;;;;;;OAMG;IACM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtD;;;;;;;;;;;OAWG;IACM,eAAe,GAAG,IAAI,GAAG,EAY/B,CAAC;IACJ;;;;;OAKG;IACM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IACjD,4DAA4D;IACnD,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;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YAAY,UAAU,EAAE,IAAI,IAAI,SAAS,EAAE;YAC3C,aAAa,UAAU,EAAE,OAAO,IAAI,SAAS,EAAE;YAC/C,sBAAsB,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAC3F,CAAC;QAEF,OAAO;YACL,eAAe,EAAE,gBAAgB;YACjC,SAAS,EAAE,EAAE,GAAG,UAAU,EAAE;YAC5B,iBAAiB,EAAE;gBACjB,WAAW,EAAE,IAAI;gBACjB,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;gBACzE,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;gBAC5C,mBAAmB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;gBACvD,mEAAmE;gBACnE,gEAAgE;gBAChE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;aAC/B;YACD,oEAAoE;YACpE,oEAAoE;YACpE,uEAAuE;YACvE,kEAAkE;YAClE,WAAW,EAAE;gBACX;oBACE,EAAE,EAAE,mBAAmB;oBACvB,IAAI,EAAE,4BAA4B;oBAClC,WAAW,EACT,2HAA2H;iBAC9H;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -197,12 +197,13 @@ API only because the ZCode backend itself sends them for inference.
|
|
|
197
197
|
|
|
198
198
|
### `remote/` — Remote access (opt-in via `ZCODE_ACP_REMOTE=1`)
|
|
199
199
|
|
|
200
|
-
| File
|
|
201
|
-
|
|
|
202
|
-
| `broadcast.ts`
|
|
203
|
-
| `config.ts`
|
|
204
|
-
| `endpoint.ts`
|
|
205
|
-
| `
|
|
200
|
+
| File | Responsibility |
|
|
201
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
202
|
+
| `broadcast.ts` | ClientRegistry + broadcast proxy: notify fans out to all clients; request is first-response-wins with loser `$/cancel_request` |
|
|
203
|
+
| `config.ts` | ENV parsing (gate, mandatory token, hub/bridge ports) |
|
|
204
|
+
| `endpoint.ts` | Loopback ACP endpoint (SDK AcpServer transport, port auto-increment) + hub registration/heartbeat |
|
|
205
|
+
| `file-endpoint.ts` | Read-only `GET /fs/list` + `GET /fs/file` on the loopback server (ADR-0004): Session Root scoping, byte/line windows, streaming |
|
|
206
|
+
| `hub-server.ts` | The hub singleton: token auth, instance discovery, byte-level WS proxying, heartbeat pruning, on-demand `?probe=1` liveness, idle exit, version self-upgrade |
|
|
206
207
|
|
|
207
208
|
When enabled, the same `AgentApp` serves the stdio editor and a loopback
|
|
208
209
|
WebSocket endpoint. Every connection (editor or remote) joins the broadcast
|
|
@@ -226,6 +227,11 @@ drops bridges that stopped registering — the fallback for hard kills — and
|
|
|
226
227
|
on demand, so a client refresh gets an immediately-honest list with no
|
|
227
228
|
background probing cost.
|
|
228
229
|
|
|
230
|
+
Session file access (ADR-0004) rides the same loopback server: the bridge
|
|
231
|
+
serves read-only `GET /fs/list` + `GET /fs/file` scoped to each session's cwd,
|
|
232
|
+
and the hub byte-proxies them at `/api/instances/{id}/fs/*` — no new port, and
|
|
233
|
+
the hub still holds no path semantics.
|
|
234
|
+
|
|
229
235
|
## Key State Machines
|
|
230
236
|
|
|
231
237
|
### Turn state
|
package/docs/REMOTE-CLIENTS.md
CHANGED
|
@@ -74,14 +74,34 @@ HTTP auth: `Authorization: Bearer <token>` or `?token=<token>`.
|
|
|
74
74
|
registered bridge's loopback port and prunes unreachable ones before
|
|
75
75
|
answering. A plain `GET` returns the heartbeat-based view, which can list a
|
|
76
76
|
hard-killed bridge for up to the 30s heartbeat TTL.
|
|
77
|
-
- `sessions[].sessionId` is the ACP session id
|
|
78
|
-
|
|
79
|
-
and
|
|
80
|
-
session
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
a
|
|
77
|
+
- `sessions[].sessionId` is the **ACP session id the editor uses** for that
|
|
78
|
+
conversation (placeholder ids are stable across bridges — Zed stores them
|
|
79
|
+
and the durable alias store records them). Attaching under it via
|
|
80
|
+
`session/load` puts the remote client on the same notification stream as
|
|
81
|
+
the editor tab: turns driven from either side stream live to both. A
|
|
82
|
+
conversation with no editor placeholder is advertised under its backend
|
|
83
|
+
id (`sess_…`), still loadable via pass-through resume. `title` comes from
|
|
84
|
+
the backend session store; sessions that never completed a turn have no
|
|
85
|
+
title and are not listed.
|
|
86
|
+
- **Prompt echo**: when any client sends `session/prompt`, the bridge
|
|
87
|
+
broadcasts the user's text to every OTHER attached client as a
|
|
88
|
+
`user_message_chunk` (messageId prefixed `uprompt_`). Your own prompts are
|
|
89
|
+
never echoed back to you — render them locally as you send them. Without
|
|
90
|
+
this rule a turn driven from the other side arrives without the user
|
|
91
|
+
message that started it.
|
|
92
|
+
- `sessions` is gated on two rules: the conversation must be **currently
|
|
93
|
+
running** (a live registration in the advertising bridge — an open editor
|
|
94
|
+
tab, or a remote attachment that ran a turn) and **accessible** (every
|
|
95
|
+
listed id resolves and resumes through that bridge). Retired conversations
|
|
96
|
+
of the project are NOT listed even though the backend store still has them
|
|
97
|
+
— the store only enriches live entries with the authoritative title and a
|
|
98
|
+
cross-bridge `updatedAt`.
|
|
99
|
+
- Entries are **deduped across instances**: several bridges of the same
|
|
100
|
+
project (e.g. a leaked old process plus the current one) can all hold the
|
|
101
|
+
same live conversation under the same id; the hub keeps one copy per
|
|
102
|
+
session — the instance whose copy has the freshest `updatedAt` (i.e. the
|
|
103
|
+
bridge actually driving it). Attach to whichever instance the entry
|
|
104
|
+
appears under.
|
|
85
105
|
- Poll every 3–5s. There is no push notification for registry changes yet.
|
|
86
106
|
- Fields are **additive-only** across releases — ignore fields you don't know.
|
|
87
107
|
|
|
@@ -175,6 +195,43 @@ exactly:
|
|
|
175
195
|
later. Only transport-level failures reject the request.
|
|
176
196
|
- Cached ~10s server-side (same caches as the `/quota` command).
|
|
177
197
|
|
|
198
|
+
## Session files (read-only)
|
|
199
|
+
|
|
200
|
+
Browse and download files of a session's project — served by the bridge,
|
|
201
|
+
byte-proxied by the hub, guarded by the same token as everything else
|
|
202
|
+
(ADR-0004). Capability probe: `initialize` returns
|
|
203
|
+
`agentCapabilities._meta.zcode.fs === true`.
|
|
204
|
+
|
|
205
|
+
```text
|
|
206
|
+
GET {hub}/api/instances/{id}/fs/list?sessionId=…&path=<rel> one directory level
|
|
207
|
+
GET {hub}/api/instances/{id}/fs/file?sessionId=…&path=<rel> file bytes
|
|
208
|
+
&offset=…&length=… byte window → 206 + Content-Range
|
|
209
|
+
&line=…&limit=… text window (defaults 1 / 200, cap 5000)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
- `path` resolves against the session's root cwd — the directory the session
|
|
213
|
+
was created or loaded with. Absolute paths work only when they land inside
|
|
214
|
+
it; `..` segments and symlinks pointing outside the root are rejected
|
|
215
|
+
(403).
|
|
216
|
+
- `list` returns `{ root, entries: [{name, kind: "file"|"dir"|"symlink",
|
|
217
|
+
size, mtime}], truncated }`. Dotfiles are included — filter client-side.
|
|
218
|
+
Entries sort dirs-first in byte order; `truncated: true` marks more than
|
|
219
|
+
2000 entries. Symlinks report placeholder stats (`size: 0`); reading
|
|
220
|
+
through one resolves and scope-checks the target.
|
|
221
|
+
- `file` streams with `Content-Length` and a Content-Type inferred from the
|
|
222
|
+
extension (`application/octet-stream` fallback) — `<a download>`,
|
|
223
|
+
`<img src>`, and `fetch` streaming all work directly. `HEAD` is supported.
|
|
224
|
+
- Byte and line windows are mutually exclusive (400). A line window returns
|
|
225
|
+
`text/plain` with `X-Zcode-First-Line` set to the first served line;
|
|
226
|
+
memory is O(limit), so it works on arbitrarily large logs.
|
|
227
|
+
- Errors: `400` bad params · `403` unknown session / path escapes the root ·
|
|
228
|
+
`404` not found / unknown instance · `416` offset beyond EOF · `502`
|
|
229
|
+
bridge port unreachable. A `404` right after a bridge upgrade is the hub
|
|
230
|
+
self-upgrading to learn the route — retry.
|
|
231
|
+
- Read-only by design, and the token remains the security boundary as
|
|
232
|
+
everywhere else; the session root contains accidents (wrong path joins),
|
|
233
|
+
not attackers.
|
|
234
|
+
|
|
178
235
|
## Slash-command handling
|
|
179
236
|
|
|
180
237
|
Only the commands the bridge advertises via `available_commands_update` (plus
|
package/docs/REPLAY-GUIDE.md
CHANGED
|
@@ -72,31 +72,61 @@ differently:
|
|
|
72
72
|
- `usage_update` / `available_commands_update` are session-level metadata,
|
|
73
73
|
not list items.
|
|
74
74
|
|
|
75
|
-
### Collapsed harness blocks (
|
|
75
|
+
### Collapsed harness blocks (tool_call form)
|
|
76
76
|
|
|
77
|
-
Replayed user messages that are harness plumbing rather than user speech
|
|
78
|
-
|
|
77
|
+
Replayed user messages that are harness plumbing rather than user speech are
|
|
78
|
+
delivered as **`tool_call` updates, not `user_message_chunk`** — tool_call is
|
|
79
|
+
the one update kind every ACP editor (Zed, JetBrains, …) renders folded by
|
|
80
|
+
default, so the collapse works with zero client-side opt-in. The full text
|
|
81
|
+
rides in the tool_call's `content` block (expandable); the `kind` rides the
|
|
82
|
+
update's `_meta`:
|
|
79
83
|
|
|
80
84
|
```json
|
|
81
85
|
{
|
|
82
86
|
"sessionId": "…",
|
|
83
87
|
"update": {
|
|
84
|
-
"sessionUpdate": "
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
"sessionUpdate": "tool_call",
|
|
89
|
+
"toolCallId": "histfold_…",
|
|
90
|
+
"title": "Context handoff",
|
|
91
|
+
"kind": "other",
|
|
92
|
+
"status": "completed",
|
|
93
|
+
"content": [
|
|
94
|
+
{
|
|
95
|
+
"type": "content",
|
|
96
|
+
"content": { "type": "text", "text": "This session is being continued …" }
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"_meta": { "zcode": { "collapsed": true, "kind": "context-handoff" } }
|
|
100
|
+
}
|
|
89
101
|
}
|
|
90
102
|
```
|
|
91
103
|
|
|
92
|
-
- `kind: "context-handoff"` — the context-window continuation summary
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
- `kind: "context-handoff"` — the context-window continuation summary, one
|
|
105
|
+
per compaction (a long session can carry dozens). Title: `Context handoff`.
|
|
106
|
+
- `kind: "compact"` — the same compaction product on backends that tag it
|
|
107
|
+
with `semantics.kind: "compact_summary"` (session/compact, auto-compact,
|
|
108
|
+
and context-window handoff all land here). Title comes from the store's
|
|
109
|
+
own `summary.title` (observed: `Compact summary`) — so a reload shows
|
|
110
|
+
where history was compacted instead of silently missing the bridge's live
|
|
111
|
+
🔄/✓ auto-compact notices, which never enter backend history.
|
|
112
|
+
- `kind: "tool-transcript"` — `Called the X tool with the following input:
|
|
113
|
+
{…}\nResult of calling…` messages: tool_use/tool_result pairs the harness
|
|
114
|
+
rewrites into text on resume, one per historical tool call. Title is
|
|
115
|
+
`X · <first string value of the input JSON>` (e.g.
|
|
116
|
+
`Read · /src/main.go`), capped at 60 characters; falls back to `X tool`.
|
|
117
|
+
- `kind: "task-notification"` — `<task-notification>` blocks the harness
|
|
118
|
+
injects when a background task (build, sub-agent) finishes, delivered as
|
|
119
|
+
standalone user messages. Title is the block's decoded `<summary>` line
|
|
120
|
+
(e.g. `Background command "Build release APK" completed (exit code 0)`),
|
|
121
|
+
capped at 60 characters; falls back to `Background task`.
|
|
96
122
|
- Harness noise that carries no value (TodoWrite/Read usage nudges) is
|
|
97
|
-
stripped before replay — you never see it.
|
|
98
|
-
|
|
99
|
-
|
|
123
|
+
stripped before replay — you never see it. Synthetic messages the backend
|
|
124
|
+
marks `transcriptVisibility: "hidden"` and that fit no collapse shape
|
|
125
|
+
(plan-file references and similar plumbing) are dropped entirely.
|
|
126
|
+
- Render all kinds as an ordinary collapsed tool card keyed by `toolCallId`;
|
|
127
|
+
the text is complete behind the expand. Unknown `kind`s: render collapsed
|
|
128
|
+
too. These updates never collide with live tool_call ids (they carry the
|
|
129
|
+
`histfold_` prefix).
|
|
100
130
|
|
|
101
131
|
## Turn running state (`replayMeta.turnActive` + `$/zcode/turnState`)
|
|
102
132
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Remote file access: session-scoped, read-only, over hub-proxied HTTP
|
|
2
|
+
|
|
3
|
+
Remote clients could see session diffs and tool-call text but had no way to
|
|
4
|
+
browse or download files of the project a session lives in. We decided to give
|
|
5
|
+
the bridge a read-only file endpoint on its existing loopback HTTP server
|
|
6
|
+
(`GET /fs/list`, `GET /fs/file`), proxied byte-for-byte by the hub at
|
|
7
|
+
`GET /api/instances/{id}/fs/*` — the same proxy pattern as `/acp`. The hub
|
|
8
|
+
still touches no filesystem and understands no path semantics (ADR-0002
|
|
9
|
+
holds); scope checks and reads happen in the bridge, against its own
|
|
10
|
+
`sessionCwds` map: a request names a `sessionId`, and the path (after
|
|
11
|
+
`path.resolve` + `realpath`, defeating `..` and symlink escapes) must stay
|
|
12
|
+
inside that session's root cwd. Newly created sessions are readable
|
|
13
|
+
immediately because the bridge consults the in-process map, not a heartbeat
|
|
14
|
+
replica.
|
|
15
|
+
|
|
16
|
+
Read-only is deliberate: token holders can already drive the agent to write
|
|
17
|
+
files through the permission flow, but a direct write path would widen
|
|
18
|
+
token-theft damage from "control sessions" to "arbitrary filesystem writes",
|
|
19
|
+
with no consistency protection against running turns. The loopback endpoint
|
|
20
|
+
itself is unauthenticated, exactly like the ACP WebSocket next to it — only
|
|
21
|
+
the hub (the sole public entry) enforces the token. Responses stream
|
|
22
|
+
(`createReadStream` + `Content-Length`), so there is no per-request size cap;
|
|
23
|
+
`offset`/`length` and `line`/`limit` (mutually exclusive) serve binary
|
|
24
|
+
chunking and text windowing. `agentCapabilities._meta.zcode.fs` advertises the
|
|
25
|
+
capability to clients.
|
|
26
|
+
|
|
27
|
+
We rejected three alternatives. ACP extension methods (`_zcode/fs/*`) with
|
|
28
|
+
base64 bodies: the SDK's WS server drops non-text frames, so a binary channel
|
|
29
|
+
means bypassing the SDK transport; base64 adds 33%; and — decisively — a
|
|
30
|
+
multi-MB response blocks every `session/update` behind it on the same
|
|
31
|
+
WebSocket (head-of-line blocking), while HTTP gives downloads, `<img src>`,
|
|
32
|
+
caching, and future `Range` support for free. The hub reading files itself:
|
|
33
|
+
security-wise equivalent (the token already grants full session control), but
|
|
34
|
+
the hub's registry only knows activity-gated sessions, so a fresh
|
|
35
|
+
`session/new` session would have no cwd until its first turn — fixing that
|
|
36
|
+
would turn the heartbeat payload from a display summary into an authoritative
|
|
37
|
+
session→directory map, a second implementation of the session semantics
|
|
38
|
+
ADR-0002 keeps out of the hub. External tools (filebrowser, `rclone serve`):
|
|
39
|
+
separate token, port, and lifetime, with no link to sessions.
|