cueloop 0.1.0-alpha.100 → 0.1.0-alpha.102

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cueloop",
3
- "version": "0.1.0-alpha.100",
3
+ "version": "0.1.0-alpha.102",
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": {
@@ -27,14 +27,14 @@
27
27
  "access": "public"
28
28
  },
29
29
  "scripts": {
30
- "build:binary": "bun build --compile --minify --external cpu-features ./src/main.ts --outfile dist/cueloop"
30
+ "build:binary": "bun build --compile --bytecode --format=esm --minify --external cpu-features ./src/main.ts --outfile dist/cueloop"
31
31
  },
32
32
  "dependencies": {
33
- "@cueloop/adapters": "0.1.0-alpha.100",
34
- "@cueloop/client": "0.1.0-alpha.100",
35
- "@cueloop/daemon": "0.1.0-alpha.100",
36
- "@cueloop/extension-api": "0.1.0-alpha.100",
37
- "@cueloop/schema": "0.1.0-alpha.100",
33
+ "@cueloop/adapters": "0.1.0-alpha.102",
34
+ "@cueloop/client": "0.1.0-alpha.102",
35
+ "@cueloop/daemon": "0.1.0-alpha.102",
36
+ "@cueloop/extension-api": "0.1.0-alpha.102",
37
+ "@cueloop/schema": "0.1.0-alpha.102",
38
38
  "@modelcontextprotocol/server": "2.1.0",
39
39
  "@valibot/to-json-schema": "1.8.0",
40
40
  "valibot": "^1.5.0"
@@ -1,17 +1,32 @@
1
+ import { createPiHarness } from "@cueloop/adapters/pi/durable-harness";
2
+ import { cueloopHome } from "@cueloop/daemon";
1
3
  import { createFxHarness } from "@cueloop/adapters/fx/harness";
2
4
  import { loadConfig } from "@cueloop/client/config";
3
5
  import type { AgentHarnessAdapter } from "@cueloop/schema";
4
6
 
5
7
  /** Select a locally installed harness; unsupported providers fail before a daemon starts. */
6
8
  export function configuredAgentHarness(): AgentHarnessAdapter | undefined {
7
- const id = process.env.CUELOOP_AGENT_HARNESS ?? "fx";
9
+ const id = process.env.CUELOOP_AGENT_HARNESS ?? "pi";
10
+
11
+ if (id === "pi") return createPiHarness({ home: cueloopHome() });
8
12
 
9
13
  if (id !== "fx") throw new Error(`Thread agent harness is not installed: ${id}`);
10
14
 
11
- return createFxHarness({ command: [process.env.CUELOOP_FX_EXECUTABLE ?? "fx", "acp"] });
15
+ return fxHarness();
12
16
  }
13
17
 
14
18
  /** Resolve the experimental Thread agent flag from user and workspace TOML. */
15
19
  export function threadAgentEnabled(repoRoot: string): boolean {
16
20
  return loadConfig({ repoRoot }).experimental.threadAgent;
17
21
  }
22
+
23
+ export function installedAgentHarnesses() {
24
+ return {
25
+ pi: createPiHarness({ home: cueloopHome() }),
26
+ fx: fxHarness(),
27
+ };
28
+ }
29
+
30
+ function fxHarness(): AgentHarnessAdapter {
31
+ return createFxHarness({ command: [process.env.CUELOOP_FX_EXECUTABLE ?? "fx", "acp"] });
32
+ }
@@ -1,3 +1,4 @@
1
+ import { OwnerAgentRelay } from "@cueloop/adapters/owner-agent-relay";
1
2
  /** Compose the local daemon with its installed harness adapters at the CLI boundary. */
2
3
  export async function daemonCommand(argv: string[]): Promise<number> {
3
4
  const { DaemonServer } = await import("@cueloop/daemon");
@@ -7,13 +8,20 @@ export async function daemonCommand(argv: string[]): Promise<number> {
7
8
  let idleExitMs: number | undefined = 0;
8
9
 
9
10
  if (argv.includes("--autostart")) idleExitMs = envIdle ? Number(envIdle) : undefined;
10
- const { configuredAgentHarness, threadAgentEnabled } = await import("./agent-harness");
11
+ const { configuredAgentHarness, installedAgentHarnesses, threadAgentEnabled } =
12
+ await import("./agent-harness");
13
+ let relay: OwnerAgentRelay | undefined;
11
14
  const server = new DaemonServer({
15
+ onEvent: (event) => {
16
+ relay?.notify(event);
17
+ if (event.event !== "agent.updated") relay?.update(server.core.sessionList());
18
+ },
12
19
  idleExitMs,
13
20
  threadAgent: {
14
21
  enabled: true,
15
22
  enabledForThread: (thread) => threadAgentEnabled(thread.workspace.repoRoot),
16
23
  adapter: configuredAgentHarness(),
24
+ adapters: installedAgentHarnesses(),
17
25
  },
18
26
  });
19
27
  const path = server.start();
@@ -23,15 +31,26 @@ export async function daemonCommand(argv: string[]): Promise<number> {
23
31
 
24
32
  return 1;
25
33
  }
34
+ server.resumeAgents();
35
+ relay = new OwnerAgentRelay({
36
+ home: server.home,
37
+ enabled: (thread) => threadAgentEnabled(thread.workspace.repoRoot),
38
+ onError: (error) => console.error("[agent relay]", error),
39
+ });
40
+ relay.update(server.core.sessionList());
26
41
  console.log(`cueloop daemon (foreground) on ${path}`);
27
- const stop = () => {
28
- server.stop();
42
+ const stop = async () => {
43
+ relay?.stop();
44
+ await server.shutdown();
29
45
  process.exit(0);
30
46
  };
31
47
 
32
48
  process.once("SIGINT", stop);
33
49
  process.once("SIGTERM", stop);
34
- process.once("exit", () => server.stop());
50
+ process.once("exit", () => {
51
+ relay?.stop();
52
+ server.stop();
53
+ });
35
54
  await new Promise(() => {}); // run until signalled
36
55
 
37
56
  return 0;