clawborrator-cli 0.2.13 → 0.2.15

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.
@@ -69411,16 +69411,20 @@ var desktopDelete = new Command("delete").description("hard-delete a desktop dae
69411
69411
  console.log(` sessions unmanaged: ${out.sessionsUnmanaged}`);
69412
69412
  if (out.wsClosed) console.log(` closed the live /supervisor WS`);
69413
69413
  });
69414
- var desktopCreate = new Command("create-session").description("ask a desktop daemon to spawn a managed CC session in a folder").argument("<machineId>", "desktop machine id (from `claw desktop list`)").argument("<folder>", "absolute path on the desktop where CC should be spawned").option("--routing-name <name>", "optional routing name for the new session (e.g. @frontend)").option("--flag <flag...>", "extra CLI flag to pass to claude. Repeat for multiple. Use one argv slot per --flag (e.g. --flag --model --flag opus, or --flag --model=opus). Reference: https://code.claude.com/docs/en/cli-reference#cli-flags").option("--manual-start", "do NOT auto-press Enter on startup; operator answers prompts via screenshot PIP / `claw session input`").action(async (machineId, folder, opts) => {
69414
+ var desktopCreate = new Command("create-session").description("ask a desktop daemon to spawn a managed CC session in a folder").argument("<machineId>", "desktop machine id (from `claw desktop list`)").argument("<folder>", "absolute path on the desktop where CC should be spawned").option("--routing-name <name>", "optional routing name for the new session (e.g. @frontend)").option("--flag <flag...>", "extra CLI flag to pass to claude. Repeat for multiple. Use one argv slot per --flag (e.g. --flag --model --flag opus, or --flag --model=opus). Reference: https://code.claude.com/docs/en/cli-reference#cli-flags").option("--manual-start", "do NOT auto-press Enter on startup; operator answers prompts via screenshot PIP / `claw session input`").option("--auto-start", "respawn this session whenever the desktop daemon reconnects (e.g. after PC reboot). With --preserve-session-id, the respawn keeps the same sessionId; without it, each respawn mints a fresh sessionId + token.").option("--preserve-session-id", "opt the session into sessionId-permanence: Reset (soft restart) becomes available, autoStart-respawn keeps the same sessionId, and history + agent.session_id + webhook pins survive across all restart shapes. Default false (impermanent \u2014 every restart rotates state).").action(async (machineId, folder, opts) => {
69415
69415
  const body = { folder };
69416
69416
  if (opts.routingName) body.routingName = opts.routingName;
69417
69417
  if (opts.flag && opts.flag.length > 0) body.flags = opts.flag;
69418
69418
  if (opts.manualStart) body.autoEnter = false;
69419
+ if (opts.autoStart) body.autoStart = true;
69420
+ if (opts.preserveSessionId) body.preserveSessionId = true;
69419
69421
  const out = await api.post(
69420
69422
  `/api/v1/desktops/${encodeURIComponent(machineId)}/sessions`,
69421
69423
  body
69422
69424
  );
69423
69425
  console.log(`\u2713 session created: ${out.sessionId}`);
69426
+ if (opts.autoStart) console.log(` auto-start: ON`);
69427
+ if (opts.preserveSessionId) console.log(` preserve session id: ON`);
69424
69428
  });
69425
69429
  var desktopCmd = new Command("desktop").description("inspect + control desktop daemons (clawborrator-supervisor)").addCommand(desktopList).addCommand(desktopDelete).addCommand(desktopCreate);
69426
69430
  function fmtAgo4(iso) {
@@ -69431,9 +69435,60 @@ function fmtAgo4(iso) {
69431
69435
  return Math.floor(ms / 864e5) + "d ago";
69432
69436
  }
69433
69437
 
69438
+ // src/commands/auth-sessions.ts
69439
+ function shortUserAgent(ua) {
69440
+ if (!ua) return "(unknown)";
69441
+ if (ua.includes("clawborrator-cli")) return "clawborrator-cli";
69442
+ if (ua.includes("clawborrator-supervisor")) return "clawborrator-supervisor";
69443
+ const isMobile = /\b(iPhone|iPad|Android|Mobile)\b/.test(ua);
69444
+ let browser = "Browser";
69445
+ if (/\bCriOS\//.test(ua)) browser = "Chrome";
69446
+ else if (/\bEdg\//.test(ua)) browser = "Edge";
69447
+ else if (/\bFirefox\//.test(ua)) browser = "Firefox";
69448
+ else if (/\bChrome\//.test(ua) && !/\bEdg\//.test(ua)) browser = "Chrome";
69449
+ else if (/\bSafari\//.test(ua) && !/\bChrome\//.test(ua)) browser = "Safari";
69450
+ let os3 = "Unknown";
69451
+ if (/\bWindows NT\b/.test(ua)) os3 = "Windows";
69452
+ else if (/\bMacintosh\b/.test(ua)) os3 = "macOS";
69453
+ else if (/\bLinux\b/.test(ua) && !/\bAndroid\b/.test(ua)) os3 = "Linux";
69454
+ else if (/\bAndroid\b/.test(ua)) os3 = "Android";
69455
+ else if (/\biPhone\b|\biPad\b/.test(ua)) os3 = "iOS";
69456
+ return `${browser} on ${os3}${isMobile && !/\biPhone|\biPad|\bAndroid\b/.test(ua) ? " (mobile)" : ""}`;
69457
+ }
69458
+ function fmtAgo5(iso) {
69459
+ const ms = Date.now() - new Date(iso).getTime();
69460
+ if (ms < 6e4) return Math.max(1, Math.floor(ms / 1e3)) + "s ago";
69461
+ if (ms < 36e5) return Math.floor(ms / 6e4) + "m ago";
69462
+ if (ms < 864e5) return Math.floor(ms / 36e5) + "h ago";
69463
+ return Math.floor(ms / 864e5) + "d ago";
69464
+ }
69465
+ var authSessionsList = new Command("list").alias("ls").description("list this user's hub auth_sessions (cookie + CLI bearer). The row used to authenticate THIS request is flagged with \u2190current.").option("--all", "include revoked sessions").action(async (opts) => {
69466
+ const qs = opts.all ? "?includeRevoked=true" : "";
69467
+ const data = await api.get("/api/v1/auth-sessions" + qs);
69468
+ if (data.items.length === 0) {
69469
+ console.log("no auth_sessions");
69470
+ return;
69471
+ }
69472
+ for (const a of data.items) {
69473
+ const status = a.revokedAt ? "REVOKED" : "active";
69474
+ const cur = a.isCurrent ? " \u2190current" : "";
69475
+ const used = `last ${fmtAgo5(a.lastUsedAt)}`;
69476
+ const ua = shortUserAgent(a.userAgent).padEnd(30);
69477
+ const mach = a.machineId ? ` mach=${a.machineId.slice(0, 12)}\u2026` : "";
69478
+ console.log(`${a.id.slice(0, 12)}\u2026 ${a.source.padEnd(4)} ${ua} ${used.padEnd(14)} ${status}${cur}${mach}`);
69479
+ }
69480
+ });
69481
+ var authSessionsRevoke = new Command("revoke").description("revoke an auth_session by id or unique id-prefix (\u22654 hex chars). Cannot revoke the row used by this CLI session \u2014 use `claw logout` for that.").argument("<idPrefix>", "sha256 id or unique prefix from `claw auth-sessions list`").action(async (idPrefix) => {
69482
+ const out = await api.post(
69483
+ `/api/v1/auth-sessions/${encodeURIComponent(idPrefix)}/revoke`
69484
+ );
69485
+ console.log(`\u2713 revoked ${out.id.slice(0, 12)}\u2026`);
69486
+ });
69487
+ var authSessionsCmd = new Command("auth-sessions").alias("auth").description("list + revoke hub-issued auth_sessions (the cookie / CLI bearer credentials minted via OAuth). Different from `claw token` (channel + app tokens).").addCommand(authSessionsList).addCommand(authSessionsRevoke);
69488
+
69434
69489
  // src/index.ts
69435
69490
  var program2 = new Command();
69436
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.2.13");
69491
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.2.15");
69437
69492
  program2.addCommand(loginCmd);
69438
69493
  program2.addCommand(logoutCmd);
69439
69494
  program2.addCommand(whoamiCmd);
@@ -69446,6 +69501,7 @@ program2.addCommand(webhookCmd);
69446
69501
  program2.addCommand(agentsCmd);
69447
69502
  program2.addCommand(appsCmd);
69448
69503
  program2.addCommand(desktopCmd);
69504
+ program2.addCommand(authSessionsCmd);
69449
69505
  program2.parseAsync(process.argv).catch((err) => {
69450
69506
  console.error(err.message ?? err);
69451
69507
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "description": "claw — command-line client for clawborrator. Attach to remote Claude Code sessions, send prompts, resolve permission gates, route across sessions, manage public agents and webhooks. Auth via GitHub OAuth + PKCE.",
6
6
  "license": "MIT",