very-happy-cli 0.2.154 → 0.2.155

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 (55) hide show
  1. package/dist/{AcpBackend-Ckyadhf4.mjs → AcpBackend-DVB0nzgR.mjs} +2 -2
  2. package/dist/{AcpBackend-B14xNj5L.cjs → AcpBackend-DmFcRh54.cjs} +3 -3
  3. package/dist/{AcpSessionManager-CCHmPdrR.cjs → AcpSessionManager-CWaSYTnT.cjs} +1 -1
  4. package/dist/{AcpSessionManager-H8t4P-IW.mjs → AcpSessionManager-dGDgNb-p.mjs} +1 -1
  5. package/dist/agentGuidance-BWxFC6UL.mjs +1613 -0
  6. package/dist/agentGuidance-un7YPryB.cjs +1665 -0
  7. package/dist/{agentHome-B20RWdgE.mjs → agentHome-ByLb2HFg.mjs} +5 -5
  8. package/dist/{agentHome-BUsLTZnz.cjs → agentHome-aucT8BHw.cjs} +5 -5
  9. package/dist/{auto-BQnncDcs.mjs → auto-BQnD6gVx.mjs} +21 -21
  10. package/dist/{auto-IeldARBS.cjs → auto-P9RoJaY0.cjs} +24 -24
  11. package/dist/codex/happyMcpStdioBridge.cjs +6 -3
  12. package/dist/codex/happyMcpStdioBridge.mjs +6 -3
  13. package/dist/{config-B-ocQh5V.mjs → config-BPZ2Y6o8.mjs} +8 -8
  14. package/dist/{config-DM_xI9M6.cjs → config-BoePh9PX.cjs} +8 -8
  15. package/dist/{index-okLyUzeD.cjs → index--KCpVs1c.cjs} +7 -7
  16. package/dist/{index-BELV05ko.mjs → index-B4oXnbYw.mjs} +463 -889
  17. package/dist/{index-ZKuBjvHi.mjs → index-BjzdXb9x.mjs} +21 -13
  18. package/dist/{index-BUxBxSxJ.cjs → index-DRrLaljt.cjs} +21 -13
  19. package/dist/{index-CIx3248o.mjs → index-DVVRqaVG.mjs} +7 -7
  20. package/dist/{index-eCjkm8Y2.cjs → index-D_fYUxVg.cjs} +521 -960
  21. package/dist/index.cjs +6 -6
  22. package/dist/index.mjs +6 -6
  23. package/dist/{install-BZOdxfPd.cjs → install-CGigiocs.cjs} +1 -1
  24. package/dist/{install-CoLN3whR.mjs → install-DP5aPNEX.mjs} +1 -1
  25. package/dist/{installTerminalHooks-CA4OcAS7.cjs → installTerminalHooks-XrcPvfBs.cjs} +5 -5
  26. package/dist/{installTerminalHooks-Dde_8t36.mjs → installTerminalHooks-tIg7mANc.mjs} +5 -5
  27. package/dist/lib.cjs +2 -2
  28. package/dist/lib.mjs +2 -2
  29. package/dist/{limits-Dt7_unH4.mjs → limits-C_DW0M0q.mjs} +309 -13
  30. package/dist/{limits-CmzISka2.cjs → limits-DkfHJ3nS.cjs} +329 -12
  31. package/dist/{mcp-7iDHlyCI.cjs → mcp-BqlXl10F.cjs} +23 -23
  32. package/dist/{mcp-9Ui4nQZL.mjs → mcp-o7QglAQM.mjs} +17 -17
  33. package/dist/{piRuntime-BesGGPME.cjs → piRuntime-BxP4B_zY.cjs} +2 -2
  34. package/dist/{piRuntime-C4E4pgye.mjs → piRuntime-MjiJI-nV.mjs} +2 -2
  35. package/dist/{piTerminal-fUogwxYr.cjs → piTerminal-DYzRcwgb.cjs} +6 -6
  36. package/dist/{piTerminal-CCEGCQOY.mjs → piTerminal-Dpq6yqKU.mjs} +6 -6
  37. package/dist/{runGemini-CNPGSsSK.cjs → runGemini-8Pxh94Fm.cjs} +7 -7
  38. package/dist/{runGemini-BW-pEklU.mjs → runGemini-CDlcQ-OA.mjs} +6 -6
  39. package/dist/{runOpenClaw-Bsodkg_s.cjs → runOpenClaw-B5FSZIbK.cjs} +6 -6
  40. package/dist/{runOpenClaw-NRB6-_jU.mjs → runOpenClaw-YkhsgPs0.mjs} +5 -5
  41. package/dist/{send-Bd00QcHC.cjs → send-CwrYXTPr.cjs} +8 -42
  42. package/dist/{send-DYeSFg8s.mjs → send-DJStmLBv.mjs} +5 -39
  43. package/dist/{sessions-DlPOYKLU.mjs → sessions-JaVXlSqj.mjs} +88 -45
  44. package/dist/{sessions-RIFUoy_g.cjs → sessions-MX21NJXd.cjs} +99 -56
  45. package/dist/{spawn-D1bhyHbH.mjs → spawn-BaPnjClT.mjs} +22 -22
  46. package/dist/{spawn-DxrfHTF4.cjs → spawn-cIoglKVf.cjs} +30 -30
  47. package/dist/{teams-pfKHpkgL.mjs → teams-DXV5Pwwt.mjs} +8 -8
  48. package/dist/{teams-Cfy0VMCo.cjs → teams-Dqk7F3D-.cjs} +8 -8
  49. package/dist/{todo-B2CjDg_V.mjs → todo-2Z1REhfx.mjs} +8 -6
  50. package/dist/{todo-B4cBFzHB.cjs → todo-Buuqn9gm.cjs} +8 -6
  51. package/dist/{types-D5RWyBE5.mjs → types-CkbfdRzq.mjs} +4 -282
  52. package/dist/{types-Bd_TGr0F.cjs → types-a2xsH2UI.cjs} +16 -311
  53. package/package.json +7 -7
  54. package/dist/agentGuidance-DUBXppv-.cjs +0 -554
  55. package/dist/agentGuidance-TLYQxsm2.mjs +0 -530
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
 
3
+ var z = require('zod');
4
+ var cuid2 = require('@paralleldrive/cuid2');
3
5
  var promises = require('node:fs/promises');
4
6
  var node_fs = require('node:fs');
5
- var os = require('node:os');
6
- var path = require('node:path');
7
- var z = require('zod');
8
7
  var node_crypto = require('node:crypto');
9
8
  var tweetnacl = require('tweetnacl');
10
9
  var chalk = require('chalk');
11
10
  var node_util = require('node:util');
12
- var cuid2 = require('@paralleldrive/cuid2');
11
+ var os = require('node:os');
12
+ var path = require('node:path');
13
13
 
14
14
  function _interopNamespaceDefault(e) {
15
15
  var n = Object.create(null);
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
  var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
32
32
 
33
33
  var name = "very-happy-cli";
34
- var version = "0.2.154";
34
+ var version = "0.2.155";
35
35
  var description = "Remote multi-agent workspace CLI with deep Claude integration, native terminal streaming, and self-hosting.";
36
36
  var author = "Kirill Dubovitskiy";
37
37
  var contributors = [
@@ -148,12 +148,12 @@ var dependencies = {
148
148
  zod: "^4.0.0"
149
149
  };
150
150
  var optionalDependencies = {
151
- "very-happy-tools-arm64-darwin": "0.2.154",
152
- "very-happy-tools-x64-darwin": "0.2.154",
153
- "very-happy-tools-arm64-linux": "0.2.154",
154
- "very-happy-tools-x64-linux": "0.2.154",
155
- "very-happy-tools-arm64-win32": "0.2.154",
156
- "very-happy-tools-x64-win32": "0.2.154"
151
+ "very-happy-tools-arm64-darwin": "0.2.155",
152
+ "very-happy-tools-x64-darwin": "0.2.155",
153
+ "very-happy-tools-arm64-linux": "0.2.155",
154
+ "very-happy-tools-x64-linux": "0.2.155",
155
+ "very-happy-tools-arm64-win32": "0.2.155",
156
+ "very-happy-tools-x64-win32": "0.2.155"
157
157
  };
158
158
  var devDependencies = {
159
159
  "@slopus/happy-wire": "workspace:*",
@@ -2062,6 +2062,302 @@ function getAgentCodeDefaults(flavor) {
2062
2062
  return AGENT_CODE_DEFAULTS[normalizeAgentKey(flavor)];
2063
2063
  }
2064
2064
 
2065
+ const SESSION_ID_RE = /^[a-zA-Z0-9_-]{1,128}$/;
2066
+ const TERMINAL_ID_RE = /^[a-zA-Z0-9_-]{1,64}$/;
2067
+ function isValidSessionId(id) {
2068
+ return typeof id === "string" && SESSION_ID_RE.test(id);
2069
+ }
2070
+ function isValidTerminalId(id) {
2071
+ return typeof id === "string" && TERMINAL_ID_RE.test(id);
2072
+ }
2073
+
2074
+ function daemonControlHeaders(controlToken) {
2075
+ return {
2076
+ "Content-Type": "application/json",
2077
+ ...controlToken ? { Authorization: `Bearer ${controlToken}` } : {}
2078
+ };
2079
+ }
2080
+ async function daemonPost(path, body) {
2081
+ const state = await readDaemonState();
2082
+ if (!state?.httpPort) {
2083
+ const errorMessage = "No daemon running, no state file found";
2084
+ logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
2085
+ return {
2086
+ error: errorMessage
2087
+ };
2088
+ }
2089
+ try {
2090
+ process.kill(state.pid, 0);
2091
+ } catch (error) {
2092
+ const errorMessage = "Daemon is not running, file is stale";
2093
+ logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
2094
+ return {
2095
+ error: errorMessage
2096
+ };
2097
+ }
2098
+ try {
2099
+ const timeout = process.env.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 1e4;
2100
+ const response = await fetch(`http://127.0.0.1:${state.httpPort}${path}`, {
2101
+ method: "POST",
2102
+ // A state written by an old daemon has no token and must remain callable;
2103
+ // a new daemon always writes one and rejects requests without it.
2104
+ headers: daemonControlHeaders(state.controlToken),
2105
+ body: JSON.stringify(body || {}),
2106
+ // Mostly increased for stress test
2107
+ signal: AbortSignal.timeout(timeout)
2108
+ });
2109
+ if (!response.ok) {
2110
+ const failure = await response.json().catch(() => null);
2111
+ const reason = typeof failure?.error === "string" && failure.error ? failure.error : `HTTP ${response.status}`;
2112
+ const errorMessage = `Request failed: ${path}, ${reason}`;
2113
+ logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
2114
+ return {
2115
+ error: errorMessage
2116
+ };
2117
+ }
2118
+ return await response.json();
2119
+ } catch (error) {
2120
+ const errorMessage = `Request failed: ${path}, ${error instanceof Error ? error.message : "Unknown error"}`;
2121
+ logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
2122
+ return {
2123
+ error: errorMessage
2124
+ };
2125
+ }
2126
+ }
2127
+ const SESSION_STARTED_RETRY_TIMEOUT_MS = 3e3;
2128
+ const SESSION_STARTED_RETRY_INTERVAL_MS = 100;
2129
+ async function notifyDaemonSessionStarted(sessionId, metadata, encryption) {
2130
+ const payload = { sessionId, metadata, encryption };
2131
+ const deadline = Date.now() + SESSION_STARTED_RETRY_TIMEOUT_MS;
2132
+ let result;
2133
+ while (true) {
2134
+ result = await daemonPost("/session-started", payload);
2135
+ if (!result?.error) {
2136
+ return result;
2137
+ }
2138
+ if (Date.now() >= deadline) {
2139
+ return result;
2140
+ }
2141
+ await new Promise((resolve) => setTimeout(resolve, SESSION_STARTED_RETRY_INTERVAL_MS));
2142
+ }
2143
+ }
2144
+ async function listDaemonSessions() {
2145
+ const result = await daemonPost("/list");
2146
+ return result.children || [];
2147
+ }
2148
+ async function stopDaemonSession(sessionId) {
2149
+ const result = await daemonPost("/stop-session", { sessionId });
2150
+ return result.success || false;
2151
+ }
2152
+ async function spawnDaemonSession(directory, sessionId, opts) {
2153
+ const result = await daemonPost("/spawn-session", {
2154
+ directory,
2155
+ sessionId,
2156
+ spawnedBy: opts?.spawnedBy,
2157
+ permissionMode: opts?.permissionMode,
2158
+ agent: opts?.agent,
2159
+ environmentVariables: opts?.environmentVariables,
2160
+ resumeClaudeSessionId: opts?.resumeClaudeSessionId,
2161
+ resumeCodexThreadId: opts?.resumeCodexThreadId,
2162
+ parentSessionId: opts?.parentSessionId
2163
+ });
2164
+ return result;
2165
+ }
2166
+ const ROUTE_NOT_FOUND_RE = /, (Not Found|HTTP 404)$/;
2167
+ async function resumeDaemonSession(sessionId, opts) {
2168
+ const result = await daemonPost("/resume-session", {
2169
+ sessionId,
2170
+ ...opts?.model !== void 0 ? { model: opts.model } : {},
2171
+ ...opts?.permissionMode !== void 0 ? { permissionMode: opts.permissionMode } : {}
2172
+ });
2173
+ if (result?.error) {
2174
+ const raw = String(result.error);
2175
+ const error = ROUTE_NOT_FOUND_RE.test(raw) ? "daemon too old to resume sessions (no /resume-session route); upgrade very-happy-cli and run `very-happy daemon start`" : raw.replace(/^Request failed: \/resume-session, /, "");
2176
+ return { success: false, error };
2177
+ }
2178
+ if (result?.success === true && typeof result.sessionId === "string") {
2179
+ return { success: true, sessionId: result.sessionId };
2180
+ }
2181
+ return { success: false, error: typeof result?.error === "string" ? result.error : "unexpected daemon response" };
2182
+ }
2183
+ async function notifyDaemonSessionEvent(sessionId, event, spawnedBy) {
2184
+ return daemonPost("/session-event", { sessionId, event, spawnedBy });
2185
+ }
2186
+ async function notifyDaemonClaudeAuthFailed(sessionId) {
2187
+ return daemonPost("/session-event", { sessionId, event: "auth_failed" });
2188
+ }
2189
+ async function notifyDaemonTurnEvent(sessionId, event) {
2190
+ return daemonPost("/session-event", { sessionId, event });
2191
+ }
2192
+ function reportSessionEditToDaemon(edit) {
2193
+ void daemonPost("/session-edit", edit).then((result) => {
2194
+ if (result?.error) logger.debug(`[CONTROL CLIENT] session-edit not recorded: ${result.error}`);
2195
+ }).catch((error) => {
2196
+ logger.debug("[CONTROL CLIENT] session-edit failed:", error);
2197
+ });
2198
+ }
2199
+ async function listDaemonPeers() {
2200
+ const result = await daemonPost("/peers");
2201
+ if (result?.error) {
2202
+ const reason = String(result.error);
2203
+ if (/404|Not Found/i.test(reason)) {
2204
+ throw new Error("The running daemon does not support session peers; restart it on a CLI that does (`very-happy daemon start` after updating)");
2205
+ }
2206
+ throw new Error(reason);
2207
+ }
2208
+ return Array.isArray(result?.sessions) ? result.sessions : [];
2209
+ }
2210
+ async function stopDaemonHttp() {
2211
+ await daemonPost("/stop");
2212
+ }
2213
+ async function pushClipboardViaDaemon(text, terminalId) {
2214
+ const result = await daemonPost("/clipboard", { text, ...terminalId ? { terminalId } : {} });
2215
+ if (result?.error && result.delivered === void 0) {
2216
+ return { delivered: false, error: result.error };
2217
+ }
2218
+ return result;
2219
+ }
2220
+ async function pushFilePreviewViaDaemon(terminalId, path, mode = "file") {
2221
+ const result = await daemonPost("/file-preview", { terminalId, path, mode });
2222
+ if (result?.error) return { delivered: false, error: result.error };
2223
+ return { delivered: result?.delivered === true, ...result?.delivered === true ? {} : { error: "preview was not delivered" } };
2224
+ }
2225
+ async function setTerminalTitleViaDaemon(terminalId, title, ifAbsent = false) {
2226
+ const result = await daemonPost("/terminal-title", { terminalId, title, ifAbsent });
2227
+ if (result?.error) {
2228
+ return { ok: false, error: result.error };
2229
+ }
2230
+ return { ok: result?.status === "ok", error: result?.status === "ok" ? void 0 : "unexpected daemon response" };
2231
+ }
2232
+ async function checkIfDaemonRunningAndCleanupStaleState() {
2233
+ const state = await readDaemonState();
2234
+ if (!state) {
2235
+ return false;
2236
+ }
2237
+ try {
2238
+ process.kill(state.pid, 0);
2239
+ } catch {
2240
+ logger.debug("[DAEMON RUN] Daemon PID not running, cleaning up state");
2241
+ await cleanupDaemonState();
2242
+ return false;
2243
+ }
2244
+ if (state.httpPort) {
2245
+ try {
2246
+ const response = await fetch(`http://127.0.0.1:${state.httpPort}/list`, {
2247
+ method: "POST",
2248
+ headers: daemonControlHeaders(state.controlToken),
2249
+ body: "{}",
2250
+ signal: AbortSignal.timeout(2e3)
2251
+ });
2252
+ if (response.ok) {
2253
+ return true;
2254
+ }
2255
+ } catch {
2256
+ logger.debug(`[DAEMON RUN] PID ${state.pid} is alive but HTTP health check failed on port ${state.httpPort}, cleaning up stale state`);
2257
+ await cleanupDaemonState();
2258
+ return false;
2259
+ }
2260
+ }
2261
+ return true;
2262
+ }
2263
+ async function isDaemonRunningCurrentlyInstalledHappyVersion() {
2264
+ logger.debug("[DAEMON CONTROL] Checking if daemon is running same version");
2265
+ const runningDaemon = await checkIfDaemonRunningAndCleanupStaleState();
2266
+ if (!runningDaemon) {
2267
+ logger.debug("[DAEMON CONTROL] No daemon running, returning false");
2268
+ return false;
2269
+ }
2270
+ const state = await readDaemonState();
2271
+ if (!state) {
2272
+ logger.debug("[DAEMON CONTROL] No daemon state found, returning false");
2273
+ return false;
2274
+ }
2275
+ const currentCliVersion = configuration.currentCliVersion;
2276
+ logger.debug(`[DAEMON CONTROL] Current CLI version: ${currentCliVersion}, Daemon started with version: ${state.startedWithCliVersion}`);
2277
+ return currentCliVersion === state.startedWithCliVersion;
2278
+ }
2279
+ async function cleanupDaemonState() {
2280
+ try {
2281
+ await clearDaemonState();
2282
+ logger.debug("[DAEMON RUN] Daemon state file removed");
2283
+ } catch (error) {
2284
+ logger.debug("[DAEMON RUN] Error cleaning up daemon metadata", error);
2285
+ }
2286
+ }
2287
+ async function stopDaemon() {
2288
+ try {
2289
+ const state = await readDaemonState();
2290
+ if (!state) {
2291
+ logger.debug("No daemon state found");
2292
+ return;
2293
+ }
2294
+ logger.debug(`Stopping daemon with PID ${state.pid}`);
2295
+ try {
2296
+ await stopDaemonHttp();
2297
+ await waitForProcessDeath(state.pid, 2e3);
2298
+ logger.debug("Daemon stopped gracefully via HTTP");
2299
+ return;
2300
+ } catch (error) {
2301
+ logger.debug("HTTP stop failed, will force kill", error);
2302
+ }
2303
+ try {
2304
+ process.kill(state.pid, "SIGKILL");
2305
+ logger.debug("Force killed daemon");
2306
+ } catch (error) {
2307
+ logger.debug("Daemon already dead");
2308
+ }
2309
+ } catch (error) {
2310
+ logger.debug("Error stopping daemon", error);
2311
+ }
2312
+ }
2313
+ async function waitForProcessDeath(pid, timeout) {
2314
+ const start = Date.now();
2315
+ while (Date.now() - start < timeout) {
2316
+ try {
2317
+ process.kill(pid, 0);
2318
+ await new Promise((resolve) => setTimeout(resolve, 100));
2319
+ } catch {
2320
+ return;
2321
+ }
2322
+ }
2323
+ throw new Error("Process did not die within timeout");
2324
+ }
2325
+
2326
+ async function delay(ms) {
2327
+ return new Promise((resolve) => setTimeout(resolve, ms));
2328
+ }
2329
+ function exponentialBackoffDelay(currentFailureCount, minDelay, maxDelay, maxFailureCount) {
2330
+ let maxDelayRet = minDelay + (maxDelay - minDelay) / maxFailureCount * Math.min(currentFailureCount, maxFailureCount);
2331
+ return Math.round(Math.random() * maxDelayRet);
2332
+ }
2333
+ function createBackoff(opts) {
2334
+ return async (callback) => {
2335
+ let currentFailureCount = 0;
2336
+ const minDelay = opts && opts.minDelay !== void 0 ? opts.minDelay : 250;
2337
+ const maxDelay = opts && opts.maxDelay !== void 0 ? opts.maxDelay : 1e3;
2338
+ const maxFailureCount = opts && opts.maxFailureCount !== void 0 ? opts.maxFailureCount : 50;
2339
+ while (true) {
2340
+ try {
2341
+ return await callback();
2342
+ } catch (e) {
2343
+ if (currentFailureCount < maxFailureCount) {
2344
+ currentFailureCount++;
2345
+ }
2346
+ if (opts && opts.onError) {
2347
+ opts.onError(e, currentFailureCount);
2348
+ }
2349
+ let waitForRequest = exponentialBackoffDelay(currentFailureCount, minDelay, maxDelay, maxFailureCount);
2350
+ await delay(waitForRequest);
2351
+ }
2352
+ }
2353
+ };
2354
+ }
2355
+ let backoff = createBackoff({
2356
+ onError: (e, failuresCount) => {
2357
+ logger.debug(`[BACKOFF] retry ${failuresCount}:`, e?.message || e);
2358
+ }
2359
+ });
2360
+
2065
2361
  const CLIPBOARD_MAX_BYTES = 256 * 1024;
2066
2362
  const CLIPBOARD_HISTORY_MAX_BYTES = 32 * 1024;
2067
2363
  const CLIPBOARD_TOOL_NAME = "copy_to_clipboard";
@@ -2120,8 +2416,10 @@ exports.ReleaseDrainNoticeSchema = ReleaseDrainNoticeSchema;
2120
2416
  exports.STREAM_DELTA_MAX_CHARS = STREAM_DELTA_MAX_CHARS;
2121
2417
  exports.SandboxConfigSchema = SandboxConfigSchema;
2122
2418
  exports.acquireDaemonLock = acquireDaemonLock;
2419
+ exports.backoff = backoff;
2420
+ exports.checkIfDaemonRunningAndCleanupStaleState = checkIfDaemonRunningAndCleanupStaleState;
2421
+ exports.cleanupDaemonState = cleanupDaemonState;
2123
2422
  exports.clearCredentials = clearCredentials;
2124
- exports.clearDaemonState = clearDaemonState;
2125
2423
  exports.clearMachineId = clearMachineId;
2126
2424
  exports.configuration = configuration;
2127
2425
  exports.createBuiltinTodoClient = createBuiltinTodoClient;
@@ -2132,12 +2430,14 @@ exports.decrypt = decrypt;
2132
2430
  exports.decryptBlob = decryptBlob;
2133
2431
  exports.decryptLegacy = decryptLegacy;
2134
2432
  exports.decryptWithDataKey = decryptWithDataKey;
2433
+ exports.delay = delay;
2135
2434
  exports.deletePersistedSessions = deletePersistedSessions;
2136
2435
  exports.encodeBase64 = encodeBase64;
2137
2436
  exports.encodeBase64Url = encodeBase64Url;
2138
2437
  exports.encrypt = encrypt;
2139
2438
  exports.ensurePrivateDirectory = ensurePrivateDirectory;
2140
2439
  exports.ensurePrivateDirectorySync = ensurePrivateDirectorySync;
2440
+ exports.exponentialBackoffDelay = exponentialBackoffDelay;
2141
2441
  exports.getAgentCodeDefaults = getAgentCodeDefaults;
2142
2442
  exports.getLatestDaemonLog = getLatestDaemonLog;
2143
2443
  exports.getRandomBytes = getRandomBytes;
@@ -2145,16 +2445,27 @@ exports.hardenPrivateFile = hardenPrivateFile;
2145
2445
  exports.hardenPrivateFileSync = hardenPrivateFileSync;
2146
2446
  exports.isAutomationRunTerminal = isAutomationRunTerminal;
2147
2447
  exports.isClaudeOpus55Model = isClaudeOpus55Model;
2448
+ exports.isDaemonRunningCurrentlyInstalledHappyVersion = isDaemonRunningCurrentlyInstalledHappyVersion;
2449
+ exports.isValidSessionId = isValidSessionId;
2450
+ exports.isValidTerminalId = isValidTerminalId;
2148
2451
  exports.libsodiumEncryptForPublicKey = libsodiumEncryptForPublicKey;
2149
2452
  exports.libsodiumPublicKeyFromSecretKey = libsodiumPublicKeyFromSecretKey;
2453
+ exports.listDaemonPeers = listDaemonPeers;
2454
+ exports.listDaemonSessions = listDaemonSessions;
2150
2455
  exports.logger = logger;
2151
2456
  exports.normalizeAgentKey = normalizeAgentKey;
2152
2457
  exports.normalizeHttpEndpoint = normalizeHttpEndpoint;
2458
+ exports.notifyDaemonClaudeAuthFailed = notifyDaemonClaudeAuthFailed;
2459
+ exports.notifyDaemonSessionEvent = notifyDaemonSessionEvent;
2460
+ exports.notifyDaemonSessionStarted = notifyDaemonSessionStarted;
2461
+ exports.notifyDaemonTurnEvent = notifyDaemonTurnEvent;
2153
2462
  exports.packageJson = packageJson;
2154
2463
  exports.persistSession = persistSession;
2155
2464
  exports.persistence = persistence;
2156
2465
  exports.prepareClipboardHistoryText = prepareClipboardHistoryText;
2157
2466
  exports.prepareClipboardText = prepareClipboardText;
2467
+ exports.pushClipboardViaDaemon = pushClipboardViaDaemon;
2468
+ exports.pushFilePreviewViaDaemon = pushFilePreviewViaDaemon;
2158
2469
  exports.readCredentials = readCredentials;
2159
2470
  exports.readCredentialsForConfiguredRelay = readCredentialsForConfiguredRelay;
2160
2471
  exports.readDaemonState = readDaemonState;
@@ -2165,6 +2476,12 @@ exports.readTrackedClaudeSessionIds = readTrackedClaudeSessionIds;
2165
2476
  exports.readTrackedCodexThreadIds = readTrackedCodexThreadIds;
2166
2477
  exports.redactLogValue = redactLogValue;
2167
2478
  exports.releaseDaemonLock = releaseDaemonLock;
2479
+ exports.reportSessionEditToDaemon = reportSessionEditToDaemon;
2480
+ exports.resumeDaemonSession = resumeDaemonSession;
2481
+ exports.setTerminalTitleViaDaemon = setTerminalTitleViaDaemon;
2482
+ exports.spawnDaemonSession = spawnDaemonSession;
2483
+ exports.stopDaemon = stopDaemon;
2484
+ exports.stopDaemonSession = stopDaemonSession;
2168
2485
  exports.streamKeyOf = streamKeyOf;
2169
2486
  exports.supportsClaudeOpus55 = supportsClaudeOpus55;
2170
2487
  exports.updateSettings = updateSettings;
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var agentGuidance = require('./agentGuidance-DUBXppv-.cjs');
3
+ var agentGuidance = require('./agentGuidance-un7YPryB.cjs');
4
4
  var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
5
5
  var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
6
6
  var z = require('zod');
7
- var index = require('./types-Bd_TGr0F.cjs');
8
- var persistence = require('./limits-CmzISka2.cjs');
9
- var index$1 = require('./index-eCjkm8Y2.cjs');
7
+ var persistence = require('./limits-DkfHJ3nS.cjs');
8
+ var index = require('./index-D_fYUxVg.cjs');
10
9
  require('node:fs/promises');
11
10
  require('node:os');
12
11
  require('node:crypto');
@@ -14,29 +13,28 @@ require('axios');
14
13
  require('tweetnacl');
15
14
  require('socket.io-client');
16
15
  require('node:child_process');
16
+ require('./types-a2xsH2UI.cjs');
17
17
  require('node:fs');
18
18
  require('node:path');
19
19
  var terminalTitleSuggest = require('./terminalTitleSuggest-Dji8I0Jy.cjs');
20
20
  var terminalToolContext = require('./terminalToolContext-DoV9Gs7K.cjs');
21
- require('node:events');
22
- require('child_process');
23
- require('util');
24
- require('fs/promises');
25
- require('crypto');
26
- require('path');
27
- require('cross-spawn');
28
- require('os');
29
21
  require('@paralleldrive/cuid2');
30
- require('node-pty');
31
- require('fs');
32
- require('node:readline');
33
- require('@anthropic-ai/sandbox-runtime');
34
- require('expo-server-sdk');
35
22
  require('chalk');
36
23
  require('node:util');
24
+ require('cross-spawn');
25
+ require('node:readline');
26
+ require('fs/promises');
37
27
  require('ink');
38
28
  require('react');
39
29
  require('@anthropic-ai/claude-agent-sdk');
30
+ require('node:events');
31
+ require('os');
32
+ require('child_process');
33
+ require('fs');
34
+ require('path');
35
+ require('@anthropic-ai/sandbox-runtime');
36
+ require('expo-server-sdk');
37
+ require('crypto');
40
38
  require('ps-list');
41
39
  require('tmp');
42
40
  require('open');
@@ -46,9 +44,11 @@ require('node:module');
46
44
  require('node:http');
47
45
  require('@modelcontextprotocol/sdk/server/streamableHttp.js');
48
46
  require('http');
47
+ require('util');
49
48
  require('inquirer');
50
49
  require('node:url');
51
50
  require('node:readline/promises');
51
+ require('node-pty');
52
52
  require('url');
53
53
 
54
54
  const TERMINAL_TITLE_TOOL_NAME = "change_title";
@@ -61,7 +61,7 @@ function resolveMcpToolSurface(env) {
61
61
  function registerTerminalTitleSuggest(server) {
62
62
  server.server.setRequestHandler(terminalTitleSuggest.TerminalTitleSuggestRequestSchema, async (request) => {
63
63
  persistence.logger.debug("[MCP] terminal title suggestion requested");
64
- return { title: await index$1.suggestTitleForPrompt(request.params.prompt) };
64
+ return { title: await index.suggestTitleForPrompt(request.params.prompt) };
65
65
  });
66
66
  }
67
67
  function registerMcpTools(server, surface, terminalId = null) {
@@ -73,7 +73,7 @@ function registerMcpTools(server, surface, terminalId = null) {
73
73
  }
74
74
  }, async (args) => {
75
75
  persistence.logger.debug(`[MCP] copy_to_clipboard called (${args.text.length} chars)`);
76
- const result = await index.pushClipboardViaDaemon(args.text, terminalId ?? void 0);
76
+ const result = await persistence.pushClipboardViaDaemon(args.text, terminalId ?? void 0);
77
77
  if (result.delivered) {
78
78
  const note = result.truncated ? ` (truncated to ${persistence.CLIPBOARD_MAX_BYTES / 1024}KB \u2014 original was ${result.totalBytes} bytes)` : "";
79
79
  return {
@@ -101,9 +101,9 @@ function registerMcpTools(server, surface, terminalId = null) {
101
101
  mode: z.z.enum(["file", "diff"]).optional().describe("'file' (default) previews the file; 'diff' is reserved and currently falls back to 'file'")
102
102
  }
103
103
  }, async (args) => {
104
- const verdict = index$1.checkPreviewPath(args.path);
104
+ const verdict = index.checkPreviewPath(args.path);
105
105
  if (verdict.deniedReason) return { content: [{ type: "text", text: verdict.deniedReason }], isError: true };
106
- const result = await index.pushFilePreviewViaDaemon(terminalId, verdict.resolved, args.mode ?? "file");
106
+ const result = await persistence.pushFilePreviewViaDaemon(terminalId, verdict.resolved, args.mode ?? "file");
107
107
  return {
108
108
  content: [{ type: "text", text: result.delivered ? `Queued a preview request for ${verdict.resolved}. This does not confirm that a browser opened it.` : `Failed to request preview: ${result.error || "unknown error"}` }],
109
109
  isError: !result.delivered
@@ -117,7 +117,7 @@ function registerMcpTools(server, surface, terminalId = null) {
117
117
  }
118
118
  }, async (args) => {
119
119
  persistence.logger.debug(`[MCP] change_title called for terminal ${terminalId}`);
120
- const result = await index.setTerminalTitleViaDaemon(terminalId, args.title);
120
+ const result = await persistence.setTerminalTitleViaDaemon(terminalId, args.title);
121
121
  if (result.ok) {
122
122
  return {
123
123
  content: [{ type: "text", text: `Successfully changed terminal title to: "${args.title}"` }],
@@ -134,7 +134,7 @@ function registerMcpTools(server, surface, terminalId = null) {
134
134
  });
135
135
  }
136
136
  if (surface === "assistant" && !process.env.VH_TEAM_SCOPE_FILE) {
137
- index$1.registerAssistantSessionTools(server);
137
+ index.registerAssistantSessionTools(server);
138
138
  }
139
139
  }
140
140
  async function handleMcpCommand(terminalToolsOnly = false) {
@@ -1,10 +1,9 @@
1
- import { r as registerTeamsTools, P as PREVIEW_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION } from './agentGuidance-TLYQxsm2.mjs';
1
+ import { r as registerTeamsTools, P as PREVIEW_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION } from './agentGuidance-BWxFC6UL.mjs';
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
4
  import { z } from 'zod';
5
- import { l as pushClipboardViaDaemon, m as pushFilePreviewViaDaemon, n as setTerminalTitleViaDaemon } from './types-D5RWyBE5.mjs';
6
- import { l as logger, C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION, h as CLIPBOARD_MAX_BYTES } from './limits-Dt7_unH4.mjs';
7
- import { x as checkPreviewPath, y as registerAssistantSessionTools, z as suggestTitleForPrompt } from './index-BELV05ko.mjs';
5
+ import { l as logger, C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION, p as pushClipboardViaDaemon, o as CLIPBOARD_MAX_BYTES, q as pushFilePreviewViaDaemon, t as setTerminalTitleViaDaemon } from './limits-C_DW0M0q.mjs';
6
+ import { e as checkPreviewPath, f as registerAssistantSessionTools, g as suggestTitleForPrompt } from './index-B4oXnbYw.mjs';
8
7
  import 'node:fs/promises';
9
8
  import 'node:os';
10
9
  import 'node:crypto';
@@ -12,29 +11,28 @@ import 'axios';
12
11
  import 'tweetnacl';
13
12
  import 'socket.io-client';
14
13
  import 'node:child_process';
14
+ import './types-CkbfdRzq.mjs';
15
15
  import 'node:fs';
16
16
  import 'node:path';
17
17
  import { b as TerminalTitleSuggestRequestSchema } from './terminalTitleSuggest-DKgX3osW.mjs';
18
18
  import { r as resolveMcpTerminalId } from './terminalToolContext-CFeGeaNm.mjs';
19
- import 'node:events';
20
- import 'child_process';
21
- import 'util';
22
- import 'fs/promises';
23
- import 'crypto';
24
- import 'path';
25
- import 'cross-spawn';
26
- import 'os';
27
19
  import '@paralleldrive/cuid2';
28
- import 'node-pty';
29
- import 'fs';
30
- import 'node:readline';
31
- import '@anthropic-ai/sandbox-runtime';
32
- import 'expo-server-sdk';
33
20
  import 'chalk';
34
21
  import 'node:util';
22
+ import 'cross-spawn';
23
+ import 'node:readline';
24
+ import 'fs/promises';
35
25
  import 'ink';
36
26
  import 'react';
37
27
  import '@anthropic-ai/claude-agent-sdk';
28
+ import 'node:events';
29
+ import 'os';
30
+ import 'child_process';
31
+ import 'fs';
32
+ import 'path';
33
+ import '@anthropic-ai/sandbox-runtime';
34
+ import 'expo-server-sdk';
35
+ import 'crypto';
38
36
  import 'ps-list';
39
37
  import 'tmp';
40
38
  import 'open';
@@ -44,9 +42,11 @@ import 'node:module';
44
42
  import 'node:http';
45
43
  import '@modelcontextprotocol/sdk/server/streamableHttp.js';
46
44
  import 'http';
45
+ import 'util';
47
46
  import 'inquirer';
48
47
  import 'node:url';
49
48
  import 'node:readline/promises';
49
+ import 'node-pty';
50
50
  import 'url';
51
51
 
52
52
  const TERMINAL_TITLE_TOOL_NAME = "change_title";
@@ -3,8 +3,8 @@
3
3
  var promises = require('node:fs/promises');
4
4
  var node_crypto = require('node:crypto');
5
5
  var path = require('node:path');
6
- var persistence = require('./limits-CmzISka2.cjs');
7
- var index = require('./index-eCjkm8Y2.cjs');
6
+ var persistence = require('./limits-DkfHJ3nS.cjs');
7
+ var index = require('./index-D_fYUxVg.cjs');
8
8
 
9
9
  async function publish(path, content, mode) {
10
10
  const temporary = `${path}.${node_crypto.randomUUID()}.new`;
@@ -1,8 +1,8 @@
1
1
  import { mkdir, chmod, writeFile, rename } from 'node:fs/promises';
2
2
  import { randomUUID } from 'node:crypto';
3
3
  import { join } from 'node:path';
4
- import { c as configuration } from './limits-Dt7_unH4.mjs';
5
- import { P as PI_TEAMS_EXTENSION } from './index-BELV05ko.mjs';
4
+ import { c as configuration } from './limits-C_DW0M0q.mjs';
5
+ import { P as PI_TEAMS_EXTENSION } from './index-B4oXnbYw.mjs';
6
6
 
7
7
  async function publish(path, content, mode) {
8
8
  const temporary = `${path}.${randomUUID()}.new`;
@@ -5,21 +5,21 @@ var node_crypto = require('node:crypto');
5
5
  var node_http = require('node:http');
6
6
  var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
7
7
  var streamableHttp_js = require('@modelcontextprotocol/sdk/server/streamableHttp.js');
8
- var piRuntime = require('./piRuntime-BesGGPME.cjs');
9
- var mcp = require('./mcp-7iDHlyCI.cjs');
10
- require('./agentGuidance-DUBXppv-.cjs');
8
+ var piRuntime = require('./piRuntime-BxP4B_zY.cjs');
9
+ var mcp = require('./mcp-BqlXl10F.cjs');
10
+ require('./agentGuidance-un7YPryB.cjs');
11
11
  require('node:fs/promises');
12
12
  require('node:os');
13
13
  require('zod');
14
- require('./limits-CmzISka2.cjs');
14
+ require('./limits-DkfHJ3nS.cjs');
15
15
  require('axios');
16
16
  require('tweetnacl');
17
17
  require('socket.io-client');
18
- require('./types-Bd_TGr0F.cjs');
18
+ require('./types-a2xsH2UI.cjs');
19
19
  require('node:fs');
20
20
  require('node:path');
21
21
  var terminalToolContext = require('./terminalToolContext-DoV9Gs7K.cjs');
22
- require('./index-eCjkm8Y2.cjs');
22
+ require('./index-D_fYUxVg.cjs');
23
23
  require('chalk');
24
24
  require('cross-spawn');
25
25
  require('node:readline');