Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Wave B PR 1: cross-lane seams (buildSegmentedProjection, reuseSegmentChunkVectors)
garrytan652dae1292e4
diff --git a/src/core/import-chunk-reuse.ts b/src/core/import-chunk-reuse.tsindex 70686ef1ba..b72167a895 100644--- a/src/core/import-chunk-reuse.ts+++ b/src/core/import-chunk-reuse.ts@@ -8,6 +8,7 @@ import { embeddingWriteTarget, embeddingInputContext } from './page-state/projecimport { canReuseMarkdownVector, planEmbeddingReuse } from './embed-reuse.ts';import { modeRequiresSynopsis } from './embedding-context.ts';import type { Chunk, ChunkInput, CRMode } from './types.ts';+import type { SegmentChunkInput } from './page-body/types.ts';/*** A13 reuse for one page import: copies each stored vector the reuse gate@@ -70,3 +71,14 @@ export async function reuseStoredChunkVectors(}return reused;}++/**+ * Wave B (lane 1e): vector reuse for a segmented write, scoped to the chunk+ * rows of the occurrences the write retires (never the whole page). Copies+ * each admitted stored vector onto the new chunk with the same source and+ * text; returns how many chunks got one.+ */+export async function reuseSegmentChunkVectors(_exec: BrainEngine, _input: { pageId: number; retiredOccurrences: readonly number[];+ chunks: SegmentChunkInput[]; title: string; corpusGeneration: string | null; tier: 'title' | 'none' }): Promise<number> {+ throw new Error('reuseSegmentChunkVectors: implemented by Wave B lane 1e');+}diff --git a/src/core/page-body/projection.ts b/src/core/page-body/projection.tsnew file mode 100644index 0000000000..66933e623e--- /dev/null+++ b/src/core/page-body/projection.ts@@ -0,0 +1,17 @@+/**+ * Segmented page projection (Wave B, lane 1d): chunk every live manifest+ * occurrence that has no chunk rows at the page's live body generation, stage+ * them, retire rows of occurrences no longer live, and seal the text+ * projection when the page is still at `expectedRevision` (or its current+ * revision). Reads one segment at a time. Used after a segmented create (whose+ * chunks cannot be staged before the page row exists), by the projection job+ * for a page left unsealed (crash, deferred retirement), and by rebuilds.+ */+import type { BrainEngine } from '../engine.ts';++export interface SegmentedProjectionResult { chunks: number; retired: number; sealed: boolean }++export async function buildSegmentedProjection(_engine: BrainEngine, _ref: { sourceId: string; slug: string },+ _opts?: { expectedRevision?: string }): Promise<SegmentedProjectionResult> {+ throw new Error('buildSegmentedProjection: implemented by Wave B lane 1d');+}