Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/capy/belief-ledger-w1' into capy/belief-w1-trust
garrytan83d80bbe87d2
diff --cc src/core/belief/ledger.tsindex bab7ffca1f,c3b7cfe33f..584d7e5437--- a/src/core/belief/ledger.ts+++ b/src/core/belief/ledger.ts@@@ -61,14 -62,8 +62,14 @@@ export function noteBelief(note: Beliefstore.getStore()?.notes.push(note);}+/** The enclosing batch's publication, source and stream slugs, or null outside a batch. */+export function currentBeliefBatch(): { publicationId: string; sourceId: string; slugs: readonly string[] } | null {+ const batch = store.getStore();+ return batch ? { publicationId: batch.publicationId, sourceId: batch.opts.sourceId, slugs: batch.opts.slugs } : null;+}+/** Coverage and purge probes for one source, in one read. */- export async function readLedgerSource(tx: Pick<BrainEngine, 'executeRaw'>, sourceId: string): Promise<{ incarnation: string; purgeEpoch: number; coverage: string | null; managed: boolean; purgesPossible: boolean } | null> {+ export async function readLedgerSource(tx: Pick<BrainEngine, 'executeRaw'>, sourceId: string): Promise<{ incarnation: string; purgeEpoch: number; coverage: string | null; purgesPossible: boolean } | null> {const [row] = await tx.executeRaw<Record<string, unknown>>(`SELECT s.incarnation::text AS incarnation, s.purge_epoch,(SELECT e.event_type FROM belief_events e WHERE e.source_id = s.id AND e.subject_kind = 'coverage' AND e.subject_key = $2AND e.source_incarnation = s.incarnation ORDER BY e.id DESC LIMIT 1) AS coverage,