very-happy-cli 0.2.116 → 0.2.117

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 (37) hide show
  1. package/dist/{AcpBackend-CfKPvoTU.mjs → AcpBackend-C4RMHt0I.mjs} +1 -1
  2. package/dist/{AcpBackend-CauAQpC1.cjs → AcpBackend-CrbXvcgQ.cjs} +1 -1
  3. package/dist/{AcpSessionManager-CA6xeET_.cjs → AcpSessionManager-CjAVO4RX.cjs} +1 -1
  4. package/dist/{AcpSessionManager-BQ6pBRW4.mjs → AcpSessionManager-Cnc8Jatl.mjs} +1 -1
  5. package/dist/{config-BpR_CwZu.mjs → config-CnA3JIUn.mjs} +2 -2
  6. package/dist/{config-BoteFn-v.cjs → config-O9quMfxg.cjs} +2 -2
  7. package/dist/{index-D7azxfcs.mjs → index-B0o3H6_x.mjs} +2 -2
  8. package/dist/{index-Dq-eFp89.mjs → index-BYZKuQoy.mjs} +499 -42
  9. package/dist/{index-4jiUeiUz.cjs → index-DcESl4cI.cjs} +510 -44
  10. package/dist/{index-C45xN8s0.mjs → index-DiRN0Rv8.mjs} +78 -8
  11. package/dist/{index-lX1UliOs.cjs → index-DqmVH6R5.cjs} +2 -2
  12. package/dist/{index-DWmhmji9.cjs → index-W-O4xR_O.cjs} +77 -7
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.mjs +2 -2
  15. package/dist/{installTerminalHooks-k3TrBHD0.mjs → installTerminalHooks-DeYqyjCB.mjs} +2 -2
  16. package/dist/{installTerminalHooks-DnaFkrTF.cjs → installTerminalHooks-zfsWSotO.cjs} +2 -2
  17. package/dist/lib.cjs +1 -1
  18. package/dist/lib.d.cts +41 -1
  19. package/dist/lib.d.mts +41 -1
  20. package/dist/lib.mjs +1 -1
  21. package/dist/{mcp-DRePTOap.mjs → mcp-D_5aOK0I.mjs} +62 -17
  22. package/dist/{mcp-DSpEpM_2.cjs → mcp-nYqC4FYm.cjs} +62 -16
  23. package/dist/{runGemini-_9-a7duU.mjs → runGemini-CEURRmM4.mjs} +4 -4
  24. package/dist/{runGemini-IWHyBq0A.cjs → runGemini-DYf3ntib.cjs} +4 -4
  25. package/dist/{runOpenClaw-Boq6LQ9a.mjs → runOpenClaw-BozfKWng.mjs} +3 -3
  26. package/dist/{runOpenClaw-0myYIz1U.cjs → runOpenClaw-CNKjAw-H.cjs} +3 -3
  27. package/dist/{send-CwWvFfay.cjs → send-BZLhRZb-.cjs} +2 -2
  28. package/dist/{send-Cyo6mgMl.mjs → send-CYznZGrp.mjs} +2 -2
  29. package/dist/sessions-DYPB3Peg.mjs +317 -0
  30. package/dist/sessions-YWt9YEN8.cjs +322 -0
  31. package/dist/{spawn-CU0DMauA.mjs → spawn-CsrHZd3y.mjs} +3 -4
  32. package/dist/{spawn-DQ6FTUK9.cjs → spawn-tSvo3stN.cjs} +6 -7
  33. package/dist/{types-C5kEpkcZ.cjs → types-DD3AK6Nb.cjs} +47 -19
  34. package/dist/{types-Ds0SiQ1D.mjs → types-jSfU_0o1.mjs} +45 -19
  35. package/package.json +7 -7
  36. package/dist/sessions-CbzqYiAy.cjs +0 -204
  37. package/dist/sessions-lvfTH_ql.mjs +0 -200
@@ -0,0 +1,322 @@
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+ var index = require('./index-DcESl4cI.cjs');
5
+ var persistence = require('./types-DD3AK6Nb.cjs');
6
+ require('node:os');
7
+ require('node:crypto');
8
+ require('cross-spawn');
9
+ require('node:path');
10
+ require('node:readline');
11
+ require('node:fs');
12
+ require('./agentGuidance-BifkGXdE.cjs');
13
+ require('node:fs/promises');
14
+ require('fs/promises');
15
+ require('ink');
16
+ require('react');
17
+ require('@anthropic-ai/claude-agent-sdk');
18
+ require('axios');
19
+ require('node:events');
20
+ require('socket.io-client');
21
+ require('tweetnacl');
22
+ require('os');
23
+ require('child_process');
24
+ require('@paralleldrive/cuid2');
25
+ require('node:child_process');
26
+ require('fs');
27
+ require('path');
28
+ require('@anthropic-ai/sandbox-runtime');
29
+ require('expo-server-sdk');
30
+ require('crypto');
31
+ require('ps-list');
32
+ require('tmp');
33
+ require('open');
34
+ require('fastify');
35
+ require('zod');
36
+ require('fastify-type-provider-zod');
37
+ require('node:module');
38
+ require('@modelcontextprotocol/sdk/server/mcp.js');
39
+ require('node:http');
40
+ require('@modelcontextprotocol/sdk/server/streamableHttp.js');
41
+ require('./limits-KdWKmwtH.cjs');
42
+ require('http');
43
+ require('util');
44
+ require('inquirer');
45
+ require('node:url');
46
+ require('node:readline/promises');
47
+ require('node:util');
48
+ require('url');
49
+ require('node-pty');
50
+
51
+ const ACTIONS = ["list", "read", "stop", "archive", "approve", "deny"];
52
+ const ACTIONS_NEEDING_ID = /* @__PURE__ */ new Set(["read", "stop", "archive", "approve", "deny"]);
53
+ const ACTIONS_NEEDING_REQUEST_ID = /* @__PURE__ */ new Set(["approve", "deny"]);
54
+ const REQUEST_ID_RE = /^[a-zA-Z0-9_.:-]{1,128}$/;
55
+ function defaultOptions() {
56
+ return { action: "help", all: false, includeArchived: false, forSession: false, json: false };
57
+ }
58
+ function parseSessionsArgs(args) {
59
+ const options = defaultOptions();
60
+ let actionSeen = false;
61
+ const positionals = [];
62
+ for (let i = 0; i < args.length; i++) {
63
+ const arg = args[i];
64
+ if (arg === "--help" || arg === "-h") {
65
+ return defaultOptions();
66
+ } else if (arg === "--json") {
67
+ options.json = true;
68
+ } else if (arg === "--all") {
69
+ options.all = true;
70
+ } else if (arg === "--include-archived") {
71
+ options.includeArchived = true;
72
+ } else if (arg === "--for-session") {
73
+ options.forSession = true;
74
+ } else if (arg === "--reason") {
75
+ const value = args[++i];
76
+ if (value === void 0) throw new Error("--reason requires a value");
77
+ options.reason = value;
78
+ } else if (arg === "--tag") {
79
+ const value = args[++i];
80
+ if (value === void 0) throw new Error("--tag requires a value");
81
+ options.tag = value;
82
+ } else if (arg === "--limit") {
83
+ const value = args[++i];
84
+ if (value === void 0) throw new Error("--limit requires a value");
85
+ const parsed = Number(value);
86
+ if (!Number.isInteger(parsed) || parsed < 1) throw new Error("--limit must be a positive integer");
87
+ options.limit = parsed;
88
+ } else if (arg.startsWith("-")) {
89
+ throw new Error(`Unknown argument: ${arg}`);
90
+ } else if (!actionSeen) {
91
+ if (!ACTIONS.includes(arg)) {
92
+ throw new Error(`Unknown action: ${arg} (expected ${ACTIONS.join(", ")})`);
93
+ }
94
+ options.action = arg;
95
+ actionSeen = true;
96
+ } else {
97
+ positionals.push(arg);
98
+ }
99
+ }
100
+ if (!actionSeen) return defaultOptions();
101
+ const expectedPositionals = ACTIONS_NEEDING_REQUEST_ID.has(options.action) ? 2 : ACTIONS_NEEDING_ID.has(options.action) ? 1 : 0;
102
+ if (positionals.length > expectedPositionals) {
103
+ throw new Error(`Unexpected ${expectedPositionals > 0 ? "extra " : ""}argument: ${positionals[expectedPositionals]}`);
104
+ }
105
+ if (ACTIONS_NEEDING_ID.has(options.action)) {
106
+ const id = positionals[0];
107
+ if (id === void 0) throw new Error(`${options.action} requires a session id`);
108
+ if (!persistence.isValidSessionId(id)) throw new Error(`Invalid session id: ${id}`);
109
+ options.sessionId = id;
110
+ }
111
+ if (ACTIONS_NEEDING_REQUEST_ID.has(options.action)) {
112
+ const requestId = positionals[1];
113
+ if (requestId === void 0) throw new Error(`${options.action} requires a session id and a request id`);
114
+ if (!REQUEST_ID_RE.test(requestId)) throw new Error(`Invalid request id: ${requestId}`);
115
+ options.requestId = requestId;
116
+ }
117
+ if (options.action !== "list") {
118
+ if (options.tag !== void 0) throw new Error("--tag only applies to `sessions list`");
119
+ if (options.all) throw new Error("--all only applies to `sessions list`");
120
+ if (options.includeArchived) throw new Error("--include-archived only applies to `sessions list --all`");
121
+ } else if (options.includeArchived && !options.all) {
122
+ throw new Error("--include-archived only applies to `sessions list --all`");
123
+ }
124
+ if (options.forSession && options.action !== "approve") throw new Error("--for-session only applies to `sessions approve`");
125
+ if (options.reason !== void 0 && options.action !== "deny") throw new Error("--reason only applies to `sessions deny`");
126
+ return options;
127
+ }
128
+ const SESSIONS_HELP = `
129
+ ${chalk.bold("very-happy sessions")} - Inspect and control sessions on this machine (for automation)
130
+
131
+ ${chalk.bold("Usage:")}
132
+ very-happy sessions list [--all [--include-archived]] [--tag <name>] [--limit <n>] [--json]
133
+ very-happy sessions read <id> [--limit <n>] [--json]
134
+ very-happy sessions stop <id> [--json]
135
+ very-happy sessions archive <id> [--json]
136
+ very-happy sessions approve <id> <requestId> [--for-session] [--json]
137
+ very-happy sessions deny <id> <requestId> [--reason <text>] [--json]
138
+
139
+ ${chalk.bold("Actions:")}
140
+ list Running sessions plus recently seen ones, newest first.
141
+ With --all: every session on the account (newest 150, server
142
+ REST), attention first. Each row says whether this machine could
143
+ decrypt it (\`decryptable\`); rows from other machines show only
144
+ id / active / archived / timestamps / url.
145
+ read The tail of a session as a role-tagged transcript.
146
+ stop SIGTERM the session's process via the local daemon.
147
+ archive Mark the session inactive server-side (it stays resumable).
148
+ approve Answer a pending permission request \`requestId\` with approve \u2014
149
+ the same RPC the web permission card sends. --for-session makes
150
+ it \`approved_for_session\` (the card's "allow for this session").
151
+ deny Answer it with deny (optional --reason is shown to the agent).
152
+
153
+ ${chalk.bold("Options:")}
154
+ --all list only: account-wide over REST instead of this
155
+ machine's daemon + local keys.
156
+ --include-archived list --all only: also show server-archived rows.
157
+ --tag <name> list only: keep sessions carrying this origin tag (see
158
+ \`spawn --spawned-by\`). With --all only decryptable rows
159
+ can match.
160
+ --limit <n> list: how many NOT-running / not-attention sessions to
161
+ include (default ${index.DEFAULT_RECENT_LIMIT}; running and attention rows are
162
+ never cut). read: how many messages (default 20, max ${index.MAX_READ_LIMIT}).
163
+ --for-session approve only: approved_for_session instead of approved.
164
+ --reason <text> deny only: reason forwarded to the wrapper.
165
+ --json Machine-readable output.
166
+ -h, --help Show this help
167
+
168
+ ${chalk.bold("Scope:")}
169
+ read / approve / deny need the session key from ~/.happy/sessions.json,
170
+ which exists for sessions this machine's daemon spawned and is pruned after
171
+ 14 days (the message payloads and the permission RPC are encrypted with it).
172
+ \`list --all\` sees every session on the account but can only decrypt those
173
+ same ones; the rest come back with decryptable=false. Reading, listing in
174
+ full and answering another machine's session from here needs the CLI to hold
175
+ the account content key \u2014 a credentials change, not a flag.
176
+
177
+ ${chalk.bold("Exit codes:")}
178
+ 0 success (approve/deny: the wrapper acknowledged the verdict; check
179
+ \`settled\` in --json to see whether the request has left the pending set)
180
+ 1 bad arguments, unknown session, no local key, request not pending,
181
+ session not online, or the operation failed (including \`stop\` on a
182
+ session the daemon is not running)
183
+ `;
184
+ function formatWait(ms) {
185
+ const minutes = Math.floor(ms / 6e4);
186
+ if (minutes < 1) return `${Math.floor(ms / 1e3)}s`;
187
+ if (minutes < 60) return `${minutes}m`;
188
+ return `${Math.floor(minutes / 60)}h${minutes % 60}m`;
189
+ }
190
+ function formatAccountSummaryLine(summary) {
191
+ const state = summary.attention ? "[attention]" : summary.live ? "[running here]" : summary.active ? "[active elsewhere]" : summary.archived ? "[archived]" : "[idle]";
192
+ const parts = [summary.id, state];
193
+ if (!summary.decryptable) {
194
+ parts.push("(not decryptable from this machine)");
195
+ } else {
196
+ if (summary.title) parts.push(`title="${summary.title}"`);
197
+ if (summary.flavor) parts.push(`agent=${summary.flavor}`);
198
+ if (summary.tags?.length) parts.push(`tags=${summary.tags.join(",")}`);
199
+ if (summary.variant) parts.push(`variant=${summary.variant}`);
200
+ if (summary.machineId) parts.push(`machine=${summary.machineId}`);
201
+ if (summary.cwd) parts.push(`cwd=${summary.cwd}`);
202
+ for (const request of summary.pending ?? []) {
203
+ parts.push(`pending=${request.id}:${request.tool}${request.waitingMs !== void 0 ? `(${formatWait(request.waitingMs)})` : ""}`);
204
+ }
205
+ }
206
+ parts.push(summary.url);
207
+ return parts.join(" ");
208
+ }
209
+ function permissionFailureRecord(sessionId, requestId, error) {
210
+ return { sessionId, requestId, error: error instanceof Error ? error.message : String(error) };
211
+ }
212
+ function formatSummaryLine(summary) {
213
+ const parts = [summary.id, summary.live ? "[running]" : "[not running]"];
214
+ if (summary.title) parts.push(`title="${summary.title}"`);
215
+ if (summary.flavor) parts.push(`agent=${summary.flavor}`);
216
+ if (summary.tags?.length) parts.push(`tags=${summary.tags.join(",")}`);
217
+ if (summary.variant) parts.push(`variant=${summary.variant}`);
218
+ if (summary.cwd) parts.push(`cwd=${summary.cwd}`);
219
+ if (summary.pid !== void 0) parts.push(`pid=${summary.pid}`);
220
+ parts.push(summary.url);
221
+ return parts.join(" ");
222
+ }
223
+ async function handleSessionsCommand(args) {
224
+ let options;
225
+ try {
226
+ options = parseSessionsArgs(args);
227
+ } catch (error) {
228
+ console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
229
+ console.error(`Run ${chalk.cyan("very-happy sessions --help")} for usage.`);
230
+ process.exit(1);
231
+ }
232
+ if (options.action === "help") {
233
+ console.log(SESSIONS_HELP);
234
+ process.exit(0);
235
+ }
236
+ try {
237
+ if (options.action === "list" && options.all) {
238
+ const sessions = await index.listAccountSessions({ tag: options.tag, recentLimit: options.limit, includeArchived: options.includeArchived });
239
+ if (options.json) {
240
+ console.log(JSON.stringify({ sessions, scope: "account" }));
241
+ } else if (sessions.length === 0) {
242
+ console.log(options.tag ? `No decryptable sessions tagged "${options.tag}" on this account.` : "No sessions found on this account.");
243
+ } else {
244
+ for (const summary of sessions) console.log(formatAccountSummaryLine(summary));
245
+ const foreign = sessions.filter((summary) => !summary.decryptable).length;
246
+ if (foreign > 0) {
247
+ console.log(chalk.dim(`${foreign} session(s) belong to another machine and cannot be decrypted here (no local key).`));
248
+ }
249
+ }
250
+ process.exit(0);
251
+ }
252
+ if (options.action === "list") {
253
+ const sessions = await index.listSessions({ tag: options.tag, recentLimit: options.limit });
254
+ if (options.json) {
255
+ console.log(JSON.stringify({ sessions }));
256
+ } else if (sessions.length === 0) {
257
+ console.log(options.tag ? `No sessions tagged "${options.tag}" on this machine.` : "No sessions found on this machine.");
258
+ } else {
259
+ for (const summary of sessions) console.log(formatSummaryLine(summary));
260
+ }
261
+ process.exit(0);
262
+ }
263
+ const sessionId = options.sessionId;
264
+ if (options.action === "read") {
265
+ const result = await index.readSessionTranscript(sessionId, options.limit ?? 20);
266
+ if (options.json) {
267
+ console.log(JSON.stringify(result));
268
+ } else {
269
+ console.log(formatSummaryLine(result.summary));
270
+ console.log(`--- last ${result.messageCount} message(s) ---`);
271
+ console.log(result.transcript.length > 0 ? result.transcript : "(no readable conversation content in this range)");
272
+ }
273
+ process.exit(0);
274
+ }
275
+ if (options.action === "stop") {
276
+ const stopped = await index.stopSession(sessionId);
277
+ if (!stopped) {
278
+ if (options.json) console.log(JSON.stringify({ sessionId, stopped: false }));
279
+ console.error(chalk.red("Error:"), `Session ${sessionId} is not among the daemon's running sessions.`);
280
+ process.exit(1);
281
+ }
282
+ if (options.json) console.log(JSON.stringify({ sessionId, stopped: true }));
283
+ else console.log(`Stopped ${sessionId}`);
284
+ process.exit(0);
285
+ }
286
+ if (options.action === "approve" || options.action === "deny") {
287
+ const requestId = options.requestId;
288
+ const verdict = options.action === "approve" ? { kind: "approve", forSession: options.forSession } : { kind: "deny", reason: options.reason };
289
+ let result;
290
+ try {
291
+ result = await index.resolvePermissionRequest(sessionId, requestId, verdict);
292
+ } catch (error) {
293
+ if (options.json) console.log(JSON.stringify(permissionFailureRecord(sessionId, requestId, error)));
294
+ throw error;
295
+ }
296
+ if (result.outcome.status !== "acknowledged") {
297
+ if (options.json) console.log(JSON.stringify(result));
298
+ console.error(chalk.red("Error:"), `${options.action} of ${requestId} on ${sessionId} was not delivered (${result.outcome.status}): ${result.outcome.message}`);
299
+ process.exit(1);
300
+ }
301
+ if (options.json) {
302
+ console.log(JSON.stringify(result));
303
+ } else {
304
+ const verb = options.action === "approve" ? "Approved" : "Denied";
305
+ console.log(`${verb} ${requestId} on ${sessionId} (${result.payload.decision})${result.settled ? "" : " \u2014 wrapper acknowledged, but the request was still listed as pending when we stopped waiting"}`);
306
+ }
307
+ process.exit(0);
308
+ }
309
+ await index.archiveSession(sessionId);
310
+ if (options.json) console.log(JSON.stringify({ sessionId, archived: true }));
311
+ else console.log(`Archived ${sessionId}`);
312
+ process.exit(0);
313
+ } catch (error) {
314
+ console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
315
+ process.exit(1);
316
+ }
317
+ }
318
+
319
+ exports.SESSIONS_HELP = SESSIONS_HELP;
320
+ exports.handleSessionsCommand = handleSessionsCommand;
321
+ exports.parseSessionsArgs = parseSessionsArgs;
322
+ exports.permissionFailureRecord = permissionFailureRecord;
@@ -1,8 +1,8 @@
1
1
  import chalk from 'chalk';
2
2
  import { readFileSync, statSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
- import { c as checkIfDaemonRunningAndCleanupStaleState, s as spawnDaemonSession, a as sessionWebUrl, i as isValidSpawnOrigin, b as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, w as waitForSessionKey, d as sendUserMessage } from './index-Dq-eFp89.mjs';
5
- import { l as logger } from './types-Ds0SiQ1D.mjs';
4
+ import { c as checkIfDaemonRunningAndCleanupStaleState, s as spawnDaemonSession, a as sessionWebUrl, i as isValidSpawnOrigin, b as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS, w as waitForSessionKey, d as sendUserMessage } from './index-BYZKuQoy.mjs';
5
+ import { l as logger } from './types-jSfU_0o1.mjs';
6
6
  import 'node:os';
7
7
  import 'node:crypto';
8
8
  import 'cross-spawn';
@@ -46,7 +46,6 @@ import 'node:util';
46
46
  import 'url';
47
47
  import 'node-pty';
48
48
 
49
- const SPAWN_AGENTS = ["claude", "codex", "gemini", "openclaw"];
50
49
  function parseEnvAssignment(raw) {
51
50
  const eq = raw.indexOf("=");
52
51
  if (eq <= 0) throw new Error(`--env expects KEY=VALUE, got: ${raw}`);
@@ -132,7 +131,7 @@ ${chalk.bold("Options:")}
132
131
  to approve \u2014 if nothing is watching, it just hangs.
133
132
  Unattended dispatchers want bypassPermissions.
134
133
  --agent <name> Backend to run: claude (default), codex, gemini,
135
- openclaw.
134
+ openclaw, pi (needs pi-acp on the daemon's PATH).
136
135
  --env KEY=VALUE Extra environment for the session process. Repeatable.
137
136
  \${VAR} is expanded against the daemon's environment;
138
137
  an unresolved reference fails the spawn.
@@ -3,8 +3,8 @@
3
3
  var chalk = require('chalk');
4
4
  var node_fs = require('node:fs');
5
5
  var path = require('node:path');
6
- var index = require('./index-4jiUeiUz.cjs');
7
- var persistence = require('./types-C5kEpkcZ.cjs');
6
+ var index = require('./index-DcESl4cI.cjs');
7
+ var persistence = require('./types-DD3AK6Nb.cjs');
8
8
  require('node:os');
9
9
  require('node:crypto');
10
10
  require('cross-spawn');
@@ -48,7 +48,6 @@ require('node:util');
48
48
  require('url');
49
49
  require('node-pty');
50
50
 
51
- const SPAWN_AGENTS = ["claude", "codex", "gemini", "openclaw"];
52
51
  function parseEnvAssignment(raw) {
53
52
  const eq = raw.indexOf("=");
54
53
  if (eq <= 0) throw new Error(`--env expects KEY=VALUE, got: ${raw}`);
@@ -89,8 +88,8 @@ function parseSpawnArgs(args) {
89
88
  } else if (arg === "--agent") {
90
89
  const value = args[++i];
91
90
  if (value === void 0) throw new Error("--agent requires a value");
92
- if (!SPAWN_AGENTS.includes(value)) {
93
- throw new Error(`--agent must be one of: ${SPAWN_AGENTS.join(", ")}`);
91
+ if (!index.SPAWN_AGENTS.includes(value)) {
92
+ throw new Error(`--agent must be one of: ${index.SPAWN_AGENTS.join(", ")}`);
94
93
  }
95
94
  options.agent = value;
96
95
  } else if (arg === "--env") {
@@ -134,7 +133,7 @@ ${chalk.bold("Options:")}
134
133
  to approve \u2014 if nothing is watching, it just hangs.
135
134
  Unattended dispatchers want bypassPermissions.
136
135
  --agent <name> Backend to run: claude (default), codex, gemini,
137
- openclaw.
136
+ openclaw, pi (needs pi-acp on the daemon's PATH).
138
137
  --env KEY=VALUE Extra environment for the session process. Repeatable.
139
138
  \${VAR} is expanded against the daemon's environment;
140
139
  an unresolved reference fails the spawn.
@@ -257,8 +256,8 @@ async function handleSpawnCommand(args) {
257
256
  process.exit(0);
258
257
  }
259
258
 
259
+ exports.SPAWN_AGENTS = index.SPAWN_AGENTS;
260
260
  exports.sessionWebUrl = index.sessionWebUrl;
261
- exports.SPAWN_AGENTS = SPAWN_AGENTS;
262
261
  exports.handleSpawnCommand = handleSpawnCommand;
263
262
  exports.parseEnvAssignment = parseEnvAssignment;
264
263
  exports.parseSpawnArgs = parseSpawnArgs;
@@ -51,7 +51,7 @@ var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
51
51
  var pty__namespace = /*#__PURE__*/_interopNamespaceDefault(pty);
52
52
 
53
53
  var name = "very-happy-cli";
54
- var version = "0.2.116";
54
+ var version = "0.2.117";
55
55
  var description = "Remote multi-agent workspace CLI with deep Claude integration, native terminal streaming, and self-hosting.";
56
56
  var author = "Kirill Dubovitskiy";
57
57
  var contributors = [
@@ -164,12 +164,12 @@ var dependencies = {
164
164
  zod: "^4.0.0"
165
165
  };
166
166
  var optionalDependencies = {
167
- "very-happy-tools-arm64-darwin": "0.2.116",
168
- "very-happy-tools-x64-darwin": "0.2.116",
169
- "very-happy-tools-arm64-linux": "0.2.116",
170
- "very-happy-tools-x64-linux": "0.2.116",
171
- "very-happy-tools-arm64-win32": "0.2.116",
172
- "very-happy-tools-x64-win32": "0.2.116"
167
+ "very-happy-tools-arm64-darwin": "0.2.117",
168
+ "very-happy-tools-x64-darwin": "0.2.117",
169
+ "very-happy-tools-arm64-linux": "0.2.117",
170
+ "very-happy-tools-x64-linux": "0.2.117",
171
+ "very-happy-tools-arm64-win32": "0.2.117",
172
+ "very-happy-tools-x64-win32": "0.2.117"
173
173
  };
174
174
  var devDependencies = {
175
175
  "@slopus/happy-wire": "workspace:*",
@@ -1039,6 +1039,8 @@ z.z.object({
1039
1039
  codex: z.z.boolean(),
1040
1040
  gemini: z.z.boolean(),
1041
1041
  openclaw: z.z.boolean(),
1042
+ pi: z.z.boolean().optional(),
1043
+ // absent on daemons that predate the pi runner
1042
1044
  detectedAt: z.z.number()
1043
1045
  }).optional(),
1044
1046
  resumeSupport: z.z.object({
@@ -1680,7 +1682,7 @@ class RpcHandlerManager {
1680
1682
  }
1681
1683
  }
1682
1684
 
1683
- const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-C5kEpkcZ.cjs', document.baseURI).href))));
1685
+ const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-DD3AK6Nb.cjs', document.baseURI).href))));
1684
1686
  function projectPath() {
1685
1687
  const path = path$1.resolve(__dirname$1, "..");
1686
1688
  return path;
@@ -12753,6 +12755,19 @@ function commandExists(command) {
12753
12755
  return false;
12754
12756
  }
12755
12757
  }
12758
+ function commandExistsWindows(name) {
12759
+ try {
12760
+ child_process.execSync(`powershell -NoProfile -Command "Get-Command ${name} -ErrorAction SilentlyContinue"`, { stdio: "ignore", windowsHide: true });
12761
+ return true;
12762
+ } catch {
12763
+ return false;
12764
+ }
12765
+ }
12766
+ const SAFE_COMMAND_NAME = /^[A-Za-z0-9._-]+$/;
12767
+ function commandOnPath(name) {
12768
+ if (!SAFE_COMMAND_NAME.test(name)) return false;
12769
+ return os$1.platform() === "win32" ? commandExistsWindows(name) : commandExists(name);
12770
+ }
12756
12771
  function detectPosix() {
12757
12772
  const claude = commandExists("claude");
12758
12773
  const codex = commandExists("codex");
@@ -12761,17 +12776,11 @@ function detectPosix() {
12761
12776
  const openclawConfig = fs$1.existsSync(path$1.join(os$1.homedir(), ".openclaw", "openclaw.json"));
12762
12777
  const openclawEnv = !!process.env.OPENCLAW_GATEWAY_URL;
12763
12778
  const openclaw = openclawCommand || openclawConfig || openclawEnv;
12764
- return { claude, codex, gemini, openclaw, detectedAt: Date.now() };
12779
+ const pi = commandExists("pi") && commandExists("pi-acp");
12780
+ return { claude, codex, gemini, openclaw, pi, detectedAt: Date.now() };
12765
12781
  }
12766
12782
  function detectWindows() {
12767
- const checkCommand = (name) => {
12768
- try {
12769
- child_process.execSync(`powershell -NoProfile -Command "Get-Command ${name} -ErrorAction SilentlyContinue"`, { stdio: "ignore", windowsHide: true });
12770
- return true;
12771
- } catch {
12772
- return false;
12773
- }
12774
- };
12783
+ const checkCommand = commandExistsWindows;
12775
12784
  const claude = checkCommand("claude");
12776
12785
  const codex = checkCommand("codex");
12777
12786
  const gemini = checkCommand("gemini");
@@ -12779,7 +12788,8 @@ function detectWindows() {
12779
12788
  const openclawConfig = fs$1.existsSync(path$1.join(process.env.USERPROFILE || os$1.homedir(), ".openclaw", "openclaw.json"));
12780
12789
  const openclawEnv = !!process.env.OPENCLAW_GATEWAY_URL;
12781
12790
  const openclaw = openclawCommand || openclawConfig || openclawEnv;
12782
- return { claude, codex, gemini, openclaw, detectedAt: Date.now() };
12791
+ const pi = checkCommand("pi") && checkCommand("pi-acp");
12792
+ return { claude, codex, gemini, openclaw, pi, detectedAt: Date.now() };
12783
12793
  }
12784
12794
 
12785
12795
  const AgentCredentialsSchema = z.z.object({
@@ -14588,6 +14598,22 @@ class ApiMachineClient {
14588
14598
  event: n.event
14589
14599
  });
14590
14600
  });
14601
+ /**
14602
+ * The CLI availability last advertised in machine metadata (re-probed by
14603
+ * the keep-alive). Null until the first keep-alive tick; the daemon falls
14604
+ * back to its startup probe then.
14605
+ */
14606
+ getCLIAvailability() {
14607
+ return this.lastKnownCLIAvailability;
14608
+ }
14609
+ /**
14610
+ * Title a web terminal from inside it (`very-happy mcp` change_title →
14611
+ * daemon /terminal-title → here). Same tmux truthfulness as the
14612
+ * `set-terminal-title` RPC.
14613
+ */
14614
+ setTerminalTitle(terminalId, title, ifAbsent) {
14615
+ return this.webTerminal.setTitle(terminalId, title, ifAbsent);
14616
+ }
14591
14617
  /**
14592
14618
  * Push text to the clipboard of every web client the user has open
14593
14619
  * (terminal-path claude → `very-happy mcp` → daemon /clipboard → here).
@@ -15396,7 +15422,7 @@ class ApiMachineClient {
15396
15422
  const prev = this.lastKnownCLIAvailability;
15397
15423
  const newResumeSupport = detectResumeSupport();
15398
15424
  const prevResume = this.lastKnownResumeSupport;
15399
- const cliAvailabilityChanged = !prev || prev.claude !== newAvailability.claude || prev.codex !== newAvailability.codex || prev.gemini !== newAvailability.gemini || prev.openclaw !== newAvailability.openclaw;
15425
+ const cliAvailabilityChanged = !prev || prev.claude !== newAvailability.claude || prev.codex !== newAvailability.codex || prev.gemini !== newAvailability.gemini || prev.openclaw !== newAvailability.openclaw || prev.pi !== newAvailability.pi;
15400
15426
  const resumeSupportChanged = !prevResume || prevResume.rpcAvailable !== newResumeSupport.rpcAvailable || prevResume.happyAgentAuthenticated !== newResumeSupport.happyAgentAuthenticated;
15401
15427
  if (cliAvailabilityChanged || resumeSupportChanged) {
15402
15428
  this.lastKnownCLIAvailability = newAvailability;
@@ -16637,6 +16663,8 @@ exports.api = api;
16637
16663
  exports.clearCredentials = clearCredentials;
16638
16664
  exports.clearDaemonState = clearDaemonState;
16639
16665
  exports.clearMachineId = clearMachineId;
16666
+ exports.commandOnPath = commandOnPath;
16667
+ exports.compareExactVersions = compareExactVersions;
16640
16668
  exports.configuration = configuration;
16641
16669
  exports.connectionState = connectionState;
16642
16670
  exports.contentLogMetadata = contentLogMetadata;
@@ -29,7 +29,7 @@ import { SandboxManager } from '@anthropic-ai/sandbox-runtime';
29
29
  import { Expo } from 'expo-server-sdk';
30
30
 
31
31
  var name = "very-happy-cli";
32
- var version = "0.2.116";
32
+ var version = "0.2.117";
33
33
  var description = "Remote multi-agent workspace CLI with deep Claude integration, native terminal streaming, and self-hosting.";
34
34
  var author = "Kirill Dubovitskiy";
35
35
  var contributors = [
@@ -142,12 +142,12 @@ var dependencies = {
142
142
  zod: "^4.0.0"
143
143
  };
144
144
  var optionalDependencies = {
145
- "very-happy-tools-arm64-darwin": "0.2.116",
146
- "very-happy-tools-x64-darwin": "0.2.116",
147
- "very-happy-tools-arm64-linux": "0.2.116",
148
- "very-happy-tools-x64-linux": "0.2.116",
149
- "very-happy-tools-arm64-win32": "0.2.116",
150
- "very-happy-tools-x64-win32": "0.2.116"
145
+ "very-happy-tools-arm64-darwin": "0.2.117",
146
+ "very-happy-tools-x64-darwin": "0.2.117",
147
+ "very-happy-tools-arm64-linux": "0.2.117",
148
+ "very-happy-tools-x64-linux": "0.2.117",
149
+ "very-happy-tools-arm64-win32": "0.2.117",
150
+ "very-happy-tools-x64-win32": "0.2.117"
151
151
  };
152
152
  var devDependencies = {
153
153
  "@slopus/happy-wire": "workspace:*",
@@ -1017,6 +1017,8 @@ z$1.object({
1017
1017
  codex: z$1.boolean(),
1018
1018
  gemini: z$1.boolean(),
1019
1019
  openclaw: z$1.boolean(),
1020
+ pi: z$1.boolean().optional(),
1021
+ // absent on daemons that predate the pi runner
1020
1022
  detectedAt: z$1.number()
1021
1023
  }).optional(),
1022
1024
  resumeSupport: z$1.object({
@@ -12731,6 +12733,19 @@ function commandExists(command) {
12731
12733
  return false;
12732
12734
  }
12733
12735
  }
12736
+ function commandExistsWindows(name) {
12737
+ try {
12738
+ execSync(`powershell -NoProfile -Command "Get-Command ${name} -ErrorAction SilentlyContinue"`, { stdio: "ignore", windowsHide: true });
12739
+ return true;
12740
+ } catch {
12741
+ return false;
12742
+ }
12743
+ }
12744
+ const SAFE_COMMAND_NAME = /^[A-Za-z0-9._-]+$/;
12745
+ function commandOnPath(name) {
12746
+ if (!SAFE_COMMAND_NAME.test(name)) return false;
12747
+ return os.platform() === "win32" ? commandExistsWindows(name) : commandExists(name);
12748
+ }
12734
12749
  function detectPosix() {
12735
12750
  const claude = commandExists("claude");
12736
12751
  const codex = commandExists("codex");
@@ -12739,17 +12754,11 @@ function detectPosix() {
12739
12754
  const openclawConfig = existsSync$1(join$1(os.homedir(), ".openclaw", "openclaw.json"));
12740
12755
  const openclawEnv = !!process.env.OPENCLAW_GATEWAY_URL;
12741
12756
  const openclaw = openclawCommand || openclawConfig || openclawEnv;
12742
- return { claude, codex, gemini, openclaw, detectedAt: Date.now() };
12757
+ const pi = commandExists("pi") && commandExists("pi-acp");
12758
+ return { claude, codex, gemini, openclaw, pi, detectedAt: Date.now() };
12743
12759
  }
12744
12760
  function detectWindows() {
12745
- const checkCommand = (name) => {
12746
- try {
12747
- execSync(`powershell -NoProfile -Command "Get-Command ${name} -ErrorAction SilentlyContinue"`, { stdio: "ignore", windowsHide: true });
12748
- return true;
12749
- } catch {
12750
- return false;
12751
- }
12752
- };
12761
+ const checkCommand = commandExistsWindows;
12753
12762
  const claude = checkCommand("claude");
12754
12763
  const codex = checkCommand("codex");
12755
12764
  const gemini = checkCommand("gemini");
@@ -12757,7 +12766,8 @@ function detectWindows() {
12757
12766
  const openclawConfig = existsSync$1(join$1(process.env.USERPROFILE || os.homedir(), ".openclaw", "openclaw.json"));
12758
12767
  const openclawEnv = !!process.env.OPENCLAW_GATEWAY_URL;
12759
12768
  const openclaw = openclawCommand || openclawConfig || openclawEnv;
12760
- return { claude, codex, gemini, openclaw, detectedAt: Date.now() };
12769
+ const pi = checkCommand("pi") && checkCommand("pi-acp");
12770
+ return { claude, codex, gemini, openclaw, pi, detectedAt: Date.now() };
12761
12771
  }
12762
12772
 
12763
12773
  const AgentCredentialsSchema = z$1.object({
@@ -14566,6 +14576,22 @@ class ApiMachineClient {
14566
14576
  event: n.event
14567
14577
  });
14568
14578
  });
14579
+ /**
14580
+ * The CLI availability last advertised in machine metadata (re-probed by
14581
+ * the keep-alive). Null until the first keep-alive tick; the daemon falls
14582
+ * back to its startup probe then.
14583
+ */
14584
+ getCLIAvailability() {
14585
+ return this.lastKnownCLIAvailability;
14586
+ }
14587
+ /**
14588
+ * Title a web terminal from inside it (`very-happy mcp` change_title →
14589
+ * daemon /terminal-title → here). Same tmux truthfulness as the
14590
+ * `set-terminal-title` RPC.
14591
+ */
14592
+ setTerminalTitle(terminalId, title, ifAbsent) {
14593
+ return this.webTerminal.setTitle(terminalId, title, ifAbsent);
14594
+ }
14569
14595
  /**
14570
14596
  * Push text to the clipboard of every web client the user has open
14571
14597
  * (terminal-path claude → `very-happy mcp` → daemon /clipboard → here).
@@ -15374,7 +15400,7 @@ class ApiMachineClient {
15374
15400
  const prev = this.lastKnownCLIAvailability;
15375
15401
  const newResumeSupport = detectResumeSupport();
15376
15402
  const prevResume = this.lastKnownResumeSupport;
15377
- const cliAvailabilityChanged = !prev || prev.claude !== newAvailability.claude || prev.codex !== newAvailability.codex || prev.gemini !== newAvailability.gemini || prev.openclaw !== newAvailability.openclaw;
15403
+ const cliAvailabilityChanged = !prev || prev.claude !== newAvailability.claude || prev.codex !== newAvailability.codex || prev.gemini !== newAvailability.gemini || prev.openclaw !== newAvailability.openclaw || prev.pi !== newAvailability.pi;
15378
15404
  const resumeSupportChanged = !prevResume || prevResume.rpcAvailable !== newResumeSupport.rpcAvailable || prevResume.happyAgentAuthenticated !== newResumeSupport.happyAgentAuthenticated;
15379
15405
  if (cliAvailabilityChanged || resumeSupportChanged) {
15380
15406
  this.lastKnownCLIAvailability = newAvailability;
@@ -16597,4 +16623,4 @@ const RawJSONLinesSchema = z$1.discriminatedUnion("type", [
16597
16623
  }).passthrough()
16598
16624
  ]);
16599
16625
 
16600
- export { mirrorLineKey as $, ApiClient as A, credentialRelayProblem as B, deriveLocalCliUpdateSummary as C, updateSettings as D, encodeBase64Url as E, decodeBase64 as F, writeCredentialsLegacy as G, writeCredentialsDataKey as H, InvalidateSync as I, readCredentialsForConfiguredRelay as J, encrypt as K, isClaudeSessionId as L, MAX_CHAT_ATTACHMENT_SOURCE_BYTES as M, getLocalHappyAgentCredentialPath as N, readLocalHappyAgentCredentials as O, decryptWithDataKey as P, decryptLegacy as Q, RawJSONLinesSchema as R, STREAM_DELTA_MAX_CHARS as S, extractCompleteLines as T, decideBackfill as U, parseTerminalHookPayload as V, tmuxArgs as W, scrubTmuxClientEnv as X, decideMirrorBinding as Y, MIRROR_BACKFILL_LINES_DEFAULT as Z, persistSession as _, ApiSessionClient as a, mirrorLocalId as a0, detectResumeSupport as a1, detectCLIAvailability as a2, acquireDaemonLock as a3, summarizeSpawnSessionForLog as a4, deletePersistedSessions as a5, shellescape as a6, decrypt as a7, writeDaemonState as a8, writeSettings as a9, fetchCliUpdateState as aa, resolveCliUpdateCheckInterval as ab, DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS as ac, releaseDaemonLock as ad, listVhTerminals as ae, isValidTerminalId as af, readVhTerminal as ag, sendToVhTerminal as ah, TITLE_PROMPT_PREFIX as ai, BOARD_ANALYZER_PROMPT_PREFIX as aj, startOfflineReconnection as ak, clearCredentials as al, clearMachineId as am, SandboxConfigSchema as an, CodexAppServerClient as ao, getLatestDaemonLog as ap, persistence as aq, api as ar, createEnvelope as b, configuration as c, contentLogMetadata as d, errorLogMetadata as e, packageJson as f, delay as g, connectionState as h, isValidSessionId as i, readSettings as j, encodeBase64 as k, logger as l, ensurePrivateDirectorySync as m, hardenPrivateFileSync as n, readDaemonState as o, projectPath as p, clearDaemonState as q, readPersistedSessions as r, getProjectPath as s, initializeSandbox as t, wrapCommand as u, AsyncLock as v, writePrivateFileSync as w, ensurePrivateDirectory as x, hardenPrivateFile as y, readCredentials as z };
16626
+ export { MIRROR_BACKFILL_LINES_DEFAULT as $, ApiClient as A, readCredentials as B, credentialRelayProblem as C, deriveLocalCliUpdateSummary as D, updateSettings as E, encodeBase64Url as F, decodeBase64 as G, writeCredentialsLegacy as H, InvalidateSync as I, writeCredentialsDataKey as J, readCredentialsForConfiguredRelay as K, encrypt as L, MAX_CHAT_ATTACHMENT_SOURCE_BYTES as M, isClaudeSessionId as N, getLocalHappyAgentCredentialPath as O, readLocalHappyAgentCredentials as P, decryptWithDataKey as Q, RawJSONLinesSchema as R, STREAM_DELTA_MAX_CHARS as S, decryptLegacy as T, compareExactVersions as U, extractCompleteLines as V, decideBackfill as W, parseTerminalHookPayload as X, tmuxArgs as Y, scrubTmuxClientEnv as Z, decideMirrorBinding as _, ApiSessionClient as a, persistSession as a0, mirrorLineKey as a1, mirrorLocalId as a2, detectCLIAvailability as a3, detectResumeSupport as a4, acquireDaemonLock as a5, summarizeSpawnSessionForLog as a6, deletePersistedSessions as a7, shellescape as a8, decrypt as a9, writeDaemonState as aa, writeSettings as ab, fetchCliUpdateState as ac, resolveCliUpdateCheckInterval as ad, DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS as ae, releaseDaemonLock as af, listVhTerminals as ag, isValidTerminalId as ah, readVhTerminal as ai, sendToVhTerminal as aj, TITLE_PROMPT_PREFIX as ak, BOARD_ANALYZER_PROMPT_PREFIX as al, startOfflineReconnection as am, clearCredentials as an, clearMachineId as ao, SandboxConfigSchema as ap, CodexAppServerClient as aq, getLatestDaemonLog as ar, persistence as as, api as at, createEnvelope as b, configuration as c, contentLogMetadata as d, errorLogMetadata as e, packageJson as f, delay as g, connectionState as h, isValidSessionId as i, readSettings as j, encodeBase64 as k, logger as l, ensurePrivateDirectorySync as m, hardenPrivateFileSync as n, readDaemonState as o, projectPath as p, clearDaemonState as q, readPersistedSessions as r, getProjectPath as s, initializeSandbox as t, wrapCommand as u, AsyncLock as v, writePrivateFileSync as w, ensurePrivateDirectory as x, hardenPrivateFile as y, commandOnPath as z };