@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/vue.d.ts CHANGED
@@ -61,6 +61,7 @@ declare class AgoClient {
61
61
  private contextRegistry;
62
62
  private eventEmitter;
63
63
  private activityLedger;
64
+ private errorWatcher;
64
65
  private lastSentPageState;
65
66
  private config;
66
67
  /** Conversations already warned about an empty reply (one warning each). */
@@ -99,7 +100,10 @@ declare class AgoClient {
99
100
  * `null` otherwise.
100
101
  */
101
102
  proactive: ProactiveController | null;
103
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
104
+ private detachWebMCP;
102
105
  constructor(config: AgoConfig);
106
+ private attachWebMCPBridge;
103
107
  /**
104
108
  * Send a message and receive a streaming response
105
109
  */
@@ -211,6 +215,7 @@ declare class AgoClient {
211
215
  * (the agent decides what to do next). No-op if the invocation is unknown.
212
216
  */
213
217
  rejectFunction(invocationId: string): Promise<void>;
218
+ /* Excluded from this release type: runExternalFunction */
214
219
  /**
215
220
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
216
221
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -230,6 +235,35 @@ declare class AgoClient {
230
235
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
231
236
  */
232
237
  private static mapPersistedToolCalls;
238
+ /**
239
+ * Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
240
+ * Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
241
+ * MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
242
+ * The filename must include the matching extension. For a MediaRecorder blob,
243
+ * wrap it in a File with the recording's extension and MIME type.
244
+ * Show the returned text as a draft; call `sendMessage` when the user sends it.
245
+ */
246
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
247
+ /**
248
+ * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
249
+ * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
250
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
251
+ * once, when a ticket form first appears in a conversation.
252
+ */
253
+ getConfig(): Promise<SdkConfig>;
254
+ /**
255
+ * The dashboard's home screen content. A starter card shows its
256
+ * `description` and sends its `initial_message`; one with neither is
257
+ * unusable and is dropped rather than rendered as an empty card.
258
+ */
259
+ private static mapHomePage;
260
+ private static mapTicketForm;
261
+ /**
262
+ * Create a support ticket (`POST /api/sdk/v1/tickets`, multipart). This is
263
+ * what the ticket form in the conversation does before it completes the
264
+ * `form` tool call with {@link submitToolCallForm}.
265
+ */
266
+ createTicket(input: CreateTicketInput): Promise<CreateTicketResult>;
233
267
  /**
234
268
  * Get messages for a conversation
235
269
  */
@@ -351,6 +385,9 @@ declare class AgoClient {
351
385
  * Get all registered function schemas
352
386
  */
353
387
  getRegisteredFunctions(): ClientFunctionSchema[];
388
+ /** The callback form of `functions:changed`. Returns an unsubscribe. */
389
+ onFunctionsChanged(listener: () => void): () => void;
390
+ /* Excluded from this release type: getFunctionRegistrations */
354
391
  /**
355
392
  * Execute a registered client function locally, through the same
356
393
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -488,6 +525,15 @@ declare class AgoClient {
488
525
  /* Excluded from this release type: emitProactiveEvent */
489
526
  /* Excluded from this release type: getHttp */
490
527
  /* Excluded from this release type: getConfiguredAgent */
528
+ /**
529
+ * How the SDK identifies the visitor: the configured `userEmail`, and
530
+ * whether a `userJwt` is set. The ticket form asks for an email when it has
531
+ * neither.
532
+ */
533
+ getUserIdentity(): {
534
+ email?: string;
535
+ hasJwt: boolean;
536
+ };
491
537
  /**
492
538
  * Enable automatic capture of the current browser page (URL + title).
493
539
  * Injected as a dynamic context entry named `browser-page`.
@@ -510,6 +556,26 @@ declare class AgoClient {
510
556
  private addActivity;
511
557
  private recordAgentAction;
512
558
  private registerActivityContext;
559
+ /**
560
+ * Start capturing the page's JavaScript errors (uncaught exceptions,
561
+ * unhandled rejections, `console.error` calls, {@link reportError}) and send
562
+ * the recent ones as the `errors:recent` context entry on every message.
563
+ * Same as setting `errorWatcher` in the config. Calling it again replaces
564
+ * the watcher (and its options); the captured errors are not kept.
565
+ */
566
+ enableErrorWatcher(options?: ErrorWatcherOptions): void;
567
+ /** Stop capturing errors and drop the `errors:recent` context entry. */
568
+ disableErrorWatcher(): void;
569
+ /**
570
+ * Record an error the app caught itself (React error boundary, Vue
571
+ * `errorHandler`, Angular `ErrorHandler`, a try/catch) so the agent sees it
572
+ * like an uncaught one. No-op unless the error watcher is enabled. `context`
573
+ * is size-clamped before it is stored; keep it small and free of secrets.
574
+ */
575
+ reportError(error: unknown, context?: Record<string, unknown>): void;
576
+ /** Errors the watcher currently holds, oldest first (a copy). Empty when disabled. */
577
+ getRecentErrors(): CapturedError[];
578
+ clearErrors(): void;
513
579
  /**
514
580
  * Subscribe to an event
515
581
  */
@@ -654,6 +720,8 @@ declare interface AgoClientEvents {
654
720
  * call running immediately.
655
721
  */
656
722
  "function:awaiting-approval": ClientFunctionInvocation;
723
+ /** A function was registered or unregistered, or the registry cleared. */
724
+ "functions:changed": ClientFunctionSchema[];
657
725
  "function:result": {
658
726
  invocationId: string;
659
727
  result: unknown;
@@ -704,6 +772,12 @@ declare interface AgoClientEvents {
704
772
  };
705
773
  /** A user- or agent-action was recorded into the activity ledger. */
706
774
  "activity:recorded": ActivityEntry;
775
+ /**
776
+ * The error watcher captured a JavaScript error (uncaught exception,
777
+ * unhandled rejection, `console.error` call, or `reportError`). Fires on
778
+ * repeats too, with the updated `count`. Requires `errorWatcher` in the config.
779
+ */
780
+ "error:captured": CapturedError;
707
781
  }
708
782
 
709
783
  /**
@@ -720,10 +794,14 @@ export declare interface AgoConfig {
720
794
  defaultAgentId?: string;
721
795
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
722
796
  permission?: string;
797
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
798
+ language?: string | null;
723
799
  /** User email for identification */
724
800
  userEmail?: string;
725
801
  /** JWT token for authenticated users */
726
802
  userJwt?: string;
803
+ /** User metadata sent with messages. Use null to stop sending defaults. Not an authentication credential. */
804
+ metadata?: Record<string, unknown> | null;
727
805
  /** Enable debug logging */
728
806
  debug?: boolean;
729
807
  /**
@@ -783,6 +861,27 @@ export declare interface AgoConfig {
783
861
  * default otherwise.
784
862
  */
785
863
  proactive?: ProactiveOptions;
864
+ /**
865
+ * Capture the page's JavaScript errors as agent context. When set, the SDK
866
+ * listens for uncaught exceptions and unhandled promise rejections, wraps
867
+ * `console.error` (calling through; restored on `destroy`), and sends the
868
+ * recent errors (deduplicated, capped, pruned after 10 min) as the
869
+ * `errors:recent` context entry on every message. `true` uses the defaults;
870
+ * pass {@link ErrorWatcherOptions} to tune the caps or add a `filter` that
871
+ * redacts messages. Off by default: error messages can carry PII or internal
872
+ * URLs, so enabling it is the host's call. Errors also feed the proactive
873
+ * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
874
+ */
875
+ errorWatcher?: boolean | ErrorWatcherOptions;
876
+ /** Mirror every registered client function into the browser's WebMCP registry
877
+ * (`document.modelContext`), so an external agent can call the same functions
878
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
879
+ *
880
+ * A mirrored function runs immediately: the approval gate
881
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
882
+ * Use `webmcp: false` on a definition to keep it out.
883
+ */
884
+ webmcp?: boolean;
786
885
  }
787
886
 
788
887
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -988,6 +1087,37 @@ declare type AgoStateSetResult = {
988
1087
  result: "unchanged";
989
1088
  };
990
1089
 
1090
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1091
+ declare interface AudioTranscription {
1092
+ text: string;
1093
+ }
1094
+
1095
+ /** One JavaScript error captured on the page (deduplicated, see `count`). */
1096
+ declare interface CapturedError {
1097
+ type: CapturedErrorType;
1098
+ /** Error message, truncated to 500 chars. */
1099
+ message: string;
1100
+ /** Script URL the error came from, without its query string. */
1101
+ source?: string;
1102
+ line?: number;
1103
+ col?: number;
1104
+ /** Leading stack frames, truncated (see `maxStackChars`). */
1105
+ stack?: string;
1106
+ /** Pathname at capture time. */
1107
+ route: string;
1108
+ /** Epoch ms of the first occurrence. */
1109
+ firstAt: number;
1110
+ /** Epoch ms of the most recent occurrence. */
1111
+ lastAt: number;
1112
+ /** How many times this same error (type + message + source + line) fired. */
1113
+ count: number;
1114
+ /** App-provided context, manual reports only (size-clamped). */
1115
+ context?: Record<string, unknown>;
1116
+ }
1117
+
1118
+ /** How an error reached the watcher. */
1119
+ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
1120
+
991
1121
  /**
992
1122
  * Single-object function definition — combines name, schema, and handler.
993
1123
  *
@@ -1001,22 +1131,11 @@ declare type AgoStateSetResult = {
1001
1131
  * client.registerFunction(fn);
1002
1132
  * ```
1003
1133
  */
1004
- declare interface ClientFunctionDefinition {
1134
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1005
1135
  name: string;
1006
1136
  description: string;
1007
1137
  parameters: ClientFunctionSchema["parameters"];
1008
1138
  handler: ClientFunctionHandler;
1009
- /**
1010
- * Max serialized result size in bytes before the SDK truncates it to a
1011
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1012
- * `Infinity` disables the guard for this function.
1013
- */
1014
- maxResultBytes?: number;
1015
- /**
1016
- * Require explicit user approval before this function runs. See
1017
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1018
- */
1019
- requiresApproval?: boolean;
1020
1139
  }
1021
1140
 
1022
1141
  /**
@@ -1035,20 +1154,7 @@ declare interface ClientFunctionInvocation {
1035
1154
  * Schema-plus-settings object accepted when registering a function: the schema
1036
1155
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1037
1156
  */
1038
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1039
- /**
1040
- * Max serialized result size in bytes before the SDK truncates it to a
1041
- * flagged preview. Overrides the client-level default
1042
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1043
- * disables the guard for this function.
1044
- */
1045
- maxResultBytes?: number;
1046
- /**
1047
- * Require explicit user approval before this function runs. See
1048
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1049
- */
1050
- requiresApproval?: boolean;
1051
- };
1157
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1052
1158
 
1053
1159
  /**
1054
1160
  * Schema for a client-side function that AGO can call
@@ -1075,6 +1181,28 @@ declare interface ClientFunctionSchema {
1075
1181
  };
1076
1182
  }
1077
1183
 
1184
+ /** SDK-side function settings that are never sent to the backend. */
1185
+ declare interface ClientFunctionSettings {
1186
+ /**
1187
+ * Max serialized result size in bytes before the SDK truncates it to a
1188
+ * flagged preview. Overrides the client-level default
1189
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1190
+ * disables the guard for this function.
1191
+ */
1192
+ maxResultBytes?: number;
1193
+ /**
1194
+ * Require explicit user approval before this function runs. See
1195
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1196
+ */
1197
+ requiresApproval?: boolean;
1198
+ /**
1199
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1200
+ * `false` keeps this function out of WebMCP while leaving it available to the
1201
+ * in-app agent.
1202
+ */
1203
+ webmcp?: WebMCPToolMeta | false;
1204
+ }
1205
+
1078
1206
  /** See {@link AgoConfig.clientFunctionsMode}. */
1079
1207
  declare type ClientFunctionsMode = "placeholder" | "pause";
1080
1208
 
@@ -1121,6 +1249,30 @@ export declare interface Conversation {
1121
1249
  messages?: AgoMessage[];
1122
1250
  }
1123
1251
 
1252
+ /** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
1253
+ declare interface CreateTicketInput {
1254
+ subject: string;
1255
+ body: string;
1256
+ priority?: string;
1257
+ typology?: string;
1258
+ /** Conversation the ticket is filed from. */
1259
+ conversationId?: string;
1260
+ /** Reporter email, for a visitor the SDK does not otherwise identify. */
1261
+ email?: string;
1262
+ customFields?: Array<{
1263
+ id: string;
1264
+ value: string;
1265
+ }>;
1266
+ files?: File[];
1267
+ ticketFormId?: string;
1268
+ }
1269
+
1270
+ /** Response of `AgoClient.createTicket`. */
1271
+ declare interface CreateTicketResult {
1272
+ id: string;
1273
+ url?: string;
1274
+ }
1275
+
1124
1276
  /**
1125
1277
  * A function that returns a fresh context entry on demand.
1126
1278
  * Evaluated every time a message is sent — use it to pull data from stores,
@@ -1128,6 +1280,23 @@ export declare interface Conversation {
1128
1280
  */
1129
1281
  declare type DynamicContextProvider = () => ContextEntry | null | undefined;
1130
1282
 
1283
+ declare interface ErrorWatcherOptions {
1284
+ /** Max distinct errors kept. Oldest dropped first. Default 10. */
1285
+ maxErrors?: number;
1286
+ /**
1287
+ * Errors older than this are pruned when the buffer is read, so a crash from
1288
+ * an hour ago does not confuse the agent. Default 600 000 (10 min).
1289
+ */
1290
+ maxAgeMs?: number;
1291
+ /** Max chars of stack kept per error. Default 2000. */
1292
+ maxStackChars?: number;
1293
+ /**
1294
+ * Redact or drop an error before it is stored. Return the (possibly edited)
1295
+ * error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
1296
+ */
1297
+ filter?: (error: CapturedError) => CapturedError | null;
1298
+ }
1299
+
1131
1300
  /** The four values of {@link FeedbackReason}, in dashboard order. */
1132
1301
  export declare const FEEDBACK_REASONS: readonly FeedbackReason[];
1133
1302
 
@@ -1507,12 +1676,26 @@ declare interface ProactiveTriggerWhen {
1507
1676
  pageState?: Partial<Record<string, unknown>>;
1508
1677
  /** Min rage-click bursts on the current route. */
1509
1678
  rageClicks?: number;
1679
+ /**
1680
+ * Min JavaScript errors captured on the current route. Needs the client's
1681
+ * `errorWatcher` enabled; without it the count stays at 0 and the matcher
1682
+ * never passes.
1683
+ */
1684
+ jsErrors?: number;
1510
1685
  /** Min A→B→A→B route oscillations this session. */
1511
1686
  routeBounces?: number;
1512
1687
  /** Per-field minimum error counts (field NAME → min count). */
1513
1688
  fieldErrors?: Record<string, number>;
1514
1689
  }
1515
1690
 
1691
+ /**
1692
+ * Registered function with handler
1693
+ */
1694
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1695
+ schema: ClientFunctionSchema;
1696
+ handler: ClientFunctionHandler;
1697
+ }
1698
+
1516
1699
  /**
1517
1700
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1518
1701
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1524,10 +1707,71 @@ declare type ResumeGate = (info: {
1524
1707
  messageId: string;
1525
1708
  }) => Promise<void> | void;
1526
1709
 
1710
+ /** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
1711
+ declare interface SdkConfig {
1712
+ permissions: SdkPermissionConfig[];
1713
+ proactive: {
1714
+ enabled: boolean;
1715
+ };
1716
+ }
1717
+
1718
+ /** The dashboard's home screen content (title, subtitle, starter cards). */
1719
+ declare interface SdkHomePageConfig {
1720
+ title?: string;
1721
+ /** Markdown. */
1722
+ subtitle?: string;
1723
+ starters: SdkHomeStarter[];
1724
+ widgetStarter?: SdkWidgetStarter;
1725
+ }
1726
+
1727
+ /**
1728
+ * A conversation starter card configured in the AGO dashboard. `label` is what
1729
+ * the card shows; clicking it sends `message`.
1730
+ */
1731
+ declare interface SdkHomeStarter {
1732
+ id: string;
1733
+ /** The card's text (the starter's `description` in the dashboard). */
1734
+ label: string;
1735
+ /** What is sent when the card is clicked. */
1736
+ message: string;
1737
+ /** Answer with this agent instead of the configured default. */
1738
+ agentId?: string;
1739
+ }
1740
+
1741
+ /** One permission's configuration in {@link SdkConfig}. */
1742
+ declare interface SdkPermissionConfig {
1743
+ id?: string;
1744
+ name?: string;
1745
+ displayName?: string;
1746
+ agents: Array<{
1747
+ id: string;
1748
+ name?: string;
1749
+ }>;
1750
+ ticketForm?: TicketForm;
1751
+ /** Home screen content, when the tenant configured one. */
1752
+ homePage?: SdkHomePageConfig;
1753
+ fileAttachmentsEnabled: boolean;
1754
+ voiceEnabled: boolean;
1755
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1756
+ speechToTextEnabled: boolean;
1757
+ }
1758
+
1759
+ /**
1760
+ * The starter the dashboard sends by itself on a fresh visit, before the
1761
+ * visitor types anything.
1762
+ */
1763
+ declare interface SdkWidgetStarter {
1764
+ id: string;
1765
+ message: string;
1766
+ agentId?: string;
1767
+ }
1768
+
1527
1769
  /**
1528
1770
  * Options for sending a message
1529
1771
  */
1530
1772
  declare interface SendMessageOptions {
1773
+ /** Replaces config.metadata for this message; null omits metadata for this message. */
1774
+ metadata?: Record<string, unknown> | null;
1531
1775
  /** Existing conversation ID */
1532
1776
  conversationId?: string;
1533
1777
  /** Override default agent */
@@ -1576,6 +1820,12 @@ declare interface SignalsSnapshot {
1576
1820
  idleMs: number;
1577
1821
  /** Rage-click bursts detected on the current route. */
1578
1822
  rageClicks: number;
1823
+ /**
1824
+ * JavaScript errors captured on the current route (count only; the messages
1825
+ * travel in `client_context` under `errors:recent`). Always `0` unless the
1826
+ * client has `errorWatcher` enabled.
1827
+ */
1828
+ jsErrors: number;
1579
1829
  /**
1580
1830
  * A→B→A→B route oscillations detected in the recent route sequence. Rolling
1581
1831
  * session counter (cross-route by nature); trigger cooldowns and dismissal
@@ -1634,6 +1884,13 @@ declare interface SSEChunkData {
1634
1884
  follow_up_replies?: string[];
1635
1885
  satisfaction_feedback?: unknown;
1636
1886
  ask_to_talk_to_human?: boolean;
1887
+ allowed_to_create_ticket?: boolean;
1888
+ ticket?: ToolCallTicketPrefill;
1889
+ mode?: "form" | "embed";
1890
+ ticket_form_id?: string;
1891
+ embed_html?: string;
1892
+ embed_description?: string;
1893
+ display_mode?: "collapsible" | "display" | "both";
1637
1894
  /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
1638
1895
  waiting_tool_call_ids?: string[];
1639
1896
  }
@@ -1708,12 +1965,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
1708
1965
  declare interface SubmitToolCallResult {
1709
1966
  status: string;
1710
1967
  result?: unknown;
1968
+ /** Set when `status` is `"error"`. */
1969
+ error?: string;
1970
+ /** The ticket a ticketing `form` tool call resolved to, when it did. */
1971
+ ticket?: {
1972
+ ticket_id: string;
1973
+ ticket_url?: string;
1974
+ [key: string]: unknown;
1975
+ };
1711
1976
  resume?: {
1712
1977
  message_id: string;
1713
1978
  ready: boolean;
1714
1979
  };
1715
1980
  }
1716
1981
 
1982
+ /** A custom field of a ticket form. */
1983
+ declare interface TicketField {
1984
+ id: string;
1985
+ /** The key the ticketing backend expects; used as the submit key when set. */
1986
+ externalId?: string;
1987
+ title?: string;
1988
+ /** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
1989
+ type?: string;
1990
+ required: boolean;
1991
+ /** Carried in the submission but never shown. */
1992
+ hidden: boolean;
1993
+ active?: boolean;
1994
+ /** Bypass progressive disclosure, while still respecting conditions. */
1995
+ alwaysVisible?: boolean;
1996
+ regexpForValidation?: string;
1997
+ position: number;
1998
+ /** Non-empty turns the field into a select. */
1999
+ options: TicketFieldOption[];
2000
+ /** Show this field only when the parent field holds `conditionalFieldValue`. */
2001
+ conditionalFieldId?: string;
2002
+ /** Legacy comma-separated condition values. */
2003
+ conditionalFieldValue?: string;
2004
+ /** Takes precedence over conditionalFieldValue when non-empty. */
2005
+ conditionalFieldValues?: string[];
2006
+ }
2007
+
2008
+ /** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
2009
+ declare interface TicketFieldOption {
2010
+ id: string;
2011
+ /** Label shown to the user. */
2012
+ name?: string;
2013
+ /** Value submitted. Falls back to `name` when absent. */
2014
+ value?: string;
2015
+ /** Preselected when the form opens. */
2016
+ default: boolean;
2017
+ /** A note shown under the field once this option is picked. */
2018
+ message?: string;
2019
+ messageType: "info" | "warning" | "danger";
2020
+ position?: number;
2021
+ group?: string;
2022
+ noDisplay?: boolean;
2023
+ conditionalFieldId?: string;
2024
+ /** Available when the parent matches any of these values. */
2025
+ conditionalFieldValues?: string[];
2026
+ }
2027
+
2028
+ /** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
2029
+ declare interface TicketForm {
2030
+ id: string;
2031
+ name?: string;
2032
+ /** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
2033
+ mode: "form" | "embed";
2034
+ showSubject: boolean;
2035
+ showBody: boolean;
2036
+ showPriority: boolean;
2037
+ showTypology: boolean;
2038
+ priorityTypologies?: string[];
2039
+ successMessageText?: string;
2040
+ successMessageUrlLabel?: string;
2041
+ fields: TicketField[];
2042
+ }
2043
+
1717
2044
  /**
1718
2045
  * Tool call data from SSE stream
1719
2046
  */
@@ -1728,12 +2055,46 @@ export declare interface ToolCallData {
1728
2055
  data?: Record<string, unknown>;
1729
2056
  functionName?: string;
1730
2057
  arguments?: Record<string, unknown>;
2058
+ /**
2059
+ * Where the hosted widget shows the call: in the collapsible "reasoning"
2060
+ * section, in the message body, or both. Absent means collapsible only.
2061
+ */
2062
+ displayMode?: "collapsible" | "display" | "both";
2063
+ /** The user asked to talk to a human. */
2064
+ askToTalkToHuman?: boolean;
2065
+ /** `false` when the tenant blocks ticket creation for this visitor. */
2066
+ allowedToCreateTicket?: boolean;
2067
+ /** Fields the agent pre-filled from the conversation. */
2068
+ ticket?: ToolCallTicketPrefill;
2069
+ /** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
2070
+ mode?: "form" | "embed";
2071
+ ticketFormId?: string;
2072
+ embedHtml?: string;
2073
+ embedDescription?: string;
2074
+ }
2075
+
2076
+ /** The ticket the agent pre-filled on a ticketing `form` tool call. */
2077
+ declare interface ToolCallTicketPrefill {
2078
+ subject?: string;
2079
+ body?: string;
2080
+ typology?: string;
2081
+ priority?: string;
2082
+ tag?: string;
2083
+ products?: string[];
2084
+ /** Keyed by the field's external id, or a lowercased, underscored title. */
2085
+ custom_fields?: Record<string, string>;
1731
2086
  }
1732
2087
 
1733
2088
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
1734
2089
 
1735
2090
  declare type ToolCallType_2 = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
1736
2091
 
2092
+ /** Options for `AgoClient.transcribeAudio`. */
2093
+ declare interface TranscribeAudioOptions {
2094
+ /** Cancel the upload or stop waiting for its transcription. */
2095
+ signal?: AbortSignal;
2096
+ }
2097
+
1737
2098
  /**
1738
2099
  * Get or create an AgoClient.
1739
2100
  *
@@ -1782,6 +2143,16 @@ export declare function useAgoFunction(name: string, options: {
1782
2143
  * `Infinity` disables the guard for this function.
1783
2144
  */
1784
2145
  maxResultBytes?: number;
2146
+ /**
2147
+ * Require explicit user approval before this function runs (pause mode
2148
+ * only). See `AgoConfig.approvalPolicy`.
2149
+ */
2150
+ requiresApproval?: boolean;
2151
+ /**
2152
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
2153
+ * `false` keeps this function out of WebMCP.
2154
+ */
2155
+ webmcp?: WebMCPToolMeta | false;
1785
2156
  }): void;
1786
2157
 
1787
2158
  /**
@@ -1886,6 +2257,22 @@ export declare function useChat(options?: UseChatOptions): {
1886
2257
  data?: Record<string, unknown> | undefined;
1887
2258
  functionName?: string | undefined;
1888
2259
  arguments?: Record<string, unknown> | undefined;
2260
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2261
+ askToTalkToHuman?: boolean | undefined;
2262
+ allowedToCreateTicket?: boolean | undefined;
2263
+ ticket?: {
2264
+ subject?: string | undefined;
2265
+ body?: string | undefined;
2266
+ typology?: string | undefined;
2267
+ priority?: string | undefined;
2268
+ tag?: string | undefined;
2269
+ products?: string[] | undefined;
2270
+ custom_fields?: Record<string, string> | undefined;
2271
+ } | undefined;
2272
+ mode?: "form" | "embed" | undefined;
2273
+ ticketFormId?: string | undefined;
2274
+ embedHtml?: string | undefined;
2275
+ embedDescription?: string | undefined;
1889
2276
  }[] | undefined;
1890
2277
  followUpReplies?: string[] | undefined;
1891
2278
  attachments?: {
@@ -1929,6 +2316,22 @@ export declare function useChat(options?: UseChatOptions): {
1929
2316
  data?: Record<string, unknown> | undefined;
1930
2317
  functionName?: string | undefined;
1931
2318
  arguments?: Record<string, unknown> | undefined;
2319
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2320
+ askToTalkToHuman?: boolean | undefined;
2321
+ allowedToCreateTicket?: boolean | undefined;
2322
+ ticket?: {
2323
+ subject?: string | undefined;
2324
+ body?: string | undefined;
2325
+ typology?: string | undefined;
2326
+ priority?: string | undefined;
2327
+ tag?: string | undefined;
2328
+ products?: string[] | undefined;
2329
+ custom_fields?: Record<string, string> | undefined;
2330
+ } | undefined;
2331
+ mode?: "form" | "embed" | undefined;
2332
+ ticketFormId?: string | undefined;
2333
+ embedHtml?: string | undefined;
2334
+ embedDescription?: string | undefined;
1932
2335
  }[] | undefined;
1933
2336
  followUpReplies?: string[] | undefined;
1934
2337
  attachments?: {
@@ -1983,6 +2386,22 @@ export declare function useChat(options?: UseChatOptions): {
1983
2386
  data?: Record<string, unknown> | undefined;
1984
2387
  functionName?: string | undefined;
1985
2388
  arguments?: Record<string, unknown> | undefined;
2389
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2390
+ askToTalkToHuman?: boolean | undefined;
2391
+ allowedToCreateTicket?: boolean | undefined;
2392
+ ticket?: {
2393
+ subject?: string | undefined;
2394
+ body?: string | undefined;
2395
+ typology?: string | undefined;
2396
+ priority?: string | undefined;
2397
+ tag?: string | undefined;
2398
+ products?: string[] | undefined;
2399
+ custom_fields?: Record<string, string> | undefined;
2400
+ } | undefined;
2401
+ mode?: "form" | "embed" | undefined;
2402
+ ticketFormId?: string | undefined;
2403
+ embedHtml?: string | undefined;
2404
+ embedDescription?: string | undefined;
1986
2405
  }[] | undefined;
1987
2406
  followUpReplies?: string[] | undefined;
1988
2407
  attachments?: {
@@ -2031,6 +2450,22 @@ export declare function useChat(options?: UseChatOptions): {
2031
2450
  data?: Record<string, unknown> | undefined;
2032
2451
  functionName?: string | undefined;
2033
2452
  arguments?: Record<string, unknown> | undefined;
2453
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2454
+ askToTalkToHuman?: boolean | undefined;
2455
+ allowedToCreateTicket?: boolean | undefined;
2456
+ ticket?: {
2457
+ subject?: string | undefined;
2458
+ body?: string | undefined;
2459
+ typology?: string | undefined;
2460
+ priority?: string | undefined;
2461
+ tag?: string | undefined;
2462
+ products?: string[] | undefined;
2463
+ custom_fields?: Record<string, string> | undefined;
2464
+ } | undefined;
2465
+ mode?: "form" | "embed" | undefined;
2466
+ ticketFormId?: string | undefined;
2467
+ embedHtml?: string | undefined;
2468
+ embedDescription?: string | undefined;
2034
2469
  }[] | undefined;
2035
2470
  followUpReplies?: string[] | undefined;
2036
2471
  attachments?: {
@@ -2080,6 +2515,22 @@ export declare function useChat(options?: UseChatOptions): {
2080
2515
  data?: Record<string, unknown> | undefined;
2081
2516
  functionName?: string | undefined;
2082
2517
  arguments?: Record<string, unknown> | undefined;
2518
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2519
+ askToTalkToHuman?: boolean | undefined;
2520
+ allowedToCreateTicket?: boolean | undefined;
2521
+ ticket?: {
2522
+ subject?: string | undefined;
2523
+ body?: string | undefined;
2524
+ typology?: string | undefined;
2525
+ priority?: string | undefined;
2526
+ tag?: string | undefined;
2527
+ products?: string[] | undefined;
2528
+ custom_fields?: Record<string, string> | undefined;
2529
+ } | undefined;
2530
+ mode?: "form" | "embed" | undefined;
2531
+ ticketFormId?: string | undefined;
2532
+ embedHtml?: string | undefined;
2533
+ embedDescription?: string | undefined;
2083
2534
  }[] | undefined;
2084
2535
  followUpReplies?: string[] | undefined;
2085
2536
  attachments?: {
@@ -2128,6 +2579,22 @@ export declare function useChat(options?: UseChatOptions): {
2128
2579
  data?: Record<string, unknown> | undefined;
2129
2580
  functionName?: string | undefined;
2130
2581
  arguments?: Record<string, unknown> | undefined;
2582
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2583
+ askToTalkToHuman?: boolean | undefined;
2584
+ allowedToCreateTicket?: boolean | undefined;
2585
+ ticket?: {
2586
+ subject?: string | undefined;
2587
+ body?: string | undefined;
2588
+ typology?: string | undefined;
2589
+ priority?: string | undefined;
2590
+ tag?: string | undefined;
2591
+ products?: string[] | undefined;
2592
+ custom_fields?: Record<string, string> | undefined;
2593
+ } | undefined;
2594
+ mode?: "form" | "embed" | undefined;
2595
+ ticketFormId?: string | undefined;
2596
+ embedHtml?: string | undefined;
2597
+ embedDescription?: string | undefined;
2131
2598
  }[] | undefined;
2132
2599
  followUpReplies?: string[] | undefined;
2133
2600
  attachments?: {
@@ -2197,6 +2664,22 @@ export declare function useConversation(options?: UseConversationOptions): {
2197
2664
  data?: Record<string, unknown> | undefined;
2198
2665
  functionName?: string | undefined;
2199
2666
  arguments?: Record<string, unknown> | undefined;
2667
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2668
+ askToTalkToHuman?: boolean | undefined;
2669
+ allowedToCreateTicket?: boolean | undefined;
2670
+ ticket?: {
2671
+ subject?: string | undefined;
2672
+ body?: string | undefined;
2673
+ typology?: string | undefined;
2674
+ priority?: string | undefined;
2675
+ tag?: string | undefined;
2676
+ products?: string[] | undefined;
2677
+ custom_fields?: Record<string, string> | undefined;
2678
+ } | undefined;
2679
+ mode?: "form" | "embed" | undefined;
2680
+ ticketFormId?: string | undefined;
2681
+ embedHtml?: string | undefined;
2682
+ embedDescription?: string | undefined;
2200
2683
  }[] | undefined;
2201
2684
  followUpReplies?: string[] | undefined;
2202
2685
  attachments?: {
@@ -2245,6 +2728,22 @@ export declare function useConversation(options?: UseConversationOptions): {
2245
2728
  data?: Record<string, unknown> | undefined;
2246
2729
  functionName?: string | undefined;
2247
2730
  arguments?: Record<string, unknown> | undefined;
2731
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2732
+ askToTalkToHuman?: boolean | undefined;
2733
+ allowedToCreateTicket?: boolean | undefined;
2734
+ ticket?: {
2735
+ subject?: string | undefined;
2736
+ body?: string | undefined;
2737
+ typology?: string | undefined;
2738
+ priority?: string | undefined;
2739
+ tag?: string | undefined;
2740
+ products?: string[] | undefined;
2741
+ custom_fields?: Record<string, string> | undefined;
2742
+ } | undefined;
2743
+ mode?: "form" | "embed" | undefined;
2744
+ ticketFormId?: string | undefined;
2745
+ embedHtml?: string | undefined;
2746
+ embedDescription?: string | undefined;
2248
2747
  }[] | undefined;
2249
2748
  followUpReplies?: string[] | undefined;
2250
2749
  attachments?: {
@@ -2294,6 +2793,22 @@ export declare function useConversation(options?: UseConversationOptions): {
2294
2793
  data?: Record<string, unknown> | undefined;
2295
2794
  functionName?: string | undefined;
2296
2795
  arguments?: Record<string, unknown> | undefined;
2796
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2797
+ askToTalkToHuman?: boolean | undefined;
2798
+ allowedToCreateTicket?: boolean | undefined;
2799
+ ticket?: {
2800
+ subject?: string | undefined;
2801
+ body?: string | undefined;
2802
+ typology?: string | undefined;
2803
+ priority?: string | undefined;
2804
+ tag?: string | undefined;
2805
+ products?: string[] | undefined;
2806
+ custom_fields?: Record<string, string> | undefined;
2807
+ } | undefined;
2808
+ mode?: "form" | "embed" | undefined;
2809
+ ticketFormId?: string | undefined;
2810
+ embedHtml?: string | undefined;
2811
+ embedDescription?: string | undefined;
2297
2812
  }[] | undefined;
2298
2813
  followUpReplies?: string[] | undefined;
2299
2814
  attachments?: {
@@ -2342,6 +2857,22 @@ export declare function useConversation(options?: UseConversationOptions): {
2342
2857
  data?: Record<string, unknown> | undefined;
2343
2858
  functionName?: string | undefined;
2344
2859
  arguments?: Record<string, unknown> | undefined;
2860
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2861
+ askToTalkToHuman?: boolean | undefined;
2862
+ allowedToCreateTicket?: boolean | undefined;
2863
+ ticket?: {
2864
+ subject?: string | undefined;
2865
+ body?: string | undefined;
2866
+ typology?: string | undefined;
2867
+ priority?: string | undefined;
2868
+ tag?: string | undefined;
2869
+ products?: string[] | undefined;
2870
+ custom_fields?: Record<string, string> | undefined;
2871
+ } | undefined;
2872
+ mode?: "form" | "embed" | undefined;
2873
+ ticketFormId?: string | undefined;
2874
+ embedHtml?: string | undefined;
2875
+ embedDescription?: string | undefined;
2345
2876
  }[] | undefined;
2346
2877
  followUpReplies?: string[] | undefined;
2347
2878
  attachments?: {
@@ -2434,6 +2965,22 @@ export declare function useMessages(options?: UseMessagesOptions): {
2434
2965
  data?: Record<string, unknown> | undefined;
2435
2966
  functionName?: string | undefined;
2436
2967
  arguments?: Record<string, unknown> | undefined;
2968
+ displayMode?: "collapsible" | "display" | "both" | undefined;
2969
+ askToTalkToHuman?: boolean | undefined;
2970
+ allowedToCreateTicket?: boolean | undefined;
2971
+ ticket?: {
2972
+ subject?: string | undefined;
2973
+ body?: string | undefined;
2974
+ typology?: string | undefined;
2975
+ priority?: string | undefined;
2976
+ tag?: string | undefined;
2977
+ products?: string[] | undefined;
2978
+ custom_fields?: Record<string, string> | undefined;
2979
+ } | undefined;
2980
+ mode?: "form" | "embed" | undefined;
2981
+ ticketFormId?: string | undefined;
2982
+ embedHtml?: string | undefined;
2983
+ embedDescription?: string | undefined;
2437
2984
  }[] | undefined;
2438
2985
  followUpReplies?: string[] | undefined;
2439
2986
  attachments?: {
@@ -2477,6 +3024,22 @@ export declare function useMessages(options?: UseMessagesOptions): {
2477
3024
  data?: Record<string, unknown> | undefined;
2478
3025
  functionName?: string | undefined;
2479
3026
  arguments?: Record<string, unknown> | undefined;
3027
+ displayMode?: "collapsible" | "display" | "both" | undefined;
3028
+ askToTalkToHuman?: boolean | undefined;
3029
+ allowedToCreateTicket?: boolean | undefined;
3030
+ ticket?: {
3031
+ subject?: string | undefined;
3032
+ body?: string | undefined;
3033
+ typology?: string | undefined;
3034
+ priority?: string | undefined;
3035
+ tag?: string | undefined;
3036
+ products?: string[] | undefined;
3037
+ custom_fields?: Record<string, string> | undefined;
3038
+ } | undefined;
3039
+ mode?: "form" | "embed" | undefined;
3040
+ ticketFormId?: string | undefined;
3041
+ embedHtml?: string | undefined;
3042
+ embedDescription?: string | undefined;
2480
3043
  }[] | undefined;
2481
3044
  followUpReplies?: string[] | undefined;
2482
3045
  attachments?: {
@@ -2524,4 +3087,23 @@ export declare interface UseProactiveNudgeResult {
2524
3087
  dismiss: () => void;
2525
3088
  }
2526
3089
 
3090
+ /** The MCP behavior hints AGO has no equivalent for. */
3091
+ declare interface WebMCPToolMeta {
3092
+ /**
3093
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
3094
+ * function that changes nothing, `untrustedContentHint` one whose result may
3095
+ * carry third-party text.
3096
+ */
3097
+ annotations?: {
3098
+ readOnlyHint?: boolean;
3099
+ untrustedContentHint?: boolean;
3100
+ };
3101
+ /**
3102
+ * This function navigates. The WebMCP call is held open until the function
3103
+ * registry goes quiet, so the caller sees the destination page's tools rather
3104
+ * than the departing page's. Already set on the built-in `navigateToPage`.
3105
+ */
3106
+ navigates?: boolean;
3107
+ }
3108
+
2527
3109
  export { }