agenr 0.9.78 → 0.9.79

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.79] - 2026-03-08
4
+
5
+ ### Fixed
6
+
7
+ - Fixed OpenClaw session-start memory index observability so startup logs now distinguish successful empty loads from timeout, invalid-response, and error states instead of collapsing them all into `0 projects`.
8
+ - Fixed the OpenClaw session-start core recall debug log to report configured `coreProjects` truthfully rather than mislabeling config length as "active projects".
9
+ - Fixed OpenClaw session-start fallback recovery for newer TUI session keys such as `agent:main:tui-<uuid>` by allowing degraded same-family TUI predecessor acceptance when the current session identity resolves `family=tui` but cannot recover a stable lane.
10
+ - Preserved strict lane matching for explicit predecessors and known-lane fallback cases, while keeping cross-family fallback candidates ineligible.
11
+ - Added regression coverage for memory-index load result typing, session-start memory-index availability logging, markdown omission on unavailable index states, truthful core-project log wording, unknown-lane TUI fallback acceptance, alternate same-family TUI lane acceptance, cross-family rejection, and the new-key debug logging path.
12
+
3
13
  ## [0.9.78] - 2026-03-08
4
14
 
5
15
  ### Fixed
@@ -642,6 +642,7 @@ import { fileURLToPath } from "url";
642
642
 
643
643
  // src/openclaw-plugin/memory-index.ts
644
644
  var MEMORY_INDEX_TIMEOUT_MS = 1e4;
645
+ var MEMORY_INDEX_TIMEOUT = /* @__PURE__ */ Symbol("memory-index-timeout");
645
646
  function normalizeDate(value) {
646
647
  const raw = typeof value === "string" ? value.trim() : "";
647
648
  if (!raw) {
@@ -693,9 +694,16 @@ function parseMemoryIndex(value) {
693
694
  }
694
695
  async function runMemoryIndex(_agenrPath, dbPath) {
695
696
  try {
696
- return await withTimeout(loadMemoryIndex(dbPath), MEMORY_INDEX_TIMEOUT_MS);
697
- } catch {
698
- return null;
697
+ const result = await withTimeout(loadMemoryIndex(dbPath), MEMORY_INDEX_TIMEOUT_MS);
698
+ if (result === MEMORY_INDEX_TIMEOUT) {
699
+ return { status: "timeout" };
700
+ }
701
+ return result;
702
+ } catch (error) {
703
+ return {
704
+ status: "error",
705
+ error: toErrorMessage(error)
706
+ };
699
707
  }
700
708
  }
701
709
  async function loadMemoryIndex(dbPath) {
@@ -703,14 +711,24 @@ async function loadMemoryIndex(dbPath) {
703
711
  index: true,
704
712
  dbPath
705
713
  });
706
- return result.mode === "index" ? parseMemoryIndex(result.indexPayload) : null;
714
+ if (result.mode !== "index") {
715
+ return { status: "invalid" };
716
+ }
717
+ const index = parseMemoryIndex(result.indexPayload);
718
+ if (!index) {
719
+ return { status: "invalid" };
720
+ }
721
+ return {
722
+ status: "ok",
723
+ index
724
+ };
707
725
  }
708
726
  async function withTimeout(promise, timeoutMs) {
709
727
  let timer;
710
728
  try {
711
729
  return await new Promise((resolve, reject) => {
712
730
  timer = setTimeout(() => {
713
- resolve(null);
731
+ resolve(MEMORY_INDEX_TIMEOUT);
714
732
  }, timeoutMs);
715
733
  promise.then(resolve).catch(reject);
716
734
  });
@@ -2806,15 +2824,17 @@ function resolveSessionFamilyPolicy(currentFamily, predecessorFamily, options) {
2806
2824
  const normalizedPredecessorFamily = normalizePolicyFamily(predecessorFamily);
2807
2825
  const sameKnownFamily = currentFamily !== "unknown" && normalizedPredecessorFamily !== "unknown" && normalizedPredecessorFamily === currentFamily;
2808
2826
  const webchatLaneIdentityAvailable = sameKnownFamily && currentFamily === "webchat" && normalizedPredecessorFamily === "webchat" && (hasStableLaneIdentity(currentFamily, options?.currentLaneId) || hasStableLaneIdentity(normalizedPredecessorFamily, options?.predecessorLaneId));
2809
- const laneContinuityRequired = sameKnownFamily && (requiresStrictLaneScopedContinuity(currentFamily) || requiresStrictLaneScopedContinuity(normalizedPredecessorFamily) || webchatLaneIdentityAvailable);
2810
- const laneContinuityConfirmed = laneContinuityRequired ? options?.laneContinuityConfirmed === true : sameKnownFamily;
2811
- const predecessorContinuityEligible = sameKnownFamily && laneContinuityConfirmed;
2827
+ const degradedLaneFallbackUsed = sameKnownFamily && options?.degradedSameFamilyFallbackAllowed === true;
2828
+ const laneContinuityRequired = !degradedLaneFallbackUsed && sameKnownFamily && (requiresStrictLaneScopedContinuity(currentFamily) || requiresStrictLaneScopedContinuity(normalizedPredecessorFamily) || webchatLaneIdentityAvailable);
2829
+ const laneContinuityConfirmed = degradedLaneFallbackUsed ? true : laneContinuityRequired ? options?.laneContinuityConfirmed === true : sameKnownFamily;
2830
+ const predecessorContinuityEligible = sameKnownFamily && (degradedLaneFallbackUsed || laneContinuityConfirmed);
2812
2831
  return {
2813
2832
  currentFamily,
2814
2833
  predecessorFamily: normalizedPredecessorFamily,
2815
2834
  laneContinuityRequired,
2816
2835
  laneContinuityConfirmed,
2817
2836
  predecessorContinuityEligible,
2837
+ degradedLaneFallbackUsed,
2818
2838
  startupHandoffBrowseEntriesAllowed: predecessorContinuityEligible,
2819
2839
  sessionProjectInheritanceAllowed: predecessorContinuityEligible,
2820
2840
  clearedSessionProjectInheritanceAllowed: predecessorContinuityEligible
@@ -3968,8 +3988,14 @@ function isFallbackLaneContinuityConfirmed(currentIdentity, predecessorFamily, p
3968
3988
  }
3969
3989
  return currentIdentity.laneId === predecessorLaneId;
3970
3990
  }
3991
+ function shouldAllowDegradedTuiFallback(currentIdentity, predecessorFamily) {
3992
+ return currentIdentity.family === "tui" && predecessorFamily === "tui" && !currentIdentity.laneId;
3993
+ }
3971
3994
  function describeContinuityDecisionReason(currentFamily, predecessorFamily, currentLaneId, predecessorLaneId, policy) {
3972
3995
  if (policy.predecessorContinuityEligible) {
3996
+ if (policy.degradedLaneFallbackUsed) {
3997
+ return "same-family continuity accepted (tui degraded fallback: current lane unknown)";
3998
+ }
3973
3999
  if (currentFamily === "webchat" && predecessorFamily === "webchat" && !policy.laneContinuityRequired) {
3974
4000
  return "same-family continuity accepted (webchat single-lane runtime)";
3975
4001
  }
@@ -4224,6 +4250,10 @@ async function resolveSessionContinuity(event, ctx, sessionsDir, logger, debug,
4224
4250
  currentIdentity,
4225
4251
  predecessorFamilySignal.family,
4226
4252
  predecessorLaneSignal.laneId
4253
+ ),
4254
+ degradedSameFamilyFallbackAllowed: shouldAllowDegradedTuiFallback(
4255
+ currentIdentity,
4256
+ predecessorFamilySignal.family
4227
4257
  )
4228
4258
  });
4229
4259
  const predecessorIdentity = {
@@ -4563,6 +4593,24 @@ function diversifySessionStartBrowseCandidates(browseResult, limit = SESSION_STA
4563
4593
  // src/openclaw-plugin/hooks/before-prompt-build-session-start-recall.ts
4564
4594
  var SESSION_START_BROWSE_SINCE = "30d";
4565
4595
  var sessionStartLog3 = createLogger("session-start");
4596
+ function formatConfiguredCoreProjects(coreProjects) {
4597
+ return `[${coreProjects.join(",")}]`;
4598
+ }
4599
+ function describeMemoryIndexResult(result) {
4600
+ if (!result) {
4601
+ return "memory index unavailable: unknown failure";
4602
+ }
4603
+ switch (result.status) {
4604
+ case "ok":
4605
+ return `memory index loaded: ${result.index.projects.length} projects`;
4606
+ case "timeout":
4607
+ return "memory index unavailable: timeout";
4608
+ case "error":
4609
+ return `memory index unavailable: ${result.error}`;
4610
+ case "invalid":
4611
+ return "memory index unavailable: invalid response";
4612
+ }
4613
+ }
4566
4614
  async function fetchSessionStartRecallData(currentSessionProjectKey, params) {
4567
4615
  const coreProjects = params.config?.coreProjects ?? [];
4568
4616
  const sessionStartBrowseProject = await resolveSessionStartBrowseProject(
@@ -4606,17 +4654,17 @@ async function fetchSessionStartRecallData(currentSessionProjectKey, params) {
4606
4654
  const coreResult = coreSettled.status === "fulfilled" ? coreSettled.value : null;
4607
4655
  const browseResult = browseSettled.status === "fulfilled" ? browseSettled.value : null;
4608
4656
  const memoryIndexResult = memoryIndexSettled.status === "fulfilled" ? memoryIndexSettled.value : null;
4609
- const memoryIndexMarkdown = memoryIndexResult ? formatMemoryIndex(memoryIndexResult) : void 0;
4657
+ const memoryIndexMarkdown = memoryIndexResult?.status === "ok" ? formatMemoryIndex(memoryIndexResult.index) : void 0;
4610
4658
  debugLog(
4611
4659
  params.debug,
4612
4660
  "session-start",
4613
- `core recall returned ${coreResult?.results.length ?? 0} entries (${coreProjects.length} active projects)`
4661
+ `core recall returned ${coreResult?.results.length ?? 0} entries (configured coreProjects=${formatConfiguredCoreProjects(coreProjects)})`
4614
4662
  );
4615
4663
  debugLog(params.debug, "session-start", `browse returned ${browseResult?.results.length ?? 0} entries`);
4616
4664
  debugLog(
4617
4665
  params.debug,
4618
4666
  "session-start",
4619
- `memory index returned ${memoryIndexResult?.projects.length ?? 0} projects`
4667
+ describeMemoryIndexResult(memoryIndexResult)
4620
4668
  );
4621
4669
  return {
4622
4670
  coreResult,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenr",
3
- "version": "0.9.78",
3
+ "version": "0.9.79",
4
4
  "openclaw": {
5
5
  "extensions": [
6
6
  "dist/openclaw-plugin/index.js"
@@ -11,6 +11,19 @@
11
11
  "bin": {
12
12
  "agenr": "dist/cli.js"
13
13
  },
14
+ "scripts": {
15
+ "build": "tsup src/cli.ts src/cli-main.ts src/openclaw-plugin/index.ts --format esm --dts --clean",
16
+ "check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
17
+ "dev": "tsup src/cli.ts src/cli-main.ts --format esm --watch",
18
+ "lint": "eslint .",
19
+ "format": "prettier --write .",
20
+ "format:check": "prettier --check .",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest",
23
+ "typecheck": "tsc --noEmit",
24
+ "verify:dist": "node scripts/verify-dist.js",
25
+ "prepack": "pnpm build && pnpm verify:dist"
26
+ },
14
27
  "dependencies": {
15
28
  "@clack/prompts": "^1.0.1",
16
29
  "@libsql/client": "^0.17.0",
@@ -59,16 +72,9 @@
59
72
  "README.md"
60
73
  ],
61
74
  "author": "agenr-ai",
62
- "scripts": {
63
- "build": "tsup src/cli.ts src/cli-main.ts src/openclaw-plugin/index.ts --format esm --dts --clean",
64
- "check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
65
- "dev": "tsup src/cli.ts src/cli-main.ts --format esm --watch",
66
- "lint": "eslint .",
67
- "format": "prettier --write .",
68
- "format:check": "prettier --check .",
69
- "test": "vitest run",
70
- "test:watch": "vitest",
71
- "typecheck": "tsc --noEmit",
72
- "verify:dist": "node scripts/verify-dist.js"
75
+ "pnpm": {
76
+ "overrides": {
77
+ "fast-xml-parser": "^5.3.6"
78
+ }
73
79
  }
74
- }
80
+ }