adhdev 0.8.56 → 0.8.58

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.
@@ -228,6 +228,41 @@ import { buildWorkspaceName, sanitizeWorkspaceName, toWorkspaceRef } from "@adhd
228
228
  import {
229
229
  SessionHostMuxClient
230
230
  } from "@adhdev/terminal-mux-core";
231
+
232
+ // src/runtime-list.ts
233
+ import {
234
+ formatRuntimeOwner,
235
+ getSessionHostRecoveryLabel,
236
+ getSessionHostSurfaceKind
237
+ } from "@adhdev/session-host-core";
238
+ function getRuntimeNextAction(record) {
239
+ const surfaceKind = getSessionHostSurfaceKind(record);
240
+ if (surfaceKind === "live_runtime") return "attach";
241
+ if (surfaceKind === "recovery_snapshot") return "recover";
242
+ return "restart";
243
+ }
244
+ function formatSurfaceKindLabel(record) {
245
+ const surfaceKind = getSessionHostSurfaceKind(record);
246
+ if (surfaceKind === "live_runtime") return "live runtime";
247
+ if (surfaceKind === "recovery_snapshot") return "recovery snapshot";
248
+ return "inactive record";
249
+ }
250
+ function formatMuxRuntimeListHeader() {
251
+ return "Raw session-host records visible to adhmux (may include recovery snapshots and stopped records). Use `adhdev runtime list` for the primary live/recovery view.";
252
+ }
253
+ function formatMuxRuntimeListLine(record) {
254
+ const recovery = getSessionHostRecoveryLabel(record.meta || void 0);
255
+ const extras = [
256
+ `surface=${formatSurfaceKindLabel(record)}`,
257
+ `next=${getRuntimeNextAction(record)}`,
258
+ recovery ? `recovery=${recovery}` : "",
259
+ `owner=${formatRuntimeOwner(record)}`,
260
+ `clients=${record.attachedClients.length}`
261
+ ].filter(Boolean).join(" ");
262
+ return `${record.runtimeKey} ${record.lifecycle} ${record.workspaceLabel} ${extras}`;
263
+ }
264
+
265
+ // src/index.ts
231
266
  var STARTUP_TIMEOUT_MS = 8e3;
232
267
  var STARTUP_POLL_MS = 200;
233
268
  var SESSION_HOST_APP_NAME = process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
@@ -241,7 +276,7 @@ function usage(exitCode = 1) {
241
276
  stream.write("Usage:\n");
242
277
  stream.write(" adhmux <command> [options] [runtimeKey...]\n\n");
243
278
  stream.write("Core commands:\n");
244
- stream.write(" list List hosted runtimes visible to session host\n");
279
+ stream.write(" list List raw session-host records visible to adhmux\n");
245
280
  stream.write(" open <runtimeKey> Open a mux workspace for a live runtime\n");
246
281
  stream.write(" snapshot <id> Print the latest terminal snapshot for a runtime\n");
247
282
  stream.write(" sessions List saved mux sessions\n");
@@ -327,11 +362,11 @@ async function listRuntimes(flags = { json: false }) {
327
362
  await client.close();
328
363
  return;
329
364
  }
365
+ process.stdout.write(`${formatMuxRuntimeListHeader()}
366
+ `);
330
367
  for (const record of result.result) {
331
- process.stdout.write(
332
- `${record.runtimeKey} ${record.lifecycle} ${record.workspaceLabel} ${record.writeOwner ? `${record.writeOwner.ownerType}:${record.writeOwner.clientId}` : "none"}
333
- `
334
- );
368
+ process.stdout.write(`${formatMuxRuntimeListLine(record)}
369
+ `);
335
370
  }
336
371
  await client.close();
337
372
  }