@useago/sdk 1.9.0 → 1.13.0

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 (49) hide show
  1. package/CHANGELOG.md +173 -2
  2. package/README.md +126 -0
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +408 -26
  5. package/dist/angular.d.ts +408 -26
  6. package/dist/angular.js +4 -1
  7. package/dist/{createConversationSession-BaaXBQ5b.js → createConversationSession-BfJg0WyA.js} +1 -1
  8. package/dist/{createConversationSession-CU0b-t1W.cjs → createConversationSession-CiOXKWl0.cjs} +1 -1
  9. package/dist/{createFormCollector-Cf7kGhCB.js → createFormCollector-DN1xjAv5.js} +1 -1
  10. package/dist/{createFormCollector-DfN1xZBy.cjs → createFormCollector-DnQl77Ko.cjs} +1 -1
  11. package/dist/createMockClient-BPt1gSve.cjs +1 -0
  12. package/dist/{createMockClient-5YF-ZbVu.js → createMockClient-YoYr3pQr.js} +16 -3
  13. package/dist/devtools.cjs +4 -4
  14. package/dist/devtools.d.cts +406 -26
  15. package/dist/devtools.d.ts +406 -26
  16. package/dist/devtools.js +87 -84
  17. package/dist/helpers.d.cts +42 -12
  18. package/dist/helpers.d.ts +42 -12
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +486 -35
  21. package/dist/index.d.ts +486 -35
  22. package/dist/index.js +117 -112
  23. package/dist/react.cjs +4 -4
  24. package/dist/react.d.cts +458 -26
  25. package/dist/react.d.ts +458 -26
  26. package/dist/react.js +816 -727
  27. package/dist/speechToText-BV7qxqPF.js +704 -0
  28. package/dist/speechToText-ZciRyyJE.cjs +1 -0
  29. package/dist/testing.cjs +1 -1
  30. package/dist/testing.d.cts +406 -26
  31. package/dist/testing.d.ts +406 -26
  32. package/dist/testing.js +1 -1
  33. package/dist/types-Q7t1peH-.js +2584 -0
  34. package/dist/types-a7teDBnC.cjs +10 -0
  35. package/dist/vue.cjs +1 -1
  36. package/dist/vue.d.cts +608 -26
  37. package/dist/vue.d.ts +608 -26
  38. package/dist/vue.js +103 -101
  39. package/dist/widget.cjs +6 -4
  40. package/dist/widget.d.cts +710 -28
  41. package/dist/widget.d.ts +710 -28
  42. package/dist/widget.js +3911 -976
  43. package/llms-full.txt +254 -7
  44. package/package.json +1 -1
  45. package/dist/createMockClient-BZbOe-23.cjs +0 -1
  46. package/dist/sheetController-CBUVOroo.js +0 -205
  47. package/dist/sheetController-DY-sC13T.cjs +0 -1
  48. package/dist/types-CPga11Of.js +0 -2068
  49. package/dist/types-D3YQl1jx.cjs +0 -9
package/dist/react.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { default as default_2 } from 'react';
2
2
  import { ForwardRefExoticComponent } from 'react';
3
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
3
4
  import { RefAttributes } from 'react';
4
5
 
5
6
  export declare interface ActivityEntry {
@@ -110,6 +111,7 @@ declare class AgoClient {
110
111
  private contextRegistry;
111
112
  private eventEmitter;
112
113
  private activityLedger;
114
+ private errorWatcher;
113
115
  private lastSentPageState;
114
116
  private config;
115
117
  /** Conversations already warned about an empty reply (one warning each). */
@@ -148,7 +150,10 @@ declare class AgoClient {
148
150
  * `null` otherwise.
149
151
  */
150
152
  proactive: ProactiveController | null;
153
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
154
+ private detachWebMCP;
151
155
  constructor(config: AgoConfig);
156
+ private attachWebMCPBridge;
152
157
  /**
153
158
  * Send a message and receive a streaming response
154
159
  */
@@ -260,6 +265,7 @@ declare class AgoClient {
260
265
  * (the agent decides what to do next). No-op if the invocation is unknown.
261
266
  */
262
267
  rejectFunction(invocationId: string): Promise<void>;
268
+ /* Excluded from this release type: runExternalFunction */
263
269
  /**
264
270
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
265
271
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -279,6 +285,35 @@ declare class AgoClient {
279
285
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
280
286
  */
281
287
  private static mapPersistedToolCalls;
288
+ /**
289
+ * Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
290
+ * Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
291
+ * MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
292
+ * The filename must include the matching extension. For a MediaRecorder blob,
293
+ * wrap it in a File with the recording's extension and MIME type.
294
+ * Show the returned text as a draft; call `sendMessage` when the user sends it.
295
+ */
296
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
297
+ /**
298
+ * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
299
+ * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
300
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
301
+ * once, when a ticket form first appears in a conversation.
302
+ */
303
+ getConfig(): Promise<SdkConfig>;
304
+ /**
305
+ * The dashboard's home screen content. A starter card shows its
306
+ * `description` and sends its `initial_message`; one with neither is
307
+ * unusable and is dropped rather than rendered as an empty card.
308
+ */
309
+ private static mapHomePage;
310
+ private static mapTicketForm;
311
+ /**
312
+ * Create a support ticket (`POST /api/sdk/v1/tickets`, multipart). This is
313
+ * what the ticket form in the conversation does before it completes the
314
+ * `form` tool call with {@link submitToolCallForm}.
315
+ */
316
+ createTicket(input: CreateTicketInput): Promise<CreateTicketResult>;
282
317
  /**
283
318
  * Get messages for a conversation
284
319
  */
@@ -400,6 +435,9 @@ declare class AgoClient {
400
435
  * Get all registered function schemas
401
436
  */
402
437
  getRegisteredFunctions(): ClientFunctionSchema[];
438
+ /** The callback form of `functions:changed`. Returns an unsubscribe. */
439
+ onFunctionsChanged(listener: () => void): () => void;
440
+ /* Excluded from this release type: getFunctionRegistrations */
403
441
  /**
404
442
  * Execute a registered client function locally, through the same
405
443
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -537,6 +575,15 @@ declare class AgoClient {
537
575
  /* Excluded from this release type: emitProactiveEvent */
538
576
  /* Excluded from this release type: getHttp */
539
577
  /* Excluded from this release type: getConfiguredAgent */
578
+ /**
579
+ * How the SDK identifies the visitor: the configured `userEmail`, and
580
+ * whether a `userJwt` is set. The ticket form asks for an email when it has
581
+ * neither.
582
+ */
583
+ getUserIdentity(): {
584
+ email?: string;
585
+ hasJwt: boolean;
586
+ };
540
587
  /**
541
588
  * Enable automatic capture of the current browser page (URL + title).
542
589
  * Injected as a dynamic context entry named `browser-page`.
@@ -559,6 +606,26 @@ declare class AgoClient {
559
606
  private addActivity;
560
607
  private recordAgentAction;
561
608
  private registerActivityContext;
609
+ /**
610
+ * Start capturing the page's JavaScript errors (uncaught exceptions,
611
+ * unhandled rejections, `console.error` calls, {@link reportError}) and send
612
+ * the recent ones as the `errors:recent` context entry on every message.
613
+ * Same as setting `errorWatcher` in the config. Calling it again replaces
614
+ * the watcher (and its options); the captured errors are not kept.
615
+ */
616
+ enableErrorWatcher(options?: ErrorWatcherOptions): void;
617
+ /** Stop capturing errors and drop the `errors:recent` context entry. */
618
+ disableErrorWatcher(): void;
619
+ /**
620
+ * Record an error the app caught itself (React error boundary, Vue
621
+ * `errorHandler`, Angular `ErrorHandler`, a try/catch) so the agent sees it
622
+ * like an uncaught one. No-op unless the error watcher is enabled. `context`
623
+ * is size-clamped before it is stored; keep it small and free of secrets.
624
+ */
625
+ reportError(error: unknown, context?: Record<string, unknown>): void;
626
+ /** Errors the watcher currently holds, oldest first (a copy). Empty when disabled. */
627
+ getRecentErrors(): CapturedError[];
628
+ clearErrors(): void;
562
629
  /**
563
630
  * Subscribe to an event
564
631
  */
@@ -703,6 +770,8 @@ declare interface AgoClientEvents {
703
770
  * call running immediately.
704
771
  */
705
772
  "function:awaiting-approval": ClientFunctionInvocation;
773
+ /** A function was registered or unregistered, or the registry cleared. */
774
+ "functions:changed": ClientFunctionSchema[];
706
775
  "function:result": {
707
776
  invocationId: string;
708
777
  result: unknown;
@@ -753,6 +822,12 @@ declare interface AgoClientEvents {
753
822
  };
754
823
  /** A user- or agent-action was recorded into the activity ledger. */
755
824
  "activity:recorded": ActivityEntry;
825
+ /**
826
+ * The error watcher captured a JavaScript error (uncaught exception,
827
+ * unhandled rejection, `console.error` call, or `reportError`). Fires on
828
+ * repeats too, with the updated `count`. Requires `errorWatcher` in the config.
829
+ */
830
+ "error:captured": CapturedError;
756
831
  }
757
832
 
758
833
  /**
@@ -769,10 +844,14 @@ export declare interface AgoConfig {
769
844
  defaultAgentId?: string;
770
845
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
771
846
  permission?: string;
847
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
848
+ language?: string | null;
772
849
  /** User email for identification */
773
850
  userEmail?: string;
774
851
  /** JWT token for authenticated users */
775
852
  userJwt?: string;
853
+ /** User metadata sent with messages. Use null to stop sending defaults. Not an authentication credential. */
854
+ metadata?: Record<string, unknown> | null;
776
855
  /** Enable debug logging */
777
856
  debug?: boolean;
778
857
  /**
@@ -832,6 +911,27 @@ export declare interface AgoConfig {
832
911
  * default otherwise.
833
912
  */
834
913
  proactive?: ProactiveOptions;
914
+ /**
915
+ * Capture the page's JavaScript errors as agent context. When set, the SDK
916
+ * listens for uncaught exceptions and unhandled promise rejections, wraps
917
+ * `console.error` (calling through; restored on `destroy`), and sends the
918
+ * recent errors (deduplicated, capped, pruned after 10 min) as the
919
+ * `errors:recent` context entry on every message. `true` uses the defaults;
920
+ * pass {@link ErrorWatcherOptions} to tune the caps or add a `filter` that
921
+ * redacts messages. Off by default: error messages can carry PII or internal
922
+ * URLs, so enabling it is the host's call. Errors also feed the proactive
923
+ * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
924
+ */
925
+ errorWatcher?: boolean | ErrorWatcherOptions;
926
+ /** Mirror every registered client function into the browser's WebMCP registry
927
+ * (`document.modelContext`), so an external agent can call the same functions
928
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
929
+ *
930
+ * A mirrored function runs immediately: the approval gate
931
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
932
+ * Use `webmcp: false` on a definition to keep it out.
933
+ */
934
+ webmcp?: boolean;
835
935
  }
836
936
 
837
937
  /**
@@ -1100,6 +1200,37 @@ declare type AgoStateSetResult = {
1100
1200
  result: "unchanged";
1101
1201
  };
1102
1202
 
1203
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1204
+ declare interface AudioTranscription {
1205
+ text: string;
1206
+ }
1207
+
1208
+ /** One JavaScript error captured on the page (deduplicated, see `count`). */
1209
+ declare interface CapturedError {
1210
+ type: CapturedErrorType;
1211
+ /** Error message, truncated to 500 chars. */
1212
+ message: string;
1213
+ /** Script URL the error came from, without its query string. */
1214
+ source?: string;
1215
+ line?: number;
1216
+ col?: number;
1217
+ /** Leading stack frames, truncated (see `maxStackChars`). */
1218
+ stack?: string;
1219
+ /** Pathname at capture time. */
1220
+ route: string;
1221
+ /** Epoch ms of the first occurrence. */
1222
+ firstAt: number;
1223
+ /** Epoch ms of the most recent occurrence. */
1224
+ lastAt: number;
1225
+ /** How many times this same error (type + message + source + line) fired. */
1226
+ count: number;
1227
+ /** App-provided context, manual reports only (size-clamped). */
1228
+ context?: Record<string, unknown>;
1229
+ }
1230
+
1231
+ /** How an error reached the watcher. */
1232
+ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
1233
+
1103
1234
  /**
1104
1235
  * Chat input component with send button
1105
1236
  */
@@ -1121,6 +1252,12 @@ export declare interface ChatInputProps {
1121
1252
  disabled?: boolean;
1122
1253
  placeholder?: string;
1123
1254
  allowFiles?: boolean;
1255
+ /** Microphone, live waveform and draft transcription. Uses the tenant flag. */
1256
+ speechToText?: boolean | SpeechToTextOptions;
1257
+ /** For dictation; otherwise uses AgoProvider's client. */
1258
+ client?: AgoClient;
1259
+ /** Cancels dictation when the conversation or page changes. */
1260
+ scopeKey?: string;
1124
1261
  className?: string;
1125
1262
  }
1126
1263
 
@@ -1159,6 +1296,8 @@ export declare interface ChatWidgetProps {
1159
1296
  placeholder?: string;
1160
1297
  /** Enable file attachments */
1161
1298
  allowFiles?: boolean;
1299
+ /** Microphone, live waveform and draft transcription. Checks the tenant flag. */
1300
+ speechToText?: boolean | SpeechToTextOptions;
1162
1301
  /**
1163
1302
  * While the agent is answering, turn the send button into a Stop button that
1164
1303
  * interrupts the turn. Defaults to `true`.
@@ -1256,22 +1395,11 @@ export declare interface ChatWidgetProps {
1256
1395
  * client.registerFunction(fn);
1257
1396
  * ```
1258
1397
  */
1259
- declare interface ClientFunctionDefinition {
1398
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1260
1399
  name: string;
1261
1400
  description: string;
1262
1401
  parameters: ClientFunctionSchema["parameters"];
1263
1402
  handler: ClientFunctionHandler;
1264
- /**
1265
- * Max serialized result size in bytes before the SDK truncates it to a
1266
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1267
- * `Infinity` disables the guard for this function.
1268
- */
1269
- maxResultBytes?: number;
1270
- /**
1271
- * Require explicit user approval before this function runs. See
1272
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1273
- */
1274
- requiresApproval?: boolean;
1275
1403
  }
1276
1404
 
1277
1405
  /**
@@ -1290,20 +1418,7 @@ declare interface ClientFunctionInvocation {
1290
1418
  * Schema-plus-settings object accepted when registering a function: the schema
1291
1419
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1292
1420
  */
1293
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1294
- /**
1295
- * Max serialized result size in bytes before the SDK truncates it to a
1296
- * flagged preview. Overrides the client-level default
1297
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1298
- * disables the guard for this function.
1299
- */
1300
- maxResultBytes?: number;
1301
- /**
1302
- * Require explicit user approval before this function runs. See
1303
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1304
- */
1305
- requiresApproval?: boolean;
1306
- };
1421
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1307
1422
 
1308
1423
  /**
1309
1424
  * Schema for a client-side function that AGO can call
@@ -1330,6 +1445,28 @@ declare interface ClientFunctionSchema {
1330
1445
  };
1331
1446
  }
1332
1447
 
1448
+ /** SDK-side function settings that are never sent to the backend. */
1449
+ declare interface ClientFunctionSettings {
1450
+ /**
1451
+ * Max serialized result size in bytes before the SDK truncates it to a
1452
+ * flagged preview. Overrides the client-level default
1453
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1454
+ * disables the guard for this function.
1455
+ */
1456
+ maxResultBytes?: number;
1457
+ /**
1458
+ * Require explicit user approval before this function runs. See
1459
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1460
+ */
1461
+ requiresApproval?: boolean;
1462
+ /**
1463
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1464
+ * `false` keeps this function out of WebMCP while leaving it available to the
1465
+ * in-app agent.
1466
+ */
1467
+ webmcp?: WebMCPToolMeta | false;
1468
+ }
1469
+
1333
1470
  /** See {@link AgoConfig.clientFunctionsMode}. */
1334
1471
  declare type ClientFunctionsMode = "placeholder" | "pause";
1335
1472
 
@@ -1434,8 +1571,34 @@ export declare interface CreateFormCollectorOptions<V = Record<string, unknown>>
1434
1571
  */
1435
1572
  export declare function createMockClient(options?: MockAgoClientOptions): MockAgoClient;
1436
1573
 
1574
+ /** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
1575
+ declare interface CreateTicketInput {
1576
+ subject: string;
1577
+ body: string;
1578
+ priority?: string;
1579
+ typology?: string;
1580
+ /** Conversation the ticket is filed from. */
1581
+ conversationId?: string;
1582
+ /** Reporter email, for a visitor the SDK does not otherwise identify. */
1583
+ email?: string;
1584
+ customFields?: Array<{
1585
+ id: string;
1586
+ value: string;
1587
+ }>;
1588
+ files?: File[];
1589
+ ticketFormId?: string;
1590
+ }
1591
+
1592
+ /** Response of `AgoClient.createTicket`. */
1593
+ declare interface CreateTicketResult {
1594
+ id: string;
1595
+ url?: string;
1596
+ }
1597
+
1437
1598
  export declare const DEFAULT_MESSAGE_FEEDBACK_LABELS: MessageFeedbackLabels;
1438
1599
 
1600
+ export declare const DEFAULT_SPEECH_TO_TEXT_LABELS: SpeechToTextLabels;
1601
+
1439
1602
  /**
1440
1603
  * Compute which required fields are still empty and whether the form is complete.
1441
1604
  * Pure — the single home for the "required + non-empty" rule, shared by the update
@@ -1463,6 +1626,23 @@ declare interface ElementProps {
1463
1626
  attrs: Record<string, string | null>;
1464
1627
  }
1465
1628
 
1629
+ declare interface ErrorWatcherOptions {
1630
+ /** Max distinct errors kept. Oldest dropped first. Default 10. */
1631
+ maxErrors?: number;
1632
+ /**
1633
+ * Errors older than this are pruned when the buffer is read, so a crash from
1634
+ * an hour ago does not confuse the agent. Default 600 000 (10 min).
1635
+ */
1636
+ maxAgeMs?: number;
1637
+ /** Max chars of stack kept per error. Default 2000. */
1638
+ maxStackChars?: number;
1639
+ /**
1640
+ * Redact or drop an error before it is stored. Return the (possibly edited)
1641
+ * error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
1642
+ */
1643
+ filter?: (error: CapturedError) => CapturedError | null;
1644
+ }
1645
+
1466
1646
  /** The four values of {@link FeedbackReason}, in dashboard order. */
1467
1647
  export declare const FEEDBACK_REASONS: readonly FeedbackReason[];
1468
1648
 
@@ -2050,12 +2230,26 @@ declare interface ProactiveTriggerWhen {
2050
2230
  pageState?: Partial<Record<string, unknown>>;
2051
2231
  /** Min rage-click bursts on the current route. */
2052
2232
  rageClicks?: number;
2233
+ /**
2234
+ * Min JavaScript errors captured on the current route. Needs the client's
2235
+ * `errorWatcher` enabled; without it the count stays at 0 and the matcher
2236
+ * never passes.
2237
+ */
2238
+ jsErrors?: number;
2053
2239
  /** Min A→B→A→B route oscillations this session. */
2054
2240
  routeBounces?: number;
2055
2241
  /** Per-field minimum error counts (field NAME → min count). */
2056
2242
  fieldErrors?: Record<string, number>;
2057
2243
  }
2058
2244
 
2245
+ /**
2246
+ * Registered function with handler
2247
+ */
2248
+ declare interface RegisteredFunction extends ClientFunctionSettings {
2249
+ schema: ClientFunctionSchema;
2250
+ handler: ClientFunctionHandler;
2251
+ }
2252
+
2059
2253
  /**
2060
2254
  * Hook run before a paused turn is resumed, so the app controls WHEN the
2061
2255
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -2067,10 +2261,71 @@ declare type ResumeGate = (info: {
2067
2261
  messageId: string;
2068
2262
  }) => Promise<void> | void;
2069
2263
 
2264
+ /** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
2265
+ declare interface SdkConfig {
2266
+ permissions: SdkPermissionConfig[];
2267
+ proactive: {
2268
+ enabled: boolean;
2269
+ };
2270
+ }
2271
+
2272
+ /** The dashboard's home screen content (title, subtitle, starter cards). */
2273
+ declare interface SdkHomePageConfig {
2274
+ title?: string;
2275
+ /** Markdown. */
2276
+ subtitle?: string;
2277
+ starters: SdkHomeStarter[];
2278
+ widgetStarter?: SdkWidgetStarter;
2279
+ }
2280
+
2281
+ /**
2282
+ * A conversation starter card configured in the AGO dashboard. `label` is what
2283
+ * the card shows; clicking it sends `message`.
2284
+ */
2285
+ declare interface SdkHomeStarter {
2286
+ id: string;
2287
+ /** The card's text (the starter's `description` in the dashboard). */
2288
+ label: string;
2289
+ /** What is sent when the card is clicked. */
2290
+ message: string;
2291
+ /** Answer with this agent instead of the configured default. */
2292
+ agentId?: string;
2293
+ }
2294
+
2295
+ /** One permission's configuration in {@link SdkConfig}. */
2296
+ declare interface SdkPermissionConfig {
2297
+ id?: string;
2298
+ name?: string;
2299
+ displayName?: string;
2300
+ agents: Array<{
2301
+ id: string;
2302
+ name?: string;
2303
+ }>;
2304
+ ticketForm?: TicketForm;
2305
+ /** Home screen content, when the tenant configured one. */
2306
+ homePage?: SdkHomePageConfig;
2307
+ fileAttachmentsEnabled: boolean;
2308
+ voiceEnabled: boolean;
2309
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
2310
+ speechToTextEnabled: boolean;
2311
+ }
2312
+
2313
+ /**
2314
+ * The starter the dashboard sends by itself on a fresh visit, before the
2315
+ * visitor types anything.
2316
+ */
2317
+ declare interface SdkWidgetStarter {
2318
+ id: string;
2319
+ message: string;
2320
+ agentId?: string;
2321
+ }
2322
+
2070
2323
  /**
2071
2324
  * Options for sending a message
2072
2325
  */
2073
2326
  declare interface SendMessageOptions {
2327
+ /** Replaces config.metadata for this message; null omits metadata for this message. */
2328
+ metadata?: Record<string, unknown> | null;
2074
2329
  /** Existing conversation ID */
2075
2330
  conversationId?: string;
2076
2331
  /** Override default agent */
@@ -2186,6 +2441,12 @@ declare interface SignalsSnapshot {
2186
2441
  idleMs: number;
2187
2442
  /** Rage-click bursts detected on the current route. */
2188
2443
  rageClicks: number;
2444
+ /**
2445
+ * JavaScript errors captured on the current route (count only; the messages
2446
+ * travel in `client_context` under `errors:recent`). Always `0` unless the
2447
+ * client has `errorWatcher` enabled.
2448
+ */
2449
+ jsErrors: number;
2189
2450
  /**
2190
2451
  * A→B→A→B route oscillations detected in the recent route sequence. Rolling
2191
2452
  * session counter (cross-route by nature); trigger cooldowns and dismissal
@@ -2203,6 +2464,42 @@ declare interface SignalsSnapshot {
2203
2464
  pageState: Record<string, unknown> | null;
2204
2465
  }
2205
2466
 
2467
+ /** Ready-made microphone, live waveform, cancel/confirm controls and transcription. */
2468
+ export declare function SpeechToTextButton(props: SpeechToTextButtonProps): JSX_2.Element;
2469
+
2470
+ export declare interface SpeechToTextButtonProps {
2471
+ /** Uses AgoProvider's client when omitted. */
2472
+ client?: AgoClient;
2473
+ onTranscript: (text: string) => void;
2474
+ /** Use this to hide or disable your editor while dictation is active. */
2475
+ onBusyChange?: (busy: boolean) => void;
2476
+ disabled?: boolean;
2477
+ /** Cancels dictation when the conversation or page changes. */
2478
+ scopeKey?: string;
2479
+ labels?: Partial<SpeechToTextLabels>;
2480
+ className?: string;
2481
+ }
2482
+
2483
+ /** Strings used by the microphone control in every widget. */
2484
+ export declare interface SpeechToTextLabels {
2485
+ start: string;
2486
+ finish: string;
2487
+ cancel: string;
2488
+ requesting: string;
2489
+ recording: string;
2490
+ transcribing: string;
2491
+ limitApproaching: string;
2492
+ permissionDenied: string;
2493
+ recordingFailed: string;
2494
+ tooLarge: string;
2495
+ noSpeech: string;
2496
+ transcriptionFailed: string;
2497
+ }
2498
+
2499
+ export declare interface SpeechToTextOptions {
2500
+ labels?: Partial<SpeechToTextLabels>;
2501
+ }
2502
+
2206
2503
  /**
2207
2504
  * SSE stream chunk data
2208
2505
  */
@@ -2244,6 +2541,13 @@ declare interface SSEChunkData {
2244
2541
  follow_up_replies?: string[];
2245
2542
  satisfaction_feedback?: unknown;
2246
2543
  ask_to_talk_to_human?: boolean;
2544
+ allowed_to_create_ticket?: boolean;
2545
+ ticket?: ToolCallTicketPrefill;
2546
+ mode?: "form" | "embed";
2547
+ ticket_form_id?: string;
2548
+ embed_html?: string;
2549
+ embed_description?: string;
2550
+ display_mode?: "collapsible" | "display" | "both";
2247
2551
  /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
2248
2552
  waiting_tool_call_ids?: string[];
2249
2553
  }
@@ -2318,12 +2622,82 @@ export declare type SubmitConfig<V = Record<string, unknown>> = string | {
2318
2622
  declare interface SubmitToolCallResult {
2319
2623
  status: string;
2320
2624
  result?: unknown;
2625
+ /** Set when `status` is `"error"`. */
2626
+ error?: string;
2627
+ /** The ticket a ticketing `form` tool call resolved to, when it did. */
2628
+ ticket?: {
2629
+ ticket_id: string;
2630
+ ticket_url?: string;
2631
+ [key: string]: unknown;
2632
+ };
2321
2633
  resume?: {
2322
2634
  message_id: string;
2323
2635
  ready: boolean;
2324
2636
  };
2325
2637
  }
2326
2638
 
2639
+ /** A custom field of a ticket form. */
2640
+ declare interface TicketField {
2641
+ id: string;
2642
+ /** The key the ticketing backend expects; used as the submit key when set. */
2643
+ externalId?: string;
2644
+ title?: string;
2645
+ /** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
2646
+ type?: string;
2647
+ required: boolean;
2648
+ /** Carried in the submission but never shown. */
2649
+ hidden: boolean;
2650
+ active?: boolean;
2651
+ /** Bypass progressive disclosure, while still respecting conditions. */
2652
+ alwaysVisible?: boolean;
2653
+ regexpForValidation?: string;
2654
+ position: number;
2655
+ /** Non-empty turns the field into a select. */
2656
+ options: TicketFieldOption[];
2657
+ /** Show this field only when the parent field holds `conditionalFieldValue`. */
2658
+ conditionalFieldId?: string;
2659
+ /** Legacy comma-separated condition values. */
2660
+ conditionalFieldValue?: string;
2661
+ /** Takes precedence over conditionalFieldValue when non-empty. */
2662
+ conditionalFieldValues?: string[];
2663
+ }
2664
+
2665
+ /** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
2666
+ declare interface TicketFieldOption {
2667
+ id: string;
2668
+ /** Label shown to the user. */
2669
+ name?: string;
2670
+ /** Value submitted. Falls back to `name` when absent. */
2671
+ value?: string;
2672
+ /** Preselected when the form opens. */
2673
+ default: boolean;
2674
+ /** A note shown under the field once this option is picked. */
2675
+ message?: string;
2676
+ messageType: "info" | "warning" | "danger";
2677
+ position?: number;
2678
+ group?: string;
2679
+ noDisplay?: boolean;
2680
+ conditionalFieldId?: string;
2681
+ /** Available when the parent matches any of these values. */
2682
+ conditionalFieldValues?: string[];
2683
+ }
2684
+
2685
+ /** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
2686
+ declare interface TicketForm {
2687
+ id: string;
2688
+ name?: string;
2689
+ /** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
2690
+ mode: "form" | "embed";
2691
+ showSubject: boolean;
2692
+ showBody: boolean;
2693
+ showPriority: boolean;
2694
+ showTypology: boolean;
2695
+ priorityTypologies?: string[];
2696
+ successMessageText?: string;
2697
+ successMessageUrlLabel?: string;
2698
+ fields: TicketField[];
2699
+ }
2700
+
2327
2701
  /**
2328
2702
  * Tool call data from SSE stream
2329
2703
  */
@@ -2338,10 +2712,44 @@ export declare interface ToolCallData {
2338
2712
  data?: Record<string, unknown>;
2339
2713
  functionName?: string;
2340
2714
  arguments?: Record<string, unknown>;
2715
+ /**
2716
+ * Where the hosted widget shows the call: in the collapsible "reasoning"
2717
+ * section, in the message body, or both. Absent means collapsible only.
2718
+ */
2719
+ displayMode?: "collapsible" | "display" | "both";
2720
+ /** The user asked to talk to a human. */
2721
+ askToTalkToHuman?: boolean;
2722
+ /** `false` when the tenant blocks ticket creation for this visitor. */
2723
+ allowedToCreateTicket?: boolean;
2724
+ /** Fields the agent pre-filled from the conversation. */
2725
+ ticket?: ToolCallTicketPrefill;
2726
+ /** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
2727
+ mode?: "form" | "embed";
2728
+ ticketFormId?: string;
2729
+ embedHtml?: string;
2730
+ embedDescription?: string;
2731
+ }
2732
+
2733
+ /** The ticket the agent pre-filled on a ticketing `form` tool call. */
2734
+ declare interface ToolCallTicketPrefill {
2735
+ subject?: string;
2736
+ body?: string;
2737
+ typology?: string;
2738
+ priority?: string;
2739
+ tag?: string;
2740
+ products?: string[];
2741
+ /** Keyed by the field's external id, or a lowercased, underscored title. */
2742
+ custom_fields?: Record<string, string>;
2341
2743
  }
2342
2744
 
2343
2745
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2344
2746
 
2747
+ /** Options for `AgoClient.transcribeAudio`. */
2748
+ declare interface TranscribeAudioOptions {
2749
+ /** Cancel the upload or stop waiting for its transcription. */
2750
+ signal?: AbortSignal;
2751
+ }
2752
+
2345
2753
  /**
2346
2754
  * Hook to create and manage an AgoClient instance
2347
2755
  *
@@ -2541,6 +2949,11 @@ export declare interface UseAgoFunctionOptions {
2541
2949
  * See `AgoConfig.approvalPolicy`.
2542
2950
  */
2543
2951
  requiresApproval?: boolean;
2952
+ /**
2953
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
2954
+ * `false` keeps this function out of WebMCP.
2955
+ */
2956
+ webmcp?: WebMCPToolMeta | false;
2544
2957
  }
2545
2958
 
2546
2959
  /**
@@ -2878,4 +3291,23 @@ export declare interface UseSheetResult {
2878
3291
  toggle: (cause?: SheetChangeCause) => void;
2879
3292
  }
2880
3293
 
3294
+ /** The MCP behavior hints AGO has no equivalent for. */
3295
+ declare interface WebMCPToolMeta {
3296
+ /**
3297
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
3298
+ * function that changes nothing, `untrustedContentHint` one whose result may
3299
+ * carry third-party text.
3300
+ */
3301
+ annotations?: {
3302
+ readOnlyHint?: boolean;
3303
+ untrustedContentHint?: boolean;
3304
+ };
3305
+ /**
3306
+ * This function navigates. The WebMCP call is held open until the function
3307
+ * registry goes quiet, so the caller sees the destination page's tools rather
3308
+ * than the departing page's. Already set on the built-in `navigateToPage`.
3309
+ */
3310
+ navigates?: boolean;
3311
+ }
3312
+
2881
3313
  export { }