engine7 7.1.26 → 7.1.28

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/main.mjs CHANGED
@@ -5747,11 +5747,11 @@ async function readLastConsolidatedAt(memoryDir) {
5747
5747
  }
5748
5748
  }
5749
5749
  async function tryAcquireConsolidationLock(memoryDir) {
5750
- const path44 = lockPath(memoryDir);
5750
+ const path45 = lockPath(memoryDir);
5751
5751
  let mtimeMs;
5752
5752
  let holderPid;
5753
5753
  try {
5754
- const [s2, raw] = await Promise.all([stat3(path44), readFile5(path44, "utf8")]);
5754
+ const [s2, raw] = await Promise.all([stat3(path45), readFile5(path45, "utf8")]);
5755
5755
  mtimeMs = s2.mtimeMs;
5756
5756
  const parsed = parseInt(raw.trim(), 10);
5757
5757
  holderPid = Number.isFinite(parsed) ? parsed : void 0;
@@ -5764,10 +5764,10 @@ async function tryAcquireConsolidationLock(memoryDir) {
5764
5764
  }
5765
5765
  }
5766
5766
  await mkdir3(memoryDir, { recursive: true });
5767
- await writeFile4(path44, String(process.pid));
5767
+ await writeFile4(path45, String(process.pid));
5768
5768
  let verify2;
5769
5769
  try {
5770
- verify2 = await readFile5(path44, "utf8");
5770
+ verify2 = await readFile5(path45, "utf8");
5771
5771
  } catch {
5772
5772
  return null;
5773
5773
  }
@@ -5775,15 +5775,15 @@ async function tryAcquireConsolidationLock(memoryDir) {
5775
5775
  return mtimeMs ?? 0;
5776
5776
  }
5777
5777
  async function rollbackConsolidationLock(memoryDir, priorMtime) {
5778
- const path44 = lockPath(memoryDir);
5778
+ const path45 = lockPath(memoryDir);
5779
5779
  try {
5780
5780
  if (priorMtime === 0) {
5781
- await unlink(path44);
5781
+ await unlink(path45);
5782
5782
  return;
5783
5783
  }
5784
- await writeFile4(path44, "");
5784
+ await writeFile4(path45, "");
5785
5785
  const t = priorMtime / 1e3;
5786
- await utimes(path44, t, t);
5786
+ await utimes(path45, t, t);
5787
5787
  } catch (e) {
5788
5788
  console.log(`[autoDream] rollback failed: ${e.message} \u2014 next trigger delayed to minHours`);
5789
5789
  }
@@ -6116,15 +6116,15 @@ __export(TodoWriteTool_exports, {
6116
6116
  loadTodos: () => loadTodos
6117
6117
  });
6118
6118
  import fs31 from "node:fs";
6119
- import path31 from "node:path";
6119
+ import path32 from "node:path";
6120
6120
  function initTodoStore(stateDir) {
6121
- todosDir = path31.join(stateDir, "todos");
6121
+ todosDir = path32.join(stateDir, "todos");
6122
6122
  if (!fs31.existsSync(todosDir)) {
6123
6123
  fs31.mkdirSync(todosDir, { recursive: true });
6124
6124
  }
6125
6125
  }
6126
6126
  function todoFilePath(sessionId) {
6127
- return path31.join(todosDir, `${sessionId}.json`);
6127
+ return path32.join(todosDir, `${sessionId}.json`);
6128
6128
  }
6129
6129
  function loadTodos(sessionId) {
6130
6130
  if (!todosDir) return [];
@@ -6220,15 +6220,15 @@ __export(tasks_exports, {
6220
6220
  updateTask: () => updateTask
6221
6221
  });
6222
6222
  import * as fs33 from "node:fs";
6223
- import * as path33 from "node:path";
6223
+ import * as path34 from "node:path";
6224
6224
  function sanitizePathComponent2(input) {
6225
6225
  return input.replace(/[^a-zA-Z0-9_-]/g, "-");
6226
6226
  }
6227
6227
  function getTasksDir2(stateDir, listId) {
6228
- return path33.join(stateDir, "tasks", sanitizePathComponent2(listId));
6228
+ return path34.join(stateDir, "tasks", sanitizePathComponent2(listId));
6229
6229
  }
6230
6230
  function getTaskPath(stateDir, listId, taskId) {
6231
- return path33.join(getTasksDir2(stateDir, listId), `${sanitizePathComponent2(taskId)}.json`);
6231
+ return path34.join(getTasksDir2(stateDir, listId), `${sanitizePathComponent2(taskId)}.json`);
6232
6232
  }
6233
6233
  function ensureTasksDir2(stateDir, listId) {
6234
6234
  const dir = getTasksDir2(stateDir, listId);
@@ -6236,7 +6236,7 @@ function ensureTasksDir2(stateDir, listId) {
6236
6236
  return dir;
6237
6237
  }
6238
6238
  function getHighWaterMarkPath(stateDir, listId) {
6239
- return path33.join(getTasksDir2(stateDir, listId), HIGH_WATER_MARK_FILE);
6239
+ return path34.join(getTasksDir2(stateDir, listId), HIGH_WATER_MARK_FILE);
6240
6240
  }
6241
6241
  function readHighWaterMark(stateDir, listId) {
6242
6242
  try {
@@ -6442,7 +6442,7 @@ __export(read_exports, {
6442
6442
  readFileState: () => readFileState
6443
6443
  });
6444
6444
  import * as fs34 from "node:fs";
6445
- import * as path34 from "node:path";
6445
+ import * as path35 from "node:path";
6446
6446
  function isBlockedDevicePath(filePath) {
6447
6447
  if (BLOCKED_DEVICE_PATHS.has(filePath)) return true;
6448
6448
  if (filePath.startsWith("/proc/") && (filePath.endsWith("/fd/0") || filePath.endsWith("/fd/1") || filePath.endsWith("/fd/2"))) return true;
@@ -6621,7 +6621,7 @@ Usage:
6621
6621
  return { content: `\u6587\u4EF6\u4E0D\u5B58\u5728: ${filePath}`, isError: true };
6622
6622
  }
6623
6623
  const stat4 = fs34.statSync(filePath);
6624
- const baseName = path34.basename(filePath).toUpperCase();
6624
+ const baseName = path35.basename(filePath).toUpperCase();
6625
6625
  if (BLOCKED_BASENAMES.has(baseName)) {
6626
6626
  return { content: `\u8BBE\u5907\u6587\u4EF6\u4E0D\u652F\u6301\u8BFB\u53D6: ${filePath}`, isError: true };
6627
6627
  }
@@ -6631,7 +6631,7 @@ Usage:
6631
6631
  if (stat4.isDirectory()) {
6632
6632
  const entries = fs34.readdirSync(filePath);
6633
6633
  const items = entries.map((e) => {
6634
- const full = path34.join(filePath, e);
6634
+ const full = path35.join(filePath, e);
6635
6635
  try {
6636
6636
  const s2 = fs34.statSync(full);
6637
6637
  return s2.isDirectory() ? `${e}/` : e;
@@ -6642,7 +6642,7 @@ Usage:
6642
6642
  return { content: `\u76EE\u5F55 (${entries.length} \u9879):
6643
6643
  ${items.join("\n")}` };
6644
6644
  }
6645
- const ext = path34.extname(filePath).toLowerCase();
6645
+ const ext = path35.extname(filePath).toLowerCase();
6646
6646
  if (BINARY_EXTENSIONS.has(ext)) {
6647
6647
  return { content: `\u4E8C\u8FDB\u5236\u6587\u4EF6\u4E0D\u652F\u6301\u8BFB\u53D6 (${ext}): ${filePath}`, isError: true };
6648
6648
  }
@@ -6691,7 +6691,7 @@ ${result}` : result };
6691
6691
  // src/tools/write.ts
6692
6692
  var write_exports = {};
6693
6693
  import * as fs35 from "node:fs";
6694
- import * as path35 from "node:path";
6694
+ import * as path36 from "node:path";
6695
6695
  function isBlockedPath(filePath) {
6696
6696
  return BLOCKED_PATTERNS.some((p2) => p2.test(filePath));
6697
6697
  }
@@ -6835,7 +6835,7 @@ Usage:
6835
6835
  }
6836
6836
  }
6837
6837
  }
6838
- const dir = path35.dirname(filePath);
6838
+ const dir = path36.dirname(filePath);
6839
6839
  try {
6840
6840
  fs35.mkdirSync(dir, { recursive: true });
6841
6841
  } catch (e) {
@@ -6871,7 +6871,7 @@ ${simpleDiff(oldContent, content)}`;
6871
6871
  // src/tools/edit.ts
6872
6872
  var edit_exports = {};
6873
6873
  import * as fs36 from "node:fs";
6874
- import * as path36 from "node:path";
6874
+ import * as path37 from "node:path";
6875
6875
  function normalizeQuotes(str) {
6876
6876
  return str.replaceAll(LEFT_SINGLE_CURLY, "'").replaceAll(RIGHT_SINGLE_CURLY, "'").replaceAll(LEFT_DOUBLE_CURLY, '"').replaceAll(RIGHT_DOUBLE_CURLY, '"');
6877
6877
  }
@@ -7034,7 +7034,7 @@ Usage:
7034
7034
  } catch (e) {
7035
7035
  if (e.code === "ENOENT") {
7036
7036
  if (oldString === "") {
7037
- const dir = path36.dirname(filePath);
7037
+ const dir = path37.dirname(filePath);
7038
7038
  fs36.mkdirSync(dir, { recursive: true });
7039
7039
  fs36.writeFileSync(filePath, newString, "utf-8");
7040
7040
  readFileState.set(filePath, { timestamp: fs36.statSync(filePath).mtimeMs });
@@ -7114,7 +7114,7 @@ ${diffView}`
7114
7114
  // src/tools/glob.ts
7115
7115
  var glob_exports = {};
7116
7116
  import * as fs37 from "node:fs";
7117
- import * as path37 from "node:path";
7117
+ import * as path38 from "node:path";
7118
7118
  function globMatch(pattern, filename) {
7119
7119
  const regexStr = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(/\{\{GLOBSTAR\}\}/g, ".*");
7120
7120
  try {
@@ -7140,12 +7140,12 @@ function findFiles(dir, pattern, limit, baseDir) {
7140
7140
  }
7141
7141
  for (const entry of entries) {
7142
7142
  if (truncated) return;
7143
- const fullPath = path37.join(currentDir, entry.name);
7143
+ const fullPath = path38.join(currentDir, entry.name);
7144
7144
  if (entry.isDirectory()) {
7145
7145
  if (VCS_DIRS.has(entry.name)) continue;
7146
7146
  walk(fullPath);
7147
7147
  } else if (entry.isFile()) {
7148
- const relativePath = path37.relative(baseDir, fullPath).replace(/\\/g, "/");
7148
+ const relativePath = path38.relative(baseDir, fullPath).replace(/\\/g, "/");
7149
7149
  const patternsToTry = [pattern];
7150
7150
  if (pattern.startsWith("**/")) {
7151
7151
  patternsToTry.push(pattern.slice(3));
@@ -7172,7 +7172,7 @@ function findFiles(dir, pattern, limit, baseDir) {
7172
7172
  };
7173
7173
  }
7174
7174
  function toRelativePath(absolutePath, cwd) {
7175
- if (absolutePath.startsWith(cwd + path37.sep)) {
7175
+ if (absolutePath.startsWith(cwd + path38.sep)) {
7176
7176
  return absolutePath.slice(cwd.length + 1);
7177
7177
  }
7178
7178
  return absolutePath;
@@ -7233,7 +7233,7 @@ ${filenames.join("\n")}${truncatedNote}`
7233
7233
  // src/tools/grep.ts
7234
7234
  var grep_exports = {};
7235
7235
  import { execFile as execFile2 } from "node:child_process";
7236
- import * as path38 from "node:path";
7236
+ import * as path39 from "node:path";
7237
7237
  function ripGrep(args2, searchPath, signal) {
7238
7238
  return new Promise((resolve10) => {
7239
7239
  const fullArgs = [...args2, searchPath];
@@ -7265,7 +7265,7 @@ function applyHeadLimit(items, limit, offset = 0) {
7265
7265
  };
7266
7266
  }
7267
7267
  function toRelativePath2(absolutePath, cwd) {
7268
- if (absolutePath.startsWith(cwd + path38.sep)) {
7268
+ if (absolutePath.startsWith(cwd + path39.sep)) {
7269
7269
  return absolutePath.slice(cwd.length + 1);
7270
7270
  }
7271
7271
  if (absolutePath.startsWith(cwd)) {
@@ -9934,7 +9934,7 @@ var init_web_fetch = __esm({
9934
9934
 
9935
9935
  // src/cron/tasks.ts
9936
9936
  import fs38 from "node:fs";
9937
- import path39 from "node:path";
9937
+ import path40 from "node:path";
9938
9938
  import crypto5 from "node:crypto";
9939
9939
  function getStorageDir() {
9940
9940
  return storageDir;
@@ -9989,7 +9989,7 @@ function readTasksFromDisk() {
9989
9989
  }
9990
9990
  }
9991
9991
  async function writeTasksToDisk(tasks2) {
9992
- const lockPath2 = path39.join(storageDir, "tasks.json.lock");
9992
+ const lockPath2 = path40.join(storageDir, "tasks.json.lock");
9993
9993
  await withFileLock(lockPath2, () => {
9994
9994
  const store = {
9995
9995
  version: 1,
@@ -10001,7 +10001,7 @@ async function writeTasksToDisk(tasks2) {
10001
10001
  }
10002
10002
  function initTaskStore(dir) {
10003
10003
  storageDir = dir;
10004
- tasksFilePath = path39.join(dir, "tasks.json");
10004
+ tasksFilePath = path40.join(dir, "tasks.json");
10005
10005
  if (!fs38.existsSync(dir)) {
10006
10006
  fs38.mkdirSync(dir, { recursive: true });
10007
10007
  }
@@ -10915,9 +10915,9 @@ async function executeAndDeliver(task, now, deps) {
10915
10915
  let filePath = promptText.slice(1).trim();
10916
10916
  try {
10917
10917
  const fs42 = await import("fs");
10918
- const path44 = await import("path");
10919
- if (!path44.isAbsolute(filePath)) {
10920
- filePath = path44.join(deps.sessions["config"].stateDir, filePath);
10918
+ const path45 = await import("path");
10919
+ if (!path45.isAbsolute(filePath)) {
10920
+ filePath = path45.join(deps.sessions["config"].stateDir, filePath);
10921
10921
  }
10922
10922
  promptText = fs42.readFileSync(filePath, "utf-8");
10923
10923
  console.log(`[cron] Loaded prompt from ${filePath} (${promptText.length} chars)`);
@@ -10946,15 +10946,15 @@ async function executeAndDeliver(task, now, deps) {
10946
10946
  let finalResult = result;
10947
10947
  if (task.postProcess) {
10948
10948
  try {
10949
- const path44 = await import("path");
10949
+ const path45 = await import("path");
10950
10950
  const fs42 = await import("fs");
10951
10951
  let scriptPath = task.postProcess;
10952
- if (!path44.isAbsolute(scriptPath)) {
10953
- scriptPath = path44.join(deps.sessions["config"].stateDir, scriptPath);
10952
+ if (!path45.isAbsolute(scriptPath)) {
10953
+ scriptPath = path45.join(deps.sessions["config"].stateDir, scriptPath);
10954
10954
  }
10955
- const resultsDirTmp = path44.join(getStorageDir(), "results");
10955
+ const resultsDirTmp = path45.join(getStorageDir(), "results");
10956
10956
  fs42.mkdirSync(resultsDirTmp, { recursive: true });
10957
- const inputFile = path44.join(resultsDirTmp, `${task.id}.input.txt`);
10957
+ const inputFile = path45.join(resultsDirTmp, `${task.id}.input.txt`);
10958
10958
  fs42.writeFileSync(inputFile, result, "utf-8");
10959
10959
  const { execFile: execFile3 } = await import("child_process");
10960
10960
  await new Promise((resolve10) => {
@@ -10983,10 +10983,10 @@ async function executeAndDeliver(task, now, deps) {
10983
10983
  }
10984
10984
  try {
10985
10985
  const fs42 = await import("fs");
10986
- const path44 = await import("path");
10987
- const resultsDir = path44.join(getStorageDir(), "results");
10986
+ const path45 = await import("path");
10987
+ const resultsDir = path45.join(getStorageDir(), "results");
10988
10988
  fs42.mkdirSync(resultsDir, { recursive: true });
10989
- const resultFile = path44.join(resultsDir, `${task.id}.json`);
10989
+ const resultFile = path45.join(resultsDir, `${task.id}.json`);
10990
10990
  fs42.writeFileSync(resultFile, JSON.stringify({
10991
10991
  taskId: task.id,
10992
10992
  description: task.description,
@@ -11235,13 +11235,13 @@ function registerCronTools() {
11235
11235
  },
11236
11236
  handler: async (args2) => {
11237
11237
  const fs42 = await import("fs");
11238
- const path44 = await import("path");
11239
- const resultsDir = path44.join(getStorageDir(), "results");
11238
+ const path45 = await import("path");
11239
+ const resultsDir = path45.join(getStorageDir(), "results");
11240
11240
  if (!fs42.existsSync(resultsDir)) {
11241
11241
  return { content: "\u6682\u65E0cron\u6267\u884C\u7ED3\u679C" };
11242
11242
  }
11243
11243
  if (args2.task_id) {
11244
- const file = path44.join(resultsDir, `${args2.task_id}.json`);
11244
+ const file = path45.join(resultsDir, `${args2.task_id}.json`);
11245
11245
  if (!fs42.existsSync(file)) {
11246
11246
  return { content: `\u4EFB\u52A1 ${args2.task_id} \u6682\u65E0\u6267\u884C\u7ED3\u679C`, isError: true };
11247
11247
  }
@@ -11257,7 +11257,7 @@ ${data.result}` };
11257
11257
  return { content: "\u6682\u65E0cron\u6267\u884C\u7ED3\u679C" };
11258
11258
  }
11259
11259
  const results = files.map((f2) => {
11260
- const data = JSON.parse(fs42.readFileSync(path44.join(resultsDir, f2), "utf-8"));
11260
+ const data = JSON.parse(fs42.readFileSync(path45.join(resultsDir, f2), "utf-8"));
11261
11261
  return `### ${data.description} (${data.taskId.slice(0, 8)})
11262
11262
  \u6267\u884C: ${data.executedAt} | \u7B2C${data.runCount}\u6B21
11263
11263
  ${data.result.slice(0, 500)}${data.result.length > 500 ? "..." : ""}`;
@@ -11311,6 +11311,7 @@ var init_tools = __esm({
11311
11311
 
11312
11312
  // src/tools/wechat/wx-query.ts
11313
11313
  var wx_query_exports = {};
11314
+ import { join as join34 } from "node:path";
11314
11315
  function getDescription() {
11315
11316
  return `\u67E5\u8BE2\u7FC0\u54E5\u7684\u5FAE\u4FE1\u6D88\u606F\uFF08\u7F13\u5B58\u89E3\u5BC6\u540E\u7684\u672C\u5730\u6570\u636E\u5E93\uFF09\u3002
11316
11317
 
@@ -11339,13 +11340,14 @@ function getDescription() {
11339
11340
  \u26A0\uFE0F \u9690\u79C1\u6CE8\u610F: \u79C1\u804A\u6D88\u606F\u4E0D\u66B4\u9732\u7ED9\u5176\u4ED6\u4EBA\uFF0C\u4EC5\u7528\u4E8E\u7FC0\u54E5\u81EA\u5DF1\u7684\u67E5\u8BE2\u3002
11340
11341
  \u5982\u679C\u67E5\u8BE2\u5230\u79C1\u804A\u5185\u5BB9\uFF0C\u4EC5\u544A\u77E5\u7FC0\u54E5\u672C\u4EBA\u3002`;
11341
11342
  }
11342
- var SCRIPT, PYTHON;
11343
+ var STATE_DIR, SCRIPT, PYTHON;
11343
11344
  var init_wx_query = __esm({
11344
11345
  "src/tools/wechat/wx-query.ts"() {
11345
11346
  "use strict";
11346
11347
  init_registry();
11347
11348
  init_live();
11348
- SCRIPT = "C:/Users/24045/.openclaw/engine/src/tools/wechat/wx_query.py";
11349
+ STATE_DIR = process.env.ENGINE7_STATE_DIR || process.env.OPENCLAW_STATE_DIR || join34(process.env.HOME || process.env.USERPROFILE || ".", ".engine7");
11350
+ SCRIPT = join34(STATE_DIR, "engine", "src", "tools", "wechat", "wx_query.py");
11349
11351
  PYTHON = "python3";
11350
11352
  registry.register({
11351
11353
  name: "wx_query",
@@ -11640,7 +11642,7 @@ __export(license_exports, {
11640
11642
  });
11641
11643
  import * as crypto6 from "node:crypto";
11642
11644
  import * as fs39 from "node:fs";
11643
- import * as path40 from "node:path";
11645
+ import * as path41 from "node:path";
11644
11646
  function loadLicense(stateDir, devMode) {
11645
11647
  if (_licenseChecked) return _cachedLicense;
11646
11648
  _licenseChecked = true;
@@ -11653,7 +11655,7 @@ function loadLicense(stateDir, devMode) {
11653
11655
  _cachedLicense = allActive;
11654
11656
  return allActive;
11655
11657
  }
11656
- const licensePath = path40.join(stateDir, "license.json");
11658
+ const licensePath = path41.join(stateDir, "license.json");
11657
11659
  if (!fs39.existsSync(licensePath)) {
11658
11660
  console.log("[license] No license.json found, running basic engine only");
11659
11661
  return null;
@@ -11709,7 +11711,7 @@ function isFeatureLicensed(featureId) {
11709
11711
  return f2?.active === true;
11710
11712
  }
11711
11713
  function getLicenseStatus(stateDir) {
11712
- const licensePath = path40.join(stateDir, "license.json");
11714
+ const licensePath = path41.join(stateDir, "license.json");
11713
11715
  if (!fs39.existsSync(licensePath)) {
11714
11716
  return { licensed: false, features: {} };
11715
11717
  }
@@ -11774,7 +11776,7 @@ __export(manager_exports, {
11774
11776
  McpManager: () => McpManager
11775
11777
  });
11776
11778
  import * as fs40 from "node:fs";
11777
- import * as path41 from "node:path";
11779
+ import * as path42 from "node:path";
11778
11780
  import { Client as Client3 } from "@modelcontextprotocol/sdk/client/index.js";
11779
11781
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
11780
11782
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
@@ -11807,9 +11809,9 @@ function convertInputSchema(inputSchema) {
11807
11809
  }
11808
11810
  function persistBinary(base64Data, mimeType, persistId) {
11809
11811
  const ext = mimeType?.split("/")[1] || "bin";
11810
- const dir = path41.join(process.env.ENGINE_STATE_DIR || ".engine", "mcp-blobs");
11812
+ const dir = path42.join(process.env.ENGINE_STATE_DIR || ".engine", "mcp-blobs");
11811
11813
  fs40.mkdirSync(dir, { recursive: true });
11812
- const filepath = path41.join(dir, `${persistId}.${ext}`);
11814
+ const filepath = path42.join(dir, `${persistId}.${ext}`);
11813
11815
  try {
11814
11816
  const buf = Buffer.from(base64Data, "base64");
11815
11817
  fs40.writeFileSync(filepath, buf);
@@ -12146,7 +12148,7 @@ __export(resources_exports, {
12146
12148
  registerMcpResourceTools: () => registerMcpResourceTools,
12147
12149
  unregisterMcpResourceTools: () => unregisterMcpResourceTools
12148
12150
  });
12149
- import * as path42 from "node:path";
12151
+ import * as path43 from "node:path";
12150
12152
  function registerMcpResourceTools(manager) {
12151
12153
  mcpManagerRef = manager;
12152
12154
  registry.register(listResourcesTool);
@@ -12164,7 +12166,7 @@ var init_resources = __esm({
12164
12166
  "use strict";
12165
12167
  init_registry();
12166
12168
  MAX_RESULT_CHARS2 = 1e5;
12167
- MEDIA_DIR = process.env.ENGINE_MEDIA_DIR || path42.join(process.env.ENGINE_STATE_DIR || ".engine", "media", "inbound");
12169
+ MEDIA_DIR = process.env.ENGINE_MEDIA_DIR || path43.join(process.env.ENGINE_STATE_DIR || ".engine", "media", "inbound");
12168
12170
  MCP_LIST_RESOURCES_TOOL = "mcp__list_resources";
12169
12171
  MCP_READ_RESOURCE_TOOL = "mcp__read_resource";
12170
12172
  mcpManagerRef = null;
@@ -12407,7 +12409,7 @@ __export(reply_blocklist_exports, {
12407
12409
  isUserBlocked: () => isUserBlocked
12408
12410
  });
12409
12411
  import { readFileSync as readFileSync26, writeFileSync as writeFileSync15, existsSync as existsSync24 } from "node:fs";
12410
- import { join as join36 } from "node:path";
12412
+ import { join as join38 } from "node:path";
12411
12413
  function ensureLoaded(workspace, configIds) {
12412
12414
  if (loaded) return;
12413
12415
  if (configIds?.length) {
@@ -12415,10 +12417,10 @@ function ensureLoaded(workspace, configIds) {
12415
12417
  if (!state.blockedUserIds.includes(id)) state.blockedUserIds.push(id);
12416
12418
  }
12417
12419
  }
12418
- const path44 = join36(workspace, ".reply-blocklist.json");
12420
+ const path45 = join38(workspace, ".reply-blocklist.json");
12419
12421
  try {
12420
- if (existsSync24(path44)) {
12421
- const raw = readFileSync26(path44, "utf-8");
12422
+ if (existsSync24(path45)) {
12423
+ const raw = readFileSync26(path45, "utf-8");
12422
12424
  const parsed = JSON.parse(raw);
12423
12425
  if (parsed.blockedUserIds) {
12424
12426
  for (const id of parsed.blockedUserIds) {
@@ -12434,9 +12436,9 @@ function ensureLoaded(workspace, configIds) {
12434
12436
  loaded = true;
12435
12437
  }
12436
12438
  function save(workspace) {
12437
- const path44 = join36(workspace, ".reply-blocklist.json");
12439
+ const path45 = join38(workspace, ".reply-blocklist.json");
12438
12440
  try {
12439
- writeFileSync15(path44, JSON.stringify(state, null, 2), "utf-8");
12441
+ writeFileSync15(path45, JSON.stringify(state, null, 2), "utf-8");
12440
12442
  } catch (err) {
12441
12443
  console.warn(`[reply-blocklist] Failed to save: ${err.message}`);
12442
12444
  }
@@ -13036,7 +13038,7 @@ var init_cognifold_intent_watcher = __esm({
13036
13038
  init_loader();
13037
13039
 
13038
13040
  // src/engine-startup.ts
13039
- import * as path43 from "node:path";
13041
+ import * as path44 from "node:path";
13040
13042
  import * as fs41 from "node:fs";
13041
13043
  import { fileURLToPath } from "node:url";
13042
13044
 
@@ -14380,11 +14382,11 @@ var DiscordAdapter = class _DiscordAdapter {
14380
14382
  /** 发送媒体附件(图片/文件/音频)— discord.js channel.send({ files }) */
14381
14383
  async sendFile(target, message, attachment) {
14382
14384
  const fs42 = await import("node:fs");
14383
- const path44 = await import("node:path");
14385
+ const path45 = await import("node:path");
14384
14386
  if (!fs42.existsSync(attachment.path)) {
14385
14387
  throw new Error(`File not found: ${attachment.path}`);
14386
14388
  }
14387
- const filename = attachment.filename || path44.basename(attachment.path);
14389
+ const filename = attachment.filename || path45.basename(attachment.path);
14388
14390
  const fileBuffer = fs42.readFileSync(attachment.path);
14389
14391
  const filePayload = {
14390
14392
  attachment: fileBuffer,
@@ -14826,11 +14828,11 @@ var FeishuAdapter = class _FeishuAdapter {
14826
14828
  /** 发送媒体附件(图片/文件) */
14827
14829
  async sendFile(target, message, attachment) {
14828
14830
  const fs42 = await import("node:fs");
14829
- const path44 = await import("node:path");
14831
+ const path45 = await import("node:path");
14830
14832
  if (!fs42.existsSync(attachment.path)) {
14831
14833
  throw new Error(`File not found: ${attachment.path}`);
14832
14834
  }
14833
- const filename = attachment.filename || path44.basename(attachment.path);
14835
+ const filename = attachment.filename || path45.basename(attachment.path);
14834
14836
  const fileBuffer = fs42.readFileSync(attachment.path);
14835
14837
  const receiveIdType = target.startsWith("ou_") ? "open_id" : "chat_id";
14836
14838
  const mimeType = attachment.mimeType || "application/octet-stream";
@@ -15662,7 +15664,7 @@ var WechatAdapter = class {
15662
15664
  this.config = config2;
15663
15665
  this.baseUrl = config2.baseUrl?.replace(/\/$/, "") || ILINK_BASE_URL;
15664
15666
  this.cdnBaseUrl = config2.cdnBaseUrl?.replace(/\/$/, "") || WEIXIN_CDN_BASE_URL;
15665
- this.stateDir = config2.stateDir || path4.join(os.homedir?.() || "/tmp", ".openclaw");
15667
+ this.stateDir = config2.stateDir || path4.join(os.homedir?.() || "/tmp", ".engine7");
15666
15668
  if (!fs5.existsSync(this.stateDir)) fs5.mkdirSync(this.stateDir, { recursive: true });
15667
15669
  }
15668
15670
  // --- ChannelAdapter interface ---
@@ -18911,8 +18913,8 @@ ${ep.episode || ep.summary}`,
18911
18913
  // src/handle-query.ts
18912
18914
  init_paths();
18913
18915
  import { readFileSync as readFileSync15, existsSync as existsSync12 } from "node:fs";
18914
- import { join as join20 } from "node:path";
18915
- import { resolve as resolve6 } from "node:path";
18916
+ import { join as join20, resolve as resolve6 } from "node:path";
18917
+ import * as path13 from "node:path";
18916
18918
  var contactMap = null;
18917
18919
  var externalChanWhitelist = null;
18918
18920
  function loadContactMap(workspace) {
@@ -18980,18 +18982,18 @@ function truncate(s2, maxLen) {
18980
18982
  }
18981
18983
  var externalChanRulesCache = null;
18982
18984
  function loadExternalChanRules(workspace) {
18983
- const path44 = join20(workspace, "prompts", "external-chan-rules.md");
18984
- if (externalChanRulesCache && externalChanRulesCache.path === path44) return externalChanRulesCache;
18985
+ const path45 = join20(workspace, "prompts", "external-chan-rules.md");
18986
+ if (externalChanRulesCache && externalChanRulesCache.path === path45) return externalChanRulesCache;
18985
18987
  let content = "";
18986
- if (existsSync12(path44)) {
18988
+ if (existsSync12(path45)) {
18987
18989
  try {
18988
- content = readFileSync15(path44, "utf-8").trim();
18990
+ content = readFileSync15(path45, "utf-8").trim();
18989
18991
  } catch (e) {
18990
18992
  console.warn(`[external-chan-rules] Failed to load: ${e}`);
18991
18993
  }
18992
18994
  }
18993
- externalChanRulesCache = { path: path44, content };
18994
- console.log(`[external-chan-rules] Loaded ${content.length} chars from ${path44}`);
18995
+ externalChanRulesCache = { path: path45, content };
18996
+ console.log(`[external-chan-rules] Loaded ${content.length} chars from ${path45}`);
18995
18997
  return externalChanRulesCache;
18996
18998
  }
18997
18999
  function getExternalChanRulesBlock(inboundMeta, workspace) {
@@ -19260,8 +19262,8 @@ ${text}` : text });
19260
19262
  console.log(`[${sessionId}] >>> query start (${messages.length} msgs in history)`);
19261
19263
  try {
19262
19264
  const { writeFileSync: writeFileSync17 } = await import("node:fs");
19263
- const { join: join39 } = await import("node:path");
19264
- const contextPath = join39(workspace, ".context-debug.txt");
19265
+ const { join: join41 } = await import("node:path");
19266
+ const contextPath = join41(workspace, ".context-debug.txt");
19265
19267
  const lines = [
19266
19268
  "=== Context Debug ===",
19267
19269
  `Time: ${(/* @__PURE__ */ new Date()).toISOString()}`,
@@ -19646,7 +19648,7 @@ stack: ${err.stack ?? "(none)"}`);
19646
19648
  }
19647
19649
  } catch (err) {
19648
19650
  try {
19649
- (await import("node:fs")).appendFileSync("C:\\Users\\24045\\.openclaw\\logs\\autoDream-debug.log", `[${(/* @__PURE__ */ new Date()).toISOString()}] [handle-query] autoDream trigger TRY-CATCH: ${err.message}
19651
+ (await import("node:fs")).appendFileSync(join20(process.env.ENGINE7_STATE_DIR || process.env.OPENCLAW_STATE_DIR || path13.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7"), "logs", "autoDream-debug.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] [handle-query] autoDream trigger TRY-CATCH: ${err.message}
19650
19652
  stack: ${err.stack ?? "(none)"}
19651
19653
  `);
19652
19654
  } catch {
@@ -20344,16 +20346,16 @@ var MessageDispatcher = class {
20344
20346
  };
20345
20347
 
20346
20348
  // src/cli-startup.ts
20347
- import * as path13 from "node:path";
20349
+ import * as path14 from "node:path";
20348
20350
  import * as fs13 from "node:fs";
20349
20351
  import * as readline2 from "node:readline";
20350
20352
  function getDailyLogPath(stateDir) {
20351
20353
  const dateStr = (/* @__PURE__ */ new Date()).toLocaleDateString("sv-SE", { timeZone: "Asia/Shanghai" });
20352
- return path13.join(stateDir, "logs", `engine-${dateStr}.log`);
20354
+ return path14.join(stateDir, "logs", `engine-${dateStr}.log`);
20353
20355
  }
20354
20356
  function setupFileLogging(stateDir) {
20355
20357
  const LOG_PATH = getDailyLogPath(stateDir);
20356
- fs13.mkdirSync(path13.join(stateDir, "logs"), { recursive: true });
20358
+ fs13.mkdirSync(path14.join(stateDir, "logs"), { recursive: true });
20357
20359
  const logStream = fs13.createWriteStream(LOG_PATH, { flags: "a" });
20358
20360
  logStream.on("error", (err) => console.error(`[log] Write error: ${err.message}`));
20359
20361
  function ts() {
@@ -20445,7 +20447,7 @@ function startCliLoop(deps, cliConfig, channelManager, dispatcher) {
20445
20447
 
20446
20448
  // src/session/session-history.ts
20447
20449
  import fs14 from "node:fs";
20448
- import path14 from "node:path";
20450
+ import path15 from "node:path";
20449
20451
  var BEIJING_OFFSET_MS = 8 * 36e5;
20450
20452
  var INJECTED_CONTENT_PATTERNS = [
20451
20453
  /【定时心跳】/,
@@ -20497,10 +20499,10 @@ function scopeMainJsonlPaths(sessions) {
20497
20499
  let latestArchive = null;
20498
20500
  if (current) {
20499
20501
  try {
20500
- const dir = path14.dirname(current);
20501
- const base = path14.basename(current);
20502
+ const dir = path15.dirname(current);
20503
+ const base = path15.basename(current);
20502
20504
  const archives = fs14.readdirSync(dir).filter((f2) => f2.startsWith(base + ".archived.")).sort();
20503
- if (archives.length > 0) latestArchive = path14.join(dir, archives[archives.length - 1]);
20505
+ if (archives.length > 0) latestArchive = path15.join(dir, archives[archives.length - 1]);
20504
20506
  } catch {
20505
20507
  }
20506
20508
  }
@@ -20747,7 +20749,7 @@ ${basePrompt}`;
20747
20749
 
20748
20750
  // src/nudge/plugin.ts
20749
20751
  import fs17 from "node:fs";
20750
- import path17 from "node:path";
20752
+ import path18 from "node:path";
20751
20753
 
20752
20754
  // src/nudge/judge.ts
20753
20755
  function shouldNudge(task, taskState, cfg) {
@@ -20916,10 +20918,10 @@ function formatDuration2(ms) {
20916
20918
 
20917
20919
  // src/nudge/session-state-reader.ts
20918
20920
  import fs15 from "node:fs";
20919
- import path15 from "node:path";
20921
+ import path16 from "node:path";
20920
20922
  function parseSessionStateFull(workspace, sessionStateFile) {
20921
20923
  const stateFile = sessionStateFile || "SESSION-STATE.md";
20922
- const statePath = path15.isAbsolute(stateFile) ? stateFile : path15.join(workspace, stateFile);
20924
+ const statePath = path16.isAbsolute(stateFile) ? stateFile : path16.join(workspace, stateFile);
20923
20925
  let content;
20924
20926
  try {
20925
20927
  content = fs15.readFileSync(statePath, "utf-8");
@@ -20974,13 +20976,13 @@ function taskIdFromTitle(title) {
20974
20976
 
20975
20977
  // src/calendar/db.ts
20976
20978
  import { DatabaseSync } from "node:sqlite";
20977
- import * as path16 from "node:path";
20979
+ import * as path17 from "node:path";
20978
20980
  import * as fs16 from "node:fs";
20979
20981
  var TZ_OFFSET_MS = 8 * 60 * 60 * 1e3;
20980
20982
  function openDb(workspace) {
20981
- const dir = path16.join(workspace, ".calendar");
20983
+ const dir = path17.join(workspace, ".calendar");
20982
20984
  fs16.mkdirSync(dir, { recursive: true });
20983
- const dbPath = path16.join(dir, "calendar.db");
20985
+ const dbPath = path17.join(dir, "calendar.db");
20984
20986
  const db = new DatabaseSync(dbPath);
20985
20987
  db.exec("PRAGMA journal_mode=WAL");
20986
20988
  db.exec(`CREATE TABLE IF NOT EXISTS events (
@@ -21069,7 +21071,7 @@ var NudgePlugin = class {
21069
21071
  provider;
21070
21072
  model;
21071
21073
  loadPrompt(workspace, promptFile) {
21072
- const promptPath = promptFile ? path17.isAbsolute(promptFile) ? promptFile : path17.join(workspace, promptFile) : path17.join(workspace, "prompts", "nudge-prompt.md");
21074
+ const promptPath = promptFile ? path18.isAbsolute(promptFile) ? promptFile : path18.join(workspace, promptFile) : path18.join(workspace, "prompts", "nudge-prompt.md");
21073
21075
  try {
21074
21076
  const content = fs17.readFileSync(promptPath, "utf-8").trim();
21075
21077
  if (content) {
@@ -21218,8 +21220,8 @@ var NudgePlugin = class {
21218
21220
  if (!isWaiting) {
21219
21221
  return { outcome: { outcome: "success" } };
21220
21222
  }
21221
- const nudgeDir = path17.join(this.workspace, ".nudge");
21222
- const notifPath = path17.join(nudgeDir, "stop-hook-notifications.json");
21223
+ const nudgeDir = path18.join(this.workspace, ".nudge");
21224
+ const notifPath = path18.join(nudgeDir, "stop-hook-notifications.json");
21223
21225
  try {
21224
21226
  if (!fs17.existsSync(nudgeDir)) fs17.mkdirSync(nudgeDir, { recursive: true });
21225
21227
  let notifs = [];
@@ -21288,7 +21290,7 @@ var NudgePlugin = class {
21288
21290
  * 已 notified 的不会再触发,等 agent 回复 "<id> 过期了" 由 cleanup 删。
21289
21291
  */
21290
21292
  collectDueStopHookNotifications() {
21291
- const notifPath = path17.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21293
+ const notifPath = path18.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21292
21294
  try {
21293
21295
  if (!fs17.existsSync(notifPath)) return null;
21294
21296
  const notifs = JSON.parse(fs17.readFileSync(notifPath, "utf-8"));
@@ -21327,7 +21329,7 @@ ${items}
21327
21329
  }
21328
21330
  /** 按 id 删除条目(stop-hook 实时清理用;正常删除路径,agent 回复即删) */
21329
21331
  removeNotificationsById(ids) {
21330
- const notifPath = path17.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21332
+ const notifPath = path18.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21331
21333
  try {
21332
21334
  if (!fs17.existsSync(notifPath)) return;
21333
21335
  const notifs = JSON.parse(fs17.readFileSync(notifPath, "utf-8"));
@@ -21347,7 +21349,7 @@ ${items}
21347
21349
  }
21348
21350
  /** 投递成功后标记 notified(防重复触发);不删除——删除只走 agent 回复 "<id> 过期了" */
21349
21351
  markNotified(ids) {
21350
- const notifPath = path17.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21352
+ const notifPath = path18.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21351
21353
  try {
21352
21354
  if (!fs17.existsSync(notifPath)) return;
21353
21355
  const notifs = JSON.parse(fs17.readFileSync(notifPath, "utf-8"));
@@ -21370,7 +21372,7 @@ ${items}
21370
21372
  */
21371
21373
  cleanupStaleNotificationsFromMessages(sessions) {
21372
21374
  try {
21373
- const notifPath = path17.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21375
+ const notifPath = path18.join(this.workspace, ".nudge", "stop-hook-notifications.json");
21374
21376
  if (!fs17.existsSync(notifPath)) return;
21375
21377
  const notifs = JSON.parse(fs17.readFileSync(notifPath, "utf-8"));
21376
21378
  if (notifs.length === 0) return;
@@ -21671,7 +21673,7 @@ ${items}
21671
21673
  // === state 持久化 ===
21672
21674
  loadState() {
21673
21675
  const stateFile = this.cfg.stateFile || "nudge-state.json";
21674
- const statePath = path17.isAbsolute(stateFile) ? stateFile : path17.join(this.workspace, stateFile);
21676
+ const statePath = path18.isAbsolute(stateFile) ? stateFile : path18.join(this.workspace, stateFile);
21675
21677
  try {
21676
21678
  const content = fs17.readFileSync(statePath, "utf-8");
21677
21679
  return JSON.parse(content);
@@ -21681,7 +21683,7 @@ ${items}
21681
21683
  }
21682
21684
  saveState(state2) {
21683
21685
  const stateFile = this.cfg.stateFile || "nudge-state.json";
21684
- const statePath = path17.isAbsolute(stateFile) ? stateFile : path17.join(this.workspace, stateFile);
21686
+ const statePath = path18.isAbsolute(stateFile) ? stateFile : path18.join(this.workspace, stateFile);
21685
21687
  fs17.writeFileSync(statePath, JSON.stringify(state2, null, 2), "utf-8");
21686
21688
  }
21687
21689
  newTaskState() {
@@ -21861,7 +21863,7 @@ ${items}
21861
21863
 
21862
21864
  // src/inner-voice/plugin.ts
21863
21865
  import fs21 from "node:fs";
21864
- import path21 from "node:path";
21866
+ import path22 from "node:path";
21865
21867
 
21866
21868
  // src/inner-voice/activity.ts
21867
21869
  function checkActivity(sessions, activeThresholdMs) {
@@ -21901,7 +21903,7 @@ function calcHintProb(min) {
21901
21903
 
21902
21904
  // src/inner-voice/emotional-state.ts
21903
21905
  import fs18 from "node:fs";
21904
- import path18 from "node:path";
21906
+ import path19 from "node:path";
21905
21907
  var NEUTRAL = 0.5;
21906
21908
  var DECAY_RATE = 0.17;
21907
21909
  var MAX_EVENTS = 20;
@@ -21952,7 +21954,7 @@ function initialState() {
21952
21954
  return { version: 1, mood: NEUTRAL, trend: "stable", updatedAt: nowIsoBj(), events: [] };
21953
21955
  }
21954
21956
  async function updateEmotionalState(workspace, sessions) {
21955
- const stateFile = path18.join(workspace, "inner-voice", "emotional-state.json");
21957
+ const stateFile = path19.join(workspace, "inner-voice", "emotional-state.json");
21956
21958
  const messages = readRecentMessages(sessions, RECENT_N);
21957
21959
  if (messages.length === 0) {
21958
21960
  console.log("[emotional-state] no messages");
@@ -21985,7 +21987,7 @@ async function updateEmotionalState(workspace, sessions) {
21985
21987
  function readRecentMessages(sessions, n) {
21986
21988
  const mainId = sessions.getSessionId("scope:main");
21987
21989
  if (!mainId) return [];
21988
- const file = path18.join(sessions.sessionsDir, `${mainId}.jsonl`);
21990
+ const file = path19.join(sessions.sessionsDir, `${mainId}.jsonl`);
21989
21991
  if (!fs18.existsSync(file)) return [];
21990
21992
  const lines = readLastNLines(file, n * 4 + 20);
21991
21993
  const entries = [];
@@ -22103,7 +22105,7 @@ function refreshHoursAgo(events) {
22103
22105
  }
22104
22106
  function appendMoodLog(workspace, state2, summary) {
22105
22107
  try {
22106
- const logPath = path18.join(workspace, "mood-history.log");
22108
+ const logPath = path19.join(workspace, "mood-history.log");
22107
22109
  const ts = formatBj(/* @__PURE__ */ new Date(), false);
22108
22110
  fs18.appendFileSync(logPath, `${ts} mood=${state2.mood.toFixed(2)} trend=${state2.trend} ${summary}
22109
22111
  `);
@@ -22120,7 +22122,7 @@ function loadJson(file) {
22120
22122
  }
22121
22123
  function saveJson(file, data) {
22122
22124
  try {
22123
- fs18.mkdirSync(path18.dirname(file), { recursive: true });
22125
+ fs18.mkdirSync(path19.dirname(file), { recursive: true });
22124
22126
  fs18.writeFileSync(file, JSON.stringify(data, null, 2));
22125
22127
  } catch (err) {
22126
22128
  console.warn(`[emotional-state] save failed: ${err.message}`);
@@ -22166,7 +22168,7 @@ function formatBj(d, withSec) {
22166
22168
 
22167
22169
  // src/inner-voice/topics-scorer.ts
22168
22170
  import fs19 from "node:fs";
22169
- import path19 from "node:path";
22171
+ import path20 from "node:path";
22170
22172
  var HALF_LIFE_DAYS = 3;
22171
22173
  var PROJECT_HALF_LIFE_DAYS = 1.5;
22172
22174
  var COOLDOWN_HOURS = 6;
@@ -22174,8 +22176,8 @@ var MAX_CHARS = 8e3;
22174
22176
  var SKIP_NAMES = /* @__PURE__ */ new Set(["MEMORY.md", "archive"]);
22175
22177
  var SKIP_DIRS = /* @__PURE__ */ new Set(["archive"]);
22176
22178
  function pickTopic(workspace, typeFilter, opts) {
22177
- const topicsDir = path19.join(workspace, "topics");
22178
- const usageFile = path19.join(workspace, "inner-voice", "topics-usage.json");
22179
+ const topicsDir = path20.join(workspace, "topics");
22180
+ const usageFile = path20.join(workspace, "inner-voice", "topics-usage.json");
22179
22181
  const files = scanTopics(topicsDir, typeFilter);
22180
22182
  if (files.length === 0) {
22181
22183
  console.log(`[topics-scorer] no topics found (type=${typeFilter})`);
@@ -22207,7 +22209,7 @@ function pickTopic(workspace, typeFilter, opts) {
22207
22209
  recency: Math.round(recency * 1e3) / 1e3,
22208
22210
  freq: Math.round(freq * 1e3) / 1e3,
22209
22211
  type: type2,
22210
- name: meta.name || path19.basename(relpath),
22212
+ name: meta.name || path20.basename(relpath),
22211
22213
  description: meta.description || "",
22212
22214
  mtime
22213
22215
  });
@@ -22265,14 +22267,14 @@ function scanTopics(topicsDir, typeFilter) {
22265
22267
  const out = [];
22266
22268
  const walk = (dir) => {
22267
22269
  for (const name of fs19.readdirSync(dir)) {
22268
- const full = path19.join(dir, name);
22270
+ const full = path20.join(dir, name);
22269
22271
  const stat4 = fs19.statSync(full);
22270
22272
  if (stat4.isDirectory()) {
22271
22273
  if (SKIP_DIRS.has(name)) continue;
22272
22274
  walk(full);
22273
22275
  } else {
22274
22276
  if (!name.endsWith(".md") || SKIP_NAMES.has(name)) continue;
22275
- const relpath = path19.relative(topicsDir, full).replace(/\\/g, "/");
22277
+ const relpath = path20.relative(topicsDir, full).replace(/\\/g, "/");
22276
22278
  if (typeFilter && !relpath.startsWith(typeFilter + "/") && !relpath.startsWith(typeFilter + "_")) continue;
22277
22279
  out.push({ relpath, fullpath: full });
22278
22280
  }
@@ -22317,7 +22319,7 @@ function loadJson2(file) {
22317
22319
  }
22318
22320
  function saveJson2(file, data) {
22319
22321
  try {
22320
- fs19.mkdirSync(path19.dirname(file), { recursive: true });
22322
+ fs19.mkdirSync(path20.dirname(file), { recursive: true });
22321
22323
  fs19.writeFileSync(file, JSON.stringify(data, null, 2));
22322
22324
  } catch (err) {
22323
22325
  console.warn(`[topics-scorer] usage save failed: ${err.message}`);
@@ -22326,21 +22328,21 @@ function saveJson2(file, data) {
22326
22328
 
22327
22329
  // src/inner-voice/memory-reader.ts
22328
22330
  import fs20 from "node:fs";
22329
- import path20 from "node:path";
22331
+ import path21 from "node:path";
22330
22332
  var US_HALF_LIFE_DAYS = 10;
22331
22333
  var US_MAX_LINES = 60;
22332
22334
  function readRecentMemory(workspace) {
22333
- const dir = path20.join(workspace, "memory");
22335
+ const dir = path21.join(workspace, "memory");
22334
22336
  const now = new Date(Date.now() + 8 * 36e5);
22335
22337
  const today = formatYmd(now);
22336
22338
  const yesterday = formatYmd(new Date(now.getTime() - 864e5));
22337
22339
  return {
22338
- today: readIfExists(path20.join(dir, `${today}.md`)),
22339
- yesterday: readIfExists(path20.join(dir, `${yesterday}.md`))
22340
+ today: readIfExists(path21.join(dir, `${today}.md`)),
22341
+ yesterday: readIfExists(path21.join(dir, `${yesterday}.md`))
22340
22342
  };
22341
22343
  }
22342
22344
  function sampleUs(workspace) {
22343
- const usFile = path20.join(workspace, "memory", "us.md");
22345
+ const usFile = path21.join(workspace, "memory", "us.md");
22344
22346
  let content;
22345
22347
  try {
22346
22348
  content = fs20.readFileSync(usFile, "utf-8");
@@ -22680,7 +22682,7 @@ var InnerVoicePlugin = class {
22680
22682
  }
22681
22683
  /** 读 workspace/prompts/my-inner-voice.md,不存在用 DEFAULT_PROMPT */
22682
22684
  loadPrompt(workspace) {
22683
- const promptPath = path21.join(workspace, "prompts", "my-inner-voice.md");
22685
+ const promptPath = path22.join(workspace, "prompts", "my-inner-voice.md");
22684
22686
  try {
22685
22687
  const content = fs21.readFileSync(promptPath, "utf-8").trim();
22686
22688
  if (content) {
@@ -22754,7 +22756,7 @@ var InnerVoicePlugin = class {
22754
22756
  console.warn(`[inner-voice] emotional-state failed: ${err.message}`);
22755
22757
  }
22756
22758
  try {
22757
- const content = fs21.readFileSync(path21.join(this.workspace, "SESSION-STATE.md"), "utf-8");
22759
+ const content = fs21.readFileSync(path22.join(this.workspace, "SESSION-STATE.md"), "utf-8");
22758
22760
  lines.push("\n--- SESSION-STATE\uFF08\u5C3E\u90E8\uFF09 ---");
22759
22761
  lines.push(content.slice(-2e3));
22760
22762
  } catch {
@@ -22865,7 +22867,7 @@ var InnerVoicePlugin = class {
22865
22867
  if (Math.random() >= activity.hintProb) {
22866
22868
  return { text: thought, hintTriggered: false, hintText: "" };
22867
22869
  }
22868
- const poolPath = path21.join(this.workspace, "inner-voice", "hints_pool.txt");
22870
+ const poolPath = path22.join(this.workspace, "inner-voice", "hints_pool.txt");
22869
22871
  let hint = "\u60F3\u4ED6\u5C31\u53D1\u6D88\u606F\u5427";
22870
22872
  try {
22871
22873
  const pool = fs21.readFileSync(poolPath, "utf-8").split("\n").map((s2) => s2.trim()).filter(Boolean);
@@ -22893,7 +22895,7 @@ var InnerVoicePlugin = class {
22893
22895
  try {
22894
22896
  const writer = sessions.getWriter(mainSessionId);
22895
22897
  const history = sessions.getHistory(mainSessionId);
22896
- const fullPath = path21.resolve(this.workspace, emoTopic.file);
22898
+ const fullPath = path22.resolve(this.workspace, emoTopic.file);
22897
22899
  const memories = [{
22898
22900
  path: fullPath,
22899
22901
  content: emoTopic.content,
@@ -22921,9 +22923,9 @@ var InnerVoicePlugin = class {
22921
22923
  /** 写 xiaoyi.log(格式对齐旧 memory_whisper.py,便于既有日志分析复用)。 */
22922
22924
  writeLog(status, delivered, activity, hintTriggered, hintText) {
22923
22925
  try {
22924
- const logDir = path21.join(this.workspace, "inner-voice");
22926
+ const logDir = path22.join(this.workspace, "inner-voice");
22925
22927
  fs21.mkdirSync(logDir, { recursive: true });
22926
- const logPath = path21.join(logDir, "xiaoyi.log");
22928
+ const logPath = path22.join(logDir, "xiaoyi.log");
22927
22929
  const ts = formatBeijingTs(/* @__PURE__ */ new Date());
22928
22930
  const hintStatus = hintTriggered ? `YES (${(hintText || "").trim()})` : "no";
22929
22931
  fs21.appendFileSync(
@@ -23462,7 +23464,7 @@ var PluginManager = class {
23462
23464
  // src/voice-chat/plugin.ts
23463
23465
  import { spawn as spawn4, exec } from "node:child_process";
23464
23466
  import net from "node:net";
23465
- import path22 from "node:path";
23467
+ import path23 from "node:path";
23466
23468
  import fs22 from "node:fs";
23467
23469
 
23468
23470
  // src/voice-chat/bridge.ts
@@ -23839,13 +23841,13 @@ var VoiceChatPlugin = class _VoiceChatPlugin {
23839
23841
  }
23840
23842
  getPythonDir() {
23841
23843
  const dir = import.meta.dirname;
23842
- const srcDir = path22.resolve(dir, "..", "src", "voice-chat", "python");
23843
- const localDir = path22.join(dir, "python");
23844
+ const srcDir = path23.resolve(dir, "..", "src", "voice-chat", "python");
23845
+ const localDir = path23.join(dir, "python");
23844
23846
  return fs22.existsSync(srcDir) ? srcDir : localDir;
23845
23847
  }
23846
23848
  startPython() {
23847
23849
  const pythonDir = this.getPythonDir();
23848
- const serverPy = path22.join(pythonDir, "server.py");
23850
+ const serverPy = path23.join(pythonDir, "server.py");
23849
23851
  const pythonBin = this.findPython();
23850
23852
  const args2 = [serverPy];
23851
23853
  if (this.config.pythonPort) args2.push("--port", String(this.config.pythonPort));
@@ -23930,7 +23932,7 @@ var VoiceChatPlugin = class _VoiceChatPlugin {
23930
23932
  init_BashTool();
23931
23933
  import { spawn as spawn5, exec as exec2 } from "node:child_process";
23932
23934
  import net2 from "node:net";
23933
- import path23 from "node:path";
23935
+ import path24 from "node:path";
23934
23936
  import fs23 from "node:fs";
23935
23937
 
23936
23938
  // src/memory/cognifold/config.ts
@@ -23969,11 +23971,11 @@ var CogniFoldClient = class {
23969
23971
  this.timeoutMs = timeoutMs;
23970
23972
  this.modelName = modelName;
23971
23973
  }
23972
- async req(path44, options = {}) {
23974
+ async req(path45, options = {}) {
23973
23975
  const ctrl = new AbortController();
23974
23976
  const timer = setTimeout(() => ctrl.abort(), this.timeoutMs);
23975
23977
  try {
23976
- const resp = await fetch(`${this.baseUrl}${path44}`, {
23978
+ const resp = await fetch(`${this.baseUrl}${path45}`, {
23977
23979
  ...options,
23978
23980
  signal: ctrl.signal,
23979
23981
  headers: {
@@ -24063,20 +24065,20 @@ var CogniFoldClient = class {
24063
24065
  });
24064
24066
  }
24065
24067
  /** 兼容老版命名 */
24066
- async recl(path44, options = {}) {
24067
- return this.req(path44, options);
24068
+ async recl(path45, options = {}) {
24069
+ return this.req(path45, options);
24068
24070
  }
24069
24071
  };
24070
24072
 
24071
24073
  // src/memory/cognifold/session-manager.ts
24072
24074
  import { readFile as readFile6, writeFile as writeFile5, mkdir as mkdir4 } from "node:fs/promises";
24073
- import { join as join23, dirname as dirname3 } from "node:path";
24075
+ import { join as join24, dirname as dirname3 } from "node:path";
24074
24076
  var CogniFoldSessionManager = class {
24075
24077
  constructor(workspacePath, config2, client) {
24076
24078
  this.workspacePath = workspacePath;
24077
24079
  this.config = config2;
24078
24080
  this.client = client;
24079
- this.sessionsDir = join23(workspacePath, ".cognifold", "sessions");
24081
+ this.sessionsDir = join24(workspacePath, ".cognifold", "sessions");
24080
24082
  }
24081
24083
  workspacePath;
24082
24084
  config;
@@ -24146,7 +24148,7 @@ var CogniFoldSessionManager = class {
24146
24148
  console.log(`[cognifold] Created new session for scope "${scope}": ${newSession.sessionId}`);
24147
24149
  }
24148
24150
  getFilePath(scope) {
24149
- return join23(this.sessionsDir, `${scope}.json`);
24151
+ return join24(this.sessionsDir, `${scope}.json`);
24150
24152
  }
24151
24153
  async writeFileSafe(filePath, data) {
24152
24154
  try {
@@ -24345,16 +24347,16 @@ var CogniFoldPlugin = class {
24345
24347
  const dir = import.meta.dirname;
24346
24348
  const candidates = [
24347
24349
  // 从 dist/ 往回找 src
24348
- path23.resolve(dir, "..", "src", "memory", "cognifold", "python"),
24349
- path23.resolve(dir, "..", "..", "src", "memory", "cognifold", "python"),
24350
- path23.resolve(dir, "..", "..", "..", "src", "memory", "cognifold", "python"),
24350
+ path24.resolve(dir, "..", "src", "memory", "cognifold", "python"),
24351
+ path24.resolve(dir, "..", "..", "src", "memory", "cognifold", "python"),
24352
+ path24.resolve(dir, "..", "..", "..", "src", "memory", "cognifold", "python"),
24351
24353
  // 从 src/memory/cognifold/ 找本地
24352
- path23.join(dir, "python"),
24354
+ path24.join(dir, "python"),
24353
24355
  // 从 dist/memory/cognifold/ 找本地
24354
- path23.resolve(dir, "python")
24356
+ path24.resolve(dir, "python")
24355
24357
  ];
24356
24358
  for (const candidate of candidates) {
24357
- if (fs23.existsSync(path23.join(candidate, "cognifold"))) {
24359
+ if (fs23.existsSync(path24.join(candidate, "cognifold"))) {
24358
24360
  return candidate;
24359
24361
  }
24360
24362
  }
@@ -24380,7 +24382,7 @@ var CogniFoldPlugin = class {
24380
24382
  const pythonBin = this.findPython();
24381
24383
  console.log(`[cognifold] Starting Python: ${pythonBin} ${args2.join(" ")}`);
24382
24384
  console.log(`[cognifold] Python dir: ${pythonDir}`);
24383
- if (!fs23.existsSync(path23.join(pythonDir, "cognifold"))) {
24385
+ if (!fs23.existsSync(path24.join(pythonDir, "cognifold"))) {
24384
24386
  console.error(`[cognifold] FATAL: Python module not found at ${pythonDir}/cognifold`);
24385
24387
  throw new Error(`cognifold: python module not found`);
24386
24388
  }
@@ -24391,7 +24393,7 @@ var CogniFoldPlugin = class {
24391
24393
  if (this.config.llm?.baseUrl) {
24392
24394
  childEnv["OPENAI_BASE_URL"] = this.config.llm.baseUrl;
24393
24395
  }
24394
- const envFile = path23.join(pythonDir, ".env");
24396
+ const envFile = path24.join(pythonDir, ".env");
24395
24397
  try {
24396
24398
  if (fs23.existsSync(envFile)) {
24397
24399
  const envContent = fs23.readFileSync(envFile, "utf-8");
@@ -24463,7 +24465,7 @@ var CogniFoldPlugin = class {
24463
24465
  init_BashTool();
24464
24466
  import { spawn as spawn6 } from "node:child_process";
24465
24467
  import net3 from "node:net";
24466
- import path24 from "node:path";
24468
+ import path25 from "node:path";
24467
24469
  import fs24 from "node:fs";
24468
24470
 
24469
24471
  // src/memory/everos/config.ts
@@ -24671,8 +24673,8 @@ var EverosPlugin = class {
24671
24673
  }, 3e5);
24672
24674
  }
24673
24675
  async startEveros() {
24674
- const pythonDir = path24.dirname(this.config.lancedbPath);
24675
- const configPath2 = path24.join(pythonDir, "config.toml");
24676
+ const pythonDir = path25.dirname(this.config.lancedbPath);
24677
+ const configPath2 = path25.join(pythonDir, "config.toml");
24676
24678
  await this.ensureFcntlCompat();
24677
24679
  const venvPython = this.findVenvPython();
24678
24680
  const everosBin = venvPython.replace(/python\.exe$/, "everos.exe");
@@ -24761,19 +24763,19 @@ var EverosPlugin = class {
24761
24763
  return child;
24762
24764
  }
24763
24765
  findVenvPython() {
24764
- const stateDir = process.env.OPENCLAW_STATE_DIR || path24.join(process.env.HOME || process.env.USERPROFILE || ".", ".openclaw");
24766
+ const stateDir = (process.env.ENGINE7_STATE_DIR ?? process.env.OPENCLAW_STATE_DIR) || path25.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7");
24765
24767
  if (process.platform === "win32") {
24766
- return path24.join(stateDir, "everos-venv", "Scripts", "python.exe");
24768
+ return path25.join(stateDir, "everos-venv", "Scripts", "python.exe");
24767
24769
  }
24768
- return path24.join(stateDir, "everos-venv", "bin", "python");
24770
+ return path25.join(stateDir, "everos-venv", "bin", "python");
24769
24771
  }
24770
24772
  /** 检测 venv 是否存在,不存在就自动创建 + 装 EverOS */
24771
24773
  async ensureVenv() {
24772
24774
  const venvPython = this.findVenvPython();
24773
24775
  if (fs24.existsSync(venvPython)) return;
24774
- const stateDir = process.env.OPENCLAW_STATE_DIR || path24.join(process.env.HOME || process.env.USERPROFILE || ".", ".openclaw");
24775
- const venvDir = path24.join(stateDir, "everos-venv");
24776
- const everosSrc = path24.join(stateDir, "workspace", "research", "EverOS");
24776
+ const stateDir = (process.env.ENGINE7_STATE_DIR ?? process.env.OPENCLAW_STATE_DIR) || path25.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7");
24777
+ const venvDir = path25.join(stateDir, "everos-venv");
24778
+ const everosSrc = path25.join(stateDir, "workspace", "research", "EverOS");
24777
24779
  console.log(`[everos] venv not found at ${venvDir}, auto-creating...`);
24778
24780
  console.log(`[everos] \u23F3 This may take a few minutes on first run...`);
24779
24781
  const pyCandidates = process.platform === "win32" ? ["python", "python3", "C:\\Python314\\python.exe", "C:\\Python313\\python.exe", "C:\\Python312\\python.exe"] : ["python3", "python"];
@@ -24795,8 +24797,8 @@ var EverosPlugin = class {
24795
24797
  console.log(`[everos] Creating venv with ${sysPython}...`);
24796
24798
  const { execSync: execSync3 } = await import("node:child_process");
24797
24799
  execSync3(`"${sysPython}" -m venv "${venvDir}"`, { stdio: "pipe", shell: true });
24798
- const pip = process.platform === "win32" ? path24.join(venvDir, "Scripts", "pip.exe") : path24.join(venvDir, "bin", "pip");
24799
- const everosReq = path24.join(this.getPythonDir(), "requirements.txt");
24800
+ const pip = process.platform === "win32" ? path25.join(venvDir, "Scripts", "pip.exe") : path25.join(venvDir, "bin", "pip");
24801
+ const everosReq = path25.join(this.getPythonDir(), "requirements.txt");
24800
24802
  if (fs24.existsSync(everosReq)) {
24801
24803
  console.log(`[everos] Installing from requirements.txt...`);
24802
24804
  execSync3(`"${pip}" install -r "${everosReq}" -q`, { stdio: "pipe", shell: true, timeout: 3e5 });
@@ -24813,12 +24815,12 @@ var EverosPlugin = class {
24813
24815
  getPythonDir() {
24814
24816
  const dir = import.meta.dirname;
24815
24817
  const candidates = [
24816
- path24.join(dir, "python"),
24817
- path24.resolve(dir, "..", "src", "memory", "everos", "python"),
24818
- path24.resolve(dir, "..", "..", "..", "src", "memory", "everos", "python")
24818
+ path25.join(dir, "python"),
24819
+ path25.resolve(dir, "..", "src", "memory", "everos", "python"),
24820
+ path25.resolve(dir, "..", "..", "..", "src", "memory", "everos", "python")
24819
24821
  ];
24820
24822
  for (const candidate of candidates) {
24821
- if (fs24.existsSync(path24.join(candidate, "agentic_server.py"))) {
24823
+ if (fs24.existsSync(path25.join(candidate, "agentic_server.py"))) {
24822
24824
  return candidate;
24823
24825
  }
24824
24826
  }
@@ -24827,11 +24829,11 @@ var EverosPlugin = class {
24827
24829
  async ensureFcntlCompat() {
24828
24830
  if (process.platform !== "win32") return;
24829
24831
  const venvPython = this.findVenvPython();
24830
- const venvDir = path24.dirname(path24.dirname(venvPython));
24831
- const sitePackages = path24.join(venvDir, "Lib", "site-packages");
24832
- const target = path24.join(sitePackages, "fcntl.py");
24832
+ const venvDir = path25.dirname(path25.dirname(venvPython));
24833
+ const sitePackages = path25.join(venvDir, "Lib", "site-packages");
24834
+ const target = path25.join(sitePackages, "fcntl.py");
24833
24835
  if (fs24.existsSync(target)) return;
24834
- const source = path24.join(this.getPythonDir(), "fcntl_compat.py");
24836
+ const source = path25.join(this.getPythonDir(), "fcntl_compat.py");
24835
24837
  if (fs24.existsSync(source)) {
24836
24838
  try {
24837
24839
  fs24.copyFileSync(source, target);
@@ -24881,7 +24883,7 @@ var EverosPlugin = class {
24881
24883
  init_task_manager();
24882
24884
 
24883
24885
  // src/skills/scanner.ts
24884
- import * as path25 from "node:path";
24886
+ import * as path26 from "node:path";
24885
24887
  import * as fs25 from "node:fs";
24886
24888
  function scanSkills(skillsDir) {
24887
24889
  if (!fs25.existsSync(skillsDir)) {
@@ -24892,7 +24894,7 @@ function scanSkills(skillsDir) {
24892
24894
  const skills = [];
24893
24895
  for (const entry of entries) {
24894
24896
  if (!entry.isDirectory()) continue;
24895
- const skillMdPath = path25.join(skillsDir, entry.name, "SKILL.md");
24897
+ const skillMdPath = path26.join(skillsDir, entry.name, "SKILL.md");
24896
24898
  if (!fs25.existsSync(skillMdPath)) continue;
24897
24899
  try {
24898
24900
  const content = fs25.readFileSync(skillMdPath, "utf-8");
@@ -24960,7 +24962,7 @@ function parseFrontmatter2(content) {
24960
24962
  // src/tools/SkillTool/SkillTool.ts
24961
24963
  init_registry();
24962
24964
  import * as fs26 from "node:fs";
24963
- import * as path26 from "node:path";
24965
+ import * as path27 from "node:path";
24964
24966
 
24965
24967
  // src/tools/SkillTool/constants.ts
24966
24968
  var SKILL_TOOL_NAME2 = "Skill";
@@ -25037,12 +25039,12 @@ Important:
25037
25039
  `;
25038
25040
  }
25039
25041
  function loadSkillContent(skillName) {
25040
- const skillMdPath = path26.join(skillsDirPath, skillName, "SKILL.md");
25042
+ const skillMdPath = path27.join(skillsDirPath, skillName, "SKILL.md");
25041
25043
  if (!fs26.existsSync(skillMdPath)) return null;
25042
25044
  const content = fs26.readFileSync(skillMdPath, "utf-8");
25043
25045
  const bodyMatch = content.match(/^---\s*\n[\s\S]*?\n---\s*\n([\s\S]*)/);
25044
25046
  const body = bodyMatch ? bodyMatch[1] : content;
25045
- const skillDir = path26.dirname(skillMdPath);
25047
+ const skillDir = path27.dirname(skillMdPath);
25046
25048
  const normalizedDir = process.platform === "win32" ? skillDir.replace(/\\/g, "/") : skillDir;
25047
25049
  let finalContent = `Base directory for this skill: ${normalizedDir}
25048
25050
 
@@ -25317,9 +25319,9 @@ Examples:
25317
25319
  init_registry();
25318
25320
  init_live();
25319
25321
  import fs27 from "node:fs";
25320
- import path27 from "node:path";
25322
+ import path28 from "node:path";
25321
25323
  function getHusbandFeishuId(workspace) {
25322
- const contactsPath = path27.join(workspace, "prompts", "contacts.md");
25324
+ const contactsPath = path28.join(workspace, "prompts", "contacts.md");
25323
25325
  try {
25324
25326
  const text = fs27.readFileSync(contactsPath, "utf-8");
25325
25327
  const m2 = text.match(/\|\s*翀哥\s*\|\s*(ou_[a-f0-9]+)\s*\|/);
@@ -25522,7 +25524,7 @@ Examples:
25522
25524
  init_live();
25523
25525
  init_registry();
25524
25526
  import * as fs28 from "node:fs";
25525
- import * as path28 from "node:path";
25527
+ import * as path29 from "node:path";
25526
25528
  var MIME_MAP = {
25527
25529
  ".jpg": "jpeg",
25528
25530
  ".jpeg": "jpeg",
@@ -25534,7 +25536,7 @@ var MIME_MAP = {
25534
25536
  function resolveLatestImage(specifiedPath, mediaDir) {
25535
25537
  if (specifiedPath && fs28.existsSync(specifiedPath)) return specifiedPath;
25536
25538
  if (!fs28.existsSync(mediaDir)) return null;
25537
- const files = fs28.readdirSync(mediaDir).filter((f2) => /\.(jpg|jpeg|png|webp|gif|bmp)$/i.test(f2)).map((f2) => ({ name: f2, p: path28.join(mediaDir, f2), mtime: fs28.statSync(path28.join(mediaDir, f2)).mtimeMs })).sort((a, b2) => b2.mtime - a.mtime);
25539
+ const files = fs28.readdirSync(mediaDir).filter((f2) => /\.(jpg|jpeg|png|webp|gif|bmp)$/i.test(f2)).map((f2) => ({ name: f2, p: path29.join(mediaDir, f2), mtime: fs28.statSync(path29.join(mediaDir, f2)).mtimeMs })).sort((a, b2) => b2.mtime - a.mtime);
25538
25540
  return files[0]?.p || null;
25539
25541
  }
25540
25542
  registry.register({
@@ -25558,13 +25560,13 @@ registry.register({
25558
25560
  if (!provider?.streamChat) {
25559
25561
  return { content: "Error: provider \u4E0D\u53EF\u7528\u3002", isError: true };
25560
25562
  }
25561
- const mediaDir = path28.join(ctx.stateDir, "media", "inbound");
25563
+ const mediaDir = path29.join(ctx.stateDir, "media", "inbound");
25562
25564
  const imagePath = resolveLatestImage(args2.image_path, mediaDir);
25563
25565
  if (!imagePath) {
25564
25566
  return { content: "Error: no image found. Provide image_path or ensure media/inbound has images.", isError: true };
25565
25567
  }
25566
25568
  const rawPrompt = args2.prompt?.trim() || "\u63CF\u8FF0\u8FD9\u5F20\u56FE\u7247\u7684\u5185\u5BB9";
25567
- const ext = path28.extname(imagePath).toLowerCase();
25569
+ const ext = path29.extname(imagePath).toLowerCase();
25568
25570
  const mime = MIME_MAP[ext] || "jpeg";
25569
25571
  const imgB64 = fs28.readFileSync(imagePath).toString("base64");
25570
25572
  const userMsg = {
@@ -25604,13 +25606,13 @@ init_registry();
25604
25606
  import { execFile } from "node:child_process";
25605
25607
  import { promisify } from "node:util";
25606
25608
  import * as fs29 from "node:fs";
25607
- import * as path29 from "node:path";
25609
+ import * as path30 from "node:path";
25608
25610
  import * as os3 from "node:os";
25609
25611
  var execFileAsync = promisify(execFile);
25610
- var VOICE_DIR = path29.join(os3.tmpdir(), "engine-voice");
25612
+ var VOICE_DIR = path30.join(os3.tmpdir(), "engine-voice");
25611
25613
  async function ttsCosyvoice(text, apiKey, model, voice, workspaceId) {
25612
25614
  fs29.mkdirSync(VOICE_DIR, { recursive: true });
25613
- const output = path29.join(VOICE_DIR, `tts_${Date.now()}.wav`);
25615
+ const output = path30.join(VOICE_DIR, `tts_${Date.now()}.wav`);
25614
25616
  const script = `
25615
25617
  import sys, json, wave, time, threading
25616
25618
  import dashscope
@@ -25675,7 +25677,7 @@ var GPTSOVITS_REF_TEXT = "\u6625\u7720\u4E0D\u89C9\u6653\uFF0C\u5904\u5904\u95FB
25675
25677
  var GPTSOVITS_REF_LANG = "zh";
25676
25678
  async function ttsGptsovits(text) {
25677
25679
  fs29.mkdirSync(VOICE_DIR, { recursive: true });
25678
- const output = path29.join(VOICE_DIR, `tts_${Date.now()}.wav`);
25680
+ const output = path30.join(VOICE_DIR, `tts_${Date.now()}.wav`);
25679
25681
  const params = new URLSearchParams({
25680
25682
  text,
25681
25683
  text_language: "zh",
@@ -25692,7 +25694,7 @@ async function ttsGptsovits(text) {
25692
25694
  var EDGE_VOICE = "zh-CN-XiaoxiaoNeural";
25693
25695
  async function ttsEdge(text) {
25694
25696
  fs29.mkdirSync(VOICE_DIR, { recursive: true });
25695
- const output = path29.join(VOICE_DIR, `tts_${Date.now()}.mp3`);
25697
+ const output = path30.join(VOICE_DIR, `tts_${Date.now()}.mp3`);
25696
25698
  const script = `
25697
25699
  import asyncio, edge_tts, sys
25698
25700
  async def main():
@@ -25785,7 +25787,7 @@ registry.register({
25785
25787
  } catch (e) {
25786
25788
  return { content: `TTS failed: ${e.message}`, isError: true };
25787
25789
  }
25788
- const ext = path29.extname(audioPath).toLowerCase();
25790
+ const ext = path30.extname(audioPath).toLowerCase();
25789
25791
  const mimeMap = { ".mp3": "audio/mpeg", ".wav": "audio/wav", ".m4a": "audio/mp4", ".ogg": "audio/ogg" };
25790
25792
  const mimeType = mimeMap[ext] || "audio/mpeg";
25791
25793
  const sizeKB = fs29.statSync(audioPath).size / 1024;
@@ -25816,7 +25818,7 @@ registry.register({
25816
25818
  init_live();
25817
25819
  init_registry();
25818
25820
  import * as fs30 from "node:fs";
25819
- import * as path30 from "node:path";
25821
+ import * as path31 from "node:path";
25820
25822
  var FAL_KEY = "3b848fc6-bee5-46e5-8db7-ae81ac16dc28:2f1f15cf394db2d32c9bb9a4f23f3bee";
25821
25823
  var FAL_ENDPOINT = "https://fal.run/xai/grok-imagine-image/edit";
25822
25824
  var DEFAULT_RESOLUTION = "1k";
@@ -25932,7 +25934,7 @@ registry.register({
25932
25934
  const REFERENCES = getReferences(ctx);
25933
25935
  const refName = args2.reference || "default";
25934
25936
  const refEntry = REFERENCES.find((r) => r.name === refName) || REFERENCES[0];
25935
- const refPath = path30.join(ctx.workspace, refEntry.p);
25937
+ const refPath = path31.join(ctx.workspace, refEntry.p);
25936
25938
  if (!fs30.existsSync(refPath)) {
25937
25939
  return { content: `Error: reference image not found at ${refPath}`, isError: true };
25938
25940
  }
@@ -25951,10 +25953,10 @@ registry.register({
25951
25953
  } catch (err) {
25952
25954
  return { content: `Selfie generation failed: ${err.message}`, isError: true };
25953
25955
  }
25954
- const imagesDir = path30.join(ctx.workspace, "images");
25956
+ const imagesDir = path31.join(ctx.workspace, "images");
25955
25957
  if (!fs30.existsSync(imagesDir)) fs30.mkdirSync(imagesDir, { recursive: true });
25956
25958
  const filename = `selfie_${Date.now()}.jpg`;
25957
- const outputPath = path30.join(imagesDir, filename);
25959
+ const outputPath = path31.join(imagesDir, filename);
25958
25960
  fs30.writeFileSync(outputPath, imageBuffer);
25959
25961
  const mgr = ctx.channelManager;
25960
25962
  if (mgr) {
@@ -25966,11 +25968,11 @@ registry.register({
25966
25968
  mimeType: "image/jpeg"
25967
25969
  });
25968
25970
  } catch (err) {
25969
- return { content: `Selfie generated but send failed: ${err.message}. Image: ${path30.resolve(outputPath)}`, isError: false };
25971
+ return { content: `Selfie generated but send failed: ${err.message}. Image: ${path31.resolve(outputPath)}`, isError: false };
25970
25972
  }
25971
25973
  return { content: `Selfie sent! Mode: ${mode}, Provider: ${getProvider(ctx)}, Ref: ${refEntry.name}` };
25972
25974
  }
25973
- return { content: `Selfie generated! Mode: ${mode}, Ref: ${refEntry.name}. Image: ${path30.resolve(outputPath)}` };
25975
+ return { content: `Selfie generated! Mode: ${mode}, Ref: ${refEntry.name}. Image: ${path31.resolve(outputPath)}` };
25974
25976
  },
25975
25977
  isConcurrencySafe: () => false,
25976
25978
  interruptBehavior: () => "block",
@@ -26437,14 +26439,14 @@ init_planModeState();
26437
26439
 
26438
26440
  // src/utils/plans.ts
26439
26441
  import * as fs32 from "node:fs";
26440
- import * as path32 from "node:path";
26442
+ import * as path33 from "node:path";
26441
26443
  import * as crypto4 from "node:crypto";
26442
26444
  var MAX_SLUG_RETRIES = 10;
26443
26445
  function generateSlug() {
26444
26446
  return crypto4.randomBytes(4).toString("hex");
26445
26447
  }
26446
26448
  function getPlansDirectory(stateDir) {
26447
- const plansDir = path32.join(stateDir, "plans");
26449
+ const plansDir = path33.join(stateDir, "plans");
26448
26450
  fs32.mkdirSync(plansDir, { recursive: true });
26449
26451
  return plansDir;
26450
26452
  }
@@ -26455,7 +26457,7 @@ function getPlanSlug(sessionId, stateDir) {
26455
26457
  const plansDir = getPlansDirectory(stateDir);
26456
26458
  for (let i = 0; i < MAX_SLUG_RETRIES; i++) {
26457
26459
  slug = generateSlug();
26458
- const filePath = path32.join(plansDir, `${slug}.md`);
26460
+ const filePath = path33.join(plansDir, `${slug}.md`);
26459
26461
  if (!fs32.existsSync(filePath)) {
26460
26462
  break;
26461
26463
  }
@@ -26467,9 +26469,9 @@ function getPlanSlug(sessionId, stateDir) {
26467
26469
  function getPlanFilePath(sessionId, stateDir, agentId) {
26468
26470
  const slug = getPlanSlug(sessionId, stateDir);
26469
26471
  if (!agentId) {
26470
- return path32.join(getPlansDirectory(stateDir), `${slug}.md`);
26472
+ return path33.join(getPlansDirectory(stateDir), `${slug}.md`);
26471
26473
  }
26472
- return path32.join(getPlansDirectory(stateDir), `${slug}-agent-${agentId}.md`);
26474
+ return path33.join(getPlansDirectory(stateDir), `${slug}-agent-${agentId}.md`);
26473
26475
  }
26474
26476
  function getPlan(sessionId, stateDir, agentId) {
26475
26477
  const filePath = getPlanFilePath(sessionId, stateDir, agentId);
@@ -27684,9 +27686,10 @@ async function startEngine(config2, opts) {
27684
27686
  process.env.ENGINE_MEDIA_DIR = config2.mediaDir;
27685
27687
  process.env.ENGINE7_WORKSPACE = config2.workspace;
27686
27688
  process.env.OPENCLAW_WORKSPACE = config2.workspace;
27687
- fs41.mkdirSync(path43.join(config2.stateDir, "agents", "main", "memory"), { recursive: true });
27688
- fs41.mkdirSync(path43.join(config2.stateDir, "agents", "main", "sessions"), { recursive: true });
27689
- fs41.mkdirSync(path43.join(config2.stateDir, "logs"), { recursive: true });
27689
+ process.env.ENGINE7_STATE_DIR = config2.stateDir;
27690
+ fs41.mkdirSync(path44.join(config2.stateDir, "agents", "main", "memory"), { recursive: true });
27691
+ fs41.mkdirSync(path44.join(config2.stateDir, "agents", "main", "sessions"), { recursive: true });
27692
+ fs41.mkdirSync(path44.join(config2.stateDir, "logs"), { recursive: true });
27690
27693
  fs41.mkdirSync(config2.workspace, { recursive: true });
27691
27694
  fs41.mkdirSync(config2.mediaDir, { recursive: true });
27692
27695
  try {
@@ -27796,7 +27799,7 @@ async function startEngine(config2, opts) {
27796
27799
  const { initSessionMemory: initSessionMemory2 } = await Promise.resolve().then(() => (init_sessionMemory(), sessionMemory_exports));
27797
27800
  initSessionMemory2({
27798
27801
  workspace: config2.workspace,
27799
- stateDir: path43.join(config2.stateDir, "session-memory"),
27802
+ stateDir: path44.join(config2.stateDir, "session-memory"),
27800
27803
  provider,
27801
27804
  model: config2.provider.modelId || config2.model || "deepseek-v4-flash",
27802
27805
  features: config2.profile.features
@@ -27826,9 +27829,9 @@ async function startEngine(config2, opts) {
27826
27829
  if (config2.hooks) {
27827
27830
  loadHooksFromConfig({ hooks: config2.hooks });
27828
27831
  }
27829
- const hooksPath = path43.join(config2.workspace, ".hooks.json");
27832
+ const hooksPath = path44.join(config2.workspace, ".hooks.json");
27830
27833
  loadHooksFromFile(hooksPath);
27831
- const settingsHooksPath = path43.join(config2.stateDir, "settings.json");
27834
+ const settingsHooksPath = path44.join(config2.stateDir, "settings.json");
27832
27835
  loadHooksFromFile(settingsHooksPath);
27833
27836
  console.log(`[hooks] Loaded hooks configuration`);
27834
27837
  registerCallbackHook("PreCompact", {
@@ -27842,15 +27845,15 @@ async function startEngine(config2, opts) {
27842
27845
  const bjTime = new Date(now.getTime() + (bjOffset + now.getTimezoneOffset()) * 6e4);
27843
27846
  const dateStr = `${bjTime.getFullYear()}-${String(bjTime.getMonth() + 1).padStart(2, "0")}-${String(bjTime.getDate()).padStart(2, "0")}`;
27844
27847
  const timeStr = `${String(bjTime.getHours()).padStart(2, "0")}:${String(bjTime.getMinutes()).padStart(2, "0")}`;
27845
- const dailyDir = path43.join(workspace, "memory", "daily");
27846
- const dailyPath = path43.join(dailyDir, `${dateStr}.md`);
27848
+ const dailyDir = path44.join(workspace, "memory", "daily");
27849
+ const dailyPath = path44.join(dailyDir, `${dateStr}.md`);
27847
27850
  try {
27848
27851
  const fs42 = await import("node:fs");
27849
27852
  if (!fs42.existsSync(dailyDir)) {
27850
27853
  fs42.mkdirSync(dailyDir, { recursive: true });
27851
27854
  }
27852
- const sessionsDir = path43.join(config2.stateDir, "agents", "main", "sessions");
27853
- const sessionFile = path43.join(sessionsDir, `${sessionId}.jsonl`);
27855
+ const sessionsDir = path44.join(config2.stateDir, "agents", "main", "sessions");
27856
+ const sessionFile = path44.join(sessionsDir, `${sessionId}.jsonl`);
27854
27857
  const recentLines = [];
27855
27858
  if (fs42.existsSync(sessionFile)) {
27856
27859
  const content = fs42.readFileSync(sessionFile, "utf-8");
@@ -27903,7 +27906,7 @@ ${entry}`);
27903
27906
  if (!workspace) return { continue: true };
27904
27907
  try {
27905
27908
  const fs42 = await import("node:fs");
27906
- const bufferPath = path43.join(workspace, "memory", "working-buffer.md");
27909
+ const bufferPath = path44.join(workspace, "memory", "working-buffer.md");
27907
27910
  if (fs42.existsSync(bufferPath)) {
27908
27911
  const stat4 = fs42.statSync(bufferPath);
27909
27912
  const ageMs = Date.now() - stat4.mtimeMs;
@@ -27956,7 +27959,7 @@ ${content}`
27956
27959
  return `${hr}h ${remMin}m`;
27957
27960
  }
27958
27961
  if (config2.skills?.enabled !== false) {
27959
- const skillsDir = config2.skills?.path ? path43.isAbsolute(config2.skills.path) ? config2.skills.path : path43.resolve(config2.workspace, config2.skills.path) : path43.resolve(config2.workspace, "skills");
27962
+ const skillsDir = config2.skills?.path ? path44.isAbsolute(config2.skills.path) ? config2.skills.path : path44.resolve(config2.workspace, config2.skills.path) : path44.resolve(config2.workspace, "skills");
27960
27963
  const modelDef2 = config2.provider.models.find((m2) => m2.id === config2.model);
27961
27964
  const contextWindowTokens = modelDef2?.contextWindow;
27962
27965
  const skills = scanSkills(skillsDir);
@@ -27975,7 +27978,7 @@ ${content}`
27975
27978
  workspace: config2.workspace
27976
27979
  });
27977
27980
  const systemPrompt = [systemStable, systemDynamic].join("\n\n");
27978
- const promptDumpPath = path43.join(config2.workspace, ".system-prompt.txt");
27981
+ const promptDumpPath = path44.join(config2.workspace, ".system-prompt.txt");
27979
27982
  fs41.writeFileSync(promptDumpPath, systemPrompt);
27980
27983
  console.log(`System prompt: ${systemStable.length} chars stable + ${systemDynamic.length} chars dynamic \u2192 ${promptDumpPath}`);
27981
27984
  const modelDef = config2.provider.models.find((m2) => m2.id === config2.model);
@@ -29054,8 +29057,8 @@ Auto-routing disabled \u2014 all messages use this model.
29054
29057
  let writePath = configPath2;
29055
29058
  if (configPath2 && !fs41.existsSync(configPath2)) {
29056
29059
  const __pFile = fileURLToPath(import.meta.url);
29057
- const __pDir = path43.dirname(__pFile);
29058
- const altPath = path43.join(path43.resolve(__pDir, "../configs"), path43.basename(configPath2));
29060
+ const __pDir = path44.dirname(__pFile);
29061
+ const altPath = path44.join(path44.resolve(__pDir, "../configs"), path44.basename(configPath2));
29059
29062
  if (fs41.existsSync(altPath)) {
29060
29063
  console.warn(`[primary] Config not found at ${configPath2}, falling back to ${altPath}`);
29061
29064
  writePath = altPath;
@@ -29335,7 +29338,7 @@ Use full ref like \`/vision-model ${candidates[0].ref}\``);
29335
29338
  const ext = detected.split("/")[1] || "png";
29336
29339
  const resized = await maybeResizeAndDownsampleImageBuffer2(rawBuffer, rawBuffer.length, ext);
29337
29340
  const imageId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
29338
- const savedPath = path43.join(config2.mediaDir, `${imageId}.${ext}`);
29341
+ const savedPath = path44.join(config2.mediaDir, `${imageId}.${ext}`);
29339
29342
  fs41.writeFileSync(savedPath, resized.buffer);
29340
29343
  savedPaths.push(savedPath);
29341
29344
  console.log(`[vision] Saved: ${savedPath} (${resized.buffer.length}B)`);
@@ -29362,7 +29365,7 @@ ${pathStr}` }];
29362
29365
  }
29363
29366
  const nonImageAttachments = inbound.attachments?.filter((a) => !a.contentType.startsWith("image/"));
29364
29367
  if (nonImageAttachments && nonImageAttachments.length > 0) {
29365
- const outDir = path43.join(config2.mediaDir, sessionId);
29368
+ const outDir = path44.join(config2.mediaDir, sessionId);
29366
29369
  fs41.mkdirSync(outDir, { recursive: true });
29367
29370
  const resolved = [];
29368
29371
  for (const att of nonImageAttachments) {
@@ -29371,8 +29374,8 @@ ${pathStr}` }];
29371
29374
  const resp = await fetch(att.url);
29372
29375
  if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
29373
29376
  const buffer = Buffer.from(await resp.arrayBuffer());
29374
- const safeName2 = path43.basename(att.filename).replace(/[<>:"/\\|?*\x00-\x1f]/g, "_") || "attachment";
29375
- const savedPath = path43.join(outDir, safeName2);
29377
+ const safeName2 = path44.basename(att.filename).replace(/[<>:"/\\|?*\x00-\x1f]/g, "_") || "attachment";
29378
+ const savedPath = path44.join(outDir, safeName2);
29376
29379
  fs41.writeFileSync(savedPath, buffer);
29377
29380
  resolved.push(savedPath);
29378
29381
  console.log(`[file] Saved: ${savedPath} (${buffer.length}B)`);
@@ -29734,7 +29737,7 @@ ${pathStr}` }];
29734
29737
  console.warn("[cognifold] watcher: config.workspace \u672A\u914D\u7F6E\uFF0C\u8DF3\u8FC7 proactive \u5199\u5165");
29735
29738
  return;
29736
29739
  }
29737
- const pFile = path43.join(wsDir, ".cognifold-proactive.json");
29740
+ const pFile = path44.join(wsDir, ".cognifold-proactive.json");
29738
29741
  const cognifoldBaseUrl = config2.cognifold?.baseUrl || "http://127.0.0.1:9001";
29739
29742
  const cognifoldSessionId = cfSessionId;
29740
29743
  const rawSuggestions = data.suggestions || data.actions || (data.intent_id ? [data] : []);
@@ -29788,7 +29791,7 @@ ${pathStr}` }];
29788
29791
  console.error(`[cognifold] failed to save proactive: ${e.message}`);
29789
29792
  }
29790
29793
  if (enriched.length > 0) {
29791
- const promptFile = path43.join(config2.workspace, "prompts", "cognifold-proactive.md");
29794
+ const promptFile = path44.join(config2.workspace, "prompts", "cognifold-proactive.md");
29792
29795
  const promptText = fs41.existsSync(promptFile) ? fs41.readFileSync(promptFile, "utf-8") : "[CogniFold proactive] \u6709 " + enriched.length + " \u4E2A action \u5230\u671F\u4E86";
29793
29796
  const actionsJson = JSON.stringify(enriched, null, 2);
29794
29797
  const sessionId = cfSessionId;
@@ -29894,9 +29897,9 @@ async function doReloadConfig(config2, deps, provider) {
29894
29897
  let reloadConfigPath = savedConfigPath;
29895
29898
  if (!fs41.existsSync(reloadConfigPath)) {
29896
29899
  const __filename = fileURLToPath(import.meta.url);
29897
- const __dirname = path43.dirname(__filename);
29898
- const engineConfigsDir = path43.resolve(__dirname, "../configs");
29899
- const altPath = path43.join(engineConfigsDir, path43.basename(savedConfigPath));
29900
+ const __dirname = path44.dirname(__filename);
29901
+ const engineConfigsDir = path44.resolve(__dirname, "../configs");
29902
+ const altPath = path44.join(engineConfigsDir, path44.basename(savedConfigPath));
29900
29903
  if (fs41.existsSync(altPath)) {
29901
29904
  console.warn(`[reload] Config not found at ${reloadConfigPath}, falling back to ${altPath} (dev mode)`);
29902
29905
  reloadConfigPath = altPath;
@@ -29949,7 +29952,7 @@ async function doReloadConfig(config2, deps, provider) {
29949
29952
  } catch (err) {
29950
29953
  console.error(`[reload] Failed: ${err.message}`);
29951
29954
  try {
29952
- fs41.appendFileSync(path43.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] RELOAD FAILED: ${err.message}
29955
+ fs41.appendFileSync(path44.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] RELOAD FAILED: ${err.message}
29953
29956
  ${err.stack}
29954
29957
  `);
29955
29958
  } catch {
@@ -29961,17 +29964,17 @@ function startConfigWatcher(config2, deps, provider) {
29961
29964
  const raw = config2._configFilePath;
29962
29965
  let configPath2 = raw;
29963
29966
  if (!fs41.existsSync(configPath2)) {
29964
- configPath2 = path43.resolve(raw);
29967
+ configPath2 = path44.resolve(raw);
29965
29968
  }
29966
29969
  if (!fs41.existsSync(configPath2)) {
29967
29970
  const __filename2 = fileURLToPath(import.meta.url);
29968
- const __dirname22 = path43.dirname(__filename2);
29969
- configPath2 = path43.resolve(__dirname22, "..", raw);
29971
+ const __dirname22 = path44.dirname(__filename2);
29972
+ configPath2 = path44.resolve(__dirname22, "..", raw);
29970
29973
  }
29971
29974
  if (!fs41.existsSync(configPath2)) {
29972
29975
  console.warn(`[config-watch] config path invalid: ${configPath2}, watcher disabled`);
29973
29976
  try {
29974
- fs41.appendFileSync(path43.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] DISABLED: configPath=${configPath2}
29977
+ fs41.appendFileSync(path44.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] DISABLED: configPath=${configPath2}
29975
29978
  `);
29976
29979
  } catch {
29977
29980
  }
@@ -29983,13 +29986,13 @@ function startConfigWatcher(config2, deps, provider) {
29983
29986
  debounceTimer = setTimeout(async () => {
29984
29987
  console.log(`[config-watch] file changed (${eventType}), reloading...`);
29985
29988
  try {
29986
- fs41.appendFileSync(path43.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] CHANGE eventType=${eventType}, calling doReloadConfig
29989
+ fs41.appendFileSync(path44.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] CHANGE eventType=${eventType}, calling doReloadConfig
29987
29990
  `);
29988
29991
  } catch {
29989
29992
  }
29990
29993
  const result = await doReloadConfig(config2, deps, provider);
29991
29994
  try {
29992
- fs41.appendFileSync(path43.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] RELOAD DONE: ok=${result.ok} changes=${result.changes.join(",")}
29995
+ fs41.appendFileSync(path44.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] RELOAD DONE: ok=${result.ok} changes=${result.changes.join(",")}
29993
29996
  `);
29994
29997
  } catch {
29995
29998
  }
@@ -29998,14 +30001,14 @@ function startConfigWatcher(config2, deps, provider) {
29998
30001
  watcher.on("error", (err) => {
29999
30002
  console.error(`[config-watch] error: ${err.message}`);
30000
30003
  try {
30001
- fs41.appendFileSync(path43.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] ERROR: ${err.message}
30004
+ fs41.appendFileSync(path44.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] ERROR: ${err.message}
30002
30005
  `);
30003
30006
  } catch {
30004
30007
  }
30005
30008
  });
30006
30009
  console.log(`[config-watch] watching ${configPath2}`);
30007
30010
  try {
30008
- fs41.appendFileSync(path43.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] STARTED watching=${configPath2}
30011
+ fs41.appendFileSync(path44.join(config2.stateDir, "logs", "engine-config-watch.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] STARTED watching=${configPath2}
30009
30012
  `);
30010
30013
  } catch {
30011
30014
  }
@@ -30015,9 +30018,9 @@ function startConfigWatcher(config2, deps, provider) {
30015
30018
  // src/main.ts
30016
30019
  import { readFileSync as readFileSync28 } from "node:fs";
30017
30020
  import { fileURLToPath as fileURLToPath2 } from "node:url";
30018
- import { dirname as dirname8, join as join38 } from "node:path";
30021
+ import { dirname as dirname8, join as join40 } from "node:path";
30019
30022
  var __dirname2 = dirname8(fileURLToPath2(import.meta.url));
30020
- var pkg = JSON.parse(readFileSync28(join38(__dirname2, "..", "package.json"), "utf-8"));
30023
+ var pkg = JSON.parse(readFileSync28(join40(__dirname2, "..", "package.json"), "utf-8"));
30021
30024
  var epipeSeen = false;
30022
30025
  process.on("uncaughtException", (err) => {
30023
30026
  const code = err?.code ?? "";