Files
rea/experiments/atomic-codemode/native-reads.mjs
T
N0zoM1z0 e38a4c4394 feat(experiment): page native SSA operand relationships
Keep operation and slice defaults compact; preserve exact input slots and phi edges, distinguish unretained seeds, and align advertised relation schemas with runtime validation. Pin a seeded wide-PHI model task after real public MCP verification.

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 12:05:15 +00:00

29 lines
829 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
? [...new Set(input.ids)].flatMap((id) => index.get(id) ?? [])
: [...index.values()]
).filter(filter),
input,
),
missing: input.ids
? [...new Set(input.ids)].filter((id) => !index.has(id))
: [],
});