Files
rea/src/domain/nativeDataType.ts
T
morlutoandGitHub 4fbc501121 feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)
* fix(hopper): normalize string-backed addresses and update verification

* feat(native): add inspection primitives, dispatch traces and approved UI observation

* test: prioritize real artifact E2E and captured golden regressions

* fix(process): queue observed output before reactive rendering actions

* test: prune redundant cases and strengthen boundary assertions

* fix(cli): route native value tracing through shared workflows

* test: replace synthetic success with real workflows and captured data

* fix(catalog): separate portable metadata from native host availability
2026-10-04 16:02:36 +08:00

58 lines
2.0 KiB
TypeScript

import { z } from "zod";
/** Select a database type by exact category path or a defined typed data address. */
export const nativeDataTypeInputSchema = z
.strictObject({
type: z.string().min(1).optional(),
address: z.string().min(1).optional(),
document: z.string().optional(),
})
.refine(
(value) => (value.type === undefined) !== (value.address === undefined),
"Supply exactly one of type or address",
);
/** Types remain analysis database observations; child identities can be inspected separately. */
export const nativeDataTypeSchema = z.strictObject({
status: z.enum(["available", "unavailable"]),
reason: z.string().nullable(),
id: z.string().nullable(),
name: z.string().nullable(),
kind: z.enum([
"struct",
"union",
"enum",
"pointer",
"array",
"typedef",
"scalar",
"unsupported",
"unavailable",
]),
source: z.literal("analysis-database"),
source_archive: z.string().nullable(),
address: z.string().nullable(),
size_bytes: z.number().int().nonnegative().nullable(),
alignment_bytes: z.number().int().positive().nullable(),
packing_enabled: z.boolean().nullable(),
referenced_type: z.string().nullable(),
array_count: z.number().int().nonnegative().nullable(),
array_stride_bytes: z.number().int().nonnegative().nullable(),
fields: z.array(
z.strictObject({
ordinal: z.number().int().nonnegative(),
name: z.string().nullable(),
offset_bytes: z.number().int().nonnegative(),
size_bytes: z.number().int().nonnegative().nullable(),
type_id: z.string(),
bit_size: z.number().int().nonnegative().nullable(),
bit_offset: z.number().int().nonnegative().nullable(),
status: z.enum(["observed", "unsupported"]),
flexible_tail: z.literal("unknown"),
}),
),
members: z.array(z.strictObject({ name: z.string(), value: z.string() })),
total_fields: z.number().int().nonnegative(),
truncated: z.boolean(),
limitations: z.array(z.string()),
});