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

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 +38 -0
  2. package/README.md +119 -68
  3. package/dist/chunk-3UR3CJAJ.js +1 -0
  4. package/dist/chunk-AR424OVX.js +1 -0
  5. package/dist/chunk-BYV3XUCN.js +1 -0
  6. package/dist/chunk-L5DXTMC2.js +1 -0
  7. package/dist/chunk-LMNV4H5B.js +1 -0
  8. package/dist/chunk-ZD5U6JIE.js +1 -0
  9. package/dist/client-tools-manifest-2T23ADUM.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-BeXKAj2P.d.ts +549 -0
  23. package/dist/version-BOWn57s2.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,549 @@
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
+ /**
84
+ * Light/dark color scheme selection for the embed. `"system"` follows the
85
+ * OS preference and updates live when it changes.
86
+ */
87
+ type AgentColorScheme = "dark" | "light" | "system";
88
+ /**
89
+ * A theme color value: one CSS color applied to both schemes, or separate
90
+ * values per scheme. Tokens left unset fall back to the built-in defaults of
91
+ * each scheme, so overriding a light color never degrades dark mode.
92
+ */
93
+ type AgentThemeColor = string | {
94
+ dark?: string;
95
+ light?: string;
96
+ };
97
+ /** Corner rounding preset applied across the embed surface and fields. */
98
+ type AgentRadius = "pill" | "round" | "sharp" | "soft";
99
+ /**
100
+ * The seven high-impact color tokens. Everything else in the embed
101
+ * (borders, shadows, chart palettes) derives from these and from the
102
+ * built-in scheme defaults.
103
+ */
104
+ type AgentThemeColors = {
105
+ /** Primary action and highlight color. Chart palettes derive from it. */
106
+ accent?: AgentThemeColor;
107
+ /** Chat panel background. */
108
+ background?: AgentThemeColor;
109
+ /** Primary text color. */
110
+ foreground?: AgentThemeColor;
111
+ /** Dropdown and popover surface color. */
112
+ overlay?: AgentThemeColor;
113
+ /** Card surface color. */
114
+ surface?: AgentThemeColor;
115
+ /** Secondary surface color (chips, muted fills). */
116
+ surfaceSecondary?: AgentThemeColor;
117
+ /** Tooltip surface color. Text contrast is derived automatically. */
118
+ tooltip?: AgentThemeColor;
119
+ };
120
+ type AgentTypography = {
121
+ /**
122
+ * Base font size in pixels (clamped to 12–18).
123
+ * @default 14
124
+ */
125
+ baseSize?: number;
126
+ /** CSS font family stack, e.g. `"Geist, sans-serif"`. */
127
+ fontFamily?: string;
128
+ };
129
+ /**
130
+ * HeroUI Pro theme variant applied to the agent surface, e.g. `"base"`,
131
+ * `"brutalism"`, `"glass"`, or `"mouve"`.
132
+ *
133
+ * Hosted Agent deployments own the list of supported variants and activate the
134
+ * selected one inside the iframe; unknown values fall back to `"base"`, so new
135
+ * variants never require an SDK update.
136
+ */
137
+ type AgentDesignTheme = string;
138
+ /**
139
+ * Intentionally small theme surface: one color scheme, one Pro variant, four
140
+ * radius presets, seven color tokens, and basic typography. No named themes,
141
+ * extend chains, or per-component tokens.
142
+ */
143
+ type AgentThemeOptions = {
144
+ /** @default "system" */
145
+ colorScheme?: AgentColorScheme;
146
+ colors?: AgentThemeColors;
147
+ /**
148
+ * HeroUI Pro theme variant rendered by the hosted Agent.
149
+ * @default "base"
150
+ */
151
+ designTheme?: AgentDesignTheme;
152
+ /** @default "round" */
153
+ radius?: AgentRadius;
154
+ typography?: AgentTypography;
155
+ };
156
+
157
+ type AgentComponentExportFormat = "csv" | "png" | "svg";
158
+ type AgentPermissionMode = "ask" | "auto" | "full";
159
+ /**
160
+ * MIME type accepted by the hosted HeroUI Agent attachment pipeline, e.g.
161
+ * `"application/pdf"` or `"text/csv"`. The hosted Agent owns the supported
162
+ * list and ignores unknown types, so new formats never require an SDK update.
163
+ * See https://heroui.pro/docs/agents/api-reference/configuration.
164
+ */
165
+ type AgentAttachmentContentType = string;
166
+ /**
167
+ * Model id from the hosted HeroUI Agent catalog, e.g. `"google/gemini-3.7-flash"`.
168
+ * The hosted Agent owns the catalog: retired ids resolve to their replacement
169
+ * and unknown ids fall back to the default model, so new models never require
170
+ * an SDK update. See https://heroui.pro/docs/agents/api-reference/models.
171
+ */
172
+ type AgentModelId = string;
173
+ type AgentMessageAction = "copy" | "feedback" | "retry";
174
+ type AgentFeedbackReason = "did_not_follow_instructions" | "incomplete" | "incorrect" | "not_relevant" | "other" | "unclear";
175
+ type AgentResponseFeedback = {
176
+ /** Optional free-form context supplied by the end user. */
177
+ comment?: string;
178
+ conversationId: string;
179
+ messageId: string;
180
+ rating: "negative" | "positive";
181
+ /** Structured reasons selected for negative feedback. Empty for positive feedback. */
182
+ reasons: AgentFeedbackReason[];
183
+ };
184
+ type AgentContext = Record<string, unknown>;
185
+ /**
186
+ * The single shared context object. It is passed as the second argument to
187
+ * every client tool's `execute` — API clients, user info, state setters.
188
+ * Anything goes; it never leaves the browser.
189
+ *
190
+ * One key is reserved: `page`. When present, the SDK calls it on every turn
191
+ * and sends its JSON-serializable return value (route, filters, selection —
192
+ * max 16KB) to the agent as page context. Nothing else in the context object
193
+ * ever crosses the wire.
194
+ */
195
+ type AgentSharedContext = {
196
+ page?: () => AgentContext | Promise<AgentContext>;
197
+ } & Record<string, unknown>;
198
+ type AgentViewMode = "floating" | "sidebar";
199
+ type AgentSurfaceVariant = "outline" | "plain" | "surface" | "surface-secondary";
200
+ /**
201
+ * Controls whether an outside interaction closes the floating panel. Matches React
202
+ * Aria Popover: `true` or omitted always closes; `false` never closes.
203
+ */
204
+ type AgentShouldCloseOnInteractOutside = boolean;
205
+ type AgentMarkdownAnimationOptions = {
206
+ animation?: "blurIn" | "fadeIn" | "slideUp" | (string & {});
207
+ duration?: number;
208
+ easing?: string;
209
+ sep?: "char" | "word";
210
+ stagger?: number;
211
+ };
212
+ type AgentMarkdownAnimation = boolean | AgentMarkdownAnimationOptions;
213
+ type AgentMarkdownCaret = "block" | "circle";
214
+ /** Streaming Markdown presentation. Rich renderers are owned by the hosted Agent UI. */
215
+ type AgentMarkdownOptions = {
216
+ /**
217
+ * Animate newly streamed content. Pass `false` to disable text animation.
218
+ * @default {animation: "fadeIn", duration: 160, easing: "ease-out", sep: "word", stagger: 18}
219
+ */
220
+ animated?: AgentMarkdownAnimation;
221
+ /** Streaming caret style. Pass `false` to hide it. @default "block" */
222
+ caret?: AgentMarkdownCaret | false;
223
+ };
224
+ declare const DEFAULT_MARKDOWN_ANIMATION: {
225
+ animation: "fadeIn";
226
+ duration: number;
227
+ easing: string;
228
+ sep: "word";
229
+ stagger: number;
230
+ };
231
+ /** Corner that anchors the launcher button and the floating panel. */
232
+ type AgentLauncherPosition = "bottom-left" | "bottom-right";
233
+ /** Placement of the floating launcher button (visibility is `showLauncher`). */
234
+ type AgentLauncherOptions = {
235
+ /**
236
+ * Fill of the launcher button. Defaults to the accent color; set it when a
237
+ * custom {@link icon} needs a different backdrop. The mark inside gets a
238
+ * contrasting foreground automatically.
239
+ */
240
+ background?: AgentThemeColor;
241
+ /**
242
+ * Image rendered inside the launcher button instead of the built-in spark
243
+ * mark. Use a square asset (70x70 or larger); it is scaled to fit.
244
+ */
245
+ icon?: string;
246
+ /**
247
+ * Pixel offsets from the anchored corner: `x` from the side edge, `y` from
248
+ * the bottom. Defaults to 24 (16 on small screens).
249
+ */
250
+ offset?: {
251
+ x?: number;
252
+ y?: number;
253
+ };
254
+ /** @default "bottom-right" */
255
+ position?: AgentLauncherPosition;
256
+ /**
257
+ * Escape hatch for launcher styling the options above do not cover, applied
258
+ * as inline styles on the button (so it wins over the stylesheet). Prefer the
259
+ * dedicated options where they exist; this is not covered by the embed's
260
+ * visual defaults and can break the button's layout.
261
+ */
262
+ style?: CSSProperties;
263
+ };
264
+ /** Optional hosted-agent capabilities, all off by default. */
265
+ type AgentCapabilities = {
266
+ /**
267
+ * Allow the hosted agent to search for images via web search. Only applies
268
+ * when {@link webSearch} is enabled; defaults to true in that case.
269
+ * @default true
270
+ */
271
+ imageSearch?: boolean;
272
+ /**
273
+ * Allow the hosted agent to include recent news results in web searches.
274
+ * Only applies when {@link webSearch} is enabled and is off by default.
275
+ * @default false
276
+ */
277
+ newsSearch?: boolean;
278
+ /**
279
+ * Allow the hosted agent to search the public web for current information
280
+ * and images. Results are untrusted external content; keep this off when the
281
+ * assistant should only ever answer from your declared client tools.
282
+ * @default false
283
+ */
284
+ webSearch?: boolean;
285
+ };
286
+ /** Browser client-tool approval policy. */
287
+ type AgentPermissionOptions = {
288
+ /**
289
+ * Permission mode used before an end user chooses another mode.
290
+ * `"ask"` gates every client tool, `"auto"` gates only tools marked
291
+ * `needsApproval`, and `"full"` runs client tools without prompting.
292
+ * @default "auto"
293
+ */
294
+ defaultMode?: AgentPermissionMode;
295
+ /**
296
+ * Show the permission picker in the composer, letting the end user switch
297
+ * modes for themselves.
298
+ *
299
+ * This is a privilege boundary, not just a control: it permits the end user
300
+ * to select `"full"` and run every client tool without approval, overriding
301
+ * {@link defaultMode}. Their choice persists for the conversation.
302
+ *
303
+ * The picker only renders when {@link HeroUIAgentProps.tools} is non-empty,
304
+ * since there is nothing to approve otherwise.
305
+ * @default false
306
+ */
307
+ showPicker?: boolean;
308
+ };
309
+ /**
310
+ * Size and expansion of the chat panel. In `floating` mode expansion grows the
311
+ * card; in `sidebar` mode it temporarily fills the viewport. Initial dimensions
312
+ * are ignored in `sidebar` mode and below the mobile breakpoint.
313
+ */
314
+ type AgentPanelOptions = {
315
+ /**
316
+ * Open the panel expanded. End users can still collapse it unless
317
+ * {@link expandable} is off.
318
+ * @default false
319
+ */
320
+ expanded?: boolean;
321
+ /**
322
+ * Offer the expand control in the panel header. In sidebar mode the expanded
323
+ * panel fills the viewport. Turn it off to pin the panel to one size.
324
+ * @default true
325
+ */
326
+ expandable?: boolean;
327
+ /**
328
+ * Panel height before expanding — a number in pixels or any CSS length.
329
+ * Capped to the viewport.
330
+ * @default "max(420px, 56dvh)"
331
+ */
332
+ initialHeight?: number | string;
333
+ /**
334
+ * Panel width before expanding — a number in pixels or any CSS length.
335
+ * Expanding widens the panel from here. Capped to the viewport.
336
+ * @default 440
337
+ */
338
+ initialWidth?: number | string;
339
+ };
340
+ /** Visual presentation: view mode, theme, panel size, and launcher placement. */
341
+ type AgentAppearance = {
342
+ /** Surface treatment for approval, calendar, commerce, and other response cards. @default "surface" */
343
+ componentSurfaceVariant?: AgentSurfaceVariant;
344
+ /** Where the launcher button (and the floating panel) is anchored. */
345
+ launcher?: AgentLauncherOptions;
346
+ /** Size and expansion of the floating panel. */
347
+ panel?: AgentPanelOptions;
348
+ /**
349
+ * When the visitor interacts outside the floating panel, whether to close it.
350
+ * Only applies in `viewMode: "floating"`. `true` or omitted always closes;
351
+ * `false` never closes on outside interact. Escape and the header close
352
+ * button are unchanged.
353
+ */
354
+ shouldCloseOnInteractOutside?: AgentShouldCloseOnInteractOutside;
355
+ /** Surface treatment for charts, tables, maps, and other primary data surfaces. */
356
+ surfaceVariant?: AgentSurfaceVariant;
357
+ theme?: AgentThemeOptions;
358
+ /**
359
+ * How the chat opens: `"floating"` (default) is a floating rounded panel in
360
+ * the corner; `"sidebar"` docks full-height to the right edge of the page.
361
+ */
362
+ viewMode?: AgentViewMode;
363
+ /**
364
+ * Stacking level of the Agent host. Set this when the Agent must sit below
365
+ * application-owned dialogs or above unusually high application chrome.
366
+ * This sets the public `--ha-z-index` CSS custom property.
367
+ * @default 40
368
+ */
369
+ zIndex?: number;
370
+ };
371
+ /** Message composer settings. */
372
+ type AgentComposerOptions = {
373
+ /**
374
+ * File types end users can attach. Omit to allow every supported type, pass
375
+ * a subset to narrow the picker, or pass `false` to remove attachments.
376
+ * @default all supported attachment types
377
+ */
378
+ attachments?: AgentAttachmentContentType[] | false;
379
+ /**
380
+ * Model used for new turns before an end user chooses another model.
381
+ * When the picker is disabled, this pins every turn to the configured model.
382
+ */
383
+ defaultModel?: AgentModelId;
384
+ /** Show microphone recording and voice transcription controls. @default true */
385
+ dictation?: boolean;
386
+ /**
387
+ * Small verification notice shown below the composer and above the HeroUI
388
+ * attribution. Supports `[label](example.com)` and HTTPS links; bare domains
389
+ * are normalized to HTTPS. Limited to 240 characters. Pass `false` or omit it
390
+ * to hide the notice.
391
+ * @default false
392
+ * @example "Agent may make mistakes. [View terms](https://example.com/terms)"
393
+ */
394
+ disclaimer?: string | false;
395
+ /** Let the end user choose from the hosted agent's allowlisted models. @default false */
396
+ modelPicker?: boolean;
397
+ /** Placeholder shown in the message composer. @default "Ask anything…" */
398
+ placeholder?: string;
399
+ };
400
+ /** The empty-conversation view shown before the first message. */
401
+ type AgentStartScreenOptions = {
402
+ /** Heading shown above the composer. @default "Ask about your data" */
403
+ greeting?: string;
404
+ /** Show and enable `Ctrl+1`…`Ctrl+5` shortcuts for the visible prompts. @default false */
405
+ promptShortcuts?: boolean;
406
+ /** Up to five suggested prompts (each max 160 characters). */
407
+ prompts?: string[];
408
+ /** Supporting text shown below the greeting. Limited to 240 characters. */
409
+ subtitle?: string;
410
+ };
411
+ /** Internal — for HeroUI platform development only. */
412
+ type AgentApiOverrides = {
413
+ baseUrl?: string;
414
+ /** Internal local-development override for the hosted iframe origin. */
415
+ embedOrigin?: string;
416
+ };
417
+ /**
418
+ * Short-lived browser credential returned by the customer's server.
419
+ *
420
+ * Kept in the public bridge so its declarations never refer to private runtime packages.
421
+ */
422
+ type AgentAuthToken = {
423
+ expiresAt: number;
424
+ token: string;
425
+ };
426
+ /** Context supplied whenever the SDK needs a fresh browser credential. */
427
+ type GetAuthTokenContext = {
428
+ anonymousId: string;
429
+ agentId: string;
430
+ };
431
+ type GetAuthToken = (context: GetAuthTokenContext) => Promise<AgentAuthToken>;
432
+ type HeroUIAgentProps = {
433
+ /** Internal — for HeroUI platform development only. */
434
+ _api?: AgentApiOverrides;
435
+ appearance?: AgentAppearance;
436
+ capabilities?: AgentCapabilities;
437
+ /** Component export formats to show. Pass `false` to hide export and copy controls. */
438
+ componentExports?: AgentComponentExportFormat[] | false;
439
+ composer?: AgentComposerOptions;
440
+ /**
441
+ * Shared context for client tools; its reserved `page` key supplies the
442
+ * page context sent to the agent. See {@link AgentSharedContext}.
443
+ */
444
+ context?: AgentSharedContext;
445
+ /**
446
+ * Fetches a short-lived browser credential from the host application's
447
+ * server. Never expose a HeroUI Agent API key in browser code.
448
+ */
449
+ getAuthToken: GetAuthToken;
450
+ /** Streaming Markdown animation and caret preferences. */
451
+ markdown?: AgentMarkdownOptions;
452
+ /**
453
+ * Receives end-user ratings for assistant responses. Negative ratings can
454
+ * include structured reasons and an optional comment from the feedback popover.
455
+ */
456
+ onFeedback?: (feedback: AgentResponseFeedback) => Promise<void> | void;
457
+ /**
458
+ * Fires whenever project configuration and the complete composer are ready
459
+ * for the current conversation. Use `useAgent().ready` when a custom launcher
460
+ * also needs the status reactively.
461
+ */
462
+ onReady?: () => void;
463
+ /** Client-tool approval defaults and optional end-user picker. */
464
+ permissions?: AgentPermissionOptions;
465
+ /**
466
+ * Warm the agent before the visitor touches it: fetch the chat engine,
467
+ * configuration, and credentials, then bootstrap and preconnect the runtime
468
+ * while the panel is still closed. Work starts immediately and in parallel
469
+ * so readiness follows the launcher as quickly as possible. Opening before
470
+ * then shows the Agent shell with a loading state.
471
+ *
472
+ * Set to `false` to request nothing until the panel is opened. Worth doing
473
+ * when most visitors never open the agent, or on pages where you want to
474
+ * choose the moment yourself — `useAgent().preload()` runs the same warm-up
475
+ * on your signal.
476
+ * @default true
477
+ */
478
+ preload?: boolean;
479
+ agentId: string;
480
+ /**
481
+ * Reopen the panel after a page refresh when it was open before the refresh.
482
+ * The restored panel always starts a new chat instead of resuming the
483
+ * previously active conversation.
484
+ * @default false
485
+ */
486
+ reopenOnRefresh?: boolean;
487
+ /**
488
+ * Open the panel on the start screen instead of restoring the most recently
489
+ * active conversation. Conversation history remains available in the picker.
490
+ * @default false
491
+ */
492
+ startNewConversationOnOpen?: boolean;
493
+ /**
494
+ * Apply the appearance saved for this project in the HeroUI dashboard —
495
+ * launcher icon, colors, typography, greeting, subtitle, and suggested prompts —
496
+ * without redeploying.
497
+ *
498
+ * Anything passed in code wins, field by field, so this only fills in what
499
+ * you left unset. Pass `false` to ignore the dashboard entirely and
500
+ * configure the embed exclusively from props.
501
+ * @default true
502
+ */
503
+ remoteConfig?: boolean;
504
+ /**
505
+ * Per-message actions shown under assistant responses: `"copy"` copies the
506
+ * response text, `"feedback"` shows thumbs up/down, `"retry"` regenerates
507
+ * the last response. Pass `false` to hide all actions.
508
+ * @default ["copy", "feedback", "retry"]
509
+ */
510
+ responseActions?: AgentMessageAction[] | false;
511
+ /**
512
+ * Show the floating launcher button when the panel is closed. Set to
513
+ * `false` when opening the agent exclusively through `useAgent()`.
514
+ * @default true
515
+ */
516
+ showLauncher?: boolean;
517
+ /**
518
+ * Show a compact Beta chip in the open panel header, next to the assistant
519
+ * title. Useful while the agent is still stabilizing for end users.
520
+ * @default false
521
+ */
522
+ showBetaBadge?: boolean;
523
+ startScreen?: AgentStartScreenOptions;
524
+ /**
525
+ * Client tools the agent can call in the user's browser. Define with
526
+ * `createToolHelper<Context>()` for typed args and context.
527
+ */
528
+ tools?: ClientTool[];
529
+ };
530
+ type AgentController = {
531
+ hide: () => void;
532
+ /** Start a fresh conversation, optionally submitting its first prompt immediately. */
533
+ newConversation: (prompt?: string) => void;
534
+ /**
535
+ * Warm the agent now, without opening it — the same work the `preload` prop
536
+ * does on its own. Pair it with `preload={false}` to pick the moment from
537
+ * your own signal: a pricing page, a scroll depth, a form the visitor is
538
+ * struggling with. Cheap to call repeatedly; the work happens once.
539
+ */
540
+ preload: () => void;
541
+ /** Whether project configuration and the complete composer are ready to open. */
542
+ ready: boolean;
543
+ refreshAuth: () => void;
544
+ show: () => void;
545
+ shutdown: () => void;
546
+ toggle: () => void;
547
+ };
548
+
549
+ export { type AgentApiOverrides as A, type AgentSharedContext as B, type AgentShouldCloseOnInteractOutside as C, type AgentStartScreenOptions as D, type AgentSurfaceVariant as E, type AgentThemeColor as F, type AgentThemeColors as G, type AgentThemeOptions as H, type AgentTypography as I, type AgentViewMode as J, type ClientTool as K, type ClientToolExecutionContext as L, type ClientToolIcon as M, type ClientToolStatus as N, DEFAULT_MARKDOWN_ANIMATION as O, type GetAuthToken as P, type GetAuthTokenContext as Q, type HeroUIAgentProps as R, createToolHelper as S, parseClientToolArgs as T, type UploadAgentDataSourceInput as U, resolveDirectToolAction as V, type AgentAppearance as a, type AgentAttachmentContentType as b, type AgentAuthToken as c, type AgentCapabilities as d, type AgentColorScheme as e, type AgentComponentExportFormat as f, type AgentComposerOptions as g, type AgentContext as h, type AgentController as i, type AgentDataSource as j, type AgentDataSourceFormat as k, type AgentDesignTheme as l, type AgentFeedbackReason as m, type AgentLauncherOptions as n, type AgentLauncherPosition as o, type AgentMarkdownAnimation as p, type AgentMarkdownAnimationOptions as q, type AgentMarkdownCaret as r, type AgentMarkdownOptions as s, type AgentMessageAction as t, type AgentModelId as u, type AgentPanelOptions as v, type AgentPermissionMode as w, type AgentPermissionOptions as x, type AgentRadius as y, type AgentResponseFeedback as z };
@@ -0,0 +1,5 @@
1
+ declare const HEROUI_AGENT_SDK_VERSION: "1.0.0-beta.6";
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroui/agent",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "Embed a hosted HeroUI Agent that turns application data into interactive UI.",
5
5
  "homepage": "https://heroui.pro/agents",
6
6
  "bugs": {
@@ -15,6 +15,8 @@
15
15
  "agent",
16
16
  "generative-ui",
17
17
  "heroui",
18
+ "iframe",
19
+ "javascript",
18
20
  "react"
19
21
  ],
20
22
  "license": "MIT",
@@ -30,10 +32,6 @@
30
32
  "types": "./dist/index.d.ts",
31
33
  "import": "./dist/index.js"
32
34
  },
33
- "./contracts": {
34
- "types": "./dist/contracts.d.ts",
35
- "import": "./dist/contracts.js"
36
- },
37
35
  "./next": {
38
36
  "types": "./dist/next.d.ts",
39
37
  "import": "./dist/next.js"
@@ -42,6 +40,14 @@
42
40
  "types": "./dist/server.d.ts",
43
41
  "import": "./dist/server.js"
44
42
  },
43
+ "./internal/host": {
44
+ "types": "./dist/internal/host.d.ts",
45
+ "import": "./dist/internal/host.js"
46
+ },
47
+ "./internal/shared": {
48
+ "types": "./dist/internal/shared.d.ts",
49
+ "import": "./dist/internal/shared.js"
50
+ },
45
51
  "./css": {
46
52
  "style": "./dist/css/index.css",
47
53
  "import": "./dist/css/index.css",
@@ -65,28 +71,15 @@
65
71
  "node": ">=20"
66
72
  },
67
73
  "dependencies": {
68
- "@ai-sdk/react": "4.0.12",
69
- "@cloudflare/ai-chat": "0.10.1",
70
- "@gravity-ui/icons": "2.18.0",
71
- "@heroui/react": "3.2.2",
72
- "@internationalized/date": "3.12.2",
73
- "@react-aria/utils": "3.34.1",
74
- "@react-stately/utils": "3.12.1",
75
- "agents": "0.20.1",
76
- "ai": "7.0.11",
77
- "dompurify": "3.4.13",
78
- "maplibre-gl": "5.24.0",
79
- "motion": "12.38.0",
80
- "react-aria-components": "1.19.0",
81
- "recharts": "3.8.0",
82
- "shiki": "4.0.2",
83
- "mermaid": "11.16.1",
84
- "streamdown": "2.5.0",
85
74
  "zod": "4.3.6"
86
75
  },
87
76
  "peerDependencies": {
88
- "react": ">=19.0.0",
89
- "react-dom": ">=19.0.0"
77
+ "react": ">=19.0.0"
78
+ },
79
+ "peerDependenciesMeta": {
80
+ "react": {
81
+ "optional": true
82
+ }
90
83
  },
91
84
  "browserslist": [
92
85
  "Chrome >= 120",
@@ -96,28 +89,19 @@
96
89
  ],
97
90
  "devDependencies": {
98
91
  "@arethetypeswrong/cli": "0.18.5",
99
- "@heroui/styles": "3.2.2",
100
- "@tailwindcss/cli": "4.2.2",
101
92
  "@types/react": "19.2.14",
102
93
  "@types/react-dom": "19.2.3",
103
94
  "fake-indexeddb": "6.2.5",
104
- "jsdom": "26.1.0",
105
- "postcss": "8.5.23",
106
95
  "publint": "0.3.21",
107
96
  "react": "19.2.6",
108
97
  "react-dom": "19.2.6",
109
- "tailwindcss": "4.2.2",
110
98
  "tsup": "8.5.0",
111
99
  "typescript": "5.9.3",
112
100
  "vitest": "4.1.0",
113
- "@heroui/agent-client": "0.0.0",
114
- "@heroui-pro/react": "1.0.0-beta.8",
115
- "@heroui/agent-ui": "0.0.0",
116
101
  "@heroui-pro/config": "0.0.0"
117
102
  },
118
103
  "scripts": {
119
104
  "build": "rm -rf dist && tsup && pnpm build:styles",
120
- "build:contracts": "rm -rf dist && tsup --config tsup.contracts.config.ts",
121
105
  "build:styles": "node scripts/build-styles.mjs",
122
106
  "check:bundle": "node scripts/check-bundle-size.mjs",
123
107
  "check:package": "publint && attw --pack . --profile esm-only --exclude-entrypoints css css/index.css",
@@ -125,7 +109,7 @@
125
109
  "clean": "rm -rf dist node_modules .turbo",
126
110
  "lint": "eslint src/",
127
111
  "lint:fix": "eslint src/ --fix",
128
- "release": "pnpm prepublishOnly && bumpp package.json src/contracts/version.ts ../../apps/frontend/src/app/dashboard/agents/_preview/contracts/version.ts --commit \"chore(agent): release heroui-agent-v%s\" --tag \"heroui-agent-v%s\"",
112
+ "release": "pnpm prepublishOnly && bumpp package.json src/version.ts ../../apps/frontend/src/app/dashboard/agents/_preview/contracts/version.ts --commit \"chore(agent): release heroui-agent-v%s\" --tag \"heroui-agent-v%s\"",
129
113
  "test": "NODE_OPTIONS=\"${NODE_OPTIONS:+$NODE_OPTIONS }--no-experimental-webstorage\" vitest run",
130
114
  "typecheck": "tsc --noEmit",
131
115
  "verify:pack": "node scripts/verify-packed-package.mjs"