From 90726455551302059df9281921bd50294a3be4a0 Mon Sep 17 00:00:00 2001 From: devlux76 Date: Fri, 13 Mar 2026 01:42:43 -0600 Subject: [PATCH 1/4] Fixes #46: Mark P0-C2 hippocampus ingest as implemented in TODO --- TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 98e472b..eb928e6 100644 --- a/TODO.md +++ b/TODO.md @@ -139,7 +139,7 @@ These items **must** be completed to have a usable system. Without them, users c - Link pages via `prevPageId`/`nextPageId` - Initialise `PageActivity` records with zero counts -- [ ] **P0-C2:** Implement `hippocampus/Ingest.ts` (minimal version) +- [x] **P0-C2:** Implement `hippocampus/Ingest.ts` (minimal version) - Entry point: `ingestText(text, modelProfile, vectorStore, metadataStore, keyPair)` - Chunk text via `Chunker` - Batch embed chunks via `EmbeddingRunner` From 1fa904b05381957f4a9a4bd3a87a129d819122fc Mon Sep 17 00:00:00 2001 From: "S. Dale Morrey" <86517969+devlux76@users.noreply.github.com> Date: Fri, 13 Mar 2026 01:46:01 -0600 Subject: [PATCH 2/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index eb928e6..794ba60 100644 --- a/TODO.md +++ b/TODO.md @@ -140,7 +140,7 @@ These items **must** be completed to have a usable system. Without them, users c - Initialise `PageActivity` records with zero counts - [x] **P0-C2:** Implement `hippocampus/Ingest.ts` (minimal version) - - Entry point: `ingestText(text, modelProfile, vectorStore, metadataStore, keyPair)` + - Entry point: `ingestText(text, { modelProfile, embeddingRunner, vectorStore, metadataStore, keyPair, ... })` - Chunk text via `Chunker` - Batch embed chunks via `EmbeddingRunner` - Persist vectors to `VectorStore` From ec15950444ead7e9a14f948debc1eafbee50e8e8 Mon Sep 17 00:00:00 2001 From: devlux76 Date: Fri, 13 Mar 2026 01:50:05 -0600 Subject: [PATCH 3/4] Fix TypeScript build errors: correct ModelProfile import and avoid SharedArrayBuffer in PageBuilder --- hippocampus/Ingest.ts | 3 ++- hippocampus/PageBuilder.ts | 8 ++++---- tests/hippocampus/PageBuilder.test.ts | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hippocampus/Ingest.ts b/hippocampus/Ingest.ts index 0f3fba2..e8257bf 100644 --- a/hippocampus/Ingest.ts +++ b/hippocampus/Ingest.ts @@ -1,4 +1,5 @@ -import type { Book, ModelProfile, MetadataStore, VectorStore } from "../core/types"; +import type { Book, MetadataStore, VectorStore } from "../core/types"; +import type { ModelProfile } from "../core/ModelProfile"; import { hashText } from "../core/crypto/hash"; import type { KeyPair } from "../core/crypto/sign"; import { EmbeddingRunner } from "../embeddings/EmbeddingRunner"; diff --git a/hippocampus/PageBuilder.ts b/hippocampus/PageBuilder.ts index cd79464..0936b0e 100644 --- a/hippocampus/PageBuilder.ts +++ b/hippocampus/PageBuilder.ts @@ -43,10 +43,10 @@ export async function buildPage(options: BuildPageOptions): Promise { const contentHash = await hashText(content); const pageId = contentHash; - const rawVector = embedding.buffer.slice( - embedding.byteOffset, - embedding.byteOffset + embedding.byteLength, - ); + // Copy into a new ArrayBuffer-backed view so we never pass a SharedArrayBuffer + // into WebCrypto (and keep TypeScript happy). + const rawVector = new Uint8Array(embedding.byteLength); + rawVector.set(new Uint8Array(embedding.buffer, embedding.byteOffset, embedding.byteLength)); const vectorHash = await hashBinary(rawVector); const unsignedPage = { diff --git a/tests/hippocampus/PageBuilder.test.ts b/tests/hippocampus/PageBuilder.test.ts index 3498f6a..5559b9a 100644 --- a/tests/hippocampus/PageBuilder.test.ts +++ b/tests/hippocampus/PageBuilder.test.ts @@ -6,7 +6,7 @@ import { generateKeyPair } from "../../core/crypto/sign"; import { verifySignature } from "../../core/crypto/verify"; import { hashBinary, hashText } from "../../core/crypto/hash"; -function canonicalizePageForSigning(page: Omit) { +function canonicalizePageForSigning(page: Page) { return JSON.stringify({ pageId: page.pageId, content: page.content, @@ -44,9 +44,10 @@ describe("buildPage", () => { expect(page.pageId).toBe(expectedContentHash); expect(page.contentHash).toBe(expectedContentHash); - const rawVector = embedding.buffer.slice( + const rawVector = new Uint8Array( + embedding.buffer, embedding.byteOffset, - embedding.byteOffset + embedding.byteLength, + embedding.byteLength, ); const expectedVectorHash = await hashBinary(rawVector); expect(page.vectorHash).toBe(expectedVectorHash); From e44821071423d23f4dbbfca1977799d979819bd6 Mon Sep 17 00:00:00 2001 From: devlux76 Date: Fri, 13 Mar 2026 01:54:45 -0600 Subject: [PATCH 4/4] Fix lint: remove unused KeyPair import from PageBuilder --- hippocampus/PageBuilder.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/hippocampus/PageBuilder.ts b/hippocampus/PageBuilder.ts index 0936b0e..d03e9e3 100644 --- a/hippocampus/PageBuilder.ts +++ b/hippocampus/PageBuilder.ts @@ -1,5 +1,4 @@ import type { Hash, Page } from "../core/types"; -import type { KeyPair } from "../core/crypto/sign"; import { hashBinary, hashText } from "../core/crypto/hash"; import { signData } from "../core/crypto/sign";