very-happy-cli 0.2.133 → 0.2.134

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.
Files changed (45) hide show
  1. package/dist/{AcpBackend-BQm7dNza.mjs → AcpBackend-B8KEjDwF.mjs} +3 -3
  2. package/dist/{AcpBackend-DgG8o4jd.cjs → AcpBackend-CeNp7tgD.cjs} +3 -3
  3. package/dist/{AcpSessionManager-DDFEmhQp.cjs → AcpSessionManager-Bu1d05bx.cjs} +1 -1
  4. package/dist/{AcpSessionManager-C7unPEZO.mjs → AcpSessionManager-KlDZbEmZ.mjs} +1 -1
  5. package/dist/{agentGuidance-BaplwDcV.mjs → agentGuidance-CPG5Cr5T.mjs} +1 -1
  6. package/dist/{agentGuidance-BItqIZTf.cjs → agentGuidance-Cg8Lha39.cjs} +1 -1
  7. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  8. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  9. package/dist/{config-uLywzv5t.cjs → config-C3e90AIH.cjs} +4 -4
  10. package/dist/{config-BZ8xEnOv.mjs → config-C4gWfnJX.mjs} +4 -4
  11. package/dist/{index-6Xm0CgN_.cjs → index-B1plzL9M.cjs} +37 -25
  12. package/dist/{index-ClCeQ1FW.mjs → index-B6UvB88K.mjs} +16 -10
  13. package/dist/{index-EsR8ayIg.mjs → index-BqUOj1zK.mjs} +33 -21
  14. package/dist/{index-D8i2EViA.mjs → index-CEDPokKf.mjs} +4 -4
  15. package/dist/{index-CdH3ecC5.cjs → index-CX-zp3FH.cjs} +4 -4
  16. package/dist/{index-Daga0ztv.cjs → index-jqG8CV0c.cjs} +15 -9
  17. package/dist/index.cjs +4 -4
  18. package/dist/index.mjs +4 -4
  19. package/dist/{installTerminalHooks-NH4kiB2E.mjs → installTerminalHooks-BT4Dq28Y.mjs} +4 -4
  20. package/dist/{installTerminalHooks-CKG0MYVK.cjs → installTerminalHooks-DPmEaHg2.cjs} +4 -4
  21. package/dist/lib.cjs +2 -2
  22. package/dist/lib.d.cts +6 -60
  23. package/dist/lib.d.mts +6 -60
  24. package/dist/lib.mjs +2 -2
  25. package/dist/{limits-Du7S6jqA.mjs → limits-BGeIBBE3.mjs} +7 -7
  26. package/dist/{limits-XRNzIlVm.cjs → limits-D6kiAfXJ.cjs} +7 -7
  27. package/dist/{mcp-D8zhjyZa.mjs → mcp-BGu_dUaJ.mjs} +4 -4
  28. package/dist/{mcp-CAMCuudA.cjs → mcp-DGZmUpuZ.cjs} +4 -4
  29. package/dist/{runGemini-BIVHp0ST.cjs → runGemini-BPPnulIk.cjs} +6 -6
  30. package/dist/{runGemini-Db4rX54F.mjs → runGemini-DGTNwiLo.mjs} +6 -6
  31. package/dist/{runOpenClaw-a0f2pZZp.cjs → runOpenClaw-BB3Ivt1S.cjs} +5 -5
  32. package/dist/{runOpenClaw-D2MceXPO.mjs → runOpenClaw-CxgTFOSM.mjs} +5 -5
  33. package/dist/{send-DKbumEcg.cjs → send-Bo6iKuXr.cjs} +4 -4
  34. package/dist/{send-1Wjb0lIh.mjs → send-DHShoBeq.mjs} +4 -4
  35. package/dist/{sessions-DXCCRDb5.mjs → sessions-CJuwvEr0.mjs} +4 -4
  36. package/dist/{sessions-SIFOOlGp.cjs → sessions-DyC5Attg.cjs} +4 -4
  37. package/dist/{spawn-Bj3W6HR4.mjs → spawn-QtKlr8Ig.mjs} +4 -4
  38. package/dist/{spawn-C-XpSPLX.cjs → spawn-gha6nGx-.cjs} +4 -4
  39. package/dist/{teams-CqhFQLVC.mjs → teams-BF-GxUZc.mjs} +4 -4
  40. package/dist/{teams-ChFzXAqr.cjs → teams-BbzWNV9e.cjs} +4 -4
  41. package/dist/{todo-o0clp-_I.cjs → todo-BaNaNZ8c.cjs} +3 -3
  42. package/dist/{todo-B0gbQHH8.mjs → todo-CkJ5UjWs.mjs} +3 -3
  43. package/dist/{types-6DrEgHVx.mjs → types-Cq-tvv9t.mjs} +84 -27
  44. package/dist/{types-CcjVmS2i.cjs → types-Dabm17Ln.cjs} +85 -28
  45. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var axios = require('axios');
4
- var persistence = require('./limits-XRNzIlVm.cjs');
4
+ var persistence = require('./limits-D6kiAfXJ.cjs');
5
5
  var node_events = require('node:events');
6
6
  var socket_ioClient = require('socket.io-client');
7
7
  var z = require('zod');
@@ -879,6 +879,8 @@ const WebTerminalListItemSchema = z.z.object({
879
879
  createdAt: z.z.number().optional(),
880
880
  activityAt: z.z.number().optional(),
881
881
  agentState: z.z.enum(["working", "needs_input", "idle", "shell"]).optional(),
882
+ agentKind: z.z.string().optional(),
883
+ agentObservedAt: z.z.number().optional(),
882
884
  /** B-105: mirror session of the claude running inside the terminal. */
883
885
  mirrorSessionId: z.z.string().optional(),
884
886
  /** B-150: auto-restored after a restart (ms epoch) — the directory and the
@@ -1345,7 +1347,7 @@ class RpcHandlerManager {
1345
1347
  }
1346
1348
  }
1347
1349
 
1348
- const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-CcjVmS2i.cjs', document.baseURI).href))));
1350
+ const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-Dabm17Ln.cjs', document.baseURI).href))));
1349
1351
  function projectPath() {
1350
1352
  const path$1 = path.resolve(__dirname$1, "..");
1351
1353
  return path$1;
@@ -4359,6 +4361,58 @@ function registerTodoHandlers(manager) {
4359
4361
  });
4360
4362
  }
4361
4363
 
4364
+ function codingAgentFromProcessTree(panePid, snapshot) {
4365
+ const rows = snapshot.split("\n").flatMap((line) => {
4366
+ const m = line.trim().match(/^(\d+)\s+(\d+)\s+(.+)$/);
4367
+ return m ? [{ pid: Number(m[1]), parent: Number(m[2]), command: m[3] }] : [];
4368
+ });
4369
+ const visit = (pid, seen = /* @__PURE__ */ new Set()) => {
4370
+ if (seen.has(pid)) return void 0;
4371
+ seen.add(pid);
4372
+ const row = rows.find((r) => r.pid === pid);
4373
+ if (!row) return void 0;
4374
+ for (const child of rows.filter((r) => r.parent === pid)) {
4375
+ const kind = visit(child.pid, seen);
4376
+ if (kind) return kind;
4377
+ }
4378
+ const words = row.command.split(/\s+/);
4379
+ const executable = words[0].split("/").pop();
4380
+ const candidate = executable === "node" ? words[1]?.split("/").pop() : executable;
4381
+ if (candidate === "pi" || candidate === "pi-coding-agent") return "pi";
4382
+ if (candidate === "codex") return "codex";
4383
+ if (candidate === "claude" || /^\d+\.\d+\.\d+$/.test(candidate ?? "")) return "claude";
4384
+ return void 0;
4385
+ };
4386
+ return visit(panePid);
4387
+ }
4388
+
4389
+ const shells = /* @__PURE__ */ new Set(["zsh", "bash", "fish", "sh", "dash", "ksh", "tcsh", "csh"]);
4390
+ function classifyAgentPane(command, tail) {
4391
+ const cmd = command.trim().replace(/^-/, "").split(/[\\/]/).pop().toLowerCase();
4392
+ const lines = tail.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/\r/g, "").trimEnd().split("\n");
4393
+ const screen = lines.join("\n");
4394
+ const footer = lines.slice(-20).join("\n");
4395
+ if (shells.has(cmd)) return { agentState: "shell" };
4396
+ if (!["node", "claude", "codex", "pi"].includes(cmd) && !/^\d+\.\d+\.\d+$/.test(cmd)) return {};
4397
+ const agentKind = cmd === "pi" ? "pi" : cmd === "codex" ? "codex" : cmd === "claude" || /^\d+\.\d+\.\d+$/.test(cmd) ? "claude" : /OpenAI Codex/.test(screen) ? "codex" : /(?:^|\n)\s*pi v\d|Pi can explain its own features/.test(screen) ? "pi" : /Claude Code|tell Claude what to do|bypass permissions on|⏵⏵|[·✻✽✶✳] [^\n]+… \(esc to interrupt\)/.test(footer) ? "claude" : void 0;
4398
+ if (!agentKind) return {};
4399
+ const result = (agentState) => ({ agentKind, agentState });
4400
+ if (agentKind === "pi") {
4401
+ if (/^\s*→ \S/m.test(screen) && /(?:↑↓ navigate.*(?:enter|return) select.*esc cancel|Enter to select.*Esc to cancel)/i.test(footer)) return result("needs_input");
4402
+ if (/^\s*[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◐◓◑◒]\s+(?:Working|Thinking|Retrying|Compacting context|Auto-compacting|Summarizing branch).*$/m.test(footer)) return result("working");
4403
+ if (/^\s*[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◐◓◑◒]\s/m.test(footer)) return result();
4404
+ const editorRules = footer.match(/^\s*─{8,}\s*$/gm) ?? [];
4405
+ if (editorRules.length >= 2 && /(?:\d+(?:\.\d+)?|\?)%\/\d+(?:\.\d+)?[km]?.* • (?:thinking off|minimal|low|medium|high|xhigh)/i.test(footer)) return result("idle");
4406
+ return result();
4407
+ }
4408
+ const choice = /^[\s│]*[❯›>]\s*\d+\.\s/m.test(footer);
4409
+ if (choice && /Do you want|Would you like|approve|Yes,|Yes\b|Enter to select.*navigate.*Esc to cancel/i.test(footer)) return result("needs_input");
4410
+ if (/esc to interrupt/i.test(footer)) return result("working");
4411
+ if (agentKind === "codex" && /^\s*gpt-[\w.-]+ (?:minimal|low|medium|high|xhigh|fast)[^\n]* · (?:~|\/|[A-Z]:[\\/])/m.test(footer) && /^› /m.test(footer)) return result("idle");
4412
+ if (/\? for shortcuts|bypass permissions on|⏵⏵|\d+% context left/.test(footer)) return result("idle");
4413
+ return result();
4414
+ }
4415
+
4362
4416
  function sanitizeGeometry(cols, rows) {
4363
4417
  const ok = (v) => typeof v === "number" && Number.isInteger(v) && v >= 2 && v <= 1e4;
4364
4418
  return ok(cols) && ok(rows) ? { cols, rows } : void 0;
@@ -9568,10 +9622,12 @@ class TerminalNotifyTracker {
9568
9622
  * Feed one observation for a terminal. Returns the notification event this
9569
9623
  * observation triggers, or null. Call once per terminal per tick.
9570
9624
  */
9571
- observe(terminalId, state, now) {
9625
+ observe(terminalId, state, now, agentKind) {
9572
9626
  let t = this.tracks.get(terminalId);
9573
- if (!t) {
9627
+ if (!t || t.agentKind !== agentKind || now - t.lastObservedAt > 45e3) {
9574
9628
  t = {
9629
+ agentKind,
9630
+ lastObservedAt: now,
9575
9631
  armed: state === "working",
9576
9632
  confirmed: state,
9577
9633
  candidate: state,
@@ -9582,6 +9638,7 @@ class TerminalNotifyTracker {
9582
9638
  this.tracks.set(terminalId, t);
9583
9639
  return null;
9584
9640
  }
9641
+ t.lastObservedAt = now;
9585
9642
  if (state === "working") t.armed = true;
9586
9643
  if (state === t.confirmed) {
9587
9644
  t.candidate = state;
@@ -9914,6 +9971,8 @@ function terminalListSignature(items) {
9914
9971
  t.createdAt ?? 0,
9915
9972
  Math.floor((t.activityAt ?? 0) / ACTIVITY_SIGNATURE_BUCKET_MS),
9916
9973
  t.agentState ?? "",
9974
+ t.agentKind ?? "",
9975
+ Math.floor((t.agentObservedAt ?? 0) / 1e4),
9917
9976
  // B-105: a mirror binding appearing/disappearing MUST push the
9918
9977
  // list, or the web never learns the toggle became available.
9919
9978
  t.mirrorSessionId ?? "",
@@ -9962,7 +10021,7 @@ const LIST_SESSIONS_FORMAT = [
9962
10021
  // command only separates shell/idle). MUST stay before pane_title: that
9963
10022
  // field is deliberately last so a pathological 0x1f inside a title can only
9964
10023
  // garble the title, never shift the fields.
9965
- "#{pane_current_command}",
10024
+ "#{pane_current_command} #{pane_pid}",
9966
10025
  "#{pane_title}"
9967
10026
  ].join(LIST_FIELD_SEP);
9968
10027
  function parseSessionListLine(line) {
@@ -9980,7 +10039,8 @@ function parseSessionListLine(line) {
9980
10039
  vhTitle: vhTitle.trim() || void 0,
9981
10040
  manual: manual.trim().length > 0,
9982
10041
  tags: parseTerminalTags(vhTags),
9983
- paneCurrentCommand: paneCommand.trim() || void 0,
10042
+ paneCurrentCommand: paneCommand.trim().replace(/ \d+$/, "") || void 0,
10043
+ .../ (\d+)$/.test(paneCommand) ? { panePid: Number(paneCommand.match(/ (\d+)$/)[1]) } : {},
9984
10044
  // Verbatim (no trim): tmux allows edge spaces in a session name and the
9985
10045
  // restore lookup / attach echo compare it exactly.
9986
10046
  attachTmux: isSafeTmuxSessionName(vhAttach) ? vhAttach : void 0,
@@ -10022,22 +10082,6 @@ function parseTerminalTags(raw) {
10022
10082
  return [];
10023
10083
  }
10024
10084
  }
10025
- function classifyPane(currentCommand, tail) {
10026
- const cmd = (currentCommand || "").trim().replace(/^-/, "").toLowerCase();
10027
- const isShell = SHELL_COMMANDS.has(cmd);
10028
- const lines = tail.replace(/\r/g, "").split("\n").map((l) => l.trimEnd());
10029
- while (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
10030
- const text = lines.join("\n");
10031
- const last15 = lines.slice(-15).join("\n");
10032
- const hasDialog = last15.includes("Do you want") || last15.includes("Would you like to proceed") || /^[\s│]*[❯>]\s*1\.\s/m.test(last15) || /\(y\/n\)/i.test(last15);
10033
- if (hasDialog) return "needs_input";
10034
- if (text.includes("esc to interrupt")) return "working";
10035
- const looksLikeClaude = looksLikeClaudeCommand(cmd);
10036
- const hasIdleFooter = text.includes("? for shortcuts") || text.includes("bypass permissions on") || text.includes("\u23F5\u23F5");
10037
- if (looksLikeClaude || hasIdleFooter) return "idle";
10038
- if (isShell) return "shell";
10039
- return void 0;
10040
- }
10041
10085
  function looksLikeClaudeCommand(currentCommand) {
10042
10086
  const cmd = (currentCommand || "").trim().replace(/^-/, "").toLowerCase();
10043
10087
  return cmd === "claude" || cmd === "node" || /^\d+\.\d+(\.\d+)?$/.test(cmd);
@@ -11048,7 +11092,7 @@ class WebTerminalManager {
11048
11092
  const now = Date.now();
11049
11093
  this.notifyTracker.prune(list.map((t) => t.id));
11050
11094
  for (const item of list) {
11051
- const event = this.notifyTracker.observe(item.id, item.agentState, now);
11095
+ const event = this.notifyTracker.observe(item.id, item.agentState, now, item.agentKind);
11052
11096
  if (!event) continue;
11053
11097
  try {
11054
11098
  this.onNotify({ terminalId: item.id, title: item.title || "Terminal", event });
@@ -11780,6 +11824,7 @@ class WebTerminalManager {
11780
11824
  if (r.status !== 0 || !r.stdout) return [];
11781
11825
  const hostname = os$1.hostname();
11782
11826
  const out = [];
11827
+ let processSnapshot;
11783
11828
  for (const line of r.stdout.split("\n")) {
11784
11829
  const s = parseSessionListLine(line);
11785
11830
  if (!s || !s.name.startsWith("vh-")) continue;
@@ -11797,7 +11842,15 @@ class WebTerminalManager {
11797
11842
  } catch {
11798
11843
  }
11799
11844
  }
11800
- const probe = this.probeAgentState(s.name, s.paneCurrentCommand);
11845
+ let identity = s.paneCurrentCommand;
11846
+ if (identity === "node" && s.panePid) {
11847
+ if (processSnapshot === void 0) {
11848
+ const ps = node_child_process.spawnSync("ps", ["-axo", "pid=,ppid=,args="], { encoding: "utf8", timeout: TMUX_PROBE_TIMEOUT_MS });
11849
+ processSnapshot = ps.status === 0 ? ps.stdout : "";
11850
+ }
11851
+ identity = codingAgentFromProcessTree(s.panePid, processSnapshot) ?? identity;
11852
+ }
11853
+ const probe = this.probeAgentState(s.name, identity);
11801
11854
  out.push({
11802
11855
  id,
11803
11856
  title,
@@ -11809,6 +11862,8 @@ class WebTerminalManager {
11809
11862
  // simply omit it and web clients fall back to createdAt.
11810
11863
  activityAt: s.activity,
11811
11864
  agentState: probe.agentState,
11865
+ agentKind: probe.agentKind,
11866
+ agentObservedAt: probe.agentObservedAt,
11812
11867
  // Daemon-internal (not pushed to web / not in the signature):
11813
11868
  // the mirror reconciler's stricter "claude is really here" gate.
11814
11869
  claudeConfident: probe.claudeConfident,
@@ -11835,16 +11890,17 @@ class WebTerminalManager {
11835
11890
  if (live) {
11836
11891
  try {
11837
11892
  const { command, tail } = live.agentProbeInput();
11838
- return { agentState: classifyPane(command || polledCommand || "", tail), claudeConfident: isClaudeConfident(tail) };
11893
+ const observation = classifyAgentPane(command === "node" ? polledCommand || command : command || polledCommand || "", tail);
11894
+ return { ...observation, agentObservedAt: Date.now(), claudeConfident: observation.agentKind === "claude" && isClaudeConfident(tail) };
11839
11895
  } catch {
11840
11896
  }
11841
11897
  }
11842
- return this.probeAgentStateViaTmux(sessionName);
11898
+ return this.probeAgentStateViaTmux(sessionName, polledCommand);
11843
11899
  }
11844
11900
  /** Fallback probe for sessions with no live headless: 2 short tmux calls
11845
11901
  * (foreground command + pane tail) fed into classifyPane. Any failure or
11846
11902
  * timeout → undefined (the field is omitted), never an error. */
11847
- probeAgentStateViaTmux(sessionName) {
11903
+ probeAgentStateViaTmux(sessionName, polledCommand) {
11848
11904
  try {
11849
11905
  const cmd = node_child_process.spawnSync(
11850
11906
  "tmux",
@@ -11858,7 +11914,8 @@ class WebTerminalManager {
11858
11914
  { encoding: "utf8", timeout: TMUX_PROBE_TIMEOUT_MS, env: ptyEnv() }
11859
11915
  );
11860
11916
  if (cap.status !== 0 || typeof cap.stdout !== "string") return { agentState: void 0, claudeConfident: false };
11861
- return { agentState: classifyPane(cmd.stdout.trim(), cap.stdout), claudeConfident: isClaudeConfident(cap.stdout) };
11917
+ const observation = classifyAgentPane(cmd.stdout.trim() === "node" ? polledCommand || "node" : cmd.stdout.trim(), cap.stdout);
11918
+ return { ...observation, agentObservedAt: Date.now(), claudeConfident: observation.agentKind === "claude" && isClaudeConfident(cap.stdout) };
11862
11919
  } catch {
11863
11920
  return { agentState: void 0, claudeConfident: false };
11864
11921
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "very-happy-cli",
3
- "version": "0.2.133",
3
+ "version": "0.2.134",
4
4
  "description": "Remote multi-agent workspace CLI with deep Claude integration, native terminal streaming, and self-hosting.",
5
5
  "author": "Kirill Dubovitskiy",
6
6
  "contributors": [
@@ -113,12 +113,12 @@
113
113
  "zod": "^4.0.0"
114
114
  },
115
115
  "optionalDependencies": {
116
- "very-happy-tools-arm64-darwin": "0.2.133",
117
- "very-happy-tools-x64-darwin": "0.2.133",
118
- "very-happy-tools-arm64-linux": "0.2.133",
119
- "very-happy-tools-x64-linux": "0.2.133",
120
- "very-happy-tools-arm64-win32": "0.2.133",
121
- "very-happy-tools-x64-win32": "0.2.133"
116
+ "very-happy-tools-arm64-darwin": "0.2.134",
117
+ "very-happy-tools-x64-darwin": "0.2.134",
118
+ "very-happy-tools-arm64-linux": "0.2.134",
119
+ "very-happy-tools-x64-linux": "0.2.134",
120
+ "very-happy-tools-arm64-win32": "0.2.134",
121
+ "very-happy-tools-x64-win32": "0.2.134"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@slopus/happy-wire": "workspace:*",