[AUTOMATED] Preserve the opt-in pinned Kuna exporter as a reproducible source patch. Share typed graph/value reads and derived control dependence through the SDK, CLI and MCP adapters, retaining unknown runtime and memory semantics. Validated 29 focused tests, lint, actual diagnostic/native MCP workflows and a real zlib CLI composition. C and line mappings match the prior stock capture. Full upstream corpus/workspace gates and revised real-model costs remain unverified. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
24 lines
1.9 KiB
Plaintext
24 lines
1.9 KiB
Plaintext
const read = async (promise) => {
|
|
const result = await promise;
|
|
if (!result.ok) throw new Error(JSON.stringify(result));
|
|
return result.data;
|
|
};
|
|
const found = await read(rea.strings({ query: "incorrect header check", limit: 1 }));
|
|
const literal = found.items[0].address;
|
|
const refs = await read(rea.references({ addresses: [literal] }));
|
|
const entry = refs.results[0].items[0].fromFunction.address;
|
|
const snapshot = await read(rea.snapshot({ entry }));
|
|
const s = snapshot.snapshot;
|
|
const seed = await read(rea.operations({ snapshot: s, constant: literal, fields: ["kind", "statement", "inputs", "output"] }));
|
|
const uses = await read(rea.relations({ snapshot: s, kind: "uses", seeds: seed.items.map((row) => row.id) }));
|
|
const consumers = await read(rea.operations({ snapshot: s, ids: uses.items.map((row) => row.use) }));
|
|
const blockIds = [...new Set(consumers.items.map((row) => row.block))];
|
|
const blocks = await read(rea.blocks({ snapshot: s, ids: blockIds }));
|
|
const controls = await read(rea.relations({ snapshot: s, kind: "controllers", seeds: blockIds, limit: 128 }));
|
|
const guards = await read(rea.operations({ snapshot: s, block_ids: [...new Set(controls.items.map((row) => row.controller))], kind: "branch", fields: ["kind", "statement", "inputs"] }));
|
|
const phi = await read(rea.operations({ snapshot: s, kind: "phi", fields: ["inputs", "output"], limit: 2 }));
|
|
const valueIds = [...new Set(phi.items.flatMap((op) => op.inputs.map((input) => input.value_id)).filter(Boolean))];
|
|
const values = await read(rea.values({ snapshot: s, ids: valueIds }));
|
|
const slice = await read(rea.slice({ snapshot: s, seeds: guards.items.map((row) => row.id), max_operations: 64 }));
|
|
return { literal, entry, source: snapshot.source, coverage: snapshot.coverage, blocks, controls, guards, phi, values, slice: { coverage: slice.coverage, value_frontier: slice.value_frontier, operations: slice.operations.map(({ id, statement }) => ({ id, statement })) } };
|