happy-imou-cloud 2.0.2 → 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-D8VhEbs2.mjs → BaseReasoningProcessor-B37yOHxo.mjs} +2 -2
- package/dist/{BaseReasoningProcessor-B6tJ_eL5.cjs → BaseReasoningProcessor-_wxlqKB8.cjs} +4 -4
- package/dist/{api-D2Njw9Im.cjs → api-D9dIR956.cjs} +43 -43
- package/dist/{api-MYhAGPLn.mjs → api-DpQIC-DJ.mjs} +2 -2
- package/dist/{command-CVldr51S.cjs → command-CdXv1zNF.cjs} +3 -3
- package/dist/{command-nmK6O-ab.mjs → command-DRqrBuHM.mjs} +3 -3
- package/dist/{index-B97L7qLD.mjs → index-CriPm_z9.mjs} +8 -8
- package/dist/{index-Bg-YziG2.cjs → index-LYPXVO_L.cjs} +95 -95
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-Dkm7rm8k.mjs → persistence-CqgPgbzN.mjs} +1 -1
- package/dist/{persistence-D_2GkJAO.cjs → persistence-PzKU0QCa.cjs} +28 -28
- package/dist/{registerKillSessionHandler-BAXmJQRt.cjs → registerKillSessionHandler-BDBPoQSA.cjs} +2 -2
- package/dist/{registerKillSessionHandler-5GbrO0FM.mjs → registerKillSessionHandler-C3M_-4Zg.mjs} +2 -2
- package/dist/{runClaude-Cii3R2Fv.mjs → runClaude-D6Pdkevn.mjs} +25 -5
- package/dist/{runClaude-B-GNEkKg.cjs → runClaude-IeRSC5qX.cjs} +53 -33
- package/dist/{runCodex-C--ZwAhl.mjs → runCodex-CsfUU1Wb.mjs} +216 -401
- package/dist/{runCodex-CPHyGwj9.cjs → runCodex-WRmgSK6L.cjs} +216 -401
- package/dist/{runGemini-CQp7Nuzn.mjs → runGemini-CrH3dQ0Y.mjs} +5 -5
- package/dist/{runGemini-DaDz1bzQ.cjs → runGemini-qBh6zs5G.cjs} +5 -5
- package/package.json +1 -1
- 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,7 +3758,7 @@ 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}`));
|
|
@@ -3766,22 +3766,22 @@ function updateLocalGeminiCredentials(tokens) {
|
|
|
3766
3766
|
}
|
|
3767
3767
|
|
|
3768
3768
|
function getProjectPath(workingDirectory, claudeConfigDirOverride) {
|
|
3769
|
-
const projectId =
|
|
3769
|
+
const projectId = node_path.resolve(workingDirectory).replace(/[^a-zA-Z0-9-]/g, "-");
|
|
3770
3770
|
const claudeConfigDirRaw = process.env.CLAUDE_CONFIG_DIR ?? "";
|
|
3771
3771
|
const claudeConfigDirTrimmed = claudeConfigDirRaw.trim();
|
|
3772
|
-
const claudeConfigDir = claudeConfigDirTrimmed ? claudeConfigDirTrimmed :
|
|
3773
|
-
return
|
|
3772
|
+
const claudeConfigDir = claudeConfigDirTrimmed ? claudeConfigDirTrimmed : node_path.join(os.homedir(), ".claude");
|
|
3773
|
+
return node_path.join(claudeConfigDir, "projects", projectId);
|
|
3774
3774
|
}
|
|
3775
3775
|
|
|
3776
|
-
function claudeCheckSession(sessionId, path
|
|
3777
|
-
const projectDir = getProjectPath(path
|
|
3778
|
-
const sessionFile = transcriptPath ??
|
|
3779
|
-
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);
|
|
3780
3780
|
if (!sessionExists) {
|
|
3781
3781
|
api.logger.debug(`[claudeCheckSession] Path ${sessionFile} does not exist`);
|
|
3782
3782
|
return false;
|
|
3783
3783
|
}
|
|
3784
|
-
const sessionData =
|
|
3784
|
+
const sessionData = node_fs.readFileSync(sessionFile, "utf-8").split("\n");
|
|
3785
3785
|
const hasGoodMessage = !!sessionData.find((v, index) => {
|
|
3786
3786
|
if (!v.trim()) return false;
|
|
3787
3787
|
try {
|
|
@@ -3802,7 +3802,7 @@ function claudeFindLastSession(workingDirectory) {
|
|
|
3802
3802
|
try {
|
|
3803
3803
|
const projectDir = getProjectPath(workingDirectory);
|
|
3804
3804
|
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3805
|
-
const files =
|
|
3805
|
+
const files = node_fs.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).map((f) => {
|
|
3806
3806
|
const sessionId = f.replace(".jsonl", "");
|
|
3807
3807
|
if (!uuidPattern.test(sessionId)) {
|
|
3808
3808
|
return null;
|
|
@@ -3811,7 +3811,7 @@ function claudeFindLastSession(workingDirectory) {
|
|
|
3811
3811
|
return {
|
|
3812
3812
|
name: f,
|
|
3813
3813
|
sessionId,
|
|
3814
|
-
mtime:
|
|
3814
|
+
mtime: node_fs.statSync(node_path.join(projectDir, f)).mtime.getTime()
|
|
3815
3815
|
};
|
|
3816
3816
|
}
|
|
3817
3817
|
return null;
|
|
@@ -3831,10 +3831,10 @@ class ExitCodeError extends Error {
|
|
|
3831
3831
|
this.exitCode = exitCode;
|
|
3832
3832
|
}
|
|
3833
3833
|
}
|
|
3834
|
-
const claudeCliPath =
|
|
3834
|
+
const claudeCliPath = node_path.resolve(node_path.join(projectPath(), "scripts", "claude_local_launcher.cjs"));
|
|
3835
3835
|
async function claudeLocal(opts) {
|
|
3836
3836
|
const projectDir = getProjectPath(opts.path);
|
|
3837
|
-
|
|
3837
|
+
node_fs.mkdirSync(projectDir, { recursive: true });
|
|
3838
3838
|
const hasContinueFlag = opts.claudeArgs?.includes("--continue");
|
|
3839
3839
|
const hasResumeFlag = opts.claudeArgs?.includes("--resume");
|
|
3840
3840
|
const hasUserSessionControl = hasContinueFlag || hasResumeFlag;
|
|
@@ -3953,7 +3953,7 @@ async function claudeLocal(opts) {
|
|
|
3953
3953
|
args.push("--settings", opts.hookSettingsPath);
|
|
3954
3954
|
api.logger.debug(`[ClaudeLocal] Using hook settings: ${opts.hookSettingsPath}`);
|
|
3955
3955
|
}
|
|
3956
|
-
if (!claudeCliPath || !
|
|
3956
|
+
if (!claudeCliPath || !node_fs.existsSync(claudeCliPath)) {
|
|
3957
3957
|
throw new Error("Claude local launcher not found. Please ensure HAPPY_PROJECT_ROOT is set correctly for development.");
|
|
3958
3958
|
}
|
|
3959
3959
|
const env = {
|
|
@@ -5711,17 +5711,17 @@ function readGeminiLocalConfig() {
|
|
|
5711
5711
|
let googleCloudProject = null;
|
|
5712
5712
|
let googleCloudProjectEmail = null;
|
|
5713
5713
|
const possiblePaths = [
|
|
5714
|
-
path
|
|
5714
|
+
path.join(os$1.homedir(), ".gemini", "oauth_creds.json"),
|
|
5715
5715
|
// Main OAuth credentials file
|
|
5716
|
-
path
|
|
5717
|
-
path
|
|
5718
|
-
path
|
|
5719
|
-
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")
|
|
5720
5720
|
];
|
|
5721
5721
|
for (const configPath of possiblePaths) {
|
|
5722
|
-
if (fs
|
|
5722
|
+
if (fs.existsSync(configPath)) {
|
|
5723
5723
|
try {
|
|
5724
|
-
const config = JSON.parse(fs
|
|
5724
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
5725
5725
|
if (!token) {
|
|
5726
5726
|
const foundToken = config.access_token || config.token || config.apiKey || config.GEMINI_API_KEY;
|
|
5727
5727
|
if (foundToken && typeof foundToken === "string") {
|
|
@@ -5793,22 +5793,22 @@ function determineGeminiModel(explicitModel, localConfig) {
|
|
|
5793
5793
|
}
|
|
5794
5794
|
function saveGeminiModelToConfig(model) {
|
|
5795
5795
|
try {
|
|
5796
|
-
const configDir = path
|
|
5797
|
-
const configPath = path
|
|
5798
|
-
if (!fs
|
|
5799
|
-
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 });
|
|
5800
5800
|
}
|
|
5801
5801
|
let config = {};
|
|
5802
|
-
if (fs
|
|
5802
|
+
if (fs.existsSync(configPath)) {
|
|
5803
5803
|
try {
|
|
5804
|
-
config = JSON.parse(fs
|
|
5804
|
+
config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
5805
5805
|
} catch (error) {
|
|
5806
5806
|
api.logger.debug(`[Gemini] Failed to read existing config, creating new one`);
|
|
5807
5807
|
config = {};
|
|
5808
5808
|
}
|
|
5809
5809
|
}
|
|
5810
5810
|
config.model = model;
|
|
5811
|
-
fs
|
|
5811
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
5812
5812
|
api.logger.debug(`[Gemini] Saved model "${model}" to ${configPath}`);
|
|
5813
5813
|
} catch (error) {
|
|
5814
5814
|
api.logger.debug(`[Gemini] Failed to save model to config:`, error);
|
|
@@ -5816,15 +5816,15 @@ function saveGeminiModelToConfig(model) {
|
|
|
5816
5816
|
}
|
|
5817
5817
|
function saveGoogleCloudProjectToConfig(projectId, email) {
|
|
5818
5818
|
try {
|
|
5819
|
-
const configDir = path
|
|
5820
|
-
const configPath = path
|
|
5821
|
-
if (!fs
|
|
5822
|
-
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 });
|
|
5823
5823
|
}
|
|
5824
5824
|
let config = {};
|
|
5825
|
-
if (fs
|
|
5825
|
+
if (fs.existsSync(configPath)) {
|
|
5826
5826
|
try {
|
|
5827
|
-
config = JSON.parse(fs
|
|
5827
|
+
config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
5828
5828
|
} catch {
|
|
5829
5829
|
config = {};
|
|
5830
5830
|
}
|
|
@@ -5833,7 +5833,7 @@ function saveGoogleCloudProjectToConfig(projectId, email) {
|
|
|
5833
5833
|
if (email) {
|
|
5834
5834
|
config.googleCloudProjectEmail = email;
|
|
5835
5835
|
}
|
|
5836
|
-
fs
|
|
5836
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
5837
5837
|
api.logger.debug(`[Gemini] Saved Google Cloud Project "${projectId}"${email ? ` for ${email}` : ""} to ${configPath}`);
|
|
5838
5838
|
} catch (error) {
|
|
5839
5839
|
api.logger.debug(`[Gemini] Failed to save Google Cloud Project to config:`, error);
|
|
@@ -5940,11 +5940,11 @@ function readFirstEnv(...names) {
|
|
|
5940
5940
|
return "";
|
|
5941
5941
|
}
|
|
5942
5942
|
function normalizeCommandPath(command) {
|
|
5943
|
-
if (
|
|
5943
|
+
if (node_path.isAbsolute(command)) {
|
|
5944
5944
|
return command;
|
|
5945
5945
|
}
|
|
5946
|
-
const resolved =
|
|
5947
|
-
return
|
|
5946
|
+
const resolved = node_path.resolve(process.cwd(), command);
|
|
5947
|
+
return node_fs.existsSync(resolved) ? resolved : command;
|
|
5948
5948
|
}
|
|
5949
5949
|
function resolveCommandOnPath(command) {
|
|
5950
5950
|
const pathValue = typeof process.env.PATH === "string" ? process.env.PATH : "";
|
|
@@ -5952,13 +5952,13 @@ function resolveCommandOnPath(command) {
|
|
|
5952
5952
|
return null;
|
|
5953
5953
|
}
|
|
5954
5954
|
const extensions = process.platform === "win32" ? (process.env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((value) => value.trim().toLowerCase()).filter(Boolean) : [""];
|
|
5955
|
-
for (const dir of pathValue.split(
|
|
5955
|
+
for (const dir of pathValue.split(node_path.delimiter)) {
|
|
5956
5956
|
const trimmedDir = dir.trim();
|
|
5957
5957
|
if (!trimmedDir) {
|
|
5958
5958
|
continue;
|
|
5959
5959
|
}
|
|
5960
|
-
const directCandidate =
|
|
5961
|
-
if (
|
|
5960
|
+
const directCandidate = node_path.join(trimmedDir, command);
|
|
5961
|
+
if (node_fs.existsSync(directCandidate)) {
|
|
5962
5962
|
return directCandidate;
|
|
5963
5963
|
}
|
|
5964
5964
|
if (process.platform !== "win32") {
|
|
@@ -5969,8 +5969,8 @@ function resolveCommandOnPath(command) {
|
|
|
5969
5969
|
continue;
|
|
5970
5970
|
}
|
|
5971
5971
|
for (const extension of extensions) {
|
|
5972
|
-
const candidate =
|
|
5973
|
-
if (
|
|
5972
|
+
const candidate = node_path.join(trimmedDir, `${command}${extension.toLowerCase()}`);
|
|
5973
|
+
if (node_fs.existsSync(candidate)) {
|
|
5974
5974
|
return candidate;
|
|
5975
5975
|
}
|
|
5976
5976
|
}
|
|
@@ -6065,8 +6065,8 @@ function validateCodexAcpSpawn(options = {}) {
|
|
|
6065
6065
|
const normalizedCommand = spawn.command.trim();
|
|
6066
6066
|
const commandLower = normalizedCommand.toLowerCase();
|
|
6067
6067
|
const npxMode = readCodexAcpNpxMode();
|
|
6068
|
-
if (
|
|
6069
|
-
if (!
|
|
6068
|
+
if (node_path.isAbsolute(normalizedCommand)) {
|
|
6069
|
+
if (!node_fs.existsSync(normalizedCommand)) {
|
|
6070
6070
|
return {
|
|
6071
6071
|
ok: false,
|
|
6072
6072
|
errorMessage: `Codex ACP is enabled, but the resolved command does not exist: ${normalizedCommand}`
|
|
@@ -6336,12 +6336,12 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
6336
6336
|
async function executeUnifiedProvider(opts) {
|
|
6337
6337
|
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
|
|
6338
6338
|
if (opts.provider === "claude") {
|
|
6339
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
6339
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-IeRSC5qX.cjs'); });
|
|
6340
6340
|
await runClaude(credentials, opts.claudeOptions ?? {});
|
|
6341
6341
|
return;
|
|
6342
6342
|
}
|
|
6343
6343
|
if (opts.provider === "codex") {
|
|
6344
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
6344
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-WRmgSK6L.cjs'); });
|
|
6345
6345
|
await runCodex({
|
|
6346
6346
|
credentials,
|
|
6347
6347
|
startedBy: opts.startedBy,
|
|
@@ -6351,7 +6351,7 @@ async function executeUnifiedProvider(opts) {
|
|
|
6351
6351
|
return;
|
|
6352
6352
|
}
|
|
6353
6353
|
if (opts.provider === "gemini") {
|
|
6354
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
6354
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-qBh6zs5G.cjs'); });
|
|
6355
6355
|
await runGemini({
|
|
6356
6356
|
credentials,
|
|
6357
6357
|
startedBy: opts.startedBy
|
|
@@ -6393,7 +6393,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6393
6393
|
return;
|
|
6394
6394
|
} else if (subcommand === "runtime") {
|
|
6395
6395
|
if (args[1] === "providers") {
|
|
6396
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
6396
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-CdXv1zNF.cjs'); });
|
|
6397
6397
|
console.log(renderRuntimeProviders());
|
|
6398
6398
|
return;
|
|
6399
6399
|
}
|
|
@@ -6571,8 +6571,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6571
6571
|
const projectId = args[3];
|
|
6572
6572
|
try {
|
|
6573
6573
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
6574
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
6575
|
-
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; });
|
|
6576
6576
|
let userEmail = void 0;
|
|
6577
6577
|
try {
|
|
6578
6578
|
const credentials = await readCredentials2();
|
|
@@ -6735,7 +6735,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6735
6735
|
if (latest) {
|
|
6736
6736
|
console.error(`Latest daemon log: ${latest.path}`);
|
|
6737
6737
|
try {
|
|
6738
|
-
const logContent =
|
|
6738
|
+
const logContent = node_fs.readFileSync(latest.path, "utf-8");
|
|
6739
6739
|
if (logContent.includes("EADDRINUSE")) {
|
|
6740
6740
|
console.error("Daemon control port is already in use. Retry after stopping the stale daemon or run `hicloud doctor clean`.");
|
|
6741
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.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';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile, unlink, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
|
|
2
2
|
import { existsSync, unlinkSync, writeFileSync, readdirSync, readFileSync, constants } from 'node:fs';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
|
-
import { c as configuration, l as logger, e as encodeBase64 } from './api-
|
|
4
|
+
import { c as configuration, l as logger, e as encodeBase64 } from './api-DpQIC-DJ.mjs';
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import 'chalk';
|