clawborrator-cli 0.0.22 → 0.0.23

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.
@@ -6894,15 +6894,19 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
6894
6894
  slug = needle;
6895
6895
  }
6896
6896
  const data = await api.get("/api/v1/sessions");
6897
- const match = data.items.find(
6898
- (s) => s.routingName === slug && (ownerLogin === null || s.startedByLogin === ownerLogin)
6899
- );
6900
- if (!match) {
6897
+ let candidates = data.items.filter((s) => s.routingName === slug);
6898
+ if (ownerLogin !== null) {
6899
+ candidates = candidates.filter((s) => s.startedByLogin === ownerLogin);
6900
+ } else {
6901
+ const mine = candidates.filter((s) => s.role === "owner");
6902
+ if (mine.length > 0) candidates = mine;
6903
+ }
6904
+ if (candidates.length === 0) {
6901
6905
  const label = ownerLogin ? `@${ownerLogin}/${slug.slice(1)}` : slug;
6902
6906
  console.error(`error: no session with routing name ${label} (run \`claw session list\` to see what's available)`);
6903
6907
  process.exit(2);
6904
6908
  }
6905
- sessionId = match.id;
6909
+ sessionId = candidates[0].id;
6906
6910
  }
6907
6911
  const wsUrl = cfg.hubUrl.replace(/^http/i, "ws") + "/cli";
6908
6912
  const ws = new wrapper_default(wsUrl, {
@@ -7016,13 +7020,18 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
7016
7020
  }
7017
7021
  try {
7018
7022
  const data = await api.get("/api/v1/sessions");
7019
- const match = data.items.find(
7020
- (s) => s.routingName === slug && (ownerLogin === null || s.startedByLogin === ownerLogin)
7021
- );
7022
- if (!match) {
7023
+ let candidates = data.items.filter((s) => s.routingName === slug);
7024
+ if (ownerLogin !== null) {
7025
+ candidates = candidates.filter((s) => s.startedByLogin === ownerLogin);
7026
+ } else {
7027
+ const mine = candidates.filter((s) => s.role === "owner");
7028
+ if (mine.length > 0) candidates = mine;
7029
+ }
7030
+ if (candidates.length === 0) {
7023
7031
  console.error(`${RED}error: no session ${targetRef} (try \`claw session list\` in another terminal)${RESET}`);
7024
7032
  return;
7025
7033
  }
7034
+ const match = candidates[0];
7026
7035
  const out2 = {
7027
7036
  type: "prompt",
7028
7037
  sessionId: match.id,
@@ -7235,17 +7244,21 @@ async function resolveSessionId(idOrName) {
7235
7244
  slug = needle;
7236
7245
  }
7237
7246
  const data = await api.get("/api/v1/sessions");
7238
- const match = data.items.find(
7239
- (s) => s.routingName === slug && (ownerLogin === null || s.startedByLogin === ownerLogin)
7240
- );
7241
- if (!match) {
7247
+ let candidates = data.items.filter((s) => s.routingName === slug);
7248
+ if (ownerLogin !== null) {
7249
+ candidates = candidates.filter((s) => s.startedByLogin === ownerLogin);
7250
+ } else {
7251
+ const mine = candidates.filter((s) => s.role === "owner");
7252
+ if (mine.length > 0) candidates = mine;
7253
+ }
7254
+ if (candidates.length === 0) {
7242
7255
  const err = new Error(
7243
7256
  ownerLogin ? `no session @${ownerLogin}/${slug.slice(1)} (run \`claw session list\`)` : `no session with routing name ${slug} (run \`claw session list\`)`
7244
7257
  );
7245
7258
  err.code = "CLW_NO_ROUTING_MATCH";
7246
7259
  throw err;
7247
7260
  }
7248
- return match.id;
7261
+ return candidates[0].id;
7249
7262
  }
7250
7263
  var sessionList = new Command("list").alias("ls").description("list sessions you can see").option("--connected", "only sessions whose channel WS is currently open").option("--all", "include archived sessions").action(async (opts) => {
7251
7264
  const qs = new URLSearchParams();
@@ -7564,7 +7577,7 @@ function fmtAgo2(iso) {
7564
7577
  }
7565
7578
 
7566
7579
  // src/commands/peers.ts
7567
- var peersCmd = new Command("peers").description("list your sessions reachable for cross-session routing").action(async () => {
7580
+ var peersCmd = new Command("peers").description("list your sessions reachable for cross-session routing \u2014 own + shared").action(async () => {
7568
7581
  const data = await api.get("/api/v1/peers");
7569
7582
  if (data.peers.length === 0) {
7570
7583
  console.log("no peers (no sessions registered yet)");
@@ -7573,7 +7586,9 @@ var peersCmd = new Command("peers").description("list your sessions reachable fo
7573
7586
  for (const p of data.peers) {
7574
7587
  const dot = p.online ? "\u25CF" : "\u25CB";
7575
7588
  const where = p.cwd ? ` ${p.cwd}` : "";
7576
- console.log(`${dot} ${p.routingName.padEnd(20)} ${p.online ? "online" : "offline"}${where}`);
7589
+ const qualifiedName = `@${p.ownerLogin}/${p.routingName.replace(/^@/, "")}`;
7590
+ const tag = p.mine ? "" : " (shared)";
7591
+ console.log(`${dot} ${qualifiedName.padEnd(28)} ${p.online ? "online " : "offline"}${tag}${where}`);
7577
7592
  }
7578
7593
  });
7579
7594
  var routeCmd = new Command("route").description("send a one-shot prompt to a peer session; ask mode (default) blocks for the reply, tell mode is fire-and-forget").argument("<peer>", "routingName (e.g. @foo, foo, @owner/foo)").argument("<prompt>", "text to send (quote it to keep spaces)").option("--mode <mode>", "ask | tell", "ask").action(async (peer, prompt, opts) => {
@@ -7662,7 +7677,7 @@ var webhookCmd = new Command("webhook").description("manage webhook subscription
7662
7677
 
7663
7678
  // src/index.ts
7664
7679
  var program2 = new Command();
7665
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.22");
7680
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.23");
7666
7681
  program2.addCommand(loginCmd);
7667
7682
  program2.addCommand(logoutCmd);
7668
7683
  program2.addCommand(whoamiCmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "description": "claw — command-line client for clawborrator hub_v1. Manages PATs, channel tokens, sessions, cross-session routing, and webhooks; ships an inline TUI for live multi-operator session attach.",
6
6
  "license": "MIT",