clawborrator-cli 0.0.36 → 0.0.38

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.
@@ -67636,6 +67636,23 @@ function stopWorking() {
67636
67636
  }
67637
67637
  refreshPrompt();
67638
67638
  }
67639
+ var routeWatchdog = null;
67640
+ var ROUTE_WATCHDOG_MS = 6e4;
67641
+ function armRouteWatchdog() {
67642
+ if (routeWatchdog) clearTimeout(routeWatchdog);
67643
+ routeWatchdog = setTimeout(() => {
67644
+ routeWatchdog = null;
67645
+ say(`${DIM2}[${ts()}]${RESET2} ${RED}\u26A0 no peer reply within 60s${RESET2} ${DIM2}\u2014 peer's Claude may have denied the reply tool${RESET2}`);
67646
+ stopWorking();
67647
+ }, ROUTE_WATCHDOG_MS);
67648
+ routeWatchdog.unref();
67649
+ }
67650
+ function disarmRouteWatchdog() {
67651
+ if (routeWatchdog) {
67652
+ clearTimeout(routeWatchdog);
67653
+ routeWatchdog = null;
67654
+ }
67655
+ }
67639
67656
  function say(line) {
67640
67657
  if (!process.stdout.isTTY || !rlRef) {
67641
67658
  console.log(line);
@@ -67748,7 +67765,12 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
67748
67765
  console.log(`${DIM2}\u2500\u2500\u2500 history (${tl.items.length} item${tl.items.length === 1 ? "" : "s"}) \u2500\u2500\u2500${RESET2}`);
67749
67766
  for (const item of tl.items) {
67750
67767
  if (item.kind === "event") {
67751
- renderEvent(item.event, myLogin);
67768
+ renderEvent(
67769
+ item.event,
67770
+ myLogin,
67771
+ /* fromBacklog */
67772
+ true
67773
+ );
67752
67774
  } else {
67753
67775
  console.log(`${DIM2}[${shortTs(item.ts)}]${RESET2} ${GREEN}@${item.authorLogin}${RESET2} ${item.text}`);
67754
67776
  }
@@ -67922,6 +67944,7 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
67922
67944
  ws.send(JSON.stringify(out2));
67923
67945
  say(`${DIM2}[${ts()}]${RESET2} ${AMBER}\u2192 prompt \u2192 ${peerSessionId.slice(0, 8)}\u2026${RESET2} ${promptText}`);
67924
67946
  startWorking();
67947
+ armRouteWatchdog();
67925
67948
  return;
67926
67949
  }
67927
67950
  (async () => {
@@ -67968,6 +67991,7 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
67968
67991
  ws.send(JSON.stringify(out2));
67969
67992
  say(`${DIM2}[${ts()}]${RESET2} ${AMBER}\u2192 prompt \u2192 ${targetRef}${RESET2} ${promptText}`);
67970
67993
  startWorking();
67994
+ armRouteWatchdog();
67971
67995
  } catch (e) {
67972
67996
  sayErr(`${RED}error: ${e?.message ?? String(e)}${RESET2}`);
67973
67997
  }
@@ -68060,12 +68084,12 @@ function maybeDebugDump(p) {
68060
68084
  say(` ${DIM2}${line}${RESET2}`);
68061
68085
  }
68062
68086
  }
68063
- function renderEvent(ev, myLogin) {
68087
+ function renderEvent(ev, myLogin, fromBacklog = false) {
68064
68088
  const ts2 = shortTs(ev.ts);
68065
68089
  const p = ev.payload || {};
68066
- if (ev.kind === "chat" && ev.type === "prompt") {
68090
+ if (!fromBacklog && ev.kind === "chat" && ev.type === "prompt") {
68067
68091
  const src = String(p.source ?? "");
68068
- if (src === "operator" && myLogin && p.authorLogin === myLogin) return;
68092
+ if ((src === "operator" || src === "operator-route") && myLogin && p.authorLogin === myLogin) return;
68069
68093
  }
68070
68094
  try {
68071
68095
  renderEventBody(ev, ts2, p, myLogin);
@@ -68081,6 +68105,12 @@ function renderEventBody(ev, ts2, p, myLogin) {
68081
68105
  if (ev.type === "prompt") {
68082
68106
  const text = String(p.text ?? p.prompt ?? "").trim() || JSON.stringify(p).slice(0, 200);
68083
68107
  const source = String(p.source ?? "cli");
68108
+ if (source === "operator-route") {
68109
+ const peer = String(p.peerLogin ?? p.peerSessionId ?? "?");
68110
+ const peerShort = peer.length > 36 ? peer.slice(0, 8) + "\u2026" : peer;
68111
+ say(`${DIM2}[${ts2}]${RESET2} ${AMBER}\u2192 prompt \u2192 ${peerShort}${RESET2} ${text}`);
68112
+ return;
68113
+ }
68084
68114
  const label = source === "operator" ? `${BOLD2}@${String(p.authorLogin ?? "remote")} \u203A${RESET2}` : `${BOLD2}(cli) \u203A${RESET2}`;
68085
68115
  say(`${DIM2}[${ts2}]${RESET2} ${label} ${text}`);
68086
68116
  return;
@@ -68101,6 +68131,15 @@ function renderEventBody(ev, ts2, p, myLogin) {
68101
68131
  const text = String(p.text ?? "").trim();
68102
68132
  const tag2 = p.source === "peer-reply" && p.peerLogin ? `${AMBER}${String(p.peerLogin)} answered${RESET2}` : p.chatId ? `${AMBER}claude${RESET2} ${DIM2}(reply to ${String(p.chatId).slice(0, 8)})${RESET2}` : `${AMBER}claude${RESET2}`;
68103
68133
  emitChatLine(`${DIM2}[${ts2}]${RESET2} ${tag2}`, renderMarkdown(text));
68134
+ if (p.source === "peer-reply") disarmRouteWatchdog();
68135
+ return;
68136
+ }
68137
+ if (ev.type === "peer-timeout") {
68138
+ const peer = String(p.peerLogin ?? p.peerSessionId ?? "?");
68139
+ const peerShort = peer.length > 36 ? peer.slice(0, 8) + "\u2026" : peer;
68140
+ say(`${DIM2}[${ts2}]${RESET2} ${RED}\u26A0 ${peerShort} did not reply${RESET2} ${DIM2}\u2014 peer's Claude may have denied the reply tool${RESET2}`);
68141
+ disarmRouteWatchdog();
68142
+ stopWorking();
68104
68143
  return;
68105
68144
  }
68106
68145
  say(`${DIM2}[${ts2}]${RESET2} ${AMBER}[chat:${ev.type}]${RESET2} ${previewPayload(p)}`);
@@ -68664,7 +68703,7 @@ var webhookCmd = new Command("webhook").description("manage webhook subscription
68664
68703
 
68665
68704
  // src/index.ts
68666
68705
  var program2 = new Command();
68667
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.36");
68706
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.38");
68668
68707
  program2.addCommand(loginCmd);
68669
68708
  program2.addCommand(logoutCmd);
68670
68709
  program2.addCommand(whoamiCmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
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",