happy-imou-cloud 2.0.1 → 2.0.3
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.
- package/dist/{BaseReasoningProcessor-DQE2l7Xu.mjs → BaseReasoningProcessor-B37yOHxo.mjs} +2 -2
- package/dist/{BaseReasoningProcessor-01KqA3Kz.cjs → BaseReasoningProcessor-_wxlqKB8.cjs} +4 -4
- package/dist/{api-B8v4tczT.cjs → api-D9dIR956.cjs} +97 -44
- package/dist/{api-B5Ui8Fw0.mjs → api-DpQIC-DJ.mjs} +56 -3
- package/dist/{command-D8yNlaDo.cjs → command-CdXv1zNF.cjs} +3 -3
- package/dist/{command-BfIuJmeo.mjs → command-DRqrBuHM.mjs} +3 -3
- package/dist/{index-BByhFIIq.mjs → index-CriPm_z9.mjs} +15 -17
- package/dist/{index-BOqJ9hwi.cjs → index-LYPXVO_L.cjs} +98 -100
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +6 -0
- package/dist/lib.d.mts +6 -0
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-CzpZpiL3.mjs → persistence-CqgPgbzN.mjs} +29 -7
- package/dist/{persistence-C33AMdtv.cjs → persistence-PzKU0QCa.cjs} +54 -32
- package/dist/{registerKillSessionHandler-BkzQulD9.cjs → registerKillSessionHandler-BDBPoQSA.cjs} +2 -2
- package/dist/{registerKillSessionHandler-BtSK7IOa.mjs → registerKillSessionHandler-C3M_-4Zg.mjs} +2 -2
- package/dist/{runClaude-C_WLfM6c.mjs → runClaude-D6Pdkevn.mjs} +250 -46
- package/dist/{runClaude-CNVufgZb.cjs → runClaude-IeRSC5qX.cjs} +270 -66
- package/dist/{runCodex-8eWjTPJr.mjs → runCodex-CsfUU1Wb.mjs} +216 -401
- package/dist/{runCodex-Dzy8anlX.cjs → runCodex-WRmgSK6L.cjs} +216 -401
- package/dist/{runGemini-nbr0mm-S.mjs → runGemini-CrH3dQ0Y.mjs} +5 -5
- package/dist/{runGemini-CgsVKP7m.cjs → runGemini-qBh6zs5G.cjs} +5 -5
- package/package.json +1 -2
- package/dist/future-Dq4Ha1Dn.cjs +0 -24
- package/dist/future-xRdLl3vf.mjs +0 -22
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var api = require('./api-
|
|
5
|
-
var persistence = require('./persistence-
|
|
4
|
+
var api = require('./api-D9dIR956.cjs');
|
|
5
|
+
var persistence = require('./persistence-PzKU0QCa.cjs');
|
|
6
6
|
var z = require('zod');
|
|
7
|
-
var fs$
|
|
7
|
+
var fs$1 = require('fs/promises');
|
|
8
8
|
var os$1 = require('os');
|
|
9
9
|
var tmp = require('tmp');
|
|
10
10
|
var node_crypto = require('node:crypto');
|
|
@@ -14,18 +14,18 @@ var qrcode = require('qrcode-terminal');
|
|
|
14
14
|
var promises = require('node:fs/promises');
|
|
15
15
|
var node_module = require('node:module');
|
|
16
16
|
var os = require('node:os');
|
|
17
|
-
var
|
|
17
|
+
var node_path = require('node:path');
|
|
18
18
|
var open = require('open');
|
|
19
19
|
var React = require('react');
|
|
20
20
|
var ink = require('ink');
|
|
21
21
|
var child_process = require('child_process');
|
|
22
|
-
var path
|
|
22
|
+
var path = require('path');
|
|
23
23
|
var url = require('url');
|
|
24
|
-
var fs
|
|
24
|
+
var fs = require('fs');
|
|
25
25
|
var node_child_process = require('node:child_process');
|
|
26
26
|
var psList = require('ps-list');
|
|
27
27
|
var spawn = require('cross-spawn');
|
|
28
|
-
var
|
|
28
|
+
var node_fs = require('node:fs');
|
|
29
29
|
var fastify = require('fastify');
|
|
30
30
|
var fastifyTypeProviderZod = require('fastify-type-provider-zod');
|
|
31
31
|
var node_readline = require('node:readline');
|
|
@@ -70,7 +70,7 @@ async function openBrowser(url) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
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-
|
|
73
|
+
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-LYPXVO_L.cjs', document.baseURI).href)));
|
|
74
74
|
const QRCode = require$1("qrcode-terminal/vendor/QRCode");
|
|
75
75
|
const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
|
|
76
76
|
const pendingTempFiles = /* @__PURE__ */ new Set();
|
|
@@ -164,7 +164,7 @@ async function openWindowsQrCode(value) {
|
|
|
164
164
|
"</body>",
|
|
165
165
|
"</html>"
|
|
166
166
|
].join("");
|
|
167
|
-
const filePath =
|
|
167
|
+
const filePath = node_path.join(os.tmpdir(), `happy-auth-qrcode-${node_crypto.randomUUID()}.html`);
|
|
168
168
|
await promises.writeFile(filePath, html, "utf8");
|
|
169
169
|
const opened = await openBrowser(filePath);
|
|
170
170
|
if (opened) {
|
|
@@ -693,18 +693,18 @@ function setupCleanupHandlers() {
|
|
|
693
693
|
});
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
-
const __dirname$1 = path
|
|
696
|
+
const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-LYPXVO_L.cjs', document.baseURI).href))));
|
|
697
697
|
function projectPath() {
|
|
698
|
-
const path = path
|
|
699
|
-
return path;
|
|
698
|
+
const path$1 = path.resolve(__dirname$1, "..");
|
|
699
|
+
return path$1;
|
|
700
700
|
}
|
|
701
701
|
|
|
702
702
|
function getDaemonPid() {
|
|
703
703
|
try {
|
|
704
|
-
if (!
|
|
704
|
+
if (!node_fs.existsSync(api.configuration.daemonStateFile)) {
|
|
705
705
|
return null;
|
|
706
706
|
}
|
|
707
|
-
const state = JSON.parse(
|
|
707
|
+
const state = JSON.parse(node_fs.readFileSync(api.configuration.daemonStateFile, "utf-8"));
|
|
708
708
|
return typeof state.pid === "number" ? state.pid : null;
|
|
709
709
|
} catch {
|
|
710
710
|
return null;
|
|
@@ -1030,8 +1030,8 @@ async function isDaemonRunningCurrentlyInstalledHappyVersion() {
|
|
|
1030
1030
|
return false;
|
|
1031
1031
|
}
|
|
1032
1032
|
try {
|
|
1033
|
-
const packageJsonPath = path
|
|
1034
|
-
const packageJson = JSON.parse(fs
|
|
1033
|
+
const packageJsonPath = path.join(projectPath(), "package.json");
|
|
1034
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
1035
1035
|
const currentCliVersion = packageJson.version;
|
|
1036
1036
|
api.logger.debug(`[DAEMON CONTROL] Current CLI version: ${currentCliVersion}, Daemon started with version: ${state.startedWithCliVersion}`);
|
|
1037
1037
|
if (currentCliVersion !== state.startedWithCliVersion) {
|
|
@@ -1131,14 +1131,14 @@ function getEnvironmentInfo() {
|
|
|
1131
1131
|
};
|
|
1132
1132
|
}
|
|
1133
1133
|
function getLogFiles(logDir) {
|
|
1134
|
-
if (!
|
|
1134
|
+
if (!node_fs.existsSync(logDir)) {
|
|
1135
1135
|
return [];
|
|
1136
1136
|
}
|
|
1137
1137
|
try {
|
|
1138
|
-
return
|
|
1139
|
-
const path
|
|
1140
|
-
const stats =
|
|
1141
|
-
return { file, path
|
|
1138
|
+
return node_fs.readdirSync(logDir).filter((file) => file.endsWith(".log")).map((file) => {
|
|
1139
|
+
const path = node_path.join(logDir, file);
|
|
1140
|
+
const stats = node_fs.statSync(path);
|
|
1141
|
+
return { file, path, modified: stats.mtime };
|
|
1142
1142
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
1143
1143
|
} catch {
|
|
1144
1144
|
return [];
|
|
@@ -1157,13 +1157,13 @@ async function runDoctorCommand(filter) {
|
|
|
1157
1157
|
console.log("");
|
|
1158
1158
|
console.log(chalk.bold("\u{1F527} Daemon Spawn Diagnostics"));
|
|
1159
1159
|
const projectRoot = projectPath();
|
|
1160
|
-
const wrapperPath =
|
|
1161
|
-
const cliEntrypoint =
|
|
1160
|
+
const wrapperPath = node_path.join(projectRoot, "bin", "happy.mjs");
|
|
1161
|
+
const cliEntrypoint = node_path.join(projectRoot, "dist", "index.mjs");
|
|
1162
1162
|
console.log(`Project Root: ${chalk.blue(projectRoot)}`);
|
|
1163
1163
|
console.log(`Wrapper Script: ${chalk.blue(wrapperPath)}`);
|
|
1164
1164
|
console.log(`CLI Entrypoint: ${chalk.blue(cliEntrypoint)}`);
|
|
1165
|
-
console.log(`Wrapper Exists: ${
|
|
1166
|
-
console.log(`CLI Exists: ${
|
|
1165
|
+
console.log(`Wrapper Exists: ${node_fs.existsSync(wrapperPath) ? chalk.green("\u2713 Yes") : chalk.red("\u274C No")}`);
|
|
1166
|
+
console.log(`CLI Exists: ${node_fs.existsSync(cliEntrypoint) ? chalk.green("\u2713 Yes") : chalk.red("\u274C No")}`);
|
|
1167
1167
|
console.log("");
|
|
1168
1168
|
console.log(chalk.bold("\u2699\uFE0F Configuration"));
|
|
1169
1169
|
console.log(`Happy Home: ${chalk.blue(api.configuration.happyCloudHomeDir)}`);
|
|
@@ -1329,7 +1329,7 @@ const isBun = () => getRuntime() === "bun";
|
|
|
1329
1329
|
|
|
1330
1330
|
function spawnHappyCLI(args, options = {}) {
|
|
1331
1331
|
const projectRoot = projectPath();
|
|
1332
|
-
const entrypoint =
|
|
1332
|
+
const entrypoint = node_path.join(projectRoot, "dist", "index.mjs");
|
|
1333
1333
|
let directory;
|
|
1334
1334
|
if ("cwd" in options) {
|
|
1335
1335
|
directory = options.cwd;
|
|
@@ -1344,7 +1344,7 @@ function spawnHappyCLI(args, options = {}) {
|
|
|
1344
1344
|
entrypoint,
|
|
1345
1345
|
...args
|
|
1346
1346
|
];
|
|
1347
|
-
if (!
|
|
1347
|
+
if (!node_fs.existsSync(entrypoint)) {
|
|
1348
1348
|
const errorMessage = `Entrypoint ${entrypoint} does not exist`;
|
|
1349
1349
|
api.logger.debug(`[SPAWN HAPPY CLOUD CLI] ${errorMessage}`);
|
|
1350
1350
|
throw new Error(errorMessage);
|
|
@@ -2404,7 +2404,7 @@ async function startDaemon() {
|
|
|
2404
2404
|
const { directory, sessionId, machineId: machineId2, approvedNewDirectoryCreation = true } = options;
|
|
2405
2405
|
let directoryCreated = false;
|
|
2406
2406
|
try {
|
|
2407
|
-
await fs$
|
|
2407
|
+
await fs$1.access(directory);
|
|
2408
2408
|
api.logger.debug(`[DAEMON RUN] Directory exists: ${directory}`);
|
|
2409
2409
|
} catch (error) {
|
|
2410
2410
|
api.logger.debug(`[DAEMON RUN] Directory doesn't exist, creating: ${directory}`);
|
|
@@ -2416,7 +2416,7 @@ async function startDaemon() {
|
|
|
2416
2416
|
};
|
|
2417
2417
|
}
|
|
2418
2418
|
try {
|
|
2419
|
-
await fs$
|
|
2419
|
+
await fs$1.mkdir(directory, { recursive: true });
|
|
2420
2420
|
api.logger.debug(`[DAEMON RUN] Successfully created directory: ${directory}`);
|
|
2421
2421
|
directoryCreated = true;
|
|
2422
2422
|
} catch (mkdirError) {
|
|
@@ -2445,7 +2445,7 @@ async function startDaemon() {
|
|
|
2445
2445
|
if (options.token) {
|
|
2446
2446
|
if (options.agent === "codex") {
|
|
2447
2447
|
const codexHomeDir = tmp__namespace.dirSync();
|
|
2448
|
-
fs$
|
|
2448
|
+
fs$1.writeFile(path.join(codexHomeDir.name, "auth.json"), options.token);
|
|
2449
2449
|
authEnv.CODEX_HOME = codexHomeDir.name;
|
|
2450
2450
|
} else {
|
|
2451
2451
|
authEnv.CLAUDE_CODE_OAUTH_TOKEN = options.token;
|
|
@@ -2511,7 +2511,7 @@ async function startDaemon() {
|
|
|
2511
2511
|
const sessionDesc = tmuxSessionName || "current/most recent session";
|
|
2512
2512
|
api.logger.debug(`[DAEMON RUN] Attempting to spawn session in tmux: ${sessionDesc}`);
|
|
2513
2513
|
const tmux = getTmuxUtilities(tmuxSessionName);
|
|
2514
|
-
const cliPath = path
|
|
2514
|
+
const cliPath = path.join(projectPath(), "dist", "index.mjs");
|
|
2515
2515
|
const agent = resolveDaemonSpawnAgent(options.agent);
|
|
2516
2516
|
const fullCommand = `node --no-warnings --no-deprecation ${cliPath} ${buildDaemonSpawnArgs(agent).join(" ")}`;
|
|
2517
2517
|
const windowName = `happy-${Date.now()}-${agent}`;
|
|
@@ -2757,7 +2757,7 @@ async function startDaemon() {
|
|
|
2757
2757
|
pidToTrackedSession.delete(pid);
|
|
2758
2758
|
}
|
|
2759
2759
|
}
|
|
2760
|
-
const projectVersion = JSON.parse(fs
|
|
2760
|
+
const projectVersion = JSON.parse(fs.readFileSync(path.join(projectPath(), "package.json"), "utf-8")).version;
|
|
2761
2761
|
if (projectVersion !== api.configuration.currentCliVersion) {
|
|
2762
2762
|
api.logger.debug("[DAEMON RUN] Daemon is outdated, triggering self-restart with latest version, clearing heartbeat interval");
|
|
2763
2763
|
clearInterval(restartOnStaleVersionAndHeartbeat);
|
|
@@ -2850,7 +2850,7 @@ const PLIST_LABEL$1 = "com.happy-cloud.daemon";
|
|
|
2850
2850
|
const PLIST_FILE$1 = `/Library/LaunchDaemons/${PLIST_LABEL$1}.plist`;
|
|
2851
2851
|
async function install$1() {
|
|
2852
2852
|
try {
|
|
2853
|
-
if (fs
|
|
2853
|
+
if (fs.existsSync(PLIST_FILE$1)) {
|
|
2854
2854
|
api.logger.info("Daemon plist already exists. Uninstalling first...");
|
|
2855
2855
|
child_process.execSync(`launchctl unload ${PLIST_FILE$1}`, { stdio: "inherit" });
|
|
2856
2856
|
}
|
|
@@ -2894,8 +2894,8 @@ async function install$1() {
|
|
|
2894
2894
|
</dict>
|
|
2895
2895
|
</plist>
|
|
2896
2896
|
`);
|
|
2897
|
-
fs
|
|
2898
|
-
fs
|
|
2897
|
+
fs.writeFileSync(PLIST_FILE$1, plistContent);
|
|
2898
|
+
fs.chmodSync(PLIST_FILE$1, 420);
|
|
2899
2899
|
api.logger.info(`Created daemon plist at ${PLIST_FILE$1}`);
|
|
2900
2900
|
child_process.execSync(`launchctl load ${PLIST_FILE$1}`, { stdio: "inherit" });
|
|
2901
2901
|
api.logger.info("Daemon installed and started successfully");
|
|
@@ -2921,7 +2921,7 @@ const PLIST_LABEL = "com.happy-cli.daemon";
|
|
|
2921
2921
|
const PLIST_FILE = `/Library/LaunchDaemons/${PLIST_LABEL}.plist`;
|
|
2922
2922
|
async function uninstall$1() {
|
|
2923
2923
|
try {
|
|
2924
|
-
if (!fs
|
|
2924
|
+
if (!fs.existsSync(PLIST_FILE)) {
|
|
2925
2925
|
api.logger.info("Daemon plist not found. Nothing to uninstall.");
|
|
2926
2926
|
return;
|
|
2927
2927
|
}
|
|
@@ -2931,7 +2931,7 @@ async function uninstall$1() {
|
|
|
2931
2931
|
} catch (error) {
|
|
2932
2932
|
api.logger.info("Failed to unload daemon (it might not be running)");
|
|
2933
2933
|
}
|
|
2934
|
-
fs
|
|
2934
|
+
fs.unlinkSync(PLIST_FILE);
|
|
2935
2935
|
api.logger.info(`Removed daemon plist from ${PLIST_FILE}`);
|
|
2936
2936
|
api.logger.info("Daemon uninstalled successfully");
|
|
2937
2937
|
} catch (error) {
|
|
@@ -3071,8 +3071,8 @@ async function handleAuthLogout(args = []) {
|
|
|
3071
3071
|
console.log(chalk.gray("Stopped daemon"));
|
|
3072
3072
|
} catch {
|
|
3073
3073
|
}
|
|
3074
|
-
if (
|
|
3075
|
-
|
|
3074
|
+
if (node_fs.existsSync(happyDir)) {
|
|
3075
|
+
node_fs.rmSync(happyDir, { recursive: true, force: true });
|
|
3076
3076
|
}
|
|
3077
3077
|
console.log(chalk.green("\u2713 Successfully logged out"));
|
|
3078
3078
|
console.log(chalk.gray(' Run "hicloud auth login" to authenticate again'));
|
|
@@ -3745,10 +3745,10 @@ async function handleConnectStatus() {
|
|
|
3745
3745
|
}
|
|
3746
3746
|
function updateLocalGeminiCredentials(tokens) {
|
|
3747
3747
|
try {
|
|
3748
|
-
const geminiDir = path
|
|
3749
|
-
const credentialsPath = path
|
|
3750
|
-
if (!fs
|
|
3751
|
-
fs
|
|
3748
|
+
const geminiDir = path.join(os$1.homedir(), ".gemini");
|
|
3749
|
+
const credentialsPath = path.join(geminiDir, "oauth_creds.json");
|
|
3750
|
+
if (!fs.existsSync(geminiDir)) {
|
|
3751
|
+
fs.mkdirSync(geminiDir, { recursive: true });
|
|
3752
3752
|
}
|
|
3753
3753
|
const credentials = {
|
|
3754
3754
|
access_token: tokens.access_token,
|
|
@@ -3758,32 +3758,30 @@ function updateLocalGeminiCredentials(tokens) {
|
|
|
3758
3758
|
...tokens.id_token && { id_token: tokens.id_token },
|
|
3759
3759
|
...tokens.expires_in && { expires_in: tokens.expires_in }
|
|
3760
3760
|
};
|
|
3761
|
-
fs
|
|
3761
|
+
fs.writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2), "utf-8");
|
|
3762
3762
|
console.log(chalk.gray(` Updated local credentials: ${credentialsPath}`));
|
|
3763
3763
|
} catch (error) {
|
|
3764
3764
|
console.log(chalk.yellow(` \u26A0\uFE0F Could not update local credentials: ${error}`));
|
|
3765
3765
|
}
|
|
3766
3766
|
}
|
|
3767
3767
|
|
|
3768
|
-
function getProjectPath(workingDirectory) {
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude");
|
|
3775
|
-
return path.join(claudeConfigDir, "projects", projectId);
|
|
3768
|
+
function getProjectPath(workingDirectory, claudeConfigDirOverride) {
|
|
3769
|
+
const projectId = node_path.resolve(workingDirectory).replace(/[^a-zA-Z0-9-]/g, "-");
|
|
3770
|
+
const claudeConfigDirRaw = process.env.CLAUDE_CONFIG_DIR ?? "";
|
|
3771
|
+
const claudeConfigDirTrimmed = claudeConfigDirRaw.trim();
|
|
3772
|
+
const claudeConfigDir = claudeConfigDirTrimmed ? claudeConfigDirTrimmed : node_path.join(os.homedir(), ".claude");
|
|
3773
|
+
return node_path.join(claudeConfigDir, "projects", projectId);
|
|
3776
3774
|
}
|
|
3777
3775
|
|
|
3778
|
-
function claudeCheckSession(sessionId, path
|
|
3779
|
-
const projectDir = getProjectPath(path
|
|
3780
|
-
const sessionFile =
|
|
3781
|
-
const sessionExists =
|
|
3776
|
+
function claudeCheckSession(sessionId, path, transcriptPath) {
|
|
3777
|
+
const projectDir = getProjectPath(path);
|
|
3778
|
+
const sessionFile = transcriptPath ?? node_path.join(projectDir, `${sessionId}.jsonl`);
|
|
3779
|
+
const sessionExists = node_fs.existsSync(sessionFile);
|
|
3782
3780
|
if (!sessionExists) {
|
|
3783
3781
|
api.logger.debug(`[claudeCheckSession] Path ${sessionFile} does not exist`);
|
|
3784
3782
|
return false;
|
|
3785
3783
|
}
|
|
3786
|
-
const sessionData =
|
|
3784
|
+
const sessionData = node_fs.readFileSync(sessionFile, "utf-8").split("\n");
|
|
3787
3785
|
const hasGoodMessage = !!sessionData.find((v, index) => {
|
|
3788
3786
|
if (!v.trim()) return false;
|
|
3789
3787
|
try {
|
|
@@ -3804,7 +3802,7 @@ function claudeFindLastSession(workingDirectory) {
|
|
|
3804
3802
|
try {
|
|
3805
3803
|
const projectDir = getProjectPath(workingDirectory);
|
|
3806
3804
|
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3807
|
-
const files =
|
|
3805
|
+
const files = node_fs.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).map((f) => {
|
|
3808
3806
|
const sessionId = f.replace(".jsonl", "");
|
|
3809
3807
|
if (!uuidPattern.test(sessionId)) {
|
|
3810
3808
|
return null;
|
|
@@ -3813,7 +3811,7 @@ function claudeFindLastSession(workingDirectory) {
|
|
|
3813
3811
|
return {
|
|
3814
3812
|
name: f,
|
|
3815
3813
|
sessionId,
|
|
3816
|
-
mtime:
|
|
3814
|
+
mtime: node_fs.statSync(node_path.join(projectDir, f)).mtime.getTime()
|
|
3817
3815
|
};
|
|
3818
3816
|
}
|
|
3819
3817
|
return null;
|
|
@@ -3833,10 +3831,10 @@ class ExitCodeError extends Error {
|
|
|
3833
3831
|
this.exitCode = exitCode;
|
|
3834
3832
|
}
|
|
3835
3833
|
}
|
|
3836
|
-
const claudeCliPath =
|
|
3834
|
+
const claudeCliPath = node_path.resolve(node_path.join(projectPath(), "scripts", "claude_local_launcher.cjs"));
|
|
3837
3835
|
async function claudeLocal(opts) {
|
|
3838
3836
|
const projectDir = getProjectPath(opts.path);
|
|
3839
|
-
|
|
3837
|
+
node_fs.mkdirSync(projectDir, { recursive: true });
|
|
3840
3838
|
const hasContinueFlag = opts.claudeArgs?.includes("--continue");
|
|
3841
3839
|
const hasResumeFlag = opts.claudeArgs?.includes("--resume");
|
|
3842
3840
|
const hasUserSessionControl = hasContinueFlag || hasResumeFlag;
|
|
@@ -3955,7 +3953,7 @@ async function claudeLocal(opts) {
|
|
|
3955
3953
|
args.push("--settings", opts.hookSettingsPath);
|
|
3956
3954
|
api.logger.debug(`[ClaudeLocal] Using hook settings: ${opts.hookSettingsPath}`);
|
|
3957
3955
|
}
|
|
3958
|
-
if (!claudeCliPath || !
|
|
3956
|
+
if (!claudeCliPath || !node_fs.existsSync(claudeCliPath)) {
|
|
3959
3957
|
throw new Error("Claude local launcher not found. Please ensure HAPPY_PROJECT_ROOT is set correctly for development.");
|
|
3960
3958
|
}
|
|
3961
3959
|
const env = {
|
|
@@ -5713,17 +5711,17 @@ function readGeminiLocalConfig() {
|
|
|
5713
5711
|
let googleCloudProject = null;
|
|
5714
5712
|
let googleCloudProjectEmail = null;
|
|
5715
5713
|
const possiblePaths = [
|
|
5716
|
-
path
|
|
5714
|
+
path.join(os$1.homedir(), ".gemini", "oauth_creds.json"),
|
|
5717
5715
|
// Main OAuth credentials file
|
|
5718
|
-
path
|
|
5719
|
-
path
|
|
5720
|
-
path
|
|
5721
|
-
path
|
|
5716
|
+
path.join(os$1.homedir(), ".gemini", "config.json"),
|
|
5717
|
+
path.join(os$1.homedir(), ".config", "gemini", "config.json"),
|
|
5718
|
+
path.join(os$1.homedir(), ".gemini", "auth.json"),
|
|
5719
|
+
path.join(os$1.homedir(), ".config", "gemini", "auth.json")
|
|
5722
5720
|
];
|
|
5723
5721
|
for (const configPath of possiblePaths) {
|
|
5724
|
-
if (fs
|
|
5722
|
+
if (fs.existsSync(configPath)) {
|
|
5725
5723
|
try {
|
|
5726
|
-
const config = JSON.parse(fs
|
|
5724
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
5727
5725
|
if (!token) {
|
|
5728
5726
|
const foundToken = config.access_token || config.token || config.apiKey || config.GEMINI_API_KEY;
|
|
5729
5727
|
if (foundToken && typeof foundToken === "string") {
|
|
@@ -5795,22 +5793,22 @@ function determineGeminiModel(explicitModel, localConfig) {
|
|
|
5795
5793
|
}
|
|
5796
5794
|
function saveGeminiModelToConfig(model) {
|
|
5797
5795
|
try {
|
|
5798
|
-
const configDir = path
|
|
5799
|
-
const configPath = path
|
|
5800
|
-
if (!fs
|
|
5801
|
-
fs
|
|
5796
|
+
const configDir = path.join(os$1.homedir(), ".gemini");
|
|
5797
|
+
const configPath = path.join(configDir, "config.json");
|
|
5798
|
+
if (!fs.existsSync(configDir)) {
|
|
5799
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
5802
5800
|
}
|
|
5803
5801
|
let config = {};
|
|
5804
|
-
if (fs
|
|
5802
|
+
if (fs.existsSync(configPath)) {
|
|
5805
5803
|
try {
|
|
5806
|
-
config = JSON.parse(fs
|
|
5804
|
+
config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
5807
5805
|
} catch (error) {
|
|
5808
5806
|
api.logger.debug(`[Gemini] Failed to read existing config, creating new one`);
|
|
5809
5807
|
config = {};
|
|
5810
5808
|
}
|
|
5811
5809
|
}
|
|
5812
5810
|
config.model = model;
|
|
5813
|
-
fs
|
|
5811
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
5814
5812
|
api.logger.debug(`[Gemini] Saved model "${model}" to ${configPath}`);
|
|
5815
5813
|
} catch (error) {
|
|
5816
5814
|
api.logger.debug(`[Gemini] Failed to save model to config:`, error);
|
|
@@ -5818,15 +5816,15 @@ function saveGeminiModelToConfig(model) {
|
|
|
5818
5816
|
}
|
|
5819
5817
|
function saveGoogleCloudProjectToConfig(projectId, email) {
|
|
5820
5818
|
try {
|
|
5821
|
-
const configDir = path
|
|
5822
|
-
const configPath = path
|
|
5823
|
-
if (!fs
|
|
5824
|
-
fs
|
|
5819
|
+
const configDir = path.join(os$1.homedir(), ".gemini");
|
|
5820
|
+
const configPath = path.join(configDir, "config.json");
|
|
5821
|
+
if (!fs.existsSync(configDir)) {
|
|
5822
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
5825
5823
|
}
|
|
5826
5824
|
let config = {};
|
|
5827
|
-
if (fs
|
|
5825
|
+
if (fs.existsSync(configPath)) {
|
|
5828
5826
|
try {
|
|
5829
|
-
config = JSON.parse(fs
|
|
5827
|
+
config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
5830
5828
|
} catch {
|
|
5831
5829
|
config = {};
|
|
5832
5830
|
}
|
|
@@ -5835,7 +5833,7 @@ function saveGoogleCloudProjectToConfig(projectId, email) {
|
|
|
5835
5833
|
if (email) {
|
|
5836
5834
|
config.googleCloudProjectEmail = email;
|
|
5837
5835
|
}
|
|
5838
|
-
fs
|
|
5836
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
5839
5837
|
api.logger.debug(`[Gemini] Saved Google Cloud Project "${projectId}"${email ? ` for ${email}` : ""} to ${configPath}`);
|
|
5840
5838
|
} catch (error) {
|
|
5841
5839
|
api.logger.debug(`[Gemini] Failed to save Google Cloud Project to config:`, error);
|
|
@@ -5942,11 +5940,11 @@ function readFirstEnv(...names) {
|
|
|
5942
5940
|
return "";
|
|
5943
5941
|
}
|
|
5944
5942
|
function normalizeCommandPath(command) {
|
|
5945
|
-
if (
|
|
5943
|
+
if (node_path.isAbsolute(command)) {
|
|
5946
5944
|
return command;
|
|
5947
5945
|
}
|
|
5948
|
-
const resolved =
|
|
5949
|
-
return
|
|
5946
|
+
const resolved = node_path.resolve(process.cwd(), command);
|
|
5947
|
+
return node_fs.existsSync(resolved) ? resolved : command;
|
|
5950
5948
|
}
|
|
5951
5949
|
function resolveCommandOnPath(command) {
|
|
5952
5950
|
const pathValue = typeof process.env.PATH === "string" ? process.env.PATH : "";
|
|
@@ -5954,13 +5952,13 @@ function resolveCommandOnPath(command) {
|
|
|
5954
5952
|
return null;
|
|
5955
5953
|
}
|
|
5956
5954
|
const extensions = process.platform === "win32" ? (process.env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((value) => value.trim().toLowerCase()).filter(Boolean) : [""];
|
|
5957
|
-
for (const dir of pathValue.split(
|
|
5955
|
+
for (const dir of pathValue.split(node_path.delimiter)) {
|
|
5958
5956
|
const trimmedDir = dir.trim();
|
|
5959
5957
|
if (!trimmedDir) {
|
|
5960
5958
|
continue;
|
|
5961
5959
|
}
|
|
5962
|
-
const directCandidate =
|
|
5963
|
-
if (
|
|
5960
|
+
const directCandidate = node_path.join(trimmedDir, command);
|
|
5961
|
+
if (node_fs.existsSync(directCandidate)) {
|
|
5964
5962
|
return directCandidate;
|
|
5965
5963
|
}
|
|
5966
5964
|
if (process.platform !== "win32") {
|
|
@@ -5971,8 +5969,8 @@ function resolveCommandOnPath(command) {
|
|
|
5971
5969
|
continue;
|
|
5972
5970
|
}
|
|
5973
5971
|
for (const extension of extensions) {
|
|
5974
|
-
const candidate =
|
|
5975
|
-
if (
|
|
5972
|
+
const candidate = node_path.join(trimmedDir, `${command}${extension.toLowerCase()}`);
|
|
5973
|
+
if (node_fs.existsSync(candidate)) {
|
|
5976
5974
|
return candidate;
|
|
5977
5975
|
}
|
|
5978
5976
|
}
|
|
@@ -6067,8 +6065,8 @@ function validateCodexAcpSpawn(options = {}) {
|
|
|
6067
6065
|
const normalizedCommand = spawn.command.trim();
|
|
6068
6066
|
const commandLower = normalizedCommand.toLowerCase();
|
|
6069
6067
|
const npxMode = readCodexAcpNpxMode();
|
|
6070
|
-
if (
|
|
6071
|
-
if (!
|
|
6068
|
+
if (node_path.isAbsolute(normalizedCommand)) {
|
|
6069
|
+
if (!node_fs.existsSync(normalizedCommand)) {
|
|
6072
6070
|
return {
|
|
6073
6071
|
ok: false,
|
|
6074
6072
|
errorMessage: `Codex ACP is enabled, but the resolved command does not exist: ${normalizedCommand}`
|
|
@@ -6338,12 +6336,12 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
6338
6336
|
async function executeUnifiedProvider(opts) {
|
|
6339
6337
|
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
|
|
6340
6338
|
if (opts.provider === "claude") {
|
|
6341
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
6339
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-IeRSC5qX.cjs'); });
|
|
6342
6340
|
await runClaude(credentials, opts.claudeOptions ?? {});
|
|
6343
6341
|
return;
|
|
6344
6342
|
}
|
|
6345
6343
|
if (opts.provider === "codex") {
|
|
6346
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
6344
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-WRmgSK6L.cjs'); });
|
|
6347
6345
|
await runCodex({
|
|
6348
6346
|
credentials,
|
|
6349
6347
|
startedBy: opts.startedBy,
|
|
@@ -6353,7 +6351,7 @@ async function executeUnifiedProvider(opts) {
|
|
|
6353
6351
|
return;
|
|
6354
6352
|
}
|
|
6355
6353
|
if (opts.provider === "gemini") {
|
|
6356
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
6354
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-qBh6zs5G.cjs'); });
|
|
6357
6355
|
await runGemini({
|
|
6358
6356
|
credentials,
|
|
6359
6357
|
startedBy: opts.startedBy
|
|
@@ -6395,7 +6393,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6395
6393
|
return;
|
|
6396
6394
|
} else if (subcommand === "runtime") {
|
|
6397
6395
|
if (args[1] === "providers") {
|
|
6398
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
6396
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-CdXv1zNF.cjs'); });
|
|
6399
6397
|
console.log(renderRuntimeProviders());
|
|
6400
6398
|
return;
|
|
6401
6399
|
}
|
|
@@ -6573,8 +6571,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6573
6571
|
const projectId = args[3];
|
|
6574
6572
|
try {
|
|
6575
6573
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
6576
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
6577
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
6574
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-PzKU0QCa.cjs'); });
|
|
6575
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-D9dIR956.cjs'); }).then(function (n) { return n.api; });
|
|
6578
6576
|
let userEmail = void 0;
|
|
6579
6577
|
try {
|
|
6580
6578
|
const credentials = await readCredentials2();
|
|
@@ -6737,7 +6735,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6737
6735
|
if (latest) {
|
|
6738
6736
|
console.error(`Latest daemon log: ${latest.path}`);
|
|
6739
6737
|
try {
|
|
6740
|
-
const logContent =
|
|
6738
|
+
const logContent = node_fs.readFileSync(latest.path, "utf-8");
|
|
6741
6739
|
if (logContent.includes("EADDRINUSE")) {
|
|
6742
6740
|
console.error("Daemon control port is already in use. Retry after stopping the stale daemon or run `hicloud doctor clean`.");
|
|
6743
6741
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('chalk');
|
|
4
|
-
require('./api-
|
|
5
|
-
require('./persistence-
|
|
4
|
+
require('./api-D9dIR956.cjs');
|
|
5
|
+
require('./persistence-PzKU0QCa.cjs');
|
|
6
6
|
require('zod');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-LYPXVO_L.cjs');
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('@agentclientprotocol/sdk');
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'chalk';
|
|
2
|
-
import './api-
|
|
3
|
-
import './persistence-
|
|
2
|
+
import './api-DpQIC-DJ.mjs';
|
|
3
|
+
import './persistence-CqgPgbzN.mjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-CriPm_z9.mjs';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import '@agentclientprotocol/sdk';
|
package/dist/lib.cjs
CHANGED
package/dist/lib.d.cts
CHANGED
|
@@ -468,6 +468,7 @@ type Metadata = {
|
|
|
468
468
|
};
|
|
469
469
|
machineId?: string;
|
|
470
470
|
claudeSessionId?: string;
|
|
471
|
+
claudeTranscriptPath?: string;
|
|
471
472
|
codexSessionId?: string;
|
|
472
473
|
tools?: string[];
|
|
473
474
|
slashCommands?: string[];
|
|
@@ -687,6 +688,8 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
687
688
|
private encryptionKey;
|
|
688
689
|
private encryptionVariant;
|
|
689
690
|
private pendingReliableCodexMessages;
|
|
691
|
+
private reconnectAfterServerDisconnectTimer;
|
|
692
|
+
private lastSocketServerError;
|
|
690
693
|
constructor(credentials: Credentials, session: Session);
|
|
691
694
|
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
692
695
|
getMetadataSnapshot(): Metadata | null;
|
|
@@ -748,6 +751,9 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
748
751
|
private emitEncryptedSessionMessage;
|
|
749
752
|
private flushReliableCodexMessages;
|
|
750
753
|
private shouldBufferReliableCodexMessage;
|
|
754
|
+
private retryAfterServerDisconnect;
|
|
755
|
+
private clearReconnectAfterServerDisconnectTimer;
|
|
756
|
+
private normalizeSocketError;
|
|
751
757
|
}
|
|
752
758
|
|
|
753
759
|
interface SpawnSessionOptions {
|
package/dist/lib.d.mts
CHANGED
|
@@ -468,6 +468,7 @@ type Metadata = {
|
|
|
468
468
|
};
|
|
469
469
|
machineId?: string;
|
|
470
470
|
claudeSessionId?: string;
|
|
471
|
+
claudeTranscriptPath?: string;
|
|
471
472
|
codexSessionId?: string;
|
|
472
473
|
tools?: string[];
|
|
473
474
|
slashCommands?: string[];
|
|
@@ -687,6 +688,8 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
687
688
|
private encryptionKey;
|
|
688
689
|
private encryptionVariant;
|
|
689
690
|
private pendingReliableCodexMessages;
|
|
691
|
+
private reconnectAfterServerDisconnectTimer;
|
|
692
|
+
private lastSocketServerError;
|
|
690
693
|
constructor(credentials: Credentials, session: Session);
|
|
691
694
|
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
692
695
|
getMetadataSnapshot(): Metadata | null;
|
|
@@ -748,6 +751,9 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
748
751
|
private emitEncryptedSessionMessage;
|
|
749
752
|
private flushReliableCodexMessages;
|
|
750
753
|
private shouldBufferReliableCodexMessage;
|
|
754
|
+
private retryAfterServerDisconnect;
|
|
755
|
+
private clearReconnectAfterServerDisconnectTimer;
|
|
756
|
+
private normalizeSocketError;
|
|
751
757
|
}
|
|
752
758
|
|
|
753
759
|
interface SpawnSessionOptions {
|
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-DpQIC-DJ.mjs';
|
|
2
2
|
export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'chalk';
|