@cueloop/daemon 0.1.0-alpha.8 → 0.1.0-alpha.80

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 (50) hide show
  1. package/package.json +34 -22
  2. package/src/api.test.ts +925 -65
  3. package/src/api.ts +1060 -88
  4. package/src/capabilities.test.ts +57 -0
  5. package/src/capabilities.ts +84 -0
  6. package/src/client.test.ts +24 -0
  7. package/src/client.ts +526 -70
  8. package/src/curate.ts +109 -0
  9. package/src/daemon-version.test.ts +93 -0
  10. package/src/diff-hot-reload.test.ts +272 -0
  11. package/src/diff-watcher.ts +274 -0
  12. package/src/gh.ts +37 -0
  13. package/src/harness-delivery.test.ts +193 -0
  14. package/src/harness-state-store.test.ts +65 -0
  15. package/src/harness-state-store.ts +182 -0
  16. package/src/herdr-pane.test.ts +240 -0
  17. package/src/herdr-pane.ts +167 -0
  18. package/src/herdr-split.test.ts +106 -0
  19. package/src/herdr-split.ts +92 -0
  20. package/src/herdr-tab-store.test.ts +96 -0
  21. package/src/herdr-tab-store.ts +66 -0
  22. package/src/index.ts +8 -9
  23. package/src/interruptible-wait.test.ts +127 -0
  24. package/src/interruptible-wait.ts +66 -0
  25. package/src/main.ts +4 -1
  26. package/src/paths.ts +44 -0
  27. package/src/pr-poller.test.ts +76 -0
  28. package/src/pr-poller.ts +74 -0
  29. package/src/project-files.test.ts +124 -0
  30. package/src/project-files.ts +56 -0
  31. package/src/protocol.ts +79 -7
  32. package/src/retention.test.ts +191 -0
  33. package/src/retention.ts +123 -0
  34. package/src/server.test.ts +430 -42
  35. package/src/server.ts +362 -84
  36. package/src/share-blob.test.ts +112 -0
  37. package/src/share-blob.ts +55 -0
  38. package/src/single-instance.test.ts +72 -11
  39. package/src/store.conformance.test.ts +41 -0
  40. package/src/store.jsonl.test.ts +159 -0
  41. package/src/store.ts +264 -34
  42. package/src/testing/store-conformance.ts +194 -0
  43. package/src/thread-review.test.ts +394 -0
  44. package/src/thread-review.ts +324 -0
  45. package/src/validate.test.ts +214 -35
  46. package/src/validate.ts +296 -25
  47. package/src/version.ts +6 -0
  48. package/src/working-tree.ts +149 -0
  49. package/src/review.test.ts +0 -167
  50. package/src/review.ts +0 -174
@@ -1,7 +1,8 @@
1
1
  import { afterEach, beforeEach, describe, expect, test } from "bun:test";
2
- import { mkdtempSync, rmSync } from "node:fs";
2
+ import { existsSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
+ import * as v from "valibot";
5
6
  import { DaemonServer } from "./server";
6
7
  import { DaemonClient, DaemonClientError } from "./client";
7
8
  import type { Artifact, WorkspaceKey } from "@cueloop/schema";
@@ -27,88 +28,475 @@ afterEach(() => {
27
28
 
28
29
  describe("socket round-trip", () => {
29
30
  test("ping and full session flow over the wire", async () => {
31
+ // Assert
30
32
  expect((await client.ping()).pid).toBe(process.pid);
31
- const s = await client.sessionCreate(WS, PLAN);
32
- expect(s.status).toBe("pending");
33
- await client.sessionAnnotate(s.id, {
33
+
34
+ // Act
35
+ const session = await client.sessionCreate(WS, PLAN);
36
+
37
+ // Assert
38
+ expect(session.status).toBe("pending");
39
+
40
+ // Act
41
+ await client.sessionAnnotate(session.id, {
34
42
  id: "a1",
35
43
  kind: "comment",
36
44
  anchor: { quote: "Body text", prefix: "", suffix: "." },
37
45
  body: "More detail please.",
38
46
  });
39
- const wait = client.sessionWait(s.id, 5_000);
40
- await client.sessionResolve(s.id, "request_changes", "Expand it.");
47
+ const wait = client.sessionWait(session.id, 5_000);
48
+
49
+ await client.sessionSendMessage(session.id, "changes_requested", "Expand it.");
41
50
  const resolved = (await wait)!;
42
- expect(resolved.verdict!.kind).toBe("request_changes");
43
- expect(resolved.verdict!.feedback).toContain("More detail please.");
51
+
52
+ // Assert
53
+ expect(resolved.message!.outcome).toBe("changes_requested");
54
+ expect(resolved.message!.body).toContain("More detail please.");
55
+ });
56
+
57
+ test("harness binding and Message delivery round-trip over the wire", async () => {
58
+ const thread = await client.sessionCreate(WS, PLAN);
59
+ const binding = await client.harnessBind(thread.id, "fake", "fake_1");
60
+
61
+ expect(await client.harnessGetBinding(binding.id)).toEqual(binding);
62
+
63
+ const sent = await client.sessionSendMessage(thread.id, "approved", "Ready.");
64
+ const pending = await client.deliveryPending(binding.id);
65
+
66
+ expect(pending).toHaveLength(1);
67
+ expect(pending[0]!.message).toEqual(sent.message!);
68
+ expect(pending[0]!.delivery.status).toBe("pending");
69
+
70
+ const acknowledged = await client.deliveryAcknowledge(pending[0]!.delivery.id);
71
+
72
+ expect(acknowledged.status).toBe("acknowledged");
73
+ expect(await client.deliveryPending(binding.id)).toEqual([]);
74
+ expect(
75
+ await client.harnessConsumeApprovedRetry(binding.id, sent.message!.id, PLAN.content),
76
+ ).toBe(true);
77
+ expect(
78
+ await client.harnessConsumeApprovedRetry(binding.id, sent.message!.id, PLAN.content),
79
+ ).toBe(false);
80
+ });
81
+
82
+ test("diff revision replaces full changed-file contents over the wire", async () => {
83
+ const files = [
84
+ { path: "a.ts", status: "modified" as const, oldContents: "old", newContents: "first" },
85
+ ];
86
+ const thread = await client.sessionCreate(WS, {
87
+ type: "diff",
88
+ content: "first patch",
89
+ files,
90
+ meta: {},
91
+ });
92
+ const revised = await client.sessionSubmitRevision(
93
+ thread.id,
94
+ "second patch",
95
+ [],
96
+ [{ ...files[0]!, newContents: "second" }],
97
+ );
98
+
99
+ expect(revised.artifact.files?.[0]?.newContents).toBe("second");
100
+ expect((await client.sessionGet(thread.id)).artifact.files?.[0]?.newContents).toBe("second");
44
101
  });
45
102
 
46
103
  test("errors carry codes across the wire", async () => {
47
- expect(client.sessionGet("nope")).rejects.toBeInstanceOf(DaemonClientError);
48
- try {
49
- await client.sessionGet("nope");
50
- } catch (e) {
51
- expect((e as DaemonClientError).code).toBe("not_found");
52
- }
104
+ await expect(client.sessionGet("nope")).rejects.toBeInstanceOf(DaemonClientError);
105
+ await expect(client.sessionGet("nope")).rejects.toHaveProperty("code", "not_found");
53
106
  });
54
107
 
55
108
  test("events push to subscribed connections only", async () => {
109
+ // Arrange
56
110
  const observer = await DaemonClient.connect({ home });
57
111
  const seen: string[] = [];
58
- observer.onEvent((e) => seen.push(e.event));
112
+
113
+ observer.onEvent((event) => seen.push(event.event));
59
114
  await observer.subscribe();
60
- const s = await client.sessionCreate(WS, PLAN);
61
- await client.sessionResolve(s.id, "approve", "");
115
+
116
+ // Act
117
+ const session = await client.sessionCreate(WS, PLAN);
118
+
119
+ await client.sessionSendMessage(session.id, "approved", "");
120
+
121
+ // Assert
62
122
  // events are pushed async over the socket; give the loop a beat
63
123
  await Bun.sleep(50);
64
124
  expect(seen).toContain("session.created");
65
- expect(seen).toContain("session.resolved");
125
+ expect(seen).toContain("message.sent");
126
+ observer.close();
127
+ });
128
+
129
+ test("an event names the history entry its change appended", async () => {
130
+ // Arrange
131
+ const observer = await DaemonClient.connect({ home });
132
+ const frames: Array<{ event: string; entryId?: string }> = [];
133
+
134
+ observer.onEvent((event) => frames.push(event));
135
+ await observer.subscribe();
136
+ const session = await client.sessionCreate(WS, PLAN);
137
+
138
+ // Act
139
+ const annotated = await client.sessionAnnotate(session.id, {
140
+ id: "a_evt",
141
+ kind: "comment",
142
+ anchor: { quote: "Plan", prefix: "", suffix: "" },
143
+ body: "hello",
144
+ });
145
+
146
+ await Bun.sleep(50);
147
+
148
+ // Assert: the update frame carries the comment entry's id
149
+ const updated = frames.find((frame) => frame.event === "session.updated");
150
+
151
+ expect(updated?.entryId).toBe(annotated.history!.entries.at(-1)!.id);
66
152
  observer.close();
67
153
  });
68
154
 
155
+ test("a non-owner removes only the comments of the author it acts as, and names itself", async () => {
156
+ // Arrange: the owner's and Ana's comments; an agent connection acting as Ana
157
+ const session = await client.sessionCreate(WS, PLAN);
158
+
159
+ await client.sessionAnnotate(session.id, {
160
+ id: "own",
161
+ kind: "comment",
162
+ anchor: { quote: "Plan", prefix: "", suffix: "" },
163
+ body: "mine",
164
+ });
165
+ await client.sessionAnnotate(session.id, {
166
+ id: "anas",
167
+ kind: "comment",
168
+ anchor: { quote: "Plan", prefix: "", suffix: "" },
169
+ body: "hers",
170
+ author: "SHA256:ana",
171
+ });
172
+ const anonymous = await DaemonClient.connect({ home, role: "agent" });
173
+ const agent = await DaemonClient.connect({ home, role: "agent", author: "SHA256:ana" });
174
+
175
+ // Act + Assert: an unbound connection removes nothing; a bound one never another author's
176
+ await expect(anonymous.sessionRemoveAnnotation(session.id, "own")).rejects.toHaveProperty(
177
+ "code",
178
+ "forbidden",
179
+ );
180
+ await expect(agent.sessionRemoveAnnotation(session.id, "own")).rejects.toHaveProperty(
181
+ "code",
182
+ "forbidden",
183
+ );
184
+ await expect(
185
+ agent.sessionSetParticipantName(session.id, "SHA256:bob", "Not Bob"),
186
+ ).rejects.toHaveProperty("code", "forbidden");
187
+
188
+ // Act: her own comment goes, and she names herself
189
+ const removed = await agent.sessionRemoveAnnotation(session.id, "anas");
190
+ const named = await agent.sessionSetParticipantName(session.id, "SHA256:ana", "Ana");
191
+
192
+ // Assert
193
+ expect(removed.annotations.map((annotation) => annotation.id)).toEqual(["own"]);
194
+ expect(removed.history!.entries.at(-1)).toMatchObject({
195
+ type: "comment-removed",
196
+ annotationId: "anas",
197
+ });
198
+ expect(named.participants).toContainEqual({ id: "SHA256:ana", provider: "ssh", name: "Ana" });
199
+ anonymous.close();
200
+ agent.close();
201
+ });
202
+
69
203
  test("malformed requests get structured errors and never wedge the daemon", async () => {
70
204
  // missing required params
71
- try {
72
- await client.request("session.create", { artifact: { type: "plan", content: "x" } });
73
- throw new Error("should have thrown");
74
- } catch (e) {
75
- expect((e as DaemonClientError).code).toBe("invalid_params");
76
- }
205
+ await expect(
206
+ client.request("session.create", { artifact: { type: "plan", content: "x" } }, v.object({})),
207
+ ).rejects.toHaveProperty("code", "invalid_params");
77
208
  // wrong types
78
- try {
79
- await client.request("session.wait", { id: 42 });
80
- throw new Error("should have thrown");
81
- } catch (e) {
82
- expect((e as DaemonClientError).code).toBe("invalid_params");
83
- }
209
+ await expect(client.request("session.wait", { id: 42 }, v.object({}))).rejects.toHaveProperty(
210
+ "code",
211
+ "invalid_params",
212
+ );
84
213
  // unknown method
85
- try {
86
- await client.request("session.nuke", {});
87
- throw new Error("should have thrown");
88
- } catch (e) {
89
- expect((e as DaemonClientError).code).toBe("unknown_method");
90
- }
214
+ await expect(client.request("session.nuke", {}, v.object({}))).rejects.toHaveProperty(
215
+ "code",
216
+ "unknown_method",
217
+ );
218
+ await Promise.all(
219
+ ["__proto__", "toString", "constructor"].map((method) =>
220
+ expect(client.request(method, {}, v.object({}))).rejects.toHaveProperty(
221
+ "code",
222
+ "unknown_method",
223
+ ),
224
+ ),
225
+ );
91
226
  // the daemon is still fully alive afterwards
92
- const s = await client.sessionCreate(WS, PLAN);
93
- expect((await client.sessionGet(s.id)).id).toBe(s.id);
227
+ const session = await client.sessionCreate(WS, PLAN);
228
+
229
+ expect((await client.sessionGet(session.id)).id).toBe(session.id);
94
230
  });
95
231
 
96
232
  test("meta fields survive the wire: herdrPane set on create comes back from get", async () => {
97
- const s = await client.sessionCreate(WS, {
233
+ // Act
234
+ const session = await client.sessionCreate(WS, {
98
235
  type: "plan",
99
236
  content: "# P",
100
237
  meta: { agent: "claude-code", herdrPane: "%7" },
101
238
  });
102
- const got = await client.sessionGet(s.id);
239
+ const got = await client.sessionGet(session.id);
240
+
241
+ // Assert
103
242
  expect(got.artifact.meta.herdrPane).toBe("%7");
104
243
  expect(got.artifact.meta.agent).toBe("claude-code");
105
244
  });
106
245
 
246
+ test("share-sync primitives round-trip: setShareId persists, mergeShared unions notes and identities by id", async () => {
247
+ // Given a shared session with one local note
248
+ const session = await client.sessionCreate(WS, PLAN);
249
+ const anchor = { quote: "Body text", prefix: "", suffix: "." };
250
+
251
+ await client.sessionSetShareId(session.id, "p_abc123xy");
252
+ await client.sessionAnnotate(session.id, { id: "a1", kind: "comment", anchor, body: "mine" });
253
+ expect((await client.sessionGet(session.id)).shareId).toBe("p_abc123xy");
254
+
255
+ // When a pull merges an update to the known id, a new collaborator note, and the collaborator's identity
256
+ const merged = await client.sessionMergeShared(session.id, {
257
+ annotations: [
258
+ {
259
+ id: "a1",
260
+ kind: "comment",
261
+ anchor,
262
+ body: "should not overwrite",
263
+ createdAt: "2026-01-01T00:00:00.000Z",
264
+ },
265
+ {
266
+ id: "a2",
267
+ kind: "comment",
268
+ anchor,
269
+ body: "theirs",
270
+ author: "SHA256:mate",
271
+ createdAt: "2026-01-01T00:00:00.000Z",
272
+ },
273
+ ],
274
+ participants: [{ id: "SHA256:mate", provider: "ssh", name: "Sam" }],
275
+ });
276
+
277
+ // Then notes union by id (existing a1 kept), and the participant registry carries the collaborator's name
278
+ expect(merged.annotations.map((annotation) => annotation.id).sort()).toEqual(["a1", "a2"]);
279
+ expect(merged.annotations.find((annotation) => annotation.id === "a1")!.body).toBe("mine");
280
+ expect(merged.annotations.find((annotation) => annotation.id === "a2")!.author).toBe(
281
+ "SHA256:mate",
282
+ );
283
+ expect(merged.participants).toEqual([{ id: "SHA256:mate", provider: "ssh", name: "Sam" }]);
284
+ });
285
+
286
+ test("mergeShared validates each annotation at the socket boundary", async () => {
287
+ // Given a session
288
+ const session = await client.sessionCreate(WS, PLAN);
289
+
290
+ // When a malformed annotation is merged, it is rejected at the wire boundary
291
+ // @ts-expect-error intentionally malformed annotation (empty id, missing fields)
292
+ const merge = client.sessionMergeShared(session.id, { annotations: [{ id: "" }] });
293
+
294
+ await expect(merge).rejects.toHaveProperty("code", "invalid_params");
295
+ });
296
+
297
+ test("session.delete removes a session over the wire", async () => {
298
+ // Given a created session
299
+ const session = await client.sessionCreate(WS, PLAN);
300
+
301
+ // When it is deleted
302
+ await client.sessionDelete(session.id);
303
+
304
+ // Then it is gone, and deleting an unknown id is a not_found error
305
+ await expect(client.sessionGet(session.id)).rejects.toBeInstanceOf(DaemonClientError);
306
+ await expect(client.sessionDelete("ses_missing")).rejects.toHaveProperty("code", "not_found");
307
+ });
308
+
107
309
  test("two clients see the same state (thin-renderer model)", async () => {
310
+ // Arrange
108
311
  const second = await DaemonClient.connect({ home });
109
- const s = await client.sessionCreate(WS, PLAN);
110
- const fromSecond = await second.sessionGet(s.id);
312
+
313
+ // Act
314
+ const session = await client.sessionCreate(WS, PLAN);
315
+ const fromSecond = await second.sessionGet(session.id);
316
+
317
+ // Assert
111
318
  expect(fromSecond.artifact.content).toBe(PLAN.content);
112
319
  second.close();
113
320
  });
114
321
  });
322
+
323
+ describe("ownership is proven, never declared", () => {
324
+ /** A wire frame as the daemon answers it: a result or a coded error. */
325
+ interface WireReply {
326
+ result?: unknown;
327
+ error?: { code: string };
328
+ }
329
+
330
+ /** The request body a bare socket sends: the primitive's params as the wire carries them. */
331
+ type WireParams = Parameters<typeof JSON.stringify>[0];
332
+
333
+ interface RawConnection {
334
+ call: (method: string, params: WireParams) => Promise<WireReply>;
335
+ close: () => void;
336
+ }
337
+
338
+ /** A bare socket that speaks the wire protocol without the client's handshake. */
339
+ async function rawConnection(): Promise<RawConnection> {
340
+ const pending = new Map<number, (frame: WireReply) => void>();
341
+ let buffered = "";
342
+ let nextId = 1;
343
+ const socket = await Bun.connect({
344
+ unix: join(home, "cueloop.sock"),
345
+ socket: {
346
+ data: (_socket, data) => {
347
+ buffered += data.toString();
348
+ const lines = buffered.split("\n");
349
+
350
+ buffered = lines.pop() ?? "";
351
+ for (const line of lines) {
352
+ const frame = JSON.parse(line);
353
+
354
+ if ("id" in frame) pending.get(frame.id)?.(frame);
355
+ }
356
+ },
357
+ },
358
+ });
359
+
360
+ return {
361
+ call: (method, params) =>
362
+ new Promise((resolve) => {
363
+ const id = nextId++;
364
+
365
+ pending.set(id, resolve);
366
+ socket.write(JSON.stringify({ id, method, params }) + "\n");
367
+ }),
368
+ close: () => socket.end(),
369
+ };
370
+ }
371
+
372
+ test("a connection that never proves ownership is a collaborator: it reads and comments, nothing more", async () => {
373
+ // Arrange
374
+ const session = await client.sessionCreate(WS, PLAN);
375
+ const raw = await rawConnection();
376
+
377
+ // Act + Assert
378
+ expect((await raw.call("session.get", { id: session.id })).error).toBeUndefined();
379
+ expect(
380
+ (
381
+ await raw.call("session.annotate", {
382
+ id: session.id,
383
+ annotation: {
384
+ id: "a_raw",
385
+ kind: "comment",
386
+ anchor: { quote: "Plan", prefix: "", suffix: "" },
387
+ body: "from a bare socket",
388
+ },
389
+ })
390
+ ).error,
391
+ ).toBeUndefined();
392
+ expect(
393
+ (await raw.call("session.sendMessage", { id: session.id, outcome: "approved", summary: "" }))
394
+ .error?.code,
395
+ ).toBe("forbidden");
396
+ expect((await raw.call("session.delete", { id: session.id })).error?.code).toBe("forbidden");
397
+ raw.close();
398
+ });
399
+
400
+ test("claiming ownership without the token is refused; the token grants it", async () => {
401
+ // Arrange
402
+ const raw = await rawConnection();
403
+
404
+ // Act + Assert: a bare claim, then a wrong token, both refused
405
+ expect((await raw.call("daemon.hello", { role: "owner" })).error?.code).toBe("forbidden");
406
+ expect((await raw.call("daemon.hello", { role: "owner", token: "nope" })).error?.code).toBe(
407
+ "forbidden",
408
+ );
409
+ expect((await raw.call("daemon.shutdown", {})).error?.code).toBe("forbidden");
410
+
411
+ // Act: the token the daemon wrote into its home
412
+ const token = readFileSync(join(home, "owner.token"), "utf8").trim();
413
+
414
+ expect((await raw.call("daemon.hello", { role: "owner", token })).error).toBeUndefined();
415
+
416
+ // Assert: owner primitives open up
417
+ const created = await raw.call("session.create", { workspace: WS, artifact: PLAN });
418
+
419
+ expect(created.error).toBeUndefined();
420
+ raw.close();
421
+ });
422
+
423
+ test("a refused handshake reaches the caller and leaves the live daemon's socket alone", async () => {
424
+ // Arrange: a token file that is not what the daemon minted
425
+ const tokenPath = join(home, "owner.token");
426
+ const minted = readFileSync(tokenPath, "utf8");
427
+
428
+ writeFileSync(tokenPath, "0".repeat(64));
429
+
430
+ // Act + Assert: the client hears the refusal; autostart does not replace the daemon
431
+ await expect(DaemonClient.connect({ home, autostart: true })).rejects.toHaveProperty(
432
+ "code",
433
+ "forbidden",
434
+ );
435
+ expect(existsSync(join(home, "cueloop.sock"))).toBe(true);
436
+ expect((await client.sessionList()).length).toBe(0);
437
+
438
+ // Arrange: a token file that is not a token at all
439
+ writeFileSync(tokenPath, "not-a-token");
440
+
441
+ // Act + Assert
442
+ await expect(DaemonClient.connect({ home })).rejects.toHaveProperty(
443
+ "code",
444
+ "invalid_owner_token",
445
+ );
446
+ writeFileSync(tokenPath, minted);
447
+ });
448
+
449
+ test("the token exists before the socket does", () => {
450
+ // Arrange: a second daemon in another home
451
+ const other = mkdtempSync(join(tmpdir(), "cueloop-token-"));
452
+ const daemon = new DaemonServer({ home: other, idleExitMs: 0 });
453
+
454
+ try {
455
+ // Act
456
+ daemon.start();
457
+
458
+ // Assert: the token is on disk the moment the socket is
459
+ expect(existsSync(join(other, "owner.token"))).toBe(true);
460
+ expect(existsSync(join(other, "cueloop.sock"))).toBe(true);
461
+ } finally {
462
+ daemon.stop();
463
+ rmSync(other, { recursive: true, force: true });
464
+ }
465
+ });
466
+
467
+ test("the daemon client proves ownership on connect and the token is private to the home", async () => {
468
+ // Assert: the client in beforeEach connected as the owner through the token
469
+ const session = await client.sessionCreate(WS, PLAN);
470
+
471
+ expect((await client.sessionSendMessage(session.id, "approved", "")).status).toBe("resolved");
472
+ expect(statSync(join(home, "owner.token")).mode & 0o777).toBe(0o600);
473
+ });
474
+ });
475
+
476
+ describe("large payloads survive socket backpressure", () => {
477
+ test("a session bigger than the kernel socket buffer round-trips", async () => {
478
+ // Regression: responses larger than one socket write used to truncate
479
+ // mid-line because the write return value was ignored, so the client
480
+ // never saw the frame's newline and every later request wedged too.
481
+ // Arrange
482
+ const bigContent =
483
+ "# Big plan\n" + "lorem ipsum dolor sit amet, consectetur adipiscing elit\n".repeat(4000);
484
+
485
+ // Act
486
+ const created = await client.sessionCreate(
487
+ { repoRoot: "/repo", branch: "main" },
488
+ { type: "plan", content: bigContent, meta: { title: "big" } },
489
+ );
490
+ const fetched = await client.sessionGet(created.id);
491
+
492
+ // Assert
493
+ expect(fetched.artifact.content).toBe(bigContent);
494
+
495
+ // Act
496
+ // the connection must still be usable for the next frame
497
+ const listed = await client.sessionList();
498
+
499
+ // Assert
500
+ expect(listed.some((session) => session.id === created.id)).toBe(true);
501
+ }, 15_000);
502
+ });