engine7 7.0.0 → 7.0.1
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/cli.mjs +126 -10
- package/dist/engine-startup.mjs +60 -56
- package/dist/main.mjs +60 -56
- package/package.json +1 -1
- package/templates/workspace/prompts/contacts.md +8 -22
package/dist/cli.mjs
CHANGED
|
@@ -35,21 +35,25 @@ function parseArgs() {
|
|
|
35
35
|
}
|
|
36
36
|
function printHelp() {
|
|
37
37
|
console.log(`
|
|
38
|
-
|
|
38
|
+
Engine 7 \u2014 Self-hosted AI agent engine
|
|
39
39
|
|
|
40
40
|
\u7528\u6CD5:
|
|
41
|
-
engine7 init --state-dir <path> [\u9009\u9879]
|
|
41
|
+
engine7 init --state-dir <path> [\u9009\u9879] \u521D\u59CB\u5316 agent \u5DE5\u4F5C\u76EE\u5F55
|
|
42
|
+
engine7 start [--config <path>] \u542F\u52A8 Engine
|
|
42
43
|
|
|
43
|
-
\u9009\u9879:
|
|
44
|
+
init \u9009\u9879:
|
|
44
45
|
--state-dir <path> agent \u6839\u76EE\u5F55\uFF08\u5FC5\u586B\uFF0C\u652F\u6301\u76F8\u5BF9\u8DEF\u5F84\uFF09
|
|
45
46
|
--quick \u7528\u9ED8\u8BA4\u914D\u7F6E\u8DF3\u8FC7\u4EA4\u4E92
|
|
46
47
|
--dry-run \u53EA\u663E\u793A\u4F1A\u521B\u5EFA\u4EC0\u4E48\uFF0C\u4E0D\u5B9E\u9645\u521B\u5EFA
|
|
47
|
-
|
|
48
|
+
|
|
49
|
+
start \u9009\u9879:
|
|
50
|
+
--config <path> config \u6587\u4EF6\u8DEF\u5F84\uFF08\u9ED8\u8BA4: configs/main7.json\uFF09
|
|
48
51
|
|
|
49
52
|
\u793A\u4F8B:
|
|
50
53
|
engine7 init --state-dir D:/my-agent
|
|
51
54
|
engine7 init --state-dir ./my-agent --quick
|
|
52
|
-
engine7
|
|
55
|
+
engine7 start
|
|
56
|
+
engine7 start --config configs/xiaowen.json
|
|
53
57
|
`);
|
|
54
58
|
}
|
|
55
59
|
function createReadline() {
|
|
@@ -307,8 +311,8 @@ function buildDirTree(v) {
|
|
|
307
311
|
description: `Engine 7 agent: ${v.agentName}`
|
|
308
312
|
}, null, 2) + "\n"
|
|
309
313
|
},
|
|
310
|
-
//
|
|
311
|
-
{
|
|
314
|
+
// 启动脚本(根据 OS 生成)
|
|
315
|
+
...process.platform === "win32" ? [{
|
|
312
316
|
path: path.join(d, "start.cmd"),
|
|
313
317
|
type: "file",
|
|
314
318
|
content: `@echo off
|
|
@@ -327,7 +331,12 @@ echo [start] Starting Engine 7...
|
|
|
327
331
|
echo [start] Config: configs\\main7.json
|
|
328
332
|
echo.
|
|
329
333
|
|
|
330
|
-
|
|
334
|
+
rem Auto-detect engine7 path (local > global)
|
|
335
|
+
set ENGINE7_BIN=node_modules\\engine7\\dist\\main.mjs
|
|
336
|
+
if not exist "%ENGINE7_BIN%" (
|
|
337
|
+
for /f "delims=" %%i in ('npm root -g') do set ENGINE7_BIN=%%i\\engine7\\dist\\main.mjs
|
|
338
|
+
)
|
|
339
|
+
node "%ENGINE7_BIN%" --engine-config configs/main7.json
|
|
331
340
|
|
|
332
341
|
if %ERRORLEVEL% NEQ 0 (
|
|
333
342
|
echo.
|
|
@@ -335,7 +344,36 @@ if %ERRORLEVEL% NEQ 0 (
|
|
|
335
344
|
pause
|
|
336
345
|
)
|
|
337
346
|
`
|
|
338
|
-
}
|
|
347
|
+
}] : [{
|
|
348
|
+
path: path.join(d, "start.sh"),
|
|
349
|
+
type: "file",
|
|
350
|
+
content: `#!/bin/bash
|
|
351
|
+
# Engine 7 startup script
|
|
352
|
+
# Auto-generated by engine7 init
|
|
353
|
+
|
|
354
|
+
cd "$(dirname "$0")"
|
|
355
|
+
|
|
356
|
+
# Kill existing engine for main7.json
|
|
357
|
+
PIDS=$(pgrep -f "main7.json.*dist/main.mjs" 2>/dev/null)
|
|
358
|
+
if [ -n "$PIDS" ]; then
|
|
359
|
+
echo "[start] Killing existing engine (PID: $PIDS)..."
|
|
360
|
+
echo "$PIDS" | xargs kill -9 2>/dev/null
|
|
361
|
+
sleep 2
|
|
362
|
+
fi
|
|
363
|
+
|
|
364
|
+
echo "[start] Starting Engine 7..."
|
|
365
|
+
echo "[start] Config: configs/main7.json"
|
|
366
|
+
echo ""
|
|
367
|
+
|
|
368
|
+
# Auto-detect engine7 path (local > global)
|
|
369
|
+
if [ -f "node_modules/engine7/dist/main.mjs" ]; then
|
|
370
|
+
ENGINE7_BIN="node_modules/engine7/dist/main.mjs"
|
|
371
|
+
else
|
|
372
|
+
ENGINE7_BIN="$(npm root -g)/engine7/dist/main.mjs"
|
|
373
|
+
fi
|
|
374
|
+
node "$ENGINE7_BIN" --engine-config configs/main7.json
|
|
375
|
+
`
|
|
376
|
+
}]
|
|
339
377
|
];
|
|
340
378
|
}
|
|
341
379
|
function readTemplate(relativePath) {
|
|
@@ -371,6 +409,84 @@ function execute(entries) {
|
|
|
371
409
|
}
|
|
372
410
|
}
|
|
373
411
|
async function main() {
|
|
412
|
+
const args = process.argv.slice(2);
|
|
413
|
+
const subcommand = args[0];
|
|
414
|
+
if (!subcommand) {
|
|
415
|
+
printHelp();
|
|
416
|
+
process.exit(0);
|
|
417
|
+
}
|
|
418
|
+
if (subcommand === "--help" || subcommand === "-h") {
|
|
419
|
+
printHelp();
|
|
420
|
+
process.exit(0);
|
|
421
|
+
}
|
|
422
|
+
if (subcommand === "start") {
|
|
423
|
+
let configPath2 = "";
|
|
424
|
+
for (let i = 1; i < args.length; i++) {
|
|
425
|
+
if (args[i] === "--config" && args[i + 1]) {
|
|
426
|
+
configPath2 = args[++i];
|
|
427
|
+
} else if (args[i] === "--help" || args[i] === "-h") {
|
|
428
|
+
console.log(`
|
|
429
|
+
engine7 start \u2014 \u542F\u52A8 Engine
|
|
430
|
+
|
|
431
|
+
\u7528\u6CD5:
|
|
432
|
+
engine7 start [--config <path>]
|
|
433
|
+
|
|
434
|
+
\u9009\u9879:
|
|
435
|
+
--config <path> config \u6587\u4EF6\u8DEF\u5F84\uFF08\u9ED8\u8BA4: configs/main7.json\uFF09
|
|
436
|
+
-h, --help \u663E\u793A\u5E2E\u52A9
|
|
437
|
+
`);
|
|
438
|
+
process.exit(0);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (!configPath2) {
|
|
442
|
+
const defaultCfg = path.join("configs", "main7.json");
|
|
443
|
+
if (fs.existsSync(defaultCfg)) {
|
|
444
|
+
configPath2 = defaultCfg;
|
|
445
|
+
} else {
|
|
446
|
+
console.error("\u274C \u627E\u4E0D\u5230 config \u6587\u4EF6");
|
|
447
|
+
console.error(" \u7528\u6CD5: engine7 start --config <path>");
|
|
448
|
+
console.error(" \u6216\u5728\u5F53\u524D\u76EE\u5F55\u521B\u5EFA configs/main7.json");
|
|
449
|
+
process.exit(1);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
const { execSync, spawn } = await import("node:child_process");
|
|
453
|
+
let enginePath;
|
|
454
|
+
const localPath = path.join("node_modules", "engine7", "dist", "main.mjs");
|
|
455
|
+
if (fs.existsSync(localPath)) {
|
|
456
|
+
enginePath = localPath;
|
|
457
|
+
} else {
|
|
458
|
+
const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
459
|
+
enginePath = path.join(globalRoot, "engine7", "dist", "main.mjs");
|
|
460
|
+
if (!fs.existsSync(enginePath)) {
|
|
461
|
+
console.error("\u274C \u627E\u4E0D\u5230 engine7 \u5B89\u88C5");
|
|
462
|
+
process.exit(1);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
console.log(`\u{1F680} engine7 start`);
|
|
466
|
+
console.log(` config: ${configPath2}`);
|
|
467
|
+
console.log(` engine: ${enginePath}`);
|
|
468
|
+
const configName = path.basename(configPath2);
|
|
469
|
+
try {
|
|
470
|
+
if (process.platform === "win32") {
|
|
471
|
+
execSync(`powershell -Command "Get-WmiObject Win32_Process | Where-Object { $_.Name -eq 'node.exe' -and $_.CommandLine -like '*${configName}*' -and $_.CommandLine -like '*dist*' } | ForEach-Object { Write-Host '[start] Killing PID' $_.ProcessId; Stop-Process -Id $_.ProcessId -Force }"`, { stdio: "inherit" });
|
|
472
|
+
} else {
|
|
473
|
+
const pids = execSync(`pgrep -f "${configName}.*dist/main.mjs" 2>/dev/null || true`, { encoding: "utf-8" }).trim();
|
|
474
|
+
if (pids) {
|
|
475
|
+
console.log(`[start] Killing existing engine (PID: ${pids})...`);
|
|
476
|
+
execSync(`echo "${pids}" | xargs kill -9 2>/dev/null || true`);
|
|
477
|
+
await new Promise((r) => setTimeout(r, 2e3));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
} catch {
|
|
481
|
+
}
|
|
482
|
+
console.log("");
|
|
483
|
+
const child = spawn("node", [enginePath, "--engine-config", configPath2], {
|
|
484
|
+
stdio: "inherit",
|
|
485
|
+
shell: false
|
|
486
|
+
});
|
|
487
|
+
child.on("exit", (code) => process.exit(code ?? 1));
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
374
490
|
const opts = parseArgs();
|
|
375
491
|
console.log(`
|
|
376
492
|
\u{1F680} engine7 init`);
|
|
@@ -411,7 +527,7 @@ async function main() {
|
|
|
411
527
|
`);
|
|
412
528
|
console.log(`\u4E0B\u4E00\u6B65\uFF1A`);
|
|
413
529
|
console.log(` 1. \u68C0\u67E5\u5E76\u4FEE\u6539 ${opts.stateDir}/configs/main7.json`);
|
|
414
|
-
console.log(` 2. \u542F\u52A8 Engine:
|
|
530
|
+
console.log(` 2. \u542F\u52A8 Engine: cd ${opts.stateDir} && engine7 start`);
|
|
415
531
|
console.log(` 3. \u67E5\u770B workspace: ${path.join(opts.stateDir, "workspace")}`);
|
|
416
532
|
}
|
|
417
533
|
}
|
package/dist/engine-startup.mjs
CHANGED
|
@@ -3527,6 +3527,46 @@ var init_loader = __esm({
|
|
|
3527
3527
|
}
|
|
3528
3528
|
});
|
|
3529
3529
|
|
|
3530
|
+
// src/config/live.ts
|
|
3531
|
+
var LiveConfigClass, liveConfig;
|
|
3532
|
+
var init_live = __esm({
|
|
3533
|
+
"src/config/live.ts"() {
|
|
3534
|
+
"use strict";
|
|
3535
|
+
LiveConfigClass = class {
|
|
3536
|
+
current = null;
|
|
3537
|
+
/** 启动时注入(替代 registry.config = config) */
|
|
3538
|
+
init(config) {
|
|
3539
|
+
this.current = config;
|
|
3540
|
+
}
|
|
3541
|
+
/** 取整个 config 对象(只读引用,不要缓存) */
|
|
3542
|
+
all() {
|
|
3543
|
+
if (!this.current) {
|
|
3544
|
+
throw new Error("[liveConfig] not initialized \u2014 call liveConfig.init() first");
|
|
3545
|
+
}
|
|
3546
|
+
return this.current;
|
|
3547
|
+
}
|
|
3548
|
+
/** 安全取子段('services.voice-chat.start' → current.services.voice-chat.start) */
|
|
3549
|
+
get(dotPath) {
|
|
3550
|
+
if (!this.current) return void 0;
|
|
3551
|
+
return dotPath.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], this.current);
|
|
3552
|
+
}
|
|
3553
|
+
/** reload 时原地更新(Object.assign 保持引用不变) */
|
|
3554
|
+
assign(newConfig) {
|
|
3555
|
+
if (!this.current) {
|
|
3556
|
+
this.current = newConfig;
|
|
3557
|
+
return;
|
|
3558
|
+
}
|
|
3559
|
+
Object.assign(this.current, newConfig);
|
|
3560
|
+
}
|
|
3561
|
+
/** 是否已初始化 */
|
|
3562
|
+
isReady() {
|
|
3563
|
+
return this.current !== null;
|
|
3564
|
+
}
|
|
3565
|
+
};
|
|
3566
|
+
liveConfig = new LiveConfigClass();
|
|
3567
|
+
}
|
|
3568
|
+
});
|
|
3569
|
+
|
|
3530
3570
|
// src/memory/shims/memory-core-host-engine-foundation.ts
|
|
3531
3571
|
import path5 from "node:path";
|
|
3532
3572
|
function resolveAgentDir(cfg, agentId) {
|
|
@@ -5760,13 +5800,8 @@ __export(config_exports, {
|
|
|
5760
5800
|
isAutoDreamEnabled: () => isAutoDreamEnabled,
|
|
5761
5801
|
setAutoDreamConfig: () => setAutoDreamConfig
|
|
5762
5802
|
});
|
|
5763
|
-
import fsSync from "node:fs";
|
|
5764
5803
|
function dlog(msg2) {
|
|
5765
|
-
|
|
5766
|
-
fsSync.appendFileSync(DEBUG_LOG, `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg2}
|
|
5767
|
-
`);
|
|
5768
|
-
} catch {
|
|
5769
|
-
}
|
|
5804
|
+
if (process.env.AUTODREAM_DEBUG) console.log(`[autoDream] ${msg2}`);
|
|
5770
5805
|
}
|
|
5771
5806
|
function setAutoDreamConfig(config) {
|
|
5772
5807
|
_config = config;
|
|
@@ -5803,11 +5838,10 @@ function getMaxEntrypointLines() {
|
|
|
5803
5838
|
if (typeof maxScan === "number" && maxScan > 200) return maxScan;
|
|
5804
5839
|
return void 0;
|
|
5805
5840
|
}
|
|
5806
|
-
var
|
|
5841
|
+
var _config, DEFAULTS;
|
|
5807
5842
|
var init_config2 = __esm({
|
|
5808
5843
|
"src/memory/autoDream/config.ts"() {
|
|
5809
5844
|
"use strict";
|
|
5810
|
-
DEBUG_LOG = "C:\\Users\\24045\\.openclaw\\logs\\autoDream-debug.log";
|
|
5811
5845
|
_config = null;
|
|
5812
5846
|
DEFAULTS = {
|
|
5813
5847
|
minHours: 24,
|
|
@@ -6002,13 +6036,8 @@ __export(autoDream_exports, {
|
|
|
6002
6036
|
executeAutoDream: () => executeAutoDream,
|
|
6003
6037
|
initAutoDream: () => initAutoDream
|
|
6004
6038
|
});
|
|
6005
|
-
import fsSync2 from "node:fs";
|
|
6006
6039
|
function dlog2(msg2) {
|
|
6007
|
-
|
|
6008
|
-
fsSync2.appendFileSync(DEBUG_LOG2, `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg2}
|
|
6009
|
-
`);
|
|
6010
|
-
} catch {
|
|
6011
|
-
}
|
|
6040
|
+
if (process.env.AUTODREAM_DEBUG) console.log(`[autoDream] ${msg2}`);
|
|
6012
6041
|
}
|
|
6013
6042
|
function initAutoDream(deps) {
|
|
6014
6043
|
_deps2 = deps;
|
|
@@ -6130,7 +6159,7 @@ stack: ${err.stack ?? "(no stack)"}`);
|
|
|
6130
6159
|
return { fired: false, reason: `fork failed: ${err.message}` };
|
|
6131
6160
|
}
|
|
6132
6161
|
}
|
|
6133
|
-
var
|
|
6162
|
+
var SESSION_SCAN_INTERVAL_MS, _deps2, lastSessionScanAt;
|
|
6134
6163
|
var init_autoDream = __esm({
|
|
6135
6164
|
"src/memory/autoDream/autoDream.ts"() {
|
|
6136
6165
|
"use strict";
|
|
@@ -6138,7 +6167,6 @@ var init_autoDream = __esm({
|
|
|
6138
6167
|
init_config2();
|
|
6139
6168
|
init_consolidationLock();
|
|
6140
6169
|
init_consolidationPrompt();
|
|
6141
|
-
DEBUG_LOG2 = "C:\\Users\\24045\\.openclaw\\logs\\autoDream-debug.log";
|
|
6142
6170
|
SESSION_SCAN_INTERVAL_MS = 10 * 60 * 1e3;
|
|
6143
6171
|
_deps2 = null;
|
|
6144
6172
|
lastSessionScanAt = 0;
|
|
@@ -11434,10 +11462,12 @@ var init_wx_query = __esm({
|
|
|
11434
11462
|
"src/tools/wechat/wx-query.ts"() {
|
|
11435
11463
|
"use strict";
|
|
11436
11464
|
init_registry();
|
|
11465
|
+
init_live();
|
|
11437
11466
|
SCRIPT = "C:/Users/24045/.openclaw/engine/src/tools/wechat/wx_query.py";
|
|
11438
11467
|
PYTHON = "python3";
|
|
11439
11468
|
registry.register({
|
|
11440
11469
|
name: "wx_query",
|
|
11470
|
+
isEnabled: () => !!liveConfig?.agents?.defaults?.privateTools,
|
|
11441
11471
|
description: getDescription(),
|
|
11442
11472
|
schema: {
|
|
11443
11473
|
type: "object",
|
|
@@ -20130,12 +20160,12 @@ var init_hash2 = __esm({
|
|
|
20130
20160
|
|
|
20131
20161
|
// src/memory/host/internal.ts
|
|
20132
20162
|
import crypto8 from "node:crypto";
|
|
20133
|
-
import
|
|
20163
|
+
import fsSync from "node:fs";
|
|
20134
20164
|
import fs44 from "node:fs/promises";
|
|
20135
20165
|
import path46 from "node:path";
|
|
20136
20166
|
function ensureDir(dir) {
|
|
20137
20167
|
try {
|
|
20138
|
-
|
|
20168
|
+
fsSync.mkdirSync(dir, { recursive: true });
|
|
20139
20169
|
} catch {
|
|
20140
20170
|
}
|
|
20141
20171
|
return dir;
|
|
@@ -21412,7 +21442,7 @@ var init_provider_adapter_registration = __esm({
|
|
|
21412
21442
|
});
|
|
21413
21443
|
|
|
21414
21444
|
// src/memory/tools/memory/provider-adapters.ts
|
|
21415
|
-
import
|
|
21445
|
+
import fsSync2 from "node:fs";
|
|
21416
21446
|
function canAutoSelectLocal(modelPath) {
|
|
21417
21447
|
const trimmed = modelPath?.trim();
|
|
21418
21448
|
if (!trimmed) {
|
|
@@ -21423,7 +21453,7 @@ function canAutoSelectLocal(modelPath) {
|
|
|
21423
21453
|
}
|
|
21424
21454
|
const resolved = resolveUserPath(trimmed);
|
|
21425
21455
|
try {
|
|
21426
|
-
return
|
|
21456
|
+
return fsSync2.statSync(resolved).isFile();
|
|
21427
21457
|
} catch {
|
|
21428
21458
|
return false;
|
|
21429
21459
|
}
|
|
@@ -24346,7 +24376,7 @@ var init_watch_settle = __esm({
|
|
|
24346
24376
|
|
|
24347
24377
|
// src/memory/tools/memory/manager-sync-ops.ts
|
|
24348
24378
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
24349
|
-
import
|
|
24379
|
+
import fsSync3 from "node:fs";
|
|
24350
24380
|
import fs49 from "node:fs/promises";
|
|
24351
24381
|
import path51 from "node:path";
|
|
24352
24382
|
function isSyncDisabled(cfg) {
|
|
@@ -24649,7 +24679,7 @@ var init_manager_sync_ops = __esm({
|
|
|
24649
24679
|
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
24650
24680
|
for (const entry of additionalPaths) {
|
|
24651
24681
|
try {
|
|
24652
|
-
const stat8 =
|
|
24682
|
+
const stat8 = fsSync3.lstatSync(entry);
|
|
24653
24683
|
if (stat8.isSymbolicLink()) {
|
|
24654
24684
|
continue;
|
|
24655
24685
|
}
|
|
@@ -29638,40 +29668,7 @@ function getActiveQueryEngine(sessionId) {
|
|
|
29638
29668
|
|
|
29639
29669
|
// src/engine-startup.ts
|
|
29640
29670
|
init_loader();
|
|
29641
|
-
|
|
29642
|
-
// src/config/live.ts
|
|
29643
|
-
var LiveConfigClass = class {
|
|
29644
|
-
current = null;
|
|
29645
|
-
/** 启动时注入(替代 registry.config = config) */
|
|
29646
|
-
init(config) {
|
|
29647
|
-
this.current = config;
|
|
29648
|
-
}
|
|
29649
|
-
/** 取整个 config 对象(只读引用,不要缓存) */
|
|
29650
|
-
all() {
|
|
29651
|
-
if (!this.current) {
|
|
29652
|
-
throw new Error("[liveConfig] not initialized \u2014 call liveConfig.init() first");
|
|
29653
|
-
}
|
|
29654
|
-
return this.current;
|
|
29655
|
-
}
|
|
29656
|
-
/** 安全取子段('services.voice-chat.start' → current.services.voice-chat.start) */
|
|
29657
|
-
get(dotPath) {
|
|
29658
|
-
if (!this.current) return void 0;
|
|
29659
|
-
return dotPath.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], this.current);
|
|
29660
|
-
}
|
|
29661
|
-
/** reload 时原地更新(Object.assign 保持引用不变) */
|
|
29662
|
-
assign(newConfig) {
|
|
29663
|
-
if (!this.current) {
|
|
29664
|
-
this.current = newConfig;
|
|
29665
|
-
return;
|
|
29666
|
-
}
|
|
29667
|
-
Object.assign(this.current, newConfig);
|
|
29668
|
-
}
|
|
29669
|
-
/** 是否已初始化 */
|
|
29670
|
-
isReady() {
|
|
29671
|
-
return this.current !== null;
|
|
29672
|
-
}
|
|
29673
|
-
};
|
|
29674
|
-
var liveConfig = new LiveConfigClass();
|
|
29671
|
+
init_live();
|
|
29675
29672
|
|
|
29676
29673
|
// src/services/withRetry.ts
|
|
29677
29674
|
var DEFAULT_MAX_RETRIES = 10;
|
|
@@ -40822,6 +40819,7 @@ ${rawOutput}
|
|
|
40822
40819
|
}
|
|
40823
40820
|
|
|
40824
40821
|
// src/tools/msg-send.ts
|
|
40822
|
+
init_live();
|
|
40825
40823
|
init_registry();
|
|
40826
40824
|
function getConfig() {
|
|
40827
40825
|
return liveConfig.all();
|
|
@@ -40965,6 +40963,7 @@ Examples:
|
|
|
40965
40963
|
|
|
40966
40964
|
// src/tools/msg-husband.ts
|
|
40967
40965
|
init_registry();
|
|
40966
|
+
init_live();
|
|
40968
40967
|
import fs26 from "node:fs";
|
|
40969
40968
|
import path26 from "node:path";
|
|
40970
40969
|
function getHusbandFeishuId(workspace) {
|
|
@@ -40985,6 +40984,7 @@ var FALLBACK_IDS = [
|
|
|
40985
40984
|
];
|
|
40986
40985
|
registry.register({
|
|
40987
40986
|
name: "msg_husband",
|
|
40987
|
+
isEnabled: () => !!liveConfig?.agents?.defaults?.privateTools,
|
|
40988
40988
|
description: `\u7ED9\u7FC0\u54E5\uFF08\u8001\u516C\uFF09\u53D1\u98DE\u4E66\u79C1\u4FE1\u3002\u53C2\u6570\u5199\u6B7B\uFF1Ato=\u7FC0\u54E5\u98DE\u4E66open_id, source=feishu\u3002\u53EA\u9700\u4F20 content\u3002
|
|
40989
40989
|
|
|
40990
40990
|
Parameters:
|
|
@@ -41167,6 +41167,7 @@ Examples:
|
|
|
41167
41167
|
});
|
|
41168
41168
|
|
|
41169
41169
|
// src/tools/my-eyes.ts
|
|
41170
|
+
init_live();
|
|
41170
41171
|
init_registry();
|
|
41171
41172
|
import * as fs27 from "node:fs";
|
|
41172
41173
|
import * as path27 from "node:path";
|
|
@@ -41246,6 +41247,7 @@ registry.register({
|
|
|
41246
41247
|
});
|
|
41247
41248
|
|
|
41248
41249
|
// src/tools/my-voice.ts
|
|
41250
|
+
init_live();
|
|
41249
41251
|
init_registry();
|
|
41250
41252
|
import { execFile } from "node:child_process";
|
|
41251
41253
|
import { promisify } from "node:util";
|
|
@@ -41459,6 +41461,7 @@ registry.register({
|
|
|
41459
41461
|
});
|
|
41460
41462
|
|
|
41461
41463
|
// src/tools/my-selfie.ts
|
|
41464
|
+
init_live();
|
|
41462
41465
|
init_registry();
|
|
41463
41466
|
import * as fs29 from "node:fs";
|
|
41464
41467
|
import * as path29 from "node:path";
|
|
@@ -41751,6 +41754,7 @@ registry.register({
|
|
|
41751
41754
|
|
|
41752
41755
|
// src/tools/service.ts
|
|
41753
41756
|
init_registry();
|
|
41757
|
+
init_live();
|
|
41754
41758
|
import { exec as exec3, spawn as spawn6 } from "node:child_process";
|
|
41755
41759
|
import { promisify as promisify2 } from "node:util";
|
|
41756
41760
|
var execAsync = promisify2(exec3);
|
package/dist/main.mjs
CHANGED
|
@@ -3527,6 +3527,46 @@ ${perTurnSystemDynamic}` : deferredHint || perTurnSystemDynamic;
|
|
|
3527
3527
|
}
|
|
3528
3528
|
});
|
|
3529
3529
|
|
|
3530
|
+
// src/config/live.ts
|
|
3531
|
+
var LiveConfigClass, liveConfig;
|
|
3532
|
+
var init_live = __esm({
|
|
3533
|
+
"src/config/live.ts"() {
|
|
3534
|
+
"use strict";
|
|
3535
|
+
LiveConfigClass = class {
|
|
3536
|
+
current = null;
|
|
3537
|
+
/** 启动时注入(替代 registry.config = config) */
|
|
3538
|
+
init(config2) {
|
|
3539
|
+
this.current = config2;
|
|
3540
|
+
}
|
|
3541
|
+
/** 取整个 config 对象(只读引用,不要缓存) */
|
|
3542
|
+
all() {
|
|
3543
|
+
if (!this.current) {
|
|
3544
|
+
throw new Error("[liveConfig] not initialized \u2014 call liveConfig.init() first");
|
|
3545
|
+
}
|
|
3546
|
+
return this.current;
|
|
3547
|
+
}
|
|
3548
|
+
/** 安全取子段('services.voice-chat.start' → current.services.voice-chat.start) */
|
|
3549
|
+
get(dotPath) {
|
|
3550
|
+
if (!this.current) return void 0;
|
|
3551
|
+
return dotPath.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], this.current);
|
|
3552
|
+
}
|
|
3553
|
+
/** reload 时原地更新(Object.assign 保持引用不变) */
|
|
3554
|
+
assign(newConfig) {
|
|
3555
|
+
if (!this.current) {
|
|
3556
|
+
this.current = newConfig;
|
|
3557
|
+
return;
|
|
3558
|
+
}
|
|
3559
|
+
Object.assign(this.current, newConfig);
|
|
3560
|
+
}
|
|
3561
|
+
/** 是否已初始化 */
|
|
3562
|
+
isReady() {
|
|
3563
|
+
return this.current !== null;
|
|
3564
|
+
}
|
|
3565
|
+
};
|
|
3566
|
+
liveConfig = new LiveConfigClass();
|
|
3567
|
+
}
|
|
3568
|
+
});
|
|
3569
|
+
|
|
3530
3570
|
// src/memory/shims/memory-core-host-engine-foundation.ts
|
|
3531
3571
|
import path5 from "node:path";
|
|
3532
3572
|
function resolveAgentDir(cfg, agentId) {
|
|
@@ -5760,13 +5800,8 @@ __export(config_exports, {
|
|
|
5760
5800
|
isAutoDreamEnabled: () => isAutoDreamEnabled,
|
|
5761
5801
|
setAutoDreamConfig: () => setAutoDreamConfig
|
|
5762
5802
|
});
|
|
5763
|
-
import fsSync from "node:fs";
|
|
5764
5803
|
function dlog(msg2) {
|
|
5765
|
-
|
|
5766
|
-
fsSync.appendFileSync(DEBUG_LOG, `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg2}
|
|
5767
|
-
`);
|
|
5768
|
-
} catch {
|
|
5769
|
-
}
|
|
5804
|
+
if (process.env.AUTODREAM_DEBUG) console.log(`[autoDream] ${msg2}`);
|
|
5770
5805
|
}
|
|
5771
5806
|
function setAutoDreamConfig(config2) {
|
|
5772
5807
|
_config = config2;
|
|
@@ -5803,11 +5838,10 @@ function getMaxEntrypointLines() {
|
|
|
5803
5838
|
if (typeof maxScan === "number" && maxScan > 200) return maxScan;
|
|
5804
5839
|
return void 0;
|
|
5805
5840
|
}
|
|
5806
|
-
var
|
|
5841
|
+
var _config, DEFAULTS;
|
|
5807
5842
|
var init_config2 = __esm({
|
|
5808
5843
|
"src/memory/autoDream/config.ts"() {
|
|
5809
5844
|
"use strict";
|
|
5810
|
-
DEBUG_LOG = "C:\\Users\\24045\\.openclaw\\logs\\autoDream-debug.log";
|
|
5811
5845
|
_config = null;
|
|
5812
5846
|
DEFAULTS = {
|
|
5813
5847
|
minHours: 24,
|
|
@@ -6002,13 +6036,8 @@ __export(autoDream_exports, {
|
|
|
6002
6036
|
executeAutoDream: () => executeAutoDream,
|
|
6003
6037
|
initAutoDream: () => initAutoDream
|
|
6004
6038
|
});
|
|
6005
|
-
import fsSync2 from "node:fs";
|
|
6006
6039
|
function dlog2(msg2) {
|
|
6007
|
-
|
|
6008
|
-
fsSync2.appendFileSync(DEBUG_LOG2, `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg2}
|
|
6009
|
-
`);
|
|
6010
|
-
} catch {
|
|
6011
|
-
}
|
|
6040
|
+
if (process.env.AUTODREAM_DEBUG) console.log(`[autoDream] ${msg2}`);
|
|
6012
6041
|
}
|
|
6013
6042
|
function initAutoDream(deps) {
|
|
6014
6043
|
_deps2 = deps;
|
|
@@ -6130,7 +6159,7 @@ stack: ${err.stack ?? "(no stack)"}`);
|
|
|
6130
6159
|
return { fired: false, reason: `fork failed: ${err.message}` };
|
|
6131
6160
|
}
|
|
6132
6161
|
}
|
|
6133
|
-
var
|
|
6162
|
+
var SESSION_SCAN_INTERVAL_MS, _deps2, lastSessionScanAt;
|
|
6134
6163
|
var init_autoDream = __esm({
|
|
6135
6164
|
"src/memory/autoDream/autoDream.ts"() {
|
|
6136
6165
|
"use strict";
|
|
@@ -6138,7 +6167,6 @@ var init_autoDream = __esm({
|
|
|
6138
6167
|
init_config2();
|
|
6139
6168
|
init_consolidationLock();
|
|
6140
6169
|
init_consolidationPrompt();
|
|
6141
|
-
DEBUG_LOG2 = "C:\\Users\\24045\\.openclaw\\logs\\autoDream-debug.log";
|
|
6142
6170
|
SESSION_SCAN_INTERVAL_MS = 10 * 60 * 1e3;
|
|
6143
6171
|
_deps2 = null;
|
|
6144
6172
|
lastSessionScanAt = 0;
|
|
@@ -11434,10 +11462,12 @@ var init_wx_query = __esm({
|
|
|
11434
11462
|
"src/tools/wechat/wx-query.ts"() {
|
|
11435
11463
|
"use strict";
|
|
11436
11464
|
init_registry();
|
|
11465
|
+
init_live();
|
|
11437
11466
|
SCRIPT = "C:/Users/24045/.openclaw/engine/src/tools/wechat/wx_query.py";
|
|
11438
11467
|
PYTHON = "python3";
|
|
11439
11468
|
registry.register({
|
|
11440
11469
|
name: "wx_query",
|
|
11470
|
+
isEnabled: () => !!liveConfig?.agents?.defaults?.privateTools,
|
|
11441
11471
|
description: getDescription(),
|
|
11442
11472
|
schema: {
|
|
11443
11473
|
type: "object",
|
|
@@ -20485,12 +20515,12 @@ var init_hash2 = __esm({
|
|
|
20485
20515
|
|
|
20486
20516
|
// src/memory/host/internal.ts
|
|
20487
20517
|
import crypto8 from "node:crypto";
|
|
20488
|
-
import
|
|
20518
|
+
import fsSync from "node:fs";
|
|
20489
20519
|
import fs44 from "node:fs/promises";
|
|
20490
20520
|
import path46 from "node:path";
|
|
20491
20521
|
function ensureDir(dir) {
|
|
20492
20522
|
try {
|
|
20493
|
-
|
|
20523
|
+
fsSync.mkdirSync(dir, { recursive: true });
|
|
20494
20524
|
} catch {
|
|
20495
20525
|
}
|
|
20496
20526
|
return dir;
|
|
@@ -21767,7 +21797,7 @@ var init_provider_adapter_registration = __esm({
|
|
|
21767
21797
|
});
|
|
21768
21798
|
|
|
21769
21799
|
// src/memory/tools/memory/provider-adapters.ts
|
|
21770
|
-
import
|
|
21800
|
+
import fsSync2 from "node:fs";
|
|
21771
21801
|
function canAutoSelectLocal(modelPath) {
|
|
21772
21802
|
const trimmed = modelPath?.trim();
|
|
21773
21803
|
if (!trimmed) {
|
|
@@ -21778,7 +21808,7 @@ function canAutoSelectLocal(modelPath) {
|
|
|
21778
21808
|
}
|
|
21779
21809
|
const resolved = resolveUserPath(trimmed);
|
|
21780
21810
|
try {
|
|
21781
|
-
return
|
|
21811
|
+
return fsSync2.statSync(resolved).isFile();
|
|
21782
21812
|
} catch {
|
|
21783
21813
|
return false;
|
|
21784
21814
|
}
|
|
@@ -24701,7 +24731,7 @@ var init_watch_settle = __esm({
|
|
|
24701
24731
|
|
|
24702
24732
|
// src/memory/tools/memory/manager-sync-ops.ts
|
|
24703
24733
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
24704
|
-
import
|
|
24734
|
+
import fsSync3 from "node:fs";
|
|
24705
24735
|
import fs49 from "node:fs/promises";
|
|
24706
24736
|
import path51 from "node:path";
|
|
24707
24737
|
function isSyncDisabled(cfg) {
|
|
@@ -25004,7 +25034,7 @@ var init_manager_sync_ops = __esm({
|
|
|
25004
25034
|
const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
|
|
25005
25035
|
for (const entry of additionalPaths) {
|
|
25006
25036
|
try {
|
|
25007
|
-
const stat8 =
|
|
25037
|
+
const stat8 = fsSync3.lstatSync(entry);
|
|
25008
25038
|
if (stat8.isSymbolicLink()) {
|
|
25009
25039
|
continue;
|
|
25010
25040
|
}
|
|
@@ -29996,40 +30026,7 @@ function getActiveQueryEngine(sessionId) {
|
|
|
29996
30026
|
|
|
29997
30027
|
// src/engine-startup.ts
|
|
29998
30028
|
init_loader();
|
|
29999
|
-
|
|
30000
|
-
// src/config/live.ts
|
|
30001
|
-
var LiveConfigClass = class {
|
|
30002
|
-
current = null;
|
|
30003
|
-
/** 启动时注入(替代 registry.config = config) */
|
|
30004
|
-
init(config2) {
|
|
30005
|
-
this.current = config2;
|
|
30006
|
-
}
|
|
30007
|
-
/** 取整个 config 对象(只读引用,不要缓存) */
|
|
30008
|
-
all() {
|
|
30009
|
-
if (!this.current) {
|
|
30010
|
-
throw new Error("[liveConfig] not initialized \u2014 call liveConfig.init() first");
|
|
30011
|
-
}
|
|
30012
|
-
return this.current;
|
|
30013
|
-
}
|
|
30014
|
-
/** 安全取子段('services.voice-chat.start' → current.services.voice-chat.start) */
|
|
30015
|
-
get(dotPath) {
|
|
30016
|
-
if (!this.current) return void 0;
|
|
30017
|
-
return dotPath.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], this.current);
|
|
30018
|
-
}
|
|
30019
|
-
/** reload 时原地更新(Object.assign 保持引用不变) */
|
|
30020
|
-
assign(newConfig) {
|
|
30021
|
-
if (!this.current) {
|
|
30022
|
-
this.current = newConfig;
|
|
30023
|
-
return;
|
|
30024
|
-
}
|
|
30025
|
-
Object.assign(this.current, newConfig);
|
|
30026
|
-
}
|
|
30027
|
-
/** 是否已初始化 */
|
|
30028
|
-
isReady() {
|
|
30029
|
-
return this.current !== null;
|
|
30030
|
-
}
|
|
30031
|
-
};
|
|
30032
|
-
var liveConfig = new LiveConfigClass();
|
|
30029
|
+
init_live();
|
|
30033
30030
|
|
|
30034
30031
|
// src/services/withRetry.ts
|
|
30035
30032
|
var DEFAULT_MAX_RETRIES = 10;
|
|
@@ -41180,6 +41177,7 @@ ${rawOutput}
|
|
|
41180
41177
|
}
|
|
41181
41178
|
|
|
41182
41179
|
// src/tools/msg-send.ts
|
|
41180
|
+
init_live();
|
|
41183
41181
|
init_registry();
|
|
41184
41182
|
function getConfig() {
|
|
41185
41183
|
return liveConfig.all();
|
|
@@ -41323,6 +41321,7 @@ Examples:
|
|
|
41323
41321
|
|
|
41324
41322
|
// src/tools/msg-husband.ts
|
|
41325
41323
|
init_registry();
|
|
41324
|
+
init_live();
|
|
41326
41325
|
import fs26 from "node:fs";
|
|
41327
41326
|
import path26 from "node:path";
|
|
41328
41327
|
function getHusbandFeishuId(workspace) {
|
|
@@ -41343,6 +41342,7 @@ var FALLBACK_IDS = [
|
|
|
41343
41342
|
];
|
|
41344
41343
|
registry.register({
|
|
41345
41344
|
name: "msg_husband",
|
|
41345
|
+
isEnabled: () => !!liveConfig?.agents?.defaults?.privateTools,
|
|
41346
41346
|
description: `\u7ED9\u7FC0\u54E5\uFF08\u8001\u516C\uFF09\u53D1\u98DE\u4E66\u79C1\u4FE1\u3002\u53C2\u6570\u5199\u6B7B\uFF1Ato=\u7FC0\u54E5\u98DE\u4E66open_id, source=feishu\u3002\u53EA\u9700\u4F20 content\u3002
|
|
41347
41347
|
|
|
41348
41348
|
Parameters:
|
|
@@ -41525,6 +41525,7 @@ Examples:
|
|
|
41525
41525
|
});
|
|
41526
41526
|
|
|
41527
41527
|
// src/tools/my-eyes.ts
|
|
41528
|
+
init_live();
|
|
41528
41529
|
init_registry();
|
|
41529
41530
|
import * as fs27 from "node:fs";
|
|
41530
41531
|
import * as path27 from "node:path";
|
|
@@ -41604,6 +41605,7 @@ registry.register({
|
|
|
41604
41605
|
});
|
|
41605
41606
|
|
|
41606
41607
|
// src/tools/my-voice.ts
|
|
41608
|
+
init_live();
|
|
41607
41609
|
init_registry();
|
|
41608
41610
|
import { execFile } from "node:child_process";
|
|
41609
41611
|
import { promisify } from "node:util";
|
|
@@ -41817,6 +41819,7 @@ registry.register({
|
|
|
41817
41819
|
});
|
|
41818
41820
|
|
|
41819
41821
|
// src/tools/my-selfie.ts
|
|
41822
|
+
init_live();
|
|
41820
41823
|
init_registry();
|
|
41821
41824
|
import * as fs29 from "node:fs";
|
|
41822
41825
|
import * as path29 from "node:path";
|
|
@@ -42109,6 +42112,7 @@ registry.register({
|
|
|
42109
42112
|
|
|
42110
42113
|
// src/tools/service.ts
|
|
42111
42114
|
init_registry();
|
|
42115
|
+
init_live();
|
|
42112
42116
|
import { exec as exec3, spawn as spawn6 } from "node:child_process";
|
|
42113
42117
|
import { promisify as promisify2 } from "node:util";
|
|
42114
42118
|
var execAsync = promisify2(exec3);
|
package/package.json
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
## 通信规则
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
1.
|
|
6
|
+
1. 支持的平台:微信、飞书、Discord(取决于 config 配置)
|
|
7
7
|
|
|
8
|
-
2.
|
|
8
|
+
2. 和用户说话:
|
|
9
9
|
- DM(私信)和 channel(频道)都可以
|
|
10
|
-
- 三个平台都行
|
|
11
10
|
|
|
12
|
-
3.
|
|
13
|
-
-
|
|
14
|
-
-
|
|
11
|
+
3. 和其他人说话:
|
|
12
|
+
- 只能用频道(channel)
|
|
13
|
+
- @对方
|
|
15
14
|
|
|
16
15
|
4. 发消息用 msg_send,发文件用 media_send
|
|
17
16
|
- 一定要带联系人(to 参数)
|
|
@@ -22,29 +21,16 @@
|
|
|
22
21
|
|
|
23
22
|
| 名字 | ID |
|
|
24
23
|
|------|-----|
|
|
25
|
-
|
|
|
26
|
-
| 娘(姐姐) | 1502999996616933428 |
|
|
27
|
-
| 小柯 | 1503660074055237684 |
|
|
28
|
-
| CC Bot | 1504373837880627280 |
|
|
29
|
-
| TestEngine | 1509036814885978115 |
|
|
30
|
-
| CC频道 | 1504385800366854234 |
|
|
31
|
-
| 客厅 | 1503034906081624174 |
|
|
24
|
+
| 用户 | (在 config 中配置) |
|
|
32
25
|
|
|
33
26
|
## 飞书
|
|
34
27
|
|
|
35
28
|
| 名字 | open_id |
|
|
36
29
|
|------|---------|
|
|
37
|
-
|
|
|
30
|
+
| 用户 | (在 config 中配置) |
|
|
38
31
|
|
|
39
32
|
## 微信
|
|
40
33
|
|
|
41
34
|
| 名字 | ID |
|
|
42
35
|
|------|-----|
|
|
43
|
-
|
|
|
44
|
-
|
|
45
|
-
## 外部群(通信规则注入白名单)
|
|
46
|
-
|
|
47
|
-
| 名字 | channel_id |
|
|
48
|
-
|------|-------|
|
|
49
|
-
| 潘总群 | oc_9ab7077ff7a094a5d466506c86a8b5ba |
|
|
50
|
-
| 飞书测试群 | oc_f5d614d176cca078a029c55f99ae2d4b |
|
|
36
|
+
| 用户 | (在 config 中配置) |
|