happy-imou-cloud 1.1.5 → 1.1.6
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/{config-CW_20tNC.mjs → config-C4c3eRAq.mjs} +1 -1
- package/dist/{config-cUle3acO.cjs → config-DSI9r8Jl.cjs} +1 -1
- package/dist/{index-CKUiwwxb.mjs → index-B3bkHdEU.mjs} +227 -156
- package/dist/{index-CInN1H_b.cjs → index-BJ0xEdNB.cjs} +230 -159
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-BXxnODRE.mjs → persistence-DS4-Wbnm.mjs} +1 -1
- package/dist/{persistence-BmW5jAuU.cjs → persistence-DW_z9Bsh.cjs} +1 -1
- package/dist/{runCodex-BKGgW5hO.cjs → runCodex-BCgor8vK.cjs} +4 -4
- package/dist/{runCodex-DYoCy0rl.mjs → runCodex-DHo2-Vmd.mjs} +4 -4
- package/dist/{runGemini-mbF04Hj9.cjs → runGemini-81Ogay0E.cjs} +5 -5
- package/dist/{runGemini-DPGUQNvu.mjs → runGemini-D1DZS8IL.mjs} +5 -5
- package/dist/{setupOfflineReconnection-D40K8dgt.mjs → setupOfflineReconnection-B15b9tE7.mjs} +2 -2
- package/dist/{setupOfflineReconnection-BFYzP7HT.cjs → setupOfflineReconnection-D2mAyajw.cjs} +2 -2
- package/dist/{types-DswSykEM.cjs → types-DSQA_cBn.cjs} +2 -2
- package/dist/{types-DB-rfqhR.mjs → types-DY1-MAPO.mjs} +2 -2
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
|
-
import { l as logger } from './types-
|
|
5
|
+
import { l as logger } from './types-DY1-MAPO.mjs';
|
|
6
6
|
|
|
7
7
|
const GEMINI_API_KEY_ENV = "GEMINI_API_KEY";
|
|
8
8
|
const GOOGLE_API_KEY_ENV = "GOOGLE_API_KEY";
|
|
@@ -4,7 +4,7 @@ var fs = require('fs');
|
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var os = require('os');
|
|
6
6
|
var child_process = require('child_process');
|
|
7
|
-
var api = require('./types-
|
|
7
|
+
var api = require('./types-DSQA_cBn.cjs');
|
|
8
8
|
|
|
9
9
|
const GEMINI_API_KEY_ENV = "GEMINI_API_KEY";
|
|
10
10
|
const GOOGLE_API_KEY_ENV = "GOOGLE_API_KEY";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
|
|
2
2
|
import os$1, { homedir, tmpdir } from 'node:os';
|
|
3
3
|
import { randomUUID, randomBytes } from 'node:crypto';
|
|
4
|
-
import { l as logger, f as backoff, d as delay, R as RawJSONLinesSchema, g as AsyncLock, c as configuration, p as packageJson, e as encodeBase64, h as encodeBase64Url, i as decodeBase64,
|
|
4
|
+
import { l as logger, f as backoff, d as delay, R as RawJSONLinesSchema, g as AsyncLock, c as configuration, H as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, e as encodeBase64, h as encodeBase64Url, i as decodeBase64, A as ApiClient, b as connectionState, s as startOfflineReconnection, j as getLatestDaemonLog } from './types-DY1-MAPO.mjs';
|
|
5
5
|
import { spawn, execSync, execFileSync } from 'node:child_process';
|
|
6
6
|
import { resolve, isAbsolute, join } from 'node:path';
|
|
7
7
|
import { createInterface } from 'node:readline';
|
|
@@ -19,7 +19,7 @@ import 'socket.io-client';
|
|
|
19
19
|
import tweetnacl from 'tweetnacl';
|
|
20
20
|
import 'expo-server-sdk';
|
|
21
21
|
import { isDeepStrictEqual } from 'node:util';
|
|
22
|
-
import { readDaemonState, clearDaemonState, readSettings, readCredentials, updateSettings, writeCredentialsLegacy, writeCredentialsDataKey, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-
|
|
22
|
+
import { readDaemonState, clearDaemonState, readSettings, readCredentials, updateSettings, writeCredentialsLegacy, writeCredentialsDataKey, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-DS4-Wbnm.mjs';
|
|
23
23
|
import { createHash, randomBytes as randomBytes$1 } from 'crypto';
|
|
24
24
|
import { spawn as spawn$1, execSync as execSync$1, exec } from 'child_process';
|
|
25
25
|
import { readFileSync as readFileSync$1, existsSync as existsSync$1, writeFileSync as writeFileSync$1, chmodSync, unlinkSync as unlinkSync$1, mkdirSync as mkdirSync$1 } from 'fs';
|
|
@@ -3673,150 +3673,6 @@ function extractSDKMetadataAsync(onComplete) {
|
|
|
3673
3673
|
});
|
|
3674
3674
|
}
|
|
3675
3675
|
|
|
3676
|
-
async function daemonPost(path, body) {
|
|
3677
|
-
const state = await readDaemonState();
|
|
3678
|
-
if (!state?.httpPort) {
|
|
3679
|
-
const errorMessage = "No daemon running, no state file found";
|
|
3680
|
-
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3681
|
-
return {
|
|
3682
|
-
error: errorMessage
|
|
3683
|
-
};
|
|
3684
|
-
}
|
|
3685
|
-
try {
|
|
3686
|
-
process.kill(state.pid, 0);
|
|
3687
|
-
} catch (error) {
|
|
3688
|
-
const errorMessage = "Daemon is not running, file is stale";
|
|
3689
|
-
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3690
|
-
return {
|
|
3691
|
-
error: errorMessage
|
|
3692
|
-
};
|
|
3693
|
-
}
|
|
3694
|
-
try {
|
|
3695
|
-
const timeout = process.env.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 1e4;
|
|
3696
|
-
const response = await fetch(`http://127.0.0.1:${state.httpPort}${path}`, {
|
|
3697
|
-
method: "POST",
|
|
3698
|
-
headers: { "Content-Type": "application/json" },
|
|
3699
|
-
body: JSON.stringify(body || {}),
|
|
3700
|
-
// Mostly increased for stress test
|
|
3701
|
-
signal: AbortSignal.timeout(timeout)
|
|
3702
|
-
});
|
|
3703
|
-
if (!response.ok) {
|
|
3704
|
-
const errorMessage = `Request failed: ${path}, HTTP ${response.status}`;
|
|
3705
|
-
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3706
|
-
return {
|
|
3707
|
-
error: errorMessage
|
|
3708
|
-
};
|
|
3709
|
-
}
|
|
3710
|
-
return await response.json();
|
|
3711
|
-
} catch (error) {
|
|
3712
|
-
const errorMessage = `Request failed: ${path}, ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
3713
|
-
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3714
|
-
return {
|
|
3715
|
-
error: errorMessage
|
|
3716
|
-
};
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
async function notifyDaemonSessionStarted(sessionId, metadata) {
|
|
3720
|
-
return await daemonPost("/session-started", {
|
|
3721
|
-
sessionId,
|
|
3722
|
-
metadata
|
|
3723
|
-
});
|
|
3724
|
-
}
|
|
3725
|
-
async function listDaemonSessions() {
|
|
3726
|
-
const result = await daemonPost("/list");
|
|
3727
|
-
return result.children || [];
|
|
3728
|
-
}
|
|
3729
|
-
async function stopDaemonSession(sessionId) {
|
|
3730
|
-
const result = await daemonPost("/stop-session", { sessionId });
|
|
3731
|
-
return result.success || false;
|
|
3732
|
-
}
|
|
3733
|
-
async function stopDaemonHttp() {
|
|
3734
|
-
await daemonPost("/stop");
|
|
3735
|
-
}
|
|
3736
|
-
async function checkIfDaemonRunningAndCleanupStaleState() {
|
|
3737
|
-
const state = await readDaemonState();
|
|
3738
|
-
if (!state) {
|
|
3739
|
-
return false;
|
|
3740
|
-
}
|
|
3741
|
-
try {
|
|
3742
|
-
process.kill(state.pid, 0);
|
|
3743
|
-
return true;
|
|
3744
|
-
} catch {
|
|
3745
|
-
logger.debug("[DAEMON RUN] Daemon PID not running, cleaning up state");
|
|
3746
|
-
await cleanupDaemonState();
|
|
3747
|
-
return false;
|
|
3748
|
-
}
|
|
3749
|
-
}
|
|
3750
|
-
async function isDaemonRunningCurrentlyInstalledHappyVersion() {
|
|
3751
|
-
logger.debug("[DAEMON CONTROL] Checking if daemon is running same version");
|
|
3752
|
-
const runningDaemon = await checkIfDaemonRunningAndCleanupStaleState();
|
|
3753
|
-
if (!runningDaemon) {
|
|
3754
|
-
logger.debug("[DAEMON CONTROL] No daemon running, returning false");
|
|
3755
|
-
return false;
|
|
3756
|
-
}
|
|
3757
|
-
const state = await readDaemonState();
|
|
3758
|
-
if (!state) {
|
|
3759
|
-
logger.debug("[DAEMON CONTROL] No daemon state found, returning false");
|
|
3760
|
-
return false;
|
|
3761
|
-
}
|
|
3762
|
-
try {
|
|
3763
|
-
const packageJsonPath = join$1(projectPath(), "package.json");
|
|
3764
|
-
const packageJson = JSON.parse(readFileSync$1(packageJsonPath, "utf-8"));
|
|
3765
|
-
const currentCliVersion = packageJson.version;
|
|
3766
|
-
logger.debug(`[DAEMON CONTROL] Current CLI version: ${currentCliVersion}, Daemon started with version: ${state.startedWithCliVersion}`);
|
|
3767
|
-
return currentCliVersion === state.startedWithCliVersion;
|
|
3768
|
-
} catch (error) {
|
|
3769
|
-
logger.debug("[DAEMON CONTROL] Error checking daemon version", error);
|
|
3770
|
-
return false;
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
async function cleanupDaemonState() {
|
|
3774
|
-
try {
|
|
3775
|
-
await clearDaemonState();
|
|
3776
|
-
logger.debug("[DAEMON RUN] Daemon state file removed");
|
|
3777
|
-
} catch (error) {
|
|
3778
|
-
logger.debug("[DAEMON RUN] Error cleaning up daemon metadata", error);
|
|
3779
|
-
}
|
|
3780
|
-
}
|
|
3781
|
-
async function stopDaemon() {
|
|
3782
|
-
try {
|
|
3783
|
-
const state = await readDaemonState();
|
|
3784
|
-
if (!state) {
|
|
3785
|
-
logger.debug("No daemon state found");
|
|
3786
|
-
return;
|
|
3787
|
-
}
|
|
3788
|
-
logger.debug(`Stopping daemon with PID ${state.pid}`);
|
|
3789
|
-
try {
|
|
3790
|
-
await stopDaemonHttp();
|
|
3791
|
-
await waitForProcessDeath(state.pid, 2e3);
|
|
3792
|
-
logger.debug("Daemon stopped gracefully via HTTP");
|
|
3793
|
-
return;
|
|
3794
|
-
} catch (error) {
|
|
3795
|
-
logger.debug("HTTP stop failed, will force kill", error);
|
|
3796
|
-
}
|
|
3797
|
-
try {
|
|
3798
|
-
process.kill(state.pid, "SIGKILL");
|
|
3799
|
-
logger.debug("Force killed daemon");
|
|
3800
|
-
} catch (error) {
|
|
3801
|
-
logger.debug("Daemon already dead");
|
|
3802
|
-
}
|
|
3803
|
-
} catch (error) {
|
|
3804
|
-
logger.debug("Error stopping daemon", error);
|
|
3805
|
-
}
|
|
3806
|
-
}
|
|
3807
|
-
async function waitForProcessDeath(pid, timeout) {
|
|
3808
|
-
const start = Date.now();
|
|
3809
|
-
while (Date.now() - start < timeout) {
|
|
3810
|
-
try {
|
|
3811
|
-
process.kill(pid, 0);
|
|
3812
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
3813
|
-
} catch {
|
|
3814
|
-
return;
|
|
3815
|
-
}
|
|
3816
|
-
}
|
|
3817
|
-
throw new Error("Process did not die within timeout");
|
|
3818
|
-
}
|
|
3819
|
-
|
|
3820
3676
|
function getDaemonPid() {
|
|
3821
3677
|
try {
|
|
3822
3678
|
if (!existsSync(configuration.daemonStateFile)) {
|
|
@@ -3984,6 +3840,210 @@ async function killRunawayHappyProcesses() {
|
|
|
3984
3840
|
return { killed, errors };
|
|
3985
3841
|
}
|
|
3986
3842
|
|
|
3843
|
+
async function daemonPost(path, body) {
|
|
3844
|
+
const state = await readDaemonState();
|
|
3845
|
+
if (!state?.httpPort) {
|
|
3846
|
+
const errorMessage = "No daemon running, no state file found";
|
|
3847
|
+
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3848
|
+
return {
|
|
3849
|
+
error: errorMessage
|
|
3850
|
+
};
|
|
3851
|
+
}
|
|
3852
|
+
try {
|
|
3853
|
+
process.kill(state.pid, 0);
|
|
3854
|
+
} catch (error) {
|
|
3855
|
+
const errorMessage = "Daemon is not running, file is stale";
|
|
3856
|
+
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3857
|
+
return {
|
|
3858
|
+
error: errorMessage
|
|
3859
|
+
};
|
|
3860
|
+
}
|
|
3861
|
+
try {
|
|
3862
|
+
const timeout = process.env.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 1e4;
|
|
3863
|
+
const response = await fetch(`http://127.0.0.1:${state.httpPort}${path}`, {
|
|
3864
|
+
method: "POST",
|
|
3865
|
+
headers: { "Content-Type": "application/json" },
|
|
3866
|
+
body: JSON.stringify(body || {}),
|
|
3867
|
+
// Mostly increased for stress test
|
|
3868
|
+
signal: AbortSignal.timeout(timeout)
|
|
3869
|
+
});
|
|
3870
|
+
if (!response.ok) {
|
|
3871
|
+
const errorMessage = `Request failed: ${path}, HTTP ${response.status}`;
|
|
3872
|
+
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3873
|
+
return {
|
|
3874
|
+
error: errorMessage
|
|
3875
|
+
};
|
|
3876
|
+
}
|
|
3877
|
+
return await response.json();
|
|
3878
|
+
} catch (error) {
|
|
3879
|
+
const errorMessage = `Request failed: ${path}, ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
3880
|
+
logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3881
|
+
return {
|
|
3882
|
+
error: errorMessage
|
|
3883
|
+
};
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
async function stopDaemonOnKnownPort() {
|
|
3887
|
+
try {
|
|
3888
|
+
const timeout = process.env.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 2e3;
|
|
3889
|
+
const response = await fetch(`http://127.0.0.1:${HAPPY_CLOUD_DAEMON_PORT}/stop`, {
|
|
3890
|
+
method: "POST",
|
|
3891
|
+
headers: { "Content-Type": "application/json" },
|
|
3892
|
+
body: JSON.stringify({}),
|
|
3893
|
+
signal: AbortSignal.timeout(timeout)
|
|
3894
|
+
});
|
|
3895
|
+
if (!response.ok) {
|
|
3896
|
+
logger.debug(`[CONTROL CLIENT] Known daemon port stop failed with HTTP ${response.status}`);
|
|
3897
|
+
return false;
|
|
3898
|
+
}
|
|
3899
|
+
return true;
|
|
3900
|
+
} catch (error) {
|
|
3901
|
+
logger.debug("[CONTROL CLIENT] No reachable daemon on known control port", error);
|
|
3902
|
+
return false;
|
|
3903
|
+
}
|
|
3904
|
+
}
|
|
3905
|
+
async function killOrphanDaemonProcesses() {
|
|
3906
|
+
const daemonTypes = /* @__PURE__ */ new Set([
|
|
3907
|
+
"daemon",
|
|
3908
|
+
"dev-daemon",
|
|
3909
|
+
"daemon-version-check",
|
|
3910
|
+
"dev-daemon-version-check"
|
|
3911
|
+
]);
|
|
3912
|
+
const orphanDaemons = (await findAllHappyProcesses()).filter(
|
|
3913
|
+
(proc) => proc.pid !== process.pid && daemonTypes.has(proc.type)
|
|
3914
|
+
);
|
|
3915
|
+
if (orphanDaemons.length === 0) {
|
|
3916
|
+
logger.debug("[CONTROL CLIENT] No orphan daemon processes found");
|
|
3917
|
+
return false;
|
|
3918
|
+
}
|
|
3919
|
+
let killed = false;
|
|
3920
|
+
for (const proc of orphanDaemons) {
|
|
3921
|
+
try {
|
|
3922
|
+
if (process.platform === "win32") {
|
|
3923
|
+
execFileSync("taskkill", ["/F", "/PID", proc.pid.toString()], { stdio: "ignore" });
|
|
3924
|
+
} else {
|
|
3925
|
+
process.kill(proc.pid, "SIGKILL");
|
|
3926
|
+
}
|
|
3927
|
+
logger.debug(`[CONTROL CLIENT] Killed orphan daemon PID ${proc.pid}: ${proc.command}`);
|
|
3928
|
+
killed = true;
|
|
3929
|
+
} catch (error) {
|
|
3930
|
+
logger.debug(`[CONTROL CLIENT] Failed to kill orphan daemon PID ${proc.pid}`, error);
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
return killed;
|
|
3934
|
+
}
|
|
3935
|
+
async function notifyDaemonSessionStarted(sessionId, metadata) {
|
|
3936
|
+
return await daemonPost("/session-started", {
|
|
3937
|
+
sessionId,
|
|
3938
|
+
metadata
|
|
3939
|
+
});
|
|
3940
|
+
}
|
|
3941
|
+
async function listDaemonSessions() {
|
|
3942
|
+
const result = await daemonPost("/list");
|
|
3943
|
+
return result.children || [];
|
|
3944
|
+
}
|
|
3945
|
+
async function stopDaemonSession(sessionId) {
|
|
3946
|
+
const result = await daemonPost("/stop-session", { sessionId });
|
|
3947
|
+
return result.success || false;
|
|
3948
|
+
}
|
|
3949
|
+
async function stopDaemonHttp() {
|
|
3950
|
+
await daemonPost("/stop");
|
|
3951
|
+
}
|
|
3952
|
+
async function checkIfDaemonRunningAndCleanupStaleState() {
|
|
3953
|
+
const state = await readDaemonState();
|
|
3954
|
+
if (!state) {
|
|
3955
|
+
return false;
|
|
3956
|
+
}
|
|
3957
|
+
try {
|
|
3958
|
+
process.kill(state.pid, 0);
|
|
3959
|
+
return true;
|
|
3960
|
+
} catch {
|
|
3961
|
+
logger.debug("[DAEMON RUN] Daemon PID not running, cleaning up state");
|
|
3962
|
+
await cleanupDaemonState();
|
|
3963
|
+
return false;
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
async function isDaemonRunningCurrentlyInstalledHappyVersion() {
|
|
3967
|
+
logger.debug("[DAEMON CONTROL] Checking if daemon is running same version");
|
|
3968
|
+
const runningDaemon = await checkIfDaemonRunningAndCleanupStaleState();
|
|
3969
|
+
if (!runningDaemon) {
|
|
3970
|
+
logger.debug("[DAEMON CONTROL] No daemon running, returning false");
|
|
3971
|
+
return false;
|
|
3972
|
+
}
|
|
3973
|
+
const state = await readDaemonState();
|
|
3974
|
+
if (!state) {
|
|
3975
|
+
logger.debug("[DAEMON CONTROL] No daemon state found, returning false");
|
|
3976
|
+
return false;
|
|
3977
|
+
}
|
|
3978
|
+
try {
|
|
3979
|
+
const packageJsonPath = join$1(projectPath(), "package.json");
|
|
3980
|
+
const packageJson = JSON.parse(readFileSync$1(packageJsonPath, "utf-8"));
|
|
3981
|
+
const currentCliVersion = packageJson.version;
|
|
3982
|
+
logger.debug(`[DAEMON CONTROL] Current CLI version: ${currentCliVersion}, Daemon started with version: ${state.startedWithCliVersion}`);
|
|
3983
|
+
return currentCliVersion === state.startedWithCliVersion;
|
|
3984
|
+
} catch (error) {
|
|
3985
|
+
logger.debug("[DAEMON CONTROL] Error checking daemon version", error);
|
|
3986
|
+
return false;
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
async function cleanupDaemonState() {
|
|
3990
|
+
try {
|
|
3991
|
+
await clearDaemonState();
|
|
3992
|
+
logger.debug("[DAEMON RUN] Daemon state file removed");
|
|
3993
|
+
} catch (error) {
|
|
3994
|
+
logger.debug("[DAEMON RUN] Error cleaning up daemon metadata", error);
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
async function stopDaemon() {
|
|
3998
|
+
try {
|
|
3999
|
+
const state = await readDaemonState();
|
|
4000
|
+
if (!state) {
|
|
4001
|
+
logger.debug("No daemon state found, trying known control port");
|
|
4002
|
+
const stoppedByKnownPort = await stopDaemonOnKnownPort();
|
|
4003
|
+
if (stoppedByKnownPort) {
|
|
4004
|
+
logger.debug(`Requested daemon stop via known control port ${HAPPY_CLOUD_DAEMON_PORT}`);
|
|
4005
|
+
return;
|
|
4006
|
+
}
|
|
4007
|
+
const killedOrphans = await killOrphanDaemonProcesses();
|
|
4008
|
+
if (killedOrphans) {
|
|
4009
|
+
logger.debug("Killed orphan daemon processes without state file");
|
|
4010
|
+
return;
|
|
4011
|
+
}
|
|
4012
|
+
logger.debug("No daemon state found");
|
|
4013
|
+
return;
|
|
4014
|
+
}
|
|
4015
|
+
logger.debug(`Stopping daemon with PID ${state.pid}`);
|
|
4016
|
+
try {
|
|
4017
|
+
await stopDaemonHttp();
|
|
4018
|
+
await waitForProcessDeath(state.pid, 2e3);
|
|
4019
|
+
logger.debug("Daemon stopped gracefully via HTTP");
|
|
4020
|
+
return;
|
|
4021
|
+
} catch (error) {
|
|
4022
|
+
logger.debug("HTTP stop failed, will force kill", error);
|
|
4023
|
+
}
|
|
4024
|
+
try {
|
|
4025
|
+
process.kill(state.pid, "SIGKILL");
|
|
4026
|
+
logger.debug("Force killed daemon");
|
|
4027
|
+
} catch (error) {
|
|
4028
|
+
logger.debug("Daemon already dead");
|
|
4029
|
+
}
|
|
4030
|
+
} catch (error) {
|
|
4031
|
+
logger.debug("Error stopping daemon", error);
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
async function waitForProcessDeath(pid, timeout) {
|
|
4035
|
+
const start = Date.now();
|
|
4036
|
+
while (Date.now() - start < timeout) {
|
|
4037
|
+
try {
|
|
4038
|
+
process.kill(pid, 0);
|
|
4039
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
4040
|
+
} catch {
|
|
4041
|
+
return;
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
throw new Error("Process did not die within timeout");
|
|
4045
|
+
}
|
|
4046
|
+
|
|
3987
4047
|
function getEnvironmentInfo() {
|
|
3988
4048
|
return {
|
|
3989
4049
|
PWD: process.env.PWD,
|
|
@@ -7523,7 +7583,7 @@ function getVersionString() {
|
|
|
7523
7583
|
return;
|
|
7524
7584
|
} else if (subcommand === "codex") {
|
|
7525
7585
|
try {
|
|
7526
|
-
const { runCodex } = await import('./runCodex-
|
|
7586
|
+
const { runCodex } = await import('./runCodex-DHo2-Vmd.mjs');
|
|
7527
7587
|
let startedBy = void 0;
|
|
7528
7588
|
for (let i = 1; i < args.length; i++) {
|
|
7529
7589
|
if (args[i] === "--started-by") {
|
|
@@ -7553,7 +7613,7 @@ function getVersionString() {
|
|
|
7553
7613
|
process.exit(1);
|
|
7554
7614
|
}
|
|
7555
7615
|
try {
|
|
7556
|
-
const { existsSync, readFileSync, writeFileSync, mkdirSync } = require("fs");
|
|
7616
|
+
const { existsSync, readFileSync: readFileSync2, writeFileSync, mkdirSync } = require("fs");
|
|
7557
7617
|
const { join } = require("path");
|
|
7558
7618
|
const { homedir } = require("os");
|
|
7559
7619
|
const configDir = join(homedir(), ".gemini");
|
|
@@ -7564,7 +7624,7 @@ function getVersionString() {
|
|
|
7564
7624
|
let config = {};
|
|
7565
7625
|
if (existsSync(configPath)) {
|
|
7566
7626
|
try {
|
|
7567
|
-
config = JSON.parse(
|
|
7627
|
+
config = JSON.parse(readFileSync2(configPath, "utf-8"));
|
|
7568
7628
|
} catch (error) {
|
|
7569
7629
|
config = {};
|
|
7570
7630
|
}
|
|
@@ -7582,7 +7642,7 @@ function getVersionString() {
|
|
|
7582
7642
|
}
|
|
7583
7643
|
if (geminiSubcommand === "model" && args[2] === "get") {
|
|
7584
7644
|
try {
|
|
7585
|
-
const { existsSync, readFileSync } = require("fs");
|
|
7645
|
+
const { existsSync, readFileSync: readFileSync2 } = require("fs");
|
|
7586
7646
|
const { join } = require("path");
|
|
7587
7647
|
const { homedir } = require("os");
|
|
7588
7648
|
const configPaths = [
|
|
@@ -7593,7 +7653,7 @@ function getVersionString() {
|
|
|
7593
7653
|
for (const configPath of configPaths) {
|
|
7594
7654
|
if (existsSync(configPath)) {
|
|
7595
7655
|
try {
|
|
7596
|
-
const config = JSON.parse(
|
|
7656
|
+
const config = JSON.parse(readFileSync2(configPath, "utf-8"));
|
|
7597
7657
|
model = config.model || config.GEMINI_MODEL || null;
|
|
7598
7658
|
if (model) break;
|
|
7599
7659
|
} catch (error) {
|
|
@@ -7616,9 +7676,9 @@ function getVersionString() {
|
|
|
7616
7676
|
if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
|
|
7617
7677
|
const projectId = args[3];
|
|
7618
7678
|
try {
|
|
7619
|
-
const { saveGoogleCloudProjectToConfig } = await import('./config-
|
|
7620
|
-
const { readCredentials: readCredentials2 } = await import('./persistence-
|
|
7621
|
-
const { ApiClient: ApiClient2 } = await import('./types-
|
|
7679
|
+
const { saveGoogleCloudProjectToConfig } = await import('./config-C4c3eRAq.mjs').then(function (n) { return n.e; });
|
|
7680
|
+
const { readCredentials: readCredentials2 } = await import('./persistence-DS4-Wbnm.mjs');
|
|
7681
|
+
const { ApiClient: ApiClient2 } = await import('./types-DY1-MAPO.mjs').then(function (n) { return n.k; });
|
|
7622
7682
|
let userEmail = void 0;
|
|
7623
7683
|
try {
|
|
7624
7684
|
const credentials = await readCredentials2();
|
|
@@ -7649,7 +7709,7 @@ function getVersionString() {
|
|
|
7649
7709
|
}
|
|
7650
7710
|
if (geminiSubcommand === "project" && args[2] === "get") {
|
|
7651
7711
|
try {
|
|
7652
|
-
const { readGeminiLocalConfig } = await import('./config-
|
|
7712
|
+
const { readGeminiLocalConfig } = await import('./config-C4c3eRAq.mjs').then(function (n) { return n.e; });
|
|
7653
7713
|
const config = readGeminiLocalConfig();
|
|
7654
7714
|
if (config.googleCloudProject) {
|
|
7655
7715
|
console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
|
|
@@ -7689,7 +7749,7 @@ function getVersionString() {
|
|
|
7689
7749
|
process.exit(0);
|
|
7690
7750
|
}
|
|
7691
7751
|
try {
|
|
7692
|
-
const { runGemini } = await import('./runGemini-
|
|
7752
|
+
const { runGemini } = await import('./runGemini-D1DZS8IL.mjs');
|
|
7693
7753
|
let startedBy = void 0;
|
|
7694
7754
|
for (let i = 1; i < args.length; i++) {
|
|
7695
7755
|
if (args[i] === "--started-by") {
|
|
@@ -7789,6 +7849,17 @@ function getVersionString() {
|
|
|
7789
7849
|
console.log("Daemon started successfully");
|
|
7790
7850
|
} else {
|
|
7791
7851
|
console.error("Failed to start daemon");
|
|
7852
|
+
const latest = await getLatestDaemonLog();
|
|
7853
|
+
if (latest) {
|
|
7854
|
+
console.error(`Latest daemon log: ${latest.path}`);
|
|
7855
|
+
try {
|
|
7856
|
+
const logContent = readFileSync(latest.path, "utf-8");
|
|
7857
|
+
if (logContent.includes("EADDRINUSE")) {
|
|
7858
|
+
console.error("Daemon control port is already in use. Retry after stopping the stale daemon or run `hicloud doctor clean`.");
|
|
7859
|
+
}
|
|
7860
|
+
} catch {
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7792
7863
|
process.exit(1);
|
|
7793
7864
|
}
|
|
7794
7865
|
process.exit(0);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
4
|
var os = require('node:os');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var api = require('./types-
|
|
6
|
+
var api = require('./types-DSQA_cBn.cjs');
|
|
7
7
|
var node_child_process = require('node:child_process');
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
var node_readline = require('node:readline');
|
|
@@ -21,7 +21,7 @@ require('socket.io-client');
|
|
|
21
21
|
var tweetnacl = require('tweetnacl');
|
|
22
22
|
require('expo-server-sdk');
|
|
23
23
|
var node_util = require('node:util');
|
|
24
|
-
var persistence = require('./persistence-
|
|
24
|
+
var persistence = require('./persistence-DW_z9Bsh.cjs');
|
|
25
25
|
var crypto = require('crypto');
|
|
26
26
|
var child_process = require('child_process');
|
|
27
27
|
var fs$2 = require('fs');
|
|
@@ -256,7 +256,7 @@ function claudeFindLastSession(workingDirectory) {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
const __dirname$2 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
259
|
+
const __dirname$2 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BJ0xEdNB.cjs', document.baseURI).href))));
|
|
260
260
|
function projectPath() {
|
|
261
261
|
const path$1 = path.resolve(__dirname$2, "..");
|
|
262
262
|
return path$1;
|
|
@@ -1169,7 +1169,7 @@ function getRuntime() {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
const isBun = () => getRuntime() === "bun";
|
|
1171
1171
|
|
|
1172
|
-
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
1172
|
+
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BJ0xEdNB.cjs', document.baseURI).href)));
|
|
1173
1173
|
const __dirname$1 = node_path.join(__filename$1, "..");
|
|
1174
1174
|
function getGlobalClaudeVersion() {
|
|
1175
1175
|
try {
|
|
@@ -3695,150 +3695,6 @@ function extractSDKMetadataAsync(onComplete) {
|
|
|
3695
3695
|
});
|
|
3696
3696
|
}
|
|
3697
3697
|
|
|
3698
|
-
async function daemonPost(path, body) {
|
|
3699
|
-
const state = await persistence.readDaemonState();
|
|
3700
|
-
if (!state?.httpPort) {
|
|
3701
|
-
const errorMessage = "No daemon running, no state file found";
|
|
3702
|
-
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3703
|
-
return {
|
|
3704
|
-
error: errorMessage
|
|
3705
|
-
};
|
|
3706
|
-
}
|
|
3707
|
-
try {
|
|
3708
|
-
process.kill(state.pid, 0);
|
|
3709
|
-
} catch (error) {
|
|
3710
|
-
const errorMessage = "Daemon is not running, file is stale";
|
|
3711
|
-
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3712
|
-
return {
|
|
3713
|
-
error: errorMessage
|
|
3714
|
-
};
|
|
3715
|
-
}
|
|
3716
|
-
try {
|
|
3717
|
-
const timeout = process.env.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 1e4;
|
|
3718
|
-
const response = await fetch(`http://127.0.0.1:${state.httpPort}${path}`, {
|
|
3719
|
-
method: "POST",
|
|
3720
|
-
headers: { "Content-Type": "application/json" },
|
|
3721
|
-
body: JSON.stringify(body || {}),
|
|
3722
|
-
// Mostly increased for stress test
|
|
3723
|
-
signal: AbortSignal.timeout(timeout)
|
|
3724
|
-
});
|
|
3725
|
-
if (!response.ok) {
|
|
3726
|
-
const errorMessage = `Request failed: ${path}, HTTP ${response.status}`;
|
|
3727
|
-
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3728
|
-
return {
|
|
3729
|
-
error: errorMessage
|
|
3730
|
-
};
|
|
3731
|
-
}
|
|
3732
|
-
return await response.json();
|
|
3733
|
-
} catch (error) {
|
|
3734
|
-
const errorMessage = `Request failed: ${path}, ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
3735
|
-
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3736
|
-
return {
|
|
3737
|
-
error: errorMessage
|
|
3738
|
-
};
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3741
|
-
async function notifyDaemonSessionStarted(sessionId, metadata) {
|
|
3742
|
-
return await daemonPost("/session-started", {
|
|
3743
|
-
sessionId,
|
|
3744
|
-
metadata
|
|
3745
|
-
});
|
|
3746
|
-
}
|
|
3747
|
-
async function listDaemonSessions() {
|
|
3748
|
-
const result = await daemonPost("/list");
|
|
3749
|
-
return result.children || [];
|
|
3750
|
-
}
|
|
3751
|
-
async function stopDaemonSession(sessionId) {
|
|
3752
|
-
const result = await daemonPost("/stop-session", { sessionId });
|
|
3753
|
-
return result.success || false;
|
|
3754
|
-
}
|
|
3755
|
-
async function stopDaemonHttp() {
|
|
3756
|
-
await daemonPost("/stop");
|
|
3757
|
-
}
|
|
3758
|
-
async function checkIfDaemonRunningAndCleanupStaleState() {
|
|
3759
|
-
const state = await persistence.readDaemonState();
|
|
3760
|
-
if (!state) {
|
|
3761
|
-
return false;
|
|
3762
|
-
}
|
|
3763
|
-
try {
|
|
3764
|
-
process.kill(state.pid, 0);
|
|
3765
|
-
return true;
|
|
3766
|
-
} catch {
|
|
3767
|
-
api.logger.debug("[DAEMON RUN] Daemon PID not running, cleaning up state");
|
|
3768
|
-
await cleanupDaemonState();
|
|
3769
|
-
return false;
|
|
3770
|
-
}
|
|
3771
|
-
}
|
|
3772
|
-
async function isDaemonRunningCurrentlyInstalledHappyVersion() {
|
|
3773
|
-
api.logger.debug("[DAEMON CONTROL] Checking if daemon is running same version");
|
|
3774
|
-
const runningDaemon = await checkIfDaemonRunningAndCleanupStaleState();
|
|
3775
|
-
if (!runningDaemon) {
|
|
3776
|
-
api.logger.debug("[DAEMON CONTROL] No daemon running, returning false");
|
|
3777
|
-
return false;
|
|
3778
|
-
}
|
|
3779
|
-
const state = await persistence.readDaemonState();
|
|
3780
|
-
if (!state) {
|
|
3781
|
-
api.logger.debug("[DAEMON CONTROL] No daemon state found, returning false");
|
|
3782
|
-
return false;
|
|
3783
|
-
}
|
|
3784
|
-
try {
|
|
3785
|
-
const packageJsonPath = path.join(projectPath(), "package.json");
|
|
3786
|
-
const packageJson = JSON.parse(fs$2.readFileSync(packageJsonPath, "utf-8"));
|
|
3787
|
-
const currentCliVersion = packageJson.version;
|
|
3788
|
-
api.logger.debug(`[DAEMON CONTROL] Current CLI version: ${currentCliVersion}, Daemon started with version: ${state.startedWithCliVersion}`);
|
|
3789
|
-
return currentCliVersion === state.startedWithCliVersion;
|
|
3790
|
-
} catch (error) {
|
|
3791
|
-
api.logger.debug("[DAEMON CONTROL] Error checking daemon version", error);
|
|
3792
|
-
return false;
|
|
3793
|
-
}
|
|
3794
|
-
}
|
|
3795
|
-
async function cleanupDaemonState() {
|
|
3796
|
-
try {
|
|
3797
|
-
await persistence.clearDaemonState();
|
|
3798
|
-
api.logger.debug("[DAEMON RUN] Daemon state file removed");
|
|
3799
|
-
} catch (error) {
|
|
3800
|
-
api.logger.debug("[DAEMON RUN] Error cleaning up daemon metadata", error);
|
|
3801
|
-
}
|
|
3802
|
-
}
|
|
3803
|
-
async function stopDaemon() {
|
|
3804
|
-
try {
|
|
3805
|
-
const state = await persistence.readDaemonState();
|
|
3806
|
-
if (!state) {
|
|
3807
|
-
api.logger.debug("No daemon state found");
|
|
3808
|
-
return;
|
|
3809
|
-
}
|
|
3810
|
-
api.logger.debug(`Stopping daemon with PID ${state.pid}`);
|
|
3811
|
-
try {
|
|
3812
|
-
await stopDaemonHttp();
|
|
3813
|
-
await waitForProcessDeath(state.pid, 2e3);
|
|
3814
|
-
api.logger.debug("Daemon stopped gracefully via HTTP");
|
|
3815
|
-
return;
|
|
3816
|
-
} catch (error) {
|
|
3817
|
-
api.logger.debug("HTTP stop failed, will force kill", error);
|
|
3818
|
-
}
|
|
3819
|
-
try {
|
|
3820
|
-
process.kill(state.pid, "SIGKILL");
|
|
3821
|
-
api.logger.debug("Force killed daemon");
|
|
3822
|
-
} catch (error) {
|
|
3823
|
-
api.logger.debug("Daemon already dead");
|
|
3824
|
-
}
|
|
3825
|
-
} catch (error) {
|
|
3826
|
-
api.logger.debug("Error stopping daemon", error);
|
|
3827
|
-
}
|
|
3828
|
-
}
|
|
3829
|
-
async function waitForProcessDeath(pid, timeout) {
|
|
3830
|
-
const start = Date.now();
|
|
3831
|
-
while (Date.now() - start < timeout) {
|
|
3832
|
-
try {
|
|
3833
|
-
process.kill(pid, 0);
|
|
3834
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
3835
|
-
} catch {
|
|
3836
|
-
return;
|
|
3837
|
-
}
|
|
3838
|
-
}
|
|
3839
|
-
throw new Error("Process did not die within timeout");
|
|
3840
|
-
}
|
|
3841
|
-
|
|
3842
3698
|
function getDaemonPid() {
|
|
3843
3699
|
try {
|
|
3844
3700
|
if (!fs.existsSync(api.configuration.daemonStateFile)) {
|
|
@@ -4006,6 +3862,210 @@ async function killRunawayHappyProcesses() {
|
|
|
4006
3862
|
return { killed, errors };
|
|
4007
3863
|
}
|
|
4008
3864
|
|
|
3865
|
+
async function daemonPost(path, body) {
|
|
3866
|
+
const state = await persistence.readDaemonState();
|
|
3867
|
+
if (!state?.httpPort) {
|
|
3868
|
+
const errorMessage = "No daemon running, no state file found";
|
|
3869
|
+
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3870
|
+
return {
|
|
3871
|
+
error: errorMessage
|
|
3872
|
+
};
|
|
3873
|
+
}
|
|
3874
|
+
try {
|
|
3875
|
+
process.kill(state.pid, 0);
|
|
3876
|
+
} catch (error) {
|
|
3877
|
+
const errorMessage = "Daemon is not running, file is stale";
|
|
3878
|
+
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3879
|
+
return {
|
|
3880
|
+
error: errorMessage
|
|
3881
|
+
};
|
|
3882
|
+
}
|
|
3883
|
+
try {
|
|
3884
|
+
const timeout = process.env.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 1e4;
|
|
3885
|
+
const response = await fetch(`http://127.0.0.1:${state.httpPort}${path}`, {
|
|
3886
|
+
method: "POST",
|
|
3887
|
+
headers: { "Content-Type": "application/json" },
|
|
3888
|
+
body: JSON.stringify(body || {}),
|
|
3889
|
+
// Mostly increased for stress test
|
|
3890
|
+
signal: AbortSignal.timeout(timeout)
|
|
3891
|
+
});
|
|
3892
|
+
if (!response.ok) {
|
|
3893
|
+
const errorMessage = `Request failed: ${path}, HTTP ${response.status}`;
|
|
3894
|
+
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3895
|
+
return {
|
|
3896
|
+
error: errorMessage
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3899
|
+
return await response.json();
|
|
3900
|
+
} catch (error) {
|
|
3901
|
+
const errorMessage = `Request failed: ${path}, ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
3902
|
+
api.logger.debug(`[CONTROL CLIENT] ${errorMessage}`);
|
|
3903
|
+
return {
|
|
3904
|
+
error: errorMessage
|
|
3905
|
+
};
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3908
|
+
async function stopDaemonOnKnownPort() {
|
|
3909
|
+
try {
|
|
3910
|
+
const timeout = process.env.HAPPY_DAEMON_HTTP_TIMEOUT ? parseInt(process.env.HAPPY_DAEMON_HTTP_TIMEOUT) : 2e3;
|
|
3911
|
+
const response = await fetch(`http://127.0.0.1:${api.HAPPY_CLOUD_DAEMON_PORT}/stop`, {
|
|
3912
|
+
method: "POST",
|
|
3913
|
+
headers: { "Content-Type": "application/json" },
|
|
3914
|
+
body: JSON.stringify({}),
|
|
3915
|
+
signal: AbortSignal.timeout(timeout)
|
|
3916
|
+
});
|
|
3917
|
+
if (!response.ok) {
|
|
3918
|
+
api.logger.debug(`[CONTROL CLIENT] Known daemon port stop failed with HTTP ${response.status}`);
|
|
3919
|
+
return false;
|
|
3920
|
+
}
|
|
3921
|
+
return true;
|
|
3922
|
+
} catch (error) {
|
|
3923
|
+
api.logger.debug("[CONTROL CLIENT] No reachable daemon on known control port", error);
|
|
3924
|
+
return false;
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
async function killOrphanDaemonProcesses() {
|
|
3928
|
+
const daemonTypes = /* @__PURE__ */ new Set([
|
|
3929
|
+
"daemon",
|
|
3930
|
+
"dev-daemon",
|
|
3931
|
+
"daemon-version-check",
|
|
3932
|
+
"dev-daemon-version-check"
|
|
3933
|
+
]);
|
|
3934
|
+
const orphanDaemons = (await findAllHappyProcesses()).filter(
|
|
3935
|
+
(proc) => proc.pid !== process.pid && daemonTypes.has(proc.type)
|
|
3936
|
+
);
|
|
3937
|
+
if (orphanDaemons.length === 0) {
|
|
3938
|
+
api.logger.debug("[CONTROL CLIENT] No orphan daemon processes found");
|
|
3939
|
+
return false;
|
|
3940
|
+
}
|
|
3941
|
+
let killed = false;
|
|
3942
|
+
for (const proc of orphanDaemons) {
|
|
3943
|
+
try {
|
|
3944
|
+
if (process.platform === "win32") {
|
|
3945
|
+
node_child_process.execFileSync("taskkill", ["/F", "/PID", proc.pid.toString()], { stdio: "ignore" });
|
|
3946
|
+
} else {
|
|
3947
|
+
process.kill(proc.pid, "SIGKILL");
|
|
3948
|
+
}
|
|
3949
|
+
api.logger.debug(`[CONTROL CLIENT] Killed orphan daemon PID ${proc.pid}: ${proc.command}`);
|
|
3950
|
+
killed = true;
|
|
3951
|
+
} catch (error) {
|
|
3952
|
+
api.logger.debug(`[CONTROL CLIENT] Failed to kill orphan daemon PID ${proc.pid}`, error);
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
return killed;
|
|
3956
|
+
}
|
|
3957
|
+
async function notifyDaemonSessionStarted(sessionId, metadata) {
|
|
3958
|
+
return await daemonPost("/session-started", {
|
|
3959
|
+
sessionId,
|
|
3960
|
+
metadata
|
|
3961
|
+
});
|
|
3962
|
+
}
|
|
3963
|
+
async function listDaemonSessions() {
|
|
3964
|
+
const result = await daemonPost("/list");
|
|
3965
|
+
return result.children || [];
|
|
3966
|
+
}
|
|
3967
|
+
async function stopDaemonSession(sessionId) {
|
|
3968
|
+
const result = await daemonPost("/stop-session", { sessionId });
|
|
3969
|
+
return result.success || false;
|
|
3970
|
+
}
|
|
3971
|
+
async function stopDaemonHttp() {
|
|
3972
|
+
await daemonPost("/stop");
|
|
3973
|
+
}
|
|
3974
|
+
async function checkIfDaemonRunningAndCleanupStaleState() {
|
|
3975
|
+
const state = await persistence.readDaemonState();
|
|
3976
|
+
if (!state) {
|
|
3977
|
+
return false;
|
|
3978
|
+
}
|
|
3979
|
+
try {
|
|
3980
|
+
process.kill(state.pid, 0);
|
|
3981
|
+
return true;
|
|
3982
|
+
} catch {
|
|
3983
|
+
api.logger.debug("[DAEMON RUN] Daemon PID not running, cleaning up state");
|
|
3984
|
+
await cleanupDaemonState();
|
|
3985
|
+
return false;
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
async function isDaemonRunningCurrentlyInstalledHappyVersion() {
|
|
3989
|
+
api.logger.debug("[DAEMON CONTROL] Checking if daemon is running same version");
|
|
3990
|
+
const runningDaemon = await checkIfDaemonRunningAndCleanupStaleState();
|
|
3991
|
+
if (!runningDaemon) {
|
|
3992
|
+
api.logger.debug("[DAEMON CONTROL] No daemon running, returning false");
|
|
3993
|
+
return false;
|
|
3994
|
+
}
|
|
3995
|
+
const state = await persistence.readDaemonState();
|
|
3996
|
+
if (!state) {
|
|
3997
|
+
api.logger.debug("[DAEMON CONTROL] No daemon state found, returning false");
|
|
3998
|
+
return false;
|
|
3999
|
+
}
|
|
4000
|
+
try {
|
|
4001
|
+
const packageJsonPath = path.join(projectPath(), "package.json");
|
|
4002
|
+
const packageJson = JSON.parse(fs$2.readFileSync(packageJsonPath, "utf-8"));
|
|
4003
|
+
const currentCliVersion = packageJson.version;
|
|
4004
|
+
api.logger.debug(`[DAEMON CONTROL] Current CLI version: ${currentCliVersion}, Daemon started with version: ${state.startedWithCliVersion}`);
|
|
4005
|
+
return currentCliVersion === state.startedWithCliVersion;
|
|
4006
|
+
} catch (error) {
|
|
4007
|
+
api.logger.debug("[DAEMON CONTROL] Error checking daemon version", error);
|
|
4008
|
+
return false;
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
async function cleanupDaemonState() {
|
|
4012
|
+
try {
|
|
4013
|
+
await persistence.clearDaemonState();
|
|
4014
|
+
api.logger.debug("[DAEMON RUN] Daemon state file removed");
|
|
4015
|
+
} catch (error) {
|
|
4016
|
+
api.logger.debug("[DAEMON RUN] Error cleaning up daemon metadata", error);
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
async function stopDaemon() {
|
|
4020
|
+
try {
|
|
4021
|
+
const state = await persistence.readDaemonState();
|
|
4022
|
+
if (!state) {
|
|
4023
|
+
api.logger.debug("No daemon state found, trying known control port");
|
|
4024
|
+
const stoppedByKnownPort = await stopDaemonOnKnownPort();
|
|
4025
|
+
if (stoppedByKnownPort) {
|
|
4026
|
+
api.logger.debug(`Requested daemon stop via known control port ${api.HAPPY_CLOUD_DAEMON_PORT}`);
|
|
4027
|
+
return;
|
|
4028
|
+
}
|
|
4029
|
+
const killedOrphans = await killOrphanDaemonProcesses();
|
|
4030
|
+
if (killedOrphans) {
|
|
4031
|
+
api.logger.debug("Killed orphan daemon processes without state file");
|
|
4032
|
+
return;
|
|
4033
|
+
}
|
|
4034
|
+
api.logger.debug("No daemon state found");
|
|
4035
|
+
return;
|
|
4036
|
+
}
|
|
4037
|
+
api.logger.debug(`Stopping daemon with PID ${state.pid}`);
|
|
4038
|
+
try {
|
|
4039
|
+
await stopDaemonHttp();
|
|
4040
|
+
await waitForProcessDeath(state.pid, 2e3);
|
|
4041
|
+
api.logger.debug("Daemon stopped gracefully via HTTP");
|
|
4042
|
+
return;
|
|
4043
|
+
} catch (error) {
|
|
4044
|
+
api.logger.debug("HTTP stop failed, will force kill", error);
|
|
4045
|
+
}
|
|
4046
|
+
try {
|
|
4047
|
+
process.kill(state.pid, "SIGKILL");
|
|
4048
|
+
api.logger.debug("Force killed daemon");
|
|
4049
|
+
} catch (error) {
|
|
4050
|
+
api.logger.debug("Daemon already dead");
|
|
4051
|
+
}
|
|
4052
|
+
} catch (error) {
|
|
4053
|
+
api.logger.debug("Error stopping daemon", error);
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
async function waitForProcessDeath(pid, timeout) {
|
|
4057
|
+
const start = Date.now();
|
|
4058
|
+
while (Date.now() - start < timeout) {
|
|
4059
|
+
try {
|
|
4060
|
+
process.kill(pid, 0);
|
|
4061
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
4062
|
+
} catch {
|
|
4063
|
+
return;
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
throw new Error("Process did not die within timeout");
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4009
4069
|
function getEnvironmentInfo() {
|
|
4010
4070
|
return {
|
|
4011
4071
|
PWD: process.env.PWD,
|
|
@@ -4214,7 +4274,7 @@ async function openBrowser(url) {
|
|
|
4214
4274
|
}
|
|
4215
4275
|
}
|
|
4216
4276
|
|
|
4217
|
-
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-
|
|
4277
|
+
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-BJ0xEdNB.cjs', document.baseURI).href)));
|
|
4218
4278
|
const QRCode = require$1("qrcode-terminal/vendor/QRCode");
|
|
4219
4279
|
const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
|
|
4220
4280
|
const pendingTempFiles = /* @__PURE__ */ new Set();
|
|
@@ -7545,7 +7605,7 @@ function getVersionString() {
|
|
|
7545
7605
|
return;
|
|
7546
7606
|
} else if (subcommand === "codex") {
|
|
7547
7607
|
try {
|
|
7548
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
7608
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BCgor8vK.cjs'); });
|
|
7549
7609
|
let startedBy = void 0;
|
|
7550
7610
|
for (let i = 1; i < args.length; i++) {
|
|
7551
7611
|
if (args[i] === "--started-by") {
|
|
@@ -7575,7 +7635,7 @@ function getVersionString() {
|
|
|
7575
7635
|
process.exit(1);
|
|
7576
7636
|
}
|
|
7577
7637
|
try {
|
|
7578
|
-
const { existsSync, readFileSync, writeFileSync, mkdirSync } = require("fs");
|
|
7638
|
+
const { existsSync, readFileSync: readFileSync2, writeFileSync, mkdirSync } = require("fs");
|
|
7579
7639
|
const { join } = require("path");
|
|
7580
7640
|
const { homedir } = require("os");
|
|
7581
7641
|
const configDir = join(homedir(), ".gemini");
|
|
@@ -7586,7 +7646,7 @@ function getVersionString() {
|
|
|
7586
7646
|
let config = {};
|
|
7587
7647
|
if (existsSync(configPath)) {
|
|
7588
7648
|
try {
|
|
7589
|
-
config = JSON.parse(
|
|
7649
|
+
config = JSON.parse(readFileSync2(configPath, "utf-8"));
|
|
7590
7650
|
} catch (error) {
|
|
7591
7651
|
config = {};
|
|
7592
7652
|
}
|
|
@@ -7604,7 +7664,7 @@ function getVersionString() {
|
|
|
7604
7664
|
}
|
|
7605
7665
|
if (geminiSubcommand === "model" && args[2] === "get") {
|
|
7606
7666
|
try {
|
|
7607
|
-
const { existsSync, readFileSync } = require("fs");
|
|
7667
|
+
const { existsSync, readFileSync: readFileSync2 } = require("fs");
|
|
7608
7668
|
const { join } = require("path");
|
|
7609
7669
|
const { homedir } = require("os");
|
|
7610
7670
|
const configPaths = [
|
|
@@ -7615,7 +7675,7 @@ function getVersionString() {
|
|
|
7615
7675
|
for (const configPath of configPaths) {
|
|
7616
7676
|
if (existsSync(configPath)) {
|
|
7617
7677
|
try {
|
|
7618
|
-
const config = JSON.parse(
|
|
7678
|
+
const config = JSON.parse(readFileSync2(configPath, "utf-8"));
|
|
7619
7679
|
model = config.model || config.GEMINI_MODEL || null;
|
|
7620
7680
|
if (model) break;
|
|
7621
7681
|
} catch (error) {
|
|
@@ -7638,9 +7698,9 @@ function getVersionString() {
|
|
|
7638
7698
|
if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
|
|
7639
7699
|
const projectId = args[3];
|
|
7640
7700
|
try {
|
|
7641
|
-
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-
|
|
7642
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
7643
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-
|
|
7701
|
+
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-DSI9r8Jl.cjs'); }).then(function (n) { return n.config; });
|
|
7702
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-DW_z9Bsh.cjs'); });
|
|
7703
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-DSQA_cBn.cjs'); }).then(function (n) { return n.api; });
|
|
7644
7704
|
let userEmail = void 0;
|
|
7645
7705
|
try {
|
|
7646
7706
|
const credentials = await readCredentials2();
|
|
@@ -7671,7 +7731,7 @@ function getVersionString() {
|
|
|
7671
7731
|
}
|
|
7672
7732
|
if (geminiSubcommand === "project" && args[2] === "get") {
|
|
7673
7733
|
try {
|
|
7674
|
-
const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-
|
|
7734
|
+
const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-DSI9r8Jl.cjs'); }).then(function (n) { return n.config; });
|
|
7675
7735
|
const config = readGeminiLocalConfig();
|
|
7676
7736
|
if (config.googleCloudProject) {
|
|
7677
7737
|
console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
|
|
@@ -7711,7 +7771,7 @@ function getVersionString() {
|
|
|
7711
7771
|
process.exit(0);
|
|
7712
7772
|
}
|
|
7713
7773
|
try {
|
|
7714
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
7774
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-81Ogay0E.cjs'); });
|
|
7715
7775
|
let startedBy = void 0;
|
|
7716
7776
|
for (let i = 1; i < args.length; i++) {
|
|
7717
7777
|
if (args[i] === "--started-by") {
|
|
@@ -7811,6 +7871,17 @@ function getVersionString() {
|
|
|
7811
7871
|
console.log("Daemon started successfully");
|
|
7812
7872
|
} else {
|
|
7813
7873
|
console.error("Failed to start daemon");
|
|
7874
|
+
const latest = await api.getLatestDaemonLog();
|
|
7875
|
+
if (latest) {
|
|
7876
|
+
console.error(`Latest daemon log: ${latest.path}`);
|
|
7877
|
+
try {
|
|
7878
|
+
const logContent = fs.readFileSync(latest.path, "utf-8");
|
|
7879
|
+
if (logContent.includes("EADDRINUSE")) {
|
|
7880
|
+
console.error("Daemon control port is already in use. Retry after stopping the stale daemon or run `hicloud doctor clean`.");
|
|
7881
|
+
}
|
|
7882
|
+
} catch {
|
|
7883
|
+
}
|
|
7884
|
+
}
|
|
7814
7885
|
process.exit(1);
|
|
7815
7886
|
}
|
|
7816
7887
|
process.exit(0);
|
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('chalk');
|
|
4
|
-
require('./index-
|
|
5
|
-
require('./types-
|
|
6
|
-
require('./persistence-
|
|
4
|
+
require('./index-BJ0xEdNB.cjs');
|
|
5
|
+
require('./types-DSQA_cBn.cjs');
|
|
6
|
+
require('./persistence-DW_z9Bsh.cjs');
|
|
7
7
|
require('zod');
|
|
8
8
|
require('node:child_process');
|
|
9
|
+
require('node:fs');
|
|
9
10
|
require('node:os');
|
|
10
11
|
require('node:crypto');
|
|
11
12
|
require('node:path');
|
|
12
13
|
require('node:readline');
|
|
13
|
-
require('node:fs');
|
|
14
14
|
require('path');
|
|
15
15
|
require('url');
|
|
16
16
|
require('node:fs/promises');
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import 'chalk';
|
|
2
|
-
import './index-
|
|
3
|
-
import './types-
|
|
4
|
-
import './persistence-
|
|
2
|
+
import './index-B3bkHdEU.mjs';
|
|
3
|
+
import './types-DY1-MAPO.mjs';
|
|
4
|
+
import './persistence-DS4-Wbnm.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'node:child_process';
|
|
7
|
+
import 'node:fs';
|
|
7
8
|
import 'node:os';
|
|
8
9
|
import 'node:crypto';
|
|
9
10
|
import 'node:path';
|
|
10
11
|
import 'node:readline';
|
|
11
|
-
import 'node:fs';
|
|
12
12
|
import 'path';
|
|
13
13
|
import 'url';
|
|
14
14
|
import 'node:fs/promises';
|
package/dist/lib.cjs
CHANGED
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-DY1-MAPO.mjs';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import 'chalk';
|
|
4
4
|
import 'fs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile, open, stat, unlink, mkdir, writeFile, rename } from 'node:fs/promises';
|
|
2
2
|
import { existsSync, constants, unlinkSync, writeFileSync, readdirSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
|
-
import { c as configuration, l as logger, e as encodeBase64 } from './types-
|
|
4
|
+
import { c as configuration, l as logger, e as encodeBase64 } from './types-DY1-MAPO.mjs';
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import 'chalk';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var promises = require('node:fs/promises');
|
|
4
4
|
var fs = require('node:fs');
|
|
5
5
|
var node_path = require('node:path');
|
|
6
|
-
var api = require('./types-
|
|
6
|
+
var api = require('./types-DSQA_cBn.cjs');
|
|
7
7
|
var z = require('zod');
|
|
8
8
|
require('axios');
|
|
9
9
|
require('chalk');
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var api = require('./types-
|
|
6
|
-
var setupOfflineReconnection = require('./setupOfflineReconnection-
|
|
5
|
+
var api = require('./types-DSQA_cBn.cjs');
|
|
6
|
+
var setupOfflineReconnection = require('./setupOfflineReconnection-D2mAyajw.cjs');
|
|
7
7
|
var node_crypto = require('node:crypto');
|
|
8
|
-
var persistence = require('./persistence-
|
|
9
|
-
var index = require('./index-
|
|
8
|
+
var persistence = require('./persistence-DW_z9Bsh.cjs');
|
|
9
|
+
var index = require('./index-BJ0xEdNB.cjs');
|
|
10
10
|
var os = require('node:os');
|
|
11
11
|
var node_path = require('node:path');
|
|
12
12
|
var fs = require('node:fs');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
-
import { l as logger, b as connectionState, A as ApiClient } from './types-
|
|
4
|
-
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './setupOfflineReconnection-
|
|
3
|
+
import { l as logger, b as connectionState, A as ApiClient } from './types-DY1-MAPO.mjs';
|
|
4
|
+
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './setupOfflineReconnection-B15b9tE7.mjs';
|
|
5
5
|
import { randomUUID } from 'node:crypto';
|
|
6
|
-
import { readSettings } from './persistence-
|
|
7
|
-
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler, a as MessageBuffer, s as stopCaffeinate } from './index-
|
|
6
|
+
import { readSettings } from './persistence-DS4-Wbnm.mjs';
|
|
7
|
+
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler, a as MessageBuffer, s as stopCaffeinate } from './index-B3bkHdEU.mjs';
|
|
8
8
|
import os from 'node:os';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import fs from 'node:fs';
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var api = require('./types-
|
|
7
|
-
var persistence = require('./persistence-
|
|
8
|
-
var setupOfflineReconnection = require('./setupOfflineReconnection-
|
|
9
|
-
var index = require('./index-
|
|
6
|
+
var api = require('./types-DSQA_cBn.cjs');
|
|
7
|
+
var persistence = require('./persistence-DW_z9Bsh.cjs');
|
|
8
|
+
var setupOfflineReconnection = require('./setupOfflineReconnection-D2mAyajw.cjs');
|
|
9
|
+
var index = require('./index-BJ0xEdNB.cjs');
|
|
10
10
|
var node_child_process = require('node:child_process');
|
|
11
11
|
var sdk = require('@agentclientprotocol/sdk');
|
|
12
|
-
var config = require('./config-
|
|
12
|
+
var config = require('./config-DSI9r8Jl.cjs');
|
|
13
13
|
require('axios');
|
|
14
14
|
require('chalk');
|
|
15
15
|
require('fs');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { l as logger, p as packageJson, d as delay, b as connectionState, A as ApiClient } from './types-
|
|
5
|
-
import { readSettings } from './persistence-
|
|
6
|
-
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './setupOfflineReconnection-
|
|
7
|
-
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, s as stopCaffeinate } from './index-
|
|
4
|
+
import { l as logger, p as packageJson, d as delay, b as connectionState, A as ApiClient } from './types-DY1-MAPO.mjs';
|
|
5
|
+
import { readSettings } from './persistence-DS4-Wbnm.mjs';
|
|
6
|
+
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './setupOfflineReconnection-B15b9tE7.mjs';
|
|
7
|
+
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, s as stopCaffeinate } from './index-B3bkHdEU.mjs';
|
|
8
8
|
import { spawn } from 'node:child_process';
|
|
9
9
|
import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
|
|
10
|
-
import { r as readGeminiLocalConfig, G as GEMINI_API_KEY_ENV, a as GOOGLE_API_KEY_ENV, d as determineGeminiModel, g as getGeminiModelSource, b as GEMINI_MODEL_ENV, c as getInitialGeminiModel, s as saveGeminiModelToConfig } from './config-
|
|
10
|
+
import { r as readGeminiLocalConfig, G as GEMINI_API_KEY_ENV, a as GOOGLE_API_KEY_ENV, d as determineGeminiModel, g as getGeminiModelSource, b as GEMINI_MODEL_ENV, c as getInitialGeminiModel, s as saveGeminiModelToConfig } from './config-C4c3eRAq.mjs';
|
|
11
11
|
import 'axios';
|
|
12
12
|
import 'chalk';
|
|
13
13
|
import 'fs';
|
package/dist/{setupOfflineReconnection-D40K8dgt.mjs → setupOfflineReconnection-B15b9tE7.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { l as logger, c as configuration, p as packageJson, s as startOfflineReconnection } from './types-
|
|
1
|
+
import { l as logger, c as configuration, p as packageJson, s as startOfflineReconnection } from './types-DY1-MAPO.mjs';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
|
-
import { p as projectPath } from './index-
|
|
5
|
+
import { p as projectPath } from './index-B3bkHdEU.mjs';
|
|
6
6
|
|
|
7
7
|
class BasePermissionHandler {
|
|
8
8
|
pendingRequests = /* @__PURE__ */ new Map();
|
package/dist/{setupOfflineReconnection-BFYzP7HT.cjs → setupOfflineReconnection-D2mAyajw.cjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var api = require('./types-
|
|
3
|
+
var api = require('./types-DSQA_cBn.cjs');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var os = require('node:os');
|
|
6
6
|
var node_path = require('node:path');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-BJ0xEdNB.cjs');
|
|
8
8
|
|
|
9
9
|
class BasePermissionHandler {
|
|
10
10
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
@@ -19,7 +19,7 @@ var path = require('path');
|
|
|
19
19
|
var expoServerSdk = require('expo-server-sdk');
|
|
20
20
|
|
|
21
21
|
var name = "happy-imou-cloud";
|
|
22
|
-
var version = "1.1.
|
|
22
|
+
var version = "1.1.6";
|
|
23
23
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
24
24
|
var author = "long.zhu";
|
|
25
25
|
var license = "MIT";
|
|
@@ -432,7 +432,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
432
432
|
return { file, path: fullPath, modified: stats.mtime };
|
|
433
433
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
434
434
|
try {
|
|
435
|
-
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-
|
|
435
|
+
const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-DW_z9Bsh.cjs'); });
|
|
436
436
|
const state = await readDaemonState();
|
|
437
437
|
if (!state) {
|
|
438
438
|
return logs;
|
|
@@ -17,7 +17,7 @@ import { resolve, join as join$1 } from 'path';
|
|
|
17
17
|
import { Expo } from 'expo-server-sdk';
|
|
18
18
|
|
|
19
19
|
var name = "happy-imou-cloud";
|
|
20
|
-
var version = "1.1.
|
|
20
|
+
var version = "1.1.6";
|
|
21
21
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
22
22
|
var author = "long.zhu";
|
|
23
23
|
var license = "MIT";
|
|
@@ -430,7 +430,7 @@ async function listDaemonLogFiles(limit = 50) {
|
|
|
430
430
|
return { file, path: fullPath, modified: stats.mtime };
|
|
431
431
|
}).sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
432
432
|
try {
|
|
433
|
-
const { readDaemonState } = await import('./persistence-
|
|
433
|
+
const { readDaemonState } = await import('./persistence-DS4-Wbnm.mjs');
|
|
434
434
|
const state = await readDaemonState();
|
|
435
435
|
if (!state) {
|
|
436
436
|
return logs;
|