Skip to main content

@svatah/yam-schema

Zod definitions and generated JSON Schemas for the Yam artifact contracts

Exports

ExportKindSignature
ActArgstypealiasexport type ActArgs = z.infer<typeof actArgsSchema>;
actArgsSchemavariableactArgsSchema = z.record(
Actiontypealiasexport type Action = z.infer<typeof actionSchema>;
ACTION_FORMSvariableACTION_FORMS: readonly ActionForm[] = [The forms, in the order an inspector offers them: the common ones first.
ActionFieldinterfaceexport interface ActionField
ActionFieldTypetypealiasexport type ActionFieldType = "string" | "number" | "boolean" | "url" | "key";How a field is collected, and how it is typed on the way to args.
ActionForminterfaceexport interface ActionForm
actionFormForfunctionexport function actionFormFor(action: string): ActionForm | undefinedOne form by action name.
ACTIONSvariableACTIONS = [Every action a compiled step can carry. Order follows LLD §3.2 exactly.
actionSchemavariableactionSchema = z.enum(ACTIONS)
ActResulttypealiasexport type ActResult = z.infer<typeof actResultSchema>;
actResultSchemavariableactResultSchema = z
AdapterNametypealiasexport type AdapterName = z.infer<typeof adapterNameSchema>;
adapterNameSchemavariableadapterNameSchema = z.enum(["playwright", "bidi", "appium", "uia", "ax", "http", "process", "atspi"])Project configuration, yam.config.yaml (LLD §3.5).
ApiRequesttypealiasexport type ApiRequest = z.infer<typeof apiRequestSchema>;
apiRequestSchemavariableapiRequestSchema = z
ApiResponsetypealiasexport type ApiResponse = z.infer<typeof apiResponseSchema>;
apiResponseSchemavariableapiResponseSchema = z
ArgValuetypealiasexport type ArgValue = ValueRef | ScalarArg;
argValueSchemavariableargValueSchema: z.ZodType<ValueRef | ScalarArg> = z.union([Step.args values: a ValueRef or a plain scalar (LLD §3.2).
AUDIT_KINDSvariableAUDIT_KINDS = [
AuditKindtypealiasexport type AuditKind = z.infer<typeof auditKindSchema>;
auditKindSchemavariableauditKindSchema = z.enum(AUDIT_KINDS)
AuditLinetypealiasexport type AuditLine = z.infer<typeof auditLineSchema>;
auditLineSchemavariableauditLineSchema = z
Behaviortypealiasexport type Behavior = z.infer<typeof behaviorSchema>;
behaviorSchemavariablebehaviorSchema = z.enum(["test", "workflow", "tool"])
BindingContexttypealiasexport type BindingContext = z.infer<typeof bindingContextSchema>;
bindingContextSchemavariablebindingContextSchema = z
BindingEntrytypealiasexport type BindingEntry = z.infer<typeof bindingEntrySchema>;
bindingEntrySchemavariablebindingEntrySchema = zOne recorded binding for one context.
BindingFiletypealiasexport type BindingFile = z.infer<typeof bindingFileSchema>;
bindingFileSchemavariablebindingFileSchema = z
BindingPlatformtypealiasexport type BindingPlatform = z.infer<typeof bindingPlatformSchema>;
bindingPlatformSchemavariablebindingPlatformSchema = z.enum(["web", "mobile", "desktop"])
bindingsHashfunctionexport function bindingsHash(files: Record<string, unknown>): stringHash of a whole bindings store: the id → file map, hashed canonically. Used in
Boxtypealiasexport type Box = z.infer<typeof boxSchema>;
boxSchemavariableboxSchema = z.tuple([z.number(), z.number(), z.number(), z.number()])[x, y, width, height].
Candidatetypealiasexport type Candidate = z.infer<typeof candidateSchema>;
CANDIDATE_KINDSvariableCANDIDATE_KINDS = [
CandidateKindtypealiasexport type CandidateKind = z.infer<typeof candidateKindSchema>;
candidateKindSchemavariablecandidateKindSchema = z.enum(CANDIDATE_KINDS)
candidateSchemavariablecandidateSchema = z
canonicalHashfunctionexport function canonicalHash(value: unknown): stringsha256 of the compact canonical form, hex encoded.
canonicalJsonfunctionexport function canonicalJson(value: unknown): stringDeterministic JSON: sorted keys, two-space indent, one trailing newline.
canonicalJsonCompactfunctionexport function canonicalJsonCompact(value: unknown): stringDeterministic JSON with no whitespace — the form hashes are taken over.
canonicalYamlfunctionexport function canonicalYaml(value: unknown): stringDeterministic YAML: sorted keys, block style, no line folding.
Capabilitiestypealiasexport type Capabilities = z.infer<typeof capabilitiesSchema>;
CAPABILITIESvariableCAPABILITIES: readonly CapabilityFlag[] = CAPABILITY_FLAGSEvery capability flag, so a client can render a readiness list.
capabilitiesSchemavariablecapabilitiesSchema = z
CAPABILITY_FLAGSvariableCAPABILITY_FLAGS = [
CapabilityFlagtypealiasexport type CapabilityFlag = (typeof CAPABILITY_FLAGS)[number];
Capturetypealiasexport type Capture = z.infer<typeof captureSchema>;
captureSchemavariablecaptureSchema = z
Checkpointtypealiasexport type Checkpoint = z.infer<typeof checkpointSchema>;
checkpointSchemavariablecheckpointSchema = zEnough state to resume a flow from this step (REQ-AUTO-3).
CheckResulttypealiasexport type CheckResult = z.infer<typeof checkResultSchema>;
checkResultSchemavariablecheckResultSchema = z
CheckSubjecttypealiasexport type CheckSubject = z.infer<typeof checkSubjectSchema>;
checkSubjectSchemavariablecheckSubjectSchema = z.enum(["ref", "page", "dialog"])
COMPILER_TIERSvariableCOMPILER_TIERS = [0, 1, 2, 3] as const
Configtypealiasexport type Config = z.infer<typeof configSchema>;
configSchemavariableconfigSchema = z
COORDS_CANDIDATE_KINDvariableCOORDS_CANDIDATE_KIND = "coords" as constLast resort: the element's box centre.
DEFAULT_CONFIGvariableDEFAULT_CONFIG: Omit<Config, "project"> The default configuration yam init writes; also the base a partial config merges onto.
DEFAULT_IGNORE_ATTRIBUTESvariableDEFAULT_IGNORE_ATTRIBUTES = ["data-yam-eval"]The default of bindings.ignoreAttributes (LLD §3.5, §16, Draft 2.3).
defaultActionForRolefunctionexport function defaultActionForRole(role: string | undefined): stringThe action an inspector opens on for an element of this role.
DESKTOP_CANDIDATE_KINDSvariableDESKTOP_CANDIDATE_KINDS = ["automationId", "controlPath"] as constDesktop candidate kinds (Windows UIA, macOS AX).
ElementDescriptiontypealiasexport type ElementDescription = z.infer<typeof elementDescriptionSchema>;
elementDescriptionSchemavariableelementDescriptionSchema = zWhat describe(ref) returns: everything candidate synthesis and fingerprinting
Environmenttypealiasexport type Environment = z.infer<typeof environmentSchema>;
environmentSchemavariableenvironmentSchema = z.enum(["test", "staging", "production"])
Expectationtypealiasexport type Expectation = z.infer<typeof expectationSchema>;
expectationSchemavariableexpectationSchema = z
EXPR_OPSvariableEXPR_OPS = ["eq", "ne", "gt", "lt", "matches"] as const
FAILURE_CLASSESvariableFAILURE_CLASSES = [
FailureClasstypealiasexport type FailureClass = z.infer<typeof failureClassSchema>;
failureClassSchemavariablefailureClassSchema = z.enum(FAILURE_CLASSES)
Fingerprinttypealiasexport type Fingerprint = z.infer<typeof fingerprintSchema>;
fingerprintSchemavariablefingerprintSchema = z
FLOW_STATUSESvariableFLOW_STATUSES = ["passed", "failed", "healed", "aborted"] as const
FlowStatustypealiasexport type FlowStatus = z.infer<typeof flowStatusSchema>;
flowStatusSchemavariableflowStatusSchema = z.enum(FLOW_STATUSES)
GeneratedSchemastypealiasexport type GeneratedSchemas = Record<string, string>;Base name → generated JSON Schema text, exactly as it is written to disk.
generateJsonSchemasfunctionexport function generateJsonSchemas(): GeneratedSchemasRender every published schema (REQ-STD-1).
GEOMETRY_PREDICATE_KINDSvariableGEOMETRY_PREDICATE_KINDS = ["location", "size", "box"] as const
Guardtypealiasexport type Guard = z.infer<typeof guardSchema>;
guardSchemavariableguardSchema = z
HUMAN_PROVENANCE_MODELvariableHUMAN_PROVENANCE_MODEL = "human"The model value that marks a human, rather than model, decision.
INPUT_TYPESvariableINPUT_TYPES = ["string", "number", "boolean", "json", "secret"] as const
Invokertypealiasexport type Invoker = z.infer<typeof invokerSchema>;
invokerSchemavariableinvokerSchema = z
isHumanProvenancefunctionexport function isHumanProvenance(p: Provenance): booleanTrue when the provenance records a human decision rather than a model call.
MOBILE_CANDIDATE_KINDSvariableMOBILE_CANDIDATE_KINDS = ["accessibilityId", "resourceId"] as constMobile candidate kinds (Appium).
MODEL_TIERSvariableMODEL_TIERS: readonly Tier[] = [2, 3]Tiers whose output came from a model and therefore requires provenance (REQ-STD-4).
NAMED_VALUE_PREDICATE_KINDSvariableNAMED_VALUE_PREDICATE_KINDS = ["attribute", "css"] as const
NODE_STATESvariableNODE_STATES = [
NodeStatetypealiasexport type NodeState = z.infer<typeof nodeStateSchema>;
nodeStateSchemavariablenodeStateSchema = z.enum(NODE_STATES)
offeredActionsfunctionexport function offeredActions(The actions this surface can actually perform, in offer order (SF-09).
OnFailuretypealiasexport type OnFailure = z.infer<typeof onFailureSchema>;
onFailureSchemavariableonFailureSchema = z.union([stop (default), continue, or run a named compensating story then stop.
Origintypealiasexport type Origin = z.infer<typeof originSchema>;
originSchemavariableoriginSchema = z
OUTPUT_TYPESvariableOUTPUT_TYPES = ["string", "number", "boolean", "json"] as const
Plantypealiasexport type Plan = z.infer<typeof planSchema>;
planHashfunctionexport function planHash(plan: Record<string, unknown>): stringHash of a plan's content (REQ-COMP-7, REQ-AUTO-3).
planSchemavariableplanSchema = z
Predicatetypealiasexport type Predicate = z.infer<typeof predicateSchema>;
PREDICATE_KINDSvariablePREDICATE_KINDS = [Every predicate kind, in LLD §3.2 order.
predicateSchemavariablepredicateSchema = z.union([
PredicateSubjecttypealiasexport type PredicateSubject = z.infer<typeof predicateSubjectSchema>;
predicateSubjectSchemavariablepredicateSubjectSchema = z.enum(["target", "page", "dialog", "scope", "set", "api"])What a predicate is asked about (LLD §3.2; set and api from Draft 2.15).
Proposaltypealiasexport type Proposal = z.infer<typeof proposalSchema>;
proposalSchemavariableproposalSchema = zA proposal written to proposals/<date>/ by the trajectory compiler (HLD §6.6,
Provenancetypealiasexport type Provenance = z.infer<typeof provenanceSchema>;
provenanceSchemavariableprovenanceSchema = zProvenance of a model-produced artifact (LLD §3.5).
PUBLISHED_SCHEMASvariablePUBLISHED_SCHEMAS: readonly PublishedSchema[] = [
publishedSchemafunctionexport function publishedSchema(name: string): PublishedSchema | undefinedLook one up by base name.
PublishedSchemainterfaceexport interface PublishedSchemaEvery schema that is published as a JSON Schema file under
ReadKindtypealiasexport type ReadKind = z.infer<typeof readKindSchema>;
readKindSchemavariablereadKindSchema = z.enum(["text", "value", "attribute", "title", "url", "result"])
Reftypealiasexport type Ref = z.infer<typeof refSchema>;
referencesSecretfunctionexport function referencesSecret(ref: ValueRef): booleanTrue when a ValueRef reads a value marked secret; used by redaction (REQ-NFR-6).
refSchemavariablerefSchema = z.string().min(1)Opaque above the surface: "r12" style, stable within one snapshot (LLD §2.2).
ScalarArgtypealiasexport type ScalarArg = z.infer<typeof scalarArgSchema>;
scalarArgSchemavariablescalarArgSchema = z.union([z.string(), z.number(), z.boolean()])A literal that a step may carry directly rather than through a ValueRef.
SCHEMA_VERSIONvariableSCHEMA_VERSION = "1.0.0"The version of the Yam artifact contract.
schemaFileNamefunctionexport function schemaFileName(name: string): string<name>.schema.json for a registry entry.
SchemaVersiontypealiasexport type SchemaVersion = typeof SCHEMA_VERSION;
SessionInittypealiasexport type SessionInit = z.infer<typeof sessionInitSchema>;
sessionInitSchemavariablesessionInitSchema = z
SessionStatetypealiasexport type SessionState = z.infer<typeof sessionStateSchema>;
sessionStateSchemavariablesessionStateSchema = zThe restorable subset of session state (LLD §2.1). It is what a checkpoint
Signaturetypealiasexport type Signature = z.infer<typeof signatureSchema>;
signatureSchemavariablesignatureSchema = z
Snapshottypealiasexport type Snapshot = z.infer<typeof snapshotSchema>;
SnapshotNodetypealiasexport type SnapshotNode = z.infer<typeof snapshotNodeSchema>;
snapshotNodeSchemavariablesnapshotNodeSchema = z
snapshotSchemavariablesnapshotSchema = z
STATE_PREDICATE_KINDSvariableSTATE_PREDICATE_KINDS = [
Steptypealiasexport type Step = z.infer<typeof stepShape>;
STEP_STATUSESvariableSTEP_STATUSES = ["passed", "failed", "skipped", "healed", "aborted"] as constaborted was added in Draft 2 for the abort policies (REQ-AUTO-4).
StepResulttypealiasexport type StepResult = z.infer<typeof stepResultSchema>;
stepResultSchemavariablestepResultSchema = z
stepSchemavariablestepSchema = stepShapeA compiled step.
StepStatustypealiasexport type StepStatus = z.infer<typeof stepStatusSchema>;
stepStatusSchemavariablestepStatusSchema = z.enum(STEP_STATUSES)
Storytypealiasexport type Story = z.infer<typeof storySchema>;
StoryMetatypealiasexport type StoryMeta = z.infer<typeof storyMetaSchema>;
storyMetaSchemavariablestoryMetaSchema = z
storySchemavariablestorySchema = z
Summarytypealiasexport type Summary = z.infer<typeof summarySchema>;
summarySchemavariablesummarySchema = z
SURFACE_ACTIONSvariableSURFACE_ACTIONS: readonly SurfaceAction[] = surfaceActionSchema.options
SURFACE_ONLY_EXCLUSIONSvariableSURFACE_ONLY_EXCLUSIONS = ["api", "custom", "expect"] as constThe actions an adapter implements: the IR action set minus api, custom and
SurfaceActiontypealiasexport type SurfaceAction = Exclude<Action, (typeof SURFACE_ONLY_EXCLUSIONS)[number]>;
surfaceActionSchemavariablesurfaceActionSchema = actionSchema.exclude(SURFACE_ONLY_EXCLUSIONS)
SurfaceActMessagetypealiasexport type SurfaceActMessage = z.infer<typeof surfaceActMessageSchema>;
surfaceActMessageSchemavariablesurfaceActMessageSchema = zsurface.act.schema.json — request and response of act().
SurfaceCapabilitiesMessagetypealiasexport type SurfaceCapabilitiesMessage = z.infer<typeof surfaceCapabilitiesMessageSchema>;
surfaceCapabilitiesMessageSchemavariablesurfaceCapabilitiesMessageSchema = zsurface.capabilities.schema.json — the descriptor an adapter publishes.
SurfaceCheckMessagetypealiasexport type SurfaceCheckMessage = z.infer<typeof surfaceCheckMessageSchema>;
surfaceCheckMessageSchemavariablesurfaceCheckMessageSchema = zsurface.check.schema.json — request and response of check().
SurfaceKindtypealiasexport type SurfaceKind = z.infer<typeof surfaceKindSchema>;
surfaceKindSchemavariablesurfaceKindSchema = z.enum(["web", "mobile", "desktop", "http", "process"])process is a terminal (T22, SF-22).
SurfaceLocateMessagetypealiasexport type SurfaceLocateMessage = z.infer<typeof surfaceLocateMessageSchema>;
surfaceLocateMessageSchemavariablesurfaceLocateMessageSchema = zsurface.locate.schema.json — candidate in, references out (used by the resolver).
SurfaceReadMessagetypealiasexport type SurfaceReadMessage = z.infer<typeof surfaceReadMessageSchema>;
surfaceReadMessageSchemavariablesurfaceReadMessageSchema = zsurface.read.schema.json — request and response of read().
SurfaceSnapshotMessagetypealiasexport type SurfaceSnapshotMessage = z.infer<typeof surfaceSnapshotMessageSchema>;
surfaceSnapshotMessageSchemavariablesurfaceSnapshotMessageSchema = zsurface.snapshot.schema.json — request and response of snapshot().
TargetReftypealiasexport type TargetRef = z.infer<typeof targetRefSchema>;
targetRefSchemavariabletargetRefSchema = z
TargetScopetypealiasexport type TargetScope = z.infer<typeof targetScopeSchema>;
targetScopeSchemavariabletargetScopeSchema = z.enum(["page", "dialog", "frame", "desktop", "window"])desktop and window were added in Draft 2 for the OS accessibility adapters.
TargetStatustypealiasexport type TargetStatus = z.infer<typeof targetStatusSchema>;
targetStatusSchemavariabletargetStatusSchema = z.enum(["bound", "unbound", "ambiguous"])
Tiertypealiasexport type Tier = z.infer<typeof tierSchema>;
tierSchemavariabletierSchema = z.union([
VALUE_PREDICATE_KINDSvariableVALUE_PREDICATE_KINDS = [
ValueReftypealiasexport type ValueRef How a step refers to a value (LLD §3.1).
valueRefSchemavariablevalueRefSchema: z.ZodType<ValueRef> = z.lazy(() =>
WEB_CANDIDATE_KINDSvariableWEB_CANDIDATE_KINDS = [Web candidate kinds.
WEBMCP_CANDIDATE_KINDvariableWEBMCP_CANDIDATE_KIND = "webmcp" as constA tool the page declared through WebMCP; preferred over locators at replay (REQ-ADP-9).