@sma1lboy/kobe 0.6.9 → 0.6.10

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/dist/cli/index.js +28 -19
  2. package/package.json +2 -6
package/dist/cli/index.js CHANGED
@@ -70,18 +70,14 @@ var init_package = __esm(() => {
70
70
  package_default = {
71
71
  $schema: "https://json.schemastore.org/package.json",
72
72
  name: "@sma1lboy/kobe",
73
- version: "0.6.9",
73
+ version: "0.6.10",
74
74
  description: "TUI orchestrator for Claude Code (codename)",
75
75
  type: "module",
76
76
  packageManager: "bun@1.3.13",
77
77
  bin: {
78
78
  kobe: "dist/cli/index.js"
79
79
  },
80
- files: [
81
- "dist",
82
- "README.md",
83
- "LICENSE"
84
- ],
80
+ files: ["dist", "README.md", "LICENSE"],
85
81
  publishConfig: {
86
82
  access: "public"
87
83
  },
@@ -3272,8 +3268,13 @@ class KobeDaemonClient {
3272
3268
  onChannel(channel, handler) {
3273
3269
  return this.on(channel, (frame) => handler(frame.payload));
3274
3270
  }
3275
- subscribe(channels) {
3276
- return this.request("subscribe", channels ? { channels } : {});
3271
+ subscribe(opts = {}) {
3272
+ const payload = {};
3273
+ if (opts.channels)
3274
+ payload.channels = opts.channels;
3275
+ if (opts.role)
3276
+ payload.role = opts.role;
3277
+ return this.request("subscribe", payload);
3277
3278
  }
3278
3279
  onLifecycle(name, handler) {
3279
3280
  let set = this.lifecycleHandlers.get(name);
@@ -4413,10 +4414,10 @@ async function startDaemonServer(orch, options = {}) {
4413
4414
  const idleGraceMs = resolveIdleGraceMs();
4414
4415
  let idleTimer = null;
4415
4416
  let stopping = false;
4416
- function subscriberCount() {
4417
+ function guiCount() {
4417
4418
  let n = 0;
4418
4419
  for (const c of clients)
4419
- if (c.subscribed)
4420
+ if (c.holdsLifetime)
4420
4421
  n++;
4421
4422
  return n;
4422
4423
  }
@@ -4427,12 +4428,12 @@ async function startDaemonServer(orch, options = {}) {
4427
4428
  }
4428
4429
  }
4429
4430
  function maybeArmIdleShutdown() {
4430
- if (stopping || subscriberCount() > 0)
4431
+ if (stopping || guiCount() > 0)
4431
4432
  return;
4432
4433
  cancelIdleTimer();
4433
4434
  idleTimer = setTimeout(() => {
4434
4435
  idleTimer = null;
4435
- if (stopping || subscriberCount() > 0)
4436
+ if (stopping || guiCount() > 0)
4436
4437
  return;
4437
4438
  stopSoon().catch((err) => logDaemonError("daemon-idle-shutdown", err));
4438
4439
  }, idleGraceMs);
@@ -4451,7 +4452,8 @@ async function startDaemonServer(orch, options = {}) {
4451
4452
  connectedAt: new Date,
4452
4453
  socket,
4453
4454
  buffer: "",
4454
- subscribed: false
4455
+ subscribed: false,
4456
+ holdsLifetime: false
4455
4457
  };
4456
4458
  clients.add(client);
4457
4459
  socket.on("data", (chunk) => {
@@ -4461,7 +4463,7 @@ async function startDaemonServer(orch, options = {}) {
4461
4463
  socket.on("error", () => {});
4462
4464
  socket.on("close", () => {
4463
4465
  clients.delete(client);
4464
- if (client.subscribed)
4466
+ if (client.holdsLifetime)
4465
4467
  maybeArmIdleShutdown();
4466
4468
  });
4467
4469
  });
@@ -4549,7 +4551,7 @@ async function startDaemonServer(orch, options = {}) {
4549
4551
  daemonPid: process.pid,
4550
4552
  uptimeMs: Date.now() - startedAt.getTime(),
4551
4553
  startedAt: startedAt.toISOString(),
4552
- attachedClients: subscriberCount(),
4554
+ attachedClients: guiCount(),
4553
4555
  taskCount: orch.listTasks().length,
4554
4556
  socketPath
4555
4557
  };
@@ -4649,7 +4651,10 @@ async function startDaemonServer(orch, options = {}) {
4649
4651
  }
4650
4652
  case "subscribe": {
4651
4653
  client.subscribed = true;
4652
- cancelIdleTimer();
4654
+ const role = payload.role === "gui" ? "gui" : "pane";
4655
+ client.holdsLifetime = role === "gui";
4656
+ if (client.holdsLifetime)
4657
+ cancelIdleTimer();
4653
4658
  for (const event of bus.snapshot()) {
4654
4659
  writeFrame(client, { type: "event", name: event.channel, payload: event.payload });
4655
4660
  }
@@ -8440,6 +8445,7 @@ class RemoteOrchestrator {
8440
8445
  connectionStateAcc;
8441
8446
  setConnectionState;
8442
8447
  ensureReachable;
8448
+ role;
8443
8449
  constructor(client, options = {}) {
8444
8450
  this.client = client;
8445
8451
  const [tasks, setTasks] = createSignal([]);
@@ -8455,6 +8461,7 @@ class RemoteOrchestrator {
8455
8461
  this.connectionStateAcc = connectionState;
8456
8462
  this.setConnectionState = (next) => setConnectionState(() => next);
8457
8463
  this.ensureReachable = options.ensureReachable ?? ensureDaemonReachable;
8464
+ this.role = options.role ?? "pane";
8458
8465
  this.client.on("*", (frame) => this.handleEvent(frame.name, frame.payload));
8459
8466
  this.client.onLifecycle("close", () => this.setConnectionState("disconnected"));
8460
8467
  }
@@ -8475,7 +8482,7 @@ class RemoteOrchestrator {
8475
8482
  }
8476
8483
  if (hello.tasks)
8477
8484
  this.setTasks(hello.tasks.map(deserializeTask));
8478
- await this.client.subscribe();
8485
+ await this.client.subscribe({ role: this.role });
8479
8486
  this.setConnectionState("online");
8480
8487
  }
8481
8488
  connectionStateSignal() {
@@ -19005,7 +19012,7 @@ async function startDirectTmux() {
19005
19012
  return;
19006
19013
  }
19007
19014
  const client = await connectOrStartDaemon();
19008
- const orchestrator = new RemoteOrchestrator(client);
19015
+ const orchestrator = new RemoteOrchestrator(client, { role: "gui" });
19009
19016
  try {
19010
19017
  process.env.KOBE_DAEMON_SOCKET_PATH = client.socketPath;
19011
19018
  await orchestrator.init();
@@ -21229,7 +21236,9 @@ async function startApp() {
21229
21236
  });
21230
21237
  } else {
21231
21238
  const client = await connectOrStartDaemon();
21232
- orchestrator = new RemoteOrchestrator(client);
21239
+ orchestrator = new RemoteOrchestrator(client, {
21240
+ role: "gui"
21241
+ });
21233
21242
  process.env.KOBE_DAEMON_SOCKET_PATH = client.socketPath;
21234
21243
  await orchestrator.init();
21235
21244
  }
package/package.json CHANGED
@@ -1,18 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@sma1lboy/kobe",
4
- "version": "0.6.9",
4
+ "version": "0.6.10",
5
5
  "description": "TUI orchestrator for Claude Code (codename)",
6
6
  "type": "module",
7
7
  "packageManager": "bun@1.3.13",
8
8
  "bin": {
9
9
  "kobe": "dist/cli/index.js"
10
10
  },
11
- "files": [
12
- "dist",
13
- "README.md",
14
- "LICENSE"
15
- ],
11
+ "files": ["dist", "README.md", "LICENSE"],
16
12
  "publishConfig": {
17
13
  "access": "public"
18
14
  },