Files
rea/experiments/atomic-codemode/native-reads.mjs
T
f9f9dc209d feat(experiment): retain call facts beyond full graph capacity
Separate native call and boundary-value ownership from the bounded recovered graph. Validate facets independently and preserve shared identities, source evidence, and explicit partial coverage. Pin the SQLite boundary task and oracle before paired real-model trials.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-16 09:46:42 +00:00

27 lines
783 B
JavaScript

import { pageFacts } from "./fact-reads.mjs";
import { requireFact } from "./native-contract.mjs";
export const nativePage = (
rows,
input = {},
identity = ["id", "origin_address", "block"],
) => pageFacts(rows, { offset: 0, limit: 20, ...input }, identity);
export const uniqueNative = (rows) => {
const index = new Map();
for (const row of rows) {
requireFact(!index.has(row.id), `Duplicate native identity ${row.id}`);
index.set(row.id, row);
}
return index;
};
export const readNativeIdentities = (index, input, filter = () => true) => ({
...nativePage(
(input.ids
? input.ids.flatMap((id) => index.get(id) ?? [])
: [...index.values()]
).filter(filter),
input,
),
missing: input.ids?.filter((id) => !index.has(id)) ?? [],
});