@adonis-agora/agent 0.72.0 → 0.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/configure.d.ts +5 -4
  3. package/dist/configure.d.ts.map +1 -1
  4. package/dist/configure.js +8 -4
  5. package/dist/configure.js.map +1 -1
  6. package/dist/providers/agent_provider.d.ts.map +1 -1
  7. package/dist/providers/agent_provider.js +15 -1
  8. package/dist/providers/agent_provider.js.map +1 -1
  9. package/dist/src/a2ui/adapter.d.ts.map +1 -1
  10. package/dist/src/a2ui/adapter.js +1 -0
  11. package/dist/src/a2ui/adapter.js.map +1 -1
  12. package/dist/src/a2ui/core.d.ts.map +1 -1
  13. package/dist/src/a2ui/core.js +11 -1
  14. package/dist/src/a2ui/core.js.map +1 -1
  15. package/dist/src/action-proposal-executor.d.ts.map +1 -1
  16. package/dist/src/action-proposal-executor.js +3 -0
  17. package/dist/src/action-proposal-executor.js.map +1 -1
  18. package/dist/src/ag-ui/adapter.d.ts.map +1 -1
  19. package/dist/src/ag-ui/adapter.js +2 -0
  20. package/dist/src/ag-ui/adapter.js.map +1 -1
  21. package/dist/src/ag-ui/core/encoder.d.ts.map +1 -1
  22. package/dist/src/ag-ui/core/encoder.js +3 -0
  23. package/dist/src/ag-ui/core/encoder.js.map +1 -1
  24. package/dist/src/agent-deps-factory.d.ts +3 -1
  25. package/dist/src/agent-deps-factory.d.ts.map +1 -1
  26. package/dist/src/agent-deps-factory.js +3 -0
  27. package/dist/src/agent-deps-factory.js.map +1 -1
  28. package/dist/src/agent-deps.d.ts +3 -1
  29. package/dist/src/agent-deps.d.ts.map +1 -1
  30. package/dist/src/agent-deps.js.map +1 -1
  31. package/dist/src/agent-loop.d.ts +7 -1
  32. package/dist/src/agent-loop.d.ts.map +1 -1
  33. package/dist/src/agent-loop.js +52 -2
  34. package/dist/src/agent-loop.js.map +1 -1
  35. package/dist/src/agent-service.d.ts +6 -0
  36. package/dist/src/agent-service.d.ts.map +1 -1
  37. package/dist/src/agent-service.js +5 -3
  38. package/dist/src/agent-service.js.map +1 -1
  39. package/dist/src/channels/adapters/evolution_api.d.ts.map +1 -1
  40. package/dist/src/channels/adapters/evolution_api.js +35 -0
  41. package/dist/src/channels/adapters/evolution_api.js.map +1 -1
  42. package/dist/src/channels/adapters/telegram.d.ts.map +1 -1
  43. package/dist/src/channels/adapters/telegram.js +25 -7
  44. package/dist/src/channels/adapters/telegram.js.map +1 -1
  45. package/dist/src/channels/adapters/whatsapp_cloud.d.ts.map +1 -1
  46. package/dist/src/channels/adapters/whatsapp_cloud.js +44 -0
  47. package/dist/src/channels/adapters/whatsapp_cloud.js.map +1 -1
  48. package/dist/src/channels/handler.d.ts +29 -1
  49. package/dist/src/channels/handler.d.ts.map +1 -1
  50. package/dist/src/channels/handler.js +231 -9
  51. package/dist/src/channels/handler.js.map +1 -1
  52. package/dist/src/channels/index.d.ts +2 -2
  53. package/dist/src/channels/index.d.ts.map +1 -1
  54. package/dist/src/channels/index.js.map +1 -1
  55. package/dist/src/channels/types.d.ts +40 -0
  56. package/dist/src/channels/types.d.ts.map +1 -1
  57. package/dist/src/genui/catalog.d.ts +12 -1
  58. package/dist/src/genui/catalog.d.ts.map +1 -1
  59. package/dist/src/genui/catalog.js +18 -1
  60. package/dist/src/genui/catalog.js.map +1 -1
  61. package/dist/src/genui/channels.d.ts +252 -0
  62. package/dist/src/genui/channels.d.ts.map +1 -0
  63. package/dist/src/genui/channels.js +516 -0
  64. package/dist/src/genui/channels.js.map +1 -0
  65. package/dist/src/genui/chart-image.d.ts +46 -0
  66. package/dist/src/genui/chart-image.d.ts.map +1 -0
  67. package/dist/src/genui/chart-image.js +155 -0
  68. package/dist/src/genui/chart-image.js.map +1 -0
  69. package/dist/src/genui/factory.d.ts +23 -1
  70. package/dist/src/genui/factory.d.ts.map +1 -1
  71. package/dist/src/genui/factory.js +13 -1
  72. package/dist/src/genui/factory.js.map +1 -1
  73. package/dist/src/genui/index.d.ts.map +1 -1
  74. package/dist/src/genui/index.js +64 -3
  75. package/dist/src/genui/index.js.map +1 -1
  76. package/dist/src/genui/kit/adonis.d.ts +4 -0
  77. package/dist/src/genui/kit/adonis.d.ts.map +1 -0
  78. package/dist/src/genui/kit/adonis.js +38 -0
  79. package/dist/src/genui/kit/adonis.js.map +1 -0
  80. package/dist/src/genui/kit/bundle.d.ts +25 -0
  81. package/dist/src/genui/kit/bundle.d.ts.map +1 -0
  82. package/dist/src/genui/kit/bundle.js +144 -0
  83. package/dist/src/genui/kit/bundle.js.map +1 -0
  84. package/dist/src/genui/kit/discover.d.ts +41 -0
  85. package/dist/src/genui/kit/discover.d.ts.map +1 -0
  86. package/dist/src/genui/kit/discover.js +100 -0
  87. package/dist/src/genui/kit/discover.js.map +1 -0
  88. package/dist/src/genui/kit/docs.d.ts +22 -0
  89. package/dist/src/genui/kit/docs.d.ts.map +1 -0
  90. package/dist/src/genui/kit/docs.js +237 -0
  91. package/dist/src/genui/kit/docs.js.map +1 -0
  92. package/dist/src/genui/kit/files.d.ts +27 -0
  93. package/dist/src/genui/kit/files.d.ts.map +1 -0
  94. package/dist/src/genui/kit/files.js +126 -0
  95. package/dist/src/genui/kit/files.js.map +1 -0
  96. package/dist/src/genui/kit/index.d.ts +12 -0
  97. package/dist/src/genui/kit/index.d.ts.map +1 -0
  98. package/dist/src/genui/kit/index.js +12 -0
  99. package/dist/src/genui/kit/index.js.map +1 -0
  100. package/dist/src/genui/kit/plugin.d.ts +52 -0
  101. package/dist/src/genui/kit/plugin.d.ts.map +1 -0
  102. package/dist/src/genui/kit/plugin.js +314 -0
  103. package/dist/src/genui/kit/plugin.js.map +1 -0
  104. package/dist/src/genui/kit/write.d.ts +14 -0
  105. package/dist/src/genui/kit/write.d.ts.map +1 -0
  106. package/dist/src/genui/kit/write.js +39 -0
  107. package/dist/src/genui/kit/write.js.map +1 -0
  108. package/dist/src/genui/public.d.ts +7 -3
  109. package/dist/src/genui/public.d.ts.map +1 -1
  110. package/dist/src/genui/public.js +5 -1
  111. package/dist/src/genui/public.js.map +1 -1
  112. package/dist/src/genui/sandbox-jsx.d.ts +29 -0
  113. package/dist/src/genui/sandbox-jsx.d.ts.map +1 -0
  114. package/dist/src/genui/sandbox-jsx.js +656 -0
  115. package/dist/src/genui/sandbox-jsx.js.map +1 -0
  116. package/dist/src/genui/sandbox-kit.d.ts +88 -0
  117. package/dist/src/genui/sandbox-kit.d.ts.map +1 -0
  118. package/dist/src/genui/sandbox-kit.js +89 -0
  119. package/dist/src/genui/sandbox-kit.js.map +1 -0
  120. package/dist/src/genui/sandbox-theme.d.ts +61 -0
  121. package/dist/src/genui/sandbox-theme.d.ts.map +1 -0
  122. package/dist/src/genui/sandbox-theme.js +255 -0
  123. package/dist/src/genui/sandbox-theme.js.map +1 -0
  124. package/dist/src/genui/sandbox.d.ts +73 -2
  125. package/dist/src/genui/sandbox.d.ts.map +1 -1
  126. package/dist/src/genui/sandbox.js +106 -16
  127. package/dist/src/genui/sandbox.js.map +1 -1
  128. package/dist/src/genui/text.d.ts.map +1 -1
  129. package/dist/src/genui/text.js +33 -1
  130. package/dist/src/genui/text.js.map +1 -1
  131. package/dist/src/genui/tools.d.ts +26 -0
  132. package/dist/src/genui/tools.d.ts.map +1 -1
  133. package/dist/src/genui/tools.js +94 -14
  134. package/dist/src/genui/tools.js.map +1 -1
  135. package/dist/src/genui/tree.d.ts +25 -2
  136. package/dist/src/genui/tree.d.ts.map +1 -1
  137. package/dist/src/genui/tree.js +161 -4
  138. package/dist/src/genui/tree.js.map +1 -1
  139. package/dist/src/hooks/genui_kit.d.ts +20 -0
  140. package/dist/src/hooks/genui_kit.d.ts.map +1 -0
  141. package/dist/src/hooks/genui_kit.js +55 -0
  142. package/dist/src/hooks/genui_kit.js.map +1 -0
  143. package/dist/src/index.d.ts +2 -2
  144. package/dist/src/index.d.ts.map +1 -1
  145. package/dist/src/index.js +2 -2
  146. package/dist/src/index.js.map +1 -1
  147. package/dist/src/negotiated-tool-ui.d.ts +27 -0
  148. package/dist/src/negotiated-tool-ui.d.ts.map +1 -1
  149. package/dist/src/negotiated-tool-ui.js +52 -0
  150. package/dist/src/negotiated-tool-ui.js.map +1 -1
  151. package/dist/src/react/core/genui/sandbox-assets.d.ts +32 -0
  152. package/dist/src/react/core/genui/sandbox-assets.d.ts.map +1 -0
  153. package/dist/src/react/core/genui/sandbox-assets.js +174 -0
  154. package/dist/src/react/core/genui/sandbox-assets.js.map +1 -0
  155. package/dist/src/react/core/genui/sandbox.d.ts +9 -0
  156. package/dist/src/react/core/genui/sandbox.d.ts.map +1 -1
  157. package/dist/src/react/core/genui/sandbox.js +119 -19
  158. package/dist/src/react/core/genui/sandbox.js.map +1 -1
  159. package/dist/src/react/core/index.d.ts +1 -1
  160. package/dist/src/react/core/index.d.ts.map +1 -1
  161. package/dist/src/react/core/index.js +1 -1
  162. package/dist/src/react/core/index.js.map +1 -1
  163. package/dist/src/react/core/presentation/phrasing.d.ts +3 -2
  164. package/dist/src/react/core/presentation/phrasing.d.ts.map +1 -1
  165. package/dist/src/react/core/presentation/phrasing.js +4 -27
  166. package/dist/src/react/core/presentation/phrasing.js.map +1 -1
  167. package/dist/src/react/core/presentation/tool-activity.d.ts +8 -0
  168. package/dist/src/react/core/presentation/tool-activity.d.ts.map +1 -1
  169. package/dist/src/react/core/presentation/tool-activity.js +28 -1
  170. package/dist/src/react/core/presentation/tool-activity.js.map +1 -1
  171. package/dist/src/react/core/transcript/model.d.ts +6 -0
  172. package/dist/src/react/core/transcript/model.d.ts.map +1 -1
  173. package/dist/src/react/core/transcript/model.js +6 -1
  174. package/dist/src/react/core/transcript/model.js.map +1 -1
  175. package/dist/src/react/core/transcript/use-chat-transcript.d.ts +5 -0
  176. package/dist/src/react/core/transcript/use-chat-transcript.d.ts.map +1 -1
  177. package/dist/src/react/core/transcript/use-chat-transcript.js +3 -0
  178. package/dist/src/react/core/transcript/use-chat-transcript.js.map +1 -1
  179. package/dist/src/spi/tool.d.ts +7 -0
  180. package/dist/src/spi/tool.d.ts.map +1 -1
  181. package/dist/src/tool-presentation.d.ts +15 -0
  182. package/dist/src/tool-presentation.d.ts.map +1 -1
  183. package/dist/src/tool-presentation.js +48 -0
  184. package/dist/src/tool-presentation.js.map +1 -1
  185. package/dist/src/tool-registry.d.ts.map +1 -1
  186. package/dist/src/tool-registry.js +2 -0
  187. package/dist/src/tool-registry.js.map +1 -1
  188. package/dist/src/types.d.ts +10 -0
  189. package/dist/src/types.d.ts.map +1 -1
  190. package/dist/src/vite/index.d.ts +24 -0
  191. package/dist/src/vite/index.d.ts.map +1 -0
  192. package/dist/src/vite/index.js +29 -0
  193. package/dist/src/vite/index.js.map +1 -0
  194. package/package.json +38 -2
  195. package/skills/agent-setup/SKILL.md +3 -1
  196. package/skills/agent-tools/SKILL.md +5 -3
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Per-channel generative UI: what a turn may draw depends on where it is read. A web page draws the
3
+ * catalog's components (and the sandbox); WhatsApp and Telegram draw text, reply buttons, lists and
4
+ * images; an email draws HTML. `genui({ channels: { … } })` sets, per channel, which tools the model
5
+ * is offered and how what it pushes is delivered — and the model is told only what that channel can
6
+ * draw.
7
+ *
8
+ * Framework-free and isomorphic, like the rest of `genui`.
9
+ */
10
+ import type { UiAction } from './actions.js';
11
+ import { type Catalog, type ComponentDefinition, type GenuiStreaming } from './catalog.js';
12
+ import { type DefineSandboxOptions } from './sandbox.js';
13
+ /** The channel a turn runs on when nothing says otherwise: a browser (AG-UI, the HTTP chat, A2UI). */
14
+ export declare const WEB_CHANNEL = "web";
15
+ /** The `channels` entry that serves every channel without one of its own. */
16
+ export declare const DEFAULT_CHANNEL = "default";
17
+ /** Channels a person reads in a messaging app or a mailbox: the server draws for them. */
18
+ export declare const MESSAGING_CHANNELS: readonly string[];
19
+ /**
20
+ * What the model is offered on a channel: `tree` — one `ui__render` tool composing the catalog (and
21
+ * the sandbox, when on); `per-component` — one `ui__show_<component>` tool per component that can be
22
+ * drawn there; `text` — no UI tools, the model answers in text.
23
+ */
24
+ export type GenuiChannelMode = 'tree' | 'per-component' | 'text';
25
+ /**
26
+ * How what the model pushed reaches a channel the server draws for (WhatsApp, Telegram, email):
27
+ * `native` — each component's channel conversion (`defineComponent(…, { channels })`: text, reply
28
+ * buttons, a list, an image), its text summary otherwise; `text` — always the text summary; `html` —
29
+ * HTML (email). A web channel draws in the browser and ignores it.
30
+ */
31
+ export type GenuiChannelRender = 'native' | 'text' | 'html';
32
+ /** One channel's generative UI — every field falls back to the `default` entry, then to the top level. */
33
+ export interface GenuiChannelOptions {
34
+ /** Default: the top-level `mode` on a web channel; `per-component` on a messaging channel. */
35
+ mode?: GenuiChannelMode;
36
+ /** Tree mode: draw the layout while the model writes it (`partial`) or once it is whole. */
37
+ streaming?: GenuiStreaming;
38
+ /**
39
+ * The sandbox on this channel: `false` for none, `true` / a config for the sandbox with those
40
+ * options (a web channel may use the app's kit while a mobile one does not). Default: the
41
+ * top-level `sandbox` on a web channel; never on a messaging channel (it cannot run there).
42
+ */
43
+ sandbox?: boolean | DefineSandboxOptions;
44
+ /** Default `native` (`html` for `email`). */
45
+ render?: GenuiChannelRender;
46
+ /** Charts as PNG images on a channel that takes images ({@link ChartImageRenderer}, `chartImages()`). */
47
+ chartImages?: ChartImageRenderer;
48
+ /** Extra words for the model on this channel, added to the UI tools' descriptions. */
49
+ instructions?: string;
50
+ }
51
+ /** `genui({ channels })`: an entry per channel name, plus `default` for every other one. */
52
+ export interface GenuiChannels {
53
+ web?: GenuiChannelOptions;
54
+ mobile?: GenuiChannelOptions;
55
+ whatsapp?: GenuiChannelOptions;
56
+ telegram?: GenuiChannelOptions;
57
+ email?: GenuiChannelOptions;
58
+ default?: GenuiChannelOptions;
59
+ [channel: string]: GenuiChannelOptions | undefined;
60
+ }
61
+ /** The top-level genui options a channel falls back to. */
62
+ export interface GenuiChannelBase {
63
+ mode?: 'per-component' | 'tree';
64
+ streaming?: GenuiStreaming;
65
+ sandbox?: boolean | DefineSandboxOptions;
66
+ }
67
+ /** A channel's options with every default applied — what the tools and the channel handler follow. */
68
+ export interface ResolvedGenuiChannel {
69
+ /** The channel's name (`web`, `whatsapp`, `mobile`, …). */
70
+ name: string;
71
+ /** The server draws for it (WhatsApp, Telegram, email): it never runs a sandbox or a React renderer. */
72
+ messaging: boolean;
73
+ /** `channels` has an entry for it (its own or `default`). `false` → it behaves as it always did. */
74
+ configured: boolean;
75
+ mode: GenuiChannelMode;
76
+ streaming?: GenuiStreaming;
77
+ /** `undefined` → the catalog's own sandbox (if it has one) is left as it is. */
78
+ sandbox?: boolean | DefineSandboxOptions;
79
+ render: GenuiChannelRender;
80
+ chartImages?: ChartImageRenderer;
81
+ instructions?: string;
82
+ }
83
+ /**
84
+ * THE rule for which channel a turn runs on, read from its page context:
85
+ *
86
+ * - `pageContext.channel` is a string → that channel (an explicit override: `send({ channel })`, a
87
+ * mobile client posting `pageContext: { channel: 'mobile' }`);
88
+ * - `pageContext.channel` is the address a text-channel adapter stamps (`{ name, conversation,
89
+ * kind? }`) → its `kind` (`whatsapp`, `telegram`), else its `name`;
90
+ * - nothing → `web`: what AG-UI, the HTTP chat and A2UI serve (they stamp nothing, so a tool that
91
+ * skips skeletons when `pageContext.channel` is set keeps working).
92
+ */
93
+ export declare function turnChannel(pageContext: {
94
+ [key: string]: unknown;
95
+ } | undefined): string;
96
+ /** WhatsApp, Telegram and email are drawn by the server; every other channel by a client. */
97
+ export declare function isMessagingChannel(channel: string): boolean;
98
+ /** One channel's options, its own entry over `default` over the top level. */
99
+ export declare function resolveGenuiChannel(base: GenuiChannelBase, channels: GenuiChannels | undefined, channel: string | undefined): ResolvedGenuiChannel;
100
+ /** Throws on a `channels` entry that names an unknown mode or render. */
101
+ export declare function assertGenuiChannels(channels: GenuiChannels | undefined): void;
102
+ /**
103
+ * A reply button. Pressed, it becomes the user's next turn — a {@link UiAction} whose text is the
104
+ * label and whose context is `value`, exactly like a sandbox's `agent.send`.
105
+ */
106
+ export interface ChannelNativeButton {
107
+ label: string;
108
+ /** The action's name. Default `select`. */
109
+ action?: string;
110
+ /** The values that go with the press (JSON). */
111
+ value?: Record<string, unknown>;
112
+ }
113
+ export interface ChannelNativeListItem extends ChannelNativeButton {
114
+ /** A second line under the label. */
115
+ description?: string;
116
+ }
117
+ /** A list to pick one entry from (a WhatsApp list message, a Telegram keyboard of one row each). */
118
+ export interface ChannelNativeList {
119
+ /** The label of the button that opens the list (WhatsApp). */
120
+ button: string;
121
+ /** A heading over the entries. */
122
+ title?: string;
123
+ items: ChannelNativeListItem[];
124
+ }
125
+ /** An image: by an `https` url the provider fetches, or its bytes. */
126
+ export interface ChannelNativeImage {
127
+ url?: string;
128
+ data?: Uint8Array;
129
+ /** Default `image/png`. */
130
+ contentType?: string;
131
+ }
132
+ /**
133
+ * What a component is on a channel the server draws for. Each field is optional; a message with an
134
+ * image sends `text` as its caption, one with buttons or a list sends `text` as its body.
135
+ */
136
+ export interface ChannelNativeMessage {
137
+ /** In the model's markdown — converted to the channel's. */
138
+ text?: string;
139
+ /** For `render: 'html'` (email). Trusted markup: build it from props, escaping what you insert. */
140
+ html?: string;
141
+ /** Reply buttons — at most 3 on WhatsApp; more become a list. */
142
+ buttons?: ChannelNativeButton[];
143
+ list?: ChannelNativeList;
144
+ image?: ChannelNativeImage;
145
+ }
146
+ /** `defineComponent(…, { channels: { whatsapp: (props) => ({ text, buttons }) } })`. */
147
+ export type ChannelConversion<P = Record<string, unknown>> = {
148
+ convert(props: P, context: {
149
+ channel: string;
150
+ }): ChannelNativeMessage | ChannelNativeMessage[] | null | undefined | Promise<ChannelNativeMessage | ChannelNativeMessage[] | null | undefined>;
151
+ }['convert'];
152
+ /**
153
+ * A conversion with words for the model: `describe` says how the component reaches the user on that
154
+ * channel — `'a pick-list of the orders; no Refund buttons: to refund, the user picks an order and
155
+ * replies'` — and goes into the channel's prompt (`channelPrompt`), so the model does not describe the
156
+ * web view there. A bare conversion is described from what it can send.
157
+ */
158
+ export interface ChannelConversionSpec<P = Record<string, unknown>> {
159
+ convert: ChannelConversion<P>;
160
+ describe?: string;
161
+ }
162
+ /**
163
+ * A component's conversions, by channel name — a function, or `{ convert, describe }`. `false` →
164
+ * the component is never offered on that channel (it has nothing to say there).
165
+ */
166
+ export type ComponentChannels<P = Record<string, unknown>> = {
167
+ [channel: string]: ChannelConversion<P> | ChannelConversionSpec<P> | false | undefined;
168
+ };
169
+ /** Renders chart components as images, for a channel that takes them. */
170
+ export interface ChartImageRenderer {
171
+ /** The components it draws (default for `chartImages()`: `['Chart']`). */
172
+ readonly components: readonly string[];
173
+ render(component: string, props: Record<string, unknown>): Promise<ChannelNativeImage | null>;
174
+ }
175
+ /**
176
+ * Whether `definition` can be drawn on `channel`. On a web channel every component can (the client's
177
+ * `uiCapabilities` narrow it); on a messaging channel a component can when it has a conversion for
178
+ * it, a chart renderer draws it, or it has a text summary (`fallbackText`) — a component without one
179
+ * would arrive as a JSON dump, so it is not offered. A sandbox never can, and `channels: { x: false }`
180
+ * opts a component out.
181
+ */
182
+ export declare function canRenderOnChannel(definition: ComponentDefinition<unknown>, channel: ResolvedGenuiChannel): boolean;
183
+ /**
184
+ * The catalog as `channel` may draw it: only what it can render, and its own sandbox (or none). With
185
+ * no `channels` configured the catalog is returned as it is.
186
+ */
187
+ export declare function channelCatalog(catalog: Catalog, channel: ResolvedGenuiChannel): Catalog;
188
+ /** What a UI tool's description says about the channel the conversation is on. */
189
+ export declare function channelInstructions(channel: ResolvedGenuiChannel): string | undefined;
190
+ /** A pushed component, as a channel delivers it. */
191
+ export interface ChannelComponentInput {
192
+ /** The frame's id — what a button press reports as its `componentId`. */
193
+ id?: string;
194
+ name: string;
195
+ props: Record<string, unknown>;
196
+ }
197
+ /** {@link ChannelNativeMessage} plus the component it came from (so a press can name it). */
198
+ export interface ChannelRenderedMessage extends ChannelNativeMessage {
199
+ component: string;
200
+ componentId?: string;
201
+ title?: string;
202
+ }
203
+ /** Plain text as minimal HTML: paragraphs, line breaks, `*bold*`. */
204
+ export declare function textToHtml(text: string): string;
205
+ /**
206
+ * What a pushed component (a tree included) is on a channel the server draws for: one or more
207
+ * messages — its conversions, chart images, and the text summary of everything else, in order.
208
+ * Consecutive text is joined. Never throws: a conversion that fails sends the summary.
209
+ */
210
+ export declare function renderChannelMessages(catalog: Catalog, component: ChannelComponentInput, channel: ResolvedGenuiChannel): Promise<ChannelRenderedMessage[]>;
211
+ /** The UI action a pressed button (or picked list entry) stands for — the user's next turn. */
212
+ export declare function channelButtonAction(button: ChannelNativeButton, from: {
213
+ componentId?: string;
214
+ title?: string;
215
+ }): UiAction;
216
+ /**
217
+ * The system-prompt block for a turn on a messaging channel (WhatsApp, Telegram, email): that the
218
+ * user is not on a web page, what the channel can show, and — component by component — how each one
219
+ * reaches the user there, from its channel conversion (its `describe`, else what a conversion can
220
+ * send), a chart image, or its text summary. Tool and component descriptions are written for the web
221
+ * ("a table with a Refund button per row"); this is what keeps the model from describing that view
222
+ * on WhatsApp. `undefined` on a web-like channel, or without `channels`.
223
+ */
224
+ export declare function channelPrompt(catalog: Catalog, channel: ResolvedGenuiChannel): string | undefined;
225
+ /**
226
+ * How many reply buttons and list rows a channel shows — the adapter's `capabilities.buttons` /
227
+ * `capabilities.lists`, which the channel handler stamps on the turn (`pageContext.channel.choices`).
228
+ */
229
+ export interface ChannelChoiceLimits {
230
+ buttons: number;
231
+ lists: number;
232
+ }
233
+ /**
234
+ * What a channel actually delivered, in words for the model: each message (text, a pick-list and its
235
+ * entries, reply buttons, numbered choices, an image, an email section), and what the user did NOT
236
+ * get. This is what a tool's result carries as `delivered` on a messaging channel, so the model talks
237
+ * about the list the user can pick from — not the table with Refund buttons it would have on the web.
238
+ *
239
+ * Choices follow the channel handler's rule, within `limits` (default: the channel's own adapter's):
240
+ * reply buttons when there is no list (or no lists) and they fit, else a list of at most `lists`
241
+ * rows, else numbered text the user answers by replying.
242
+ */
243
+ export declare function describeChannelDelivery(messages: readonly ChannelRenderedMessage[], channel: ResolvedGenuiChannel, limits?: ChannelChoiceLimits): string;
244
+ /**
245
+ * {@link describeChannelDelivery} of the components a tool pushed (last props per id, previews left
246
+ * out), rendered the way the channel draws them. `undefined` on a channel the server does not draw
247
+ * for, or without `channels`.
248
+ */
249
+ export declare function describeChannelComponents(catalog: Catalog, components: readonly (ChannelComponentInput & {
250
+ partial?: boolean;
251
+ })[], channel: ResolvedGenuiChannel, limits?: ChannelChoiceLimits): Promise<string | undefined>;
252
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../src/genui/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,mBAAmB,EAExB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,oBAAoB,EAAkC,MAAM,cAAc,CAAC;AAIzF,sGAAsG;AACtG,eAAO,MAAM,WAAW,QAAQ,CAAC;AACjC,6EAA6E;AAC7E,eAAO,MAAM,eAAe,YAAY,CAAC;AACzC,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI9C,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,eAAe,GAAG,MAAM,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5D,0GAA0G;AAC1G,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAC;IACzC,6CAA6C;IAC7C,MAAM,CAA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