@heroui/agent 1.0.0-beta.3 → 1.0.0-beta.5

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 (56) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +119 -68
  3. package/dist/chunk-6O4WPQKO.js +1 -0
  4. package/dist/chunk-7OTMWVOC.js +1 -0
  5. package/dist/chunk-KGJ6UDTY.js +1 -0
  6. package/dist/chunk-PKCBDTYR.js +1 -0
  7. package/dist/chunk-PX3X4VP2.js +1 -0
  8. package/dist/chunk-SWO2ABN5.js +1 -0
  9. package/dist/client-tools-manifest-62CRLCZY.js +1 -0
  10. package/dist/css/index.css +1 -2
  11. package/dist/index.d.ts +9 -712
  12. package/dist/index.js +1 -1
  13. package/dist/internal/host.d.ts +108 -0
  14. package/dist/internal/host.js +1 -0
  15. package/dist/internal/shared.d.ts +63 -0
  16. package/dist/internal/shared.js +1 -0
  17. package/dist/next.d.ts +3 -4
  18. package/dist/next.js +1 -1
  19. package/dist/persistence-YI6JSYCT.js +1 -0
  20. package/dist/server.d.ts +21 -2
  21. package/dist/server.js +1 -1
  22. package/dist/types-BdAn3HPv.d.ts +667 -0
  23. package/dist/version-CIfRqjWe.d.ts +5 -0
  24. package/package.json +18 -34
  25. package/dist/chart-content-YGW25P3Z.js +0 -1
  26. package/dist/chunk-4JEZZR5J.js +0 -1
  27. package/dist/chunk-6RWQT7JH.js +0 -2
  28. package/dist/chunk-6ZJJN322.js +0 -1
  29. package/dist/chunk-7CUSOLDM.js +0 -5
  30. package/dist/chunk-7KCGPNEN.js +0 -1
  31. package/dist/chunk-CLHBM3HQ.js +0 -1
  32. package/dist/chunk-CR3H7AVI.js +0 -1
  33. package/dist/chunk-E43KPTLS.js +0 -2
  34. package/dist/chunk-HCLXS4HQ.js +0 -1
  35. package/dist/chunk-JTZX5KVY.js +0 -1
  36. package/dist/chunk-KQTLIOZ3.js +0 -1
  37. package/dist/chunk-M22IGTLZ.js +0 -1
  38. package/dist/chunk-MXXCR5SR.js +0 -1
  39. package/dist/chunk-PZJ4NC3J.js +0 -1
  40. package/dist/chunk-RNNGE7KM.js +0 -1
  41. package/dist/chunk-T4VDCNDW.js +0 -1
  42. package/dist/chunk-UHHKMESI.js +0 -1
  43. package/dist/component-renderer-KWBZJPBV.js +0 -1
  44. package/dist/composer-draft-NSKK65F3.js +0 -1
  45. package/dist/composer-image-draft-KAGTNQR7.js +0 -1
  46. package/dist/contracts.d.ts +0 -1683
  47. package/dist/contracts.js +0 -2
  48. package/dist/embed-runtime-YK64GOPA.js +0 -5
  49. package/dist/identity-CAJPsGqJ.d.ts +0 -101
  50. package/dist/interactive-map-surface-WC2LPCR7.js +0 -1
  51. package/dist/internal/client-tools.js +0 -1
  52. package/dist/internal/models.js +0 -1
  53. package/dist/internal/runtime.js +0 -1
  54. package/dist/internal/theme.js +0 -1
  55. package/dist/model-picker-QTI5TDBG.js +0 -1
  56. package/dist/shell-permission-picker-KIC3VEYJ.js +0 -1
@@ -0,0 +1,667 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ /**
4
+ * Deliberately Zod-free: `createToolHelper` and these types are re-exported from
5
+ * the package root, which the panel shell is served from. The manifest
6
+ * serializer that does need Zod lives in `./client-tools-manifest`.
7
+ */
8
+ type ClientToolStatus = "input-streaming" | "approval-requested" | "executing" | "completed" | "rejected" | "error";
9
+ /** HeroUI-owned icon rendered by the hosted Agent tool card. */
10
+ type ClientToolIcon = "add" | "database" | "delete" | "edit" | "navigate" | "search" | "sparkles" | "view";
11
+ type ClientToolSchema<TArgs> = {
12
+ parse: (input: unknown) => TArgs;
13
+ safeParse: (input: unknown) => unknown;
14
+ };
15
+ type AgentDataSourceFormat = "csv" | "json" | "tsv";
16
+ /** A private, conversation-scoped dataset uploaded by a browser client tool. */
17
+ type AgentDataSource = Readonly<{
18
+ filename: string;
19
+ format: AgentDataSourceFormat;
20
+ id: string;
21
+ kind: "heroui-agent-data-source";
22
+ mediaType: "application/json" | "text/csv" | "text/tab-separated-values";
23
+ size: number;
24
+ url: string;
25
+ }>;
26
+ type UploadAgentDataSourceInput = Readonly<{
27
+ /** JSON value, delimited text, Blob, ArrayBuffer, or byte array. */
28
+ data: unknown;
29
+ filename?: string;
30
+ format?: AgentDataSourceFormat;
31
+ }>;
32
+ /**
33
+ * Stable identity for one agent-initiated browser tool effect. Pass
34
+ * `idempotencyKey` through to mutation APIs so an ambiguous network retry can
35
+ * return the original result instead of applying the side effect twice.
36
+ */
37
+ type ClientToolExecutionContext = Readonly<{
38
+ conversationId: string;
39
+ idempotencyKey: string;
40
+ toolCallId: string;
41
+ /** Upload a large result without placing its bytes in the 64 KiB tool receipt. */
42
+ uploadDataSource: (input: UploadAgentDataSourceInput) => Promise<AgentDataSource>;
43
+ }>;
44
+ /**
45
+ * A tool the agent can call in the user's browser. Execution stays in the
46
+ * customer page; the hosted iframe receives only its declarative manifest and
47
+ * a validated result.
48
+ */
49
+ type ClientTool<TArgs = any, TContext = any> = {
50
+ description: string;
51
+ /** Human-readable name shown in the default tool card. Defaults to `name`. */
52
+ displayName?: string;
53
+ execute: (args: TArgs, context: TContext, execution: ClientToolExecutionContext) => Promise<unknown> | unknown;
54
+ /** HeroUI-owned icon rendered by the hosted tool card. */
55
+ icon?: ClientToolIcon;
56
+ iconColor?: string;
57
+ name: string;
58
+ /** When true, the user must approve the call before `execute` runs. */
59
+ needsApproval?: boolean;
60
+ /** Zod schema (typed) or raw JSON Schema object for the tool parameters. */
61
+ parameters: ClientToolSchema<TArgs> | Record<string, unknown>;
62
+ };
63
+ /**
64
+ * Returns a type-safe tool factory bound to your shared context type:
65
+ *
66
+ * ```ts
67
+ * type AppContext = {apiClient: ApiClient};
68
+ * const tool = createToolHelper<AppContext>();
69
+ * const tools = [tool({name: "search_users", parameters: z.object({...}), execute: (args, ctx) => ...})];
70
+ * ```
71
+ */
72
+ declare function createToolHelper<TContext>(): <TArgs>(definition: ClientTool<TArgs, TContext>) => ClientTool<TArgs, TContext>;
73
+ /** Parses model-provided args with the local Zod schema when available. */
74
+ declare function parseClientToolArgs(tool: ClientTool, input: unknown): unknown;
75
+ /**
76
+ * Resolves a component "tool" action (a rendered button's toolCall) to the
77
+ * client tool it may execute directly in the page. Unknown and approval-gated
78
+ * tools return null — those actions fall back to their composer prompt so
79
+ * nothing ever runs without the user seeing it first.
80
+ */
81
+ declare function resolveDirectToolAction(tools: ReadonlyMap<string, ClientTool>, toolName: string): ClientTool | null;
82
+
83
+ /** Maximum number of files accepted on one HeroUI Agent message. */
84
+ declare const HEROUI_AGENT_MAX_ATTACHMENTS = 5;
85
+ /** Maximum stored size for one HeroUI Agent attachment (10 MiB). */
86
+ declare const HEROUI_AGENT_ATTACHMENT_MAX_BYTES: number;
87
+ /**
88
+ * File types that the hosted model pipeline can process consistently.
89
+ *
90
+ * SVG is intentionally excluded because it can carry active content. Hosted
91
+ * document parsing handles the remaining office and publishing formats.
92
+ */
93
+ declare const HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE: {
94
+ readonly "application/epub+zip": "epub";
95
+ readonly "application/json": "json";
96
+ readonly "application/msword": "doc";
97
+ readonly "application/pdf": "pdf";
98
+ readonly "application/rtf": "rtf";
99
+ readonly "application/vnd.ms-excel": "xls";
100
+ readonly "application/vnd.ms-excel.sheet.binary.macroenabled.12": "xlsb";
101
+ readonly "application/vnd.ms-excel.sheet.macroenabled.12": "xlsm";
102
+ readonly "application/vnd.ms-powerpoint": "ppt";
103
+ readonly "application/vnd.ms-powerpoint.presentation.macroenabled.12": "pptm";
104
+ readonly "application/vnd.ms-word.document.macroenabled.12": "docm";
105
+ readonly "application/vnd.oasis.opendocument.presentation": "odp";
106
+ readonly "application/vnd.oasis.opendocument.spreadsheet": "ods";
107
+ readonly "application/vnd.oasis.opendocument.text": "odt";
108
+ readonly "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx";
109
+ readonly "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx";
110
+ readonly "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx";
111
+ readonly "image/gif": "gif";
112
+ readonly "image/jpeg": "jpg";
113
+ readonly "image/png": "png";
114
+ readonly "image/webp": "webp";
115
+ readonly "text/csv": "csv";
116
+ readonly "text/html": "html";
117
+ readonly "text/markdown": "md";
118
+ readonly "text/plain": "txt";
119
+ readonly "text/rtf": "rtf";
120
+ readonly "text/tab-separated-values": "tsv";
121
+ };
122
+ type HeroUIAgentAttachmentContentType = keyof typeof HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE;
123
+ declare const HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES: readonly ("application/json" | "text/csv" | "text/tab-separated-values" | "application/epub+zip" | "application/msword" | "application/pdf" | "application/rtf" | "application/vnd.ms-excel" | "application/vnd.ms-excel.sheet.binary.macroenabled.12" | "application/vnd.ms-excel.sheet.macroenabled.12" | "application/vnd.ms-powerpoint" | "application/vnd.ms-powerpoint.presentation.macroenabled.12" | "application/vnd.ms-word.document.macroenabled.12" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/gif" | "image/jpeg" | "image/png" | "image/webp" | "text/html" | "text/markdown" | "text/plain" | "text/rtf")[];
124
+ declare const HEROUI_AGENT_ATTACHMENT_ACCEPT: string;
125
+ declare const HEROUI_AGENT_ATTACHMENT_CONTENT_TYPE_BY_EXTENSION: Readonly<Record<string, "application/json" | "text/csv" | "text/tab-separated-values" | "application/epub+zip" | "application/msword" | "application/pdf" | "application/rtf" | "application/vnd.ms-excel" | "application/vnd.ms-excel.sheet.binary.macroenabled.12" | "application/vnd.ms-excel.sheet.macroenabled.12" | "application/vnd.ms-powerpoint" | "application/vnd.ms-powerpoint.presentation.macroenabled.12" | "application/vnd.ms-word.document.macroenabled.12" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/gif" | "image/jpeg" | "image/png" | "image/webp" | "text/html" | "text/markdown" | "text/plain" | "text/rtf">>;
126
+ declare const HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES: ReadonlySet<string>;
127
+ declare function isHeroUIAgentAttachmentContentType(value: string): value is HeroUIAgentAttachmentContentType;
128
+ /** Browsers sometimes omit Office MIME types; fall back to the file extension. */
129
+ declare function resolveHeroUIAgentAttachmentContentType(contentType: string, filename: string): HeroUIAgentAttachmentContentType | null;
130
+
131
+ /**
132
+ * Deliberately Zod-free: the model catalogue is re-exported from the package
133
+ * root, so importing Zod here would pull the whole validation library into the
134
+ * panel shell's first-paint graph. The matching schema lives in
135
+ * `./models.schema`, which only server and contract consumers need.
136
+ */
137
+ /** Model ids the hosted agent accepts from the browser picker. */
138
+ declare const AGENT_MODEL_IDS: readonly ["moonshotai/Kimi-K3", "openai/gpt-5.6-luna", "openai/gpt-5.6-terra", "openai/gpt-5.6-sol", "google/gemini-3.7-flash", "anthropic/claude-sonnet-5", "anthropic/claude-opus-4.8"];
139
+ type AgentModelId = (typeof AGENT_MODEL_IDS)[number];
140
+ /**
141
+ * Retired ids mapped to their replacement. Model ids are a public part of the
142
+ * embed API — a customer pins one in their own code and projects store one as
143
+ * their default — so a retired id keeps resolving instead of failing the
144
+ * session with an "Invalid agent model" error.
145
+ */
146
+ declare const LEGACY_AGENT_MODEL_IDS: Record<string, AgentModelId>;
147
+ /** Resolves a possibly-retired model id to the id the runtime should use. */
148
+ declare function resolveAgentModelId(value: string): string;
149
+ type AgentModelTier = "codegen" | "complex" | "light";
150
+ type AgentModelOption = {
151
+ description: string;
152
+ id: AgentModelId;
153
+ label: string;
154
+ provider: "Anthropic" | "Google" | "Moonshot AI" | "OpenAI";
155
+ tier: AgentModelTier;
156
+ };
157
+ /**
158
+ * Recommended default selected when the optional picker first opens. Gemini 3.7 Flash
159
+ * matches the hosted runtime's baked-in default (`DEFAULT_CHAT_MODEL_IDS.herouiAgent`),
160
+ * so what users see in the picker is what actually runs by default.
161
+ */
162
+ declare const DEFAULT_AGENT_PICKER_MODEL_ID = "google/gemini-3.7-flash";
163
+ /**
164
+ * Small, tool-capable model catalog for HeroUI Agent. These ids are the
165
+ * server-side allowlist as well as the browser picker source of truth.
166
+ */
167
+ declare const AGENT_MODEL_OPTIONS: readonly [{
168
+ readonly description: "Flagship model for coding, reasoning, and knowledge work";
169
+ readonly id: "moonshotai/Kimi-K3";
170
+ readonly label: "Kimi K3";
171
+ readonly provider: "Moonshot AI";
172
+ readonly tier: "light";
173
+ }, {
174
+ readonly description: "Fast answers and lightweight agent workflows";
175
+ readonly id: "openai/gpt-5.6-luna";
176
+ readonly label: "GPT-5.6 Luna";
177
+ readonly provider: "OpenAI";
178
+ readonly tier: "light";
179
+ }, {
180
+ readonly description: "Balanced reasoning for everyday agent tasks";
181
+ readonly id: "openai/gpt-5.6-terra";
182
+ readonly label: "GPT-5.6 Terra";
183
+ readonly provider: "OpenAI";
184
+ readonly tier: "codegen";
185
+ }, {
186
+ readonly description: "Deep reasoning for complex, multi-step analysis";
187
+ readonly id: "openai/gpt-5.6-sol";
188
+ readonly label: "GPT-5.6 Sol";
189
+ readonly provider: "OpenAI";
190
+ readonly tier: "complex";
191
+ }, {
192
+ readonly description: "Fast multimodal analysis with a large context window";
193
+ readonly id: "google/gemini-3.7-flash";
194
+ readonly label: "Gemini 3.7 Flash";
195
+ readonly provider: "Google";
196
+ readonly tier: "light";
197
+ }, {
198
+ readonly description: "Strong agentic reasoning and polished UI decisions";
199
+ readonly id: "anthropic/claude-sonnet-5";
200
+ readonly label: "Claude Sonnet 5";
201
+ readonly provider: "Anthropic";
202
+ readonly tier: "codegen";
203
+ }, {
204
+ readonly description: "Highest-capability Claude for difficult research and analysis";
205
+ readonly id: "anthropic/claude-opus-4.8";
206
+ readonly label: "Claude Opus 4.8";
207
+ readonly provider: "Anthropic";
208
+ readonly tier: "complex";
209
+ }];
210
+ declare function isAgentModelId(value: unknown): value is AgentModelId;
211
+ /** Unknown/env-overridden models keep the hosted agent's historical light tier. */
212
+ declare function getAgentModelTier(modelId?: string): AgentModelTier;
213
+
214
+ /**
215
+ * Light/dark color scheme selection for the embed. `"system"` follows the
216
+ * OS preference and updates live when it changes.
217
+ */
218
+ type AgentColorScheme = "dark" | "light" | "system";
219
+ /**
220
+ * A theme color value: one CSS color applied to both schemes, or separate
221
+ * values per scheme. Tokens left unset fall back to the built-in defaults of
222
+ * each scheme, so overriding a light color never degrades dark mode.
223
+ */
224
+ type AgentThemeColor = string | {
225
+ dark?: string;
226
+ light?: string;
227
+ };
228
+ /** Corner rounding preset applied across the embed surface and fields. */
229
+ type AgentRadius = "pill" | "round" | "sharp" | "soft";
230
+ /**
231
+ * The seven high-impact color tokens. Everything else in the embed
232
+ * (borders, shadows, chart palettes) derives from these and from the
233
+ * built-in scheme defaults.
234
+ */
235
+ type AgentThemeColors = {
236
+ /** Primary action and highlight color. Chart palettes derive from it. */
237
+ accent?: AgentThemeColor;
238
+ /** Chat panel background. */
239
+ background?: AgentThemeColor;
240
+ /** Primary text color. */
241
+ foreground?: AgentThemeColor;
242
+ /** Dropdown and popover surface color. */
243
+ overlay?: AgentThemeColor;
244
+ /** Card surface color. */
245
+ surface?: AgentThemeColor;
246
+ /** Secondary surface color (chips, muted fills). */
247
+ surfaceSecondary?: AgentThemeColor;
248
+ /** Tooltip surface color. Text contrast is derived automatically. */
249
+ tooltip?: AgentThemeColor;
250
+ };
251
+ type AgentTypography = {
252
+ /**
253
+ * Base font size in pixels (clamped to 12–18).
254
+ * @default 14
255
+ */
256
+ baseSize?: number;
257
+ /** CSS font family stack, e.g. `"Geist, sans-serif"`. */
258
+ fontFamily?: string;
259
+ };
260
+ /**
261
+ * HeroUI Pro theme variant applied to the agent surface.
262
+ *
263
+ * Hosted Agent deployments include all supported variants; the selected one
264
+ * is activated inside the iframe.
265
+ */
266
+ type AgentDesignTheme = "base" | "brutalism" | "glass" | "mouve";
267
+ declare const AGENT_DESIGN_THEMES: readonly AgentDesignTheme[];
268
+ /**
269
+ * Intentionally small theme surface: one color scheme, one Pro variant, four
270
+ * radius presets, seven color tokens, and basic typography. No named themes,
271
+ * extend chains, or per-component tokens.
272
+ */
273
+ type AgentThemeOptions = {
274
+ /** @default "system" */
275
+ colorScheme?: AgentColorScheme;
276
+ colors?: AgentThemeColors;
277
+ /**
278
+ * HeroUI Pro theme variant rendered by the hosted Agent.
279
+ * @default "base"
280
+ */
281
+ designTheme?: AgentDesignTheme;
282
+ /** @default "round" */
283
+ radius?: AgentRadius;
284
+ typography?: AgentTypography;
285
+ };
286
+
287
+ type AgentComponentExportFormat = "csv" | "png" | "svg";
288
+ type AgentPermissionMode = "ask" | "auto" | "full";
289
+ /** MIME type accepted by the hosted HeroUI Agent attachment pipeline. */
290
+ type AgentAttachmentContentType = HeroUIAgentAttachmentContentType;
291
+ type AgentMessageAction = "copy" | "feedback" | "retry";
292
+ type AgentFeedbackReason = "did_not_follow_instructions" | "incomplete" | "incorrect" | "not_relevant" | "other" | "unclear";
293
+ type AgentResponseFeedback = {
294
+ /** Optional free-form context supplied by the end user. */
295
+ comment?: string;
296
+ conversationId: string;
297
+ messageId: string;
298
+ rating: "negative" | "positive";
299
+ /** Structured reasons selected for negative feedback. Empty for positive feedback. */
300
+ reasons: AgentFeedbackReason[];
301
+ };
302
+ type AgentContext = Record<string, unknown>;
303
+ /**
304
+ * The single shared context object. It is passed as the second argument to
305
+ * every client tool's `execute` — API clients, user info, state setters.
306
+ * Anything goes; it never leaves the browser.
307
+ *
308
+ * One key is reserved: `page`. When present, the SDK calls it on every turn
309
+ * and sends its JSON-serializable return value (route, filters, selection —
310
+ * max 16KB) to the agent as page context. Nothing else in the context object
311
+ * ever crosses the wire.
312
+ */
313
+ type AgentSharedContext = {
314
+ page?: () => AgentContext | Promise<AgentContext>;
315
+ } & Record<string, unknown>;
316
+ type AgentViewMode = "floating" | "sidebar";
317
+ type AgentSurfaceVariant = "outline" | "plain" | "surface" | "surface-secondary";
318
+ /**
319
+ * Controls whether an outside interaction closes the floating panel. Matches React
320
+ * Aria Popover: `true` or omitted always closes; `false` never closes.
321
+ */
322
+ type AgentShouldCloseOnInteractOutside = boolean;
323
+ type AgentMarkdownAnimationOptions = {
324
+ animation?: "blurIn" | "fadeIn" | "slideUp" | (string & {});
325
+ duration?: number;
326
+ easing?: string;
327
+ sep?: "char" | "word";
328
+ stagger?: number;
329
+ };
330
+ type AgentMarkdownAnimation = boolean | AgentMarkdownAnimationOptions;
331
+ type AgentMarkdownCaret = "block" | "circle";
332
+ /** Streaming Markdown presentation. Rich renderers are owned by the hosted Agent UI. */
333
+ type AgentMarkdownOptions = {
334
+ /**
335
+ * Animate newly streamed content. Pass `false` to disable text animation.
336
+ * @default {animation: "fadeIn", duration: 160, easing: "ease-out", sep: "word", stagger: 18}
337
+ */
338
+ animated?: AgentMarkdownAnimation;
339
+ /** Streaming caret style. Pass `false` to hide it. @default "block" */
340
+ caret?: AgentMarkdownCaret | false;
341
+ };
342
+ declare const DEFAULT_MARKDOWN_ANIMATION: {
343
+ animation: "fadeIn";
344
+ duration: number;
345
+ easing: string;
346
+ sep: "word";
347
+ stagger: number;
348
+ };
349
+ /** Corner that anchors the launcher button and the floating panel. */
350
+ type AgentLauncherPosition = "bottom-left" | "bottom-right";
351
+ /** Placement of the floating launcher button (visibility is `showLauncher`). */
352
+ type AgentLauncherOptions = {
353
+ /**
354
+ * Fill of the launcher button. Defaults to the accent color; set it when a
355
+ * custom {@link icon} needs a different backdrop. The mark inside gets a
356
+ * contrasting foreground automatically.
357
+ */
358
+ background?: AgentThemeColor;
359
+ /**
360
+ * Image rendered inside the launcher button instead of the built-in spark
361
+ * mark. Use a square asset (70x70 or larger); it is scaled to fit.
362
+ */
363
+ icon?: string;
364
+ /**
365
+ * Pixel offsets from the anchored corner: `x` from the side edge, `y` from
366
+ * the bottom. Defaults to 24 (16 on small screens).
367
+ */
368
+ offset?: {
369
+ x?: number;
370
+ y?: number;
371
+ };
372
+ /** @default "bottom-right" */
373
+ position?: AgentLauncherPosition;
374
+ /**
375
+ * Escape hatch for launcher styling the options above do not cover, applied
376
+ * as inline styles on the button (so it wins over the stylesheet). Prefer the
377
+ * dedicated options where they exist; this is not covered by the embed's
378
+ * visual defaults and can break the button's layout.
379
+ */
380
+ style?: CSSProperties;
381
+ };
382
+ /** Optional hosted-agent capabilities, all off by default. */
383
+ type AgentCapabilities = {
384
+ /**
385
+ * Allow the hosted agent to search for images via web search. Only applies
386
+ * when {@link webSearch} is enabled; defaults to true in that case.
387
+ * @default true
388
+ */
389
+ imageSearch?: boolean;
390
+ /**
391
+ * Allow the hosted agent to include recent news results in web searches.
392
+ * Only applies when {@link webSearch} is enabled and is off by default.
393
+ * @default false
394
+ */
395
+ newsSearch?: boolean;
396
+ /**
397
+ * Allow the hosted agent to search the public web for current information
398
+ * and images. Results are untrusted external content; keep this off when the
399
+ * assistant should only ever answer from your declared client tools.
400
+ * @default false
401
+ */
402
+ webSearch?: boolean;
403
+ };
404
+ /** Browser client-tool approval policy. */
405
+ type AgentPermissionOptions = {
406
+ /**
407
+ * Permission mode used before an end user chooses another mode.
408
+ * `"ask"` gates every client tool, `"auto"` gates only tools marked
409
+ * `needsApproval`, and `"full"` runs client tools without prompting.
410
+ * @default "auto"
411
+ */
412
+ defaultMode?: AgentPermissionMode;
413
+ /**
414
+ * Show the permission picker in the composer, letting the end user switch
415
+ * modes for themselves.
416
+ *
417
+ * This is a privilege boundary, not just a control: it permits the end user
418
+ * to select `"full"` and run every client tool without approval, overriding
419
+ * {@link defaultMode}. Their choice persists for the conversation.
420
+ *
421
+ * The picker only renders when {@link HeroUIAgentProps.tools} is non-empty,
422
+ * since there is nothing to approve otherwise.
423
+ * @default false
424
+ */
425
+ showPicker?: boolean;
426
+ };
427
+ /**
428
+ * Size and expansion of the chat panel. In `floating` mode expansion grows the
429
+ * card; in `sidebar` mode it temporarily fills the viewport. Initial dimensions
430
+ * are ignored in `sidebar` mode and below the mobile breakpoint.
431
+ */
432
+ type AgentPanelOptions = {
433
+ /**
434
+ * Open the panel expanded. End users can still collapse it unless
435
+ * {@link expandable} is off.
436
+ * @default false
437
+ */
438
+ expanded?: boolean;
439
+ /**
440
+ * Offer the expand control in the panel header. In sidebar mode the expanded
441
+ * panel fills the viewport. Turn it off to pin the panel to one size.
442
+ * @default true
443
+ */
444
+ expandable?: boolean;
445
+ /**
446
+ * Panel height before expanding — a number in pixels or any CSS length.
447
+ * Capped to the viewport.
448
+ * @default "max(420px, 56dvh)"
449
+ */
450
+ initialHeight?: number | string;
451
+ /**
452
+ * Panel width before expanding — a number in pixels or any CSS length.
453
+ * Expanding widens the panel from here. Capped to the viewport.
454
+ * @default 440
455
+ */
456
+ initialWidth?: number | string;
457
+ };
458
+ /** Visual presentation: view mode, theme, panel size, and launcher placement. */
459
+ type AgentAppearance = {
460
+ /** Surface treatment for approval, calendar, commerce, and other response cards. @default "surface" */
461
+ componentSurfaceVariant?: AgentSurfaceVariant;
462
+ /** Where the launcher button (and the floating panel) is anchored. */
463
+ launcher?: AgentLauncherOptions;
464
+ /** Size and expansion of the floating panel. */
465
+ panel?: AgentPanelOptions;
466
+ /**
467
+ * When the visitor interacts outside the floating panel, whether to close it.
468
+ * Only applies in `viewMode: "floating"`. `true` or omitted always closes;
469
+ * `false` never closes on outside interact. Escape and the header close
470
+ * button are unchanged.
471
+ */
472
+ shouldCloseOnInteractOutside?: AgentShouldCloseOnInteractOutside;
473
+ /** Surface treatment for charts, tables, maps, and other primary data surfaces. */
474
+ surfaceVariant?: AgentSurfaceVariant;
475
+ theme?: AgentThemeOptions;
476
+ /**
477
+ * How the chat opens: `"floating"` (default) is a floating rounded panel in
478
+ * the corner; `"sidebar"` docks full-height to the right edge of the page.
479
+ */
480
+ viewMode?: AgentViewMode;
481
+ /**
482
+ * Stacking level of the Agent host. Set this when the Agent must sit below
483
+ * application-owned dialogs or above unusually high application chrome.
484
+ * This sets the public `--ha-z-index` CSS custom property.
485
+ * @default 40
486
+ */
487
+ zIndex?: number;
488
+ };
489
+ /** Message composer settings. */
490
+ type AgentComposerOptions = {
491
+ /**
492
+ * File types end users can attach. Omit to allow every supported type, pass
493
+ * a subset to narrow the picker, or pass `false` to remove attachments.
494
+ * @default all supported attachment types
495
+ */
496
+ attachments?: AgentAttachmentContentType[] | false;
497
+ /**
498
+ * Model used for new turns before an end user chooses another model.
499
+ * When the picker is disabled, this pins every turn to the configured model.
500
+ */
501
+ defaultModel?: AgentModelId;
502
+ /** Show microphone recording and voice transcription controls. @default true */
503
+ dictation?: boolean;
504
+ /**
505
+ * Small verification notice shown below the composer and above the HeroUI
506
+ * attribution. Supports `[label](example.com)` and HTTPS links; bare domains
507
+ * are normalized to HTTPS. Limited to 240 characters. Pass `false` or omit it
508
+ * to hide the notice.
509
+ * @default false
510
+ * @example "Agent may make mistakes. [View terms](https://example.com/terms)"
511
+ */
512
+ disclaimer?: string | false;
513
+ /** Let the end user choose from the hosted agent's allowlisted models. @default false */
514
+ modelPicker?: boolean;
515
+ /** Placeholder shown in the message composer. @default "Ask anything…" */
516
+ placeholder?: string;
517
+ };
518
+ /** The empty-conversation view shown before the first message. */
519
+ type AgentStartScreenOptions = {
520
+ /** Heading shown above the composer. @default "Ask about your data" */
521
+ greeting?: string;
522
+ /** Show and enable `Ctrl+1`…`Ctrl+5` shortcuts for the visible prompts. @default false */
523
+ promptShortcuts?: boolean;
524
+ /** Up to five suggested prompts (each max 160 characters). */
525
+ prompts?: string[];
526
+ /** Supporting text shown below the greeting. Limited to 240 characters. */
527
+ subtitle?: string;
528
+ };
529
+ /** Internal — for HeroUI platform development only. */
530
+ type AgentApiOverrides = {
531
+ baseUrl?: string;
532
+ /** Internal local-development override for the hosted iframe origin. */
533
+ embedOrigin?: string;
534
+ };
535
+ /**
536
+ * Short-lived browser credential returned by the customer's server.
537
+ *
538
+ * Kept in the public bridge so its declarations never refer to private runtime packages.
539
+ */
540
+ type AgentAuthToken = {
541
+ expiresAt: number;
542
+ token: string;
543
+ };
544
+ /** Context supplied whenever the SDK needs a fresh browser credential. */
545
+ type GetAuthTokenContext = {
546
+ anonymousId: string;
547
+ agentId: string;
548
+ };
549
+ type GetAuthToken = (context: GetAuthTokenContext) => Promise<AgentAuthToken>;
550
+ type HeroUIAgentProps = {
551
+ /** Internal — for HeroUI platform development only. */
552
+ _api?: AgentApiOverrides;
553
+ appearance?: AgentAppearance;
554
+ capabilities?: AgentCapabilities;
555
+ /** Component export formats to show. Pass `false` to hide export and copy controls. */
556
+ componentExports?: AgentComponentExportFormat[] | false;
557
+ composer?: AgentComposerOptions;
558
+ /**
559
+ * Shared context for client tools; its reserved `page` key supplies the
560
+ * page context sent to the agent. See {@link AgentSharedContext}.
561
+ */
562
+ context?: AgentSharedContext;
563
+ /**
564
+ * Fetches a short-lived browser credential from the host application's
565
+ * server. Never expose a HeroUI Agent API key in browser code.
566
+ */
567
+ getAuthToken: GetAuthToken;
568
+ /** Streaming Markdown animation and caret preferences. */
569
+ markdown?: AgentMarkdownOptions;
570
+ /**
571
+ * Receives end-user ratings for assistant responses. Negative ratings can
572
+ * include structured reasons and an optional comment from the feedback popover.
573
+ */
574
+ onFeedback?: (feedback: AgentResponseFeedback) => Promise<void> | void;
575
+ /**
576
+ * Fires whenever project configuration and the complete composer are ready
577
+ * for the current conversation. Use `useAgent().ready` when a custom launcher
578
+ * also needs the status reactively.
579
+ */
580
+ onReady?: () => void;
581
+ /** Client-tool approval defaults and optional end-user picker. */
582
+ permissions?: AgentPermissionOptions;
583
+ /**
584
+ * Warm the agent before the visitor touches it: fetch the chat engine,
585
+ * configuration, and credentials, then bootstrap and preconnect the runtime
586
+ * while the panel is still closed. Work starts immediately and in parallel
587
+ * so readiness follows the launcher as quickly as possible. Opening before
588
+ * then shows the Agent shell with a loading state.
589
+ *
590
+ * Set to `false` to request nothing until the panel is opened. Worth doing
591
+ * when most visitors never open the agent, or on pages where you want to
592
+ * choose the moment yourself — `useAgent().preload()` runs the same warm-up
593
+ * on your signal.
594
+ * @default true
595
+ */
596
+ preload?: boolean;
597
+ agentId: string;
598
+ /**
599
+ * Reopen the panel after a page refresh when it was open before the refresh.
600
+ * The restored panel always starts a new chat instead of resuming the
601
+ * previously active conversation.
602
+ * @default false
603
+ */
604
+ reopenOnRefresh?: boolean;
605
+ /**
606
+ * Open the panel on the start screen instead of restoring the most recently
607
+ * active conversation. Conversation history remains available in the picker.
608
+ * @default false
609
+ */
610
+ startNewConversationOnOpen?: boolean;
611
+ /**
612
+ * Apply the appearance saved for this project in the HeroUI dashboard —
613
+ * launcher icon, colors, typography, greeting, subtitle, and suggested prompts —
614
+ * without redeploying.
615
+ *
616
+ * Anything passed in code wins, field by field, so this only fills in what
617
+ * you left unset. Pass `false` to ignore the dashboard entirely and
618
+ * configure the embed exclusively from props.
619
+ * @default true
620
+ */
621
+ remoteConfig?: boolean;
622
+ /**
623
+ * Per-message actions shown under assistant responses: `"copy"` copies the
624
+ * response text, `"feedback"` shows thumbs up/down, `"retry"` regenerates
625
+ * the last response. Pass `false` to hide all actions.
626
+ * @default ["copy", "feedback", "retry"]
627
+ */
628
+ responseActions?: AgentMessageAction[] | false;
629
+ /**
630
+ * Show the floating launcher button when the panel is closed. Set to
631
+ * `false` when opening the agent exclusively through `useAgent()`.
632
+ * @default true
633
+ */
634
+ showLauncher?: boolean;
635
+ /**
636
+ * Show a compact Beta chip in the open panel header, next to the assistant
637
+ * title. Useful while the agent is still stabilizing for end users.
638
+ * @default false
639
+ */
640
+ showBetaBadge?: boolean;
641
+ startScreen?: AgentStartScreenOptions;
642
+ /**
643
+ * Client tools the agent can call in the user's browser. Define with
644
+ * `createToolHelper<Context>()` for typed args and context.
645
+ */
646
+ tools?: ClientTool[];
647
+ };
648
+ type AgentController = {
649
+ hide: () => void;
650
+ /** Start a fresh conversation, optionally submitting its first prompt immediately. */
651
+ newConversation: (prompt?: string) => void;
652
+ /**
653
+ * Warm the agent now, without opening it — the same work the `preload` prop
654
+ * does on its own. Pair it with `preload={false}` to pick the moment from
655
+ * your own signal: a pricing page, a scroll depth, a form the visitor is
656
+ * struggling with. Cheap to call repeatedly; the work happens once.
657
+ */
658
+ preload: () => void;
659
+ /** Whether project configuration and the complete composer are ready to open. */
660
+ ready: boolean;
661
+ refreshAuth: () => void;
662
+ show: () => void;
663
+ shutdown: () => void;
664
+ toggle: () => void;
665
+ };
666
+
667
+ export { HEROUI_AGENT_ATTACHMENT_MAX_BYTES as $, AGENT_DESIGN_THEMES as A, type AgentPanelOptions as B, type AgentPermissionMode as C, type AgentPermissionOptions as D, type AgentRadius as E, type AgentResponseFeedback as F, type AgentSharedContext as G, type AgentShouldCloseOnInteractOutside as H, type AgentStartScreenOptions as I, type AgentSurfaceVariant as J, type AgentThemeColor as K, type AgentThemeColors as L, type AgentThemeOptions as M, type AgentTypography as N, type AgentViewMode as O, type ClientTool as P, type ClientToolExecutionContext as Q, type ClientToolIcon as R, type ClientToolStatus as S, DEFAULT_AGENT_PICKER_MODEL_ID as T, DEFAULT_MARKDOWN_ANIMATION as U, type GetAuthToken as V, type GetAuthTokenContext as W, HEROUI_AGENT_ATTACHMENT_ACCEPT as X, HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES as Y, HEROUI_AGENT_ATTACHMENT_CONTENT_TYPE_BY_EXTENSION as Z, HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE as _, AGENT_MODEL_IDS as a, HEROUI_AGENT_MAX_ATTACHMENTS as a0, HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES as a1, type HeroUIAgentAttachmentContentType as a2, type HeroUIAgentProps as a3, LEGACY_AGENT_MODEL_IDS as a4, type UploadAgentDataSourceInput as a5, createToolHelper as a6, getAgentModelTier as a7, isAgentModelId as a8, isHeroUIAgentAttachmentContentType as a9, parseClientToolArgs as aa, resolveAgentModelId as ab, resolveDirectToolAction as ac, resolveHeroUIAgentAttachmentContentType as ad, AGENT_MODEL_OPTIONS as b, type AgentApiOverrides as c, type AgentAppearance as d, type AgentAttachmentContentType as e, type AgentAuthToken as f, type AgentCapabilities as g, type AgentColorScheme as h, type AgentComponentExportFormat as i, type AgentComposerOptions as j, type AgentContext as k, type AgentController as l, type AgentDataSource as m, type AgentDataSourceFormat as n, type AgentDesignTheme as o, type AgentFeedbackReason as p, type AgentLauncherOptions as q, type AgentLauncherPosition as r, type AgentMarkdownAnimation as s, type AgentMarkdownAnimationOptions as t, type AgentMarkdownCaret as u, type AgentMarkdownOptions as v, type AgentMessageAction as w, type AgentModelId as x, type AgentModelOption as y, type AgentModelTier as z };
@@ -0,0 +1,5 @@
1
+ declare const HEROUI_AGENT_SDK_VERSION: "1.0.0-beta.5";
2
+ /** Production Agent API origin used when hosts omit `_api.baseUrl` / `apiBaseUrl`. */
3
+ declare const HEROUI_AGENT_API_BASE_URL: "https://api.heroui.pro";
4
+
5
+ export { HEROUI_AGENT_API_BASE_URL as H, HEROUI_AGENT_SDK_VERSION as a };