very-happy-cli 0.2.115 → 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-DEZTWZZu.mjs → AcpBackend-C4RMHt0I.mjs} +1 -1
  2. package/dist/{AcpBackend-BrZN8KM-.cjs → AcpBackend-CrbXvcgQ.cjs} +1 -1
  3. package/dist/{AcpSessionManager-DjulpKY0.cjs → AcpSessionManager-CjAVO4RX.cjs} +1 -1
  4. package/dist/{AcpSessionManager-BzP3eiOG.mjs → AcpSessionManager-Cnc8Jatl.mjs} +1 -1
  5. package/dist/{config-CMgRBQMS.mjs → config-CnA3JIUn.mjs} +2 -2
  6. package/dist/{config-BNAsx9Wg.cjs → config-O9quMfxg.cjs} +2 -2
  7. package/dist/{index-B2KfhNku.mjs → index-B0o3H6_x.mjs} +2 -2
  8. package/dist/{index-BHNEb4bc.mjs → index-BYZKuQoy.mjs} +590 -41
  9. package/dist/{index-tPXwlc_t.cjs → index-DcESl4cI.cjs} +601 -43
  10. package/dist/{index-CpGR7rIw.mjs → index-DiRN0Rv8.mjs} +78 -8
  11. package/dist/{index-B3UkbonP.cjs → index-DqmVH6R5.cjs} +2 -2
  12. package/dist/{index-ClR0jhjm.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-DD6QuHfT.mjs → installTerminalHooks-DeYqyjCB.mjs} +2 -2
  16. package/dist/{installTerminalHooks-CWfCF68p.cjs → installTerminalHooks-zfsWSotO.cjs} +2 -2
  17. package/dist/lib.cjs +1 -1
  18. package/dist/lib.d.cts +66 -1
  19. package/dist/lib.d.mts +66 -1
  20. package/dist/lib.mjs +1 -1
  21. package/dist/{mcp-CiNrjYox.mjs → mcp-D_5aOK0I.mjs} +62 -17
  22. package/dist/{mcp-CqjiDRnG.cjs → mcp-nYqC4FYm.cjs} +62 -16
  23. package/dist/{runGemini-DdJqpywr.mjs → runGemini-CEURRmM4.mjs} +4 -4
  24. package/dist/{runGemini-UN5IznJp.cjs → runGemini-DYf3ntib.cjs} +4 -4
  25. package/dist/{runOpenClaw-CM5UrVBy.mjs → runOpenClaw-BozfKWng.mjs} +3 -3
  26. package/dist/{runOpenClaw-9hhfGllZ.cjs → runOpenClaw-CNKjAw-H.cjs} +3 -3
  27. package/dist/{send-CnVtXOj0.cjs → send-BZLhRZb-.cjs} +2 -2
  28. package/dist/{send-C6G2jsQp.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-qb344Y5E.mjs → spawn-CsrHZd3y.mjs} +3 -4
  32. package/dist/{spawn-CfYddkS_.cjs → spawn-tSvo3stN.cjs} +6 -7
  33. package/dist/{types-CpnzfHHS.cjs → types-DD3AK6Nb.cjs} +189 -26
  34. package/dist/{types-B3qx8Ga1.mjs → types-jSfU_0o1.mjs} +187 -26
  35. package/package.json +7 -7
  36. package/dist/sessions-CGdcF05T.cjs +0 -204
  37. package/dist/sessions-CmabJzYS.mjs +0 -200
@@ -1,200 +0,0 @@
1
- import chalk from 'chalk';
2
- import { D as DEFAULT_RECENT_LIMIT, M as MAX_READ_LIMIT, l as listSessions, r as readSessionTranscript, e as stopSession, f as archiveSession } from './index-BHNEb4bc.mjs';
3
- import { i as isValidSessionId } from './types-B3qx8Ga1.mjs';
4
- import 'node:os';
5
- import 'node:crypto';
6
- import 'cross-spawn';
7
- import 'node:path';
8
- import 'node:readline';
9
- import 'node:fs';
10
- import './agentGuidance-C2_pkgRI.mjs';
11
- import 'node:fs/promises';
12
- import 'fs/promises';
13
- import 'ink';
14
- import 'react';
15
- import '@anthropic-ai/claude-agent-sdk';
16
- import 'axios';
17
- import 'node:events';
18
- import 'socket.io-client';
19
- import 'tweetnacl';
20
- import 'os';
21
- import 'child_process';
22
- import '@paralleldrive/cuid2';
23
- import 'node:child_process';
24
- import 'fs';
25
- import 'path';
26
- import '@anthropic-ai/sandbox-runtime';
27
- import 'expo-server-sdk';
28
- import 'crypto';
29
- import 'ps-list';
30
- import 'tmp';
31
- import 'open';
32
- import 'fastify';
33
- import 'zod';
34
- import 'fastify-type-provider-zod';
35
- import 'node:module';
36
- import '@modelcontextprotocol/sdk/server/mcp.js';
37
- import 'node:http';
38
- import '@modelcontextprotocol/sdk/server/streamableHttp.js';
39
- import './limits-CwFb5S2b.mjs';
40
- import 'http';
41
- import 'util';
42
- import 'inquirer';
43
- import 'node:url';
44
- import 'node:readline/promises';
45
- import 'node:util';
46
- import 'url';
47
- import 'node-pty';
48
-
49
- const ACTIONS_NEEDING_ID = /* @__PURE__ */ new Set(["read", "stop", "archive"]);
50
- function parseSessionsArgs(args) {
51
- const options = { action: "help", json: false };
52
- let actionSeen = false;
53
- const positionals = [];
54
- for (let i = 0; i < args.length; i++) {
55
- const arg = args[i];
56
- if (arg === "--help" || arg === "-h") {
57
- return { action: "help", json: false };
58
- } else if (arg === "--json") {
59
- options.json = true;
60
- } else if (arg === "--tag") {
61
- const value = args[++i];
62
- if (value === void 0) throw new Error("--tag requires a value");
63
- options.tag = value;
64
- } else if (arg === "--limit") {
65
- const value = args[++i];
66
- if (value === void 0) throw new Error("--limit requires a value");
67
- const parsed = Number(value);
68
- if (!Number.isInteger(parsed) || parsed < 1) throw new Error("--limit must be a positive integer");
69
- options.limit = parsed;
70
- } else if (arg.startsWith("-")) {
71
- throw new Error(`Unknown argument: ${arg}`);
72
- } else if (!actionSeen) {
73
- if (arg !== "list" && arg !== "read" && arg !== "stop" && arg !== "archive") {
74
- throw new Error(`Unknown action: ${arg} (expected list, read, stop or archive)`);
75
- }
76
- options.action = arg;
77
- actionSeen = true;
78
- } else {
79
- positionals.push(arg);
80
- }
81
- }
82
- if (!actionSeen) return { action: "help", json: false };
83
- if (positionals.length > 1) throw new Error(`Unexpected extra argument: ${positionals[1]}`);
84
- if (ACTIONS_NEEDING_ID.has(options.action)) {
85
- const id = positionals[0];
86
- if (id === void 0) throw new Error(`${options.action} requires a session id`);
87
- if (!isValidSessionId(id)) throw new Error(`Invalid session id: ${id}`);
88
- options.sessionId = id;
89
- } else if (positionals.length > 0) {
90
- throw new Error(`Unexpected argument: ${positionals[0]}`);
91
- }
92
- if (options.action !== "list" && options.tag !== void 0) {
93
- throw new Error("--tag only applies to `sessions list`");
94
- }
95
- return options;
96
- }
97
- const SESSIONS_HELP = `
98
- ${chalk.bold("very-happy sessions")} - Inspect and control sessions on this machine (for automation)
99
-
100
- ${chalk.bold("Usage:")}
101
- very-happy sessions list [--tag <name>] [--limit <n>] [--json]
102
- very-happy sessions read <id> [--limit <n>] [--json]
103
- very-happy sessions stop <id> [--json]
104
- very-happy sessions archive <id> [--json]
105
-
106
- ${chalk.bold("Actions:")}
107
- list Running sessions plus recently seen ones, newest first.
108
- read The tail of a session as a role-tagged transcript.
109
- stop SIGTERM the session's process via the local daemon.
110
- archive Mark the session inactive server-side (it stays resumable).
111
-
112
- ${chalk.bold("Options:")}
113
- --tag <name> list only: keep sessions carrying this origin tag (see
114
- \`spawn --spawned-by\`).
115
- --limit <n> list: how many NOT-running sessions to include (default ${DEFAULT_RECENT_LIMIT};
116
- running ones are never cut). read: how many messages
117
- (default 20, max ${MAX_READ_LIMIT}).
118
- --json Machine-readable output.
119
- -h, --help Show this help
120
-
121
- ${chalk.bold("Scope:")}
122
- This machine only. Reads need the session key from ~/.happy/sessions.json,
123
- which exists for sessions this machine's daemon spawned and is pruned after
124
- 14 days. A session on another machine cannot be read or stopped from here.
125
-
126
- ${chalk.bold("Exit codes:")}
127
- 0 success
128
- 1 bad arguments, unknown session, no local key, or the operation failed
129
- (including \`stop\` on a session the daemon is not running)
130
- `;
131
- function formatSummaryLine(summary) {
132
- const parts = [summary.id, summary.live ? "[running]" : "[not running]"];
133
- if (summary.title) parts.push(`title="${summary.title}"`);
134
- if (summary.flavor) parts.push(`agent=${summary.flavor}`);
135
- if (summary.tags?.length) parts.push(`tags=${summary.tags.join(",")}`);
136
- if (summary.variant) parts.push(`variant=${summary.variant}`);
137
- if (summary.cwd) parts.push(`cwd=${summary.cwd}`);
138
- if (summary.pid !== void 0) parts.push(`pid=${summary.pid}`);
139
- parts.push(summary.url);
140
- return parts.join(" ");
141
- }
142
- async function handleSessionsCommand(args) {
143
- let options;
144
- try {
145
- options = parseSessionsArgs(args);
146
- } catch (error) {
147
- console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
148
- console.error(`Run ${chalk.cyan("very-happy sessions --help")} for usage.`);
149
- process.exit(1);
150
- }
151
- if (options.action === "help") {
152
- console.log(SESSIONS_HELP);
153
- process.exit(0);
154
- }
155
- try {
156
- if (options.action === "list") {
157
- const sessions = await listSessions({ tag: options.tag, recentLimit: options.limit });
158
- if (options.json) {
159
- console.log(JSON.stringify({ sessions }));
160
- } else if (sessions.length === 0) {
161
- console.log(options.tag ? `No sessions tagged "${options.tag}" on this machine.` : "No sessions found on this machine.");
162
- } else {
163
- for (const summary of sessions) console.log(formatSummaryLine(summary));
164
- }
165
- process.exit(0);
166
- }
167
- const sessionId = options.sessionId;
168
- if (options.action === "read") {
169
- const result = await readSessionTranscript(sessionId, options.limit ?? 20);
170
- if (options.json) {
171
- console.log(JSON.stringify(result));
172
- } else {
173
- console.log(formatSummaryLine(result.summary));
174
- console.log(`--- last ${result.messageCount} message(s) ---`);
175
- console.log(result.transcript.length > 0 ? result.transcript : "(no readable conversation content in this range)");
176
- }
177
- process.exit(0);
178
- }
179
- if (options.action === "stop") {
180
- const stopped = await stopSession(sessionId);
181
- if (!stopped) {
182
- if (options.json) console.log(JSON.stringify({ sessionId, stopped: false }));
183
- console.error(chalk.red("Error:"), `Session ${sessionId} is not among the daemon's running sessions.`);
184
- process.exit(1);
185
- }
186
- if (options.json) console.log(JSON.stringify({ sessionId, stopped: true }));
187
- else console.log(`Stopped ${sessionId}`);
188
- process.exit(0);
189
- }
190
- await archiveSession(sessionId);
191
- if (options.json) console.log(JSON.stringify({ sessionId, archived: true }));
192
- else console.log(`Archived ${sessionId}`);
193
- process.exit(0);
194
- } catch (error) {
195
- console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
196
- process.exit(1);
197
- }
198
- }
199
-
200
- export { SESSIONS_HELP, handleSessionsCommand, parseSessionsArgs };