Record Type In Jay-Action
Design Log 120 — record(T) Type in Jay-Action
Written for AI agents. See Log Methodology Note below for details.
Background
Jay-actions need to express Record<string, T> as output types. A real use case: VariantStockMap — variant IDs → option IDs → in-stock booleans (Record<string, Record<string, boolean>>). The existing type notation had no way to express typed record/map types. Empty objects {} produce Record<string, unknown>, but there was no notation for typed values.
Design
Add record(T) keyword to the compact type notation, following the enum(a | b | c) pattern. Supports nesting and all existing inner types via recursive parsing.
outputSchema:
stock: record(boolean) # Record<string, boolean>
variants: record(record(boolean)) # Record<string, Record<string, boolean>>
labels: record(string) # Record<string, string>
items: record(productCard) # Record<string, ProductCardViewState>
Implementation
Changes
compiler-shared/lib/jay-type.ts— AddedrecordtoJayTypeKind,JayRecordTypeclass (mirrorsJayArrayType),isRecordType()guard,equalJayTypes()casecompiler-shared/lib/jay-type-to-json-schema.ts— AddedadditionalPropertiestoJsonSchemaProperty, record →{ type: 'object', additionalProperties: ... }conversioncompiler-jay-html/lib/action/action-parser.ts—record(...)detection inresolveStringType()with recursive inner type parsingcompiler-jay-html/lib/action/action-compiler.ts—renderType()rendersRecord<string, T>,collectImportedAliases()recurses into record items- Documentation — Added
record(T)row to type notation tables inserver-actions.md,plugins.md,contracts-and-plugins.md
Test Results
- compiler-shared: 108/108 passing (including 2 new record JSON Schema tests)
- compiler-jay-html actions: 35/35 passing (including 5 new parser + 4 new compiler tests)
Log Methodology Note
Note: These design logs are written primarily for AI agents as part of the Design Log methodology and made accessible here for human readers. The language and structure are optimized for machine consumption — expect precise, specification-style prose rather than narrative documentation.