engine7 7.1.130 → 7.1.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -13396,10 +13396,12 @@ function generateConfig(v) {
13396
13396
  ...isFreeTier(v) ? { clean: { model: FREE_TIER_FAST_REF } } : {}
13397
13397
  },
13398
13398
  // 1026 翀哥拍板:免费档默认带 mem7 向量通道——provision 时代不写这格,免费装机
13399
- // topics 导入全零向量、语义检索空转(testengine2 实弹 51/51 零向量)。enabled 不写
13400
- // (引擎默认开);只在免费档写 embedding(引用必须落在本次真实写出的 7yi provider
13401
- // 里,同 topics.model 纪律)。
13402
- ...isFreeTier(v) ? { mem7: mem7ServiceDefaults(void 0) } : {},
13399
+ // topics 导入全零向量、语义检索空转(testengine2 实弹 51/51 零向量)。只在免费档写
13400
+ // embedding(引用必须落在本次真实写出的 7yi provider 里,同 topics.model 纪律)。
13401
+ // 🔴 1102 补 enabled 本体(翀哥拍板"新装默认开"):引擎严格判 `=== true` 且全仓无
13402
+ // 默认填充——下面那条"enabled 不写(引擎默认开)"的旧注释从未成立,1026 起新装机
13403
+ // 的 mem7 实际是静默关闭的(装机日志三次 WARN memory 工具不可用,1102 实证)。
13404
+ ...isFreeTier(v) ? { mem7: { enabled: true, ...mem7ServiceDefaults(void 0) } } : {},
13403
13405
  channels: {
13404
13406
  // ⚠️ 三个凭据格写的是 `env:` 引用,**不是明文**(T12,0926)。值落
13405
13407
  // ~/.engine7-secrets/<cfg>.env(0600),由 cli-init 在 config 落盘后写入。
@@ -42778,8 +42780,12 @@ ${conversationText}`
42778
42780
  let result = "";
42779
42781
  let completed = false;
42780
42782
  let hadError = false;
42783
+ let completionReason;
42781
42784
  for await (const chunk of extractEngine.query(extractMessages, void 0, toolContext)) {
42782
- if (chunk.type === "result") completed = chunk.completionReason === "completed";
42785
+ if (chunk.type === "result") {
42786
+ completionReason = chunk.completionReason;
42787
+ completed = completionReason === "completed";
42788
+ }
42783
42789
  if (chunk.type === "error" || chunk.type === "tool_result" && chunk.isError) hadError = true;
42784
42790
  if (chunk.type === "text" && chunk.text) {
42785
42791
  result += chunk.text;
@@ -42789,7 +42795,7 @@ ${conversationText}`
42789
42795
  }
42790
42796
  }
42791
42797
  if (!completed || hadError || generation !== (state2.generations.get(sessionId) ?? 0)) {
42792
- console.warn(`[memory] extractMemories incomplete \u2014 input remains eligible, tools=${toolCount}, error=${hadError}`);
42798
+ console.warn(`[memory] extractMemories incomplete \u2014 input remains eligible, tools=${toolCount}, error=${hadError}, reason=${completionReason ?? "unknown"}, reset=${generation !== (state2.generations.get(sessionId) ?? 0)}`);
42793
42799
  return;
42794
42800
  }
42795
42801
  if (maxNewTs > 0) state2.lastTs.set(sessionId, maxNewTs);
@@ -42816,11 +42822,15 @@ ${conversationText}`
42816
42822
  },
42817
42823
  execute(messages, provider, model, sessionId, disableThinking, intervalMinutes) {
42818
42824
  if (!enabled) return Promise.resolve();
42825
+ const generation = state2.generations.get(sessionId) ?? 0;
42819
42826
  const previous = state2.tail;
42820
42827
  const lastTime = state2.lastExtractTime.get(sessionId);
42821
42828
  const alreadyCoolingDown = Boolean(intervalMinutes && intervalMinutes > 0 && lastTime && Date.now() - lastTime < intervalMinutes * 6e4);
42822
42829
  const snapshot = structuredClone(messages);
42823
- const task = (previous ?? Promise.resolve()).then(() => extract(snapshot, provider, model, sessionId, disableThinking, previous && !alreadyCoolingDown ? 0 : intervalMinutes));
42830
+ const task = (previous ?? Promise.resolve()).then(() => {
42831
+ if (generation !== (state2.generations.get(sessionId) ?? 0)) return;
42832
+ return extract(snapshot, provider, model, sessionId, disableThinking, previous && !alreadyCoolingDown ? 0 : intervalMinutes);
42833
+ });
42824
42834
  const tail2 = task.finally(() => {
42825
42835
  if (state2.tail === tail2) state2.tail = void 0;
42826
42836
  });
@@ -46071,6 +46081,7 @@ function applyFreeTier(cfg, opts = {}) {
46071
46081
  if (cfg.innerVoice.model === void 0) cfg.innerVoice.model = FREE_TIER_NORT_REF;
46072
46082
  cfg.mem7 = cfg.mem7 || {};
46073
46083
  Object.assign(cfg.mem7, mem7ServiceDefaults(cfg.mem7, cfg.everos?.rerank));
46084
+ if (cfg.mem7.enabled !== false) cfg.mem7.enabled = true;
46074
46085
  cfg.tools = cfg.tools || {};
46075
46086
  if (vision) cfg.tools.my_eyes = { ...cfg.tools.my_eyes || {}, model: vision };
46076
46087
  cfg.tools.my_selfie = { ...cfg.tools.my_selfie || {}, provider: "relay" };
@@ -51039,7 +51050,25 @@ function isEngineImage(text) {
51039
51050
  function isPidAlive(pid) {
51040
51051
  try {
51041
51052
  process.kill(pid, 0);
51042
- return true;
51053
+ } catch (err) {
51054
+ return err?.code === "EPERM";
51055
+ }
51056
+ return !isPidZombie(pid);
51057
+ }
51058
+ function statFieldIsZombie(statContent) {
51059
+ const state2 = statContent.slice(statContent.lastIndexOf(")") + 2).trim().charAt(0);
51060
+ return state2 === "Z";
51061
+ }
51062
+ function isPidZombie(pid) {
51063
+ try {
51064
+ if (process.platform === "linux") {
51065
+ return statFieldIsZombie(fs6.readFileSync(`/proc/${pid}/stat`, "utf-8"));
51066
+ }
51067
+ if (process.platform === "darwin") {
51068
+ const st = execSync(`ps -p ${pid} -o stat=`, { encoding: "utf-8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"] });
51069
+ return st.trim().startsWith("Z");
51070
+ }
51071
+ return false;
51043
51072
  } catch {
51044
51073
  return false;
51045
51074
  }
@@ -52436,7 +52465,10 @@ engine7 session \u2014 \u4F1A\u8BDD\u7BA1\u7406\u5DE5\u5177
52436
52465
  if (killed !== null) {
52437
52466
  console.log(`
52438
52467
  Killing engine (PID: ${killed})...`);
52439
- await waitForPidGone(killed);
52468
+ if (!await waitForPidGone(killed)) {
52469
+ console.error(`\u274C \u65E7\u5F15\u64CE\uFF08PID ${killed}\uFF09\u6CA1\u80FD\u505C\u6389\uFF0C\u4F1A\u8BDD\u91CD\u7F6E\u4E2D\u6B62\u2014\u2014\u5148\u624B\u52A8\u7ED3\u675F\u8BE5\u8FDB\u7A0B\u518D\u91CD\u8BD5\u3002`);
52470
+ process.exit(1);
52471
+ }
52440
52472
  }
52441
52473
  } catch (err) {
52442
52474
  console.warn(`[session] \u6740\u65E7\u8FDB\u7A0B\u5931\u8D25\uFF08\u4E0D\u6321\u91CD\u7F6E\uFF09\uFF1A${err.message}`);