very-happy-cli 0.2.155 → 0.2.156

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-DmFcRh54.cjs → AcpBackend-BHe1_F1h.cjs} +2 -2
  2. package/dist/{AcpBackend-DVB0nzgR.mjs → AcpBackend-C3nc1u-s.mjs} +2 -2
  3. package/dist/{AcpSessionManager-CWaSYTnT.cjs → AcpSessionManager-BVxkQnNf.cjs} +1 -1
  4. package/dist/{AcpSessionManager-dGDgNb-p.mjs → AcpSessionManager-dN3k1LbI.mjs} +1 -1
  5. package/dist/{agentGuidance-un7YPryB.cjs → agentGuidance-C-CmV03f.cjs} +1 -1
  6. package/dist/{agentGuidance-BWxFC6UL.mjs → agentGuidance-C604n0Zq.mjs} +1 -1
  7. package/dist/{agentHome-aucT8BHw.cjs → agentHome-CmIJNV7f.cjs} +2 -2
  8. package/dist/{agentHome-ByLb2HFg.mjs → agentHome-D2XGsoqs.mjs} +2 -2
  9. package/dist/{auto-BQnD6gVx.mjs → auto-B1I6G_Nf.mjs} +6 -6
  10. package/dist/{auto-P9RoJaY0.cjs → auto-CMDq4oIu.cjs} +6 -6
  11. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  12. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  13. package/dist/{config-BoePh9PX.cjs → config-BYHSRY2E.cjs} +4 -4
  14. package/dist/{config-BPZ2Y6o8.mjs → config-BkTu25bH.mjs} +4 -4
  15. package/dist/{index-BjzdXb9x.mjs → index-B5QbzEga.mjs} +8 -8
  16. package/dist/{index-DRrLaljt.cjs → index-B_-7NpGZ.cjs} +7 -7
  17. package/dist/{index-D_fYUxVg.cjs → index-BbtR-Qto.cjs} +114 -51
  18. package/dist/{index--KCpVs1c.cjs → index-CB8QnjvS.cjs} +4 -4
  19. package/dist/{index-B4oXnbYw.mjs → index-DAAreiRF.mjs} +110 -47
  20. package/dist/{index-DVVRqaVG.mjs → index-PYO8Mdz4.mjs} +4 -4
  21. package/dist/index.cjs +4 -4
  22. package/dist/index.mjs +4 -4
  23. package/dist/{install-DP5aPNEX.mjs → install-CNtXzwT_.mjs} +1 -1
  24. package/dist/{install-CGigiocs.cjs → install-CO1ps6Wt.cjs} +1 -1
  25. package/dist/{installTerminalHooks-XrcPvfBs.cjs → installTerminalHooks-BOAnQ1Qe.cjs} +4 -4
  26. package/dist/{installTerminalHooks-tIg7mANc.mjs → installTerminalHooks-CMpOV3RU.mjs} +4 -4
  27. package/dist/lib.cjs +2 -2
  28. package/dist/lib.d.cts +24 -8
  29. package/dist/lib.d.mts +24 -8
  30. package/dist/lib.mjs +2 -2
  31. package/dist/{limits-C_DW0M0q.mjs → limits-DmMdchTz.mjs} +7 -7
  32. package/dist/{limits-DkfHJ3nS.cjs → limits-o29KXBgj.cjs} +7 -7
  33. package/dist/{mcp-o7QglAQM.mjs → mcp-C_uejotl.mjs} +4 -4
  34. package/dist/{mcp-BqlXl10F.cjs → mcp-CwK1nI7Y.cjs} +4 -4
  35. package/dist/{piRuntime-MjiJI-nV.mjs → piRuntime-Cu2-8nOT.mjs} +2 -2
  36. package/dist/{piRuntime-BxP4B_zY.cjs → piRuntime-Dj5WnqzJ.cjs} +2 -2
  37. package/dist/{piTerminal-DYzRcwgb.cjs → piTerminal-D-BIbov9.cjs} +6 -6
  38. package/dist/{piTerminal-Dpq6yqKU.mjs → piTerminal-DanZeBrO.mjs} +6 -6
  39. package/dist/{runGemini-8Pxh94Fm.cjs → runGemini--QqK-Ap5.cjs} +6 -6
  40. package/dist/{runGemini-CDlcQ-OA.mjs → runGemini-CZ_lhMWY.mjs} +6 -6
  41. package/dist/{runOpenClaw-B5FSZIbK.cjs → runOpenClaw-C0xLhTvk.cjs} +5 -5
  42. package/dist/{runOpenClaw-YkhsgPs0.mjs → runOpenClaw-CxgLpm38.mjs} +5 -5
  43. package/dist/{send-DJStmLBv.mjs → send-BaOkDgH0.mjs} +2 -2
  44. package/dist/{send-CwrYXTPr.cjs → send-CTcGMVuG.cjs} +2 -2
  45. package/dist/{sessions-JaVXlSqj.mjs → sessions-Bn304xF1.mjs} +2 -2
  46. package/dist/{sessions-MX21NJXd.cjs → sessions-OmvyJb0n.cjs} +2 -2
  47. package/dist/{spawn-BaPnjClT.mjs → spawn-BKNabutV.mjs} +4 -4
  48. package/dist/{spawn-cIoglKVf.cjs → spawn-CC6V2KiA.cjs} +4 -4
  49. package/dist/{teams-DXV5Pwwt.mjs → teams-CLbS2_4Q.mjs} +5 -5
  50. package/dist/{teams-Dqk7F3D-.cjs → teams-XtrH3_h3.cjs} +5 -5
  51. package/dist/{todo-2Z1REhfx.mjs → todo-BcPbNKt2.mjs} +2 -2
  52. package/dist/{todo-Buuqn9gm.cjs → todo-CEDvKNXK.cjs} +2 -2
  53. package/dist/{types-CkbfdRzq.mjs → types-BEVzYSoV.mjs} +49 -10
  54. package/dist/{types-a2xsH2UI.cjs → types-CphWjqHc.cjs} +49 -10
  55. package/package.json +7 -7
@@ -3,14 +3,14 @@
3
3
  var chalk = require('chalk');
4
4
  var os = require('node:os');
5
5
  var node_crypto = require('node:crypto');
6
- var index = require('./types-a2xsH2UI.cjs');
7
- var persistence = require('./limits-DkfHJ3nS.cjs');
6
+ var index = require('./types-CphWjqHc.cjs');
7
+ var persistence = require('./limits-o29KXBgj.cjs');
8
8
  var spawn = require('cross-spawn');
9
9
  var path = require('node:path');
10
10
  var node_readline = require('node:readline');
11
11
  var node_fs = require('node:fs');
12
12
  var terminalTitleSuggest = require('./terminalTitleSuggest-Dji8I0Jy.cjs');
13
- var agentGuidance = require('./agentGuidance-un7YPryB.cjs');
13
+ var agentGuidance = require('./agentGuidance-C-CmV03f.cjs');
14
14
  var promises = require('node:fs/promises');
15
15
  var fs = require('fs/promises');
16
16
  var ink = require('ink');
@@ -5402,8 +5402,8 @@ ${typeLabels[type] || type}:`));
5402
5402
  }
5403
5403
  console.log(chalk.gray(" An external claude command is only needed for native terminal/mirror use."));
5404
5404
  try {
5405
- const { resolveAgentHomesForCli } = await Promise.resolve().then(function () { return require('./agentHome-aucT8BHw.cjs'); });
5406
- const { describeAgentHome } = await Promise.resolve().then(function () { return require('./types-a2xsH2UI.cjs'); }).then(function (n) { return n.index; });
5405
+ const { resolveAgentHomesForCli } = await Promise.resolve().then(function () { return require('./agentHome-CmIJNV7f.cjs'); });
5406
+ const { describeAgentHome } = await Promise.resolve().then(function () { return require('./types-CphWjqHc.cjs'); }).then(function (n) { return n.index; });
5407
5407
  const homes = await resolveAgentHomesForCli();
5408
5408
  console.log(chalk.green(`\u2713 Claude config dir: ${describeAgentHome(homes.claudeConfigDir)}`));
5409
5409
  console.log(chalk.green(`\u2713 Codex home: ${describeAgentHome(homes.codexHome)}`));
@@ -6242,7 +6242,8 @@ function startDaemonControlServer({
6242
6242
  onTerminalHook,
6243
6243
  setTerminalTitle,
6244
6244
  onSessionEdit,
6245
- listPeers
6245
+ listPeers,
6246
+ isTurnActive
6246
6247
  }) {
6247
6248
  return new Promise((resolve) => {
6248
6249
  const app = fastify({
@@ -6326,7 +6327,8 @@ function startDaemonControlServer({
6326
6327
  children: z.z.array(z.z.object({
6327
6328
  startedBy: z.z.string(),
6328
6329
  happySessionId: z.z.string(),
6329
- pid: z.z.number()
6330
+ pid: z.z.number(),
6331
+ turnActive: z.z.boolean()
6330
6332
  }))
6331
6333
  })
6332
6334
  }
@@ -6338,7 +6340,8 @@ function startDaemonControlServer({
6338
6340
  children: children.filter((child) => child.happySessionId !== void 0).map((child) => ({
6339
6341
  startedBy: child.startedBy,
6340
6342
  happySessionId: child.happySessionId,
6341
- pid: child.pid
6343
+ pid: child.pid,
6344
+ turnActive: isTurnActive ? isTurnActive(child.happySessionId) : false
6342
6345
  }))
6343
6346
  };
6344
6347
  });
@@ -8442,7 +8445,7 @@ function parseJsonObject(text) {
8442
8445
  return null;
8443
8446
  }
8444
8447
  }
8445
- function resolveSdkClaudeBinary(platform = process.platform, arch = process.arch, resolver = (s) => node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-D_fYUxVg.cjs', document.baseURI).href))).resolve(s)) {
8448
+ function resolveSdkClaudeBinary(platform = process.platform, arch = process.arch, resolver = (s) => node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BbtR-Qto.cjs', document.baseURI).href))).resolve(s)) {
8446
8449
  const platformArch = `${platform}-${arch}`;
8447
8450
  const candidates = [
8448
8451
  `@anthropic-ai/claude-agent-sdk-${platformArch}/claude`,
@@ -9132,9 +9135,9 @@ function createMirrorManager(deps) {
9132
9135
  archiveReason: reason
9133
9136
  });
9134
9137
  try {
9135
- await deps.api.deactivateSession(binding.happySessionId);
9138
+ await deps.api.archiveSession(binding.happySessionId);
9136
9139
  } catch (error) {
9137
- persistence.logger.debug(`[MIRROR] deactivateSession failed for ${binding.happySessionId}:`, error);
9140
+ persistence.logger.debug(`[MIRROR] archiveSession failed for ${binding.happySessionId}:`, error);
9138
9141
  }
9139
9142
  deps.onBindingsChanged?.();
9140
9143
  };
@@ -10743,6 +10746,16 @@ ${action.prompt}`, { localId: `automation-${run.id}`, ...meta });
10743
10746
  function daemonExitCode(source) {
10744
10747
  return source === "exception" ? 1 : 0;
10745
10748
  }
10749
+ const HANDOVER_EXIT_CODE = 75;
10750
+
10751
+ function detectDaemonSupervisor(env, platform = process.platform) {
10752
+ const explicit = env.HAPPY_DAEMON_SUPERVISOR?.trim().toLowerCase();
10753
+ if (explicit === "systemd") return "systemd";
10754
+ if (explicit === "none") return "none";
10755
+ if (platform === "linux" && typeof env.INVOCATION_ID === "string" && env.INVOCATION_ID.trim() !== "") return "systemd";
10756
+ return "none";
10757
+ }
10758
+ const SYSTEMD_RESTART_HINT = "systemctl --user restart very-happy-daemon";
10746
10759
 
10747
10760
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
10748
10761
  function sanitizeImportTitle(value) {
@@ -11848,6 +11861,9 @@ async function startDaemon() {
11848
11861
  peerCoordinator.onEdit(edit);
11849
11862
  },
11850
11863
  listPeers: () => peerCoordinator.list(),
11864
+ // B-505: `daemon list` shows which sessions have a turn in flight, so an
11865
+ // operator can check the WHOLE machine before a supervised restart.
11866
+ isTurnActive: (sessionId) => turnActivity.activeSessions().includes(sessionId),
11851
11867
  pushClipboard: (text, terminalId) => {
11852
11868
  if (!apiMachineRef) {
11853
11869
  return { delivered: false, truncated: false, totalBytes: 0, error: "daemon is still starting up" };
@@ -11867,6 +11883,8 @@ async function startDaemon() {
11867
11883
  }
11868
11884
  });
11869
11885
  const daemonClaudeCredentials = resolveClaudeCredentialReadiness();
11886
+ const daemonSupervisor = detectDaemonSupervisor(process.env);
11887
+ persistence.logger.debug(`[DAEMON RUN] Supervisor: ${daemonSupervisor}`);
11870
11888
  let fileState = {
11871
11889
  pid: process.pid,
11872
11890
  httpPort: controlPort,
@@ -11876,7 +11894,8 @@ async function startDaemon() {
11876
11894
  serverUrl: persistence.configuration.serverUrl,
11877
11895
  webappUrl: persistence.configuration.webappUrl,
11878
11896
  daemonLogPath: persistence.logger.logFilePath,
11879
- claudeCredentialSource: daemonClaudeCredentials.source
11897
+ claudeCredentialSource: daemonClaudeCredentials.source,
11898
+ supervisor: daemonSupervisor
11880
11899
  };
11881
11900
  persistence.writeDaemonState(fileState);
11882
11901
  persistence.logger.debug("[DAEMON RUN] Daemon state written");
@@ -12049,6 +12068,10 @@ async function startDaemon() {
12049
12068
  await persistence.cleanupDaemonState();
12050
12069
  await persistence.releaseDaemonLock(daemonLockHandle);
12051
12070
  await stopCaffeinate();
12071
+ if (daemonSupervisor === "systemd") {
12072
+ persistence.logger.debug(`[DAEMON RUN] systemd-supervised: exiting ${HANDOVER_EXIT_CODE} for the unit to restart on the new bundle`);
12073
+ process.exit(HANDOVER_EXIT_CODE);
12074
+ }
12052
12075
  try {
12053
12076
  spawnHappyCLI(["daemon", "start"], {
12054
12077
  detached: true,
@@ -13028,6 +13051,40 @@ function registerKillSessionHandler(rpcHandlerManager, killThisHappy, archiveEve
13028
13051
  };
13029
13052
  }
13030
13053
 
13054
+ async function settleSessionOnExit(sessionId, intent, deps) {
13055
+ if (intent === "archive") {
13056
+ deps.updateMetadata((currentMetadata) => ({
13057
+ ...currentMetadata,
13058
+ lifecycleState: "archived",
13059
+ lifecycleStateSince: Date.now(),
13060
+ archivedBy: "cli",
13061
+ archiveReason: "User terminated"
13062
+ }));
13063
+ }
13064
+ deps.sendSessionDeath();
13065
+ try {
13066
+ if (intent === "archive") await deps.archiveSession(sessionId);
13067
+ else await deps.deactivateSession(sessionId);
13068
+ } catch (error) {
13069
+ deps.log?.(`[START] ${intent === "archive" ? "archiveSession" : "deactivateSession"} during cleanup failed:`, error);
13070
+ }
13071
+ }
13072
+ class SessionExitGate {
13073
+ decided = null;
13074
+ /** Returns the intent to act on, or null when cleanup already started. */
13075
+ claim(intent) {
13076
+ if (this.decided !== null) return null;
13077
+ this.decided = intent;
13078
+ return intent;
13079
+ }
13080
+ get current() {
13081
+ return this.decided;
13082
+ }
13083
+ }
13084
+ function exitIntentFromArchiveFlag(archive) {
13085
+ return archive ?? true ? "archive" : "offline";
13086
+ }
13087
+
13031
13088
  function isUnsupportedSideQuestionError(error) {
13032
13089
  const message = error instanceof Error ? error.message : String(error);
13033
13090
  return /unknown|unsupported|not supported|unrecognized|invalid.*subtype/i.test(message);
@@ -13204,7 +13261,7 @@ function registerSideQuestionHandler(rpc, deps) {
13204
13261
  const retainMs = deps.retainMs ?? SIDE_QUESTION_RETAIN_MS;
13205
13262
  const maxRunMs = deps.maxRunMs ?? SIDE_QUESTION_MAX_RUN_MS;
13206
13263
  const fork = deps.run ?? (async (input) => {
13207
- const { query } = await Promise.resolve().then(function () { return require('./index--KCpVs1c.cjs'); });
13264
+ const { query } = await Promise.resolve().then(function () { return require('./index-CB8QnjvS.cjs'); });
13208
13265
  return runSideQuestion(query, input);
13209
13266
  });
13210
13267
  const run = async (input, live) => {
@@ -13323,7 +13380,7 @@ const MAX_TITLE_CHARS = 60;
13323
13380
  const GENERATION_TIMEOUT_MS = 3e4;
13324
13381
  function resolveClaudeBinary() {
13325
13382
  try {
13326
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-D_fYUxVg.cjs', document.baseURI).href)));
13383
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BbtR-Qto.cjs', document.baseURI).href)));
13327
13384
  const utilsPath = path.resolve(path.join(terminalTitleSuggest.projectPath(), "scripts", "claude_version_utils.cjs"));
13328
13385
  const { getClaudeCliPath } = require$1(utilsPath);
13329
13386
  const path$1 = getClaudeCliPath();
@@ -14341,26 +14398,24 @@ async function runClaude(credentials, options = {}) {
14341
14398
  hasMetadata: Boolean(message.meta)
14342
14399
  });
14343
14400
  });
14401
+ const exitGate = new SessionExitGate();
14344
14402
  const cleanup = async (opts = { archive: true }) => {
14345
- persistence.logger.debug(`[START] Received termination signal, cleaning up (archive=${opts.archive ?? true})...`);
14403
+ const intent = exitGate.claim(exitIntentFromArchiveFlag(opts.archive));
14404
+ if (intent === null) {
14405
+ persistence.logger.debug(`[START] Termination (archive=${opts.archive ?? true}) ignored: cleanup already running as ${exitGate.current}`);
14406
+ return;
14407
+ }
14408
+ persistence.logger.debug(`[START] Received termination signal, cleaning up (archive=${intent === "archive"})...`);
14346
14409
  try {
14347
14410
  if (session) {
14348
- if (opts.archive ?? true) {
14349
- session.updateMetadata((currentMetadata) => ({
14350
- ...currentMetadata,
14351
- lifecycleState: "archived",
14352
- lifecycleStateSince: Date.now(),
14353
- archivedBy: "cli",
14354
- archiveReason: "User terminated"
14355
- }));
14356
- }
14357
14411
  currentSession?.cleanup();
14358
- session.sendSessionDeath();
14359
- try {
14360
- await api.deactivateSession(session.sessionId);
14361
- } catch (err) {
14362
- persistence.logger.debug("[START] deactivateSession during cleanup failed:", err);
14363
- }
14412
+ await settleSessionOnExit(session.sessionId, intent, {
14413
+ updateMetadata: (handler) => session.updateMetadata(handler),
14414
+ sendSessionDeath: () => session.sendSessionDeath(),
14415
+ archiveSession: (id) => api.archiveSession(id),
14416
+ deactivateSession: (id) => api.deactivateSession(id),
14417
+ log: (message, ...args) => persistence.logger.debug(message, ...args)
14418
+ });
14364
14419
  await session.flush();
14365
14420
  await session.close();
14366
14421
  }
@@ -15569,9 +15624,9 @@ function resolveLocalSignupBootstrap(configuredMode, configuredInviteCodes, gene
15569
15624
  };
15570
15625
  }
15571
15626
 
15572
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-D_fYUxVg.cjs', document.baseURI).href)));
15627
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BbtR-Qto.cjs', document.baseURI).href)));
15573
15628
  const __dirname$1 = path.dirname(__filename$1);
15574
- const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-D_fYUxVg.cjs', document.baseURI).href)));
15629
+ const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BbtR-Qto.cjs', document.baseURI).href)));
15575
15630
  const PRISMA_QUERY_ENGINE_FILES = {
15576
15631
  "arm64-darwin": "libquery_engine-darwin-arm64.dylib.node",
15577
15632
  "x64-darwin": "libquery_engine-darwin.dylib.node",
@@ -18514,7 +18569,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18514
18569
  return;
18515
18570
  } else if (subcommand === "install-terminal-hooks") {
18516
18571
  try {
18517
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-XrcPvfBs.cjs'); });
18572
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-BOAnQ1Qe.cjs'); });
18518
18573
  const command = parseTerminalHooksArgs(args.slice(1));
18519
18574
  if (command.action === "help") {
18520
18575
  console.log(TERMINAL_HOOKS_HELP);
@@ -18531,7 +18586,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18531
18586
  }
18532
18587
  } else if (subcommand === "agent-home") {
18533
18588
  try {
18534
- const { parseAgentHomeArgs, runAgentHomeCommand } = await Promise.resolve().then(function () { return require('./agentHome-aucT8BHw.cjs'); });
18589
+ const { parseAgentHomeArgs, runAgentHomeCommand } = await Promise.resolve().then(function () { return require('./agentHome-CmIJNV7f.cjs'); });
18535
18590
  await runAgentHomeCommand(parseAgentHomeArgs(args.slice(1)));
18536
18591
  process.exit(0);
18537
18592
  } catch (error) {
@@ -18540,7 +18595,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18540
18595
  }
18541
18596
  } else if (subcommand === "spawn") {
18542
18597
  try {
18543
- const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-cIoglKVf.cjs'); });
18598
+ const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-CC6V2KiA.cjs'); });
18544
18599
  await handleSpawnCommand(args.slice(1));
18545
18600
  } catch (error) {
18546
18601
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18552,7 +18607,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18552
18607
  return;
18553
18608
  } else if (subcommand === "sessions") {
18554
18609
  try {
18555
- const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-MX21NJXd.cjs'); });
18610
+ const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-OmvyJb0n.cjs'); });
18556
18611
  await handleSessionsCommand(args.slice(1));
18557
18612
  } catch (error) {
18558
18613
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18564,7 +18619,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18564
18619
  return;
18565
18620
  } else if (subcommand === "send") {
18566
18621
  try {
18567
- const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-CwrYXTPr.cjs'); });
18622
+ const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-CTcGMVuG.cjs'); });
18568
18623
  await handleSendCommand(args.slice(1));
18569
18624
  } catch (error) {
18570
18625
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18670,9 +18725,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18670
18725
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
18671
18726
  const projectId = args[3];
18672
18727
  try {
18673
- const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-BoePh9PX.cjs'); });
18674
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-DkfHJ3nS.cjs'); }).then(function (n) { return n.persistence; });
18675
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-a2xsH2UI.cjs'); }).then(function (n) { return n.api; });
18728
+ const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-BYHSRY2E.cjs'); });
18729
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-o29KXBgj.cjs'); }).then(function (n) { return n.persistence; });
18730
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-CphWjqHc.cjs'); }).then(function (n) { return n.api; });
18676
18731
  let userEmail = void 0;
18677
18732
  try {
18678
18733
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -18703,7 +18758,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18703
18758
  }
18704
18759
  if (geminiSubcommand === "project" && args[2] === "get") {
18705
18760
  try {
18706
- const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-BoePh9PX.cjs'); });
18761
+ const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-BYHSRY2E.cjs'); });
18707
18762
  const config = readGeminiLocalConfig();
18708
18763
  if (config.googleCloudProject) {
18709
18764
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -18743,7 +18798,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18743
18798
  process.exit(0);
18744
18799
  }
18745
18800
  try {
18746
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-8Pxh94Fm.cjs'); });
18801
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini--QqK-Ap5.cjs'); });
18747
18802
  let startedBy = void 0;
18748
18803
  for (let i = 1; i < args.length; i++) {
18749
18804
  if (args[i] === "--started-by") {
@@ -18766,7 +18821,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18766
18821
  } else if (subcommand === "pi") {
18767
18822
  if (args[1] === "--terminal") {
18768
18823
  try {
18769
- const { runPiTerminal } = await Promise.resolve().then(function () { return require('./piTerminal-DYzRcwgb.cjs'); });
18824
+ const { runPiTerminal } = await Promise.resolve().then(function () { return require('./piTerminal-D-BIbov9.cjs'); });
18770
18825
  process.exitCode = await runPiTerminal(args.slice(2));
18771
18826
  } catch (error) {
18772
18827
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18783,7 +18838,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18783
18838
  }
18784
18839
  };
18785
18840
  try {
18786
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-DRrLaljt.cjs'); });
18841
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-B_-7NpGZ.cjs'); });
18787
18842
  const parsed = parsePiRunnerArgs(args.slice(1));
18788
18843
  const resolved = resolveAcpAgentConfig(["pi", ...parsed.passthrough]);
18789
18844
  const { credentials } = await authAndSetupMachineIfNeeded();
@@ -18811,7 +18866,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18811
18866
  return;
18812
18867
  } else if (subcommand === "acp") {
18813
18868
  try {
18814
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-DRrLaljt.cjs'); });
18869
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-B_-7NpGZ.cjs'); });
18815
18870
  let startedBy = void 0;
18816
18871
  let verbose = false;
18817
18872
  const acpArgs = [];
@@ -18851,7 +18906,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18851
18906
  return;
18852
18907
  } else if (subcommand === "openclaw") {
18853
18908
  try {
18854
- const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-B5FSZIbK.cjs'); });
18909
+ const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-C0xLhTvk.cjs'); });
18855
18910
  let startedBy = void 0;
18856
18911
  let verbose = false;
18857
18912
  let gatewayUrl;
@@ -18902,7 +18957,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18902
18957
  return;
18903
18958
  } else if (subcommand === "todo") {
18904
18959
  try {
18905
- const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-Buuqn9gm.cjs'); });
18960
+ const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-CEDvKNXK.cjs'); });
18906
18961
  await handleTodoCommand(args.slice(1));
18907
18962
  } catch (error) {
18908
18963
  console.error(JSON.stringify({ error: error instanceof Error ? error.message : "Todo command failed" }));
@@ -18911,7 +18966,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18911
18966
  return;
18912
18967
  } else if (subcommand === "teams") {
18913
18968
  try {
18914
- const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-Dqk7F3D-.cjs'); });
18969
+ const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-XtrH3_h3.cjs'); });
18915
18970
  await handleTeamsCommand(args.slice(1));
18916
18971
  } catch (error) {
18917
18972
  console.error(error instanceof Error ? error.message : "Teams command failed");
@@ -18920,7 +18975,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18920
18975
  return;
18921
18976
  } else if (subcommand === "auto") {
18922
18977
  try {
18923
- const { handleAutoCommand } = await Promise.resolve().then(function () { return require('./auto-P9RoJaY0.cjs'); });
18978
+ const { handleAutoCommand } = await Promise.resolve().then(function () { return require('./auto-CMDq4oIu.cjs'); });
18924
18979
  await handleAutoCommand(args.slice(1));
18925
18980
  } catch (error) {
18926
18981
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Automation command failed");
@@ -18932,7 +18987,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18932
18987
  return;
18933
18988
  } else if (subcommand === "mcp" && (args.length === 1 || args.length === 2 && args[1] === "--terminal-tools")) {
18934
18989
  try {
18935
- const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-BqlXl10F.cjs'); });
18990
+ const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-CwK1nI7Y.cjs'); });
18936
18991
  await handleMcpCommand(args[1] === "--terminal-tools");
18937
18992
  } catch (error) {
18938
18993
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}
@@ -18961,6 +19016,8 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18961
19016
  } else {
18962
19017
  console.log("Active sessions:");
18963
19018
  console.log(JSON.stringify(sessions, null, 2));
19019
+ const busy = sessions.filter((s) => s.turnActive === true);
19020
+ console.log(busy.length === 0 ? "No turn in flight on this machine (wrappers older than 0.2.139 do not report turns)." : `${busy.length} session(s) with a turn in flight: ${busy.map((s) => s.happySessionId).join(", ")}`);
18964
19021
  }
18965
19022
  } catch (error) {
18966
19023
  console.log("No daemon running");
@@ -18989,13 +19046,19 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18989
19046
  persistence.configuration.webappUrl
18990
19047
  );
18991
19048
  if (running && !currentDaemonMatches) {
19049
+ if (currentState?.supervisor === "systemd") {
19050
+ console.error(`The running daemon is supervised by systemd; hand over through the unit instead:
19051
+ ${SYSTEMD_RESTART_HINT}`);
19052
+ process.exit(1);
19053
+ }
18992
19054
  console.log("Configured relay or CLI version changed; restarting the existing daemon");
18993
19055
  await persistence.stopDaemon();
18994
19056
  }
19057
+ const { HAPPY_DAEMON_SUPERVISOR: _supervisor, INVOCATION_ID: _invocation, ...detachedEnv } = process.env;
18995
19058
  const child = spawnHappyCLI(["daemon", "start-sync"], {
18996
19059
  detached: true,
18997
19060
  stdio: "ignore",
18998
- env: process.env
19061
+ env: detachedEnv
18999
19062
  });
19000
19063
  child.unref();
19001
19064
  let started = false;
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-D_fYUxVg.cjs');
3
+ var index = require('./index-BbtR-Qto.cjs');
4
4
  var claudeAgentSdk = require('@anthropic-ai/claude-agent-sdk');
5
5
  require('chalk');
6
6
  require('node:os');
7
7
  require('node:crypto');
8
- require('./types-a2xsH2UI.cjs');
8
+ require('./types-CphWjqHc.cjs');
9
9
  require('axios');
10
- require('./limits-DkfHJ3nS.cjs');
10
+ require('./limits-o29KXBgj.cjs');
11
11
  require('zod');
12
12
  require('@paralleldrive/cuid2');
13
13
  require('node:fs/promises');
@@ -32,7 +32,7 @@ require('fs');
32
32
  require('node:readline');
33
33
  require('@anthropic-ai/sandbox-runtime');
34
34
  require('expo-server-sdk');
35
- require('./agentGuidance-un7YPryB.cjs');
35
+ require('./agentGuidance-C-CmV03f.cjs');
36
36
  require('ink');
37
37
  require('react');
38
38
  require('ps-list');