Skip to main content

@svatah/yam-screens

The headless screen model: one set of screens, actions and keys behind the app, yam ui, the SDK and the CLI

Exports

ExportKindSignature
Actioninterfaceexport interface ActionOne action (LLD §13.7).
ActionArgsinterfaceexport interface ActionArgs extends ScreenParamsWhat an action was given: the screen's params, plus whatever the row supplied.
actionByIdfunctionexport function actionById(id: string): Action | undefinedOne action by id, or undefined. The renderers and the SDK both use this.
ActionInputinterfaceexport interface ActionInputOne thing an action must be given before it runs.
ActionOutcomeinterfaceexport interface ActionOutcomeWhat an action answered with. Renderers show message; agents read the rest.
ACTIONSvariableACTIONS: readonly Action[] = [...ACTIONS_ONLY, ...GO_TO]Every action, in palette order: Actions first, then Go to (LLD §13.7).
actionsForScreenfunctionexport function actionsForScreen(screen: ScreenId): readonly Action[]The actions a screen offers, in registry order.
AgentsStateinterfaceexport interface AgentsState extends ScreenStateBase
agofunctionexport function ago(at: string | undefined, now: number): string | undefined"run 22 min ago", from an ISO timestamp and the moment now.
ApiRequestResponseinterfaceexport interface ApiRequestResponse
ApiRequestRowinterfaceexport interface ApiRequestRow
apiResponseViewfunctionexport function apiResponseView(value: unknown): ApiResponseView | undefinedA response object → what the screen shows of it.
ApiResponseViewinterfaceexport interface ApiResponseViewWhat POST /api/request answered, when one has been sent on this screen.
ApiStateinterfaceexport interface ApiState extends ScreenStateBase
applyEventfunctionexport function applyEvent(state: RunState, event: ServiceEventLike): RunStateFold one event into a run's state (LLD §13.5's stream, §13.7's live screen).
applyHealEventfunctionexport function applyHealEvent(state: HealState, event: ServiceEventLike): HealStateFold one event into the Heal screen's state (LLD §13.5's stream).
applyRecordEventfunctionexport function applyRecordEvent<T extends RecordView>(state: T, event: ServiceEventLike): TFold one event into the Record screen's state (LLD §13.5's stream).
AuditResponseinterfaceexport interface AuditResponseOne audit.jsonl line (LLD §3.4, REQ-AUTO-6).
AuditRowinterfaceexport interface AuditRow
AUTHORING_SCREENSvariableAUTHORING_SCREENS = [
BindingCandidateinterfaceexport interface BindingCandidate
BindingFileResponseinterfaceexport interface BindingFileResponseGET /bindings/:id, parsed: the YAML yam bindings show prints.
BindingInspectorinterfaceexport interface BindingInspectorWhat the inspector shows about the selected binding (the Bindings artboard).
BindingListRowinterfaceexport interface BindingListRowGET /bindings — the list, which is ids and file paths and nothing else.
BindingRowinterfaceexport interface BindingRow
BindingsStateinterfaceexport interface BindingsState extends ScreenStateBase
CompileResponseinterfaceexport interface CompileResponse
DataResponseinterfaceexport interface DataResponse
DataRowinterfaceexport interface DataRow
DataStateinterfaceexport interface DataState extends ScreenStateBase
defaultScreenOffunctionexport function defaultScreenOf(section: SectionId): ScreenIdThe screen a section opens on: the first row of its sub-rail.
DESKTOP_HOLDERvariableDESKTOP_HOLDER = "Yam desktop"How this desktop names itself when it takes a target (SF-13, T16).
Diagnosticinterfaceexport interface Diagnostic
dottedvariabledotted = (...parts: ReadonlyArray<string | undefined>): string =>["a", "b"]"a · b", dropping the empties. The mockups' subtitle style.
envelopeErrorfunctionexport function envelopeError(value: unknown): string | undefinedThe error.message of a failed/refused envelope, when it carries one.
EVERY_SCREEN_IS_MODELLEDvariableEVERY_SCREEN_IS_MODELLED: boolean = SCREEN_IDS.every((id) =>Every screen id has exactly one screen. The renderers rely on it; so does --json.
FakeCallinterfaceexport interface FakeCallWhat the fake was asked, in order. A test asserts on the screen rule with it.
FakeNotFoundclassexport class FakeNotFound extends ErrorA route the fixtures have no answer for. Screens treat it as an empty screen.
FakeResponsesinterfaceexport interface FakeResponsesEvery response the fake can give, keyed the way the fixtures file is.
fakeServicefunctionexport function fakeService(responses: FakeResponses = {}): FakeService
FakeServiceinterfaceexport interface FakeService extends ScreenService
FlowLineinterfaceexport interface FlowLineOne line of the editor, with what the plan and the last run say about it.
FlowRowinterfaceexport interface FlowRowOne row of the flow list (the Main artboard's left column).
flowsScreenvariableflowsScreen: Screen<FlowsState>
FlowsStateinterfaceexport interface FlowsState extends ScreenStateBase
HealProposalinterfaceexport interface HealProposalOne repair the healer proposes: before, after, and why (REQ-HEAL-2).
HealStateinterfaceexport interface HealState extends ScreenStateBase
importResultViewfunctionexport function importResultView(value: unknown): ImportState["result"]POST /migrate's answer → the rows the screen shows.
ImportStateinterfaceexport interface ImportState extends ScreenStateBase
loadRecordfunctionexport async function loadRecord(Load the record mode's half of a Session (TV-M04).
loadSurfacefunctionexport async function loadSurface(Load the do mode's half of a Session (TV-M04).
modeFromfunctionexport function modeFrom(value: unknown): SessionMode--mode, validated against the model's own list; do when unsaid.
needsProjectfunctionexport function needsProject(screen: ScreenId): boolean
outcomeOffunctionexport function outcomeOf(summary: SummaryResponse): PillHow a summary's outcome reads, in one place (T10.4 added stopped).
parseBindingfunctionexport function parseBinding(text: string): BindingFileResponse | undefinedOne binding file's YAML → the shape a screen reads, or undefined.
Pillinterfaceexport interface PillA pill: a word, and the tone that colours it. The word is never omitted.
PlanResponseinterfaceexport interface PlanResponse
PlanStepinterfaceexport interface PlanStepOne compiled step, as the Plan tab and the editor's gutter read it.
PlanStoryinterfaceexport interface PlanStory
platformGroupsfunctionexport function platformGroups(Adapters and targets → the platform-family groups the screen draws.
pluralvariableplural = (n: number, one: string, many = ${one}s): string =>1/2"1 story"/"2 stories".
policyTextfunctionexport function policyText(policy: string | { compensate?: string } | undefined): string | undefinedAn onFailure policy as one phrase (REQ-AUTO-4).
problemForfunctionexport function problemFor(code: string | undefined, message: string): SurfaceProblem | undefinedA domain error code → the state it puts the inspector in, and the way out.
ProjectResponseinterfaceexport interface ProjectResponseWhat the service's answers look like, as far as a screen reads them.
RAILvariableRAIL: ReadonlyArray<
RecordDecisioninterfaceexport interface RecordDecisionOne grounding waiting on a reviewer (REQ-ADE-4, the record.decision event).
RecordLoadtypealiasexport type RecordLoad = RecordView & Omit<ScreenStateBase, "screen">;The view, plus the provenance the loader collected for it.
RecordViewinterfaceexport interface RecordViewWhat the record mode of Session is about (TV-M04).
RunInspectorinterfaceexport interface RunInspector
runScreenvariablerunScreen: Screen<RunState>
RunsFiltersinterfaceexport interface RunsFiltersThe filter chips the artboard shows. all is not a filter.
RunsInspectorinterfaceexport interface RunsInspectorWhat the inspector shows about the selected run (the artboard's right column).
RunsRowinterfaceexport interface RunsRow
RunsStateinterfaceexport interface RunsState extends ScreenStateBase
RunStateinterfaceexport interface RunState extends ScreenStateBase
runStateFromfunctionexport function runStateFrom(Build the whole state from a summary, its results and its audit.
RunStepRowinterfaceexport interface RunStepRow
RunStoryRowinterfaceexport interface RunStoryRow
SaidSentenceinterfaceexport interface SaidSentenceOne sentence the person said, and what became of it.
SayViewinterfaceexport interface SayViewThe say mode's own state (TV-15).
Screeninterfaceexport interface Screen<S extends ScreenStateBase = ScreenStateBase>One screen (LLD §13.7).
SCREEN_IDSvariableSCREEN_IDS = [The twelve screens (LLD §13.7).
screenByIdfunctionexport function screenById(id: ScreenId): Screen<ScreenStateBase>One screen by id. Throws rather than answering undefined: ids are a union.
ScreenIdtypealiasexport type ScreenId = (typeof SCREEN_IDS)[number];
ScreenParamsinterfaceexport interface ScreenParamsWhat a screen was asked to show: which flow, which run, which binding.
SCREENSvariableSCREENS: readonly Screen<ScreenStateBase>[] = [Every screen, in rail order (LLD §13.7's information architecture).
ScreenServiceinterfaceexport interface ScreenServiceA screen asks for what it renders and gets unknown; it parses with @svatah/yam-schema.
ScreenStateBaseinterfaceexport interface ScreenStateBaseEvery screen's state carries these, so a renderer's chrome is written once.
SECONDARY_SCREENSvariableSECONDARY_SCREENS = [
Sectioninterfaceexport interface Section
SectionIdtypealiasexport type SectionId = "session" | "automations" | "activity" | "settings";The four destinations (SF-16, REQ-ADE-11).
sectionOffunctionexport function sectionOf(screen: ScreenId): SectionId
SECTIONSvariableSECTIONS: readonly Section[] = [
ServiceConnectionInfointerfaceexport interface ServiceConnectionInfoWhere the connection is, for the renderers' chrome and for --json.
ServiceEventLikeinterfaceexport interface ServiceEventLikeOne line of the event stream, as far as a screen cares.
SESSION_MODESvariableSESSION_MODES = ["record", "say", "do"] as constSession's three modes (REQ-ADE-14, Draft 2.27).
SessionModetypealiasexport type SessionMode = (typeof SESSION_MODES)[number];
sessionScreenvariablesessionScreen: Screen<SessionState>
SessionStateinterfaceexport interface SessionState extends ScreenStateBase
SettingsStateinterfaceexport interface SettingsState extends ScreenStateBase
Sourcesclassexport class SourcesCollects the endpoints a load touched and the first thing that went wrong.
stampfunctionexport function stamp(at: string | undefined, startedAt: string | undefined): string2026-09-05T09:13:42.896Z and the run's start → 08.451, the mockup's stamp.
StatusTonetypealiasexport type StatusTone = "pass" | "fail" | "skip" | "healed" | "abort" | "info" | "neutral";A status word with the colour token beside it (LLD §13.7: never colour alone).
StepInspectorinterfaceexport interface StepInspectorWhat the inspector shows about the selected step.
StepResultResponseinterfaceexport interface StepResultResponse
SummaryResponseinterfaceexport interface SummaryResponse
SurfaceActionFieldinterfaceexport interface SurfaceActionFieldOne field of an action's form, as the catalogue describes it.
SurfaceActionOfferinterfaceexport interface SurfaceActionOfferOne action this surface can perform, with what it needs.
SurfaceAdapterRowinterfaceexport interface SurfaceAdapterRowOne adapter the service reported, with its readiness and, when not, why.
SurfaceAgentSetupinterfaceexport interface SurfaceAgentSetupWhat a generic MCP client needs to reach the same sessions (SF-07, T16).
SurfaceElementViewinterfaceexport interface SurfaceElementViewWhat describe said about the selected control.
SurfaceLoadtypealiasexport type SurfaceLoad = SurfaceView & Omit<ScreenStateBase, "screen">;The view, plus the provenance the loader collected for it.
surfaceOutcomeViewfunctionexport function surfaceOutcomeView(value: unknown): SurfaceOutcomeView | undefinedWhat an act and its postcondition came to (SF-11, T15).
SurfaceOutcomeViewinterfaceexport interface SurfaceOutcomeViewWhat an act (and its optional postcondition) came to (SF-11).
SurfacePlatformGroupinterfaceexport interface SurfacePlatformGroupA platform family, with its adapters and any targets discovered under it.
SurfaceProbleminterfaceexport interface SurfaceProblem
SurfaceProblemKindtypealiasexport type SurfaceProblemKind A state the inspector is in that is not "ready" (SF-17).
SurfaceSessionRowinterfaceexport interface SurfaceSessionRowOne open session, an agent's or a person's (SF-05, SF-13).
SurfaceSessionViewinterfaceexport interface SurfaceSessionViewThe session the inspector is about.
SurfaceTargetRowinterfaceexport interface SurfaceTargetRowOne target the service discovered — an adapter, or a URL through one.
SurfaceTreeLineinterfaceexport interface SurfaceTreeLineOne line of the semantic tree, as the inspector draws it.
SurfaceViewinterfaceexport interface SurfaceViewWhat the do mode of Session is about (TV-M04).
ToolsResponseinterfaceexport interface ToolsResponseGET /tools{ tools: { tools, refused }, invocations }.
TREE_MAX_NODESvariableTREE_MAX_NODES = 200How many nodes the inspector's tree asks for. Bounded, and it says when it truncated.
treeLinesfunctionexport function treeLines(A snapshot's flat nodes → the indented lines the tree pane draws.