Files
rea/src/domain/native/nativeByteRead.ts
T
gensokyo-dev 1417bf943b feat(native): match retained function inventories across builds (#5390)
Match retained native inventories through shared CLI/MCP workflows with conservative symbol/byte correspondence, unresolved structural candidates, complete Evidence provenance and bounded paged reads.

Closes #5343.
2026-10-20 09:48:52 +00:00

23 lines
799 B
TypeScript

import { z } from "zod";
/** Provider-owned bytes and exact coverage of one requested memory interval. */
export const nativeByteReadSchema = z
.object({
address: z.string(),
requested_bytes: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
returned_bytes: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
bytes_hex: z.string().regex(/^(?:[a-f0-9]{2})*$/u),
complete: z.boolean(),
})
.superRefine((value, context) => {
if (
value.returned_bytes * 2 !== value.bytes_hex.length ||
value.returned_bytes > value.requested_bytes ||
value.complete !== (value.returned_bytes === value.requested_bytes)
)
context.addIssue({
code: "custom",
message: "Read-byte length and completeness disagree",
});
});