very-happy-cli 0.2.132 → 0.2.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{AcpBackend-BNMLGtST.mjs → AcpBackend-B8KEjDwF.mjs} +3 -3
  2. package/dist/{AcpBackend--EnHZRC4.cjs → AcpBackend-CeNp7tgD.cjs} +3 -3
  3. package/dist/{AcpSessionManager-RoOyx5KI.cjs → AcpSessionManager-Bu1d05bx.cjs} +1 -1
  4. package/dist/{AcpSessionManager-BF5JZYCC.mjs → AcpSessionManager-KlDZbEmZ.mjs} +1 -1
  5. package/dist/{agentGuidance-DeOIgOhh.mjs → agentGuidance-CPG5Cr5T.mjs} +1 -1
  6. package/dist/{agentGuidance-R9MH5Cd5.cjs → agentGuidance-Cg8Lha39.cjs} +1 -1
  7. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  8. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  9. package/dist/{config-CkmssSRu.cjs → config-C3e90AIH.cjs} +4 -4
  10. package/dist/{config-ClCkJ1a_.mjs → config-C4gWfnJX.mjs} +4 -4
  11. package/dist/{index-Dn7s2iaT.cjs → index-B1plzL9M.cjs} +85 -36
  12. package/dist/{index-DdbU8FmA.mjs → index-B6UvB88K.mjs} +16 -10
  13. package/dist/{index-D1gHXtkw.mjs → index-BqUOj1zK.mjs} +81 -32
  14. package/dist/{index-DK0qz1y7.mjs → index-CEDPokKf.mjs} +4 -4
  15. package/dist/{index-Bqg6yo5s.cjs → index-CX-zp3FH.cjs} +4 -4
  16. package/dist/{index-CjopZZg3.cjs → index-jqG8CV0c.cjs} +15 -9
  17. package/dist/index.cjs +4 -4
  18. package/dist/index.mjs +4 -4
  19. package/dist/{installTerminalHooks-CRWWmonO.mjs → installTerminalHooks-BT4Dq28Y.mjs} +4 -4
  20. package/dist/{installTerminalHooks-CPZ3vVn8.cjs → installTerminalHooks-DPmEaHg2.cjs} +4 -4
  21. package/dist/lib.cjs +2 -2
  22. package/dist/lib.d.cts +15 -60
  23. package/dist/lib.d.mts +15 -60
  24. package/dist/lib.mjs +2 -2
  25. package/dist/{limits-C9aXkP7U.mjs → limits-BGeIBBE3.mjs} +7 -7
  26. package/dist/{limits-DLlsV71c.cjs → limits-D6kiAfXJ.cjs} +7 -7
  27. package/dist/{mcp-DkoXvc07.mjs → mcp-BGu_dUaJ.mjs} +4 -4
  28. package/dist/{mcp-DHkYfENQ.cjs → mcp-DGZmUpuZ.cjs} +4 -4
  29. package/dist/{runGemini-Cx1YcK2o.cjs → runGemini-BPPnulIk.cjs} +6 -6
  30. package/dist/{runGemini-BjEl7syj.mjs → runGemini-DGTNwiLo.mjs} +6 -6
  31. package/dist/{runOpenClaw-I4sGAQf1.cjs → runOpenClaw-BB3Ivt1S.cjs} +5 -5
  32. package/dist/{runOpenClaw-ByHu69K5.mjs → runOpenClaw-CxgTFOSM.mjs} +5 -5
  33. package/dist/{send-gH1vJ0iv.cjs → send-Bo6iKuXr.cjs} +4 -4
  34. package/dist/{send-CSOeUlQC.mjs → send-DHShoBeq.mjs} +4 -4
  35. package/dist/{sessions-CP9FlcJ6.mjs → sessions-CJuwvEr0.mjs} +4 -4
  36. package/dist/{sessions-BBc8L8qf.cjs → sessions-DyC5Attg.cjs} +4 -4
  37. package/dist/{spawn-DrQo81MW.mjs → spawn-QtKlr8Ig.mjs} +4 -4
  38. package/dist/{spawn-Dmfbot5k.cjs → spawn-gha6nGx-.cjs} +4 -4
  39. package/dist/{teams-Bbvo1G6y.mjs → teams-BF-GxUZc.mjs} +4 -4
  40. package/dist/{teams-DtXQYmEK.cjs → teams-BbzWNV9e.cjs} +4 -4
  41. package/dist/{todo-DOi6svw9.cjs → todo-BaNaNZ8c.cjs} +3 -3
  42. package/dist/{todo-BAwevRyb.mjs → todo-CkJ5UjWs.mjs} +3 -3
  43. package/dist/{types-CA-c2NH7.mjs → types-Cq-tvv9t.mjs} +89 -27
  44. package/dist/{types-B15E2OVy.cjs → types-Dabm17Ln.cjs} +90 -28
  45. package/package.json +7 -7
@@ -1,8 +1,8 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
3
3
  import { randomUUID } from 'node:crypto';
4
- import { l as logger, p as packageJson } from './limits-C9aXkP7U.mjs';
5
- import { d as contentLogMetadata, e as errorLogMetadata, h as delay } from './types-CA-c2NH7.mjs';
4
+ import { l as logger, p as packageJson } from './limits-BGeIBBE3.mjs';
5
+ import { d as contentLogMetadata, e as errorLogMetadata, h as delay } from './types-Cq-tvv9t.mjs';
6
6
 
7
7
  function acpImageBlocks(attachments, supportsImages) {
8
8
  return attachments.filter((file) => ["image/jpeg", "image/png", "image/gif", "image/webp"].includes(file.mimeType)).map((file) => {
@@ -1357,7 +1357,7 @@ class AcpBackend {
1357
1357
  }
1358
1358
  try {
1359
1359
  await this.connection.cancel({ sessionId: this.acpSessionId });
1360
- this.emit({ type: "status", status: "stopped", detail: "Cancelled by user" });
1360
+ this.emit({ type: "status", status: "idle", detail: "Cancelled by user" });
1361
1361
  } catch (error) {
1362
1362
  logger.debug("[AcpBackend] Error cancelling:", errorLogMetadata(error));
1363
1363
  }
@@ -3,8 +3,8 @@
3
3
  var node_child_process = require('node:child_process');
4
4
  var sdk = require('@agentclientprotocol/sdk');
5
5
  var node_crypto = require('node:crypto');
6
- var persistence = require('./limits-DLlsV71c.cjs');
7
- var api = require('./types-B15E2OVy.cjs');
6
+ var persistence = require('./limits-D6kiAfXJ.cjs');
7
+ var api = require('./types-Dabm17Ln.cjs');
8
8
 
9
9
  function acpImageBlocks(attachments, supportsImages) {
10
10
  return attachments.filter((file) => ["image/jpeg", "image/png", "image/gif", "image/webp"].includes(file.mimeType)).map((file) => {
@@ -1359,7 +1359,7 @@ class AcpBackend {
1359
1359
  }
1360
1360
  try {
1361
1361
  await this.connection.cancel({ sessionId: this.acpSessionId });
1362
- this.emit({ type: "status", status: "stopped", detail: "Cancelled by user" });
1362
+ this.emit({ type: "status", status: "idle", detail: "Cancelled by user" });
1363
1363
  } catch (error) {
1364
1364
  persistence.logger.debug("[AcpBackend] Error cancelling:", api.errorLogMetadata(error));
1365
1365
  }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var cuid2 = require('@paralleldrive/cuid2');
4
- var api = require('./types-B15E2OVy.cjs');
4
+ var api = require('./types-Dabm17Ln.cjs');
5
5
 
6
6
  function turnOptions(turnId, time) {
7
7
  return turnId ? { turn: turnId, time } : { time };
@@ -1,5 +1,5 @@
1
1
  import { createId } from '@paralleldrive/cuid2';
2
- import { s as streamKeyOf, c as createEnvelope } from './types-CA-c2NH7.mjs';
2
+ import { s as streamKeyOf, c as createEnvelope } from './types-Cq-tvv9t.mjs';
3
3
 
4
4
  function turnOptions(turnId, time) {
5
5
  return turnId ? { turn: turnId, time } : { time };
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { randomUUID } from 'node:crypto';
3
- import { n as normalizeHttpEndpoint, c as configuration, g as readSettings, r as readPersistedSessions, d as readCredentialsForConfiguredRelay } from './limits-C9aXkP7U.mjs';
3
+ import { n as normalizeHttpEndpoint, c as configuration, g as readSettings, r as readPersistedSessions, d as readCredentialsForConfiguredRelay } from './limits-BGeIBBE3.mjs';
4
4
  import { open, mkdir, rename, unlink } from 'node:fs/promises';
5
5
  import { constants } from 'node:fs';
6
6
  import { isAbsolute, join, dirname } from 'node:path';
@@ -2,7 +2,7 @@
2
2
 
3
3
  var z = require('zod');
4
4
  var node_crypto = require('node:crypto');
5
- var persistence = require('./limits-DLlsV71c.cjs');
5
+ var persistence = require('./limits-D6kiAfXJ.cjs');
6
6
  var promises = require('node:fs/promises');
7
7
  var node_fs = require('node:fs');
8
8
  var path = require('node:path');
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var agentGuidance = require('../agentGuidance-R9MH5Cd5.cjs');
3
+ var agentGuidance = require('../agentGuidance-Cg8Lha39.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 index_js = require('@modelcontextprotocol/sdk/client/index.js');
7
7
  var streamableHttp_js = require('@modelcontextprotocol/sdk/client/streamableHttp.js');
8
8
  var z = require('zod');
9
- var persistence = require('../limits-DLlsV71c.cjs');
9
+ var persistence = require('../limits-D6kiAfXJ.cjs');
10
10
  require('node:crypto');
11
11
  require('node:fs/promises');
12
12
  require('node:fs');
@@ -1,10 +1,10 @@
1
- import { P as PREVIEW_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, r as registerTeamsTools } from '../agentGuidance-DeOIgOhh.mjs';
1
+ import { P as PREVIEW_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, r as registerTeamsTools } from '../agentGuidance-CPG5Cr5T.mjs';
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
4
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
5
5
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
6
6
  import { z } from 'zod';
7
- import { C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION } from '../limits-C9aXkP7U.mjs';
7
+ import { C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION } from '../limits-BGeIBBE3.mjs';
8
8
  import 'node:crypto';
9
9
  import 'node:fs/promises';
10
10
  import 'node:fs';
@@ -4,8 +4,8 @@ var fs = require('fs');
4
4
  var path = require('path');
5
5
  var os = require('os');
6
6
  var child_process = require('child_process');
7
- var persistence = require('./limits-DLlsV71c.cjs');
8
- var index = require('./index-Dn7s2iaT.cjs');
7
+ var persistence = require('./limits-D6kiAfXJ.cjs');
8
+ var index = require('./index-B1plzL9M.cjs');
9
9
  require('node:fs/promises');
10
10
  require('node:fs');
11
11
  require('node:os');
@@ -15,7 +15,7 @@ require('node:crypto');
15
15
  require('tweetnacl');
16
16
  require('chalk');
17
17
  require('node:util');
18
- require('./types-B15E2OVy.cjs');
18
+ require('./types-Dabm17Ln.cjs');
19
19
  require('axios');
20
20
  require('node:events');
21
21
  require('socket.io-client');
@@ -30,7 +30,7 @@ require('node-pty');
30
30
  require('node:readline');
31
31
  require('@anthropic-ai/sandbox-runtime');
32
32
  require('expo-server-sdk');
33
- require('./agentGuidance-R9MH5Cd5.cjs');
33
+ require('./agentGuidance-Cg8Lha39.cjs');
34
34
  require('ink');
35
35
  require('react');
36
36
  require('@anthropic-ai/claude-agent-sdk');
@@ -2,8 +2,8 @@ import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  import { homedir } from 'os';
4
4
  import { execSync } from 'child_process';
5
- import { l as logger } from './limits-C9aXkP7U.mjs';
6
- import { j as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-D1gHXtkw.mjs';
5
+ import { l as logger } from './limits-BGeIBBE3.mjs';
6
+ import { j as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-BqUOj1zK.mjs';
7
7
  import 'node:fs/promises';
8
8
  import 'node:fs';
9
9
  import 'node:os';
@@ -13,7 +13,7 @@ import 'node:crypto';
13
13
  import 'tweetnacl';
14
14
  import 'chalk';
15
15
  import 'node:util';
16
- import './types-CA-c2NH7.mjs';
16
+ import './types-Cq-tvv9t.mjs';
17
17
  import 'axios';
18
18
  import 'node:events';
19
19
  import 'socket.io-client';
@@ -28,7 +28,7 @@ import 'node-pty';
28
28
  import 'node:readline';
29
29
  import '@anthropic-ai/sandbox-runtime';
30
30
  import 'expo-server-sdk';
31
- import './agentGuidance-DeOIgOhh.mjs';
31
+ import './agentGuidance-CPG5Cr5T.mjs';
32
32
  import 'ink';
33
33
  import 'react';
34
34
  import '@anthropic-ai/claude-agent-sdk';
@@ -3,13 +3,13 @@
3
3
  var chalk = require('chalk');
4
4
  var os = require('node:os');
5
5
  var node_crypto = require('node:crypto');
6
- var api = require('./types-B15E2OVy.cjs');
7
- var persistence = require('./limits-DLlsV71c.cjs');
6
+ var api = require('./types-Dabm17Ln.cjs');
7
+ var persistence = require('./limits-D6kiAfXJ.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
- var agentGuidance = require('./agentGuidance-R9MH5Cd5.cjs');
12
+ var agentGuidance = require('./agentGuidance-Cg8Lha39.cjs');
13
13
  var promises = require('node:fs/promises');
14
14
  var fs = require('fs/promises');
15
15
  var ink = require('ink');
@@ -7524,27 +7524,31 @@ function createUpdateController(deps) {
7524
7524
  let policy = null;
7525
7525
  let outcome = null;
7526
7526
  let running = false;
7527
+ let manualVersion = null;
7527
7528
  let operation = null;
7528
7529
  let blocked = false;
7529
7530
  let handoverHold;
7530
7531
  let lastPublished = "";
7531
7532
  const now = deps.now ?? Date.now;
7533
+ function validManualTarget(next, version) {
7534
+ return version === next.recommendedVersion && Number.isFinite(next.checkedAt) && now() - next.checkedAt <= 65 * 6e4 && next.checkedAt <= now() + 6e4 && api.compareExactVersions(next.currentVersion, version) === -1 && (!next.minimumVersion || [0, 1].includes(api.compareExactVersions(version, next.minimumVersion) ?? -1));
7535
+ }
7532
7536
  function publish(state, version, detail) {
7533
7537
  if (!policy) return;
7534
- const fingerprint = JSON.stringify([policy.checkedAt, state, version, detail]);
7538
+ const fingerprint = JSON.stringify([policy.checkedAt, state, version, detail, manualVersion]);
7535
7539
  if (fingerprint === lastPublished) return;
7536
7540
  lastPublished = fingerprint;
7537
- outcome = { state, version, detail, at: now() };
7538
- deps.publish({ ...policy, retrySupported: !blocked, handoverHold, autoUpdate: outcome });
7541
+ outcome = { state, version, detail, at: now(), ...manualVersion ? { source: "manual" } : {} };
7542
+ deps.publish({ ...policy, retrySupported: !blocked, manualUpdateSupported: !blocked, handoverHold, autoUpdate: outcome });
7539
7543
  }
7540
7544
  async function evaluate() {
7541
7545
  if (!policy || running) return;
7542
- const target = policy.autoUpdateVersion ?? null;
7546
+ const target = manualVersion ?? policy.autoUpdateVersion ?? null;
7543
7547
  if (outcome?.version === target && ["failed", "installed"].includes(outcome.state)) {
7544
- const fingerprint = JSON.stringify([policy.checkedAt, outcome.state, outcome.version, outcome.detail]);
7548
+ const fingerprint = JSON.stringify([policy.checkedAt, outcome.state, outcome.version, outcome.detail, manualVersion]);
7545
7549
  if (fingerprint !== lastPublished) {
7546
7550
  lastPublished = fingerprint;
7547
- deps.publish({ ...policy, retrySupported: !blocked, handoverHold, autoUpdate: outcome });
7551
+ deps.publish({ ...policy, retrySupported: !blocked, manualUpdateSupported: !blocked, handoverHold, autoUpdate: outcome });
7548
7552
  }
7549
7553
  return;
7550
7554
  }
@@ -7552,7 +7556,7 @@ function createUpdateController(deps) {
7552
7556
  publish("policy_stale", target);
7553
7557
  return;
7554
7558
  }
7555
- if (!await deps.enabled()) {
7559
+ if (!manualVersion && !await deps.enabled()) {
7556
7560
  publish("disabled", target);
7557
7561
  return;
7558
7562
  }
@@ -7605,6 +7609,7 @@ function createUpdateController(deps) {
7605
7609
  try {
7606
7610
  const next = await deps.policy();
7607
7611
  if (!next) return;
7612
+ if (manualVersion && !validManualTarget(next, manualVersion)) manualVersion = null;
7608
7613
  policy = next;
7609
7614
  await evaluate();
7610
7615
  } finally {
@@ -7619,10 +7624,10 @@ function createUpdateController(deps) {
7619
7624
  operation = "retry";
7620
7625
  try {
7621
7626
  const next = await deps.policy();
7622
- if (!next || next.autoUpdateVersion !== version || now() - next.checkedAt > 65 * 6e4) {
7627
+ if (!next || (manualVersion ? !validManualTarget(next, version) : next.autoUpdateVersion !== version || now() - next.checkedAt > 65 * 6e4)) {
7623
7628
  return { error: "update_policy_changed_or_unavailable" };
7624
7629
  }
7625
- if (!await deps.enabled()) return { error: "auto_update_disabled" };
7630
+ if (!manualVersion && !await deps.enabled()) return { error: "auto_update_disabled" };
7626
7631
  policy = next;
7627
7632
  outcome = null;
7628
7633
  handoverHold = null;
@@ -7635,6 +7640,37 @@ function createUpdateController(deps) {
7635
7640
  operation = null;
7636
7641
  }
7637
7642
  }
7643
+ async function request(version) {
7644
+ if (operation || blocked) return { error: blocked ? "manual_recovery_required" : "update_in_progress" };
7645
+ operation = "request";
7646
+ try {
7647
+ const next = await deps.policy();
7648
+ if (next && manualVersion && !validManualTarget(next, manualVersion)) {
7649
+ manualVersion = null;
7650
+ policy = next;
7651
+ publish("policy_stale", null);
7652
+ }
7653
+ if (!next || typeof version !== "string" || !validManualTarget(next, version)) {
7654
+ return { error: "update_policy_changed_or_unavailable" };
7655
+ }
7656
+ if (outcome?.version === version && (outcome.state === "installed" || manualVersion === version && outcome.state === "waiting_idle")) {
7657
+ policy = next;
7658
+ publish(outcome.state, version, outcome.detail);
7659
+ return { accepted: true };
7660
+ }
7661
+ policy = next;
7662
+ manualVersion = version;
7663
+ outcome = null;
7664
+ handoverHold = null;
7665
+ publish("waiting_idle", version);
7666
+ setTimeout(() => {
7667
+ void tick().catch(() => publish("policy_stale", version));
7668
+ }, 0);
7669
+ return { accepted: true };
7670
+ } finally {
7671
+ operation = null;
7672
+ }
7673
+ }
7638
7674
  async function withHandover(task) {
7639
7675
  if (operation || blocked) return;
7640
7676
  operation = "handover";
@@ -7646,9 +7682,9 @@ function createUpdateController(deps) {
7646
7682
  }
7647
7683
  function holdHandover(reason) {
7648
7684
  handoverHold = { reason, at: now() };
7649
- publish("failed", policy?.autoUpdateVersion ?? null, "handover_preflight_failed");
7685
+ publish("failed", manualVersion ?? policy?.autoUpdateVersion ?? null, "handover_preflight_failed");
7650
7686
  }
7651
- return { refresh, retry, tick, withHandover, holdHandover, isRunning: () => running };
7687
+ return { refresh, retry, request, tick, withHandover, holdHandover, isRunning: () => running };
7652
7688
  }
7653
7689
 
7654
7690
  const CLAUDE_KEYCHAIN_SERVICE_PREFIX = "Claude Code";
@@ -7714,7 +7750,7 @@ function parseJsonObject(text) {
7714
7750
  return null;
7715
7751
  }
7716
7752
  }
7717
- 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-Dn7s2iaT.cjs', document.baseURI).href))).resolve(s)) {
7753
+ 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-B1plzL9M.cjs', document.baseURI).href))).resolve(s)) {
7718
7754
  const platformArch = `${platform}-${arch}`;
7719
7755
  const candidates = [
7720
7756
  `@anthropic-ai/claude-agent-sdk-${platformArch}/claude`,
@@ -10945,6 +10981,7 @@ async function startDaemon() {
10945
10981
  }
10946
10982
  });
10947
10983
  apiMachine.setCliUpdateRetryHandler(updateController.retry);
10984
+ apiMachine.setCliUpdateRequestHandler(updateController.request);
10948
10985
  const refreshCliUpdate = () => updateController.refresh().catch((error) => {
10949
10986
  persistence.logger.debug("[DAEMON RUN] CLI update policy check failed:", error);
10950
10987
  });
@@ -12003,7 +12040,7 @@ function cleanupHookSettingsFile(filepath) {
12003
12040
  }
12004
12041
  }
12005
12042
 
12006
- function registerKillSessionHandler(rpcHandlerManager, killThisHappy, archiveEvents) {
12043
+ function registerKillSessionHandler(rpcHandlerManager, killThisHappy, archiveEvents, options) {
12007
12044
  let terminationStarted = false;
12008
12045
  const terminateOnce = () => {
12009
12046
  if (terminationStarted) return;
@@ -12011,6 +12048,10 @@ function registerKillSessionHandler(rpcHandlerManager, killThisHappy, archiveEve
12011
12048
  void killThisHappy();
12012
12049
  };
12013
12050
  archiveEvents.on("archived", terminateOnce);
12051
+ if (options?.processSignals) {
12052
+ process.on("SIGTERM", terminateOnce);
12053
+ process.on("SIGINT", terminateOnce);
12054
+ }
12014
12055
  rpcHandlerManager.registerHandler("killSession", async () => {
12015
12056
  persistence.logger.debug("Kill session request received");
12016
12057
  terminateOnce();
@@ -12019,6 +12060,13 @@ function registerKillSessionHandler(rpcHandlerManager, killThisHappy, archiveEve
12019
12060
  message: "Killing happy-cli process"
12020
12061
  };
12021
12062
  });
12063
+ return () => {
12064
+ archiveEvents.off?.("archived", terminateOnce);
12065
+ if (options?.processSignals) {
12066
+ process.off("SIGTERM", terminateOnce);
12067
+ process.off("SIGINT", terminateOnce);
12068
+ }
12069
+ };
12022
12070
  }
12023
12071
 
12024
12072
  const SIDE_QUESTION_SYSTEM_PROMPT = [
@@ -12133,7 +12181,7 @@ function registerSideQuestionHandler(rpc, deps) {
12133
12181
  const retainMs = deps.retainMs ?? SIDE_QUESTION_RETAIN_MS;
12134
12182
  const maxRunMs = deps.maxRunMs ?? SIDE_QUESTION_MAX_RUN_MS;
12135
12183
  const run = deps.run ?? (async (input) => {
12136
- const { query } = await Promise.resolve().then(function () { return require('./index-Bqg6yo5s.cjs'); });
12184
+ const { query } = await Promise.resolve().then(function () { return require('./index-CX-zp3FH.cjs'); });
12137
12185
  return runSideQuestion(query, input);
12138
12186
  });
12139
12187
  const slots = /* @__PURE__ */ new Map();
@@ -12235,7 +12283,7 @@ const MAX_TITLE_CHARS = 60;
12235
12283
  const GENERATION_TIMEOUT_MS = 3e4;
12236
12284
  function resolveClaudeBinary() {
12237
12285
  try {
12238
- 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-Dn7s2iaT.cjs', document.baseURI).href)));
12286
+ 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-B1plzL9M.cjs', document.baseURI).href)));
12239
12287
  const utilsPath = path.resolve(path.join(api.projectPath(), "scripts", "claude_version_utils.cjs"));
12240
12288
  const { getClaudeCliPath } = require$1(utilsPath);
12241
12289
  const path$1 = getClaudeCliPath();
@@ -14453,9 +14501,9 @@ function resolveLocalSignupBootstrap(configuredMode, configuredInviteCodes, gene
14453
14501
  };
14454
14502
  }
14455
14503
 
14456
- 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-Dn7s2iaT.cjs', document.baseURI).href)));
14504
+ 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-B1plzL9M.cjs', document.baseURI).href)));
14457
14505
  const __dirname$1 = path.dirname(__filename$1);
14458
- const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Dn7s2iaT.cjs', document.baseURI).href)));
14506
+ const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-B1plzL9M.cjs', document.baseURI).href)));
14459
14507
  const PRISMA_QUERY_ENGINE_FILES = {
14460
14508
  "arm64-darwin": "libquery_engine-darwin-arm64.dylib.node",
14461
14509
  "x64-darwin": "libquery_engine-darwin.dylib.node",
@@ -16612,7 +16660,7 @@ async function runCodex(opts) {
16612
16660
  }
16613
16661
  };
16614
16662
  session.rpcHandlerManager.registerHandler("abort", handleAbort);
16615
- registerKillSessionHandler(session.rpcHandlerManager, handleKillSession, session);
16663
+ const disposeTermination = registerKillSessionHandler(session.rpcHandlerManager, handleKillSession, session, { processSignals: true });
16616
16664
  const messageBuffer = new MessageBuffer();
16617
16665
  const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
16618
16666
  let inkInstance = null;
@@ -16948,6 +16996,7 @@ async function runCodex(opts) {
16948
16996
  }
16949
16997
  }
16950
16998
  } finally {
16999
+ disposeTermination?.();
16951
17000
  persistence.logger.debug("[codex]: Final cleanup start");
16952
17001
  logActiveHandles("cleanup-start");
16953
17002
  if (reconnectionHandle) {
@@ -17150,7 +17199,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17150
17199
  process.exit(0);
17151
17200
  } else if (subcommand === "install-terminal-hooks") {
17152
17201
  try {
17153
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-CPZ3vVn8.cjs'); });
17202
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-DPmEaHg2.cjs'); });
17154
17203
  const command = parseTerminalHooksArgs(args.slice(1));
17155
17204
  if (command.action === "help") {
17156
17205
  console.log(TERMINAL_HOOKS_HELP);
@@ -17167,7 +17216,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17167
17216
  }
17168
17217
  } else if (subcommand === "spawn") {
17169
17218
  try {
17170
- const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-Dmfbot5k.cjs'); });
17219
+ const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-gha6nGx-.cjs'); });
17171
17220
  await handleSpawnCommand(args.slice(1));
17172
17221
  } catch (error) {
17173
17222
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -17179,7 +17228,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17179
17228
  return;
17180
17229
  } else if (subcommand === "sessions") {
17181
17230
  try {
17182
- const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-BBc8L8qf.cjs'); });
17231
+ const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-DyC5Attg.cjs'); });
17183
17232
  await handleSessionsCommand(args.slice(1));
17184
17233
  } catch (error) {
17185
17234
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -17191,7 +17240,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17191
17240
  return;
17192
17241
  } else if (subcommand === "send") {
17193
17242
  try {
17194
- const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-gH1vJ0iv.cjs'); });
17243
+ const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-Bo6iKuXr.cjs'); });
17195
17244
  await handleSendCommand(args.slice(1));
17196
17245
  } catch (error) {
17197
17246
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -17297,9 +17346,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17297
17346
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
17298
17347
  const projectId = args[3];
17299
17348
  try {
17300
- const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-CkmssSRu.cjs'); });
17301
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-DLlsV71c.cjs'); }).then(function (n) { return n.persistence; });
17302
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-B15E2OVy.cjs'); }).then(function (n) { return n.api; });
17349
+ const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-C3e90AIH.cjs'); });
17350
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-D6kiAfXJ.cjs'); }).then(function (n) { return n.persistence; });
17351
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-Dabm17Ln.cjs'); }).then(function (n) { return n.api; });
17303
17352
  let userEmail = void 0;
17304
17353
  try {
17305
17354
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -17330,7 +17379,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17330
17379
  }
17331
17380
  if (geminiSubcommand === "project" && args[2] === "get") {
17332
17381
  try {
17333
- const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-CkmssSRu.cjs'); });
17382
+ const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-C3e90AIH.cjs'); });
17334
17383
  const config = readGeminiLocalConfig();
17335
17384
  if (config.googleCloudProject) {
17336
17385
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -17370,7 +17419,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17370
17419
  process.exit(0);
17371
17420
  }
17372
17421
  try {
17373
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-Cx1YcK2o.cjs'); });
17422
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BPPnulIk.cjs'); });
17374
17423
  let startedBy = void 0;
17375
17424
  for (let i = 1; i < args.length; i++) {
17376
17425
  if (args[i] === "--started-by") {
@@ -17400,7 +17449,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17400
17449
  }
17401
17450
  };
17402
17451
  try {
17403
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-CjopZZg3.cjs'); });
17452
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-jqG8CV0c.cjs'); });
17404
17453
  const parsed = parsePiRunnerArgs(args.slice(1));
17405
17454
  const resolved = resolveAcpAgentConfig(["pi", ...parsed.passthrough]);
17406
17455
  const { credentials } = await authAndSetupMachineIfNeeded();
@@ -17428,7 +17477,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17428
17477
  return;
17429
17478
  } else if (subcommand === "acp") {
17430
17479
  try {
17431
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-CjopZZg3.cjs'); });
17480
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-jqG8CV0c.cjs'); });
17432
17481
  let startedBy = void 0;
17433
17482
  let verbose = false;
17434
17483
  const acpArgs = [];
@@ -17468,7 +17517,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17468
17517
  return;
17469
17518
  } else if (subcommand === "openclaw") {
17470
17519
  try {
17471
- const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-I4sGAQf1.cjs'); });
17520
+ const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-BB3Ivt1S.cjs'); });
17472
17521
  let startedBy = void 0;
17473
17522
  let verbose = false;
17474
17523
  let gatewayUrl;
@@ -17519,7 +17568,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17519
17568
  return;
17520
17569
  } else if (subcommand === "todo") {
17521
17570
  try {
17522
- const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-DOi6svw9.cjs'); });
17571
+ const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-BaNaNZ8c.cjs'); });
17523
17572
  await handleTodoCommand(args.slice(1));
17524
17573
  } catch (error) {
17525
17574
  console.error(JSON.stringify({ error: error instanceof Error ? error.message : "Todo command failed" }));
@@ -17528,7 +17577,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17528
17577
  return;
17529
17578
  } else if (subcommand === "teams") {
17530
17579
  try {
17531
- const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-DtXQYmEK.cjs'); });
17580
+ const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-BbzWNV9e.cjs'); });
17532
17581
  await handleTeamsCommand(args.slice(1));
17533
17582
  } catch (error) {
17534
17583
  console.error(error instanceof Error ? error.message : "Teams command failed");
@@ -17537,7 +17586,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
17537
17586
  return;
17538
17587
  } else if (subcommand === "mcp" && args.length === 1) {
17539
17588
  try {
17540
- const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-DHkYfENQ.cjs'); });
17589
+ const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-DGZmUpuZ.cjs'); });
17541
17590
  await handleMcpCommand();
17542
17591
  } catch (error) {
17543
17592
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}
@@ -1,9 +1,9 @@
1
- import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-BNMLGtST.mjs';
2
- export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-BNMLGtST.mjs';
3
- import { c as configuration, g as readSettings, i as encodeBase64, l as logger } from './limits-C9aXkP7U.mjs';
4
- import { A as AcpSessionManager } from './AcpSessionManager-BF5JZYCC.mjs';
5
- import { f as connectionState, A as ApiClient, p as projectPath, g as BUILTIN_TODO_DISCOVERY } from './types-CA-c2NH7.mjs';
6
- import { P as PI_TEAMS_EXTENSION, n as initialMachineMetadata, o as createSessionMetadata, u as setupOfflineReconnection, v as notifyDaemonSessionStarted, z as StreamRelay, x as MessageQueue2, B as hashObject, C as startHappyServer, E as registerAgentAttachmentDownloads, F as TitleGenerator, y as registerKillSessionHandler, H as CLAUDE_ATTACHMENT_KINDS, I as stageClaudeAttachments, J as appendStagedAttachmentsToPrompt, K as BasePermissionHandler, L as writeSessionModeFile, N as normalizeAcpPermissionMode, O as removeSessionModeFile } from './index-D1gHXtkw.mjs';
1
+ import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-B8KEjDwF.mjs';
2
+ export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-B8KEjDwF.mjs';
3
+ import { c as configuration, g as readSettings, i as encodeBase64, l as logger } from './limits-BGeIBBE3.mjs';
4
+ import { A as AcpSessionManager } from './AcpSessionManager-KlDZbEmZ.mjs';
5
+ import { f as connectionState, A as ApiClient, p as projectPath, g as BUILTIN_TODO_DISCOVERY } from './types-Cq-tvv9t.mjs';
6
+ import { P as PI_TEAMS_EXTENSION, n as initialMachineMetadata, o as createSessionMetadata, u as setupOfflineReconnection, v as notifyDaemonSessionStarted, z as StreamRelay, x as MessageQueue2, B as hashObject, C as startHappyServer, E as registerAgentAttachmentDownloads, F as TitleGenerator, y as registerKillSessionHandler, H as CLAUDE_ATTACHMENT_KINDS, I as stageClaudeAttachments, J as appendStagedAttachmentsToPrompt, K as BasePermissionHandler, L as writeSessionModeFile, N as normalizeAcpPermissionMode, O as removeSessionModeFile } from './index-BqUOj1zK.mjs';
7
7
  import { mkdir, chmod, writeFile, rename } from 'node:fs/promises';
8
8
  import { randomUUID } from 'node:crypto';
9
9
  import { join } from 'node:path';
@@ -32,7 +32,7 @@ import 'fs';
32
32
  import 'node:readline';
33
33
  import '@anthropic-ai/sandbox-runtime';
34
34
  import 'expo-server-sdk';
35
- import './agentGuidance-DeOIgOhh.mjs';
35
+ import './agentGuidance-CPG5Cr5T.mjs';
36
36
  import 'ink';
37
37
  import 'react';
38
38
  import '@anthropic-ai/claude-agent-sdk';
@@ -749,6 +749,7 @@ async function runAcp(opts) {
749
749
  let shouldExit = false;
750
750
  let abortController = new AbortController();
751
751
  let pendingTurn = null;
752
+ let turnCancelled = false;
752
753
  const clearPendingTurn = (error) => {
753
754
  if (!pendingTurn) {
754
755
  return;
@@ -1094,6 +1095,7 @@ async function runAcp(opts) {
1094
1095
  session.keepAlive(thinking, "remote");
1095
1096
  }, 2e3);
1096
1097
  async function handleAbort() {
1098
+ turnCancelled = thinking;
1097
1099
  try {
1098
1100
  if (acpSessionId) {
1099
1101
  await backend.cancel(acpSessionId);
@@ -1123,12 +1125,12 @@ async function runAcp(opts) {
1123
1125
  return { mode };
1124
1126
  }
1125
1127
  );
1126
- registerKillSessionHandler(session.rpcHandlerManager, async () => {
1128
+ const disposeTermination = registerKillSessionHandler(session.rpcHandlerManager, async () => {
1127
1129
  shouldExit = true;
1128
1130
  messageQueue.close();
1129
1131
  clearPendingTurn(new Error("Session terminated"));
1130
1132
  await handleAbort();
1131
- }, session);
1133
+ }, session, { processSignals: true });
1132
1134
  try {
1133
1135
  const started = await backend.startSession();
1134
1136
  acpSessionId = started.sessionId;
@@ -1174,8 +1176,11 @@ async function runAcp(opts) {
1174
1176
  }
1175
1177
  logAcp("incoming", `Incoming prompt: ${formatUnknownForConsole(batch.message, ACP_EVENT_PREVIEW_CHARS)}`);
1176
1178
  sendEnvelopes(sessionManager.startTurn());
1179
+ turnCancelled = false;
1177
1180
  setThinking(true);
1178
1181
  const turnEnded = waitForTurnEnd();
1182
+ void turnEnded.catch(() => {
1183
+ });
1179
1184
  try {
1180
1185
  if (typeof batch.mode.permissionMode === "string" && batch.mode.permissionMode.length > 0) {
1181
1186
  await switchPermissionModeIfRequested(batch.mode.permissionMode);
@@ -1195,7 +1200,7 @@ ${BUILTIN_TODO_DISCOVERY}`;
1195
1200
  await backend.sendPrompt(acpSessionId, appendStagedAttachmentsToPrompt(prompt, staged), attachments);
1196
1201
  todoDiscoverySent = true;
1197
1202
  await turnEnded;
1198
- sendEnvelopes(sessionManager.endTurn("completed"));
1203
+ sendEnvelopes(sessionManager.endTurn(turnCancelled ? "cancelled" : "completed"));
1199
1204
  streamRelay.endTurn();
1200
1205
  setThinking(false);
1201
1206
  session.sendSessionEvent({ type: "ready" });
@@ -1214,6 +1219,7 @@ ${BUILTIN_TODO_DISCOVERY}`;
1214
1219
  }
1215
1220
  }
1216
1221
  } finally {
1222
+ disposeTermination?.();
1217
1223
  setThinking(false);
1218
1224
  clearInterval(keepAliveInterval);
1219
1225
  streamRelay.endTurn();