@cueloop/daemon 0.1.0-alpha.0 → 0.1.0-alpha.100

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 (80) hide show
  1. package/README.md +7 -0
  2. package/SDK.md +102 -0
  3. package/package.json +43 -16
  4. package/src/agent-tools.ts +98 -0
  5. package/src/agent-turn.test.ts +24 -0
  6. package/src/agent-turn.ts +34 -0
  7. package/src/api.test.ts +1081 -65
  8. package/src/api.ts +1425 -89
  9. package/src/capabilities.test.ts +57 -0
  10. package/src/capabilities.ts +95 -0
  11. package/src/client-errors.ts +24 -0
  12. package/src/client-reliability.test.ts +189 -0
  13. package/src/client.test.ts +37 -0
  14. package/src/client.ts +820 -94
  15. package/src/curate.ts +109 -0
  16. package/src/daemon-sdk-effect.ts +113 -0
  17. package/src/daemon-sdk.test.ts +306 -0
  18. package/src/daemon-sdk.ts +397 -0
  19. package/src/daemon-version.test.ts +142 -0
  20. package/src/diff-hot-reload.test.ts +419 -0
  21. package/src/diff-watcher.test.ts +117 -0
  22. package/src/diff-watcher.ts +326 -0
  23. package/src/examples/daemon-sdk.ts +55 -0
  24. package/src/gh.test.ts +59 -0
  25. package/src/gh.ts +74 -0
  26. package/src/ghostty-thread-surface-store.test.ts +49 -0
  27. package/src/ghostty-thread-surface-store.ts +101 -0
  28. package/src/ghostty-thread-surface.test.ts +398 -0
  29. package/src/ghostty-thread-surface.ts +267 -0
  30. package/src/harness-delivery.test.ts +269 -0
  31. package/src/harness-diagnostics.test.ts +26 -0
  32. package/src/harness-diagnostics.ts +30 -0
  33. package/src/harness-state-store.test.ts +93 -0
  34. package/src/harness-state-store.ts +213 -0
  35. package/src/herdr-split.test.ts +106 -0
  36. package/src/herdr-split.ts +85 -0
  37. package/src/herdr-thread-surface-store.test.ts +81 -0
  38. package/src/herdr-thread-surface-store.ts +66 -0
  39. package/src/herdr-thread-surface.test.ts +465 -0
  40. package/src/herdr-thread-surface.ts +378 -0
  41. package/src/index.ts +8 -8
  42. package/src/interruptible-wait.test.ts +127 -0
  43. package/src/interruptible-wait.ts +66 -0
  44. package/src/jj-working-tree.ts +131 -0
  45. package/src/main.ts +4 -1
  46. package/src/operation-receipts.test.ts +111 -0
  47. package/src/operation-receipts.ts +91 -0
  48. package/src/paths.ts +49 -0
  49. package/src/pr-poller.test.ts +102 -0
  50. package/src/pr-poller.ts +73 -0
  51. package/src/project-files.test.ts +134 -0
  52. package/src/project-files.ts +68 -0
  53. package/src/protocol.ts +78 -7
  54. package/src/retention.test.ts +191 -0
  55. package/src/retention.ts +123 -0
  56. package/src/sdk-identities.ts +35 -0
  57. package/src/server.test.ts +465 -40
  58. package/src/server.ts +601 -88
  59. package/src/share-blob.test.ts +119 -0
  60. package/src/share-blob.ts +57 -0
  61. package/src/single-instance.test.ts +162 -13
  62. package/src/store.conformance.test.ts +41 -0
  63. package/src/store.jsonl.test.ts +173 -0
  64. package/src/store.ts +267 -34
  65. package/src/testing/store-conformance.ts +192 -0
  66. package/src/thread-agent-validation.ts +119 -0
  67. package/src/thread-agent.test.ts +412 -0
  68. package/src/thread-agent.ts +713 -0
  69. package/src/thread-review.test.ts +483 -0
  70. package/src/thread-review.ts +382 -0
  71. package/src/thread-subscription.test.ts +174 -0
  72. package/src/thread-subscription.ts +129 -0
  73. package/src/thread-surface-config.test.ts +63 -0
  74. package/src/thread-surface-config.ts +61 -0
  75. package/src/validate.test.ts +366 -21
  76. package/src/validate.ts +458 -47
  77. package/src/vcs-source.test.ts +180 -0
  78. package/src/vcs-source.ts +229 -0
  79. package/src/version.ts +6 -0
  80. package/src/working-tree.ts +150 -0
@@ -0,0 +1,465 @@
1
+ /** Herdr Thread launching with a stub CLI, including tab and pane reuse. */
2
+
3
+ import { afterAll, describe, expect, test } from "bun:test";
4
+ import { chmodSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import { join } from "node:path";
7
+ import type { Thread } from "@cueloop/schema";
8
+ import {
9
+ openHerdrThreadTab,
10
+ openHerdrThreadPane,
11
+ openHerdrThreadSurface,
12
+ } from "./herdr-thread-surface";
13
+ import type { HerdrThreadSurfacePersistence } from "./herdr-thread-surface";
14
+ import type { HerdrThreadSurfaceHandle } from "./herdr-thread-surface-store";
15
+
16
+ const dir = mkdtempSync(join(tmpdir(), "cueloop-herdr-thread-surface-"));
17
+
18
+ /**
19
+ * A stub herdr binary. It logs argv, prints the tab-create result carrying both
20
+ * pane_id and tab_id (herdr 0.8.2 shape), and answers `pane get` alive or dead
21
+ * per `paneAlive` so the liveness branch can be exercised.
22
+ */
23
+ function makeStub(
24
+ name: string,
25
+ paneAlive = false,
26
+ leftNeighborPaneId = "w1:p1",
27
+ failedCommand?: "send-text" | "send-keys",
28
+ ) {
29
+ const logPath = join(dir, `${name}.log`);
30
+ const binPath = join(dir, `${name}.sh`);
31
+ const paneGet = paneAlive ? `printf '{"result":{"pane":{"pane_id":"w1:p2"}}}'` : "exit 1";
32
+
33
+ writeFileSync(
34
+ binPath,
35
+ `#!/bin/sh
36
+ printf '%s\\n' "$*" >> "${logPath}"
37
+ if [ "$1" = "pane" ] && [ "$2" = "${failedCommand ?? "never"}" ]; then exit 1; fi
38
+ if [ "$1" = "tab" ] && [ "$2" = "create" ]; then
39
+ printf '{"result":{"root_pane":{"pane_id":"w1:p2","tab_id":"w1:t2"}}}'
40
+ fi
41
+ if [ "$1" = "pane" ] && [ "$2" = "split" ]; then
42
+ printf '{"result":{"pane":{"pane_id":"w1:p3"}}}'
43
+ fi
44
+ if [ "$1" = "pane" ] && [ "$2" = "neighbor" ]; then
45
+ if [ "$4" = "w1:p3" ] && [ "$6" = "left" ]; then
46
+ printf '{"result":{"neighbor":{"neighbor_pane_id":"${leftNeighborPaneId}"}}}'
47
+ elif [ "$4" = "${leftNeighborPaneId}" ] && [ "$6" = "right" ]; then
48
+ printf '{"result":{"neighbor":{"neighbor_pane_id":"w1:p3"}}}'
49
+ else
50
+ printf '{"result":{"neighbor":{"neighbor_pane_id":null}}}'
51
+ fi
52
+ fi
53
+ if [ "$1" = "pane" ] && [ "$2" = "focus" ]; then
54
+ printf '{"result":{"focus":{"focused_pane_id":"w1:p3"}}}'
55
+ fi
56
+ if [ "$1" = "pane" ] && [ "$2" = "get" ]; then ${paneGet}; fi
57
+ exit 0
58
+ `,
59
+ );
60
+ chmodSync(binPath, 0o755);
61
+
62
+ return { binPath, logPath };
63
+ }
64
+
65
+ function readLines(logPath: string): string[] {
66
+ if (!existsSync(logPath)) return [];
67
+
68
+ return readFileSync(logPath, "utf8").split("\n").filter(Boolean);
69
+ }
70
+
71
+ /** In-memory persistence double for native Thread handles. */
72
+ function fakePersistence(initial: HerdrThreadSurfaceHandle | null = null) {
73
+ let stored = initial;
74
+
75
+ return {
76
+ persistence: {
77
+ herdrGetThreadSurface: async () => stored,
78
+ herdrSetThreadSurface: async (_sessionId: string, handle: HerdrThreadSurfaceHandle) => {
79
+ stored = handle;
80
+ },
81
+ },
82
+ saved: () => stored,
83
+ };
84
+ }
85
+
86
+ function newSession(overrides: Partial<Thread> = {}): Thread {
87
+ return {
88
+ schemaVersion: "1",
89
+ id: "ses_new1",
90
+ workspace: { repoRoot: "/repo", branch: "main" },
91
+ artifact: { type: "plan", content: "# P", meta: { cwd: "/repo/work", title: "Rollout Plan" } },
92
+ revisions: [{ revision: 1, content: "# P", submittedAt: "now" }],
93
+ annotations: [],
94
+ message: null,
95
+ status: "pending",
96
+ createdAt: "now",
97
+ ...overrides,
98
+ };
99
+ }
100
+
101
+ describe("openHerdrThreadTab", () => {
102
+ test("creates a focused tab, launches the review, and returns the handle", () => {
103
+ const stub = makeStub("open");
104
+
105
+ const handle = openHerdrThreadTab({
106
+ sessionId: "ses_abc",
107
+ cwd: "/repo/work",
108
+ binPath: stub.binPath,
109
+ label: "Rollout Plan",
110
+ });
111
+
112
+ expect(handle).toEqual({ tabId: "w1:t2", paneId: "w1:p2" });
113
+ expect(readLines(stub.logPath)).toEqual([
114
+ "tab create --cwd /repo/work --label Rollout Plan --focus",
115
+ "pane send-text w1:p2 cueloop ses_abc",
116
+ "pane send-keys w1:p2 enter",
117
+ ]);
118
+ });
119
+
120
+ test("returns null and never throws on a broken binary", () => {
121
+ expect(
122
+ openHerdrThreadTab({
123
+ sessionId: "ses_abc",
124
+ cwd: "/repo/work",
125
+ binPath: join(dir, "missing-bin"),
126
+ label: "x",
127
+ }),
128
+ ).toBeNull();
129
+ });
130
+
131
+ test("returns null when tab create yields no ids - no send-text, no send-keys", () => {
132
+ const logPath = join(dir, "nopane.log");
133
+ const binPath = join(dir, "nopane.sh");
134
+
135
+ writeFileSync(
136
+ binPath,
137
+ `#!/bin/sh\nprintf '%s\\n' "$*" >> "${logPath}"\nprintf '{"result":{}}'\n`,
138
+ );
139
+ chmodSync(binPath, 0o755);
140
+
141
+ const handle = openHerdrThreadTab({
142
+ sessionId: "ses_abc",
143
+ cwd: "/repo/work",
144
+ binPath,
145
+ label: "x",
146
+ });
147
+
148
+ expect(handle).toBeNull();
149
+ expect(readLines(logPath)).toEqual(["tab create --cwd /repo/work --label x --focus"]);
150
+ });
151
+
152
+ test("closes a tab if the Thread command cannot be sent", () => {
153
+ const stub = makeStub("tab-send-failed", false, "w1:p1", "send-text");
154
+
155
+ expect(
156
+ openHerdrThreadTab({
157
+ sessionId: "ses_abc",
158
+ cwd: "/repo/work",
159
+ binPath: stub.binPath,
160
+ label: "Rollout Plan",
161
+ }),
162
+ ).toBeNull();
163
+ expect(readLines(stub.logPath)).toEqual([
164
+ "tab create --cwd /repo/work --label Rollout Plan --focus",
165
+ "pane send-text w1:p2 cueloop ses_abc",
166
+ "tab close w1:t2",
167
+ ]);
168
+ });
169
+ });
170
+
171
+ describe("openHerdrThreadPane", () => {
172
+ test("creates a focused right-hand pane at 50 percent and launches cueloop", () => {
173
+ const stub = makeStub("split");
174
+ const handle = openHerdrThreadPane({
175
+ sessionId: "ses_abc",
176
+ cwd: "/repo/work",
177
+ binPath: stub.binPath,
178
+ sourcePaneId: "w1:p1",
179
+ tabId: "w1:t1",
180
+ });
181
+
182
+ expect(handle).toEqual({
183
+ mode: "pane",
184
+ tabId: "w1:t1",
185
+ paneId: "w1:p3",
186
+ });
187
+ expect(readLines(stub.logPath)).toEqual([
188
+ "pane split w1:p1 --direction right --ratio 0.5 --cwd /repo/work --focus",
189
+ "pane send-text w1:p3 cueloop ses_abc",
190
+ "pane send-keys w1:p3 enter",
191
+ ]);
192
+ });
193
+
194
+ test("closes a pane if the Thread command cannot be entered", () => {
195
+ const stub = makeStub("pane-enter-failed", false, "w1:p1", "send-keys");
196
+
197
+ expect(
198
+ openHerdrThreadPane({
199
+ sessionId: "ses_abc",
200
+ cwd: "/repo/work",
201
+ binPath: stub.binPath,
202
+ sourcePaneId: "w1:p1",
203
+ tabId: "w1:t1",
204
+ }),
205
+ ).toBeNull();
206
+ expect(readLines(stub.logPath)).toEqual([
207
+ "pane split w1:p1 --direction right --ratio 0.5 --cwd /repo/work --focus",
208
+ "pane send-text w1:p3 cueloop ses_abc",
209
+ "pane send-keys w1:p3 enter",
210
+ "pane close w1:p3",
211
+ ]);
212
+ });
213
+ });
214
+
215
+ describe("openHerdrThreadSurface", () => {
216
+ test("tab mode targets the calling Herdr workspace", async () => {
217
+ const stub = makeStub("workspace");
218
+ const store = fakePersistence();
219
+ const env = {
220
+ HERDR_ENV: "1",
221
+ HERDR_PANE_ID: "w1:p1",
222
+ HERDR_WORKSPACE_ID: "w1",
223
+ HERDR_BIN_PATH: stub.binPath,
224
+ };
225
+
226
+ expect(await openHerdrThreadSurface(newSession(), store.persistence, env, "tab")).toBe(
227
+ "opened",
228
+ );
229
+ expect(readLines(stub.logPath)[0]).toBe(
230
+ "tab create --workspace w1 --cwd /repo/work --label Rollout Plan --focus",
231
+ );
232
+ });
233
+
234
+ test("pane mode focuses a live remembered pane and reopens a closed one", async () => {
235
+ const stub = makeStub("pane-reopen", false);
236
+ const env = {
237
+ HERDR_ENV: "1",
238
+ HERDR_PANE_ID: "w1:p1",
239
+ HERDR_TAB_ID: "w1:t1",
240
+ HERDR_BIN_PATH: stub.binPath,
241
+ };
242
+ const store = fakePersistence({
243
+ mode: "pane",
244
+ tabId: "w1:t1",
245
+ paneId: "w1:p9",
246
+ });
247
+
248
+ expect(await openHerdrThreadSurface(newSession(), store.persistence, env, "pane")).toBe(
249
+ "opened",
250
+ );
251
+ expect(readLines(stub.logPath)).toContain("pane get w1:p9");
252
+ expect(store.saved()).toEqual({
253
+ mode: "pane",
254
+ tabId: "w1:t1",
255
+ paneId: "w1:p3",
256
+ });
257
+
258
+ const live = makeStub("pane-focus", true);
259
+ const liveEnv = { ...env, HERDR_BIN_PATH: live.binPath };
260
+
261
+ expect(await openHerdrThreadSurface(newSession(), store.persistence, liveEnv, "pane")).toBe(
262
+ "focused",
263
+ );
264
+ expect(readLines(live.logPath)).toEqual([
265
+ "pane get w1:p3",
266
+ "tab focus w1:t1",
267
+ "pane neighbor --pane w1:p3 --direction left",
268
+ "pane neighbor --pane w1:p1 --direction right",
269
+ "pane focus --pane w1:p1 --direction right",
270
+ ]);
271
+ });
272
+
273
+ test("a moved live pane focuses through its new neighbor without opening a duplicate", async () => {
274
+ const stub = makeStub("pane-moved", true, "w1:p4");
275
+ const store = fakePersistence({
276
+ mode: "pane",
277
+ tabId: "w1:t1",
278
+ paneId: "w1:p3",
279
+ });
280
+ const env = {
281
+ HERDR_ENV: "1",
282
+ HERDR_PANE_ID: "w1:p1",
283
+ HERDR_TAB_ID: "w1:t1",
284
+ HERDR_BIN_PATH: stub.binPath,
285
+ };
286
+
287
+ expect(await openHerdrThreadSurface(newSession(), store.persistence, env, "pane")).toBe(
288
+ "focused",
289
+ );
290
+ expect(readLines(stub.logPath)).toEqual([
291
+ "pane get w1:p3",
292
+ "tab focus w1:t1",
293
+ "pane neighbor --pane w1:p3 --direction left",
294
+ "pane neighbor --pane w1:p4 --direction right",
295
+ "pane focus --pane w1:p4 --direction right",
296
+ ]);
297
+ });
298
+
299
+ test("none never launches, and a launch failure reports failure without resolving the Thread", async () => {
300
+ const stub = makeStub("disabled");
301
+ const env = { HERDR_ENV: "1", HERDR_PANE_ID: "w1:p1", HERDR_BIN_PATH: stub.binPath };
302
+ const store = fakePersistence();
303
+
304
+ expect(await openHerdrThreadSurface(newSession(), store.persistence, env, "none")).toBe(
305
+ "disabled",
306
+ );
307
+ expect(readLines(stub.logPath)).toEqual([]);
308
+ expect(
309
+ await openHerdrThreadSurface(
310
+ newSession(),
311
+ store.persistence,
312
+ { ...env, HERDR_BIN_PATH: join(dir, "missing-binary") },
313
+ "tab",
314
+ ),
315
+ ).toBe("failed");
316
+ expect(store.saved()).toBeNull();
317
+ });
318
+ test("opens and records a tab for a review with no recorded tab", async () => {
319
+ const stub = makeStub("gated-new");
320
+ const env = { HERDR_ENV: "1", HERDR_PANE_ID: "w1:p1", HERDR_BIN_PATH: stub.binPath };
321
+ const store = fakePersistence(null);
322
+
323
+ await openHerdrThreadSurface(newSession({ id: "ses_xyz" }), store.persistence, env);
324
+
325
+ expect(readLines(stub.logPath)).toEqual([
326
+ "tab create --cwd /repo/work --label Rollout Plan --focus",
327
+ "pane send-text w1:p2 cueloop ses_xyz",
328
+ "pane send-keys w1:p2 enter",
329
+ ]);
330
+ expect(store.saved()).toEqual({ tabId: "w1:t2", paneId: "w1:p2" });
331
+ });
332
+
333
+ test("no-op outside herdr - no herdr process is spawned", async () => {
334
+ const stub = makeStub("gated-outside");
335
+ const store = fakePersistence(null);
336
+
337
+ await openHerdrThreadSurface(newSession(), store.persistence, {
338
+ HERDR_PANE_ID: "w1:p1",
339
+ HERDR_BIN_PATH: stub.binPath,
340
+ });
341
+
342
+ expect(existsSync(stub.logPath)).toBeFalse();
343
+ expect(store.saved()).toBeNull();
344
+ });
345
+
346
+ test("focuses the recorded tab when its pane is still alive, without reopening", async () => {
347
+ const stub = makeStub("gated-alive", true);
348
+ const env = { HERDR_ENV: "1", HERDR_PANE_ID: "w1:p1", HERDR_BIN_PATH: stub.binPath };
349
+ const store = fakePersistence({ tabId: "w9:t9", paneId: "w9:p9" });
350
+
351
+ await openHerdrThreadSurface(newSession(), store.persistence, env);
352
+
353
+ const lines = readLines(stub.logPath);
354
+
355
+ expect(lines).toContain("pane get w9:p9");
356
+ expect(lines).toContain("tab focus w9:t9");
357
+ expect(lines.some((line) => line.startsWith("tab create"))).toBeFalse();
358
+ expect(store.saved()).toEqual({ tabId: "w9:t9", paneId: "w9:p9" });
359
+ });
360
+
361
+ test("opens a tab when the recorded live surface is a pane", async () => {
362
+ const stub = makeStub("pane-to-tab", true);
363
+ const herdrEnvironment = {
364
+ HERDR_ENV: "1",
365
+ HERDR_PANE_ID: "w1:p1",
366
+ HERDR_BIN_PATH: stub.binPath,
367
+ };
368
+ const store = fakePersistence({ mode: "pane", tabId: "w1:t1", paneId: "w1:p3" });
369
+
370
+ expect(
371
+ await openHerdrThreadSurface(
372
+ newSession(),
373
+ store.persistence,
374
+ herdrEnvironment,
375
+ "tab",
376
+ "pair",
377
+ ),
378
+ ).toBe("opened");
379
+ expect(readLines(stub.logPath)).toEqual([
380
+ "tab create --cwd /repo/work --label Rollout Plan --focus",
381
+ "pane send-text w1:p2 cueloop pair ses_new1",
382
+ "pane send-keys w1:p2 enter",
383
+ "pane close w1:p3",
384
+ ]);
385
+ expect(store.saved()).toEqual({ tabId: "w1:t2", paneId: "w1:p2", layout: "pair" });
386
+ });
387
+
388
+ test("replaces a generic review tab with the pairing layout", async () => {
389
+ const stub = makeStub("review-to-pair", true);
390
+ const herdrEnvironment = {
391
+ HERDR_ENV: "1",
392
+ HERDR_PANE_ID: "w1:p1",
393
+ HERDR_BIN_PATH: stub.binPath,
394
+ };
395
+ const store = fakePersistence({ tabId: "w9:t9", paneId: "w9:p9" });
396
+
397
+ expect(
398
+ await openHerdrThreadSurface(
399
+ newSession(),
400
+ store.persistence,
401
+ herdrEnvironment,
402
+ "tab",
403
+ "pair",
404
+ ),
405
+ ).toBe("opened");
406
+ expect(readLines(stub.logPath)).toEqual([
407
+ "tab create --cwd /repo/work --label Rollout Plan --focus",
408
+ "pane send-text w1:p2 cueloop pair ses_new1",
409
+ "pane send-keys w1:p2 enter",
410
+ "tab close w9:t9",
411
+ ]);
412
+ expect(store.saved()).toEqual({ tabId: "w1:t2", paneId: "w1:p2", layout: "pair" });
413
+ });
414
+
415
+ test("a persistence failure never escapes - review creation stays best-effort", async () => {
416
+ const stub = makeStub("gated-persist-fail");
417
+ const env = { HERDR_ENV: "1", HERDR_PANE_ID: "w1:p1", HERDR_BIN_PATH: stub.binPath };
418
+ const persistence: HerdrThreadSurfacePersistence = {
419
+ herdrGetThreadSurface: async () => null,
420
+ herdrSetThreadSurface: async () => {
421
+ throw new Error("disk full");
422
+ },
423
+ };
424
+
425
+ await openHerdrThreadSurface(newSession(), persistence, env);
426
+ expect(readLines(stub.logPath).some((line) => line.startsWith("tab create"))).toBeTrue();
427
+ });
428
+
429
+ test("a recall failure (stale daemon) still opens a fresh tab", async () => {
430
+ const stub = makeStub("gated-recall-fail");
431
+ const env = { HERDR_ENV: "1", HERDR_PANE_ID: "w1:p1", HERDR_BIN_PATH: stub.binPath };
432
+ const persistence: HerdrThreadSurfacePersistence = {
433
+ herdrGetThreadSurface: async () => {
434
+ throw new Error("unknown method herdr.getThreadSurface");
435
+ },
436
+ herdrSetThreadSurface: async () => {},
437
+ };
438
+
439
+ await openHerdrThreadSurface(newSession({ id: "ses_stale" }), persistence, env);
440
+
441
+ expect(readLines(stub.logPath)).toEqual([
442
+ "tab create --cwd /repo/work --label Rollout Plan --focus",
443
+ "pane send-text w1:p2 cueloop ses_stale",
444
+ "pane send-keys w1:p2 enter",
445
+ ]);
446
+ });
447
+
448
+ test("reopens and re-records when the recorded pane is dead", async () => {
449
+ const stub = makeStub("gated-dead", false);
450
+ const env = { HERDR_ENV: "1", HERDR_PANE_ID: "w1:p1", HERDR_BIN_PATH: stub.binPath };
451
+ const store = fakePersistence({ tabId: "old:t", paneId: "old:p" });
452
+
453
+ await openHerdrThreadSurface(newSession({ id: "ses_re" }), store.persistence, env);
454
+
455
+ const lines = readLines(stub.logPath);
456
+
457
+ expect(lines).toContain("pane get old:p");
458
+ expect(lines).toContain("tab create --cwd /repo/work --label Rollout Plan --focus");
459
+ expect(store.saved()).toEqual({ tabId: "w1:t2", paneId: "w1:p2" });
460
+ });
461
+ });
462
+
463
+ afterAll(() => {
464
+ rmSync(dir, { recursive: true, force: true, maxRetries: 3 });
465
+ });