@cotal-ai/manager 0.16.0 → 0.18.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.
Files changed (62) hide show
  1. package/README.md +2 -1
  2. package/dist/attach-endpoint.d.ts +53 -59
  3. package/dist/attach-endpoint.d.ts.map +1 -1
  4. package/dist/attach-endpoint.js +120 -244
  5. package/dist/attach-endpoint.js.map +1 -1
  6. package/dist/commands.js +88 -8
  7. package/dist/commands.js.map +1 -1
  8. package/dist/console/app.js +68 -30
  9. package/dist/console/index.html +3 -2
  10. package/dist/console/session-bundle.js +9736 -0
  11. package/dist/console-crypto-shim.d.ts +16 -0
  12. package/dist/console-crypto-shim.d.ts.map +1 -0
  13. package/dist/console-crypto-shim.js +20 -0
  14. package/dist/console-crypto-shim.js.map +1 -0
  15. package/dist/console-session-entry.d.ts +2 -0
  16. package/dist/console-session-entry.d.ts.map +1 -0
  17. package/dist/console-session-entry.js +26 -0
  18. package/dist/console-session-entry.js.map +1 -0
  19. package/dist/endpoint-evict.d.ts +29 -0
  20. package/dist/endpoint-evict.d.ts.map +1 -0
  21. package/dist/endpoint-evict.js +80 -0
  22. package/dist/endpoint-evict.js.map +1 -0
  23. package/dist/holder-liveness.d.ts +40 -0
  24. package/dist/holder-liveness.d.ts.map +1 -0
  25. package/dist/holder-liveness.js +98 -0
  26. package/dist/holder-liveness.js.map +1 -0
  27. package/dist/manager-service-contract.d.ts +132 -0
  28. package/dist/manager-service-contract.d.ts.map +1 -0
  29. package/dist/manager-service-contract.js +332 -0
  30. package/dist/manager-service-contract.js.map +1 -0
  31. package/dist/manager.d.ts +519 -22
  32. package/dist/manager.d.ts.map +1 -1
  33. package/dist/manager.js +2273 -262
  34. package/dist/manager.js.map +1 -1
  35. package/dist/reconcile-gate.d.ts +82 -0
  36. package/dist/reconcile-gate.d.ts.map +1 -0
  37. package/dist/reconcile-gate.js +118 -0
  38. package/dist/reconcile-gate.js.map +1 -0
  39. package/dist/runtime/pty.d.ts.map +1 -1
  40. package/dist/runtime/pty.js +15 -2
  41. package/dist/runtime/pty.js.map +1 -1
  42. package/dist/session/bridge.d.ts +63 -0
  43. package/dist/session/bridge.d.ts.map +1 -0
  44. package/dist/session/bridge.js +157 -0
  45. package/dist/session/bridge.js.map +1 -0
  46. package/dist/session/establish.d.ts +212 -0
  47. package/dist/session/establish.d.ts.map +1 -0
  48. package/dist/session/establish.js +174 -0
  49. package/dist/session/establish.js.map +1 -0
  50. package/dist/session/index.d.ts +12 -0
  51. package/dist/session/index.d.ts.map +1 -0
  52. package/dist/session/index.js +15 -0
  53. package/dist/session/index.js.map +1 -0
  54. package/dist/session/plane.d.ts +120 -0
  55. package/dist/session/plane.d.ts.map +1 -0
  56. package/dist/session/plane.js +327 -0
  57. package/dist/session/plane.js.map +1 -0
  58. package/dist/static-lifecycle.d.ts +97 -0
  59. package/dist/static-lifecycle.d.ts.map +1 -0
  60. package/dist/static-lifecycle.js +262 -0
  61. package/dist/static-lifecycle.js.map +1 -0
  62. package/package.json +10 -6
@@ -4,7 +4,7 @@ import { createRequire } from "node:module";
4
4
  import { readFileSync } from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { dirname, join } from "node:path";
7
- import { WebSocketServer } from "ws";
7
+ import { EpEnvelopeError } from "@cotal-ai/core";
8
8
  const require = createRequire(import.meta.url);
9
9
  const here = dirname(fileURLToPath(import.meta.url));
10
10
  /** Vendored xterm.js assets (served from node_modules, resolved at startup). */
@@ -14,20 +14,20 @@ const ASSETS = {
14
14
  "/assets/addon-fit.js": { path: require.resolve("@xterm/addon-fit/lib/addon-fit.js"), type: "text/javascript" },
15
15
  "/assets/addon-attach.js": { path: require.resolve("@xterm/addon-attach/lib/addon-attach.js"), type: "text/javascript" },
16
16
  };
17
- /** Anything the console page needs to render itself, served from this dir. */
17
+ /** Anything the console page needs to render itself, served from this dir. `session-bundle.js` is
18
+ * the pre-built (esbuild) mesh §13.6 session client — present only in a built dist, so the page
19
+ * falls back to a clear "bundle not loaded" notice when running from source (P2 item 6). */
18
20
  const PAGE = {
19
21
  "/": { path: join(here, "console/index.html"), type: "text/html" },
20
22
  "/app.js": { path: join(here, "console/app.js"), type: "text/javascript" },
23
+ "/session-bundle.js": { path: join(here, "console/session-bundle.js"), type: "text/javascript" },
21
24
  };
22
25
  /**
23
- * The address the attach endpoint binds and advertises: the host of the mesh broker this manager is
24
- * attached to. Keeping the two in step is the whole point — a client that reached the control plane
25
- * to request an attach URL demonstrably has a route to that address, whereas a hardcoded
26
- * `127.0.0.1` resolves to the client's own machine.
26
+ * The address the console endpoint binds and advertises, derived from a mesh broker URL.
27
27
  *
28
28
  * With no server URL there is no mesh address to follow, so this is loopback: the conservative
29
- * default and exactly the endpoint's previous behavior. An unparseable URL is a caller bug and
30
- * throws rather than quietly binding somewhere the operator did not ask for.
29
+ * default. An unparseable URL is a caller bug and throws rather than quietly binding somewhere the
30
+ * operator did not ask for.
31
31
  */
32
32
  export function attachHost(servers) {
33
33
  if (!servers)
@@ -44,106 +44,78 @@ export function attachHost(servers) {
44
44
  // BIND address, and `#advertised` puts the brackets back for the URL form.
45
45
  return hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname;
46
46
  }
47
- /** How long an issued attach capability stays redeemable. The client redeems it immediately (the
48
- * control-plane reply goes straight into a connect), so this only has to cover that round trip;
49
- * short means a URL that leaked into a log or shell history is already dead. */
50
- const ATTACH_TICKET_TTL_MS = 120_000;
51
47
  /**
52
- * The manager's local HTTP + WebSocket face. It hosts the **console** (a
53
- * lightweight xterm.js page) and bridges each agent's PTY to the browser and to
54
- * `cotal attach` over a direct socket, never the mesh, so owning the terminal
55
- * keeps the manager off the message hot path.
48
+ * The manager's local HTTP face. It serves the **console** (a lightweight xterm.js page + its
49
+ * assets) and is the browser's credential broker: `POST /session/<name>` mints a mesh §13.6 session
50
+ * for the console to drive the terminal over the broker's WebSocket listener. The terminal never
51
+ * rides a manager-hosted socket (P2 item 6 replaced the loopback `ws://.../attach/` transport with
52
+ * the mesh session, closing the bearer-less-local hole) — `cotal attach` reaches a manager on
53
+ * another machine over the mesh, not by dialing this face.
56
54
  *
57
- * **Where it binds, and why it is credentialed.** A mesh can span machines: the manager that owns an
58
- * agent's PTY may sit on another host than the operator running `cotal attach`. Hardcoding
59
- * `127.0.0.1` made every remote attach fail with ECONNREFUSED against the *client's own* loopback.
60
- * The bind address is therefore an explicit option (default loopback, so nothing is exposed by
61
- * accident); `cotal up` passes the address it bound the broker to. A broker DIAL address is
62
- * deliberately NOT used as the bind: a manager may supervise a broker on another host and could not
63
- * bind that address at all. Where the manager can only name loopback (a wildcard bind), the CLIENT
64
- * substitutes the broker address its own control connection reached.
55
+ * **Where it binds, and why it is credentialed.** The bind address is an explicit option (default
56
+ * loopback, so nothing is exposed by accident); `cotal up` passes the address it bound the broker
57
+ * to when the operator asked for an exposed console. A broker DIAL address is deliberately NOT used
58
+ * as the bind: a manager may supervise a broker on another host and could not bind that address at
59
+ * all. Where the manager can only name loopback (a wildcard bind), it advertises loopback.
65
60
  *
66
- * Reachability is why the surface is credentialed, in two tiers. This face carries terminal READ AND
67
- * WRITE for every managed agent, plus the roster and the live feed, so once it can leave the box
68
- * "unauthenticated but loopback-only" stops being a safe position.
61
+ * Reachability is why the surface is credentialed. It carries the managed roster, the live mesh
62
+ * feed, and through `POST /session/<name>` the mint of a real §13.6 session grant plus its
63
+ * per-session caller credential. Once the face can leave the box, "unauthenticated but
64
+ * loopback-only" stops being a safe position, so every DATA route requires the manager's console
65
+ * token. The console SHELL (its HTML, its script, the vendored xterm assets) is static and carries
66
+ * nothing about this mesh, so it stays open — that is what lets the page load and then present the
67
+ * token, held in memory from its own URL, on the requests that do matter.
69
68
  *
70
- * - **Attach tickets** are what a mesh caller gets: minted per authorized `attach` request, bound to
71
- * the ONE agent the manager just authorized, single-use, short-lived. This is what makes the
72
- * per-agent/owner check real — a manager-wide token would let a caller authorized for its own
73
- * agent swap the path and take over anyone's terminal.
74
- * - **The console token** is the operator's own: it reaches every agent, because the console
75
- * legitimately drives all of them, and it is printed solely to this manager process's output
76
- * (so it is as sensitive as `.cotal/manager.log`, and never handed to a mesh caller).
77
- *
78
- * Credentials travel in `?t=` or a bearer header, never a cookie: cookies are host-scoped, not
69
+ * The credential travels in `?t=` or a bearer header, never a cookie: cookies are host-scoped, not
79
70
  * port-scoped, so one set here would be sent to every other HTTP service on this host and would
80
71
  * collide between two managers on one box. The console URL carries its token in the FRAGMENT, which
81
72
  * a browser never sends to a server.
82
73
  *
83
- * Routes: `GET /` console page, `GET /agents` the managed roster (JSON),
84
- * `GET /feed` the live mesh feed (SSE: presence roster + comms), static assets
85
- * under `/assets`, and `WS /attach/<name>` the PTY stream.
86
- *
87
- * Attach protocol: server → client sends raw terminal bytes (binary). client →
88
- * server: binary frames are keystrokes; a text frame `r:<cols>,<rows>` resizes.
74
+ * Routes: `GET /` console page + `/app.js` + `/session-bundle.js` + `/assets/*`; `GET /agents` the
75
+ * managed roster (JSON); `GET /feed` the live mesh feed (SSE: presence roster + comms);
76
+ * `POST /session/<name>` the mesh session establishment.
89
77
  */
90
78
  export class AttachEndpoint {
91
- lookup;
92
79
  list;
93
80
  snapshot;
81
+ establishSession;
94
82
  token;
95
83
  #http;
96
- #wss;
97
84
  #port;
98
85
  #host;
99
86
  #sse = new Set();
100
87
  #ping;
101
- /** Redeemable attach capabilities: token → the ONE INCARNATION it may attach, and when it lapses.
102
- * `handle` is the identity that actually matters — see {@link AttachEndpoint.url}. */
103
- #tickets = new Map();
104
- constructor(lookup, list,
88
+ constructor(list,
105
89
  /** Events replayed to each console as it connects to `/feed` (e.g. the current roster). */
106
90
  snapshot, port = 0,
107
- /** Bind address, and the host advertised in {@link url} / {@link consoleUrl}. Defaults to
108
- * loopback; the manager passes the mesh broker's host so attach is reachable from wherever the
109
- * mesh is. A wildcard bind still advertises loopback, since a wildcard is not a dialable name. */
91
+ /** P2 item 6: the manager-injected mesh-session establisher backing `POST /session/<name>`
92
+ * (the console's session-client transport). Absent the route 503s. Wired at 6b-2. */
93
+ establishSession,
94
+ /** Bind address, and the host advertised in {@link consoleUrl}. Defaults to loopback; the
95
+ * manager passes an operator-chosen address when the console is meant to be reachable from
96
+ * another machine. A wildcard bind still advertises loopback, since a wildcard is not a
97
+ * dialable name. */
110
98
  host = "127.0.0.1",
111
- /** The endpoint credential. Generated per manager process; required on every route. */
99
+ /** The endpoint credential. Generated per manager process; required on every data route. */
112
100
  token = randomBytes(32).toString("hex")) {
113
- this.lookup = lookup;
114
101
  this.list = list;
115
102
  this.snapshot = snapshot;
103
+ this.establishSession = establishSession;
116
104
  this.token = token;
105
+ // A blank credential is the fail-OPEN shape of this gate, and it would only ever be consulted on
106
+ // the dangerous path. Refuse it at CONSTRUCTION, not at request time: an endpoint that cannot be
107
+ // credentialed must not exist rather than serve the roster, the feed and the session mint to
108
+ // anyone who can reach the bind host. (The default above means "no token configured" is already
109
+ // a fresh per-process secret; this closes the one way a caller could ask for none.)
110
+ if (!token)
111
+ throw new Error("AttachEndpoint: refusing to serve without a console token - the roster, the feed and the session mint are all credentialed on it");
117
112
  this.#port = port;
118
113
  this.#host = host;
119
114
  this.#http = createServer((req, res) => this.#onRequest(req, res));
120
- this.#wss = new WebSocketServer({ noServer: true });
121
- this.#http.on("upgrade", (req, socket, head) => {
122
- const path = (req.url ?? "/").split("?")[0];
123
- if (!path.startsWith("/attach/")) {
124
- socket.destroy();
125
- return;
126
- }
127
- let name;
128
- try {
129
- name = decodeURIComponent(path.slice("/attach/".length));
130
- }
131
- catch {
132
- socket.end("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n");
133
- return;
134
- }
135
- // Terminal read+write, so the capability must name THIS agent: a ticket issued for one agent
136
- // must never attach another. Redeemed against the decoded name — the name is parsed first only
137
- // because the check needs it, and a malformed name is refused before any credential is looked
138
- // at, so neither order leaks the other's outcome.
139
- if (!this.#redeemAttach(req, name)) {
140
- socket.end("HTTP/1.1 401 Unauthorized\r\nConnection: close\r\n\r\n");
141
- return;
142
- }
143
- this.#wss.handleUpgrade(req, socket, head, (ws) => {
144
- this.#onConnection(ws, name).catch(() => ws.close());
145
- });
146
- });
115
+ // HTTP-only face: refuse any WebSocket upgrade with a clean 400 (P2 item 6 removed the loopback
116
+ // `ws://.../attach/` terminal transport the console drives the terminal over the mesh session).
117
+ // A proper response beats leaving a stray/malformed upgrade hanging or resetting it abruptly.
118
+ this.#http.on("upgrade", (_req, socket) => socket.end("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n"));
147
119
  }
148
120
  /** The credential a request presents, from `?t=` or a bearer header. */
149
121
  #presented(req) {
@@ -158,67 +130,22 @@ export class AttachEndpoint {
158
130
  const b = Buffer.from(secret);
159
131
  return a.length === b.length && timingSafeEqual(a, b);
160
132
  }
161
- /** The MANAGER-WIDE credential: the operator's own console session. It reaches every agent, which
162
- * is not an escalation it is only ever printed to the manager process's own output, and anyone
163
- * who can read that already controls the process. Never handed to a mesh caller. */
133
+ /** The operator's own console credential. It reaches every managed agent, because the console
134
+ * legitimately drives all of them, and it is printed solely to this manager process's output (so
135
+ * it is as sensitive as `.cotal/manager.log`, and never handed to a mesh caller). */
164
136
  #authorized(req) {
165
137
  return this.#sameSecret(this.#presented(req), this.token);
166
138
  }
167
- /**
168
- * Redeem an attach capability for EXACTLY `name`.
169
- *
170
- * The per-name control-plane authorization (`Manager.opAttach` → `authorizeNamed`) is only real if
171
- * the credential it hands back is bound to the agent it authorized. A manager-wide token is not:
172
- * a caller legitimately authorized for its own agent could edit `/attach/mine` to `/attach/victim`
173
- * and the endpoint, checking only "is this the manager's token", would attach it — silently
174
- * defeating the owner-domain and cross-owner admin boundaries on a user-auth mesh. So a mesh
175
- * caller receives a ticket that names one agent, expires, and is consumed on redemption.
176
- *
177
- * The console token is also accepted here, because the console legitimately drives every agent.
178
- */
179
- #redeemAttach(req, name) {
180
- const presented = this.#presented(req);
181
- if (!presented)
182
- return false;
183
- if (this.#sameSecret(presented, this.token))
184
- return true; // operator console: all agents
185
- const ticket = this.#tickets.get(presented);
186
- if (!ticket)
187
- return false;
188
- this.#tickets.delete(presented); // single use, redeemed or not
189
- if (ticket.expires < Date.now())
190
- return false;
191
- // Compare the BOUND name against the requested one in constant time, so a redemption cannot be
192
- // probed character-by-character for another agent's name.
193
- if (!this.#sameSecret(name, ticket.name))
194
- return false;
195
- // A NAME IS A REUSABLE SLOT, not an identity. Binding the capability to the name alone leaves it
196
- // valid for whoever occupies that slot at redemption time: if the authorized agent exits and a
197
- // same-name successor — possibly a different owner's — takes the slot inside the TTL, the
198
- // untouched URL would attach the successor's terminal. Bind to the incarnation instead. The
199
- // handle object IS that identity: the manager creates a new one per spawn, so a successor can
200
- // never compare equal to its predecessor.
201
- return this.lookup(name) === ticket.handle;
202
- }
203
- /** Drop expired tickets so an idle manager doesn't accumulate them. */
204
- #sweepTickets() {
205
- const now = Date.now();
206
- for (const [t, v] of this.#tickets)
207
- if (v.expires < now)
208
- this.#tickets.delete(t);
209
- }
210
139
  async start() {
211
- // The bind host is the BROKER's, which is right when the manager is co-located with it (every
212
- // `cotal up` stack). A manager pointed at a broker on ANOTHER machine does not own that address,
213
- // and `listen` fails EADDRNOTAVAIL. Say so in operator terms instead of surfacing a bare errno
214
- // from deep inside startup: the address is the diagnosis, and the two real resolutions are to
215
- // run the manager on the broker's host or to give this space a broker address this host owns.
140
+ // The bind host is the operator's explicit choice. A manager asked to bind an address this
141
+ // machine does not own dies deep inside startup with a bare errno; say so in operator terms
142
+ // instead the address is the diagnosis.
216
143
  await new Promise((resolve, reject) => {
217
144
  const onError = (e) => {
218
145
  if (e.code === "EADDRNOTAVAIL" || e.code === "EADDRINUSE") {
219
146
  reject(new Error(e.code === "EADDRINUSE"
220
- ? `the manager's attach endpoint cannot bind ${this.#host}:${this.#port} - that port is already in use on this host`
221
- : `the manager's attach endpoint cannot bind ${this.#host} - this machine has no such address. The attach face binds the broker's host, so the manager must run on the machine the broker is bound to.`));
147
+ ? `the manager's console endpoint cannot bind ${this.#host}:${this.#port} - that port is already in use on this host`
148
+ : `the manager's console endpoint cannot bind ${this.#host} - this machine has no such address. Give this manager a console host it owns, or leave it on loopback.`));
222
149
  return;
223
150
  }
224
151
  reject(e);
@@ -245,8 +172,6 @@ export class AttachEndpoint {
245
172
  for (const res of this.#sse)
246
173
  res.end();
247
174
  this.#sse.clear();
248
- for (const ws of this.#wss.clients)
249
- ws.terminate();
250
175
  await new Promise((resolve) => this.#http.close(() => resolve()));
251
176
  }
252
177
  /** Push a named event to every connected console (SSE). */
@@ -261,31 +186,6 @@ export class AttachEndpoint {
261
186
  return "127.0.0.1";
262
187
  return this.#host.includes(":") && !this.#host.startsWith("[") ? `[${this.#host}]` : this.#host;
263
188
  }
264
- /**
265
- * The ws URL a client uses to attach to `name`, carrying a capability bound to THAT agent.
266
- *
267
- * Called once per authorized control-plane `attach` request, so the ticket inherits exactly the
268
- * authorization the manager just performed for this caller and this agent. It is single-use and
269
- * short-lived: the client redeems it immediately, and a leaked URL (shell history, a log, a
270
- * `Referer`) is spent or expired rather than a standing key to someone's terminal.
271
- *
272
- * `expected` is the handle the caller actually authorized, and it is REQUIRED. A name is a reusable
273
- * slot, and authorization is async (a user-mode ledger read), so between the caller resolving the
274
- * name and arriving here the slot can have been stopped and refilled by a same-name successor.
275
- * Re-resolving the name would then mint a valid ticket for an agent nobody authorized. Binding to
276
- * the caller's own handle closes that window: if the slot moved, there is no capability to issue.
277
- */
278
- url(name, expected) {
279
- this.#sweepTickets();
280
- const handle = this.lookup(name);
281
- if (!handle)
282
- throw new Error(`cannot issue an attach capability for "${name}": no such running agent`);
283
- if (handle !== expected)
284
- throw new Error(`cannot issue an attach capability for "${name}": it was replaced during authorization`);
285
- const ticket = randomBytes(32).toString("hex");
286
- this.#tickets.set(ticket, { name, handle: expected, expires: Date.now() + ATTACH_TICKET_TTL_MS });
287
- return `ws://${this.#advertised}:${this.#port}/attach/${encodeURIComponent(name)}?t=${ticket}`;
288
- }
289
189
  /** The console page URL. The token rides the FRAGMENT, which a browser never sends to a server:
290
190
  * it stays out of this endpoint's request handling, out of any proxy's logs, and out of the
291
191
  * `Referer` a click on the page would otherwise leak. The page reads it from `location.hash` and
@@ -297,30 +197,37 @@ export class AttachEndpoint {
297
197
  #onRequest(req, res) {
298
198
  try {
299
199
  const path = (req.url ?? "/").split("?")[0];
300
- // Every DATA route is credentialed: the managed roster and the live mesh feed both describe
301
- // real agents. The console shell (its HTML, its script, the vendored xterm assets) is static
302
- // and carries nothing about this mesh, so it stays open — that is what lets the page load and
303
- // then present the token, held in memory from its own URL, on the requests that do matter.
304
- //
305
- // Deliberately NOT a cookie. Cookies are host-scoped, not port-scoped: a `cotal_attach` cookie
306
- // set by a manager on one port would be sent by the browser to EVERY other HTTP service on
307
- // that host, handing a terminal credential to anything the operator happens to visit, and two
308
- // managers on one host would silently overwrite each other's. `Secure` fixes neither, and is
309
- // unavailable over plain HTTP anyway.
310
- // The console shell must not be cached or leak a referrer: the page holds a terminal-capable
200
+ // The console shell must not be cached or leak a referrer: the page holds the console
311
201
  // credential in memory, and a stale cached copy would keep working against a restarted
312
202
  // manager whose token has rotated.
313
203
  if (PAGE[path]) {
314
204
  res.setHeader("cache-control", "no-store");
315
205
  res.setHeader("referrer-policy", "no-referrer");
316
206
  }
317
- if (path === "/agents" || path === "/feed") {
207
+ // Every DATA route is credentialed. The roster and the live feed describe real agents, and
208
+ // `POST /session/` MINTS a §13.6 grant plus a per-session caller credential — the most
209
+ // sensitive thing this face does. Loopback alone stopped being the trust boundary once the
210
+ // bind host became an operator choice, so the token gate is unconditional.
211
+ if (path === "/agents" || path === "/feed" || path.startsWith("/session/")) {
318
212
  if (!this.#authorized(req)) {
319
213
  res.writeHead(401, { "content-type": "text/plain" });
320
214
  res.end("unauthorized - this endpoint requires the manager's console token");
321
215
  return;
322
216
  }
323
217
  }
218
+ // P2 item 6: the console's mesh §13.6 session establishment. `POST /session/<name>` mints the
219
+ // holder-bound offer + the per-session caller credential (via the injected establisher) and
220
+ // returns {grant, wsUrl, creds} for the browser to open the caller rail — no ws:// terminal
221
+ // transport in the reply.
222
+ if (path.startsWith("/session/")) {
223
+ this.#onSession(req, res, path);
224
+ return;
225
+ }
226
+ // Browsers request the favicon unprompted; answer 204 so it isn't a noisy 404 in the console.
227
+ if (path === "/favicon.ico") {
228
+ res.writeHead(204).end();
229
+ return;
230
+ }
324
231
  if (path === "/agents") {
325
232
  const body = JSON.stringify(this.list());
326
233
  res.writeHead(200, { "content-type": "application/json" });
@@ -350,6 +257,47 @@ export class AttachEndpoint {
350
257
  }
351
258
  }
352
259
  }
260
+ /** `POST /session/<name>` (P2 item 6): establish a mesh §13.6 session for the console and return
261
+ * {grant, wsUrl, creds}. POST because it has side effects (it mints a one-use offer + a
262
+ * per-session credential). 503 when no establisher is wired (open mesh / pre-6b-2). */
263
+ #onSession(req, res, path) {
264
+ if (req.method !== "POST") {
265
+ res.writeHead(405, { allow: "POST" }).end("method not allowed");
266
+ return;
267
+ }
268
+ if (!this.establishSession) {
269
+ res.writeHead(503).end("mesh session establishment is not available (open mesh, or not yet wired)");
270
+ return;
271
+ }
272
+ let name;
273
+ try {
274
+ name = decodeURIComponent(path.slice("/session/".length));
275
+ }
276
+ catch {
277
+ res.writeHead(400).end("bad agent name");
278
+ return;
279
+ }
280
+ if (!name) {
281
+ res.writeHead(400).end("missing agent name");
282
+ return;
283
+ }
284
+ this.establishSession(name)
285
+ .then((est) => {
286
+ res.writeHead(200, { "content-type": "application/json" });
287
+ res.end(JSON.stringify(est));
288
+ })
289
+ .catch((e) => {
290
+ // A CAPACITY refusal is not an internal fault, and the browser has to be able to tell them
291
+ // apart: the live-session ceiling is a bounded, retryable condition (429), while a 500 says
292
+ // the manager broke. Both carry the envelope `code`, so the page branches on a stable token
293
+ // rather than on message text.
294
+ const code = e instanceof EpEnvelopeError ? e.code : undefined;
295
+ const status = code === "resource-exhausted" ? 429 : 500;
296
+ if (!res.headersSent)
297
+ res.writeHead(status, { "content-type": "application/json" });
298
+ res.end(JSON.stringify({ error: e.message, ...(code ? { code } : {}) }));
299
+ });
300
+ }
353
301
  #serveFile(res, file, type) {
354
302
  try {
355
303
  const body = readFileSync(file);
@@ -389,77 +337,5 @@ export class AttachEndpoint {
389
337
  return;
390
338
  res.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
391
339
  }
392
- async #onConnection(ws, name) {
393
- const handle = this.lookup(name);
394
- if (!handle || handle.status() !== "running") {
395
- ws.close();
396
- return;
397
- }
398
- // Only streamable backends (pty/host) can be attached over the wire; external runtimes are watched
399
- // natively and their attach() throws. Close cleanly instead of letting it crash the upgrade.
400
- let session;
401
- try {
402
- session = handle.attach();
403
- }
404
- catch {
405
- ws.close(1011, `attach unsupported for the ${handle.kind} runtime - watch its surface directly`);
406
- return;
407
- }
408
- const send = (b) => {
409
- if (ws.readyState === ws.OPEN)
410
- ws.send(b);
411
- };
412
- // Subscribe to live output BEFORE requesting the snapshot, and buffer what arrives until the
413
- // snapshot is sent. The snapshot (below) is a point-in-time screen image; anything the child
414
- // emits after it must land after it, in order. Subscribing first (no await in between) means no
415
- // chunk can slip through unobserved, and the buffer stops a mid-snapshot burst from racing ahead
416
- // of — or being lost before — the image.
417
- let live = false;
418
- const buffered = [];
419
- const offData = session.onData((chunk) => {
420
- if (live)
421
- send(chunk);
422
- else
423
- buffered.push(chunk);
424
- });
425
- const offExit = session.onExit(() => ws.close());
426
- // Wire input + cleanup now too, so the client's initial `r:cols,rows` (and any early keystrokes)
427
- // during the snapshot await aren't dropped, and a disconnect mid-await still unsubscribes.
428
- ws.on("message", (data, isBinary) => {
429
- if (isBinary) {
430
- session.write(data.toString("utf8"));
431
- return;
432
- }
433
- const text = data.toString();
434
- const m = /^r:(\d+),(\d+)$/.exec(text);
435
- if (!m) {
436
- session.write(text);
437
- return;
438
- }
439
- session.resize(Number(m[1]), Number(m[2]));
440
- });
441
- ws.on("close", () => {
442
- offData();
443
- offExit();
444
- });
445
- // Reconstructed screen image: the backend replays a byte-exact snapshot — including the
446
- // alternate-screen buffer of a full-screen TUI (OpenCode/Claude) — so a late or concurrent attach
447
- // paints correctly without depending on the child to repaint. (Raw scrollback replay couldn't
448
- // rebuild an alt-screen, leaving same-size re/co-attaches a partial screen.) Then flush anything
449
- // that arrived while we built it, and switch to sending live output straight through.
450
- let snapshot;
451
- try {
452
- snapshot = await session.backlog();
453
- }
454
- catch {
455
- ws.close(1011, "attach snapshot failed");
456
- return;
457
- }
458
- if (snapshot.length)
459
- send(snapshot);
460
- for (const chunk of buffered)
461
- send(chunk);
462
- live = true; // snapshot delivered — stream subsequent output straight through
463
- }
464
340
  }
465
341
  //# sourceMappingURL=attach-endpoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attach-endpoint.js","sourceRoot":"","sources":["../src/attach-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAA0D,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AAIrD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAErD,gFAAgF;AAChF,MAAM,MAAM,GAAmD;IAC7D,kBAAkB,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACnG,mBAAmB,EAAE,EAAE,IAAI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