Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/master' into capy/w1-trust-guards

garrytanc9375ce81e6a
diff --cc src/core/persistence/canonical-projections.ts
index 3f5a4da307,4610324278..14a25913fd
--- a/src/core/persistence/canonical-projections.ts
+++ b/src/core/persistence/canonical-projections.ts
@@@ -382,18 -375,19 +385,19 @@@ export async function prepareCanonicalP
// #6259: a page the content-quality gate hid as junk projects no facts or takes. Rows projected before it
// was quarantined are left as they are (hiding them would need a new row state); only new projection stops.
const projectFences = !isQuarantined(page.frontmatter);
+ const priorBody = prior && !bodyUnread(prior.page) ? prior.page : null;
const { timeline, exactIncoming, pinned } = classifyTimeline(prior ? await storedTimeline(engine, prior.page.id) : [],
- page, prior?.page ?? null, slug, writer, policy);
+ page, priorBody, slug, writer, policy);
- const deletions = JSON.stringify(pinned.filter(row => row.action === 'delete')
- .map(({ id, date, source, summary, detail, state }) => ({ id, date, source, summary, detail, removed: state === 'removed' || state === 'removed_marked' })));
- const refreshes = JSON.stringify(pinned.filter(row => row.action === 'refresh_detail')
+ const deletionRows = pinned.filter(row => row.action === 'delete')
+ .map(({ id, date, source, summary, detail, state }) => ({ id, date, source, summary, detail, removed: state === 'removed' || state === 'removed_marked' }));
+ const refreshRows = pinned.filter(row => row.action === 'refresh_detail')
.map(row => ({ id: row.id, detail: row.detail, next: exactIncoming.get(exactTimelineKey(row)) }))
- .filter(row => row.next !== row.detail));
+ .filter(row => row.next !== row.detail);
- const priorTakes = prior ? canonicalTakeRows(prior.page) : new Set<number>();
+ const priorTakes = priorBody ? canonicalTakeRows(priorBody) : new Set<number>();
// TE1 (#6188): when the prior takes fence does not parse, its stored rows count as prior canonical rows, so a
// row Tier 1 normalized (same number, holder `system` -> `brain`) updates its stored take instead of colliding.
- const priorCanonical = prior && [prior.page.compiled_truth, prior.page.timeline ?? ''].some(field => parseTakesFence(field).warnings.length)
- ? new Set([...priorTakes, ...(await engine.executeRaw<{ row_num: number }>('SELECT row_num FROM takes WHERE page_id=$1', [prior.page.id])).map(r => Number(r.row_num))])
+ const priorCanonical = priorBody && [priorBody.compiled_truth, priorBody.timeline ?? ''].some(field => parseTakesFence(field).warnings.length)
+ ? new Set([...priorTakes, ...(await engine.executeRaw<{ row_num: number }>('SELECT row_num FROM takes WHERE page_id=$1', [priorBody.id])).map(r => Number(r.row_num))])
: priorTakes;
const newTakes = JSON.stringify(takes.filter(t => !priorCanonical.has(t.rowNum)).map(t => ({ row_num: t.rowNum, claim: t.claim, kind: t.kind, holder: t.holder })));
const takeRowsGone = [...priorTakes].filter(n => !takes.some(t => t.rowNum === n));