@useago/sdk 1.7.2 → 1.12.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 (51) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +96 -1
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +402 -5
  5. package/dist/angular.d.ts +402 -5
  6. package/dist/angular.js +11 -7
  7. package/dist/{createConversationSession-DP90nY71.js → createConversationSession-B1Qn-y0I.js} +3 -3
  8. package/dist/createConversationSession-B3v_xOU7.cjs +1 -0
  9. package/dist/createFormCollector-FvwDOqnV.cjs +1 -0
  10. package/dist/{createFormCollector-BivHRIAe.js → createFormCollector-m79zk_NA.js} +1 -1
  11. package/dist/createMockClient-BEOXI8yW.cjs +1 -0
  12. package/dist/{createMockClient-BDLW6tVc.js → createMockClient-Beao82tu.js} +31 -18
  13. package/dist/devtools.cjs +61 -12
  14. package/dist/devtools.d.cts +403 -5
  15. package/dist/devtools.d.ts +403 -5
  16. package/dist/devtools.js +225 -73
  17. package/dist/errors-BLfjXnLB.js +32 -0
  18. package/dist/errors-o1IB5fEu.cjs +1 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +489 -7
  21. package/dist/index.d.ts +489 -7
  22. package/dist/index.js +124 -118
  23. package/dist/react.cjs +4 -4
  24. package/dist/react.d.cts +510 -3
  25. package/dist/react.d.ts +510 -3
  26. package/dist/react.js +1036 -752
  27. package/dist/sheetController-BThJRtOu.cjs +1 -0
  28. package/dist/sheetController-aEKXIvjk.js +343 -0
  29. package/dist/testing.cjs +1 -1
  30. package/dist/testing.d.cts +393 -3
  31. package/dist/testing.d.ts +393 -3
  32. package/dist/testing.js +1 -1
  33. package/dist/types-Ct1hlKwg.js +2408 -0
  34. package/dist/types-mcW8vB1U.cjs +10 -0
  35. package/dist/vue.cjs +1 -1
  36. package/dist/vue.d.cts +615 -3
  37. package/dist/vue.d.ts +615 -3
  38. package/dist/vue.js +202 -154
  39. package/dist/widget.cjs +6 -4
  40. package/dist/widget.d.cts +733 -5
  41. package/dist/widget.d.ts +733 -5
  42. package/dist/widget.js +3996 -786
  43. package/llms-full.txt +264 -31
  44. package/package.json +1 -1
  45. package/dist/AgoClient-7yXQ6R3O.cjs +0 -9
  46. package/dist/AgoClient-DTkBRGFE.js +0 -1965
  47. package/dist/createConversationSession-Bv6a15E0.cjs +0 -1
  48. package/dist/createFormCollector-CwfiYn0V.cjs +0 -1
  49. package/dist/createMockClient-BSNuN3ys.cjs +0 -1
  50. package/dist/sheetController-CBUVOroo.js +0 -205
  51. package/dist/sheetController-DY-sC13T.cjs +0 -1
@@ -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). */
@@ -222,6 +223,26 @@ declare class AgoClient {
222
223
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
223
224
  */
224
225
  private static mapPersistedToolCalls;
226
+ /**
227
+ * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
228
+ * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
229
+ * file-attachment flag. The vanilla widget fetches it once, when a ticket
230
+ * form first appears in a conversation.
231
+ */
232
+ getConfig(): Promise<SdkConfig>;
233
+ /**
234
+ * The dashboard's home screen content. A starter card shows its
235
+ * `description` and sends its `initial_message`; one with neither is
236
+ * unusable and is dropped rather than rendered as an empty card.
237
+ */
238
+ private static mapHomePage;
239
+ private static mapTicketForm;
240
+ /**
241
+ * Create a support ticket (`POST /api/sdk/v1/tickets`, multipart). This is
242
+ * what the ticket form in the conversation does before it completes the
243
+ * `form` tool call with {@link submitToolCallForm}.
244
+ */
245
+ createTicket(input: CreateTicketInput): Promise<CreateTicketResult>;
225
246
  /**
226
247
  * Get messages for a conversation
227
248
  */
@@ -273,9 +294,40 @@ declare class AgoClient {
273
294
  */
274
295
  submitFormCollector(name: string, values: Record<string, unknown>): Promise<unknown>;
275
296
  /**
276
- * Submit feedback for a message
297
+ * Report an answer: thumbs up/down, optionally with what went wrong.
298
+ *
299
+ * ```ts
300
+ * await client.submitFeedback(message.id, "negative", {
301
+ * reasons: ["inaccurate"],
302
+ * comment: "The price it quoted is from last year.",
303
+ * });
304
+ * ```
305
+ *
306
+ * A bare rating is a reaction (the thumbs counted in the dashboard). Adding a
307
+ * reason or a comment also files it in the feedback list, the analytics and
308
+ * the CSV export, so someone can act on it.
309
+ */
310
+ submitFeedback(messageId: string, rating: FeedbackRating, details?: FeedbackDetails): Promise<void>;
311
+ /**
312
+ * Report a whole conversation ("this chat is not working").
313
+ *
314
+ * ```ts
315
+ * await client.submitConversationFeedback(conversationId, "negative", {
316
+ * reasons: ["information_not_found"],
317
+ * comment: "It never answered my question.",
318
+ * });
319
+ * ```
320
+ *
321
+ * Feedback is stored per message, so this attaches the report to the last
322
+ * answer of the conversation, which is the one the user is reacting to.
323
+ * Returns the message id it landed on.
324
+ *
325
+ * Pass `lastMessageId` when you already have it (the widget does) to skip the
326
+ * lookup round-trip.
277
327
  */
278
- submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
328
+ submitConversationFeedback(conversationId: string, rating: FeedbackRating, details?: FeedbackDetails & {
329
+ lastMessageId?: string;
330
+ }): Promise<string>;
279
331
  /**
280
332
  * Register a client-side function that AGO can call.
281
333
  * Accepts either a definition object or (name, handler, schema) args.
@@ -449,6 +501,15 @@ declare class AgoClient {
449
501
  /* Excluded from this release type: emitProactiveEvent */
450
502
  /* Excluded from this release type: getHttp */
451
503
  /* Excluded from this release type: getConfiguredAgent */
504
+ /**
505
+ * How the SDK identifies the visitor: the configured `userEmail`, and
506
+ * whether a `userJwt` is set. The ticket form asks for an email when it has
507
+ * neither.
508
+ */
509
+ getUserIdentity(): {
510
+ email?: string;
511
+ hasJwt: boolean;
512
+ };
452
513
  /**
453
514
  * Enable automatic capture of the current browser page (URL + title).
454
515
  * Injected as a dynamic context entry named `browser-page`.
@@ -471,6 +532,26 @@ declare class AgoClient {
471
532
  private addActivity;
472
533
  private recordAgentAction;
473
534
  private registerActivityContext;
535
+ /**
536
+ * Start capturing the page's JavaScript errors (uncaught exceptions,
537
+ * unhandled rejections, `console.error` calls, {@link reportError}) and send
538
+ * the recent ones as the `errors:recent` context entry on every message.
539
+ * Same as setting `errorWatcher` in the config. Calling it again replaces
540
+ * the watcher (and its options); the captured errors are not kept.
541
+ */
542
+ enableErrorWatcher(options?: ErrorWatcherOptions): void;
543
+ /** Stop capturing errors and drop the `errors:recent` context entry. */
544
+ disableErrorWatcher(): void;
545
+ /**
546
+ * Record an error the app caught itself (React error boundary, Vue
547
+ * `errorHandler`, Angular `ErrorHandler`, a try/catch) so the agent sees it
548
+ * like an uncaught one. No-op unless the error watcher is enabled. `context`
549
+ * is size-clamped before it is stored; keep it small and free of secrets.
550
+ */
551
+ reportError(error: unknown, context?: Record<string, unknown>): void;
552
+ /** Errors the watcher currently holds, oldest first (a copy). Empty when disabled. */
553
+ getRecentErrors(): CapturedError[];
554
+ clearErrors(): void;
474
555
  /**
475
556
  * Subscribe to an event
476
557
  */
@@ -665,6 +746,12 @@ declare interface AgoClientEvents {
665
746
  };
666
747
  /** A user- or agent-action was recorded into the activity ledger. */
667
748
  "activity:recorded": ActivityEntry;
749
+ /**
750
+ * The error watcher captured a JavaScript error (uncaught exception,
751
+ * unhandled rejection, `console.error` call, or `reportError`). Fires on
752
+ * repeats too, with the updated `count`. Requires `errorWatcher` in the config.
753
+ */
754
+ "error:captured": CapturedError;
668
755
  }
669
756
 
670
757
  /**
@@ -685,6 +772,8 @@ declare interface AgoConfig {
685
772
  userEmail?: string;
686
773
  /** JWT token for authenticated users */
687
774
  userJwt?: string;
775
+ /** User metadata sent with messages. Use null to stop sending defaults. Not an authentication credential. */
776
+ metadata?: Record<string, unknown> | null;
688
777
  /** Enable debug logging */
689
778
  debug?: boolean;
690
779
  /**
@@ -744,6 +833,18 @@ declare interface AgoConfig {
744
833
  * default otherwise.
745
834
  */
746
835
  proactive?: ProactiveOptions;
836
+ /**
837
+ * Capture the page's JavaScript errors as agent context. When set, the SDK
838
+ * listens for uncaught exceptions and unhandled promise rejections, wraps
839
+ * `console.error` (calling through; restored on `destroy`), and sends the
840
+ * recent errors (deduplicated, capped, pruned after 10 min) as the
841
+ * `errors:recent` context entry on every message. `true` uses the defaults;
842
+ * pass {@link ErrorWatcherOptions} to tune the caps or add a `filter` that
843
+ * redacts messages. Off by default: error messages can carry PII or internal
844
+ * URLs, so enabling it is the host's call. Errors also feed the proactive
845
+ * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
846
+ */
847
+ errorWatcher?: boolean | ErrorWatcherOptions;
747
848
  }
748
849
 
749
850
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -907,12 +1008,53 @@ declare interface AgoStateControl<T = unknown> {
907
1008
  enum?: (string | number)[];
908
1009
  };
909
1010
  };
1011
+ /** String-only: `""` means "clear" instead of being dropped as filler. */
1012
+ clearable?: boolean;
910
1013
  /** Current value → pushed as dynamic context so the agent knows what to change. */
911
1014
  get?: () => T;
912
1015
  /** Apply the state change on the page. May be async. */
913
- set: (value: T) => void | Promise<void>;
1016
+ set: (value: T) => void | AgoStateSetResult | Promise<void | AgoStateSetResult>;
914
1017
  }
915
1018
 
1019
+ /**
1020
+ * Tagged outcome a page setter may return to reject or mark unchanged.
1021
+ *
1022
+ * Returning nothing (void) means APPLY. Returning an unrecognized JS value
1023
+ * (e.g. a string from an assignment expression) is also treated as APPLY.
1024
+ */
1025
+ declare type AgoStateSetResult = {
1026
+ result: "rejected";
1027
+ reason: string;
1028
+ } | {
1029
+ result: "unchanged";
1030
+ };
1031
+
1032
+ /** One JavaScript error captured on the page (deduplicated, see `count`). */
1033
+ declare interface CapturedError {
1034
+ type: CapturedErrorType;
1035
+ /** Error message, truncated to 500 chars. */
1036
+ message: string;
1037
+ /** Script URL the error came from, without its query string. */
1038
+ source?: string;
1039
+ line?: number;
1040
+ col?: number;
1041
+ /** Leading stack frames, truncated (see `maxStackChars`). */
1042
+ stack?: string;
1043
+ /** Pathname at capture time. */
1044
+ route: string;
1045
+ /** Epoch ms of the first occurrence. */
1046
+ firstAt: number;
1047
+ /** Epoch ms of the most recent occurrence. */
1048
+ lastAt: number;
1049
+ /** How many times this same error (type + message + source + line) fired. */
1050
+ count: number;
1051
+ /** App-provided context, manual reports only (size-clamped). */
1052
+ context?: Record<string, unknown>;
1053
+ }
1054
+
1055
+ /** How an error reached the watcher. */
1056
+ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
1057
+
916
1058
  /**
917
1059
  * Single-object function definition — combines name, schema, and handler.
918
1060
  *
@@ -1046,6 +1188,30 @@ declare interface Conversation {
1046
1188
  messages?: AgoMessage[];
1047
1189
  }
1048
1190
 
1191
+ /** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
1192
+ declare interface CreateTicketInput {
1193
+ subject: string;
1194
+ body: string;
1195
+ priority?: string;
1196
+ typology?: string;
1197
+ /** Conversation the ticket is filed from. */
1198
+ conversationId?: string;
1199
+ /** Reporter email, for a visitor the SDK does not otherwise identify. */
1200
+ email?: string;
1201
+ customFields?: Array<{
1202
+ id: string;
1203
+ value: string;
1204
+ }>;
1205
+ files?: File[];
1206
+ ticketFormId?: string;
1207
+ }
1208
+
1209
+ /** Response of `AgoClient.createTicket`. */
1210
+ declare interface CreateTicketResult {
1211
+ id: string;
1212
+ url?: string;
1213
+ }
1214
+
1049
1215
  /** Options for {@link initDevPanel}. */
1050
1216
  export declare interface DevPanelOptions {
1051
1217
  /**
@@ -1053,7 +1219,9 @@ export declare interface DevPanelOptions {
1053
1219
  * function events, and renders the name + data of each entry in its live context
1054
1220
  * snapshot (`client.getContextSnapshot()`)
1055
1221
  */
1056
- client: Pick<AgoClient, "on" | "getRegisteredFunctions" | "getContextSnapshot">;
1222
+ client: Pick<AgoClient, "on" | "off" | "getRegisteredFunctions" | "getContextSnapshot"> & {
1223
+ executeClientFunction?: AgoClient["executeClientFunction"];
1224
+ };
1057
1225
  /** Where to mount: a CSS selector, an Element, or `document.body` (default). */
1058
1226
  target?: string | Element;
1059
1227
  /**
@@ -1067,6 +1235,12 @@ export declare interface DevPanelOptions {
1067
1235
  * page (one per widget): pass e.g. the agent or widget name to tell them apart.
1068
1236
  */
1069
1237
  label?: string;
1238
+ /**
1239
+ * Mount a local function runner in the panel. The runner executes registered
1240
+ * client functions locally via `client.executeClientFunction` and displays
1241
+ * the result. It never submits to the backend. Developer-only.
1242
+ */
1243
+ enableFunctionRunner?: boolean;
1070
1244
  }
1071
1245
 
1072
1246
  /**
@@ -1076,6 +1250,54 @@ export declare interface DevPanelOptions {
1076
1250
  */
1077
1251
  declare type DynamicContextProvider = () => ContextEntry | null | undefined;
1078
1252
 
1253
+ declare interface ErrorWatcherOptions {
1254
+ /** Max distinct errors kept. Oldest dropped first. Default 10. */
1255
+ maxErrors?: number;
1256
+ /**
1257
+ * Errors older than this are pruned when the buffer is read, so a crash from
1258
+ * an hour ago does not confuse the agent. Default 600 000 (10 min).
1259
+ */
1260
+ maxAgeMs?: number;
1261
+ /** Max chars of stack kept per error. Default 2000. */
1262
+ maxStackChars?: number;
1263
+ /**
1264
+ * Redact or drop an error before it is stored. Return the (possibly edited)
1265
+ * error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
1266
+ */
1267
+ filter?: (error: CapturedError) => CapturedError | null;
1268
+ }
1269
+
1270
+ /**
1271
+ * Why the user is reporting a message (see `AgoClient.submitFeedback`).
1272
+ *
1273
+ * A rating on its own is a reaction (the thumbs count). Add a reason or a
1274
+ * comment and the report also lands in the feedback dashboard, the analytics
1275
+ * and the CSV export, where someone can act on it.
1276
+ */
1277
+ declare interface FeedbackDetails {
1278
+ /** What went wrong. Several can apply at once. */
1279
+ reasons?: FeedbackReason[];
1280
+ /** The user's own words. Trimmed server-side; 5000 characters max. */
1281
+ comment?: string;
1282
+ }
1283
+
1284
+ /** Thumbs up / thumbs down on an answer. */
1285
+ declare type FeedbackRating = "positive" | "negative";
1286
+
1287
+ /**
1288
+ * What went wrong with an answer. These are the four buckets the AGO feedback
1289
+ * dashboard filters and charts on.
1290
+ */
1291
+ declare type FeedbackReason =
1292
+ /** The answer states something false. */
1293
+ "inaccurate"
1294
+ /** The answer is right but stops short. */
1295
+ | "incomplete"
1296
+ /** The agent could not find the information. */
1297
+ | "information_not_found"
1298
+ /** Something broke: the widget, a tool call, the stream. */
1299
+ | "technical_issue";
1300
+
1079
1301
  /**
1080
1302
  * The backend-stored shape returned by `GET /api/sdk/v1/forms/{name}` (see
1081
1303
  * {@link AgoClient.getFormCollector}). Mirrors the persistable subset of
@@ -1217,7 +1439,7 @@ declare class HttpClient {
1217
1439
  private handleErrorResponse;
1218
1440
  }
1219
1441
 
1220
- export declare function initDevPanel(options: DevPanelOptions): void;
1442
+ export declare function initDevPanel(options: DevPanelOptions): () => void;
1221
1443
 
1222
1444
  declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
1223
1445
  /**
@@ -1407,6 +1629,12 @@ declare interface ProactiveTriggerWhen {
1407
1629
  pageState?: Partial<Record<string, unknown>>;
1408
1630
  /** Min rage-click bursts on the current route. */
1409
1631
  rageClicks?: number;
1632
+ /**
1633
+ * Min JavaScript errors captured on the current route. Needs the client's
1634
+ * `errorWatcher` enabled; without it the count stays at 0 and the matcher
1635
+ * never passes.
1636
+ */
1637
+ jsErrors?: number;
1410
1638
  /** Min A→B→A→B route oscillations this session. */
1411
1639
  routeBounces?: number;
1412
1640
  /** Per-field minimum error counts (field NAME → min count). */
@@ -1424,10 +1652,69 @@ declare type ResumeGate = (info: {
1424
1652
  messageId: string;
1425
1653
  }) => Promise<void> | void;
1426
1654
 
1655
+ /** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
1656
+ declare interface SdkConfig {
1657
+ permissions: SdkPermissionConfig[];
1658
+ proactive: {
1659
+ enabled: boolean;
1660
+ };
1661
+ }
1662
+
1663
+ /** The dashboard's home screen content (title, subtitle, starter cards). */
1664
+ declare interface SdkHomePageConfig {
1665
+ title?: string;
1666
+ /** Markdown. */
1667
+ subtitle?: string;
1668
+ starters: SdkHomeStarter[];
1669
+ widgetStarter?: SdkWidgetStarter;
1670
+ }
1671
+
1672
+ /**
1673
+ * A conversation starter card configured in the AGO dashboard. `label` is what
1674
+ * the card shows; clicking it sends `message`.
1675
+ */
1676
+ declare interface SdkHomeStarter {
1677
+ id: string;
1678
+ /** The card's text (the starter's `description` in the dashboard). */
1679
+ label: string;
1680
+ /** What is sent when the card is clicked. */
1681
+ message: string;
1682
+ /** Answer with this agent instead of the configured default. */
1683
+ agentId?: string;
1684
+ }
1685
+
1686
+ /** One permission's configuration in {@link SdkConfig}. */
1687
+ declare interface SdkPermissionConfig {
1688
+ id?: string;
1689
+ name?: string;
1690
+ displayName?: string;
1691
+ agents: Array<{
1692
+ id: string;
1693
+ name?: string;
1694
+ }>;
1695
+ ticketForm?: TicketForm;
1696
+ /** Home screen content, when the tenant configured one. */
1697
+ homePage?: SdkHomePageConfig;
1698
+ fileAttachmentsEnabled: boolean;
1699
+ voiceEnabled: boolean;
1700
+ }
1701
+
1702
+ /**
1703
+ * The starter the dashboard sends by itself on a fresh visit, before the
1704
+ * visitor types anything.
1705
+ */
1706
+ declare interface SdkWidgetStarter {
1707
+ id: string;
1708
+ message: string;
1709
+ agentId?: string;
1710
+ }
1711
+
1427
1712
  /**
1428
1713
  * Options for sending a message
1429
1714
  */
1430
1715
  declare interface SendMessageOptions {
1716
+ /** Replaces config.metadata for this message; null omits metadata for this message. */
1717
+ metadata?: Record<string, unknown> | null;
1431
1718
  /** Existing conversation ID */
1432
1719
  conversationId?: string;
1433
1720
  /** Override default agent */
@@ -1476,6 +1763,12 @@ declare interface SignalsSnapshot {
1476
1763
  idleMs: number;
1477
1764
  /** Rage-click bursts detected on the current route. */
1478
1765
  rageClicks: number;
1766
+ /**
1767
+ * JavaScript errors captured on the current route (count only; the messages
1768
+ * travel in `client_context` under `errors:recent`). Always `0` unless the
1769
+ * client has `errorWatcher` enabled.
1770
+ */
1771
+ jsErrors: number;
1479
1772
  /**
1480
1773
  * A→B→A→B route oscillations detected in the recent route sequence. Rolling
1481
1774
  * session counter (cross-route by nature); trigger cooldowns and dismissal
@@ -1534,6 +1827,13 @@ declare interface SSEChunkData {
1534
1827
  follow_up_replies?: string[];
1535
1828
  satisfaction_feedback?: unknown;
1536
1829
  ask_to_talk_to_human?: boolean;
1830
+ allowed_to_create_ticket?: boolean;
1831
+ ticket?: ToolCallTicketPrefill;
1832
+ mode?: "form" | "embed";
1833
+ ticket_form_id?: string;
1834
+ embed_html?: string;
1835
+ embed_description?: string;
1836
+ display_mode?: "collapsible" | "display" | "both";
1537
1837
  /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
1538
1838
  waiting_tool_call_ids?: string[];
1539
1839
  }
@@ -1587,12 +1887,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
1587
1887
  declare interface SubmitToolCallResult {
1588
1888
  status: string;
1589
1889
  result?: unknown;
1890
+ /** Set when `status` is `"error"`. */
1891
+ error?: string;
1892
+ /** The ticket a ticketing `form` tool call resolved to, when it did. */
1893
+ ticket?: {
1894
+ ticket_id: string;
1895
+ ticket_url?: string;
1896
+ [key: string]: unknown;
1897
+ };
1590
1898
  resume?: {
1591
1899
  message_id: string;
1592
1900
  ready: boolean;
1593
1901
  };
1594
1902
  }
1595
1903
 
1904
+ /** A custom field of a ticket form. */
1905
+ declare interface TicketField {
1906
+ id: string;
1907
+ /** The key the ticketing backend expects; used as the submit key when set. */
1908
+ externalId?: string;
1909
+ title?: string;
1910
+ /** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
1911
+ type?: string;
1912
+ required: boolean;
1913
+ /** Carried in the submission but never shown. */
1914
+ hidden: boolean;
1915
+ active?: boolean;
1916
+ /** Bypass progressive disclosure, while still respecting conditions. */
1917
+ alwaysVisible?: boolean;
1918
+ regexpForValidation?: string;
1919
+ position: number;
1920
+ /** Non-empty turns the field into a select. */
1921
+ options: TicketFieldOption[];
1922
+ /** Show this field only when the parent field holds `conditionalFieldValue`. */
1923
+ conditionalFieldId?: string;
1924
+ /** Legacy comma-separated condition values. */
1925
+ conditionalFieldValue?: string;
1926
+ /** Takes precedence over conditionalFieldValue when non-empty. */
1927
+ conditionalFieldValues?: string[];
1928
+ }
1929
+
1930
+ /** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
1931
+ declare interface TicketFieldOption {
1932
+ id: string;
1933
+ /** Label shown to the user. */
1934
+ name?: string;
1935
+ /** Value submitted. Falls back to `name` when absent. */
1936
+ value?: string;
1937
+ /** Preselected when the form opens. */
1938
+ default: boolean;
1939
+ /** A note shown under the field once this option is picked. */
1940
+ message?: string;
1941
+ messageType: "info" | "warning" | "danger";
1942
+ position?: number;
1943
+ group?: string;
1944
+ noDisplay?: boolean;
1945
+ conditionalFieldId?: string;
1946
+ /** Available when the parent matches any of these values. */
1947
+ conditionalFieldValues?: string[];
1948
+ }
1949
+
1950
+ /** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
1951
+ declare interface TicketForm {
1952
+ id: string;
1953
+ name?: string;
1954
+ /** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
1955
+ mode: "form" | "embed";
1956
+ showSubject: boolean;
1957
+ showBody: boolean;
1958
+ showPriority: boolean;
1959
+ showTypology: boolean;
1960
+ priorityTypologies?: string[];
1961
+ successMessageText?: string;
1962
+ successMessageUrlLabel?: string;
1963
+ fields: TicketField[];
1964
+ }
1965
+
1596
1966
  /**
1597
1967
  * Tool call data from SSE stream
1598
1968
  */
@@ -1607,6 +1977,34 @@ declare interface ToolCallData {
1607
1977
  data?: Record<string, unknown>;
1608
1978
  functionName?: string;
1609
1979
  arguments?: Record<string, unknown>;
1980
+ /**
1981
+ * Where the hosted widget shows the call: in the collapsible "reasoning"
1982
+ * section, in the message body, or both. Absent means collapsible only.
1983
+ */
1984
+ displayMode?: "collapsible" | "display" | "both";
1985
+ /** The user asked to talk to a human. */
1986
+ askToTalkToHuman?: boolean;
1987
+ /** `false` when the tenant blocks ticket creation for this visitor. */
1988
+ allowedToCreateTicket?: boolean;
1989
+ /** Fields the agent pre-filled from the conversation. */
1990
+ ticket?: ToolCallTicketPrefill;
1991
+ /** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
1992
+ mode?: "form" | "embed";
1993
+ ticketFormId?: string;
1994
+ embedHtml?: string;
1995
+ embedDescription?: string;
1996
+ }
1997
+
1998
+ /** The ticket the agent pre-filled on a ticketing `form` tool call. */
1999
+ declare interface ToolCallTicketPrefill {
2000
+ subject?: string;
2001
+ body?: string;
2002
+ typology?: string;
2003
+ priority?: string;
2004
+ tag?: string;
2005
+ products?: string[];
2006
+ /** Keyed by the field's external id, or a lowercased, underscored title. */
2007
+ custom_fields?: Record<string, string>;
1610
2008
  }
1611
2009
 
1612
2010
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";