cueloop 0.1.0-alpha.92 → 0.1.0-alpha.94

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 (2) hide show
  1. package/package.json +6 -6
  2. package/src/main.ts +29 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cueloop",
3
- "version": "0.1.0-alpha.92",
3
+ "version": "0.1.0-alpha.94",
4
4
  "description": "Terminal review surface for coding agents: annotate plans and diffs, return a message, send structured feedback back",
5
5
  "homepage": "https://github.com/mmurakaru/cueloop#readme",
6
6
  "bugs": {
@@ -30,11 +30,11 @@
30
30
  "build:binary": "bun build --compile --minify --external cpu-features ./src/main.ts --outfile dist/cueloop"
31
31
  },
32
32
  "dependencies": {
33
- "@cueloop/adapters": "0.1.0-alpha.92",
34
- "@cueloop/client": "0.1.0-alpha.92",
35
- "@cueloop/daemon": "0.1.0-alpha.92",
36
- "@cueloop/extension-api": "0.1.0-alpha.92",
37
- "@cueloop/schema": "0.1.0-alpha.92",
33
+ "@cueloop/adapters": "0.1.0-alpha.94",
34
+ "@cueloop/client": "0.1.0-alpha.94",
35
+ "@cueloop/daemon": "0.1.0-alpha.94",
36
+ "@cueloop/extension-api": "0.1.0-alpha.94",
37
+ "@cueloop/schema": "0.1.0-alpha.94",
38
38
  "@modelcontextprotocol/server": "2.0.0",
39
39
  "@valibot/to-json-schema": "1.4.0",
40
40
  "valibot": "^1.5.0"
package/src/main.ts CHANGED
@@ -22,8 +22,8 @@ import {
22
22
  } from "./open-target";
23
23
  import { sessionCommand } from "./thread-commands";
24
24
  import { CLI_VERSION } from "./version";
25
- import { DaemonClient } from "@cueloop/daemon/client";
26
- import type { Thread, ThreadSurfaceOpenStatus } from "@cueloop/schema";
25
+ import { DaemonClient, DaemonClientError } from "@cueloop/daemon/client";
26
+ import type { DiffFileContents, Thread, ThreadSurfaceOpenStatus } from "@cueloop/schema";
27
27
  import { openReview } from "@cueloop/daemon/thread-review";
28
28
 
29
29
  const argv = process.argv.slice(2);
@@ -272,11 +272,25 @@ async function diffCommand(argv: string[]): Promise<number> {
272
272
  if (wantsOpen) return openReviewOfKind(isDiffReview, "diff", selector, "review");
273
273
 
274
274
  const client = await DaemonClient.connect({ autostart: true });
275
- const workbench = await client.sessionWorkbench(process.cwd());
276
275
 
277
- client.close();
276
+ try {
277
+ const cwd = process.cwd();
278
+ let initialReview: Awaited<ReturnType<DaemonClient["workbenchReview"]>>;
279
+
280
+ try {
281
+ initialReview = await client.workbenchReview(cwd);
282
+ } catch (error) {
283
+ if (!(error instanceof DaemonClientError) || error.code !== "unknown_method") throw error;
284
+ const session = await client.sessionWorkbench(cwd);
285
+ const diff = await client.repoDiff(cwd);
286
+
287
+ initialReview = { session, diff };
288
+ }
278
289
 
279
- return runTui(workbench.id, "review");
290
+ return await runTui(initialReview.session.id, "review", initialReview, client);
291
+ } finally {
292
+ client.close();
293
+ }
280
294
  }
281
295
 
282
296
  async function pairCommand(argv: string[]): Promise<number> {
@@ -348,7 +362,15 @@ async function reviewEntry(argv: string[]): Promise<number> {
348
362
  * omitted) restores the remembered one. Resolve the factory here so the heavy client
349
363
  * module stays lazily imported for non-TUI commands.
350
364
  */
351
- async function runTui(sessionId?: string, layout?: "review" | "plan" | "pair"): Promise<number> {
365
+ async function runTui(
366
+ sessionId?: string,
367
+ layout?: "review" | "plan" | "pair",
368
+ initialReview?: {
369
+ session: Thread;
370
+ diff: { patch: string; files: DiffFileContents[] };
371
+ },
372
+ initialClient?: DaemonClient,
373
+ ): Promise<number> {
352
374
  const { runClient, pairLayout, reviewLayout, planLayout } = await import("@cueloop/client");
353
375
  const resolved =
354
376
  layout === "review"
@@ -359,7 +381,7 @@ async function runTui(sessionId?: string, layout?: "review" | "plan" | "pair"):
359
381
  ? pairLayout()
360
382
  : undefined;
361
383
 
362
- return runClient({ sessionId, layout: resolved });
384
+ return runClient({ sessionId, layout: resolved, initialReview, initialClient });
363
385
  }
364
386
 
365
387
  function printHelp(): void {