@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
package/dist/testing.d.ts CHANGED
@@ -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.
277
309
  */
278
- submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
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.
327
+ */
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
  *
@@ -1059,6 +1201,30 @@ declare interface Conversation {
1059
1201
  */
1060
1202
  export declare function createMockClient(options?: MockAgoClientOptions): MockAgoClient;
1061
1203
 
1204
+ /** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
1205
+ declare interface CreateTicketInput {
1206
+ subject: string;
1207
+ body: string;
1208
+ priority?: string;
1209
+ typology?: string;
1210
+ /** Conversation the ticket is filed from. */
1211
+ conversationId?: string;
1212
+ /** Reporter email, for a visitor the SDK does not otherwise identify. */
1213
+ email?: string;
1214
+ customFields?: Array<{
1215
+ id: string;
1216
+ value: string;
1217
+ }>;
1218
+ files?: File[];
1219
+ ticketFormId?: string;
1220
+ }
1221
+
1222
+ /** Response of `AgoClient.createTicket`. */
1223
+ declare interface CreateTicketResult {
1224
+ id: string;
1225
+ url?: string;
1226
+ }
1227
+
1062
1228
  /**
1063
1229
  * A function that returns a fresh context entry on demand.
1064
1230
  * Evaluated every time a message is sent — use it to pull data from stores,
@@ -1066,6 +1232,54 @@ export declare function createMockClient(options?: MockAgoClientOptions): MockAg
1066
1232
  */
1067
1233
  declare type DynamicContextProvider = () => ContextEntry | null | undefined;
1068
1234
 
1235
+ declare interface ErrorWatcherOptions {
1236
+ /** Max distinct errors kept. Oldest dropped first. Default 10. */
1237
+ maxErrors?: number;
1238
+ /**
1239
+ * Errors older than this are pruned when the buffer is read, so a crash from
1240
+ * an hour ago does not confuse the agent. Default 600 000 (10 min).
1241
+ */
1242
+ maxAgeMs?: number;
1243
+ /** Max chars of stack kept per error. Default 2000. */
1244
+ maxStackChars?: number;
1245
+ /**
1246
+ * Redact or drop an error before it is stored. Return the (possibly edited)
1247
+ * error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
1248
+ */
1249
+ filter?: (error: CapturedError) => CapturedError | null;
1250
+ }
1251
+
1252
+ /**
1253
+ * Why the user is reporting a message (see `AgoClient.submitFeedback`).
1254
+ *
1255
+ * A rating on its own is a reaction (the thumbs count). Add a reason or a
1256
+ * comment and the report also lands in the feedback dashboard, the analytics
1257
+ * and the CSV export, where someone can act on it.
1258
+ */
1259
+ declare interface FeedbackDetails {
1260
+ /** What went wrong. Several can apply at once. */
1261
+ reasons?: FeedbackReason[];
1262
+ /** The user's own words. Trimmed server-side; 5000 characters max. */
1263
+ comment?: string;
1264
+ }
1265
+
1266
+ /** Thumbs up / thumbs down on an answer. */
1267
+ declare type FeedbackRating = "positive" | "negative";
1268
+
1269
+ /**
1270
+ * What went wrong with an answer. These are the four buckets the AGO feedback
1271
+ * dashboard filters and charts on.
1272
+ */
1273
+ declare type FeedbackReason =
1274
+ /** The answer states something false. */
1275
+ "inaccurate"
1276
+ /** The answer is right but stops short. */
1277
+ | "incomplete"
1278
+ /** The agent could not find the information. */
1279
+ | "information_not_found"
1280
+ /** Something broke: the widget, a tool call, the stream. */
1281
+ | "technical_issue";
1282
+
1069
1283
  /**
1070
1284
  * The backend-stored shape returned by `GET /api/sdk/v1/forms/{name}` (see
1071
1285
  * {@link AgoClient.getFormCollector}). Mirrors the persistable subset of
@@ -1425,6 +1639,12 @@ declare interface ProactiveTriggerWhen {
1425
1639
  pageState?: Partial<Record<string, unknown>>;
1426
1640
  /** Min rage-click bursts on the current route. */
1427
1641
  rageClicks?: number;
1642
+ /**
1643
+ * Min JavaScript errors captured on the current route. Needs the client's
1644
+ * `errorWatcher` enabled; without it the count stays at 0 and the matcher
1645
+ * never passes.
1646
+ */
1647
+ jsErrors?: number;
1428
1648
  /** Min A→B→A→B route oscillations this session. */
1429
1649
  routeBounces?: number;
1430
1650
  /** Per-field minimum error counts (field NAME → min count). */
@@ -1442,10 +1662,69 @@ declare type ResumeGate = (info: {
1442
1662
  messageId: string;
1443
1663
  }) => Promise<void> | void;
1444
1664
 
1665
+ /** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
1666
+ declare interface SdkConfig {
1667
+ permissions: SdkPermissionConfig[];
1668
+ proactive: {
1669
+ enabled: boolean;
1670
+ };
1671
+ }
1672
+
1673
+ /** The dashboard's home screen content (title, subtitle, starter cards). */
1674
+ declare interface SdkHomePageConfig {
1675
+ title?: string;
1676
+ /** Markdown. */
1677
+ subtitle?: string;
1678
+ starters: SdkHomeStarter[];
1679
+ widgetStarter?: SdkWidgetStarter;
1680
+ }
1681
+
1682
+ /**
1683
+ * A conversation starter card configured in the AGO dashboard. `label` is what
1684
+ * the card shows; clicking it sends `message`.
1685
+ */
1686
+ declare interface SdkHomeStarter {
1687
+ id: string;
1688
+ /** The card's text (the starter's `description` in the dashboard). */
1689
+ label: string;
1690
+ /** What is sent when the card is clicked. */
1691
+ message: string;
1692
+ /** Answer with this agent instead of the configured default. */
1693
+ agentId?: string;
1694
+ }
1695
+
1696
+ /** One permission's configuration in {@link SdkConfig}. */
1697
+ declare interface SdkPermissionConfig {
1698
+ id?: string;
1699
+ name?: string;
1700
+ displayName?: string;
1701
+ agents: Array<{
1702
+ id: string;
1703
+ name?: string;
1704
+ }>;
1705
+ ticketForm?: TicketForm;
1706
+ /** Home screen content, when the tenant configured one. */
1707
+ homePage?: SdkHomePageConfig;
1708
+ fileAttachmentsEnabled: boolean;
1709
+ voiceEnabled: boolean;
1710
+ }
1711
+
1712
+ /**
1713
+ * The starter the dashboard sends by itself on a fresh visit, before the
1714
+ * visitor types anything.
1715
+ */
1716
+ declare interface SdkWidgetStarter {
1717
+ id: string;
1718
+ message: string;
1719
+ agentId?: string;
1720
+ }
1721
+
1445
1722
  /**
1446
1723
  * Options for sending a message
1447
1724
  */
1448
1725
  declare interface SendMessageOptions {
1726
+ /** Replaces config.metadata for this message; null omits metadata for this message. */
1727
+ metadata?: Record<string, unknown> | null;
1449
1728
  /** Existing conversation ID */
1450
1729
  conversationId?: string;
1451
1730
  /** Override default agent */
@@ -1494,6 +1773,12 @@ declare interface SignalsSnapshot {
1494
1773
  idleMs: number;
1495
1774
  /** Rage-click bursts detected on the current route. */
1496
1775
  rageClicks: number;
1776
+ /**
1777
+ * JavaScript errors captured on the current route (count only; the messages
1778
+ * travel in `client_context` under `errors:recent`). Always `0` unless the
1779
+ * client has `errorWatcher` enabled.
1780
+ */
1781
+ jsErrors: number;
1497
1782
  /**
1498
1783
  * A→B→A→B route oscillations detected in the recent route sequence. Rolling
1499
1784
  * session counter (cross-route by nature); trigger cooldowns and dismissal
@@ -1552,6 +1837,13 @@ declare interface SSEChunkData {
1552
1837
  follow_up_replies?: string[];
1553
1838
  satisfaction_feedback?: unknown;
1554
1839
  ask_to_talk_to_human?: boolean;
1840
+ allowed_to_create_ticket?: boolean;
1841
+ ticket?: ToolCallTicketPrefill;
1842
+ mode?: "form" | "embed";
1843
+ ticket_form_id?: string;
1844
+ embed_html?: string;
1845
+ embed_description?: string;
1846
+ display_mode?: "collapsible" | "display" | "both";
1555
1847
  /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
1556
1848
  waiting_tool_call_ids?: string[];
1557
1849
  }
@@ -1605,12 +1897,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
1605
1897
  declare interface SubmitToolCallResult {
1606
1898
  status: string;
1607
1899
  result?: unknown;
1900
+ /** Set when `status` is `"error"`. */
1901
+ error?: string;
1902
+ /** The ticket a ticketing `form` tool call resolved to, when it did. */
1903
+ ticket?: {
1904
+ ticket_id: string;
1905
+ ticket_url?: string;
1906
+ [key: string]: unknown;
1907
+ };
1608
1908
  resume?: {
1609
1909
  message_id: string;
1610
1910
  ready: boolean;
1611
1911
  };
1612
1912
  }
1613
1913
 
1914
+ /** A custom field of a ticket form. */
1915
+ declare interface TicketField {
1916
+ id: string;
1917
+ /** The key the ticketing backend expects; used as the submit key when set. */
1918
+ externalId?: string;
1919
+ title?: string;
1920
+ /** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
1921
+ type?: string;
1922
+ required: boolean;
1923
+ /** Carried in the submission but never shown. */
1924
+ hidden: boolean;
1925
+ active?: boolean;
1926
+ /** Bypass progressive disclosure, while still respecting conditions. */
1927
+ alwaysVisible?: boolean;
1928
+ regexpForValidation?: string;
1929
+ position: number;
1930
+ /** Non-empty turns the field into a select. */
1931
+ options: TicketFieldOption[];
1932
+ /** Show this field only when the parent field holds `conditionalFieldValue`. */
1933
+ conditionalFieldId?: string;
1934
+ /** Legacy comma-separated condition values. */
1935
+ conditionalFieldValue?: string;
1936
+ /** Takes precedence over conditionalFieldValue when non-empty. */
1937
+ conditionalFieldValues?: string[];
1938
+ }
1939
+
1940
+ /** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
1941
+ declare interface TicketFieldOption {
1942
+ id: string;
1943
+ /** Label shown to the user. */
1944
+ name?: string;
1945
+ /** Value submitted. Falls back to `name` when absent. */
1946
+ value?: string;
1947
+ /** Preselected when the form opens. */
1948
+ default: boolean;
1949
+ /** A note shown under the field once this option is picked. */
1950
+ message?: string;
1951
+ messageType: "info" | "warning" | "danger";
1952
+ position?: number;
1953
+ group?: string;
1954
+ noDisplay?: boolean;
1955
+ conditionalFieldId?: string;
1956
+ /** Available when the parent matches any of these values. */
1957
+ conditionalFieldValues?: string[];
1958
+ }
1959
+
1960
+ /** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
1961
+ declare interface TicketForm {
1962
+ id: string;
1963
+ name?: string;
1964
+ /** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
1965
+ mode: "form" | "embed";
1966
+ showSubject: boolean;
1967
+ showBody: boolean;
1968
+ showPriority: boolean;
1969
+ showTypology: boolean;
1970
+ priorityTypologies?: string[];
1971
+ successMessageText?: string;
1972
+ successMessageUrlLabel?: string;
1973
+ fields: TicketField[];
1974
+ }
1975
+
1614
1976
  /**
1615
1977
  * Tool call data from SSE stream
1616
1978
  */
@@ -1625,6 +1987,34 @@ declare interface ToolCallData {
1625
1987
  data?: Record<string, unknown>;
1626
1988
  functionName?: string;
1627
1989
  arguments?: Record<string, unknown>;
1990
+ /**
1991
+ * Where the hosted widget shows the call: in the collapsible "reasoning"
1992
+ * section, in the message body, or both. Absent means collapsible only.
1993
+ */
1994
+ displayMode?: "collapsible" | "display" | "both";
1995
+ /** The user asked to talk to a human. */
1996
+ askToTalkToHuman?: boolean;
1997
+ /** `false` when the tenant blocks ticket creation for this visitor. */
1998
+ allowedToCreateTicket?: boolean;
1999
+ /** Fields the agent pre-filled from the conversation. */
2000
+ ticket?: ToolCallTicketPrefill;
2001
+ /** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
2002
+ mode?: "form" | "embed";
2003
+ ticketFormId?: string;
2004
+ embedHtml?: string;
2005
+ embedDescription?: string;
2006
+ }
2007
+
2008
+ /** The ticket the agent pre-filled on a ticketing `form` tool call. */
2009
+ declare interface ToolCallTicketPrefill {
2010
+ subject?: string;
2011
+ body?: string;
2012
+ typology?: string;
2013
+ priority?: string;
2014
+ tag?: string;
2015
+ products?: string[];
2016
+ /** Keyed by the field's external id, or a lowercased, underscored title. */
2017
+ custom_fields?: Record<string, string>;
1628
2018
  }
1629
2019
 
1630
2020
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
package/dist/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createMockClient-BDLW6tVc.js";
1
+ import { t as e } from "./createMockClient-Beao82tu.js";
2
2
  export {
3
3
  e as createMockClient
4
4
  };