/** * Widget spec types. * * A widget spec is the single source for one `widget_type`: the text that * teaches the model when to reach for the card, and the handler that builds * the result. The `show_widget` descriptor (enum + description) is generated * from the spec list, so the two cannot drift. */ /** Rendered by the client. Always carries the three shared keys. */ export interface WidgetPayload { readonly widget_type: string; readonly widget_version: number; readonly status: string; readonly [key: string]: unknown; } export interface WidgetResult { readonly payload: WidgetPayload; /** Short line for the agent — what happened and what not to do next. */ readonly text: string; } export interface WidgetSpec { readonly widgetType: string; /** Bumped when the payload shape changes; the client falls back on unknown versions. */ readonly widgetVersion: number; /** What the card does. Reproduced verbatim in the tool description. */ readonly description: string; /** * The condition that makes the model call the tool, stated as an intent it * already has rather than a box to tick. Reproduced verbatim. */ readonly callWhen: string; /** * The nearest thing this card is not, and the tool that owns it. One line, * reproduced verbatim — a card can be mistaken for a neighbouring flow long * before it is mistaken for an unrelated one. */ readonly notFor: string; /** Situations illustrating the condition. One line each, reproduced verbatim. */ readonly examples: readonly string[]; /** Takes no arguments: `show_widget` accepts `widget_type` and nothing else. */ readonly handler: () => WidgetResult | Promise; } /** A spec plus its resolved on/off state from plugin config. */ export interface RegisteredWidget extends WidgetSpec { readonly enabled: boolean; } export interface WidgetLogger { info(...args: unknown[]): void; warn(...args: unknown[]): void; /** Unhandled failures only; every expected rejection is a WARN. */ error?(...args: unknown[]): void; } //# sourceMappingURL=types.d.ts.map