Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: one title scrub for the evidence header line and think title attribute
garrytand2efc238afec
diff --git a/src/core/search/evidence-date.ts b/src/core/search/evidence-date.tsindex d7cab31bcd..65e700d6c9 100644--- a/src/core/search/evidence-date.ts+++ b/src/core/search/evidence-date.ts@@ -148,9 +148,14 @@ async function factObservationDates(return out;}+/** A page title as one inert line: angle brackets and U+0085 become spaces, double quotes single quotes, whitespace runs one space. */+export function evidenceTitle(title: string | null | undefined): string {+ return (title ?? '').replace(/[<>\u0085]/g, ' ').replace(/"/g, "'").replace(/\s+/g, ' ').trim();+}+/** A page header line with the page's title after the bracket, on one line; an empty title adds nothing. */export function titledPageHeader(header: string, title: string | null | undefined): string {- const clean = (title ?? '').replace(/\s+/g, ' ').trim();+ const clean = evidenceTitle(title);return clean ? `${header} ${clean}` : header;}diff --git a/src/core/think/gather.ts b/src/core/think/gather.tsindex 549791965b..bd9c3bd45f 100644--- a/src/core/think/gather.ts+++ b/src/core/think/gather.ts@@ -28,6 +28,7 @@ import { DEFAULT_PAGES_BUDGET, PAGES_BLOCK_EXCERPT_FLOOR_CHARS, type PagesBudgetimport { filterPagesToWindow, type TemporalWindow } from './temporal-window.ts';import { pageContentDate } from './temporal-context.ts';import { sanitizeQueryForPrompt } from '../search/expansion.ts';+import { evidenceTitle } from '../search/evidence-date.ts';import { ensureWellFormed } from '../text-safe.ts';import { CJK_SLUG_CHARS } from '../cjk.ts';import type { IntentAsk } from '../search/decide-retrieval.ts';@@ -667,7 +668,7 @@ export function renderPagesBlockDetailed(const flag = (p.injection_suspected ? `${INJECTION_SUSPECTED_LINE}\n` : '')+ (p.trust_tier && needsDataEnvelope(p.trust_tier) ? `${EXTERNAL_DATA_RULE}\n` : '') + graphEvidenceLine(p);const trustAttr = p.trust_tier ? ` ${trustAttributes({ trust_tier: p.trust_tier, origin: p.origin ?? 'legacy' })}` : '';- const cleanTitle = opts.titles ? title.replace(/[\r\n<>]/g, ' ').replace(/"/g, "'").replace(/\s+/g, ' ').trim() : '';+ const cleanTitle = opts.titles ? evidenceTitle(title) : '';const titleAttr = cleanTitle ? ` title="${cleanTitle}"` : '';// Evidence delivery: the block was already budgeted and cut around its// hits; render it whole (capped only by excerptLen).