@useago/sdk 0.3.2 → 0.3.4

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 (121) hide show
  1. package/dist/AgoClient-DF7M2WAz.js +575 -0
  2. package/dist/AgoClient-bjN-z2ZQ.cjs +6 -0
  3. package/dist/angular.cjs +1 -143
  4. package/dist/angular.d.cts +530 -0
  5. package/dist/angular.d.ts +530 -2
  6. package/dist/angular.js +71 -139
  7. package/dist/createFormCollector-ClzHfaBd.js +185 -0
  8. package/dist/createFormCollector-H4Me_2uj.cjs +1 -0
  9. package/dist/createMockClient-C50gjV0b.js +71 -0
  10. package/dist/createMockClient-DQvFFWnc.cjs +1 -0
  11. package/dist/devtools.cjs +26 -100
  12. package/dist/devtools.d.cts +443 -0
  13. package/dist/devtools.d.ts +443 -2
  14. package/dist/devtools.js +68 -93
  15. package/dist/functions-BH1X5kas.cjs +1 -0
  16. package/dist/functions-CWSRi3xv.js +312 -0
  17. package/dist/helpers.cjs +1 -15
  18. package/dist/{helpers/functions.d.ts → helpers.d.cts} +121 -62
  19. package/dist/helpers.d.ts +121 -2
  20. package/dist/helpers.js +16 -2
  21. package/dist/index.cjs +1 -347
  22. package/dist/index.d.cts +1150 -0
  23. package/dist/index.d.ts +1150 -20
  24. package/dist/index.js +129 -298
  25. package/dist/react.cjs +31 -22438
  26. package/dist/react.d.cts +999 -0
  27. package/dist/react.d.ts +999 -2
  28. package/dist/react.js +8416 -22376
  29. package/dist/rolldown-runtime-CaekUdDJ.cjs +1 -0
  30. package/dist/rolldown-runtime-DxmricAu.js +25 -0
  31. package/dist/vue.cjs +1 -336
  32. package/dist/vue.d.cts +1063 -0
  33. package/dist/vue.d.ts +1063 -2
  34. package/dist/vue.js +174 -316
  35. package/dist/widget.cjs +1 -0
  36. package/dist/widget.d.cts +577 -0
  37. package/dist/widget.d.ts +577 -2
  38. package/dist/widget.js +398 -0
  39. package/package.json +35 -24
  40. package/dist/AgoClient-DPZdN5n2.js +0 -905
  41. package/dist/AgoClient-DPZdN5n2.js.map +0 -1
  42. package/dist/AgoClient-wMVUQqCD.cjs +0 -976
  43. package/dist/AgoClient-wMVUQqCD.cjs.map +0 -1
  44. package/dist/angular/ago.service.d.ts +0 -98
  45. package/dist/angular/index.d.ts +0 -4
  46. package/dist/angular/provide.d.ts +0 -27
  47. package/dist/angular.cjs.map +0 -1
  48. package/dist/angular.js.map +0 -1
  49. package/dist/api/HttpClient.d.ts +0 -31
  50. package/dist/api/index.d.ts +0 -1
  51. package/dist/auto/createAgo.d.ts +0 -39
  52. package/dist/auto/index.d.ts +0 -1
  53. package/dist/client/AgoClient.d.ts +0 -169
  54. package/dist/client/errors.d.ts +0 -48
  55. package/dist/client/index.d.ts +0 -3
  56. package/dist/client/types.d.ts +0 -205
  57. package/dist/createMockClient-Ci_N2tH8.cjs +0 -104
  58. package/dist/createMockClient-Ci_N2tH8.cjs.map +0 -1
  59. package/dist/createMockClient-U0ae_AYy.js +0 -99
  60. package/dist/createMockClient-U0ae_AYy.js.map +0 -1
  61. package/dist/devtools/index.d.ts +0 -2
  62. package/dist/devtools/initDevPanel.d.ts +0 -15
  63. package/dist/devtools.cjs.map +0 -1
  64. package/dist/devtools.js.map +0 -1
  65. package/dist/functions/FunctionRegistry.d.ts +0 -41
  66. package/dist/functions/defineFunction.d.ts +0 -22
  67. package/dist/functions/index.d.ts +0 -2
  68. package/dist/functions/types.d.ts +0 -50
  69. package/dist/functions--c6lx3ic.cjs +0 -480
  70. package/dist/functions--c6lx3ic.cjs.map +0 -1
  71. package/dist/functions-C9F1dnmh.js +0 -398
  72. package/dist/functions-C9F1dnmh.js.map +0 -1
  73. package/dist/helpers/factory.d.ts +0 -20
  74. package/dist/helpers/index.d.ts +0 -1
  75. package/dist/index.cjs.map +0 -1
  76. package/dist/index.js.map +0 -1
  77. package/dist/react/components/ChatInput.d.ts +0 -12
  78. package/dist/react/components/ChatWidget.d.ts +0 -35
  79. package/dist/react/components/Markdown.d.ts +0 -12
  80. package/dist/react/components/Message.d.ts +0 -9
  81. package/dist/react/components/index.d.ts +0 -8
  82. package/dist/react/context/AgoContext.d.ts +0 -62
  83. package/dist/react/context/index.d.ts +0 -2
  84. package/dist/react/hooks/index.d.ts +0 -7
  85. package/dist/react/hooks/useAgo.d.ts +0 -14
  86. package/dist/react/hooks/useAgoContext.d.ts +0 -40
  87. package/dist/react/hooks/useAgoFunction.d.ts +0 -58
  88. package/dist/react/hooks/useAgoStore.d.ts +0 -17
  89. package/dist/react/hooks/useChat.d.ts +0 -45
  90. package/dist/react/hooks/useConversation.d.ts +0 -28
  91. package/dist/react/hooks/useMessages.d.ts +0 -26
  92. package/dist/react/index.d.ts +0 -24
  93. package/dist/react/testing.d.ts +0 -2
  94. package/dist/react.cjs.map +0 -1
  95. package/dist/react.js.map +0 -1
  96. package/dist/rolldown-runtime-BqCkTl7Q.cjs +0 -50
  97. package/dist/rolldown-runtime-CNZpIYwj.js +0 -33
  98. package/dist/state/ClientContextRegistry.d.ts +0 -64
  99. package/dist/state/createStore.d.ts +0 -30
  100. package/dist/streaming/SSEHandler.d.ts +0 -46
  101. package/dist/streaming/helpers.d.ts +0 -67
  102. package/dist/streaming/index.d.ts +0 -2
  103. package/dist/testing/createMockClient.d.ts +0 -42
  104. package/dist/testing/index.d.ts +0 -2
  105. package/dist/utils/eventEmitter.d.ts +0 -23
  106. package/dist/utils/index.d.ts +0 -2
  107. package/dist/utils/logger.d.ts +0 -14
  108. package/dist/vue/composables/useAgo.d.ts +0 -17
  109. package/dist/vue/composables/useAgoEvents.d.ts +0 -11
  110. package/dist/vue/composables/useAgoFunction.d.ts +0 -34
  111. package/dist/vue/composables/useAgoStore.d.ts +0 -18
  112. package/dist/vue/composables/useChat.d.ts +0 -251
  113. package/dist/vue/composables/useConversation.d.ts +0 -178
  114. package/dist/vue/composables/useMessages.d.ts +0 -89
  115. package/dist/vue/index.d.ts +0 -11
  116. package/dist/vue/plugin.d.ts +0 -16
  117. package/dist/vue/symbols.d.ts +0 -3
  118. package/dist/vue.cjs.map +0 -1
  119. package/dist/vue.js.map +0 -1
  120. package/dist/widget/index.d.ts +0 -1
  121. package/dist/widget/types.d.ts +0 -43
package/dist/widget.d.ts CHANGED
@@ -1,2 +1,577 @@
1
- export * from './widget/index'
2
- export {}
1
+ /**
2
+ * Agent information
3
+ */
4
+ declare interface AgoAgent {
5
+ id: string;
6
+ name: string;
7
+ displayName?: string;
8
+ }
9
+
10
+ /**
11
+ * Main SDK client for AGO Chat integration
12
+ */
13
+ declare class AgoClient {
14
+ private httpClient;
15
+ private functionRegistry;
16
+ private contextRegistry;
17
+ private eventEmitter;
18
+ private config;
19
+ constructor(config: AgoConfig);
20
+ /**
21
+ * Send a message and receive a streaming response
22
+ */
23
+ sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
24
+ private processSSEResponse;
25
+ private handleClientFunctionInvocation;
26
+ /**
27
+ * Get list of conversations
28
+ */
29
+ getConversations(): Promise<Conversation[]>;
30
+ /**
31
+ * Get a specific conversation with messages
32
+ */
33
+ getConversation(conversationId: string): Promise<Conversation>;
34
+ /**
35
+ * Get messages for a conversation
36
+ */
37
+ getMessages(conversationId: string): Promise<AgoMessage[]>;
38
+ /**
39
+ * Submit form data for a tool call
40
+ */
41
+ submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<void>;
42
+ /**
43
+ * Confirm a tool call
44
+ */
45
+ confirmToolCall(toolCallId: string): Promise<void>;
46
+ /**
47
+ * Reject a tool call
48
+ */
49
+ rejectToolCall(toolCallId: string): Promise<void>;
50
+ /**
51
+ * Relay a completed form collector's values to a server-configured destination.
52
+ *
53
+ * Used by `createFormCollector` / `useFormCollector` in `{ via: "backend" }` mode:
54
+ * the browser never holds the destination URL or its secret — the backend resolves
55
+ * `destination` (a named, opted-in tool) and forwards the values from the server.
56
+ */
57
+ submitFormCollector(destination: string, values: Record<string, unknown>): Promise<unknown>;
58
+ /**
59
+ * Submit feedback for a message
60
+ */
61
+ submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
62
+ /**
63
+ * Register a client-side function that AGO can call.
64
+ * Accepts either a definition object or (name, handler, schema) args.
65
+ *
66
+ * ```ts
67
+ * // Single-object (preferred)
68
+ * client.registerFunction({
69
+ * name: "lookupOrder",
70
+ * description: "Look up an order",
71
+ * parameters: { type: "object", properties: { id: { type: "string" } } },
72
+ * handler: async (args) => fetchOrder(args.id),
73
+ * });
74
+ *
75
+ * // Classic 3-arg form
76
+ * client.registerFunction("lookupOrder", handler, schema);
77
+ * ```
78
+ */
79
+ registerFunction(definition: ClientFunctionDefinition): void;
80
+ registerFunction(name: string, handler: ClientFunctionHandler, schema: Omit<ClientFunctionSchema, "name">): void;
81
+ /**
82
+ * Short alias for `registerFunction`. Also accepts an array of definitions.
83
+ *
84
+ * ```ts
85
+ * client.register(lookupOrder);
86
+ * client.register([lookupOrder, cancelOrder]);
87
+ * ```
88
+ */
89
+ register(definition: ClientFunctionDefinition | ClientFunctionDefinition[]): void;
90
+ /**
91
+ * Unregister a client-side function
92
+ */
93
+ unregisterFunction(name: string): boolean;
94
+ /**
95
+ * Get all registered function schemas
96
+ */
97
+ getRegisteredFunctions(): ClientFunctionSchema[];
98
+ /**
99
+ * Register a navigation function that lets AGO navigate users to different pages.
100
+ * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
101
+ * @param routes - Map of route names to paths, with descriptions for the LLM
102
+ */
103
+ registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
104
+ name: string;
105
+ path: string;
106
+ description: string;
107
+ }>): void;
108
+ /**
109
+ * Register or update a piece of client-side context.
110
+ * This context is sent with every message so the AI understands the user's situation.
111
+ *
112
+ * ```ts
113
+ * client.setContext("order-page", {
114
+ * name: "Order detail",
115
+ * description: "User is viewing order #123",
116
+ * data: { orderId: "123", status: "shipped" },
117
+ * });
118
+ * ```
119
+ */
120
+ setContext(key: string, entry: ContextEntry): void;
121
+ /**
122
+ * Remove a previously registered context entry.
123
+ */
124
+ removeContext(key: string): boolean;
125
+ /**
126
+ * Register a dynamic context provider. The callback is invoked every time
127
+ * a message is sent, so the AI always gets the freshest data.
128
+ *
129
+ * Use this for context that lives outside React state — global stores,
130
+ * refs, or computed values.
131
+ *
132
+ * ```ts
133
+ * client.addDynamicContext("cart", () => ({
134
+ * name: "Checkout",
135
+ * data: { itemCount: cart.items.length, total: cart.total },
136
+ * }));
137
+ * ```
138
+ */
139
+ addDynamicContext(key: string, provider: DynamicContextProvider): void;
140
+ /**
141
+ * Remove a dynamic context provider.
142
+ */
143
+ removeDynamicContext(key: string): boolean;
144
+ /**
145
+ * Enable automatic capture of the current browser page (URL + title).
146
+ * Injected as a dynamic context entry named `browser-page`.
147
+ */
148
+ enableAutoPageContext(): void;
149
+ /**
150
+ * Get the current context snapshot.
151
+ */
152
+ getContextSnapshot(): ContextSnapshot | null;
153
+ /**
154
+ * Subscribe to an event
155
+ */
156
+ on<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
157
+ /**
158
+ * Unsubscribe from an event
159
+ */
160
+ off<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
161
+ /**
162
+ * Subscribe to an event once — auto-unsubscribes after the first call.
163
+ */
164
+ once<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
165
+ /**
166
+ * Returns a Promise that resolves the next time `event` fires.
167
+ *
168
+ * ```ts
169
+ * const msg = await client.waitFor("message:complete", { timeout: 10000 });
170
+ * ```
171
+ */
172
+ waitFor<K extends AgoEventName>(event: K, options?: {
173
+ timeout?: number;
174
+ }): Promise<AgoClientEvents[K]>;
175
+ /**
176
+ * Update client configuration
177
+ */
178
+ updateConfig(config: Partial<AgoConfig>): void;
179
+ /**
180
+ * Clean up resources
181
+ */
182
+ destroy(): void;
183
+ }
184
+
185
+ /**
186
+ * SDK Events
187
+ */
188
+ declare interface AgoClientEvents {
189
+ "message:start": {
190
+ conversationId: string;
191
+ messageId: string;
192
+ };
193
+ "message:chunk": {
194
+ content: string;
195
+ conversationId: string;
196
+ messageId: string;
197
+ };
198
+ "message:complete": AgoMessage;
199
+ "message:error": {
200
+ error: string;
201
+ conversationId?: string;
202
+ messageId?: string;
203
+ };
204
+ "toolCall:received": ToolCallData;
205
+ "toolCall:form": ToolCallData;
206
+ "function:invoke": ClientFunctionInvocation;
207
+ "function:result": {
208
+ invocationId: string;
209
+ result: unknown;
210
+ error?: string;
211
+ };
212
+ "connection:status": {
213
+ connected: boolean;
214
+ };
215
+ }
216
+
217
+ /**
218
+ * SDK Configuration
219
+ */
220
+ declare interface AgoConfig {
221
+ /** API base URL (e.g., https://YOUR-DOMAIN.useago.com) */
222
+ baseUrl: string;
223
+ /** Widget ID (X-Widget-Id header). Auto-generated if not provided. */
224
+ widgetId?: string;
225
+ /** Default agent (id or slug) for new conversations. Shorthand for `defaultAgentId`. */
226
+ agent?: string;
227
+ /** Default agent ID for new conversations. Prefer `agent`. */
228
+ defaultAgentId?: string;
229
+ /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
230
+ permission?: string;
231
+ /** User email for identification */
232
+ userEmail?: string;
233
+ /** JWT token for authenticated users */
234
+ userJwt?: string;
235
+ /** Enable debug logging */
236
+ debug?: boolean;
237
+ }
238
+
239
+ declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
240
+
241
+ declare type AgoEventName = keyof AgoClientEvents;
242
+
243
+ /**
244
+ * Message from AGO
245
+ */
246
+ declare interface AgoMessage {
247
+ id: string;
248
+ conversationId: string;
249
+ content: string;
250
+ role: "user" | "assistant";
251
+ status: MessageStatus;
252
+ agent?: AgoAgent;
253
+ sources?: AgoSource[];
254
+ toolCalls?: ToolCallData[];
255
+ followUpReplies?: string[];
256
+ createdAt: Date;
257
+ }
258
+
259
+ /**
260
+ * Knowledge source citation
261
+ */
262
+ declare interface AgoSource {
263
+ id: string;
264
+ title: string;
265
+ url?: string;
266
+ }
267
+
268
+ /**
269
+ * Widget configuration types.
270
+ *
271
+ * These types describe the `window.AGO` configuration object
272
+ * used by the embeddable chat widget snippet.
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * import type { AgoWidgetConfig } from "@useago/sdk/widget";
277
+ * ```
278
+ */
279
+ export declare interface AgoWidgetColors {
280
+ button?: string;
281
+ header?: string;
282
+ agentMessage?: string;
283
+ agentMessageFont?: string;
284
+ background?: string;
285
+ font?: string;
286
+ userMessage?: string;
287
+ userMessageFont?: string;
288
+ }
289
+
290
+ export declare interface AgoWidgetConfig {
291
+ basepath: string;
292
+ widgetApiKey: string;
293
+ defaultAgent?: string;
294
+ email?: string;
295
+ title?: string;
296
+ icon?: string;
297
+ prompt?: string;
298
+ notifications?: boolean;
299
+ notificationMessage?: string;
300
+ colors?: AgoWidgetColors;
301
+ hideFooter?: boolean;
302
+ jwt?: string;
303
+ authToken?: string;
304
+ permission?: string;
305
+ metadata?: Record<string, unknown>;
306
+ }
307
+
308
+ /** Handle returned by {@link mountChatWidget}. */
309
+ export declare interface ChatWidgetHandle {
310
+ /** The AGO client backing the widget. */
311
+ client: AgoClient;
312
+ /** The root element the widget rendered into. */
313
+ element: HTMLElement;
314
+ /** Programmatically send a message (same path as the input). */
315
+ sendMessage: (content: string, files?: File[]) => Promise<void>;
316
+ /** Remove listeners, uninstall forms, and clear the DOM. */
317
+ destroy: () => void;
318
+ }
319
+
320
+ /**
321
+ * Single-object function definition — combines name, schema, and handler.
322
+ *
323
+ * ```ts
324
+ * const fn = defineFunction({
325
+ * name: "lookupOrder",
326
+ * description: "Look up an order by ID",
327
+ * parameters: { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
328
+ * handler: async (args) => fetchOrder(args.id as string),
329
+ * });
330
+ * client.registerFunction(fn);
331
+ * ```
332
+ */
333
+ declare interface ClientFunctionDefinition {
334
+ name: string;
335
+ description: string;
336
+ parameters: ClientFunctionSchema["parameters"];
337
+ handler: ClientFunctionHandler;
338
+ }
339
+
340
+ /**
341
+ * Function handler type
342
+ */
343
+ declare type ClientFunctionHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
344
+
345
+ declare interface ClientFunctionInvocation {
346
+ invocationId: string;
347
+ functionName: string;
348
+ arguments: Record<string, unknown>;
349
+ conversationId: string;
350
+ }
351
+
352
+ /**
353
+ * Schema for a client-side function that AGO can call
354
+ */
355
+ declare interface ClientFunctionSchema {
356
+ /** Function name (must be unique) */
357
+ name: string;
358
+ /** Description for the LLM to understand when to call this function */
359
+ description: string;
360
+ /** JSON Schema for function parameters */
361
+ parameters: {
362
+ type: "object";
363
+ properties: Record<string, {
364
+ type: string;
365
+ description?: string;
366
+ enum?: string[];
367
+ default?: unknown;
368
+ }>;
369
+ required?: string[];
370
+ };
371
+ }
372
+
373
+ /**
374
+ * A single piece of context the client wants the LLM to know about.
375
+ */
376
+ declare interface ContextEntry {
377
+ /** Human-readable label (e.g. "Order detail", "Current user") */
378
+ name?: string;
379
+ /** Short description of what this context represents */
380
+ description?: string;
381
+ /** Arbitrary structured data the AI should know about */
382
+ data?: Record<string, unknown>;
383
+ }
384
+
385
+ /**
386
+ * Serialised client context sent with each message.
387
+ */
388
+ declare interface ContextSnapshot {
389
+ /** All active context entries keyed by their registration key */
390
+ entries: Record<string, ContextEntry>;
391
+ }
392
+
393
+ /**
394
+ * Conversation/Thread
395
+ */
396
+ declare interface Conversation {
397
+ id: string;
398
+ title: string;
399
+ lastMessageDate: Date;
400
+ messages?: AgoMessage[];
401
+ }
402
+
403
+ export declare interface CreateFormCollectorOptions<V = Record<string, unknown>> {
404
+ /** Short identifier; becomes the `update_<name>` / `submit_<name>` function names. */
405
+ name: string;
406
+ /** What the form is, for the LLM. */
407
+ description: string;
408
+ /** The single source of truth for the form's fields. */
409
+ schema: FormCollectorSchema;
410
+ /** How the completed form is submitted. Default: `false` (collect only). */
411
+ submit?: SubmitConfig<V>;
412
+ /** Pre-filled values. */
413
+ initialValues?: Partial<V>;
414
+ }
415
+
416
+ /**
417
+ * A function that returns a fresh context entry on demand.
418
+ * Evaluated every time a message is sent — use it to pull data from stores,
419
+ * refs, or any source that isn't captured by React state.
420
+ */
421
+ declare type DynamicContextProvider = () => ContextEntry | null | undefined;
422
+
423
+ /**
424
+ * JSON-schema shape of a form's fields — identical to a client function's
425
+ * `parameters`, so one schema feeds the store, the update function, and the
426
+ * dynamic context with no second type.
427
+ */
428
+ declare type FormCollectorSchema = ClientFunctionSchema["parameters"];
429
+
430
+ declare interface FormField {
431
+ type: "string" | "number" | "boolean" | "array";
432
+ title?: string;
433
+ description?: string;
434
+ enum?: string[];
435
+ default?: unknown;
436
+ }
437
+
438
+ /**
439
+ * Form schema for tool calls requiring user input
440
+ */
441
+ declare interface FormSchema {
442
+ type: "object";
443
+ properties: Record<string, FormField>;
444
+ required?: string[];
445
+ }
446
+
447
+ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
448
+
449
+ /**
450
+ * Mount a complete, dependency-free chat widget into any DOM element — no React,
451
+ * Vue, or Angular required. Mirrors the React `<ChatWidget>`: it streams replies,
452
+ * renders clickable suggested replies, and installs conversational form collectors.
453
+ *
454
+ * Message content is rendered as plain text (no markdown) to stay dependency-free;
455
+ * use the React `<Message>` component if you need GitHub-flavored markdown.
456
+ *
457
+ * ```ts
458
+ * import { mountChatWidget } from "@useago/sdk/widget";
459
+ *
460
+ * const widget = mountChatWidget("#chat", {
461
+ * config: { baseUrl: "https://YOUR-DOMAIN.useago.com" },
462
+ * title: "Book a demo",
463
+ * forms: [{
464
+ * name: "demo_request",
465
+ * description: "A request to book a product demo.",
466
+ * schema: {
467
+ * type: "object",
468
+ * properties: { name: { type: "string" }, email: { type: "string" } },
469
+ * required: ["name", "email"],
470
+ * },
471
+ * submit: { via: "backend", destination: "demo_webhook" },
472
+ * }],
473
+ * });
474
+ * // later: widget.destroy();
475
+ * ```
476
+ */
477
+ export declare function mountChatWidget(target: string | HTMLElement, options: MountChatWidgetOptions): ChatWidgetHandle;
478
+
479
+ /**
480
+ * Options for {@link mountChatWidget} — the framework-agnostic (pure TS/JS)
481
+ * equivalent of the React `<ChatWidget>` component. Same features: conversational
482
+ * forms (form creator) and clickable suggested replies.
483
+ */
484
+ export declare interface MountChatWidgetOptions {
485
+ /** An existing AGO client. Provide this OR `config`. */
486
+ client?: AgoClient;
487
+ /** Config to build a client when `client` is not supplied. `baseUrl` is required. */
488
+ config?: AgoConfig;
489
+ /** Initial conversation ID to continue. */
490
+ conversationId?: string;
491
+ /** Widget title shown in the header. */
492
+ title?: string;
493
+ /** Message shown before any conversation has started. */
494
+ welcomeMessage?: string;
495
+ /** Input placeholder. */
496
+ placeholder?: string;
497
+ /** Enable file attachments. */
498
+ allowFiles?: boolean;
499
+ /** Widget height (number → px). */
500
+ height?: string | number;
501
+ /** URL of a logo shown in the header. */
502
+ logoUrl?: string;
503
+ /** Show the agent name above assistant messages. Defaults to `false`. */
504
+ showAgentName?: boolean;
505
+ /**
506
+ * Conversational forms the agent can fill and submit during the chat. Each
507
+ * config is installed as a {@link createFormCollector} for the lifetime of the
508
+ * widget (removed on `destroy()`).
509
+ */
510
+ forms?: CreateFormCollectorOptions[];
511
+ /**
512
+ * How clicking a suggested follow-up reply behaves. Defaults to sending the
513
+ * reply as a new user message. Pass a handler to override, or `false` to
514
+ * render the suggestions as non-interactive.
515
+ */
516
+ onFollowUpClick?: ((reply: string) => void) | false;
517
+ /** Called when the user sends a message. */
518
+ onMessageSent?: (content: string) => void;
519
+ /** Called when an assistant message completes. */
520
+ onMessageReceived?: (message: {
521
+ id: string;
522
+ content: string;
523
+ }) => void;
524
+ }
525
+
526
+ /**
527
+ * Options for sending a message
528
+ */
529
+ declare interface SendMessageOptions {
530
+ /** Existing conversation ID */
531
+ conversationId?: string;
532
+ /** Override default agent */
533
+ agentId?: string;
534
+ /** File attachments */
535
+ files?: File[];
536
+ }
537
+
538
+ /**
539
+ * Where a completed form is sent.
540
+ * - `"https://..."` (a bare string) — shorthand for `{ via: "client", url }`: the browser
541
+ * POSTs the values to that URL.
542
+ * - `{ via: "client", url }` — same, written out.
543
+ * - `{ via: "client", handler }` — the browser runs your own submit logic.
544
+ * - `{ via: "backend", destination }` — the browser relays the values to the backend,
545
+ * which forwards them to the server-configured destination (URL + secret stay server-side).
546
+ * - `false` — collect only, no submit function.
547
+ */
548
+ declare type SubmitConfig<V = Record<string, unknown>> = string | {
549
+ via: "client";
550
+ url: string;
551
+ } | {
552
+ via: "client";
553
+ handler: (values: V) => Promise<unknown> | unknown;
554
+ } | {
555
+ via: "backend";
556
+ destination: string;
557
+ } | false;
558
+
559
+ /**
560
+ * Tool call data from SSE stream
561
+ */
562
+ declare interface ToolCallData {
563
+ id: string;
564
+ type: ToolCallType;
565
+ status: string;
566
+ toolName: string;
567
+ toolDisplayName?: string;
568
+ message?: string;
569
+ formSchema?: FormSchema;
570
+ data?: Record<string, unknown>;
571
+ functionName?: string;
572
+ arguments?: Record<string, unknown>;
573
+ }
574
+
575
+ declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
576
+
577
+ export { }