clawborrator-cli 0.0.24 → 0.0.26

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.
@@ -6920,7 +6920,7 @@ var GREEN = "\x1B[32m";
6920
6920
  function ts() {
6921
6921
  return (/* @__PURE__ */ new Date()).toLocaleTimeString();
6922
6922
  }
6923
- var sessionAttach = new Command("attach").description("open a TUI on a session \u2014 see the chat stream, post op-messages").argument("<ref>", "session UUID or @routingName (e.g. @driver)").action(async (ref) => {
6923
+ var sessionAttach = new Command("attach").description("open a TUI on a session \u2014 see the chat stream, post op-messages").argument("<ref>", "session UUID or @routingName (e.g. @driver)").option("--limit <n>", 'history items to load before the live stream begins. 0 = none. "all" = up to 5000. default 50.', "50").option("--no-op-messages", "exclude op-messages from the history backlog (live ones still arrive once attached)").action(async (ref, opts) => {
6924
6924
  const cfg = loadConfig();
6925
6925
  if (!cfg.pat) {
6926
6926
  console.error("error: not logged in. run `claw login`.");
@@ -6963,7 +6963,9 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
6963
6963
  sessionId = picked.id;
6964
6964
  } catch (e) {
6965
6965
  if (e instanceof AmbiguousError) {
6966
- console.error(`error: '${ref}' is ambiguous \u2014 multiple online sessions match. Re-run with a UUID or qualified form (e.g. @owner/slug). Candidates:`);
6966
+ const usedQualified = ref.includes("/");
6967
+ const advice = usedQualified ? `'${ref}' is ambiguous even within owner \u2014 multiple sessions share the same routing name. Re-run with a session UUID:` : `'${ref}' is ambiguous \u2014 re-run with the qualified @owner/slug form, or with a UUID if even that collides:`;
6968
+ console.error(`error: ${advice}`);
6967
6969
  for (const c of e.candidates) {
6968
6970
  console.error(` ${c.id} @${c.startedByLogin}/${(c.routingName ?? "").replace(/^@/, "")} ${c.cwd ?? ""}`);
6969
6971
  }
@@ -6973,6 +6975,27 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
6973
6975
  process.exit(2);
6974
6976
  }
6975
6977
  }
6978
+ const limitArg = String(opts.limit ?? "50").toLowerCase();
6979
+ const historyLimit = limitArg === "all" ? 5e3 : limitArg === "0" ? 0 : Math.max(0, parseInt(limitArg, 10) || 0);
6980
+ if (historyLimit > 0) {
6981
+ const kindsParam = opts.opMessages === false ? "&kinds=event" : "";
6982
+ try {
6983
+ const tl = await api.get(`/api/v1/sessions/${encodeURIComponent(sessionId)}/timeline?limit=${historyLimit}${kindsParam}`);
6984
+ if (tl.items.length > 0) {
6985
+ console.log(`${DIM2}\u2500\u2500\u2500 history (${tl.items.length} item${tl.items.length === 1 ? "" : "s"}) \u2500\u2500\u2500${RESET2}`);
6986
+ for (const item of tl.items) {
6987
+ if (item.kind === "event") {
6988
+ renderEvent(item.event, myLogin);
6989
+ } else {
6990
+ console.log(`${DIM2}[${shortTs(item.ts)}]${RESET2} ${GREEN}@${item.authorLogin}${RESET2} ${item.text}`);
6991
+ }
6992
+ }
6993
+ console.log(`${DIM2}\u2500\u2500\u2500 live \u2500\u2500\u2500${RESET2}`);
6994
+ }
6995
+ } catch (e) {
6996
+ console.error(`${DIM2}(history fetch failed: ${e?.message ?? String(e)} \u2014 continuing live)${RESET2}`);
6997
+ }
6998
+ }
6976
6999
  const wsUrl = cfg.hubUrl.replace(/^http/i, "ws") + "/cli";
6977
7000
  const ws = new wrapper_default(wsUrl, {
6978
7001
  headers: { Authorization: `Bearer ${cfg.pat}` }
@@ -7098,9 +7121,11 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
7098
7121
  }
7099
7122
  const liveMatches = candidates.filter((c) => c.connected);
7100
7123
  if (liveMatches.length > 1) {
7101
- console.error(`${RED}error: '${targetRef}' is ambiguous \u2014 multiple online matches. Use the qualified form:${RESET2}`);
7124
+ const usedQualified = targetRef.includes("/");
7125
+ const advice = usedQualified ? `'${targetRef}' is ambiguous even within owner \u2014 re-issue using a session UUID:` : `'${targetRef}' is ambiguous \u2014 use the qualified form @owner/slug, or a UUID if the qualified form still collides:`;
7126
+ console.error(`${RED}error: ${advice}${RESET2}`);
7102
7127
  for (const c of liveMatches) {
7103
- console.error(` ${DIM2}${c.id.slice(0, 8)}\u2026${RESET2} @${c.startedByLogin}/${(c.routingName ?? "").replace(/^@/, "")} ${DIM2}${c.cwd ?? ""}${RESET2}`);
7128
+ console.error(` ${c.id} @${c.startedByLogin}/${(c.routingName ?? "").replace(/^@/, "")} ${DIM2}${c.cwd ?? ""}${RESET2}`);
7104
7129
  }
7105
7130
  return;
7106
7131
  }
@@ -7336,9 +7361,10 @@ async function resolveSessionId(idOrName) {
7336
7361
  return picked.id;
7337
7362
  } catch (e) {
7338
7363
  if (e instanceof AmbiguousError) {
7364
+ const usedQualified = idOrName.includes("/");
7365
+ const advice = usedQualified ? `'${idOrName}' is ambiguous even within owner \u2014 multiple sessions share the same routing name (different cwds with matching basenames). Re-run with a UUID:` : `'${idOrName}' is ambiguous \u2014 re-run with the qualified @owner/slug form, or with a UUID if even that collides:`;
7339
7366
  const err = new Error(
7340
- `ambiguous reference '${idOrName}' \u2014 multiple online sessions match. Re-run with a UUID or qualified form. Candidates:
7341
- ` + e.candidates.map((c) => ` ${c.id} @${c.startedByLogin}/${(c.routingName ?? "").replace(/^@/, "")} ${c.cwd ?? ""}`).join("\n")
7367
+ advice + "\n" + e.candidates.map((c) => ` ${c.id} @${c.startedByLogin}/${(c.routingName ?? "").replace(/^@/, "")} ${c.cwd ?? ""}`).join("\n")
7342
7368
  );
7343
7369
  err.code = "CLW_AMBIGUOUS";
7344
7370
  throw err;
@@ -7763,7 +7789,7 @@ var webhookCmd = new Command("webhook").description("manage webhook subscription
7763
7789
 
7764
7790
  // src/index.ts
7765
7791
  var program2 = new Command();
7766
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.24");
7792
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.26");
7767
7793
  program2.addCommand(loginCmd);
7768
7794
  program2.addCommand(logoutCmd);
7769
7795
  program2.addCommand(whoamiCmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
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",