Skip to content

wire

ReadonlySchemaValue<T> > = T extends infer Item[] ? readonly ReadonlySchemaValue<Item>>[] : T extends object ? { readonly [Key in keyof T]: ReadonlySchemaValue<T[Key]> } : T

Preserve readonly domain collections while deriving contracts from schemas.

T


WhistleJsonValue = ReadonlySchemaValue<z.output<typeof WhistleJsonValueSchema>>>>

JSON values accepted at Whistle transport boundaries.


WhistleJsonObject = ReadonlySchemaValue<z.output<typeof WhistleJsonObjectSchema>>>>

A JSON object accepted at Whistle transport boundaries.


WhistleFailure = ReadonlySchemaValue<z.output<typeof WhistleFailureSchema>>>>

Portable failure data that crosses Whistle transports.


WhistleActionSchema = ReadonlySchemaValue<z.output<typeof WhistleActionSchemaSchema>>>>

JSON Schema document used as an action input or output contract.


WhistleAvailability = ReadonlySchemaValue<z.output<typeof WhistleAvailabilitySchema>>>>

Host-owned availability fact carried in agent snapshots.


WhistleActionPresentation = ReadonlySchemaValue<z.output<typeof WhistleActionPresentationSchema>>>>

Renderer-neutral presentation data attached to an action.


WhistleAction = ReadonlySchemaValue<z.output<typeof WhistleActionDataSchema>>>>

Serializable action data accepted by Whistle.


WhistleSlashArguments = ReadonlySchemaValue<z.output<typeof WhistleSlashArgumentsSchema>>>>

Slash command parsing metadata accepted from transport owners.


WhistleSlashWord = ReadonlySchemaValue<NonNullable<z.output<typeof WhistleSlashArgumentsSchema>>["words"]>[number]>

A fixed word and its action arguments within a slash command.


WhistleCommandProjections = ReadonlySchemaValue<z.output<typeof WhistleCommandProjectionsSchema>>>>

Projection membership selected by a semantic command owner.


WhistleCommandDefinition = ReadonlySchemaValue<z.output<typeof WhistleCommandDefinitionSchema>>>>

Data-only command definition accepted at adapter boundaries.


WhistleAgentProjectionData = z.output<typeof WhistleAgentProjectionSchema>>

Decoded agent projection data as received across the wire.


WhistlePrompt = ReadonlySchemaValue<z.output<typeof WhistlePromptSchema>>>>

A renderer-neutral interaction prompt.


WhistlePromptOption = NonNullable<Extract<WhistlePrompt, { type: "choice"; }>["options"][number]>

One selectable value in a parsed interaction prompt.


WhistleNotice = ReadonlySchemaValue<z.output<typeof WhistleNoticeSchema>>>>

A renderer-neutral interaction notice.


WhistleNoticeLink = ReadonlySchemaValue<NonNullable<Extract<z.output<typeof WhistleNoticeSchema>>, { type: "info"; }>["links"]>[number]>

One link included in a parsed informational notice.


WhistlePromptAnswers = object

Answer types owned by the closed prompt vocabulary.

confirmation: boolean

text: string

choice: string


WhistlePromptOf<Kind> > = { [K in Kind]: Extract<WhistlePrompt, { type: K }> & { type: K } }[Kind]

A prompt and its discriminator remain correlated through generic dispatch.

Kind extends WhistlePrompt["type"]

const WhistleAvailabilitySchema: ZodDiscriminatedUnion<[ZodObject<{ status: ZodLiteral<"available">>; }, $strict>>, ZodObject<{ status: ZodLiteral<"unavailable">>; reason: ZodString; }, $strict>>], "status">>

Host-owned availability carried by every discovered agent row.


const WhistleJsonValueSchema: ZodJSONSchema = json

The JSON value grammar shared by Whistle transports and App adapters.


const WhistleJsonObjectSchema: ZodRecord<ZodString, ZodJSONSchema>>

One JSON object, used for action schemas and custom presentation data.


const parseJsonValue: typeof WhistleJsonValueSchema.parse

Parse copied JSON data at an untrusted transport boundary.


const parseJsonObject: typeof WhistleJsonObjectSchema.parse

Parse a copied JSON object at an untrusted transport boundary.


const WhistleFailureSchema: ZodObject<{ code: ZodString; message: ZodString; details: ZodOptional<ZodJSONSchema>>; }, $strict>>

General portable failure data for adapters that cross a transport.


const parseFailure: typeof WhistleFailureSchema.parse

Parse failure data without carrying an Error or stack across the wire.


const WhistleActionSchemaSchema: ZodRecord<ZodString, ZodJSONSchema> > = WhistleJsonObjectSchema

The JSON object shape used by Whistle action schemas.


const WhistleActionPresentationSchema: ZodUnion<readonly [ZodObject<{ type: ZodLiteral<"action">>; }, $strict>>, ZodObject<{ type: ZodLiteral<"custom">>; data: ZodRecord<ZodString, ZodJSONSchema>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"choice">>; options: ZodArray<ZodObject<{ value: ZodJSONSchema; label: ZodString; description: ZodOptional<ZodString>>; }, $strip>>>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"form">>; submitLabel: ZodOptional<ZodString>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"confirmation">>; message: ZodString; confirmLabel: ZodOptional<ZodString>>; cancelLabel: ZodOptional<ZodString>>; }, $strict>>]>

Validate renderer-neutral presentation data attached to an action.


const WhistleActionDataSchema: ZodObject<{ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; presentation: ZodOptional<ZodUnion<readonly [ZodObject<{ type: ZodLiteral<"action">>; }, $strict>>, ZodObject<{ type: ZodLiteral<"custom">>; data: ZodRecord<ZodString, ZodJSONSchema>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"choice">>; options: ZodArray<ZodObject<{ value: ZodJSONSchema; label: ZodString; description: ZodOptional<…>; }, $strip>>>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"form">>; submitLabel: ZodOptional<ZodString>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"confirmation">>; message: ZodString; confirmLabel: ZodOptional<ZodString>>; cancelLabel: ZodOptional<ZodString>>; }, $strict>>]>>; }, $strict>>

Validate the serializable action contract carried by a command.


const WhistleSlashArgumentsSchema: ZodObject<{ hint: ZodPipe<ZodString, ZodString>>; words: ZodOptional<ZodArray<ZodObject<{ word: ZodString; description: ZodOptional<ZodPipe<ZodString, ZodString>>>>; arguments: ZodRecord<ZodString, ZodJSONSchema>>; }, $strict>>>>>>; text: ZodOptional<ZodObject<{ field: ZodPipe<ZodString, ZodString>>; arguments: ZodRecord<ZodString, ZodJSONSchema>>; requestIdField: ZodOptional<ZodPipe<ZodString, ZodString>>>>; }, $strict>>>>; }, $strict>>

Validate aliases and argument mapping metadata for slash commands.


const WhistleCommandProjectionsSchema: ZodObject<{ bindings: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; values: ZodArray<ZodString>>; }, $strict>>>>; agent: ZodOptional<ZodObject<{ keybind: ZodOptional<ZodString>>; order: ZodOptional<ZodNumber>>; }, $strict>>>>; help: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; }, $strict>>>>; menu: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; }, $strict>>>>; palette: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; }, $strict>>>>; slash: ZodOptional<ZodObject<{ aliases: ZodArray<ZodString>>; order: ZodOptional<ZodNumber>>; arguments: ZodOptional<ZodObject<{ hint: ZodPipe<ZodString, ZodString>>; words: ZodOptional<ZodArray<ZodObject<…, …>>>; text: ZodOptional<ZodObject<{ field: …; arguments: …; requestIdField: …; }, $strict>>>>; }, $strict>>>>; }, $strict>>>>; }, $strict>>

Validate explicit membership and ordering across Whistle surfaces.


const WhistleCommandDefinitionSchema: ZodObject<{ id: ZodString; title: ZodString; category: ZodString; description: ZodOptional<ZodString>>; projections: ZodOptional<ZodObject<{ bindings: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; values: ZodArray<ZodString>>; }, $strict>>>>; agent: ZodOptional<ZodObject<{ keybind: ZodOptional<ZodString>>; order: ZodOptional<ZodNumber>>; }, $strict>>>>; help: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; }, $strict>>>>; menu: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; }, $strict>>>>; palette: ZodOptional<ZodObject<{ order: ZodOptional<ZodNumber>>; }, $strict>>>>; slash: ZodOptional<ZodObject<{ aliases: ZodArray<ZodString>>; order: ZodOptional<ZodNumber>>; arguments: ZodOptional<ZodObject<{ hint: …; words: …; text: …; }, $strict>>>>; }, $strict>>>>; }, $strict>>>>; action: ZodOptional<ZodObject<{ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; presentation: ZodOptional<ZodUnion<readonly [ZodObject<{ type: ZodLiteral<…>; }, $strict>>, ZodObject<{ type: ZodLiteral<…>; data: ZodRecord<…, …>; }, $strict>>, ZodObject<{ type: ZodLiteral<…>; options: ZodArray<…>; }, $strict>>, ZodObject<{ type: ZodLiteral<…>; submitLabel: ZodOptional<…>; }, $strict>>, ZodObject<{ type: ZodLiteral<…>; message: ZodString; confirmLabel: ZodOptional<…>; cancelLabel: ZodOptional<…>; }, $strict>>]>>; }, $strict>>>>; availability: ZodOptional<ZodDiscriminatedUnion<[ZodObject<{ status: ZodLiteral<"available">>; }, $strict>>, ZodObject<{ status: ZodLiteral<"unavailable">>; reason: ZodString; }, $strict>>], "status">>>>; }, $strict>>

Validate data-only command definitions supplied by an adapter.


const parseAction: typeof WhistleActionDataSchema.parse

Parse action metadata once before an adapter constructs a Whistle command.


const parseProjections: typeof WhistleCommandProjectionsSchema.parse

Parse the Whistle-owned projection metadata supplied by an App.


const parseAvailability: typeof availabilitySchema.parse

Parse an availability fact while preserving its reason.


const parseCommandDefinition: typeof WhistleCommandDefinitionSchema.parse

Parse one data-only command definition before an adapter creates a command.


const WhistleAgentProjectionSchema: ZodObject<{ commandId: ZodString; sourceId: ZodString; title: ZodString; category: ZodString; description: ZodOptional<ZodString>>; order: ZodNumber; availability: ZodDiscriminatedUnion<[ZodObject<{ status: ZodLiteral<"available">>; }, $strict>>, ZodObject<{ status: ZodLiteral<"unavailable">>; reason: ZodString; }, $strict>>], "status">>; action: ZodOptional<ZodObject<{ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; }, $strict>>>>; keybind: ZodOptional<ZodString>>; }, $strict>>

One neutral agent row emitted by Whistle’s snapshot.agent projection.


const WhistleAgentProjectionsSchema: ZodArray<ZodObject<{ commandId: ZodString; sourceId: ZodString; title: ZodString; category: ZodString; description: ZodOptional<ZodString>>; order: ZodNumber; availability: ZodDiscriminatedUnion<[ZodObject<{ status: ZodLiteral<"available">>; }, $strict>>, ZodObject<{ status: ZodLiteral<"unavailable">>; reason: ZodString; }, $strict>>], "status">>; action: ZodOptional<ZodObject<{ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>>>; }, $strict>>>>; keybind: ZodOptional<ZodString>>; }, $strict>>>>

A neutral Whistle agent projection collection.


const parse: typeof WhistleAgentProjectionsSchema.parse

Decode an untrusted agent projection collection at the wire boundary.


const interactionTextLimit: 8192 = 8192

Longest prompt answer or message an interaction carries.


const WhistlePromptSchema: ZodDiscriminatedUnion<[ZodObject<{ type: ZodLiteral<"choice">>; message: ZodPipe<ZodString, ZodString>>; collapsedGroup: ZodOptional<ZodPipe<ZodString, ZodString>>>>; options: ZodArray<ZodObject<{ value: ZodPipe<ZodString, ZodString>>; label: ZodPipe<ZodString, ZodString>>; description: ZodOptional<ZodPipe<ZodString, ZodString>>>>; group: ZodOptional<ZodPipe<ZodString, ZodString>>>>; }, $strict>>>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"text">>; message: ZodPipe<ZodString, ZodString>>; placeholder: ZodOptional<ZodPipe<ZodString, ZodString>>>>; secret: ZodOptional<ZodBoolean>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"confirmation">>; message: ZodPipe<ZodString, ZodString>>; confirmLabel: ZodOptional<ZodPipe<ZodString, ZodString>>>>; cancelLabel: ZodOptional<ZodPipe<ZodString, ZodString>>>>; }, $strict>>], "type">>

Validate renderer-neutral interaction prompts received from a host.


const WhistleNoticeSchema: ZodDiscriminatedUnion<[ZodObject<{ type: ZodLiteral<"info">>; message: ZodPipe<ZodString, ZodString>>; links: ZodOptional<ZodArray<ZodObject<{ url: ZodURL; label: ZodOptional<ZodPipe<ZodString, ZodString>>>>; }, $strict>>>>>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"progress">>; message: ZodPipe<ZodString, ZodString>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"handoff">>; url: ZodURL; code: ZodOptional<ZodPipe<ZodString, ZodString>>>>; message: ZodOptional<ZodPipe<ZodString, ZodString>>>>; }, $strict>>, ZodObject<{ type: ZodLiteral<"success">>; message: ZodPipe<ZodString, ZodString>>; }, $strict>>], "type">>

Validate interaction notices received from a host.


const parsePrompt: typeof WhistlePromptSchema.parse

Parse one interaction prompt at the boundary where a client renders it.


const parseNotice: typeof WhistleNoticeSchema.parse

Parse one interaction notice at the boundary where a client renders it.

createPromptAnswerParser<Kind>>(prompt): (value) => WhistlePromptAnswers[Kind]

Capture a prompt’s parsed answer contract before handing it to a renderer.

Kind extends "text" | "choice" | "confirmation"

WhistlePromptOf<Kind>

(value) => WhistlePromptAnswers[Kind]


parsePromptAnswer<Kind>>(prompt, value): WhistlePromptAnswers[Kind]

Parse the answer a human gave to one prompt before the command sees it.

Kind extends "text" | "choice" | "confirmation"

WhistlePromptOf<Kind>

string | boolean

WhistlePromptAnswers[Kind]


createPromptAnswerDecoder<Kind>>(prompt): (value) => Readonly<{ kind: "accepted"; value: WhistlePromptAnswers[Kind]; }> | Readonly<{ kind: "invalid"; cause: ZodError; }>

Capture a typed answer decoder; invalid input stays an explicit outcome.

Kind extends "text" | "choice" | "confirmation"

WhistlePromptOf<Kind>

(value) => Readonly<{ kind: "accepted"; value: WhistlePromptAnswers[Kind]; }> | Readonly<{ kind: "invalid"; cause: ZodError; }>


decodePromptAnswer<Kind>>(prompt, value): Readonly<{ kind: "invalid"; cause: ZodError; }> | Readonly<{ kind: "accepted"; value: WhistlePromptAnswers[Kind]; }>

Decode a human answer without throwing so renderers can handle invalid input.

Kind extends "text" | "choice" | "confirmation"

WhistlePromptOf<Kind>

string | boolean

Readonly<{ kind: "invalid"; cause: ZodError; }> | Readonly<{ kind: "accepted"; value: WhistlePromptAnswers[Kind]; }>