@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
@@ -53,6 +53,7 @@ declare class AgoClient {
53
53
  private contextRegistry;
54
54
  private eventEmitter;
55
55
  private activityLedger;
56
+ private errorWatcher;
56
57
  private lastSentPageState;
57
58
  private config;
58
59
  /** Conversations already warned about an empty reply (one warning each). */
@@ -91,7 +92,10 @@ declare class AgoClient {
91
92
  * `null` otherwise.
92
93
  */
93
94
  proactive: ProactiveController | null;
95
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
96
+ private detachWebMCP;
94
97
  constructor(config: AgoConfig);
98
+ private attachWebMCPBridge;
95
99
  /**
96
100
  * Send a message and receive a streaming response
97
101
  */
@@ -203,6 +207,7 @@ declare class AgoClient {
203
207
  * (the agent decides what to do next). No-op if the invocation is unknown.
204
208
  */
205
209
  rejectFunction(invocationId: string): Promise<void>;
210
+ /* Excluded from this release type: runExternalFunction */
206
211
  /**
207
212
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
208
213
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -222,6 +227,35 @@ declare class AgoClient {
222
227
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
223
228
  */
224
229
  private static mapPersistedToolCalls;
230
+ /**
231
+ * Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
232
+ * Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
233
+ * MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
234
+ * The filename must include the matching extension. For a MediaRecorder blob,
235
+ * wrap it in a File with the recording's extension and MIME type.
236
+ * Show the returned text as a draft; call `sendMessage` when the user sends it.
237
+ */
238
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
239
+ /**
240
+ * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
241
+ * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
242
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
243
+ * once, when a ticket form first appears in a conversation.
244
+ */
245
+ getConfig(): Promise<SdkConfig>;
246
+ /**
247
+ * The dashboard's home screen content. A starter card shows its
248
+ * `description` and sends its `initial_message`; one with neither is
249
+ * unusable and is dropped rather than rendered as an empty card.
250
+ */
251
+ private static mapHomePage;
252
+ private static mapTicketForm;
253
+ /**
254
+ * Create a support ticket (`POST /api/sdk/v1/tickets`, multipart). This is
255
+ * what the ticket form in the conversation does before it completes the
256
+ * `form` tool call with {@link submitToolCallForm}.
257
+ */
258
+ createTicket(input: CreateTicketInput): Promise<CreateTicketResult>;
225
259
  /**
226
260
  * Get messages for a conversation
227
261
  */
@@ -343,6 +377,9 @@ declare class AgoClient {
343
377
  * Get all registered function schemas
344
378
  */
345
379
  getRegisteredFunctions(): ClientFunctionSchema[];
380
+ /** The callback form of `functions:changed`. Returns an unsubscribe. */
381
+ onFunctionsChanged(listener: () => void): () => void;
382
+ /* Excluded from this release type: getFunctionRegistrations */
346
383
  /**
347
384
  * Execute a registered client function locally, through the same
348
385
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -480,6 +517,15 @@ declare class AgoClient {
480
517
  /* Excluded from this release type: emitProactiveEvent */
481
518
  /* Excluded from this release type: getHttp */
482
519
  /* Excluded from this release type: getConfiguredAgent */
520
+ /**
521
+ * How the SDK identifies the visitor: the configured `userEmail`, and
522
+ * whether a `userJwt` is set. The ticket form asks for an email when it has
523
+ * neither.
524
+ */
525
+ getUserIdentity(): {
526
+ email?: string;
527
+ hasJwt: boolean;
528
+ };
483
529
  /**
484
530
  * Enable automatic capture of the current browser page (URL + title).
485
531
  * Injected as a dynamic context entry named `browser-page`.
@@ -502,6 +548,26 @@ declare class AgoClient {
502
548
  private addActivity;
503
549
  private recordAgentAction;
504
550
  private registerActivityContext;
551
+ /**
552
+ * Start capturing the page's JavaScript errors (uncaught exceptions,
553
+ * unhandled rejections, `console.error` calls, {@link reportError}) and send
554
+ * the recent ones as the `errors:recent` context entry on every message.
555
+ * Same as setting `errorWatcher` in the config. Calling it again replaces
556
+ * the watcher (and its options); the captured errors are not kept.
557
+ */
558
+ enableErrorWatcher(options?: ErrorWatcherOptions): void;
559
+ /** Stop capturing errors and drop the `errors:recent` context entry. */
560
+ disableErrorWatcher(): void;
561
+ /**
562
+ * Record an error the app caught itself (React error boundary, Vue
563
+ * `errorHandler`, Angular `ErrorHandler`, a try/catch) so the agent sees it
564
+ * like an uncaught one. No-op unless the error watcher is enabled. `context`
565
+ * is size-clamped before it is stored; keep it small and free of secrets.
566
+ */
567
+ reportError(error: unknown, context?: Record<string, unknown>): void;
568
+ /** Errors the watcher currently holds, oldest first (a copy). Empty when disabled. */
569
+ getRecentErrors(): CapturedError[];
570
+ clearErrors(): void;
505
571
  /**
506
572
  * Subscribe to an event
507
573
  */
@@ -646,6 +712,8 @@ declare interface AgoClientEvents {
646
712
  * call running immediately.
647
713
  */
648
714
  "function:awaiting-approval": ClientFunctionInvocation;
715
+ /** A function was registered or unregistered, or the registry cleared. */
716
+ "functions:changed": ClientFunctionSchema[];
649
717
  "function:result": {
650
718
  invocationId: string;
651
719
  result: unknown;
@@ -696,6 +764,12 @@ declare interface AgoClientEvents {
696
764
  };
697
765
  /** A user- or agent-action was recorded into the activity ledger. */
698
766
  "activity:recorded": ActivityEntry;
767
+ /**
768
+ * The error watcher captured a JavaScript error (uncaught exception,
769
+ * unhandled rejection, `console.error` call, or `reportError`). Fires on
770
+ * repeats too, with the updated `count`. Requires `errorWatcher` in the config.
771
+ */
772
+ "error:captured": CapturedError;
699
773
  }
700
774
 
701
775
  /**
@@ -712,10 +786,14 @@ declare interface AgoConfig {
712
786
  defaultAgentId?: string;
713
787
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
714
788
  permission?: string;
789
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
790
+ language?: string | null;
715
791
  /** User email for identification */
716
792
  userEmail?: string;
717
793
  /** JWT token for authenticated users */
718
794
  userJwt?: string;
795
+ /** User metadata sent with messages. Use null to stop sending defaults. Not an authentication credential. */
796
+ metadata?: Record<string, unknown> | null;
719
797
  /** Enable debug logging */
720
798
  debug?: boolean;
721
799
  /**
@@ -775,6 +853,27 @@ declare interface AgoConfig {
775
853
  * default otherwise.
776
854
  */
777
855
  proactive?: ProactiveOptions;
856
+ /**
857
+ * Capture the page's JavaScript errors as agent context. When set, the SDK
858
+ * listens for uncaught exceptions and unhandled promise rejections, wraps
859
+ * `console.error` (calling through; restored on `destroy`), and sends the
860
+ * recent errors (deduplicated, capped, pruned after 10 min) as the
861
+ * `errors:recent` context entry on every message. `true` uses the defaults;
862
+ * pass {@link ErrorWatcherOptions} to tune the caps or add a `filter` that
863
+ * redacts messages. Off by default: error messages can carry PII or internal
864
+ * URLs, so enabling it is the host's call. Errors also feed the proactive
865
+ * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
866
+ */
867
+ errorWatcher?: boolean | ErrorWatcherOptions;
868
+ /** Mirror every registered client function into the browser's WebMCP registry
869
+ * (`document.modelContext`), so an external agent can call the same functions
870
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
871
+ *
872
+ * A mirrored function runs immediately: the approval gate
873
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
874
+ * Use `webmcp: false` on a definition to keep it out.
875
+ */
876
+ webmcp?: boolean;
778
877
  }
779
878
 
780
879
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -959,6 +1058,37 @@ declare type AgoStateSetResult = {
959
1058
  result: "unchanged";
960
1059
  };
961
1060
 
1061
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1062
+ declare interface AudioTranscription {
1063
+ text: string;
1064
+ }
1065
+
1066
+ /** One JavaScript error captured on the page (deduplicated, see `count`). */
1067
+ declare interface CapturedError {
1068
+ type: CapturedErrorType;
1069
+ /** Error message, truncated to 500 chars. */
1070
+ message: string;
1071
+ /** Script URL the error came from, without its query string. */
1072
+ source?: string;
1073
+ line?: number;
1074
+ col?: number;
1075
+ /** Leading stack frames, truncated (see `maxStackChars`). */
1076
+ stack?: string;
1077
+ /** Pathname at capture time. */
1078
+ route: string;
1079
+ /** Epoch ms of the first occurrence. */
1080
+ firstAt: number;
1081
+ /** Epoch ms of the most recent occurrence. */
1082
+ lastAt: number;
1083
+ /** How many times this same error (type + message + source + line) fired. */
1084
+ count: number;
1085
+ /** App-provided context, manual reports only (size-clamped). */
1086
+ context?: Record<string, unknown>;
1087
+ }
1088
+
1089
+ /** How an error reached the watcher. */
1090
+ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
1091
+
962
1092
  /**
963
1093
  * Single-object function definition — combines name, schema, and handler.
964
1094
  *
@@ -972,22 +1102,11 @@ declare type AgoStateSetResult = {
972
1102
  * client.registerFunction(fn);
973
1103
  * ```
974
1104
  */
975
- declare interface ClientFunctionDefinition {
1105
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
976
1106
  name: string;
977
1107
  description: string;
978
1108
  parameters: ClientFunctionSchema["parameters"];
979
1109
  handler: ClientFunctionHandler;
980
- /**
981
- * Max serialized result size in bytes before the SDK truncates it to a
982
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
983
- * `Infinity` disables the guard for this function.
984
- */
985
- maxResultBytes?: number;
986
- /**
987
- * Require explicit user approval before this function runs. See
988
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
989
- */
990
- requiresApproval?: boolean;
991
1110
  }
992
1111
 
993
1112
  /**
@@ -1006,20 +1125,7 @@ declare interface ClientFunctionInvocation {
1006
1125
  * Schema-plus-settings object accepted when registering a function: the schema
1007
1126
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1008
1127
  */
1009
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1010
- /**
1011
- * Max serialized result size in bytes before the SDK truncates it to a
1012
- * flagged preview. Overrides the client-level default
1013
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1014
- * disables the guard for this function.
1015
- */
1016
- maxResultBytes?: number;
1017
- /**
1018
- * Require explicit user approval before this function runs. See
1019
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1020
- */
1021
- requiresApproval?: boolean;
1022
- };
1128
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1023
1129
 
1024
1130
  /**
1025
1131
  * Schema for a client-side function that AGO can call
@@ -1046,6 +1152,28 @@ declare interface ClientFunctionSchema {
1046
1152
  };
1047
1153
  }
1048
1154
 
1155
+ /** SDK-side function settings that are never sent to the backend. */
1156
+ declare interface ClientFunctionSettings {
1157
+ /**
1158
+ * Max serialized result size in bytes before the SDK truncates it to a
1159
+ * flagged preview. Overrides the client-level default
1160
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1161
+ * disables the guard for this function.
1162
+ */
1163
+ maxResultBytes?: number;
1164
+ /**
1165
+ * Require explicit user approval before this function runs. See
1166
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1167
+ */
1168
+ requiresApproval?: boolean;
1169
+ /**
1170
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1171
+ * `false` keeps this function out of WebMCP while leaving it available to the
1172
+ * in-app agent.
1173
+ */
1174
+ webmcp?: WebMCPToolMeta | false;
1175
+ }
1176
+
1049
1177
  /** See {@link AgoConfig.clientFunctionsMode}. */
1050
1178
  declare type ClientFunctionsMode = "placeholder" | "pause";
1051
1179
 
@@ -1092,6 +1220,30 @@ declare interface Conversation {
1092
1220
  messages?: AgoMessage[];
1093
1221
  }
1094
1222
 
1223
+ /** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
1224
+ declare interface CreateTicketInput {
1225
+ subject: string;
1226
+ body: string;
1227
+ priority?: string;
1228
+ typology?: string;
1229
+ /** Conversation the ticket is filed from. */
1230
+ conversationId?: string;
1231
+ /** Reporter email, for a visitor the SDK does not otherwise identify. */
1232
+ email?: string;
1233
+ customFields?: Array<{
1234
+ id: string;
1235
+ value: string;
1236
+ }>;
1237
+ files?: File[];
1238
+ ticketFormId?: string;
1239
+ }
1240
+
1241
+ /** Response of `AgoClient.createTicket`. */
1242
+ declare interface CreateTicketResult {
1243
+ id: string;
1244
+ url?: string;
1245
+ }
1246
+
1095
1247
  /** Options for {@link initDevPanel}. */
1096
1248
  export declare interface DevPanelOptions {
1097
1249
  /**
@@ -1130,6 +1282,23 @@ export declare interface DevPanelOptions {
1130
1282
  */
1131
1283
  declare type DynamicContextProvider = () => ContextEntry | null | undefined;
1132
1284
 
1285
+ declare interface ErrorWatcherOptions {
1286
+ /** Max distinct errors kept. Oldest dropped first. Default 10. */
1287
+ maxErrors?: number;
1288
+ /**
1289
+ * Errors older than this are pruned when the buffer is read, so a crash from
1290
+ * an hour ago does not confuse the agent. Default 600 000 (10 min).
1291
+ */
1292
+ maxAgeMs?: number;
1293
+ /** Max chars of stack kept per error. Default 2000. */
1294
+ maxStackChars?: number;
1295
+ /**
1296
+ * Redact or drop an error before it is stored. Return the (possibly edited)
1297
+ * error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
1298
+ */
1299
+ filter?: (error: CapturedError) => CapturedError | null;
1300
+ }
1301
+
1133
1302
  /**
1134
1303
  * Why the user is reporting a message (see `AgoClient.submitFeedback`).
1135
1304
  *
@@ -1492,12 +1661,26 @@ declare interface ProactiveTriggerWhen {
1492
1661
  pageState?: Partial<Record<string, unknown>>;
1493
1662
  /** Min rage-click bursts on the current route. */
1494
1663
  rageClicks?: number;
1664
+ /**
1665
+ * Min JavaScript errors captured on the current route. Needs the client's
1666
+ * `errorWatcher` enabled; without it the count stays at 0 and the matcher
1667
+ * never passes.
1668
+ */
1669
+ jsErrors?: number;
1495
1670
  /** Min A→B→A→B route oscillations this session. */
1496
1671
  routeBounces?: number;
1497
1672
  /** Per-field minimum error counts (field NAME → min count). */
1498
1673
  fieldErrors?: Record<string, number>;
1499
1674
  }
1500
1675
 
1676
+ /**
1677
+ * Registered function with handler
1678
+ */
1679
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1680
+ schema: ClientFunctionSchema;
1681
+ handler: ClientFunctionHandler;
1682
+ }
1683
+
1501
1684
  /**
1502
1685
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1503
1686
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1509,10 +1692,71 @@ declare type ResumeGate = (info: {
1509
1692
  messageId: string;
1510
1693
  }) => Promise<void> | void;
1511
1694
 
1695
+ /** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
1696
+ declare interface SdkConfig {
1697
+ permissions: SdkPermissionConfig[];
1698
+ proactive: {
1699
+ enabled: boolean;
1700
+ };
1701
+ }
1702
+
1703
+ /** The dashboard's home screen content (title, subtitle, starter cards). */
1704
+ declare interface SdkHomePageConfig {
1705
+ title?: string;
1706
+ /** Markdown. */
1707
+ subtitle?: string;
1708
+ starters: SdkHomeStarter[];
1709
+ widgetStarter?: SdkWidgetStarter;
1710
+ }
1711
+
1712
+ /**
1713
+ * A conversation starter card configured in the AGO dashboard. `label` is what
1714
+ * the card shows; clicking it sends `message`.
1715
+ */
1716
+ declare interface SdkHomeStarter {
1717
+ id: string;
1718
+ /** The card's text (the starter's `description` in the dashboard). */
1719
+ label: string;
1720
+ /** What is sent when the card is clicked. */
1721
+ message: string;
1722
+ /** Answer with this agent instead of the configured default. */
1723
+ agentId?: string;
1724
+ }
1725
+
1726
+ /** One permission's configuration in {@link SdkConfig}. */
1727
+ declare interface SdkPermissionConfig {
1728
+ id?: string;
1729
+ name?: string;
1730
+ displayName?: string;
1731
+ agents: Array<{
1732
+ id: string;
1733
+ name?: string;
1734
+ }>;
1735
+ ticketForm?: TicketForm;
1736
+ /** Home screen content, when the tenant configured one. */
1737
+ homePage?: SdkHomePageConfig;
1738
+ fileAttachmentsEnabled: boolean;
1739
+ voiceEnabled: boolean;
1740
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1741
+ speechToTextEnabled: boolean;
1742
+ }
1743
+
1744
+ /**
1745
+ * The starter the dashboard sends by itself on a fresh visit, before the
1746
+ * visitor types anything.
1747
+ */
1748
+ declare interface SdkWidgetStarter {
1749
+ id: string;
1750
+ message: string;
1751
+ agentId?: string;
1752
+ }
1753
+
1512
1754
  /**
1513
1755
  * Options for sending a message
1514
1756
  */
1515
1757
  declare interface SendMessageOptions {
1758
+ /** Replaces config.metadata for this message; null omits metadata for this message. */
1759
+ metadata?: Record<string, unknown> | null;
1516
1760
  /** Existing conversation ID */
1517
1761
  conversationId?: string;
1518
1762
  /** Override default agent */
@@ -1561,6 +1805,12 @@ declare interface SignalsSnapshot {
1561
1805
  idleMs: number;
1562
1806
  /** Rage-click bursts detected on the current route. */
1563
1807
  rageClicks: number;
1808
+ /**
1809
+ * JavaScript errors captured on the current route (count only; the messages
1810
+ * travel in `client_context` under `errors:recent`). Always `0` unless the
1811
+ * client has `errorWatcher` enabled.
1812
+ */
1813
+ jsErrors: number;
1564
1814
  /**
1565
1815
  * A→B→A→B route oscillations detected in the recent route sequence. Rolling
1566
1816
  * session counter (cross-route by nature); trigger cooldowns and dismissal
@@ -1619,6 +1869,13 @@ declare interface SSEChunkData {
1619
1869
  follow_up_replies?: string[];
1620
1870
  satisfaction_feedback?: unknown;
1621
1871
  ask_to_talk_to_human?: boolean;
1872
+ allowed_to_create_ticket?: boolean;
1873
+ ticket?: ToolCallTicketPrefill;
1874
+ mode?: "form" | "embed";
1875
+ ticket_form_id?: string;
1876
+ embed_html?: string;
1877
+ embed_description?: string;
1878
+ display_mode?: "collapsible" | "display" | "both";
1622
1879
  /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
1623
1880
  waiting_tool_call_ids?: string[];
1624
1881
  }
@@ -1672,12 +1929,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
1672
1929
  declare interface SubmitToolCallResult {
1673
1930
  status: string;
1674
1931
  result?: unknown;
1932
+ /** Set when `status` is `"error"`. */
1933
+ error?: string;
1934
+ /** The ticket a ticketing `form` tool call resolved to, when it did. */
1935
+ ticket?: {
1936
+ ticket_id: string;
1937
+ ticket_url?: string;
1938
+ [key: string]: unknown;
1939
+ };
1675
1940
  resume?: {
1676
1941
  message_id: string;
1677
1942
  ready: boolean;
1678
1943
  };
1679
1944
  }
1680
1945
 
1946
+ /** A custom field of a ticket form. */
1947
+ declare interface TicketField {
1948
+ id: string;
1949
+ /** The key the ticketing backend expects; used as the submit key when set. */
1950
+ externalId?: string;
1951
+ title?: string;
1952
+ /** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
1953
+ type?: string;
1954
+ required: boolean;
1955
+ /** Carried in the submission but never shown. */
1956
+ hidden: boolean;
1957
+ active?: boolean;
1958
+ /** Bypass progressive disclosure, while still respecting conditions. */
1959
+ alwaysVisible?: boolean;
1960
+ regexpForValidation?: string;
1961
+ position: number;
1962
+ /** Non-empty turns the field into a select. */
1963
+ options: TicketFieldOption[];
1964
+ /** Show this field only when the parent field holds `conditionalFieldValue`. */
1965
+ conditionalFieldId?: string;
1966
+ /** Legacy comma-separated condition values. */
1967
+ conditionalFieldValue?: string;
1968
+ /** Takes precedence over conditionalFieldValue when non-empty. */
1969
+ conditionalFieldValues?: string[];
1970
+ }
1971
+
1972
+ /** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
1973
+ declare interface TicketFieldOption {
1974
+ id: string;
1975
+ /** Label shown to the user. */
1976
+ name?: string;
1977
+ /** Value submitted. Falls back to `name` when absent. */
1978
+ value?: string;
1979
+ /** Preselected when the form opens. */
1980
+ default: boolean;
1981
+ /** A note shown under the field once this option is picked. */
1982
+ message?: string;
1983
+ messageType: "info" | "warning" | "danger";
1984
+ position?: number;
1985
+ group?: string;
1986
+ noDisplay?: boolean;
1987
+ conditionalFieldId?: string;
1988
+ /** Available when the parent matches any of these values. */
1989
+ conditionalFieldValues?: string[];
1990
+ }
1991
+
1992
+ /** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
1993
+ declare interface TicketForm {
1994
+ id: string;
1995
+ name?: string;
1996
+ /** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
1997
+ mode: "form" | "embed";
1998
+ showSubject: boolean;
1999
+ showBody: boolean;
2000
+ showPriority: boolean;
2001
+ showTypology: boolean;
2002
+ priorityTypologies?: string[];
2003
+ successMessageText?: string;
2004
+ successMessageUrlLabel?: string;
2005
+ fields: TicketField[];
2006
+ }
2007
+
1681
2008
  /**
1682
2009
  * Tool call data from SSE stream
1683
2010
  */
@@ -1692,8 +2019,61 @@ declare interface ToolCallData {
1692
2019
  data?: Record<string, unknown>;
1693
2020
  functionName?: string;
1694
2021
  arguments?: Record<string, unknown>;
2022
+ /**
2023
+ * Where the hosted widget shows the call: in the collapsible "reasoning"
2024
+ * section, in the message body, or both. Absent means collapsible only.
2025
+ */
2026
+ displayMode?: "collapsible" | "display" | "both";
2027
+ /** The user asked to talk to a human. */
2028
+ askToTalkToHuman?: boolean;
2029
+ /** `false` when the tenant blocks ticket creation for this visitor. */
2030
+ allowedToCreateTicket?: boolean;
2031
+ /** Fields the agent pre-filled from the conversation. */
2032
+ ticket?: ToolCallTicketPrefill;
2033
+ /** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
2034
+ mode?: "form" | "embed";
2035
+ ticketFormId?: string;
2036
+ embedHtml?: string;
2037
+ embedDescription?: string;
2038
+ }
2039
+
2040
+ /** The ticket the agent pre-filled on a ticketing `form` tool call. */
2041
+ declare interface ToolCallTicketPrefill {
2042
+ subject?: string;
2043
+ body?: string;
2044
+ typology?: string;
2045
+ priority?: string;
2046
+ tag?: string;
2047
+ products?: string[];
2048
+ /** Keyed by the field's external id, or a lowercased, underscored title. */
2049
+ custom_fields?: Record<string, string>;
1695
2050
  }
1696
2051
 
1697
2052
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
1698
2053
 
2054
+ /** Options for `AgoClient.transcribeAudio`. */
2055
+ declare interface TranscribeAudioOptions {
2056
+ /** Cancel the upload or stop waiting for its transcription. */
2057
+ signal?: AbortSignal;
2058
+ }
2059
+
2060
+ /** The MCP behavior hints AGO has no equivalent for. */
2061
+ declare interface WebMCPToolMeta {
2062
+ /**
2063
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
2064
+ * function that changes nothing, `untrustedContentHint` one whose result may
2065
+ * carry third-party text.
2066
+ */
2067
+ annotations?: {
2068
+ readOnlyHint?: boolean;
2069
+ untrustedContentHint?: boolean;
2070
+ };
2071
+ /**
2072
+ * This function navigates. The WebMCP call is held open until the function
2073
+ * registry goes quiet, so the caller sees the destination page's tools rather
2074
+ * than the departing page's. Already set on the built-in `navigateToPage`.
2075
+ */
2076
+ navigates?: boolean;
2077
+ }
2078
+
1699
2079
  export { }