engine7 7.1.141 → 7.1.142

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.
@@ -1726,10 +1726,11 @@ var STATE_EXCLUDED = {
1726
1726
  var NESTED_EXCLUDED = { ".git": "source control metadata", node_modules: "installed dependencies", __pycache__: "Python bytecode cache" };
1727
1727
  var WORKSPACE_DIAGNOSTICS = /* @__PURE__ */ new Set([".system-prompt.txt", ".context-debug.txt"]);
1728
1728
  var RUNTIME_CONTROL = /* @__PURE__ */ new Set([".continuity", ".engine.pid", ".bg-worker.pid", ".travel-restored.json", ".travel-enrolled.json", ".travel-active.json"]);
1729
- var CORE_DIRECTORIES = new Set(`agents auth configs cron mem7 memory runtime session-memory steer tasks teams todos tools .everos .calendar calendar .proactive proactive skills prompts .nudge hooks inner-voice goals plans private scripts state .voice-chat .desktopBuddy body`.split(" "));
1729
+ var CORE_DIRECTORIES = new Set(`agents auth configs cron mem7 memory runtime session-memory steer tasks teams todos tools .everos .calendar calendar .proactive proactive skills prompts topics .nudge hooks inner-voice goals plans private scripts state .voice-chat .desktopBuddy body`.split(" "));
1730
1730
  var CORE_OMITTED = new Set(`media images videos audio content content-library docs output outputs dogfood-output backup backups topics-history node_modules .venvs venv .venv asr .cache cache caches tmp temp .playwright-mcp lancedb`.split(" "));
1731
1731
  function coreReason(path2) {
1732
1732
  const name = path2.split("/").at(-1);
1733
+ if (path2 === "chan7-files" || path2.startsWith("chan7-files/")) return void 0;
1733
1734
  if (CORE_OMITTED.has(name) || /(?:\.lance$|(?:^|[-.])bak(?:[-.]|$))/i.test(name)) return "optional attachments, historical copies or rebuildable indexes; outside core travel";
1734
1735
  if (/\.(?:mp4|mov|mkv|webm|avi|m4v|mp3|wav|ogg|opus|m4a|aac|flac|png|jpe?g|gif|webp|heic|bmp|tiff?|ico|pdf|docx?|pptx?|xlsx?|zip|gz|tgz|tar|7z|rar|dmg|exe|dll|so|dylib|bin|onnx|safetensors|gguf|vrm|glb|gltf|fbx|ttf|otf|woff2?|pyc|log|out)$/i.test(name) || name === ".DS_Store" || name === "package-lock.json" || name === ".context-debug.txt" || path2 === "mem7/spool/intake.failed.jsonl") return "attachments, installed binaries or diagnostics; outside core travel";
1735
1736
  }
@@ -3312,12 +3313,7 @@ async function runtimeFileEntries(options2) {
3312
3313
  db.close();
3313
3314
  }
3314
3315
  }
3315
- for (const file of databases) if (!dynamic.has(file) && !immutable.has(file)) throw new Error("RUNTIME_UNCLASSIFIED_SQLITE");
3316
- for (const entry of inventory2.entries) {
3317
- if (/\.lance(?:\/|$)/i.test(entry.path)) throw new Error("RUNTIME_UNCLASSIFIED_LANCE");
3318
- if (entry.kind === "sidecar" && immutable.has(entry.source.replace(/-(wal|shm|journal)$/, ""))) throw new Error("RUNTIME_IMMUTABLE_DATABASE_HAS_SIDECAR");
3319
- }
3320
- return inventory2.entries.filter((entry) => entry.kind === "directory" || entry.kind === "file" || immutable.has(entry.source));
3316
+ return inventory2.entries.filter((entry) => entry.kind === "directory" || entry.kind === "file" || immutable.has(entry.source) || entry.kind === "sqlite" && !dynamic.has(entry.source));
3321
3317
  };
3322
3318
  return await classify();
3323
3319
  }
@@ -4196,18 +4192,22 @@ function frameBytes(row) {
4196
4192
  if (createHash10("sha256").update(bytes).digest("hex") !== row.digest) throw new Error("SESSION_EVENT_CORRUPT");
4197
4193
  return bytes;
4198
4194
  }
4199
- function mapSessionIndex(bytes, db, path2, stateDir, sourceRoot, targetRoot) {
4195
+ function mapSessionIndex(bytes, _db, path2, stateDir, sourceRoot, targetRoot) {
4200
4196
  if (basename5(path2) !== "session-index.json") return bytes;
4201
- const index = JSON.parse(bytes.toString("utf8"));
4197
+ let index;
4198
+ try {
4199
+ index = JSON.parse(bytes.toString("utf8"));
4200
+ } catch {
4201
+ return bytes;
4202
+ }
4203
+ if (!index || typeof index !== "object" || Array.isArray(index)) return bytes;
4202
4204
  const prefixes = [sourceRoot, stateDir].map((root) => root.replace(/\\/g, "/").replace(/\/$/, "") + "/");
4203
- if (!index || typeof index !== "object" || Array.isArray(index)) throw new Error("SESSION_INDEX_INVALID");
4204
4205
  for (const entry of Object.values(index)) {
4205
- if (!entry || typeof entry.file !== "string") throw new Error("SESSION_INDEX_INVALID");
4206
+ if (!entry || typeof entry.file !== "string") continue;
4206
4207
  const old = entry.file.replace(/\\/g, "/"), prefix = prefixes.find((value) => old.startsWith(value));
4207
- if (!prefix) throw new Error("SESSION_INDEX_PATH_UNSUPPORTED");
4208
+ if (!prefix) continue;
4208
4209
  const local = old.slice(prefix.length);
4209
4210
  sessionFilePath(stateDir, join14(stateDir, local));
4210
- if (!db.prepare("SELECT 1 FROM session_files WHERE path=? AND state='active'").get(local)) throw new Error("SESSION_INDEX_TARGET_MISSING");
4211
4211
  entry.file = join14(targetRoot, local);
4212
4212
  }
4213
4213
  return Buffer.from(JSON.stringify(index, null, 2));
@@ -5937,7 +5937,9 @@ function publicPairingError(error) {
5937
5937
  if (message === "INVALID_ARTIFACT_PATH") return "TRAVEL_SOURCE_PATH_INVALID";
5938
5938
  if (/^SYMLINK_(REFUSED|CYCLE)(:|$)/.test(message)) return "TRAVEL_SOURCE_LINK_UNAVAILABLE";
5939
5939
  if (message.startsWith("INVALID_SQLITE_FILE:")) return "TRAVEL_SOURCE_DATABASE_INVALID";
5940
- return /^TRAVEL_[A-Z_]+$/.test(message) ? message : "TRAVEL_PAIRING_REFUSED";
5940
+ if (/^TRAVEL_[A-Z_]+$/.test(message)) return message;
5941
+ process.stderr.write("[pairing] masked-as TRAVEL_PAIRING_REFUSED, original: " + (error?.stack ?? String(error)) + "\n");
5942
+ return "TRAVEL_PAIRING_REFUSED";
5941
5943
  }
5942
5944
 
5943
5945
  // src/continuity/initial-baseline-main.ts
@@ -2035,10 +2035,11 @@ var STATE_EXCLUDED = {
2035
2035
  var NESTED_EXCLUDED = { ".git": "source control metadata", node_modules: "installed dependencies", __pycache__: "Python bytecode cache" };
2036
2036
  var WORKSPACE_DIAGNOSTICS = /* @__PURE__ */ new Set([".system-prompt.txt", ".context-debug.txt"]);
2037
2037
  var RUNTIME_CONTROL = /* @__PURE__ */ new Set([".continuity", ".engine.pid", ".bg-worker.pid", ".travel-restored.json", ".travel-enrolled.json", ".travel-active.json"]);
2038
- var CORE_DIRECTORIES = new Set(`agents auth configs cron mem7 memory runtime session-memory steer tasks teams todos tools .everos .calendar calendar .proactive proactive skills prompts .nudge hooks inner-voice goals plans private scripts state .voice-chat .desktopBuddy body`.split(" "));
2038
+ var CORE_DIRECTORIES = new Set(`agents auth configs cron mem7 memory runtime session-memory steer tasks teams todos tools .everos .calendar calendar .proactive proactive skills prompts topics .nudge hooks inner-voice goals plans private scripts state .voice-chat .desktopBuddy body`.split(" "));
2039
2039
  var CORE_OMITTED = new Set(`media images videos audio content content-library docs output outputs dogfood-output backup backups topics-history node_modules .venvs venv .venv asr .cache cache caches tmp temp .playwright-mcp lancedb`.split(" "));
2040
2040
  function coreReason(path2) {
2041
2041
  const name = path2.split("/").at(-1);
2042
+ if (path2 === "chan7-files" || path2.startsWith("chan7-files/")) return void 0;
2042
2043
  if (CORE_OMITTED.has(name) || /(?:\.lance$|(?:^|[-.])bak(?:[-.]|$))/i.test(name)) return "optional attachments, historical copies or rebuildable indexes; outside core travel";
2043
2044
  if (/\.(?:mp4|mov|mkv|webm|avi|m4v|mp3|wav|ogg|opus|m4a|aac|flac|png|jpe?g|gif|webp|heic|bmp|tiff?|ico|pdf|docx?|pptx?|xlsx?|zip|gz|tgz|tar|7z|rar|dmg|exe|dll|so|dylib|bin|onnx|safetensors|gguf|vrm|glb|gltf|fbx|ttf|otf|woff2?|pyc|log|out)$/i.test(name) || name === ".DS_Store" || name === "package-lock.json" || name === ".context-debug.txt" || path2 === "mem7/spool/intake.failed.jsonl") return "attachments, installed binaries or diagnostics; outside core travel";
2044
2045
  }
@@ -2604,12 +2605,7 @@ async function runtimeFileEntries(options) {
2604
2605
  db.close();
2605
2606
  }
2606
2607
  }
2607
- for (const file of databases) if (!dynamic.has(file) && !immutable.has(file)) throw new Error("RUNTIME_UNCLASSIFIED_SQLITE");
2608
- for (const entry of inventory.entries) {
2609
- if (/\.lance(?:\/|$)/i.test(entry.path)) throw new Error("RUNTIME_UNCLASSIFIED_LANCE");
2610
- if (entry.kind === "sidecar" && immutable.has(entry.source.replace(/-(wal|shm|journal)$/, ""))) throw new Error("RUNTIME_IMMUTABLE_DATABASE_HAS_SIDECAR");
2611
- }
2612
- return inventory.entries.filter((entry) => entry.kind === "directory" || entry.kind === "file" || immutable.has(entry.source));
2608
+ return inventory.entries.filter((entry) => entry.kind === "directory" || entry.kind === "file" || immutable.has(entry.source) || entry.kind === "sqlite" && !dynamic.has(entry.source));
2613
2609
  };
2614
2610
  return await classify();
2615
2611
  }
@@ -245,7 +245,7 @@ function validateTravelChannelConfiguration(channels) {
245
245
  if (!["feishu", "discord", "wechat"].includes(name)) throw new Error("TRAVEL_CHANNEL_NOT_CONTROLLED");
246
246
  if (value2.mode !== "remote-only") throw new Error("TRAVEL_REMOTE_ONLY_REQUIRED");
247
247
  const hasPlatformSecret = (block) => block && typeof block === "object" && Object.entries(block).some(([key2, v]) => ["appSecret", "token", "accessToken", "tenantAccessToken", "app_secret", "botToken", "bot_token"].includes(key2) && typeof v === "string" && !!v.trim() || v && typeof v === "object" && hasPlatformSecret(v));
248
- if (hasPlatformSecret(value2) || ["FEISHU_APP_SECRET", "LARK_APP_SECRET", "FEISHU_ACCESS_TOKEN", "DISCORD_TOKEN", "WECHAT_TOKEN"].some((k) => !!process.env[k])) throw new Error("TRAVEL_PLATFORM_SECRET_PRESENT");
248
+ if (hasPlatformSecret(value2)) throw new Error("TRAVEL_PLATFORM_SECRET_PRESENT");
249
249
  let url;
250
250
  try {
251
251
  url = new URL(value2.gatewayUrl);
@@ -2844,10 +2844,11 @@ var STATE_EXCLUDED = {
2844
2844
  var NESTED_EXCLUDED = { ".git": "source control metadata", node_modules: "installed dependencies", __pycache__: "Python bytecode cache" };
2845
2845
  var WORKSPACE_DIAGNOSTICS = /* @__PURE__ */ new Set([".system-prompt.txt", ".context-debug.txt"]);
2846
2846
  var RUNTIME_CONTROL = /* @__PURE__ */ new Set([".continuity", ".engine.pid", ".bg-worker.pid", ".travel-restored.json", ".travel-enrolled.json", ".travel-active.json"]);
2847
- var CORE_DIRECTORIES = new Set(`agents auth configs cron mem7 memory runtime session-memory steer tasks teams todos tools .everos .calendar calendar .proactive proactive skills prompts .nudge hooks inner-voice goals plans private scripts state .voice-chat .desktopBuddy body`.split(" "));
2847
+ var CORE_DIRECTORIES = new Set(`agents auth configs cron mem7 memory runtime session-memory steer tasks teams todos tools .everos .calendar calendar .proactive proactive skills prompts topics .nudge hooks inner-voice goals plans private scripts state .voice-chat .desktopBuddy body`.split(" "));
2848
2848
  var CORE_OMITTED = new Set(`media images videos audio content content-library docs output outputs dogfood-output backup backups topics-history node_modules .venvs venv .venv asr .cache cache caches tmp temp .playwright-mcp lancedb`.split(" "));
2849
2849
  function coreReason(path3) {
2850
2850
  const name = path3.split("/").at(-1);
2851
+ if (path3 === "chan7-files" || path3.startsWith("chan7-files/")) return void 0;
2851
2852
  if (CORE_OMITTED.has(name) || /(?:\.lance$|(?:^|[-.])bak(?:[-.]|$))/i.test(name)) return "optional attachments, historical copies or rebuildable indexes; outside core travel";
2852
2853
  if (/\.(?:mp4|mov|mkv|webm|avi|m4v|mp3|wav|ogg|opus|m4a|aac|flac|png|jpe?g|gif|webp|heic|bmp|tiff?|ico|pdf|docx?|pptx?|xlsx?|zip|gz|tgz|tar|7z|rar|dmg|exe|dll|so|dylib|bin|onnx|safetensors|gguf|vrm|glb|gltf|fbx|ttf|otf|woff2?|pyc|log|out)$/i.test(name) || name === ".DS_Store" || name === "package-lock.json" || name === ".context-debug.txt" || path3 === "mem7/spool/intake.failed.jsonl") return "attachments, installed binaries or diagnostics; outside core travel";
2853
2854
  }
@@ -12820,18 +12821,22 @@ function frameBytes(row) {
12820
12821
  if (createHash22("sha256").update(bytes).digest("hex") !== row.digest) throw new Error("SESSION_EVENT_CORRUPT");
12821
12822
  return bytes;
12822
12823
  }
12823
- function mapSessionIndex(bytes, db, path3, stateDir, sourceRoot, targetRoot) {
12824
+ function mapSessionIndex(bytes, _db, path3, stateDir, sourceRoot, targetRoot) {
12824
12825
  if (basename4(path3) !== "session-index.json") return bytes;
12825
- const index = JSON.parse(bytes.toString("utf8"));
12826
+ let index;
12827
+ try {
12828
+ index = JSON.parse(bytes.toString("utf8"));
12829
+ } catch {
12830
+ return bytes;
12831
+ }
12832
+ if (!index || typeof index !== "object" || Array.isArray(index)) return bytes;
12826
12833
  const prefixes = [sourceRoot, stateDir].map((root) => root.replace(/\\/g, "/").replace(/\/$/, "") + "/");
12827
- if (!index || typeof index !== "object" || Array.isArray(index)) throw new Error("SESSION_INDEX_INVALID");
12828
12834
  for (const entry of Object.values(index)) {
12829
- if (!entry || typeof entry.file !== "string") throw new Error("SESSION_INDEX_INVALID");
12835
+ if (!entry || typeof entry.file !== "string") continue;
12830
12836
  const old = entry.file.replace(/\\/g, "/"), prefix2 = prefixes.find((value2) => old.startsWith(value2));
12831
- if (!prefix2) throw new Error("SESSION_INDEX_PATH_UNSUPPORTED");
12837
+ if (!prefix2) continue;
12832
12838
  const local = old.slice(prefix2.length);
12833
12839
  sessionFilePath(stateDir, join17(stateDir, local));
12834
- if (!db.prepare("SELECT 1 FROM session_files WHERE path=? AND state='active'").get(local)) throw new Error("SESSION_INDEX_TARGET_MISSING");
12835
12840
  entry.file = join17(targetRoot, local);
12836
12841
  }
12837
12842
  return Buffer.from(JSON.stringify(index, null, 2));
@@ -14078,7 +14083,11 @@ async function copyTree(from, to, skipControl = false) {
14078
14083
  const stat2 = await lstat4(from);
14079
14084
  if (stat2.isSymbolicLink() || !stat2.isDirectory() && !stat2.isFile()) throw new Error("TRAVEL_ACTIVATION_UNSAFE_PATH");
14080
14085
  if (stat2.isFile()) {
14081
- await copyNativeFile(from, to, copyFlags, stat2.size);
14086
+ try {
14087
+ await copyNativeFile(from, to, copyFlags, stat2.size);
14088
+ } catch (error) {
14089
+ if (error.code !== "EEXIST") throw error;
14090
+ }
14082
14091
  return;
14083
14092
  }
14084
14093
  await mkdir(to, { recursive: true, mode: 448 });
@@ -14135,7 +14144,11 @@ async function activateRuntimeGeneration(options) {
14135
14144
  await options.authority.assertPermit(runtime.assert("CONTROL"), "CONTROL");
14136
14145
  const path3 = join22(destination, options.layout.databases[d.databaseId]), place = locations.get(d.databaseId);
14137
14146
  mkdirSync9(dirname12(path3), { recursive: true, mode: 448 });
14138
- await copyNativeFile(join22(snapshot, "databases", d.databaseId + ".sqlite"), path3, copyFlags);
14147
+ try {
14148
+ await copyNativeFile(join22(snapshot, "databases", d.databaseId + ".sqlite"), path3, copyFlags);
14149
+ } catch (error) {
14150
+ if (error.code !== "EEXIST") throw error;
14151
+ }
14139
14152
  const binding = { ...identity, databaseId: d.databaseId, baselineId: profile.baselineId, epoch: profile.epoch };
14140
14153
  await runActivationDatabaseWorker(destination, path3, binding, () => {
14141
14154
  options.assertStaging?.();
@@ -15140,12 +15153,7 @@ async function runtimeFileEntries(options) {
15140
15153
  db.close();
15141
15154
  }
15142
15155
  }
15143
- for (const file of databases) if (!dynamic.has(file) && !immutable.has(file)) throw new Error("RUNTIME_UNCLASSIFIED_SQLITE");
15144
- for (const entry of inventory.entries) {
15145
- if (/\.lance(?:\/|$)/i.test(entry.path)) throw new Error("RUNTIME_UNCLASSIFIED_LANCE");
15146
- if (entry.kind === "sidecar" && immutable.has(entry.source.replace(/-(wal|shm|journal)$/, ""))) throw new Error("RUNTIME_IMMUTABLE_DATABASE_HAS_SIDECAR");
15147
- }
15148
- return inventory.entries.filter((entry) => entry.kind === "directory" || entry.kind === "file" || immutable.has(entry.source));
15156
+ return inventory.entries.filter((entry) => entry.kind === "directory" || entry.kind === "file" || immutable.has(entry.source) || entry.kind === "sqlite" && !dynamic.has(entry.source));
15149
15157
  };
15150
15158
  return await classify();
15151
15159
  }
@@ -21636,6 +21644,12 @@ var TravelGatewayClient = class {
21636
21644
  async ack(permit, eventId2) {
21637
21645
  await this.call("ack", { permit, eventId: eventId2 });
21638
21646
  }
21647
+ /** 1121:引擎主动开口——开一个 ENGINE 态事件承载 effect 台账。 */
21648
+ async begin(permit, channel) {
21649
+ const result = await this.call("begin", { permit, channel });
21650
+ if (!result || typeof result.id !== "string" || !/^[a-f0-9]{64}$/.test(result.id)) throw new Error("TRAVEL_GATEWAY_INVALID_RESPONSE");
21651
+ return result;
21652
+ }
21639
21653
  async finish(permit, eventId2) {
21640
21654
  await this.call("finish", { permit, eventId: eventId2 });
21641
21655
  }
@@ -22080,7 +22094,7 @@ function createTravelNodeSupervisorServer(options) {
22080
22094
  } catch (error) {
22081
22095
  const code = error instanceof Error && nodeSupervisorErrors.has(error.message) ? error.message : "TRAVEL_NODE_REFUSED";
22082
22096
  const reason = error instanceof Error ? /^(?:TRAVEL|RECOVERY|RUNTIME|PUBLICATION|REPLICATION|KEY_SERVICE)_[A-Z_]+/.exec(error.message)?.[0] : void 0;
22083
- if (slot === "operation" || slot === "stop") process.stderr.write("[travel-node] " + (reason ?? code) + "\n");
22097
+ if (slot === "operation" || slot === "stop") process.stderr.write("[travel-node] " + (reason ?? code) + " | original: " + (error?.stack ?? String(error)) + "\n");
22084
22098
  reply(code === "TRAVEL_AUTH_DENIED" ? 403 : 409, { error: code });
22085
22099
  } finally {
22086
22100
  clearTimeout(timer);