Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

1.3 KB
Raw Blame
import { z } from "zod";
import { webTextArtifactSchema } from "./webContentArtifact.js";

/** Structural DOM facts shared by passive web and Electron observations. */
export const cdpDomNodeSchema = z.object({
  index: z.number().int().min(0),
  parent_index: z.number().int().min(-1),
  node_type: z.number().int().min(0),
  node_name: z.string(),
  node_value_length: z.number().int().min(0),
  attribute_names: z.array(z.string()),
});

/** Captured text or an explicit reason why source is unavailable. */
export const cdpScriptSourceSchema = z.discriminatedUnion("included", [
  z.object({ included: z.literal(false), reason: z.string() }),
  z.object({
    included: z.literal(true),
    artifact: webTextArtifactSchema,
  }),
]);

/** Producer script declarations; unavailable facts remain null. */
export const cdpScriptMetadataSchema = z.object({
  cdp_hash: z
    .string()
    .nullable()
    .describe("Producer-reported script hash; null when unavailable."),
  length: z
    .number()
    .int()
    .min(0)
    .nullable()
    .describe("Producer-reported script length; null when unavailable."),
  is_module: z
    .boolean()
    .nullable()
    .describe(
      "Producer-reported module classification; null when unavailable.",
    ),
  language: z.string().nullable(),
});