Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(entities): load the identity-sibling resolver lazily
garrytan6b05f551ac0a
diff --git a/src/core/entities/resolve.ts b/src/core/entities/resolve.tsindex 6a204122e4..87199fb034 100644--- a/src/core/entities/resolve.ts+++ b/src/core/entities/resolve.ts@@ -21,11 +21,13 @@* unprefixed holding path rather than guessing from connection count.*/-import { siblingCanonical } from '../mentions/siblings.ts';-import { loadLinkableTypes } from '../mentions/policy.ts';import type { BrainEngine } from '../engine.ts';import { normalizeAlias } from '../search/alias-normalize.ts';import { foldNonDecomposingLatin } from '../latin-fold.ts';++/** Lazy: the mentions graph stays out of the OpenClaw plugin's static import graph. */+const siblingCanonical: typeof import('../mentions/siblings.ts').siblingCanonical = async (...args) =>+ (await import('../mentions/siblings.ts')).siblingCanonical(...args);import { isUndefinedTableError } from '../utils.ts';import { privatePagesFilterFragment } from '../search/private-visibility.ts';@@ -339,7 +341,7 @@ export async function resolveStrictEntityReference(let linkable: Set<string> | null = null;const isEntity = async (r: { slug: string; type: string | null }) => {if (isFactEntityPage(r.slug, r.type)) return true;- linkable ??= new Set((await loadLinkableTypes(engine, source_id).catch(() => ({ types: [] as string[] }))).types);+ linkable ??= new Set((await (await import('../mentions/policy.ts')).loadLinkableTypes(engine, source_id).catch(() => ({ types: [] as string[] }))).types);return r.type != null && linkable.has(r.type);};const pick = async (rows: Array<{ slug: string; type: string | null }>, arm: StrictResolutionArm): Promise<StrictResolution | null> => {diff --git a/src/core/snapshot-schema-inputs.ts b/src/core/snapshot-schema-inputs.tsindex ba9861b843..dc57f5f572 100644--- a/src/core/snapshot-schema-inputs.ts+++ b/src/core/snapshot-schema-inputs.ts@@ -52,6 +52,8 @@ export const SNAPSHOT_DYNAMIC_IMPORTS_NOT_HASHED: Readonly<Record<string, string'model-pricing.ts': 'verbs.ts request-time verb handlers','interop-notices.ts': 'verbs.ts request-time verb handlers (agent contract notices)','remember-batch.ts': 'verbs.ts request-time verb handlers (remember items[])',+ 'mentions/siblings.ts': 'entities/resolve.ts request-time entity resolution (identity-sibling names)',+ 'mentions/policy.ts': 'entities/resolve.ts request-time entity resolution (pack linkable types)',};const STATIC_SPECIFIER =diff --git a/test/mcp-notice-ceilings.test.ts b/test/mcp-notice-ceilings.test.tsindex 583d835e61..904a10b6ee 100644--- a/test/mcp-notice-ceilings.test.ts+++ b/test/mcp-notice-ceilings.test.ts@@ -8,7 +8,7 @@import { describe, expect, test } from 'bun:test';import { OTHER_NAMES_NOTICE_MAX_CHARS, SAVED_FACTS_NOTICE_MAX_CHARS, retrievalNoticeBlocks } from '../src/mcp/dispatch.ts';-const FACTS_HEAD = 'Saved facts (remember) matching this query, newest first; recall returns more:\n';+const FACTS_HEAD = 'Saved facts (remember): about the entity this query names (newest first), then facts those point to, then matches for its words; recall returns more:\n';const NAMES_HEAD = 'Other names in these results (documents may use either; search the one you have not tried): ';const fact = (text: string, i = 0) => ({ fact: text, entity_slug: `e${i}`, valid_from: '2026-09-01T00:00:00Z', source: 'user update' });