happy-imou-cloud 2.1.55 → 2.1.57

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 (53) hide show
  1. package/dist/{BaseReasoningProcessor-Dki9homz.cjs → BaseReasoningProcessor-C67V1qL3.cjs} +1 -1
  2. package/dist/{BaseReasoningProcessor-D1sM3Q7L.mjs → BaseReasoningProcessor-D2Q8Nme5.mjs} +1 -1
  3. package/dist/{ConversationHistory-0k9JVK1V.mjs → ConversationHistory-BBIe2m4P.mjs} +3 -4
  4. package/dist/{ConversationHistory-qacGLrlL.cjs → ConversationHistory-atrS3PAx.cjs} +9 -10
  5. package/dist/{ProviderSelectionHandler-N1pndtnU.mjs → ProviderSelectionHandler-Qi2pFTxL.mjs} +2 -2
  6. package/dist/{ProviderSelectionHandler-Bc4-nkHI.cjs → ProviderSelectionHandler-h3z4-foa.cjs} +2 -2
  7. package/dist/{bootstrapManagedProviderSession-D8-8Q3mN.mjs → bootstrapManagedProviderSession-AhAYHLGj.mjs} +2 -2
  8. package/dist/{bootstrapManagedProviderSession-BSvR42PU.cjs → bootstrapManagedProviderSession-RLtyRq0n.cjs} +2 -2
  9. package/dist/{command-CNQbqCNo.cjs → command-CyzKMQbs.cjs} +7 -25
  10. package/dist/{command-kCu_CfoX.mjs → command-DRRTqKEA.mjs} +6 -24
  11. package/dist/{config-B1xP_Nn4.mjs → config-BXTUTPxJ.mjs} +2 -2
  12. package/dist/{config-DlNGxB2C.cjs → config-BqFnXbs0.cjs} +1 -1
  13. package/dist/{index-B3MHJb_p.mjs → index-BCLSXYQP.mjs} +30 -618
  14. package/dist/{index-D3ybrRvv.cjs → index-BoSqCbVr.cjs} +28 -629
  15. package/dist/index.cjs +4 -4
  16. package/dist/index.mjs +4 -4
  17. package/dist/{installFatalProcessHandlers-BNyeh_kZ.mjs → installFatalProcessHandlers-B99QpyLN.mjs} +1 -1
  18. package/dist/{installFatalProcessHandlers-BgD0JeUY.cjs → installFatalProcessHandlers-DyyiLNrG.cjs} +1 -1
  19. package/dist/{launch-D3RkSzmj.mjs → launch-DRd9FuLt.mjs} +6 -24
  20. package/dist/{launch-Blm8KHa6.cjs → launch-DnWvtpv4.cjs} +7 -25
  21. package/dist/lib.cjs +9 -1
  22. package/dist/lib.d.cts +414 -408
  23. package/dist/lib.d.mts +414 -408
  24. package/dist/lib.mjs +9 -1
  25. package/dist/{runClaude-vHxxBRCD.cjs → runClaude-DOlxK2PO.cjs} +22 -25
  26. package/dist/{runClaude-Bv8y1SS9.mjs → runClaude-Df_7_PkI.mjs} +7 -10
  27. package/dist/{runCodex-BIlFckCC.cjs → runCodex-ClqZb2wh.cjs} +36 -41
  28. package/dist/{runCodex-CCMOgVeu.mjs → runCodex-DP-67NuP.mjs} +10 -15
  29. package/dist/{runCursor-DS30KiFi.cjs → runCursor-ClUxehsP.cjs} +17 -21
  30. package/dist/{runCursor-31OZtyc5.mjs → runCursor-CqElKVpg.mjs} +15 -19
  31. package/dist/{runGemini-DYgMC16z.mjs → runGemini-CVyRbdZg.mjs} +10 -12
  32. package/dist/{runGemini-BVeW9RS6.cjs → runGemini-CmrMnkBU.cjs} +16 -18
  33. package/dist/{sessionControl-C92KNiqm.mjs → sessionControl-BovRthCu.mjs} +12 -4
  34. package/dist/{sessionControl-CYwKuJZa.cjs → sessionControl-C1bgV3SZ.cjs} +16 -8
  35. package/dist/{types-n7tu2s6X.mjs → types-BZeEK90l.mjs} +6458 -7
  36. package/dist/{types-rroNN6ng.cjs → types-CcsR2bJq.cjs} +6474 -1
  37. package/package.json +6 -5
  38. package/dist/AcpBackend-Cn35Zh4a.mjs +0 -2619
  39. package/dist/AcpBackend-Cnemq0Xi.cjs +0 -2621
  40. package/dist/RuntimeShell-B7sU6Xzu.cjs +0 -258
  41. package/dist/RuntimeShell-DXgX6DWL.mjs +0 -252
  42. package/dist/claude-ZqCIeRvV.mjs +0 -1073
  43. package/dist/claude-ruqZmLWR.cjs +0 -1080
  44. package/dist/codex-DNZNx4t8.mjs +0 -577
  45. package/dist/codex-h3N30twQ.cjs +0 -582
  46. package/dist/createDefaultRuntimeShell-BPgsP29s.mjs +0 -31
  47. package/dist/createDefaultRuntimeShell-Bp-CgZeN.cjs +0 -33
  48. package/dist/cursor-B4IzFkEb.cjs +0 -91
  49. package/dist/cursor-DgMcEhW1.mjs +0 -88
  50. package/dist/future-Dq4Ha1Dn.cjs +0 -24
  51. package/dist/future-xRdLl3vf.mjs +0 -22
  52. package/dist/resolveCommand-CsPlUeu4.cjs +0 -193
  53. package/dist/resolveCommand-DF9Hq3Bt.mjs +0 -189
@@ -1,5 +1,5 @@
1
1
  import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
2
- import { l as logger, t as encodeBase64, c as configuration, u as readCredentials, v as ensureSigningCredentials, r as readSettings, w as updateSettings, x as encodeBase64Url, d as delay, y as buildClientHeaders, z as decodeBase64, B as writeCredentialsLegacy, C as writeCredentialsDataKey, D as readDaemonState, E as HAPPY_CLOUD_DAEMON_PORT, F as clearDaemonState, p as packageJson, i as isAuthenticationRequiredError, G as buildSessionRuntimeIndex, I as acquireDaemonLock, J as writeDaemonState, A as ApiClient, K as releaseDaemonLock, L as validateProfileForAgent, M as getProfileEnvironmentVariables, N as clearCredentials, O as clearMachineId, P as readHappyOrgDispatchTruthSnapshot, Q as processHappyOrgRepoRequests, S as readHappyOrgRepoTaskBoard, T as HappyOrgTurnReportSchema, U as recordHappyOrgTurnReport, V as MessageContentSchema, W as buildSocketAuth, X as encrypt, Y as getLatestDaemonLog } from './types-n7tu2s6X.mjs';
2
+ import { U as logger, E as encodeBase64, v as configuration, a1 as readCredentials, J as ensureSigningCredentials, a5 as readSettings, ae as updateSettings, G as encodeBase64Url, D as delay, p as buildClientHeaders, C as decodeBase64, ai as writeCredentialsLegacy, ah as writeCredentialsDataKey, a2 as readDaemonState, H as HAPPY_CLOUD_DAEMON_PORT, $ as projectPath, t as clearDaemonState, X as packageJson, S as isBun, Q as isAuthenticationRequiredError, q as buildSessionRuntimeIndex, m as acquireDaemonLock, aj as writeDaemonState, b as ApiClient, a7 as releaseDaemonLock, ag as validateProfileForAgent, N as getProfileEnvironmentVariables, s as clearCredentials, u as clearMachineId, a3 as readHappyOrgDispatchTruthSnapshot, _ as processHappyOrgRepoRequests, a4 as readHappyOrgRepoTaskBoard, j as HappyOrgTurnReportSchema, a6 as recordHappyOrgTurnReport, M as MessageContentSchema, r as buildSocketAuth, I as encrypt, L as getLatestDaemonLog } from './types-BZeEK90l.mjs';
3
3
  import { z } from 'zod';
4
4
  import fs, { writeFile as writeFile$1, rename, unlink as unlink$1 } from 'fs/promises';
5
5
  import os$1, { homedir as homedir$1 } from 'os';
@@ -10,15 +10,14 @@ import qrcode from 'qrcode-terminal';
10
10
  import { writeFile, unlink, readdir, readFile, mkdir } from 'node:fs/promises';
11
11
  import { createRequire } from 'node:module';
12
12
  import os, { tmpdir, homedir } from 'node:os';
13
- import { join, delimiter, resolve as resolve$1, dirname as dirname$1, normalize } from 'node:path';
13
+ import { join, delimiter, resolve, dirname, normalize } from 'node:path';
14
14
  import open from 'open';
15
15
  import React, { useState } from 'react';
16
16
  import { useInput, Box, Text, render } from 'ink';
17
17
  import { spawn, execSync, exec } from 'child_process';
18
- import { dirname, resolve, join as join$1 } from 'path';
19
- import { fileURLToPath } from 'url';
20
18
  import { readFileSync as readFileSync$1, existsSync as existsSync$1, writeFileSync as writeFileSync$1, chmodSync as chmodSync$1, unlinkSync as unlinkSync$1, mkdirSync as mkdirSync$1 } from 'fs';
21
- import { execFileSync, spawn as spawn$2, execSync as execSync$1 } from 'node:child_process';
19
+ import { join as join$1 } from 'path';
20
+ import { execFileSync, spawn as spawn$2 } from 'node:child_process';
22
21
  import psList from 'ps-list';
23
22
  import spawn$1 from 'cross-spawn';
24
23
  import { existsSync, readFileSync, readdirSync, statSync, mkdtempSync, writeFileSync, chmodSync, unlinkSync, mkdirSync, cpSync, rmSync } from 'node:fs';
@@ -30,7 +29,6 @@ import { createServer } from 'http';
30
29
  import { promisify } from 'util';
31
30
  import { io } from 'socket.io-client';
32
31
  import '@agentclientprotocol/sdk';
33
- import { fileURLToPath as fileURLToPath$1 } from 'node:url';
34
32
  import 'node:events';
35
33
  import 'sharp';
36
34
 
@@ -615,12 +613,6 @@ function setupCleanupHandlers() {
615
613
  });
616
614
  }
617
615
 
618
- const __dirname$2 = dirname(fileURLToPath(import.meta.url));
619
- function projectPath() {
620
- const path = resolve(__dirname$2, "..");
621
- return path;
622
- }
623
-
624
616
  const WINDOWS_PROCESS_QUERY_MAX_BUFFER_BYTES = 16 * 1024 * 1024;
625
617
  function classifyHappyProcessLookup(proc) {
626
618
  const match = classifyHappyProcess(proc);
@@ -1429,34 +1421,6 @@ ${typeLabels[type] || type}:`));
1429
1421
  console.log(chalk.green("\n\u2705 Doctor diagnosis complete!\n"));
1430
1422
  }
1431
1423
 
1432
- let cachedRuntime = null;
1433
- function getRuntime() {
1434
- if (cachedRuntime) return cachedRuntime;
1435
- if (typeof globalThis.Bun !== "undefined") {
1436
- cachedRuntime = "bun";
1437
- return cachedRuntime;
1438
- }
1439
- if (typeof globalThis.Deno !== "undefined") {
1440
- cachedRuntime = "deno";
1441
- return cachedRuntime;
1442
- }
1443
- if (process?.versions?.bun) {
1444
- cachedRuntime = "bun";
1445
- return cachedRuntime;
1446
- }
1447
- if (process?.versions?.deno) {
1448
- cachedRuntime = "deno";
1449
- return cachedRuntime;
1450
- }
1451
- if (process?.versions?.node) {
1452
- cachedRuntime = "node";
1453
- return cachedRuntime;
1454
- }
1455
- cachedRuntime = "unknown";
1456
- return cachedRuntime;
1457
- }
1458
- const isBun = () => getRuntime() === "bun";
1459
-
1460
1424
  function spawnHappyCLI(args, options = {}) {
1461
1425
  const projectRoot = projectPath();
1462
1426
  const entrypoint = join(projectRoot, "dist", "index.mjs");
@@ -2699,7 +2663,7 @@ function pathExists(targetPath) {
2699
2663
  return existsSync(targetPath);
2700
2664
  }
2701
2665
  function normalizePathKey(targetPath) {
2702
- const normalizedPath = normalize(resolve$1(targetPath));
2666
+ const normalizedPath = normalize(resolve(targetPath));
2703
2667
  return process.platform === "win32" ? normalizedPath.toLowerCase() : normalizedPath;
2704
2668
  }
2705
2669
  function normalizeTextKey(target) {
@@ -2729,7 +2693,7 @@ function isCeoHomeContentsPath(homePath) {
2729
2693
  return pathExists(join(homePath, "IDENTITY.md")) || pathExists(join(homePath, "AGENT.md"));
2730
2694
  }
2731
2695
  function inferHomeSource(homePath) {
2732
- const parentDirName = dirname$1(resolve$1(homePath)).split(/[\\/]/).pop()?.toLowerCase();
2696
+ const parentDirName = dirname(resolve(homePath)).split(/[\\/]/).pop()?.toLowerCase();
2733
2697
  if (parentDirName === "positions") {
2734
2698
  return "position-home";
2735
2699
  }
@@ -2739,18 +2703,18 @@ function inferHomeSource(homePath) {
2739
2703
  return null;
2740
2704
  }
2741
2705
  function isCeoHomePath(homePath) {
2742
- const resolvedHomePath = resolve$1(homePath);
2706
+ const resolvedHomePath = resolve(homePath);
2743
2707
  const homeDirName = resolvedHomePath.split(/[\\/]/).pop()?.toLowerCase();
2744
2708
  const source = inferHomeSource(resolvedHomePath);
2745
2709
  return homeDirName === "ceo" && source !== null && isCeoHomeContentsPath(resolvedHomePath);
2746
2710
  }
2747
2711
  function findExpectedHomePath(startPath) {
2748
- let currentPath = resolve$1(startPath);
2712
+ let currentPath = resolve(startPath);
2749
2713
  while (true) {
2750
2714
  if (isCeoHomePath(currentPath)) {
2751
2715
  return currentPath;
2752
2716
  }
2753
- const parentPath = dirname$1(currentPath);
2717
+ const parentPath = dirname(currentPath);
2754
2718
  if (parentPath === currentPath) {
2755
2719
  return null;
2756
2720
  }
@@ -2758,11 +2722,11 @@ function findExpectedHomePath(startPath) {
2758
2722
  }
2759
2723
  }
2760
2724
  function deriveOrganizationRootFromHomePath(homePath) {
2761
- const resolvedHomePath = resolve$1(homePath);
2725
+ const resolvedHomePath = resolve(homePath);
2762
2726
  if (!isCeoHomePath(resolvedHomePath)) {
2763
2727
  return null;
2764
2728
  }
2765
- return dirname$1(dirname$1(resolvedHomePath));
2729
+ return dirname(dirname(resolvedHomePath));
2766
2730
  }
2767
2731
  function collectCandidateRoots(startPath) {
2768
2732
  const candidates = /* @__PURE__ */ new Map();
@@ -2770,13 +2734,13 @@ function collectCandidateRoots(startPath) {
2770
2734
  if (!candidateRootPath || !isHappyOrgRoot(candidateRootPath)) {
2771
2735
  return;
2772
2736
  }
2773
- candidates.set(normalizePathKey(candidateRootPath), resolve$1(candidateRootPath));
2737
+ candidates.set(normalizePathKey(candidateRootPath), resolve(candidateRootPath));
2774
2738
  };
2775
- let currentPath = resolve$1(startPath);
2739
+ let currentPath = resolve(startPath);
2776
2740
  while (true) {
2777
2741
  addCandidate(currentPath);
2778
2742
  addCandidate(deriveOrganizationRootFromHomePath(currentPath));
2779
- const parentPath = dirname$1(currentPath);
2743
+ const parentPath = dirname(currentPath);
2780
2744
  if (parentPath === currentPath) {
2781
2745
  break;
2782
2746
  }
@@ -2838,7 +2802,7 @@ function readHomeIdentity(homePath, source) {
2838
2802
  const identityMarkdown = readTextIfExists(join(homePath, "IDENTITY.md"));
2839
2803
  const agentMarkdown = readTextIfExists(join(homePath, "AGENT.md"));
2840
2804
  return {
2841
- homePath: resolve$1(homePath),
2805
+ homePath: resolve(homePath),
2842
2806
  agentId: extractIdentityField(identityMarkdown, "agent_id"),
2843
2807
  role: extractIdentityField(identityMarkdown, "role") || "ceo",
2844
2808
  displayName: resolveDisplayName(identityMarkdown, agentMarkdown),
@@ -2984,7 +2948,7 @@ function createSessionMetadata(opts) {
2984
2948
  homeDir: os.homedir(),
2985
2949
  happyHomeDir: configuration.happyCloudHomeDir,
2986
2950
  happyLibDir: projectPath(),
2987
- happyToolsDir: resolve$1(projectPath(), "tools", "unpacked"),
2951
+ happyToolsDir: resolve(projectPath(), "tools", "unpacked"),
2988
2952
  startedFromDaemon: opts.startedBy === "daemon",
2989
2953
  startedBy: opts.startedBy || "terminal",
2990
2954
  ...opts.managedSessionTag ? { managedSessionTag: opts.managedSessionTag } : {},
@@ -3610,7 +3574,7 @@ function copyCodexHomeEntry(sourcePath, destPath) {
3610
3574
  if (!existsSync(sourcePath)) {
3611
3575
  return;
3612
3576
  }
3613
- mkdirSync(dirname$1(destPath), { recursive: true });
3577
+ mkdirSync(dirname(destPath), { recursive: true });
3614
3578
  cpSync(sourcePath, destPath, {
3615
3579
  recursive: true,
3616
3580
  force: true,
@@ -6445,7 +6409,7 @@ async function handleSessionCommand(args, deps = defaultDeps) {
6445
6409
  }
6446
6410
 
6447
6411
  function getProjectPath(workingDirectory, claudeConfigDirOverride) {
6448
- const projectId = resolve$1(workingDirectory).replace(/[^a-zA-Z0-9-]/g, "-");
6412
+ const projectId = resolve(workingDirectory).replace(/[^a-zA-Z0-9-]/g, "-");
6449
6413
  const claudeConfigDirRaw = process.env.CLAUDE_CONFIG_DIR ?? "";
6450
6414
  const claudeConfigDirTrimmed = claudeConfigDirRaw.trim();
6451
6415
  const claudeConfigDir = claudeConfigDirTrimmed ? claudeConfigDirTrimmed : join(homedir(), ".claude");
@@ -6510,7 +6474,7 @@ class ExitCodeError extends Error {
6510
6474
  this.exitCode = exitCode;
6511
6475
  }
6512
6476
  }
6513
- const claudeCliPath = resolve$1(join(projectPath(), "scripts", "claude_local_launcher.cjs"));
6477
+ const claudeCliPath = resolve(join(projectPath(), "scripts", "claude_local_launcher.cjs"));
6514
6478
  async function claudeLocal(opts) {
6515
6479
  const projectDir = getProjectPath(opts.path);
6516
6480
  mkdirSync(projectDir, { recursive: true });
@@ -6773,558 +6737,6 @@ function printVersion() {
6773
6737
  }
6774
6738
  }
6775
6739
 
6776
- const DEFAULT_RESPONSE_WAIT_TIMEOUT_MS = 10 * 6e4;
6777
- const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS = 2 * 6e4;
6778
- const TIMEOUT_FAST_WORDS = ["fast", "quick", "low", "minimal", "light", "shallow", "short", "economy"];
6779
- const TIMEOUT_BALANCED_WORDS = ["balanced", "medium", "normal", "default", "standard", "auto"];
6780
- const TIMEOUT_DEEP_WORDS = ["deep", "high", "max", "maximum", "extended", "long", "intense", "thorough"];
6781
- const CACHE_OFF_WORDS = ["off", "none", "disabled", "disable", "false"];
6782
- const CACHE_DEFAULT_WORDS = ["default", "auto", "balanced", "standard", "normal"];
6783
- const CACHE_AGGRESSIVE_WORDS = ["aggressive", "enabled", "enable", "on", "high", "max", "maximum", "full", "always"];
6784
- const TIMEOUT_OPTION_HINTS = ["timeout", "latency", "speed", "effort", "thought", "thinking", "reasoning", "reason", "depth"];
6785
- const CACHE_OPTION_HINTS = ["cache", "caching", "cached", "reuse", "replay"];
6786
- function normalizeAgentKey(agentName) {
6787
- return agentName.replace(/[^a-z0-9]+/gi, "_").replace(/^_+|_+$/g, "").toUpperCase();
6788
- }
6789
- function readEnvValue(env, names) {
6790
- for (const name of names) {
6791
- const raw = env[name]?.trim();
6792
- if (raw) {
6793
- return raw;
6794
- }
6795
- }
6796
- return null;
6797
- }
6798
- function readTimeoutProfile(agentName, env) {
6799
- const agentKey = normalizeAgentKey(agentName);
6800
- const raw = readEnvValue(env, [
6801
- `HAPPY_${agentKey}_ACP_TIMEOUT_PROFILE`,
6802
- `HAPPIER_${agentKey}_ACP_TIMEOUT_PROFILE`,
6803
- "HAPPY_ACP_TIMEOUT_PROFILE",
6804
- "HAPPIER_ACP_TIMEOUT_PROFILE"
6805
- ])?.toLowerCase();
6806
- if (!raw) {
6807
- return { value: "balanced", source: "default" };
6808
- }
6809
- if (["fast", "quick", "low", "minimal", "light", "shallow"].includes(raw)) {
6810
- return { value: "fast", source: "env" };
6811
- }
6812
- if (["deep", "high", "max", "maximum", "extended", "long", "thorough"].includes(raw)) {
6813
- return { value: "deep", source: "env" };
6814
- }
6815
- return { value: "balanced", source: "env" };
6816
- }
6817
- function readCachePolicy(agentName, env) {
6818
- const agentKey = normalizeAgentKey(agentName);
6819
- const raw = readEnvValue(env, [
6820
- `HAPPY_${agentKey}_ACP_CACHE_POLICY`,
6821
- `HAPPIER_${agentKey}_ACP_CACHE_POLICY`,
6822
- "HAPPY_ACP_CACHE_POLICY",
6823
- "HAPPIER_ACP_CACHE_POLICY"
6824
- ])?.toLowerCase();
6825
- if (!raw) {
6826
- return { value: "default", source: "default" };
6827
- }
6828
- if (["off", "none", "disabled", "disable", "false"].includes(raw)) {
6829
- return { value: "off", source: "env" };
6830
- }
6831
- if (["aggressive", "enabled", "enable", "on", "high", "max", "maximum", "full", "always"].includes(raw)) {
6832
- return { value: "aggressive", source: "env" };
6833
- }
6834
- return { value: "default", source: "env" };
6835
- }
6836
- function normalizeText(value) {
6837
- return (value ?? "").toLowerCase();
6838
- }
6839
- function tokenize(...parts) {
6840
- return parts.map((part) => normalizeText(part)).join(" ").split(/[^a-z0-9]+/g).filter(Boolean);
6841
- }
6842
- function includesAny(tokens, expected) {
6843
- return expected.some((candidate) => tokens.includes(candidate));
6844
- }
6845
- function isSelectSessionConfigOption(option) {
6846
- return option.type === "select";
6847
- }
6848
- function isBooleanSessionConfigOption(option) {
6849
- return option.type === "boolean";
6850
- }
6851
- function flattenSelectOptions(options) {
6852
- const flattened = [];
6853
- for (const option of options) {
6854
- if (Array.isArray(option.options)) {
6855
- flattened.push(...option.options);
6856
- continue;
6857
- }
6858
- flattened.push(option);
6859
- }
6860
- return flattened;
6861
- }
6862
- function classifyConfigOption(option) {
6863
- const tokens = tokenize(option.id, option.name, option.description, option.category);
6864
- if (option.category === "thought_level" || includesAny(tokens, TIMEOUT_OPTION_HINTS)) {
6865
- return "timeout";
6866
- }
6867
- if (includesAny(tokens, CACHE_OPTION_HINTS)) {
6868
- return "cache";
6869
- }
6870
- return null;
6871
- }
6872
- function scoreTimeoutChoice(option, profile, currentValue) {
6873
- const tokens = tokenize(option.value, option.name, option.description);
6874
- let score = 0;
6875
- if (profile === "fast" && includesAny(tokens, TIMEOUT_FAST_WORDS)) {
6876
- score += 4;
6877
- }
6878
- if (profile === "balanced" && includesAny(tokens, TIMEOUT_BALANCED_WORDS)) {
6879
- score += 4;
6880
- }
6881
- if (profile === "deep" && includesAny(tokens, TIMEOUT_DEEP_WORDS)) {
6882
- score += 4;
6883
- }
6884
- if (profile === "balanced" && option.value === currentValue) {
6885
- score += 2;
6886
- }
6887
- return score;
6888
- }
6889
- function scoreCacheChoice(option, policy, currentValue) {
6890
- const tokens = tokenize(option.value, option.name, option.description);
6891
- let score = 0;
6892
- if (policy === "off" && includesAny(tokens, CACHE_OFF_WORDS)) {
6893
- score += 4;
6894
- }
6895
- if (policy === "default" && includesAny(tokens, CACHE_DEFAULT_WORDS)) {
6896
- score += 4;
6897
- }
6898
- if (policy === "aggressive" && includesAny(tokens, CACHE_AGGRESSIVE_WORDS)) {
6899
- score += 4;
6900
- }
6901
- if (policy === "default" && option.value === currentValue) {
6902
- score += 2;
6903
- }
6904
- return score;
6905
- }
6906
- function chooseTimeoutValue(option, profile) {
6907
- if (!isSelectSessionConfigOption(option)) {
6908
- return null;
6909
- }
6910
- const candidates = flattenSelectOptions(option.options);
6911
- let best = null;
6912
- for (const candidate of candidates) {
6913
- const score = scoreTimeoutChoice(candidate, profile, option.currentValue);
6914
- if (score <= 0) {
6915
- continue;
6916
- }
6917
- if (!best || score > best.score) {
6918
- best = { value: candidate.value, score };
6919
- }
6920
- }
6921
- return best?.value ?? null;
6922
- }
6923
- function chooseCacheValue(option, policy) {
6924
- if (isBooleanSessionConfigOption(option)) {
6925
- if (policy === "off") {
6926
- return false;
6927
- }
6928
- if (policy === "aggressive") {
6929
- return true;
6930
- }
6931
- return null;
6932
- }
6933
- if (!isSelectSessionConfigOption(option)) {
6934
- return null;
6935
- }
6936
- const candidates = flattenSelectOptions(option.options);
6937
- let best = null;
6938
- for (const candidate of candidates) {
6939
- const score = scoreCacheChoice(candidate, policy, option.currentValue);
6940
- if (score <= 0) {
6941
- continue;
6942
- }
6943
- if (!best || score > best.score) {
6944
- best = { value: candidate.value, score };
6945
- }
6946
- }
6947
- return best?.value ?? null;
6948
- }
6949
- function buildSetSessionConfigOptionRequest(options) {
6950
- if (typeof options.value === "boolean") {
6951
- return {
6952
- sessionId: options.sessionId,
6953
- configId: options.configId,
6954
- type: "boolean",
6955
- value: options.value
6956
- };
6957
- }
6958
- return {
6959
- sessionId: options.sessionId,
6960
- configId: options.configId,
6961
- value: options.value
6962
- };
6963
- }
6964
- function resolveAcpSessionPreferences(options) {
6965
- const mergedEnv = {
6966
- ...process.env,
6967
- ...options.env ?? {}
6968
- };
6969
- const timeout = readTimeoutProfile(options.agentName, mergedEnv);
6970
- const cache = readCachePolicy(options.agentName, mergedEnv);
6971
- return {
6972
- agentName: options.agentName,
6973
- timeoutProfile: timeout.value,
6974
- timeoutSource: timeout.source,
6975
- cachePolicy: cache.value,
6976
- cacheSource: cache.source
6977
- };
6978
- }
6979
- function scaleAcpTimeoutMs(baseMs, kind, profile) {
6980
- if (profile === "balanced") {
6981
- return baseMs;
6982
- }
6983
- const multipliers = profile === "fast" ? {
6984
- init: 0.75,
6985
- tool: 0.75,
6986
- investigation: 0.75,
6987
- think: 0.5,
6988
- execute: 0.75
6989
- } : {
6990
- init: 1.5,
6991
- tool: 1.5,
6992
- investigation: 1.5,
6993
- think: 2,
6994
- execute: 1.5
6995
- };
6996
- const minimums = {
6997
- init: 15e3,
6998
- tool: 6e4,
6999
- investigation: 5 * 6e4,
7000
- think: 15e3,
7001
- execute: 2 * 6e4
7002
- };
7003
- return Math.max(minimums[kind], Math.round(baseMs * multipliers[kind]));
7004
- }
7005
- function resolveAcpResponseWaitTimeoutMs(profile) {
7006
- if (profile === "fast") {
7007
- return 5 * 6e4;
7008
- }
7009
- if (profile === "deep") {
7010
- return 20 * 6e4;
7011
- }
7012
- return DEFAULT_RESPONSE_WAIT_TIMEOUT_MS;
7013
- }
7014
- function resolveAcpPostPromptNoUpdatesTimeoutMs(baseMs, profile) {
7015
- if (profile === "fast") {
7016
- return Math.max(3e4, Math.min(baseMs, 45e3));
7017
- }
7018
- if (profile === "deep") {
7019
- return Math.max(baseMs, 4 * 6e4);
7020
- }
7021
- return baseMs || DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS;
7022
- }
7023
- function buildAcpSessionConfigPresetPlan(options) {
7024
- const plan = [];
7025
- for (const option of options.configOptions ?? []) {
7026
- const kind = classifyConfigOption(option);
7027
- if (kind === "timeout" && options.preferences.timeoutSource === "env") {
7028
- const targetValue = chooseTimeoutValue(option, options.preferences.timeoutProfile);
7029
- if (targetValue && targetValue !== option.currentValue) {
7030
- plan.push({
7031
- kind,
7032
- optionId: option.id,
7033
- optionName: option.name,
7034
- currentValue: option.currentValue,
7035
- targetValue,
7036
- request: buildSetSessionConfigOptionRequest({
7037
- sessionId: options.sessionId,
7038
- configId: option.id,
7039
- value: targetValue
7040
- })
7041
- });
7042
- }
7043
- continue;
7044
- }
7045
- if (kind === "cache" && options.preferences.cacheSource === "env") {
7046
- const targetValue = chooseCacheValue(option, options.preferences.cachePolicy);
7047
- if (targetValue && targetValue !== option.currentValue) {
7048
- plan.push({
7049
- kind,
7050
- optionId: option.id,
7051
- optionName: option.name,
7052
- currentValue: option.currentValue,
7053
- targetValue,
7054
- request: buildSetSessionConfigOptionRequest({
7055
- sessionId: options.sessionId,
7056
- configId: option.id,
7057
- value: targetValue
7058
- })
7059
- });
7060
- }
7061
- }
7062
- }
7063
- return plan;
7064
- }
7065
-
7066
- const DEFAULT_TIMEOUTS = {
7067
- /** Default initialization timeout: 60 seconds */
7068
- init: 6e4,
7069
- /** Default tool call timeout: 10 minutes */
7070
- toolCall: 10 * 6e4,
7071
- /** Think tool timeout: 2 minutes */
7072
- think: 2 * 6e4
7073
- };
7074
- class DefaultTransport {
7075
- agentName;
7076
- constructor(agentName = "generic-acp") {
7077
- this.agentName = agentName;
7078
- }
7079
- getTimeoutProfile() {
7080
- return resolveAcpSessionPreferences({ agentName: this.agentName }).timeoutProfile;
7081
- }
7082
- /**
7083
- * Default init timeout: 60 seconds
7084
- */
7085
- getInitTimeout() {
7086
- return scaleAcpTimeoutMs(DEFAULT_TIMEOUTS.init, "init", this.getTimeoutProfile());
7087
- }
7088
- getInitDelayMs() {
7089
- return 0;
7090
- }
7091
- /**
7092
- * Default: pass through all lines that are valid JSON objects/arrays
7093
- */
7094
- filterStdoutLine(line) {
7095
- const trimmed = line.trim();
7096
- if (!trimmed) {
7097
- return null;
7098
- }
7099
- if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
7100
- return null;
7101
- }
7102
- try {
7103
- const parsed = JSON.parse(trimmed);
7104
- if (typeof parsed !== "object" || parsed === null) {
7105
- return null;
7106
- }
7107
- return line;
7108
- } catch {
7109
- return null;
7110
- }
7111
- }
7112
- /**
7113
- * Default: no special stderr handling
7114
- */
7115
- handleStderr(_text, _context) {
7116
- return { message: null };
7117
- }
7118
- /**
7119
- * Default: no special tool patterns
7120
- */
7121
- getToolPatterns() {
7122
- return [];
7123
- }
7124
- /**
7125
- * Default: no investigation tools
7126
- */
7127
- isInvestigationTool(_toolCallId, _toolKind) {
7128
- return false;
7129
- }
7130
- /**
7131
- * Default tool call timeout based on tool kind
7132
- */
7133
- getToolCallTimeout(_toolCallId, toolKind) {
7134
- if (toolKind === "think") {
7135
- return scaleAcpTimeoutMs(DEFAULT_TIMEOUTS.think, "think", this.getTimeoutProfile());
7136
- }
7137
- return scaleAcpTimeoutMs(DEFAULT_TIMEOUTS.toolCall, "tool", this.getTimeoutProfile());
7138
- }
7139
- /**
7140
- * Default: no tool name extraction (return null)
7141
- */
7142
- extractToolNameFromId(_toolCallId) {
7143
- return null;
7144
- }
7145
- /**
7146
- * Default: return original tool name (no special detection)
7147
- */
7148
- determineToolName(toolName, _toolCallId, _input, _context) {
7149
- return toolName;
7150
- }
7151
- getPostPromptNoUpdatesTimeoutMs() {
7152
- return resolveAcpPostPromptNoUpdatesTimeoutMs(2 * 6e4, this.getTimeoutProfile());
7153
- }
7154
- }
7155
-
7156
- const DEFAULT_CODEX_EXECUTE_TIMEOUT_MS = 30 * 6e4;
7157
- function readPositiveIntegerEnv(name) {
7158
- const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
7159
- if (!raw) {
7160
- return null;
7161
- }
7162
- const value = Number(raw);
7163
- if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) {
7164
- return null;
7165
- }
7166
- return value;
7167
- }
7168
- class CodexTransport extends DefaultTransport {
7169
- constructor() {
7170
- super("codex");
7171
- }
7172
- getInitTimeout() {
7173
- return scaleAcpTimeoutMs(3e4, "init", this.getTimeoutProfile());
7174
- }
7175
- getIdleTimeout() {
7176
- return 800;
7177
- }
7178
- getToolCallTimeout(toolCallId, toolKind) {
7179
- if (toolKind === "execute") {
7180
- const explicit = readPositiveIntegerEnv("HAPPY_CODEX_EXECUTE_TIMEOUT_MS") ?? readPositiveIntegerEnv("HAPPIER_CODEX_EXECUTE_TIMEOUT_MS");
7181
- return explicit ?? scaleAcpTimeoutMs(DEFAULT_CODEX_EXECUTE_TIMEOUT_MS, "execute", this.getTimeoutProfile());
7182
- }
7183
- return super.getToolCallTimeout(toolCallId, toolKind);
7184
- }
7185
- }
7186
- new CodexTransport();
7187
-
7188
- class ClaudeTransport extends DefaultTransport {
7189
- constructor() {
7190
- super("claude");
7191
- }
7192
- getInitTimeout() {
7193
- return scaleAcpTimeoutMs(15e3, "init", this.getTimeoutProfile());
7194
- }
7195
- getIdleTimeout() {
7196
- return 600;
7197
- }
7198
- }
7199
- new ClaudeTransport();
7200
-
7201
- class CursorTransport extends DefaultTransport {
7202
- constructor() {
7203
- super("cursor");
7204
- }
7205
- getInitTimeout() {
7206
- return scaleAcpTimeoutMs(2e4, "init", this.getTimeoutProfile());
7207
- }
7208
- getIdleTimeout() {
7209
- return 700;
7210
- }
7211
- }
7212
- const cursorTransport = new CursorTransport();
7213
-
7214
- const __filename$1 = fileURLToPath$1(import.meta.url);
7215
- const __dirname$1 = join(__filename$1, "..");
7216
- function getGlobalClaudeVersion() {
7217
- try {
7218
- const cleanEnv = getCleanEnv();
7219
- const output = execSync$1("claude --version", {
7220
- encoding: "utf8",
7221
- stdio: ["pipe", "pipe", "pipe"],
7222
- cwd: homedir(),
7223
- env: cleanEnv,
7224
- windowsHide: true
7225
- }).trim();
7226
- const match = output.match(/(\d+\.\d+\.\d+)/);
7227
- logger.debug(`[Claude SDK] Global claude --version output: ${output}`);
7228
- return match ? match[1] : null;
7229
- } catch {
7230
- return null;
7231
- }
7232
- }
7233
- function getCleanEnv() {
7234
- const env = { ...process.env };
7235
- const cwd = process.cwd();
7236
- const pathSep = process.platform === "win32" ? ";" : ":";
7237
- const pathKey = process.platform === "win32" ? "Path" : "PATH";
7238
- const actualPathKey = Object.keys(env).find((k) => k.toLowerCase() === "path") || pathKey;
7239
- if (env[actualPathKey]) {
7240
- const cleanPath = env[actualPathKey].split(pathSep).filter((p) => {
7241
- const normalizedP = p.replace(/\\/g, "/").toLowerCase();
7242
- const normalizedCwd = cwd.replace(/\\/g, "/").toLowerCase();
7243
- return !normalizedP.startsWith(normalizedCwd);
7244
- }).join(pathSep);
7245
- env[actualPathKey] = cleanPath;
7246
- logger.debug(`[Claude SDK] Cleaned PATH, removed local paths from: ${cwd}`);
7247
- }
7248
- if (isBun()) {
7249
- Object.keys(env).forEach((key) => {
7250
- if (key.startsWith("BUN_")) {
7251
- delete env[key];
7252
- }
7253
- });
7254
- logger.debug("[Claude SDK] Removed Bun-specific environment variables for Node.js compatibility");
7255
- }
7256
- return env;
7257
- }
7258
- function findGlobalClaudePath() {
7259
- const homeDir = homedir();
7260
- const cleanEnv = getCleanEnv();
7261
- try {
7262
- execSync$1("claude --version", {
7263
- encoding: "utf8",
7264
- stdio: ["pipe", "pipe", "pipe"],
7265
- cwd: homeDir,
7266
- env: cleanEnv,
7267
- windowsHide: true
7268
- });
7269
- logger.debug("[Claude SDK] Global claude command available (checked with clean PATH)");
7270
- return "claude";
7271
- } catch {
7272
- }
7273
- if (process.platform !== "win32") {
7274
- try {
7275
- const result = execSync$1("which claude", {
7276
- encoding: "utf8",
7277
- stdio: ["pipe", "pipe", "pipe"],
7278
- cwd: homeDir,
7279
- env: cleanEnv,
7280
- windowsHide: true
7281
- }).trim();
7282
- if (result && existsSync(result)) {
7283
- logger.debug(`[Claude SDK] Found global claude path via which: ${result}`);
7284
- return result;
7285
- }
7286
- } catch {
7287
- }
7288
- }
7289
- return null;
7290
- }
7291
- function getDefaultClaudeCodePath() {
7292
- const nodeModulesPath = join(__dirname$1, "..", "..", "..", "node_modules", "@anthropic-ai", "claude-code", "cli.js");
7293
- if (process.env.HAPPY_CLAUDE_PATH) {
7294
- logger.debug(`[Claude SDK] Using HAPPY_CLAUDE_PATH: ${process.env.HAPPY_CLAUDE_PATH}`);
7295
- return process.env.HAPPY_CLAUDE_PATH;
7296
- }
7297
- if (process.env.HAPPY_USE_BUNDLED_CLAUDE === "1") {
7298
- logger.debug(`[Claude SDK] Forced bundled version: ${nodeModulesPath}`);
7299
- return nodeModulesPath;
7300
- }
7301
- const globalPath = findGlobalClaudePath();
7302
- if (!globalPath) {
7303
- logger.debug(`[Claude SDK] No global claude found, using bundled: ${nodeModulesPath}`);
7304
- return nodeModulesPath;
7305
- }
7306
- const globalVersion = getGlobalClaudeVersion();
7307
- logger.debug(`[Claude SDK] Global version: ${globalVersion || "unknown"}`);
7308
- if (!globalVersion) {
7309
- logger.debug(`[Claude SDK] Cannot compare versions, using global: ${globalPath}`);
7310
- return globalPath;
7311
- }
7312
- return globalPath;
7313
- }
7314
- function logDebug(message) {
7315
- if (process.env.DEBUG) {
7316
- logger.debug(message);
7317
- console.log(message);
7318
- }
7319
- }
7320
- async function streamToStdin(stream, stdin, abort) {
7321
- for await (const message of stream) {
7322
- if (abort?.aborted) break;
7323
- stdin.write(JSON.stringify(message) + "\n");
7324
- }
7325
- stdin.end();
7326
- }
7327
-
7328
6740
  const KNOWN_CANONICAL_TOOL_NAMES_V2 = [
7329
6741
  "Bash",
7330
6742
  "Read",
@@ -7413,14 +6825,14 @@ async function waitForDaemonReady(timeoutMs = DAEMON_STARTUP_TIMEOUT_MS, pollInt
7413
6825
  const unifiedProviderExecutors = {
7414
6826
  claude: async (opts) => {
7415
6827
  const claudeOptions = opts.claudeOptions ?? {};
7416
- const { runClaude } = await import('./runClaude-Bv8y1SS9.mjs');
6828
+ const { runClaude } = await import('./runClaude-Df_7_PkI.mjs');
7417
6829
  await runClaude(opts.credentials, {
7418
6830
  ...claudeOptions,
7419
6831
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
7420
6832
  });
7421
6833
  },
7422
6834
  codex: async (opts) => {
7423
- const { runCodex } = await import('./runCodex-CCMOgVeu.mjs');
6835
+ const { runCodex } = await import('./runCodex-DP-67NuP.mjs');
7424
6836
  await runCodex({
7425
6837
  credentials: opts.credentials,
7426
6838
  startedBy: opts.startedBy,
@@ -7430,14 +6842,14 @@ const unifiedProviderExecutors = {
7430
6842
  });
7431
6843
  },
7432
6844
  gemini: async (opts) => {
7433
- const { runGemini } = await import('./runGemini-DYgMC16z.mjs');
6845
+ const { runGemini } = await import('./runGemini-CVyRbdZg.mjs');
7434
6846
  await runGemini({
7435
6847
  credentials: opts.credentials,
7436
6848
  startedBy: opts.startedBy
7437
6849
  });
7438
6850
  },
7439
6851
  cursor: async (opts) => {
7440
- const { runCursor } = await import('./runCursor-31OZtyc5.mjs');
6852
+ const { runCursor } = await import('./runCursor-CqElKVpg.mjs');
7441
6853
  await runCursor({
7442
6854
  credentials: opts.credentials,
7443
6855
  startedBy: opts.startedBy,
@@ -7516,12 +6928,12 @@ function shouldRunMainClaudeFlow(opts) {
7516
6928
  return;
7517
6929
  } else if (subcommand === "runtime") {
7518
6930
  if (args[1] === "providers") {
7519
- const { renderRuntimeProviders } = await import('./command-kCu_CfoX.mjs');
6931
+ const { renderRuntimeProviders } = await import('./command-DRRTqKEA.mjs');
7520
6932
  console.log(renderRuntimeProviders());
7521
6933
  return;
7522
6934
  }
7523
6935
  if (args[1] === "launch" && args[2]) {
7524
- const { isRuntimeProvider, launchRuntimeProvider } = await import('./launch-D3RkSzmj.mjs');
6936
+ const { isRuntimeProvider, launchRuntimeProvider } = await import('./launch-DRd9FuLt.mjs');
7525
6937
  const provider = args[2];
7526
6938
  if (!isRuntimeProvider(provider)) {
7527
6939
  console.error(`Unknown runtime provider: ${provider}`);
@@ -7730,9 +7142,9 @@ function shouldRunMainClaudeFlow(opts) {
7730
7142
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
7731
7143
  const projectId = args[3];
7732
7144
  try {
7733
- const { saveGoogleCloudProjectToConfig } = await import('./config-B1xP_Nn4.mjs').then(function (n) { return n.e; });
7734
- const { readCredentials: readCredentials2 } = await import('./types-n7tu2s6X.mjs').then(function (n) { return n.Z; });
7735
- const { ApiClient: ApiClient2 } = await import('./types-n7tu2s6X.mjs').then(function (n) { return n._; });
7145
+ const { saveGoogleCloudProjectToConfig } = await import('./config-BXTUTPxJ.mjs').then(function (n) { return n.c; });
7146
+ const { readCredentials: readCredentials2 } = await import('./types-BZeEK90l.mjs').then(function (n) { return n.Y; });
7147
+ const { ApiClient: ApiClient2 } = await import('./types-BZeEK90l.mjs').then(function (n) { return n.n; });
7736
7148
  let userEmail = void 0;
7737
7149
  try {
7738
7150
  const credentials = await readCredentials2();
@@ -7763,7 +7175,7 @@ function shouldRunMainClaudeFlow(opts) {
7763
7175
  }
7764
7176
  if (geminiSubcommand === "project" && args[2] === "get") {
7765
7177
  try {
7766
- const { readGeminiLocalConfig } = await import('./config-B1xP_Nn4.mjs').then(function (n) { return n.e; });
7178
+ const { readGeminiLocalConfig } = await import('./config-BXTUTPxJ.mjs').then(function (n) { return n.c; });
7767
7179
  const config = readGeminiLocalConfig();
7768
7180
  if (config.googleCloudProject) {
7769
7181
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -8150,4 +7562,4 @@ ${chalk.bold("Examples:")}
8150
7562
  }
8151
7563
  }
8152
7564
 
8153
- export { CodexTransport as C, DefaultTransport as D, ExitCodeError as E, resolveManagedSessionTag as a, closeProviderSession as b, cursorTransport as c, createSessionMetadata as d, publishSessionRegistration as e, resolveAcpSessionPreferences as f, buildAcpSessionConfigPresetPlan as g, resolveAcpPostPromptNoUpdatesTimeoutMs as h, resolveAcpResponseWaitTimeoutMs as i, getDefaultClaudeCodePath as j, getCleanEnv as k, logDebug as l, streamToStdin as m, scaleAcpTimeoutMs as n, initialMachineMetadata as o, projectPath as p, resolveCanonicalToolNameV2 as q, readManagedSessionTag as r, stopCaffeinate as s, getProjectPath as t, claudeLocal as u, trimIdent as v, claudeCheckSession as w, getEnvironmentInfo as x, startCaffeinate as y };
7565
+ export { ExitCodeError as E, claudeLocal as a, closeProviderSession as b, claudeCheckSession as c, createSessionMetadata as d, getProjectPath as e, resolveCanonicalToolNameV2 as f, getEnvironmentInfo as g, resolveManagedSessionTag as h, initialMachineMetadata as i, stopCaffeinate as j, publishSessionRegistration as p, readManagedSessionTag as r, startCaffeinate as s, trimIdent as t };