@useago/sdk 1.9.0 → 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 (45) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +53 -0
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +313 -0
  5. package/dist/angular.d.ts +313 -0
  6. package/dist/angular.js +1 -1
  7. package/dist/{createConversationSession-BaaXBQ5b.js → createConversationSession-B1Qn-y0I.js} +1 -1
  8. package/dist/{createConversationSession-CU0b-t1W.cjs → createConversationSession-B3v_xOU7.cjs} +1 -1
  9. package/dist/{createFormCollector-DfN1xZBy.cjs → createFormCollector-FvwDOqnV.cjs} +1 -1
  10. package/dist/{createFormCollector-Cf7kGhCB.js → createFormCollector-m79zk_NA.js} +1 -1
  11. package/dist/createMockClient-BEOXI8yW.cjs +1 -0
  12. package/dist/{createMockClient-5YF-ZbVu.js → createMockClient-Beao82tu.js} +15 -3
  13. package/dist/devtools.d.cts +313 -0
  14. package/dist/devtools.d.ts +313 -0
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.d.cts +389 -4
  17. package/dist/index.d.ts +389 -4
  18. package/dist/index.js +118 -114
  19. package/dist/react.cjs +1 -1
  20. package/dist/react.d.cts +313 -0
  21. package/dist/react.d.ts +313 -0
  22. package/dist/react.js +8 -6
  23. package/dist/sheetController-BThJRtOu.cjs +1 -0
  24. package/dist/sheetController-aEKXIvjk.js +343 -0
  25. package/dist/testing.cjs +1 -1
  26. package/dist/testing.d.cts +313 -0
  27. package/dist/testing.d.ts +313 -0
  28. package/dist/testing.js +1 -1
  29. package/dist/types-Ct1hlKwg.js +2408 -0
  30. package/dist/types-mcW8vB1U.cjs +10 -0
  31. package/dist/vue.cjs +1 -1
  32. package/dist/vue.d.cts +505 -0
  33. package/dist/vue.d.ts +505 -0
  34. package/dist/vue.js +1 -1
  35. package/dist/widget.cjs +6 -4
  36. package/dist/widget.d.cts +585 -2
  37. package/dist/widget.d.ts +585 -2
  38. package/dist/widget.js +3985 -995
  39. package/llms-full.txt +125 -6
  40. package/package.json +1 -1
  41. package/dist/createMockClient-BZbOe-23.cjs +0 -1
  42. package/dist/sheetController-CBUVOroo.js +0 -205
  43. package/dist/sheetController-DY-sC13T.cjs +0 -1
  44. package/dist/types-CPga11Of.js +0 -2068
  45. package/dist/types-D3YQl1jx.cjs +0 -9
package/dist/index.d.cts CHANGED
@@ -92,6 +92,7 @@ export declare class AgoClient {
92
92
  private contextRegistry;
93
93
  private eventEmitter;
94
94
  private activityLedger;
95
+ private errorWatcher;
95
96
  private lastSentPageState;
96
97
  private config;
97
98
  /** Conversations already warned about an empty reply (one warning each). */
@@ -261,6 +262,26 @@ export declare class AgoClient {
261
262
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
262
263
  */
263
264
  private static mapPersistedToolCalls;
265
+ /**
266
+ * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
267
+ * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
268
+ * file-attachment flag. The vanilla widget fetches it once, when a ticket
269
+ * form first appears in a conversation.
270
+ */
271
+ getConfig(): Promise<SdkConfig>;
272
+ /**
273
+ * The dashboard's home screen content. A starter card shows its
274
+ * `description` and sends its `initial_message`; one with neither is
275
+ * unusable and is dropped rather than rendered as an empty card.
276
+ */
277
+ private static mapHomePage;
278
+ private static mapTicketForm;
279
+ /**
280
+ * Create a support ticket (`POST /api/sdk/v1/tickets`, multipart). This is
281
+ * what the ticket form in the conversation does before it completes the
282
+ * `form` tool call with {@link submitToolCallForm}.
283
+ */
284
+ createTicket(input: CreateTicketInput): Promise<CreateTicketResult>;
264
285
  /**
265
286
  * Get messages for a conversation
266
287
  */
@@ -519,6 +540,15 @@ export declare class AgoClient {
519
540
  /* Excluded from this release type: emitProactiveEvent */
520
541
  /* Excluded from this release type: getHttp */
521
542
  /* Excluded from this release type: getConfiguredAgent */
543
+ /**
544
+ * How the SDK identifies the visitor: the configured `userEmail`, and
545
+ * whether a `userJwt` is set. The ticket form asks for an email when it has
546
+ * neither.
547
+ */
548
+ getUserIdentity(): {
549
+ email?: string;
550
+ hasJwt: boolean;
551
+ };
522
552
  /**
523
553
  * Enable automatic capture of the current browser page (URL + title).
524
554
  * Injected as a dynamic context entry named `browser-page`.
@@ -541,6 +571,26 @@ export declare class AgoClient {
541
571
  private addActivity;
542
572
  private recordAgentAction;
543
573
  private registerActivityContext;
574
+ /**
575
+ * Start capturing the page's JavaScript errors (uncaught exceptions,
576
+ * unhandled rejections, `console.error` calls, {@link reportError}) and send
577
+ * the recent ones as the `errors:recent` context entry on every message.
578
+ * Same as setting `errorWatcher` in the config. Calling it again replaces
579
+ * the watcher (and its options); the captured errors are not kept.
580
+ */
581
+ enableErrorWatcher(options?: ErrorWatcherOptions): void;
582
+ /** Stop capturing errors and drop the `errors:recent` context entry. */
583
+ disableErrorWatcher(): void;
584
+ /**
585
+ * Record an error the app caught itself (React error boundary, Vue
586
+ * `errorHandler`, Angular `ErrorHandler`, a try/catch) so the agent sees it
587
+ * like an uncaught one. No-op unless the error watcher is enabled. `context`
588
+ * is size-clamped before it is stored; keep it small and free of secrets.
589
+ */
590
+ reportError(error: unknown, context?: Record<string, unknown>): void;
591
+ /** Errors the watcher currently holds, oldest first (a copy). Empty when disabled. */
592
+ getRecentErrors(): CapturedError[];
593
+ clearErrors(): void;
544
594
  /**
545
595
  * Subscribe to an event
546
596
  */
@@ -735,6 +785,12 @@ export declare interface AgoClientEvents {
735
785
  };
736
786
  /** A user- or agent-action was recorded into the activity ledger. */
737
787
  "activity:recorded": ActivityEntry;
788
+ /**
789
+ * The error watcher captured a JavaScript error (uncaught exception,
790
+ * unhandled rejection, `console.error` call, or `reportError`). Fires on
791
+ * repeats too, with the updated `count`. Requires `errorWatcher` in the config.
792
+ */
793
+ "error:captured": CapturedError;
738
794
  }
739
795
 
740
796
  /**
@@ -755,6 +811,8 @@ export declare interface AgoConfig {
755
811
  userEmail?: string;
756
812
  /** JWT token for authenticated users */
757
813
  userJwt?: string;
814
+ /** User metadata sent with messages. Use null to stop sending defaults. Not an authentication credential. */
815
+ metadata?: Record<string, unknown> | null;
758
816
  /** Enable debug logging */
759
817
  debug?: boolean;
760
818
  /**
@@ -814,6 +872,18 @@ export declare interface AgoConfig {
814
872
  * default otherwise.
815
873
  */
816
874
  proactive?: ProactiveOptions;
875
+ /**
876
+ * Capture the page's JavaScript errors as agent context. When set, the SDK
877
+ * listens for uncaught exceptions and unhandled promise rejections, wraps
878
+ * `console.error` (calling through; restored on `destroy`), and sends the
879
+ * recent errors (deduplicated, capped, pruned after 10 min) as the
880
+ * `errors:recent` context entry on every message. `true` uses the defaults;
881
+ * pass {@link ErrorWatcherOptions} to tune the caps or add a `filter` that
882
+ * redacts messages. Off by default: error messages can carry PII or internal
883
+ * URLs, so enabling it is the host's call. Errors also feed the proactive
884
+ * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
885
+ */
886
+ errorWatcher?: boolean | ErrorWatcherOptions;
817
887
  }
818
888
 
819
889
  /**
@@ -1151,6 +1221,32 @@ export declare function autoDetectConfig(overrides?: Partial<AgoConfig>): AgoCon
1151
1221
  */
1152
1222
  export declare function canInlineImage(attachment: AgoAttachment): boolean;
1153
1223
 
1224
+ /** One JavaScript error captured on the page (deduplicated, see `count`). */
1225
+ export declare interface CapturedError {
1226
+ type: CapturedErrorType;
1227
+ /** Error message, truncated to 500 chars. */
1228
+ message: string;
1229
+ /** Script URL the error came from, without its query string. */
1230
+ source?: string;
1231
+ line?: number;
1232
+ col?: number;
1233
+ /** Leading stack frames, truncated (see `maxStackChars`). */
1234
+ stack?: string;
1235
+ /** Pathname at capture time. */
1236
+ route: string;
1237
+ /** Epoch ms of the first occurrence. */
1238
+ firstAt: number;
1239
+ /** Epoch ms of the most recent occurrence. */
1240
+ lastAt: number;
1241
+ /** How many times this same error (type + message + source + line) fired. */
1242
+ count: number;
1243
+ /** App-provided context, manual reports only (size-clamped). */
1244
+ context?: Record<string, unknown>;
1245
+ }
1246
+
1247
+ /** How an error reached the watcher. */
1248
+ export declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
1249
+
1154
1250
  /**
1155
1251
  * Registry that collects client-side context from across the component tree.
1156
1252
  *
@@ -1559,8 +1655,36 @@ export declare function createMockClient(options?: MockAgoClientOptions): MockAg
1559
1655
 
1560
1656
  export declare function createStore<T>(initial: T, persist?: PersistOptions): Store<T>;
1561
1657
 
1658
+ /** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
1659
+ declare interface CreateTicketInput {
1660
+ subject: string;
1661
+ body: string;
1662
+ priority?: string;
1663
+ typology?: string;
1664
+ /** Conversation the ticket is filed from. */
1665
+ conversationId?: string;
1666
+ /** Reporter email, for a visitor the SDK does not otherwise identify. */
1667
+ email?: string;
1668
+ customFields?: Array<{
1669
+ id: string;
1670
+ value: string;
1671
+ }>;
1672
+ files?: File[];
1673
+ ticketFormId?: string;
1674
+ }
1675
+
1676
+ /** Response of `AgoClient.createTicket`. */
1677
+ declare interface CreateTicketResult {
1678
+ id: string;
1679
+ url?: string;
1680
+ }
1681
+
1562
1682
  export declare const DEFAULT_MAX_ACTIVITY_ENTRIES = 10;
1563
1683
 
1684
+ export declare const DEFAULT_MAX_ERROR_AGE_MS = 600000;
1685
+
1686
+ export declare const DEFAULT_MAX_ERRORS = 10;
1687
+
1564
1688
  /**
1565
1689
  * Create a reusable function definition.
1566
1690
  * Returns the same object — this is an identity function for discoverability and type-checking.
@@ -1603,6 +1727,83 @@ export declare function deriveFormStatus(schema: FormCollectorSchema, values: Pa
1603
1727
  */
1604
1728
  export declare type DynamicContextProvider = () => ContextEntry | null | undefined;
1605
1729
 
1730
+ /**
1731
+ * Captures the page's JavaScript errors so they can ride along as agent
1732
+ * context: uncaught exceptions (`window` `error` event), unhandled promise
1733
+ * rejections, every `console.error` call, and errors the app reports itself
1734
+ * via {@link report}.
1735
+ *
1736
+ * Errors are deduplicated by type + message + source + line (a repeat bumps
1737
+ * `count` and `lastAt`), capped at `maxErrors`, and pruned after `maxAgeMs`
1738
+ * when read. Messages and stacks are truncated so one error cannot bloat the
1739
+ * context.
1740
+ *
1741
+ * `console.error` capture wraps the console method. This is the one sanctioned
1742
+ * exception to the SDK's no-global-mutation rule: the wrapper always calls the
1743
+ * original, ignores the SDK's own `[AGO SDK]` lines, and is restored by
1744
+ * {@link destroy} when it is still installed (another library may have
1745
+ * wrapped it after us; in that case ours stays in the chain and keeps calling
1746
+ * through).
1747
+ *
1748
+ * Attached by `AgoClient` when `errorWatcher` is set in the config; usable
1749
+ * standalone. Listeners are attached only by `start()` and removed by
1750
+ * `destroy()`. No-op outside a browser (SSR).
1751
+ */
1752
+ export declare class ErrorWatcher {
1753
+ private readonly maxErrors;
1754
+ private readonly maxAgeMs;
1755
+ private readonly maxStackChars;
1756
+ private readonly filter?;
1757
+ private started;
1758
+ private teardowns;
1759
+ private errors;
1760
+ private listeners;
1761
+ /** True while a capture is being processed (a throw inside must not recurse). */
1762
+ private capturing;
1763
+ constructor(options?: ErrorWatcherOptions);
1764
+ /** Attach the listeners and wrap `console.error`. Idempotent; no-op in SSR. */
1765
+ start(): void;
1766
+ /** Remove the listeners, restore `console.error`, drop subscribers. */
1767
+ destroy(): void;
1768
+ /**
1769
+ * Record an error the app caught itself (error boundary, framework error
1770
+ * handler, try/catch). `context` is size-clamped before it is stored.
1771
+ */
1772
+ report(error: unknown, context?: Record<string, unknown>): void;
1773
+ /** Subscribe to captures (fires once per capture, repeats included). */
1774
+ subscribe(listener: (error: CapturedError) => void): () => void;
1775
+ /** Errors still within `maxAgeMs`, oldest first (a copy). */
1776
+ getErrors(): CapturedError[];
1777
+ clear(): void;
1778
+ private onErrorEvent;
1779
+ private onRejectionEvent;
1780
+ private wrapConsoleError;
1781
+ private onConsoleError;
1782
+ private capture;
1783
+ private notify;
1784
+ private prune;
1785
+ /** Drop the leading "Name: message" line stacks repeat, then cap the length. */
1786
+ private trimStack;
1787
+ private currentPathname;
1788
+ }
1789
+
1790
+ export declare interface ErrorWatcherOptions {
1791
+ /** Max distinct errors kept. Oldest dropped first. Default 10. */
1792
+ maxErrors?: number;
1793
+ /**
1794
+ * Errors older than this are pruned when the buffer is read, so a crash from
1795
+ * an hour ago does not confuse the agent. Default 600 000 (10 min).
1796
+ */
1797
+ maxAgeMs?: number;
1798
+ /** Max chars of stack kept per error. Default 2000. */
1799
+ maxStackChars?: number;
1800
+ /**
1801
+ * Redact or drop an error before it is stored. Return the (possibly edited)
1802
+ * error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
1803
+ */
1804
+ filter?: (error: CapturedError) => CapturedError | null;
1805
+ }
1806
+
1606
1807
  /**
1607
1808
  * Simple typed event emitter
1608
1809
  */
@@ -2371,6 +2572,12 @@ export declare interface ProactiveTriggerWhen {
2371
2572
  pageState?: Partial<Record<string, unknown>>;
2372
2573
  /** Min rage-click bursts on the current route. */
2373
2574
  rageClicks?: number;
2575
+ /**
2576
+ * Min JavaScript errors captured on the current route. Needs the client's
2577
+ * `errorWatcher` enabled; without it the count stays at 0 and the matcher
2578
+ * never passes.
2579
+ */
2580
+ jsErrors?: number;
2374
2581
  /** Min A→B→A→B route oscillations this session. */
2375
2582
  routeBounces?: number;
2376
2583
  /** Per-field minimum error counts (field NAME → min count). */
@@ -2414,10 +2621,69 @@ export declare function safeAttachmentUrl(url?: string): string | undefined;
2414
2621
  */
2415
2622
  export declare const scrollToElement: ClientFunctionDefinition;
2416
2623
 
2624
+ /** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
2625
+ declare interface SdkConfig {
2626
+ permissions: SdkPermissionConfig[];
2627
+ proactive: {
2628
+ enabled: boolean;
2629
+ };
2630
+ }
2631
+
2632
+ /** The dashboard's home screen content (title, subtitle, starter cards). */
2633
+ declare interface SdkHomePageConfig {
2634
+ title?: string;
2635
+ /** Markdown. */
2636
+ subtitle?: string;
2637
+ starters: SdkHomeStarter[];
2638
+ widgetStarter?: SdkWidgetStarter;
2639
+ }
2640
+
2641
+ /**
2642
+ * A conversation starter card configured in the AGO dashboard. `label` is what
2643
+ * the card shows; clicking it sends `message`.
2644
+ */
2645
+ declare interface SdkHomeStarter {
2646
+ id: string;
2647
+ /** The card's text (the starter's `description` in the dashboard). */
2648
+ label: string;
2649
+ /** What is sent when the card is clicked. */
2650
+ message: string;
2651
+ /** Answer with this agent instead of the configured default. */
2652
+ agentId?: string;
2653
+ }
2654
+
2655
+ /** One permission's configuration in {@link SdkConfig}. */
2656
+ declare interface SdkPermissionConfig {
2657
+ id?: string;
2658
+ name?: string;
2659
+ displayName?: string;
2660
+ agents: Array<{
2661
+ id: string;
2662
+ name?: string;
2663
+ }>;
2664
+ ticketForm?: TicketForm;
2665
+ /** Home screen content, when the tenant configured one. */
2666
+ homePage?: SdkHomePageConfig;
2667
+ fileAttachmentsEnabled: boolean;
2668
+ voiceEnabled: boolean;
2669
+ }
2670
+
2671
+ /**
2672
+ * The starter the dashboard sends by itself on a fresh visit, before the
2673
+ * visitor types anything.
2674
+ */
2675
+ declare interface SdkWidgetStarter {
2676
+ id: string;
2677
+ message: string;
2678
+ agentId?: string;
2679
+ }
2680
+
2417
2681
  /**
2418
2682
  * Options for sending a message
2419
2683
  */
2420
2684
  export declare interface SendMessageOptions {
2685
+ /** Replaces config.metadata for this message; null omits metadata for this message. */
2686
+ metadata?: Record<string, unknown> | null;
2421
2687
  /** Existing conversation ID */
2422
2688
  conversationId?: string;
2423
2689
  /** Override default agent */
@@ -2483,8 +2749,9 @@ export declare interface Signal {
2483
2749
 
2484
2750
  /**
2485
2751
  * Framework-agnostic collector of client-side friction signals: per-route
2486
- * dwell time, idle time, route bounces (A→B→A→B), rage clicks, and app-pushed
2487
- * field error counters. Attached to an `AgoClient` by `createAgoProactive`,
2752
+ * dwell time, idle time, route bounces (A→B→A→B), rage clicks, app-pushed
2753
+ * field error counters, and JavaScript error counts (pushed by the client's
2754
+ * `ErrorWatcher` through `createAgoProactive`). Attached to an `AgoClient` by `createAgoProactive`,
2488
2755
  * the same way `ClientContextRegistry` is attached.
2489
2756
  *
2490
2757
  * Route observation is poll-on-demand rather than a `history.pushState` patch:
@@ -2516,6 +2783,7 @@ export declare class SignalCollector {
2516
2783
  private recentRoutes;
2517
2784
  private routeBounces;
2518
2785
  private rageClicks;
2786
+ private jsErrors;
2519
2787
  private fieldErrors;
2520
2788
  private recentClicks;
2521
2789
  private signals;
@@ -2533,9 +2801,15 @@ export declare class SignalCollector {
2533
2801
  * Pass the field NAME only — values are never read, so no PII is collected.
2534
2802
  */
2535
2803
  signalFieldError(fieldName: string): void;
2804
+ /**
2805
+ * Pushed signal: a JavaScript error was captured on the page. Counter only;
2806
+ * `kind` says how it was caught (`error`, `unhandledrejection`, `console`,
2807
+ * `manual`). The message itself never enters the signals channel.
2808
+ */
2809
+ signalJsError(kind: string): void;
2536
2810
  /**
2537
2811
  * Subscribe to raw signals (route changes, bounces, rage clicks, field
2538
- * errors). Returns an unsubscribe function. Used by the proactive engine to
2812
+ * errors, JS errors). Returns an unsubscribe function. Used by the proactive engine to
2539
2813
  * evaluate promptly instead of waiting for the next tick.
2540
2814
  */
2541
2815
  subscribe(listener: (signal: Signal) => void): () => void;
@@ -2605,6 +2879,12 @@ export declare interface SignalsSnapshot {
2605
2879
  idleMs: number;
2606
2880
  /** Rage-click bursts detected on the current route. */
2607
2881
  rageClicks: number;
2882
+ /**
2883
+ * JavaScript errors captured on the current route (count only; the messages
2884
+ * travel in `client_context` under `errors:recent`). Always `0` unless the
2885
+ * client has `errorWatcher` enabled.
2886
+ */
2887
+ jsErrors: number;
2608
2888
  /**
2609
2889
  * A→B→A→B route oscillations detected in the recent route sequence. Rolling
2610
2890
  * session counter (cross-route by nature); trigger cooldowns and dismissal
@@ -2628,7 +2908,7 @@ export declare interface SignalsSnapshot {
2628
2908
  * Privacy rule: signals carry **enums, counters, and paths only** — never field
2629
2909
  * values or free text — so no PII ever leaves the page through this channel.
2630
2910
  */
2631
- export declare type SignalType = "route_change" | "route_bounce" | "rage_click" | "field_error";
2911
+ export declare type SignalType = "route_change" | "route_bounce" | "rage_click" | "field_error" | "js_error";
2632
2912
 
2633
2913
  /**
2634
2914
  * SSE stream chunk data
@@ -2671,6 +2951,13 @@ export declare interface SSEChunkData {
2671
2951
  follow_up_replies?: string[];
2672
2952
  satisfaction_feedback?: unknown;
2673
2953
  ask_to_talk_to_human?: boolean;
2954
+ allowed_to_create_ticket?: boolean;
2955
+ ticket?: ToolCallTicketPrefill;
2956
+ mode?: "form" | "embed";
2957
+ ticket_form_id?: string;
2958
+ embed_html?: string;
2959
+ embed_description?: string;
2960
+ display_mode?: "collapsible" | "display" | "both";
2674
2961
  /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
2675
2962
  waiting_tool_call_ids?: string[];
2676
2963
  }
@@ -2839,12 +3126,82 @@ export declare const submitForm: ClientFunctionDefinition;
2839
3126
  export declare interface SubmitToolCallResult {
2840
3127
  status: string;
2841
3128
  result?: unknown;
3129
+ /** Set when `status` is `"error"`. */
3130
+ error?: string;
3131
+ /** The ticket a ticketing `form` tool call resolved to, when it did. */
3132
+ ticket?: {
3133
+ ticket_id: string;
3134
+ ticket_url?: string;
3135
+ [key: string]: unknown;
3136
+ };
2842
3137
  resume?: {
2843
3138
  message_id: string;
2844
3139
  ready: boolean;
2845
3140
  };
2846
3141
  }
2847
3142
 
3143
+ /** A custom field of a ticket form. */
3144
+ declare interface TicketField {
3145
+ id: string;
3146
+ /** The key the ticketing backend expects; used as the submit key when set. */
3147
+ externalId?: string;
3148
+ title?: string;
3149
+ /** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
3150
+ type?: string;
3151
+ required: boolean;
3152
+ /** Carried in the submission but never shown. */
3153
+ hidden: boolean;
3154
+ active?: boolean;
3155
+ /** Bypass progressive disclosure, while still respecting conditions. */
3156
+ alwaysVisible?: boolean;
3157
+ regexpForValidation?: string;
3158
+ position: number;
3159
+ /** Non-empty turns the field into a select. */
3160
+ options: TicketFieldOption[];
3161
+ /** Show this field only when the parent field holds `conditionalFieldValue`. */
3162
+ conditionalFieldId?: string;
3163
+ /** Legacy comma-separated condition values. */
3164
+ conditionalFieldValue?: string;
3165
+ /** Takes precedence over conditionalFieldValue when non-empty. */
3166
+ conditionalFieldValues?: string[];
3167
+ }
3168
+
3169
+ /** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
3170
+ declare interface TicketFieldOption {
3171
+ id: string;
3172
+ /** Label shown to the user. */
3173
+ name?: string;
3174
+ /** Value submitted. Falls back to `name` when absent. */
3175
+ value?: string;
3176
+ /** Preselected when the form opens. */
3177
+ default: boolean;
3178
+ /** A note shown under the field once this option is picked. */
3179
+ message?: string;
3180
+ messageType: "info" | "warning" | "danger";
3181
+ position?: number;
3182
+ group?: string;
3183
+ noDisplay?: boolean;
3184
+ conditionalFieldId?: string;
3185
+ /** Available when the parent matches any of these values. */
3186
+ conditionalFieldValues?: string[];
3187
+ }
3188
+
3189
+ /** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
3190
+ declare interface TicketForm {
3191
+ id: string;
3192
+ name?: string;
3193
+ /** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
3194
+ mode: "form" | "embed";
3195
+ showSubject: boolean;
3196
+ showBody: boolean;
3197
+ showPriority: boolean;
3198
+ showTypology: boolean;
3199
+ priorityTypologies?: string[];
3200
+ successMessageText?: string;
3201
+ successMessageUrlLabel?: string;
3202
+ fields: TicketField[];
3203
+ }
3204
+
2848
3205
  /**
2849
3206
  * Tool call data from SSE stream
2850
3207
  */
@@ -2859,6 +3216,34 @@ export declare interface ToolCallData {
2859
3216
  data?: Record<string, unknown>;
2860
3217
  functionName?: string;
2861
3218
  arguments?: Record<string, unknown>;
3219
+ /**
3220
+ * Where the hosted widget shows the call: in the collapsible "reasoning"
3221
+ * section, in the message body, or both. Absent means collapsible only.
3222
+ */
3223
+ displayMode?: "collapsible" | "display" | "both";
3224
+ /** The user asked to talk to a human. */
3225
+ askToTalkToHuman?: boolean;
3226
+ /** `false` when the tenant blocks ticket creation for this visitor. */
3227
+ allowedToCreateTicket?: boolean;
3228
+ /** Fields the agent pre-filled from the conversation. */
3229
+ ticket?: ToolCallTicketPrefill;
3230
+ /** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
3231
+ mode?: "form" | "embed";
3232
+ ticketFormId?: string;
3233
+ embedHtml?: string;
3234
+ embedDescription?: string;
3235
+ }
3236
+
3237
+ /** The ticket the agent pre-filled on a ticketing `form` tool call. */
3238
+ declare interface ToolCallTicketPrefill {
3239
+ subject?: string;
3240
+ body?: string;
3241
+ typology?: string;
3242
+ priority?: string;
3243
+ tag?: string;
3244
+ products?: string[];
3245
+ /** Keyed by the field's external id, or a lowercased, underscored title. */
3246
+ custom_fields?: Record<string, string>;
2862
3247
  }
2863
3248
 
2864
3249
  export declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";