happy-imou-cloud 2.0.2 → 2.0.4
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-B6tJ_eL5.cjs → BaseReasoningProcessor-DEEfNi5Y.cjs} +4 -4
- package/dist/{BaseReasoningProcessor-D8VhEbs2.mjs → BaseReasoningProcessor-Di1yEMMv.mjs} +2 -2
- package/dist/{api-MYhAGPLn.mjs → api-CIHTNilH.mjs} +2 -2
- package/dist/{api-D2Njw9Im.cjs → api-CyJG1mr6.cjs} +43 -43
- package/dist/{command-nmK6O-ab.mjs → command-BERqmFB0.mjs} +3 -3
- package/dist/{command-CVldr51S.cjs → command-CPlJKXDn.cjs} +3 -3
- package/dist/{index-Bg-YziG2.cjs → index-1zlH6s7a.cjs} +313 -118
- package/dist/{index-B97L7qLD.mjs → index-vNYxNqVZ.mjs} +226 -31
- 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-D_2GkJAO.cjs → persistence-BeFVx6kI.cjs} +28 -28
- package/dist/{persistence-Dkm7rm8k.mjs → persistence-sLEqV8vk.mjs} +1 -1
- package/dist/{registerKillSessionHandler-BAXmJQRt.cjs → registerKillSessionHandler-CCxqGFjZ.cjs} +2 -2
- package/dist/{registerKillSessionHandler-5GbrO0FM.mjs → registerKillSessionHandler-uVHqIC4h.mjs} +2 -2
- package/dist/{runClaude-Cii3R2Fv.mjs → runClaude-Dl9nIRIg.mjs} +25 -5
- package/dist/{runClaude-B-GNEkKg.cjs → runClaude-Dz-PCSvb.cjs} +53 -33
- package/dist/{runCodex-CPHyGwj9.cjs → runCodex-BtZplK1R.cjs} +275 -408
- package/dist/{runCodex-C--ZwAhl.mjs → runCodex-DgKKw3IU.mjs} +273 -409
- package/dist/{runGemini-CQp7Nuzn.mjs → runGemini-CM1v3I24.mjs} +10 -8
- package/dist/{runGemini-DaDz1bzQ.cjs → runGemini-DUyH311Z.cjs} +10 -8
- package/package.json +1 -1
- package/dist/future-Dq4Ha1Dn.cjs +0 -24
- package/dist/future-xRdLl3vf.mjs +0 -22
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var os = require('node:os');
|
|
4
|
-
var
|
|
5
|
-
var api = require('./api-
|
|
6
|
-
var index = require('./index-
|
|
4
|
+
var node_path = require('node:path');
|
|
5
|
+
var api = require('./api-CyJG1mr6.cjs');
|
|
6
|
+
var index = require('./index-1zlH6s7a.cjs');
|
|
7
7
|
var node_events = require('node:events');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
9
9
|
|
|
@@ -20,7 +20,7 @@ function createSessionMetadata(opts) {
|
|
|
20
20
|
homeDir: os.homedir(),
|
|
21
21
|
happyHomeDir: api.configuration.happyCloudHomeDir,
|
|
22
22
|
happyLibDir: index.projectPath(),
|
|
23
|
-
happyToolsDir:
|
|
23
|
+
happyToolsDir: node_path.resolve(index.projectPath(), "tools", "unpacked"),
|
|
24
24
|
startedFromDaemon: opts.startedBy === "daemon",
|
|
25
25
|
hostPid: process.pid,
|
|
26
26
|
startedBy: opts.startedBy || "terminal",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-
|
|
4
|
-
import { p as projectPath } from './index-
|
|
3
|
+
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-CIHTNilH.mjs';
|
|
4
|
+
import { p as projectPath } from './index-vNYxNqVZ.mjs';
|
|
5
5
|
import { EventEmitter } from 'node:events';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
7
|
|
|
@@ -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 = "2.0.
|
|
20
|
+
var version = "2.0.4";
|
|
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-sLEqV8vk.mjs');
|
|
434
434
|
const state = await readDaemonState();
|
|
435
435
|
if (!state) {
|
|
436
436
|
return logs;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
4
|
var chalk = require('chalk');
|
|
5
|
-
var fs
|
|
6
|
-
var
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var node_fs = require('node:fs');
|
|
7
7
|
var os = require('node:os');
|
|
8
|
-
var
|
|
8
|
+
var node_path = require('node:path');
|
|
9
9
|
var node_events = require('node:events');
|
|
10
10
|
var socket_ioClient = require('socket.io-client');
|
|
11
11
|
var z = require('zod');
|
|
@@ -13,13 +13,13 @@ var node_crypto = require('node:crypto');
|
|
|
13
13
|
var tweetnacl = require('tweetnacl');
|
|
14
14
|
var child_process = require('child_process');
|
|
15
15
|
var util = require('util');
|
|
16
|
-
var fs$
|
|
16
|
+
var fs$1 = require('fs/promises');
|
|
17
17
|
var crypto = require('crypto');
|
|
18
|
-
var path
|
|
18
|
+
var path = require('path');
|
|
19
19
|
var expoServerSdk = require('expo-server-sdk');
|
|
20
20
|
|
|
21
21
|
var name = "happy-imou-cloud";
|
|
22
|
-
var version = "2.0.
|
|
22
|
+
var version = "2.0.4";
|
|
23
23
|
var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
|
|
24
24
|
var author = "long.zhu";
|
|
25
25
|
var license = "MIT";
|
|
@@ -217,7 +217,7 @@ class Configuration {
|
|
|
217
217
|
const expandedPath = process.env.HAPPY_CLOUD_HOME_DIR.replace(/^~/, os.homedir());
|
|
218
218
|
this.happyCloudHomeDir = expandedPath;
|
|
219
219
|
} else {
|
|
220
|
-
this.happyCloudHomeDir =
|
|
220
|
+
this.happyCloudHomeDir = node_path.join(os.homedir(), ".happy-cloud");
|
|
221
221
|
}
|
|
222
222
|
this.happyHomeDir = this.happyCloudHomeDir;
|
|
223
223
|
} else {
|
|
@@ -225,15 +225,15 @@ class Configuration {
|
|
|
225
225
|
const expandedPath = process.env.HAPPY_HOME_DIR.replace(/^~/, os.homedir());
|
|
226
226
|
this.happyHomeDir = expandedPath;
|
|
227
227
|
} else {
|
|
228
|
-
this.happyHomeDir =
|
|
228
|
+
this.happyHomeDir = node_path.join(os.homedir(), ".happy");
|
|
229
229
|
}
|
|
230
230
|
this.happyCloudHomeDir = this.happyHomeDir;
|
|
231
231
|
}
|
|
232
|
-
this.logsDir =
|
|
233
|
-
this.settingsFile =
|
|
234
|
-
this.privateKeyFile =
|
|
235
|
-
this.daemonStateFile =
|
|
236
|
-
this.daemonLockFile =
|
|
232
|
+
this.logsDir = node_path.join(this.isHappyCloudMode ? this.happyCloudHomeDir : this.happyHomeDir, "logs");
|
|
233
|
+
this.settingsFile = node_path.join(this.isHappyCloudMode ? this.happyCloudHomeDir : this.happyHomeDir, "settings.json");
|
|
234
|
+
this.privateKeyFile = node_path.join(this.isHappyCloudMode ? this.happyCloudHomeDir : this.happyHomeDir, "access.key");
|
|
235
|
+
this.daemonStateFile = node_path.join(this.isHappyCloudMode ? this.happyCloudHomeDir : this.happyHomeDir, "daemon.state.json");
|
|
236
|
+
this.daemonLockFile = node_path.join(this.isHappyCloudMode ? this.happyCloudHomeDir : this.happyHomeDir, "daemon.state.json.lock");
|
|
237
237
|
this.isExperimentalEnabled = ["true", "1", "yes"].includes(process.env.HAPPY_EXPERIMENTAL?.toLowerCase() || "");
|
|
238
238
|
this.disableCaffeinate = ["true", "1", "yes"].includes(process.env.HAPPY_DISABLE_CAFFEINATE?.toLowerCase() || "");
|
|
239
239
|
this.currentCliVersion = packageJson.version;
|
|
@@ -251,11 +251,11 @@ class Configuration {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
const homeDir = this.isHappyCloudMode ? this.happyCloudHomeDir : this.happyHomeDir;
|
|
254
|
-
if (!
|
|
255
|
-
|
|
254
|
+
if (!node_fs.existsSync(homeDir)) {
|
|
255
|
+
node_fs.mkdirSync(homeDir, { recursive: true });
|
|
256
256
|
}
|
|
257
|
-
if (!
|
|
258
|
-
|
|
257
|
+
if (!node_fs.existsSync(this.logsDir)) {
|
|
258
|
+
node_fs.mkdirSync(this.logsDir, { recursive: true });
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
}
|
|
@@ -285,7 +285,7 @@ function createTimestampForLogEntry(date = /* @__PURE__ */ new Date()) {
|
|
|
285
285
|
function getSessionLogPath() {
|
|
286
286
|
const timestamp = createTimestampForFilename();
|
|
287
287
|
const filename = configuration.isDaemonProcess ? `${timestamp}-daemon.log` : `${timestamp}.log`;
|
|
288
|
-
return
|
|
288
|
+
return node_path.join(configuration.logsDir, filename);
|
|
289
289
|
}
|
|
290
290
|
class Logger {
|
|
291
291
|
constructor(logFilePath = getSessionLogPath()) {
|
|
@@ -410,7 +410,7 @@ class Logger {
|
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
try {
|
|
413
|
-
fs
|
|
413
|
+
fs.appendFileSync(this.logFilePath, logLine);
|
|
414
414
|
} catch (appendError) {
|
|
415
415
|
if (process.env.DEBUG) {
|
|
416
416
|
console.error("[DEV MODE ONLY THROWING] Failed to append to log file:", appendError);
|
|
@@ -423,24 +423,24 @@ let logger = new Logger();
|
|
|
423
423
|
async function listDaemonLogFiles(limit = 50) {
|
|
424
424
|
try {
|
|
425
425
|
const logsDir = configuration.logsDir;
|
|
426
|
-
if (!
|
|
426
|
+
if (!node_fs.existsSync(logsDir)) {
|
|
427
427
|
return [];
|
|
428
428
|
}
|
|
429
|
-
const logs =
|
|
430
|
-
const fullPath =
|
|
431
|
-
const stats =
|
|
429
|
+
const logs = node_fs.readdirSync(logsDir).filter((file) => file.endsWith("-daemon.log")).map((file) => {
|
|
430
|
+
const fullPath = node_path.join(logsDir, file);
|
|
431
|
+
const stats = node_fs.statSync(fullPath);
|
|
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-BeFVx6kI.cjs'); });
|
|
436
436
|
const state = await readDaemonState();
|
|
437
437
|
if (!state) {
|
|
438
438
|
return logs;
|
|
439
439
|
}
|
|
440
|
-
if (state.daemonLogPath &&
|
|
441
|
-
const stats =
|
|
440
|
+
if (state.daemonLogPath && node_fs.existsSync(state.daemonLogPath)) {
|
|
441
|
+
const stats = node_fs.statSync(state.daemonLogPath);
|
|
442
442
|
const persisted = {
|
|
443
|
-
file:
|
|
443
|
+
file: node_path.basename(state.daemonLogPath),
|
|
444
444
|
path: state.daemonLogPath,
|
|
445
445
|
modified: stats.mtime
|
|
446
446
|
};
|
|
@@ -853,8 +853,8 @@ class RpcHandlerManager {
|
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
function validatePath(targetPath, workingDirectory) {
|
|
856
|
-
const resolvedTarget = path
|
|
857
|
-
const resolvedWorkingDir = path
|
|
856
|
+
const resolvedTarget = path.resolve(workingDirectory, targetPath);
|
|
857
|
+
const resolvedWorkingDir = path.resolve(workingDirectory);
|
|
858
858
|
const targetNormalized = resolvedTarget.replace(/\\/g, "/");
|
|
859
859
|
const workingDirNormalized = resolvedWorkingDir.replace(/\\/g, "/");
|
|
860
860
|
process.platform === "win32" ? "\\" : "/";
|
|
@@ -940,7 +940,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
940
940
|
return { success: false, error: validation.error };
|
|
941
941
|
}
|
|
942
942
|
try {
|
|
943
|
-
const buffer = await fs$
|
|
943
|
+
const buffer = await fs$1.readFile(data.path);
|
|
944
944
|
const content = buffer.toString("base64");
|
|
945
945
|
return { success: true, content };
|
|
946
946
|
} catch (error) {
|
|
@@ -957,7 +957,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
957
957
|
try {
|
|
958
958
|
if (data.expectedHash !== null && data.expectedHash !== void 0) {
|
|
959
959
|
try {
|
|
960
|
-
const existingBuffer = await fs$
|
|
960
|
+
const existingBuffer = await fs$1.readFile(data.path);
|
|
961
961
|
const existingHash = crypto.createHash("sha256").update(existingBuffer).digest("hex");
|
|
962
962
|
if (existingHash !== data.expectedHash) {
|
|
963
963
|
return {
|
|
@@ -977,7 +977,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
977
977
|
}
|
|
978
978
|
} else {
|
|
979
979
|
try {
|
|
980
|
-
await fs$
|
|
980
|
+
await fs$1.stat(data.path);
|
|
981
981
|
return {
|
|
982
982
|
success: false,
|
|
983
983
|
error: "File already exists but was expected to be new"
|
|
@@ -990,7 +990,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
const buffer = Buffer.from(data.content, "base64");
|
|
993
|
-
await fs$
|
|
993
|
+
await fs$1.writeFile(data.path, buffer);
|
|
994
994
|
const hash = crypto.createHash("sha256").update(buffer).digest("hex");
|
|
995
995
|
return { success: true, hash };
|
|
996
996
|
} catch (error) {
|
|
@@ -1005,10 +1005,10 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
1005
1005
|
return { success: false, error: validation.error };
|
|
1006
1006
|
}
|
|
1007
1007
|
try {
|
|
1008
|
-
const entries = await fs$
|
|
1008
|
+
const entries = await fs$1.readdir(data.path, { withFileTypes: true });
|
|
1009
1009
|
const directoryEntries = await Promise.all(
|
|
1010
1010
|
entries.map(async (entry) => {
|
|
1011
|
-
const fullPath = path
|
|
1011
|
+
const fullPath = path.join(data.path, entry.name);
|
|
1012
1012
|
let type = "other";
|
|
1013
1013
|
let size;
|
|
1014
1014
|
let modified;
|
|
@@ -1018,7 +1018,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
1018
1018
|
type = "file";
|
|
1019
1019
|
}
|
|
1020
1020
|
try {
|
|
1021
|
-
const stats = await fs$
|
|
1021
|
+
const stats = await fs$1.stat(fullPath);
|
|
1022
1022
|
size = stats.size;
|
|
1023
1023
|
modified = stats.mtime.getTime();
|
|
1024
1024
|
} catch (error) {
|
|
@@ -1049,26 +1049,26 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
1049
1049
|
if (!validation.valid) {
|
|
1050
1050
|
return { success: false, error: validation.error };
|
|
1051
1051
|
}
|
|
1052
|
-
async function buildTree(path, name, currentDepth) {
|
|
1052
|
+
async function buildTree(path$1, name, currentDepth) {
|
|
1053
1053
|
try {
|
|
1054
|
-
const stats = await fs$
|
|
1054
|
+
const stats = await fs$1.stat(path$1);
|
|
1055
1055
|
const node = {
|
|
1056
1056
|
name,
|
|
1057
|
-
path,
|
|
1057
|
+
path: path$1,
|
|
1058
1058
|
type: stats.isDirectory() ? "directory" : "file",
|
|
1059
1059
|
size: stats.size,
|
|
1060
1060
|
modified: stats.mtime.getTime()
|
|
1061
1061
|
};
|
|
1062
1062
|
if (stats.isDirectory() && currentDepth < data.maxDepth) {
|
|
1063
|
-
const entries = await fs$
|
|
1063
|
+
const entries = await fs$1.readdir(path$1, { withFileTypes: true });
|
|
1064
1064
|
const children = [];
|
|
1065
1065
|
await Promise.all(
|
|
1066
1066
|
entries.map(async (entry) => {
|
|
1067
1067
|
if (entry.isSymbolicLink()) {
|
|
1068
|
-
logger.debug(`Skipping symlink: ${path
|
|
1068
|
+
logger.debug(`Skipping symlink: ${path.join(path$1, entry.name)}`);
|
|
1069
1069
|
return;
|
|
1070
1070
|
}
|
|
1071
|
-
const childPath = path
|
|
1071
|
+
const childPath = path.join(path$1, entry.name);
|
|
1072
1072
|
const childNode = await buildTree(childPath, entry.name, currentDepth + 1);
|
|
1073
1073
|
if (childNode) {
|
|
1074
1074
|
children.push(childNode);
|
|
@@ -1084,7 +1084,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory) {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
return node;
|
|
1086
1086
|
} catch (error) {
|
|
1087
|
-
logger.debug(`Failed to process ${path}:`, error instanceof Error ? error.message : String(error));
|
|
1087
|
+
logger.debug(`Failed to process ${path$1}:`, error instanceof Error ? error.message : String(error));
|
|
1088
1088
|
return null;
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createDefaultRuntimeShell } from './index-
|
|
1
|
+
import { c as createDefaultRuntimeShell } from './index-vNYxNqVZ.mjs';
|
|
2
2
|
import 'chalk';
|
|
3
|
-
import './api-
|
|
3
|
+
import './api-CIHTNilH.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'node:fs';
|
|
@@ -17,7 +17,7 @@ import 'fs/promises';
|
|
|
17
17
|
import 'crypto';
|
|
18
18
|
import 'path';
|
|
19
19
|
import 'expo-server-sdk';
|
|
20
|
-
import './persistence-
|
|
20
|
+
import './persistence-sLEqV8vk.mjs';
|
|
21
21
|
import 'node:fs/promises';
|
|
22
22
|
import 'os';
|
|
23
23
|
import 'tmp';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-1zlH6s7a.cjs');
|
|
4
4
|
require('chalk');
|
|
5
|
-
require('./api-
|
|
5
|
+
require('./api-CyJG1mr6.cjs');
|
|
6
6
|
require('axios');
|
|
7
7
|
require('fs');
|
|
8
8
|
require('node:fs');
|
|
@@ -19,7 +19,7 @@ require('fs/promises');
|
|
|
19
19
|
require('crypto');
|
|
20
20
|
require('path');
|
|
21
21
|
require('expo-server-sdk');
|
|
22
|
-
require('./persistence-
|
|
22
|
+
require('./persistence-BeFVx6kI.cjs');
|
|
23
23
|
require('node:fs/promises');
|
|
24
24
|
require('os');
|
|
25
25
|
require('tmp');
|