Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs/test: record the import tag batch writer and the new engine option surface (#5984)
garrytan02aecfc75027
diff --git a/docs/architecture/canonical-writers.tsv b/docs/architecture/canonical-writers.tsvindex 96faef59f1..ac2bc5fc96 100644--- a/docs/architecture/canonical-writers.tsv+++ b/docs/architecture/canonical-writers.tsv@@ -92,7 +92,7 @@ src/core/page-state/projection-schema.ts 1 schema Schema installation and forwarsrc/core/page-state/projections.ts 2 projection Derived indexing, retrieval telemetry, or source settings; canonical fields remain guarded by SQL triggers.src/core/page-state/schema.ts 3 schema Schema installation and forward-reference DDL; coordinated activation quiesces canonical writers. The pages DO block constrains an empty pages table only; populated tables are finalized by revision-backfill-schema.ts.src/core/page-state/revision-backfill-schema.ts 2 schema Migration-pass backfill of pages.knowledge_revision for rows written before the column (#5216): only NULL revisions are assigned, in committed id batches; canonical content is never written, and the revision trigger treats a NULL old revision without reading bodies.-src/core/page-state/tags.ts 3 engine_guard Canonical table SQL trigger requires coordinator capability; legacy calls fail before canonical DB publication. The frontmatter-claim and explicit-add inserts are two branches of one guarded statement.+src/core/page-state/tags.ts 5 engine_guard Canonical table SQL trigger requires coordinator capability; legacy calls fail before canonical DB publication. The frontmatter-claim and explicit-add inserts are two branches of one guarded statement. #5984: addPageTags is the same two-branch statement for many tags of a page the import wrote in its guarded transaction.src/core/persistence/memory-mutations.ts 1 coordinator Publication is transaction-scoped under admitted authority, source/page guards and revision checks.src/core/persistence/memory-prepare.ts 3 coordinator Publication is transaction-scoped under admitted authority, source/page guards and revision checks.src/core/persistence/page-prepare.ts 10 coordinator Publication, including versioned tombstone restoration, is transaction-scoped under admitted authority, source/page guards and revision checks; the sixth SQL site reconciles trusted first-write provenance with prepared canonical frontmatter and the seventh records canonical source_path in that same guarded transaction. Identical canonical no-ops do not heal physical metadata. The added local-CLI purge deletePage call runs in the prepared publication callback after recorded-artifact removal, under the same source/page identity, revision and durable authority guards as receipt completion; permanent journal IDs and outcomes survive the hard delete. The ninth site pins an inferred slug_root_mode on sources in the same publication transaction as the first bound origin. Its importFromContent calls carry prepare and run inside the coordinator publication.diff --git a/docs/architecture/system-of-record.md b/docs/architecture/system-of-record.mdindex 138174c432..e29eca2b0b 100644--- a/docs/architecture/system-of-record.md+++ b/docs/architecture/system-of-record.md@@ -243,7 +243,7 @@ or a physical projection that leaves attribution untouched):- `src/core/facts/unfenced-facts.ts` (2): the cycle and v0.32.2 fence of `row_num`-NULL facts: a maintenance request on managed brains; the unmanaged body mirror and row-number stamp run in `maintenanceTransaction`.- `src/core/facts/withdrawal.ts` (1): runs inside the `forget` request's coordinated write.- `src/core/facts/write-single.ts` (2): the legacy single-fact insert and its supersession link each run in `maintenanceTransaction`; managed brains publish through the fact request.-- `src/core/import-file.ts` (11): direct markdown, code and image imports, the moved-file rename (`updateSlug`) and the #3694 legacy-hash re-stamp run in `maintenanceTransaction`; managed imports go through the page request preparer.+- `src/core/import-file.ts` (12): direct markdown, code and image imports, the moved-file rename (`updateSlug`) and the #3694 legacy-hash re-stamp run in `maintenanceTransaction`; managed imports go through the page request preparer.- `src/core/minions/handlers/ingest-capture.ts` (1): the capture ingest tombstone soft delete runs in `maintenanceTransaction`.- `src/core/ops/extraction.ts` (2): extraction review promote (frontmatter) and reject (soft delete) each run in `maintenanceTransaction`.- `src/core/output/writer.ts` (4): `BrainWriter.transaction` is a `maintenanceTransaction`, so its pages and timeline rows carry the maintenance principal.diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.jsonindex c2dedcb432..5685886a74 100644--- a/test/fixtures/goldens/exports/types.json+++ b/test/fixtures/goldens/exports/types.json@@ -197,7 +197,7 @@"searchVector: (embedding: Float32Array, opts?: SearchOpts) => Promise<SearchResult[]>","setConfig: (key: string, value: string) => Promise<void>","setEmotionalWeightBatch: (rows: EmotionalWeightWriteRow[]) => Promise<number>",- "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[]) => Promise<void>",+ "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[], opts?: { inline?: boolean; }) => Promise<void>","setPageEmbeddingSignature: (slug: string, opts: { sourceId?: string; signature: string; }) => Promise<void>","softDeletePage: (slug: string, opts?: { sourceId?: string; }) => Promise<{ slug: string; } | null>","softDeletePages: (slugs: string[], opts: { sourceId: string; }) => Promise<string[]>",@@ -216,7 +216,7 @@"updateSourceConfig: (sourceId: string, patch: Record<string, unknown>) => Promise<boolean>","updateTake: (pageId: number, rowNum: number, fields: { weight?: number; since_date?: string; source?: string; }) => Promise<void>","updateTakeEmbeddings: (rows: TakeEmbeddingInput[], opts?: BatchOpts) => Promise<number>",- "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; } & BatchOpts) => Promise<void>",+ "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; pageId?: number; } & BatchOpts) => Promise<void>","upsertEventProjection: (opts: { depthSlug: string; eventSlug: string; date: string; summary: string; detail?: string; sourceId?: string; }) => Promise<{ projected: boolean; }>","upsertFile: (spec: FileSpec) => Promise<{ id: number; created: boolean; }>","withReservedConnection: <T>(fn: (conn: ReservedConnection) => Promise<T>, opts?: { route?: \"ordinary\"; selfContained?: boolean; }) => Promise<T>",@@ -1179,7 +1179,7 @@"searchVector: (embedding: Float32Array, opts?: SearchOpts) => Promise<SearchResult[]>","setConfig: (key: string, value: string) => Promise<void>","setEmotionalWeightBatch: (rows: EmotionalWeightWriteRow[]) => Promise<number>",- "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[]) => Promise<void>",+ "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[], opts?: { inline?: boolean; }) => Promise<void>","setPageEmbeddingSignature: (slug: string, opts: { sourceId?: string; signature: string; }) => Promise<void>","softDeletePage: (slug: string, opts?: { sourceId?: string; }) => Promise<{ slug: string; } | null>","softDeletePages: (slugs: string[], opts: { sourceId: string; }) => Promise<string[]>",@@ -1199,7 +1199,7 @@"updateSourceConfig: (sourceId: string, patch: Record<string, unknown>) => Promise<boolean>","updateTake: (pageId: number, rowNum: number, fields: { weight?: number; since_date?: string; source?: string; }) => Promise<void>","updateTakeEmbeddings: (rowsIn: TakeEmbeddingInput[], opts?: BatchOpts) => Promise<number>",- "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; } & BatchOpts) => Promise<void>",+ "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; pageId?: number; } & BatchOpts) => Promise<void>","upsertEventProjection: (opts: { depthSlug: string; eventSlug: string; date: string; summary: string; detail?: string; sourceId?: string; }) => Promise<{ projected: boolean; }>","upsertFile: (spec: FileSpec) => Promise<{ id: number; created: boolean; }>","withReservedConnection: <T>(fn: (conn: ReservedConnection) => Promise<T>, opts?: { route?: \"ordinary\"; selfContained?: boolean; }) => Promise<T>",@@ -3335,7 +3335,7 @@"searchVector: (embedding: Float32Array, opts?: SearchOpts) => Promise<SearchResult[]>","setConfig: (key: string, value: string) => Promise<void>","setEmotionalWeightBatch: (rows: EmotionalWeightWriteRow[]) => Promise<number>",- "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[]) => Promise<void>",+ "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[], opts?: { inline?: boolean; }) => Promise<void>","setPageEmbeddingSignature: (slug: string, opts: { sourceId?: string; signature: string; }) => Promise<void>","softDeletePage: (slug: string, opts?: { sourceId?: string; }) => Promise<{ slug: string; } | null>","softDeletePages: (slugs: string[], opts: { sourceId: string; }) => Promise<string[]>",@@ -3354,7 +3354,7 @@"updateSourceConfig: (sourceId: string, patch: Record<string, unknown>) => Promise<boolean>","updateTake: (pageId: number, rowNum: number, fields: { weight?: number; since_date?: string; source?: string; }) => Promise<void>","updateTakeEmbeddings: (rows: TakeEmbeddingInput[], opts?: BatchOpts) => Promise<number>",- "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; } & BatchOpts) => Promise<void>",+ "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; pageId?: number; } & BatchOpts) => Promise<void>","upsertEventProjection: (opts: { depthSlug: string; eventSlug: string; date: string; summary: string; detail?: string; sourceId?: string; }) => Promise<{ projected: boolean; }>","upsertFile: (spec: FileSpec) => Promise<{ id: number; created: boolean; }>","withReservedConnection: <T>(fn: (conn: ReservedConnection) => Promise<T>, opts?: { route?: \"ordinary\"; selfContained?: boolean; }) => Promise<T>",@@ -3598,6 +3598,7 @@{"kind": "interface","members": [+ "incarnation?: string | undefined","slug: string","sourceId: string"],@@ -3650,8 +3651,10 @@"kind": "interface","members": ["allowEmptyOverwrite?: boolean | undefined",+ "contextualRetrieval?: { mode: string; corpusGeneration: string | null; } | undefined","expectedRevision?: string | undefined","force?: boolean | undefined",+ "inline?: boolean | undefined","sourceId?: string | undefined"],"name": "PageWriteOptions"@@ -4848,7 +4851,7 @@"kind": "function","name": "buildBasenameIndex","signature": [- "(slugs: Iterable<string>) => Map<string, string[]>"+ "(slugs: Iterable<string>, idx?: Map<string, string[]>) => Map<string, string[]>"]},{@@ -4953,7 +4956,7 @@"kind": "function","name": "makeResolver","signature": [- "(engine: BrainEngine, opts?: { mode: \"batch\" | \"live\"; sourceId?: string; }) => SlugResolver"+ "(engine: BrainEngine, opts?: { mode: \"batch\" | \"live\"; sourceId?: string; basenameIndex?: () => Promise<Map<string, string[]>>; }) => SlugResolver"]},{@@ -6215,7 +6218,7 @@"searchVector: (embedding: Float32Array, opts?: SearchOpts) => Promise<SearchResult[]>","setConfig: (key: string, value: string) => Promise<void>","setEmotionalWeightBatch: (rows: EmotionalWeightWriteRow[]) => Promise<number>",- "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[]) => Promise<void>",+ "setPageAliases: (slug: string, sourceId: string, aliasNorms: string[], opts?: { inline?: boolean; }) => Promise<void>","setPageEmbeddingSignature: (slug: string, opts: { sourceId?: string; signature: string; }) => Promise<void>","softDeletePage: (slug: string, opts?: { sourceId?: string; }) => Promise<{ slug: string; } | null>","softDeletePages: (slugs: string[], opts: { sourceId: string; }) => Promise<string[]>",@@ -6234,7 +6237,7 @@"updateSourceConfig: (sourceId: string, patch: Record<string, unknown>) => Promise<boolean>","updateTake: (pageId: number, rowNum: number, fields: { weight?: number; since_date?: string; source?: string; }) => Promise<void>","updateTakeEmbeddings: (rowsIn: TakeEmbeddingInput[], opts?: BatchOpts) => Promise<number>",- "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; } & BatchOpts) => Promise<void>",+ "upsertChunks: (slug: string, chunks: ChunkInput[], opts?: { sourceId?: string; embeddingColumn?: ResolvedColumn; expectedRevision?: string; sealChunkerVersion?: number; pageId?: number; } & BatchOpts) => Promise<void>","upsertEventProjection: (opts: { depthSlug: string; eventSlug: string; date: string; summary: string; detail?: string; sourceId?: string; }) => Promise<{ projected: boolean; }>","upsertFile: (spec: FileSpec) => Promise<{ id: number; created: boolean; }>","walRepairReceipt: WalRepairReceipt | null",