Skip to main content

Function: validateInterruptAnswer()

validateInterruptAnswer(spec, value): InterruptAnswer

Defined in: packages/core/src/interrupt/types.ts:190

Validate a resume value against the stored interrupt spec (never trust client-claimed kinds).

Parameters​

spec​

{ cancelLabel?: string; confirmLabel?: string; id?: string; kind: "confirm"; metadata?: Record<string, unknown>; prompt: string; } | { id?: string; kind: "text"; maxLength?: number; metadata?: Record<string, unknown>; placeholder?: string; prompt: string; } | { id?: string; kind: "choice"; metadata?: Record<string, unknown>; multiple?: boolean; options: object[]; prompt: string; } | { id?: string; kind: "number"; max: number; metadata?: Record<string, unknown>; min: number; prompt: string; step?: number; } | { accept?: string[]; id?: string; kind: "file"; maxBytes?: number; metadata?: Record<string, unknown>; prompt: string; } | { id?: string; kind: "encrypted"; metadata?: Record<string, unknown>; prompt: string; purpose?: "password" | "secret" | "api_key"; }

Type Literal​

{ cancelLabel?: string; confirmLabel?: string; id?: string; kind: "confirm"; metadata?: Record<string, unknown>; prompt: string; }

cancelLabel?​

string = ...

confirmLabel?​

string = ...

id?​

string = ...

kind​

"confirm" = ...

metadata?​

Record<string, unknown> = ...

Opaque host correlation/presentation hints, persisted with the interrupt.

prompt​

string = ...


Type Literal​

{ id?: string; kind: "text"; maxLength?: number; metadata?: Record<string, unknown>; placeholder?: string; prompt: string; }

id?​

string = ...

kind​

"text" = ...

maxLength?​

number = ...

metadata?​

Record<string, unknown> = ...

Opaque host correlation/presentation hints, persisted with the interrupt.

placeholder?​

string = ...

prompt​

string = ...


Type Literal​

{ id?: string; kind: "choice"; metadata?: Record<string, unknown>; multiple?: boolean; options: object[]; prompt: string; }

id?​

string = ...

kind​

"choice" = ...

metadata?​

Record<string, unknown> = ...

Opaque host correlation/presentation hints, persisted with the interrupt.

multiple?​

boolean = ...

options​

object[] = ...

prompt​

string = ...


Type Literal​

{ id?: string; kind: "number"; max: number; metadata?: Record<string, unknown>; min: number; prompt: string; step?: number; }

id?​

string = ...

kind​

"number" = ...

max​

number = ...

metadata?​

Record<string, unknown> = ...

Opaque host correlation/presentation hints, persisted with the interrupt.

min​

number = ...

prompt​

string = ...

step?​

number = ...


Type Literal​

{ accept?: string[]; id?: string; kind: "file"; maxBytes?: number; metadata?: Record<string, unknown>; prompt: string; }

accept?​

string[] = ...

id?​

string = ...

kind​

"file" = ...

maxBytes?​

number = ...

metadata?​

Record<string, unknown> = ...

Opaque host correlation/presentation hints, persisted with the interrupt.

prompt​

string = ...


Type Literal​

{ id?: string; kind: "encrypted"; metadata?: Record<string, unknown>; prompt: string; purpose?: "password" | "secret" | "api_key"; }

id?​

string = ...

kind​

"encrypted" = ...

metadata?​

Record<string, unknown> = ...

Opaque host correlation/presentation hints, persisted with the interrupt.

prompt​

string = ...

purpose?​

"password" | "secret" | "api_key" = ...

value​

unknown

Returns​

InterruptAnswer