@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.
- package/CHANGELOG.md +173 -2
- package/README.md +126 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +408 -26
- package/dist/angular.d.ts +408 -26
- package/dist/angular.js +4 -1
- package/dist/{createConversationSession-BaaXBQ5b.js → createConversationSession-BfJg0WyA.js} +1 -1
- package/dist/{createConversationSession-CU0b-t1W.cjs → createConversationSession-CiOXKWl0.cjs} +1 -1
- package/dist/{createFormCollector-Cf7kGhCB.js → createFormCollector-DN1xjAv5.js} +1 -1
- package/dist/{createFormCollector-DfN1xZBy.cjs → createFormCollector-DnQl77Ko.cjs} +1 -1
- package/dist/createMockClient-BPt1gSve.cjs +1 -0
- package/dist/{createMockClient-5YF-ZbVu.js → createMockClient-YoYr3pQr.js} +16 -3
- package/dist/devtools.cjs +4 -4
- package/dist/devtools.d.cts +406 -26
- package/dist/devtools.d.ts +406 -26
- package/dist/devtools.js +87 -84
- package/dist/helpers.d.cts +42 -12
- package/dist/helpers.d.ts +42 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +486 -35
- package/dist/index.d.ts +486 -35
- package/dist/index.js +117 -112
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +458 -26
- package/dist/react.d.ts +458 -26
- package/dist/react.js +816 -727
- package/dist/speechToText-BV7qxqPF.js +704 -0
- package/dist/speechToText-ZciRyyJE.cjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +406 -26
- package/dist/testing.d.ts +406 -26
- package/dist/testing.js +1 -1
- package/dist/types-Q7t1peH-.js +2584 -0
- package/dist/types-a7teDBnC.cjs +10 -0
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +608 -26
- package/dist/vue.d.ts +608 -26
- package/dist/vue.js +103 -101
- package/dist/widget.cjs +6 -4
- package/dist/widget.d.cts +710 -28
- package/dist/widget.d.ts +710 -28
- package/dist/widget.js +3911 -976
- package/llms-full.txt +254 -7
- package/package.json +1 -1
- package/dist/createMockClient-BZbOe-23.cjs +0 -1
- package/dist/sheetController-CBUVOroo.js +0 -205
- package/dist/sheetController-DY-sC13T.cjs +0 -1
- package/dist/types-CPga11Of.js +0 -2068
- package/dist/types-D3YQl1jx.cjs +0 -9
package/dist/widget.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). */
|
|
@@ -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;
|
|
@@ -988,6 +1087,37 @@ export declare interface AgoWidgetConfig {
|
|
|
988
1087
|
metadata?: Record<string, unknown>;
|
|
989
1088
|
}
|
|
990
1089
|
|
|
1090
|
+
/** Editable text returned by `AgoClient.transcribeAudio`. */
|
|
1091
|
+
declare interface AudioTranscription {
|
|
1092
|
+
text: string;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/** One JavaScript error captured on the page (deduplicated, see `count`). */
|
|
1096
|
+
declare interface CapturedError {
|
|
1097
|
+
type: CapturedErrorType;
|
|
1098
|
+
/** Error message, truncated to 500 chars. */
|
|
1099
|
+
message: string;
|
|
1100
|
+
/** Script URL the error came from, without its query string. */
|
|
1101
|
+
source?: string;
|
|
1102
|
+
line?: number;
|
|
1103
|
+
col?: number;
|
|
1104
|
+
/** Leading stack frames, truncated (see `maxStackChars`). */
|
|
1105
|
+
stack?: string;
|
|
1106
|
+
/** Pathname at capture time. */
|
|
1107
|
+
route: string;
|
|
1108
|
+
/** Epoch ms of the first occurrence. */
|
|
1109
|
+
firstAt: number;
|
|
1110
|
+
/** Epoch ms of the most recent occurrence. */
|
|
1111
|
+
lastAt: number;
|
|
1112
|
+
/** How many times this same error (type + message + source + line) fired. */
|
|
1113
|
+
count: number;
|
|
1114
|
+
/** App-provided context, manual reports only (size-clamped). */
|
|
1115
|
+
context?: Record<string, unknown>;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/** How an error reached the watcher. */
|
|
1119
|
+
declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
|
|
1120
|
+
|
|
991
1121
|
/** Handle returned by `mountChatWidget`. */
|
|
992
1122
|
export declare interface ChatWidgetHandle {
|
|
993
1123
|
/** The AGO client backing the widget. */
|
|
@@ -1020,6 +1150,18 @@ export declare interface ChatWidgetHandle {
|
|
|
1020
1150
|
readonly threads: Conversation[];
|
|
1021
1151
|
/** Re-fetch the conversations list and update {@link ChatWidgetHandle.threads}. */
|
|
1022
1152
|
refreshThreads: () => Promise<Conversation[]>;
|
|
1153
|
+
/** `placement: "bubble"` only. The screen currently shown. */
|
|
1154
|
+
readonly screen?: WidgetScreen;
|
|
1155
|
+
/** `placement: "bubble"` only. Switch to the home, chat, or history screen. */
|
|
1156
|
+
showScreen?: (screen: WidgetScreen) => void;
|
|
1157
|
+
/** `placement: "bubble"` only. Open a conversation by id on the chat screen. */
|
|
1158
|
+
openConversation?: (conversationId: string) => Promise<void>;
|
|
1159
|
+
/**
|
|
1160
|
+
* Forget the current thread and start over, like the header's new-chat
|
|
1161
|
+
* button and the "New conversation" button shown once a ticket exists. The
|
|
1162
|
+
* bubble widget also returns to its home screen.
|
|
1163
|
+
*/
|
|
1164
|
+
newConversation: () => void;
|
|
1023
1165
|
/** Remove listeners, uninstall forms, and clear the DOM. */
|
|
1024
1166
|
destroy: () => void;
|
|
1025
1167
|
}
|
|
@@ -1037,22 +1179,11 @@ export declare interface ChatWidgetHandle {
|
|
|
1037
1179
|
* client.registerFunction(fn);
|
|
1038
1180
|
* ```
|
|
1039
1181
|
*/
|
|
1040
|
-
declare interface ClientFunctionDefinition {
|
|
1182
|
+
declare interface ClientFunctionDefinition extends ClientFunctionSettings {
|
|
1041
1183
|
name: string;
|
|
1042
1184
|
description: string;
|
|
1043
1185
|
parameters: ClientFunctionSchema["parameters"];
|
|
1044
1186
|
handler: ClientFunctionHandler;
|
|
1045
|
-
/**
|
|
1046
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1047
|
-
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
1048
|
-
* `Infinity` disables the guard for this function.
|
|
1049
|
-
*/
|
|
1050
|
-
maxResultBytes?: number;
|
|
1051
|
-
/**
|
|
1052
|
-
* Require explicit user approval before this function runs. See
|
|
1053
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1054
|
-
*/
|
|
1055
|
-
requiresApproval?: boolean;
|
|
1056
1187
|
}
|
|
1057
1188
|
|
|
1058
1189
|
/**
|
|
@@ -1071,20 +1202,7 @@ declare interface ClientFunctionInvocation {
|
|
|
1071
1202
|
* Schema-plus-settings object accepted when registering a function: the schema
|
|
1072
1203
|
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
1073
1204
|
*/
|
|
1074
|
-
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> &
|
|
1075
|
-
/**
|
|
1076
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1077
|
-
* flagged preview. Overrides the client-level default
|
|
1078
|
-
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1079
|
-
* disables the guard for this function.
|
|
1080
|
-
*/
|
|
1081
|
-
maxResultBytes?: number;
|
|
1082
|
-
/**
|
|
1083
|
-
* Require explicit user approval before this function runs. See
|
|
1084
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1085
|
-
*/
|
|
1086
|
-
requiresApproval?: boolean;
|
|
1087
|
-
};
|
|
1205
|
+
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
|
|
1088
1206
|
|
|
1089
1207
|
/**
|
|
1090
1208
|
* Schema for a client-side function that AGO can call
|
|
@@ -1111,9 +1229,39 @@ declare interface ClientFunctionSchema {
|
|
|
1111
1229
|
};
|
|
1112
1230
|
}
|
|
1113
1231
|
|
|
1232
|
+
/** SDK-side function settings that are never sent to the backend. */
|
|
1233
|
+
declare interface ClientFunctionSettings {
|
|
1234
|
+
/**
|
|
1235
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1236
|
+
* flagged preview. Overrides the client-level default
|
|
1237
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1238
|
+
* disables the guard for this function.
|
|
1239
|
+
*/
|
|
1240
|
+
maxResultBytes?: number;
|
|
1241
|
+
/**
|
|
1242
|
+
* Require explicit user approval before this function runs. See
|
|
1243
|
+
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1244
|
+
*/
|
|
1245
|
+
requiresApproval?: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
|
|
1248
|
+
* `false` keeps this function out of WebMCP while leaving it available to the
|
|
1249
|
+
* in-app agent.
|
|
1250
|
+
*/
|
|
1251
|
+
webmcp?: WebMCPToolMeta | false;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1114
1254
|
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
1115
1255
|
declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
1116
1256
|
|
|
1257
|
+
/**
|
|
1258
|
+
* Translate the embed snippet's `colors` object into {@link WidgetTheme} keys,
|
|
1259
|
+
* so `mountChatWidget({ colors })` skins the bubble widget exactly like
|
|
1260
|
+
* `window.AGO.colors` skins the hosted one. The header text color is derived
|
|
1261
|
+
* for contrast unless the theme sets it.
|
|
1262
|
+
*/
|
|
1263
|
+
export declare function colorsToTheme(colors: AgoWidgetColors | undefined): WidgetTheme;
|
|
1264
|
+
|
|
1117
1265
|
/**
|
|
1118
1266
|
* Build the media query for the compact layout.
|
|
1119
1267
|
*
|
|
@@ -1220,6 +1368,19 @@ export declare interface ConversationSessionOptions {
|
|
|
1220
1368
|
ttlMs?: number;
|
|
1221
1369
|
}
|
|
1222
1370
|
|
|
1371
|
+
/** A card on the bubble widget's home screen that starts a conversation. */
|
|
1372
|
+
export declare interface ConversationStarter {
|
|
1373
|
+
/** Text shown on the card. */
|
|
1374
|
+
label: string;
|
|
1375
|
+
/** Message sent when clicked. Defaults to `label`. */
|
|
1376
|
+
message?: string;
|
|
1377
|
+
/**
|
|
1378
|
+
* Answer this starter with a specific agent (id or slug) instead of the
|
|
1379
|
+
* client's default. Dashboard starters (`loadHomeConfig`) carry their own.
|
|
1380
|
+
*/
|
|
1381
|
+
agentId?: string;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1223
1384
|
export declare interface CreateFormCollectorOptions<V = Record<string, unknown>> {
|
|
1224
1385
|
/** Short identifier; becomes the `update_<name>` / `submit_<name>` function names. */
|
|
1225
1386
|
name: string;
|
|
@@ -1245,8 +1406,38 @@ export declare interface CreateFormCollectorOptions<V = Record<string, unknown>>
|
|
|
1245
1406
|
|
|
1246
1407
|
export declare function createSheetController(options?: SheetOptions): SheetController;
|
|
1247
1408
|
|
|
1409
|
+
/** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
|
|
1410
|
+
declare interface CreateTicketInput {
|
|
1411
|
+
subject: string;
|
|
1412
|
+
body: string;
|
|
1413
|
+
priority?: string;
|
|
1414
|
+
typology?: string;
|
|
1415
|
+
/** Conversation the ticket is filed from. */
|
|
1416
|
+
conversationId?: string;
|
|
1417
|
+
/** Reporter email, for a visitor the SDK does not otherwise identify. */
|
|
1418
|
+
email?: string;
|
|
1419
|
+
customFields?: Array<{
|
|
1420
|
+
id: string;
|
|
1421
|
+
value: string;
|
|
1422
|
+
}>;
|
|
1423
|
+
files?: File[];
|
|
1424
|
+
ticketFormId?: string;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
/** Response of `AgoClient.createTicket`. */
|
|
1428
|
+
declare interface CreateTicketResult {
|
|
1429
|
+
id: string;
|
|
1430
|
+
url?: string;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1248
1433
|
export declare const DEFAULT_FEEDBACK_LABELS: FeedbackLabels;
|
|
1249
1434
|
|
|
1435
|
+
export declare const DEFAULT_SPEECH_TO_TEXT_LABELS: SpeechToTextLabels;
|
|
1436
|
+
|
|
1437
|
+
export declare const DEFAULT_TOOL_CALL_FORM_LABELS: ToolCallFormLabels;
|
|
1438
|
+
|
|
1439
|
+
export declare const DEFAULT_WIDGET_LABELS: WidgetLabels;
|
|
1440
|
+
|
|
1250
1441
|
/**
|
|
1251
1442
|
* A function that returns a fresh context entry on demand.
|
|
1252
1443
|
* Evaluated every time a message is sent — use it to pull data from stores,
|
|
@@ -1261,6 +1452,23 @@ export declare interface ElementProps {
|
|
|
1261
1452
|
attrs: Record<string, string | null>;
|
|
1262
1453
|
}
|
|
1263
1454
|
|
|
1455
|
+
declare interface ErrorWatcherOptions {
|
|
1456
|
+
/** Max distinct errors kept. Oldest dropped first. Default 10. */
|
|
1457
|
+
maxErrors?: number;
|
|
1458
|
+
/**
|
|
1459
|
+
* Errors older than this are pruned when the buffer is read, so a crash from
|
|
1460
|
+
* an hour ago does not confuse the agent. Default 600 000 (10 min).
|
|
1461
|
+
*/
|
|
1462
|
+
maxAgeMs?: number;
|
|
1463
|
+
/** Max chars of stack kept per error. Default 2000. */
|
|
1464
|
+
maxStackChars?: number;
|
|
1465
|
+
/**
|
|
1466
|
+
* Redact or drop an error before it is stored. Return the (possibly edited)
|
|
1467
|
+
* error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
|
|
1468
|
+
*/
|
|
1469
|
+
filter?: (error: CapturedError) => CapturedError | null;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1264
1472
|
/**
|
|
1265
1473
|
* Why the user is reporting a message (see `AgoClient.submitFeedback`).
|
|
1266
1474
|
*
|
|
@@ -1534,12 +1742,22 @@ export declare interface MountChatWidgetOptions {
|
|
|
1534
1742
|
placeholder?: string;
|
|
1535
1743
|
/** Enable file attachments. */
|
|
1536
1744
|
allowFiles?: boolean;
|
|
1745
|
+
/** Microphone, live waveform and draft transcription. Checks the tenant flag. Default false. */
|
|
1746
|
+
speechToText?: boolean | SpeechToTextOptions;
|
|
1537
1747
|
/**
|
|
1538
1748
|
* While the agent is answering, turn the send button into a Stop button that
|
|
1539
1749
|
* interrupts the turn. Default `true`; set `false` to keep showing a disabled
|
|
1540
1750
|
* spinner instead.
|
|
1541
1751
|
*/
|
|
1542
1752
|
allowStop?: boolean;
|
|
1753
|
+
/**
|
|
1754
|
+
* Follow new messages and streamed replies while the reader is at the bottom.
|
|
1755
|
+
* Defaults to `true`; sending a message or clicking the jump button resumes
|
|
1756
|
+
* following. Set `false` to keep the scroll position during replies. Sending
|
|
1757
|
+
* a message or clicking the jump button still jumps to the end once, without
|
|
1758
|
+
* enabling follow for subsequent chunks.
|
|
1759
|
+
*/
|
|
1760
|
+
autoScroll?: boolean;
|
|
1543
1761
|
/** Widget height (number → px). Ignored when `placement` is `"left"`/`"right"`
|
|
1544
1762
|
* (a side panel is always full-height). */
|
|
1545
1763
|
height?: string | number;
|
|
@@ -1550,14 +1768,73 @@ export declare interface MountChatWidgetOptions {
|
|
|
1550
1768
|
* closed; the target is only used as the DOM parent (pass `document.body` for
|
|
1551
1769
|
* a true page overlay). In side mode `height` is ignored and the width comes
|
|
1552
1770
|
* from {@link MountChatWidgetOptions.width}.
|
|
1771
|
+
*
|
|
1772
|
+
* `"bubble"` reproduces the hosted embed widget without an iframe: a floating
|
|
1773
|
+
* launcher bottom-right, a teaser bubble, and a 550px panel with a home
|
|
1774
|
+
* screen, a conversation screen, and a chat history screen. See the
|
|
1775
|
+
* "Floating bubble" section of `docs/general/widget.md`.
|
|
1553
1776
|
*/
|
|
1554
|
-
placement?: "inline" | "left" | "right";
|
|
1777
|
+
placement?: "inline" | "left" | "right" | "bubble";
|
|
1555
1778
|
/**
|
|
1556
1779
|
* Width of the side panel for `placement: "left" | "right"` (number → px).
|
|
1557
1780
|
* Capped at the viewport width so it never overflows on mobile. Ignored when
|
|
1558
|
-
* `placement` is `"inline"`. Defaults to `400
|
|
1781
|
+
* `placement` is `"inline"`. Defaults to `400`; to `550` for `"bubble"`, where
|
|
1782
|
+
* it is clamped between 400px and the viewport width minus 40px.
|
|
1559
1783
|
*/
|
|
1560
1784
|
width?: string | number;
|
|
1785
|
+
/**
|
|
1786
|
+
* `placement: "bubble"` only. The teaser speech bubble shown above the
|
|
1787
|
+
* launcher one second after mount, inviting the visitor in. Pass `false` to
|
|
1788
|
+
* skip it. Defaults to `"Hello, how can I help you today?"`.
|
|
1789
|
+
*/
|
|
1790
|
+
prompt?: string | false;
|
|
1791
|
+
/**
|
|
1792
|
+
* `placement: "bubble"` only. URL of an image (32×32) shown on the launcher
|
|
1793
|
+
* instead of the default chat glyph.
|
|
1794
|
+
*/
|
|
1795
|
+
icon?: string;
|
|
1796
|
+
/**
|
|
1797
|
+
* `placement: "bubble"` only. The same `colors` object as the embed snippet's
|
|
1798
|
+
* `window.AGO.colors`, mapped onto {@link WidgetTheme} keys. `theme` wins over
|
|
1799
|
+
* it key by key. The header text color is derived for contrast automatically.
|
|
1800
|
+
*/
|
|
1801
|
+
colors?: AgoWidgetColors;
|
|
1802
|
+
/** `placement: "bubble"` only. Hide the Home / Chats bottom bar. Defaults to `false`. */
|
|
1803
|
+
hideFooter?: boolean;
|
|
1804
|
+
/**
|
|
1805
|
+
* `placement: "bubble"` only. Markdown shown under the title on the home
|
|
1806
|
+
* screen.
|
|
1807
|
+
*/
|
|
1808
|
+
subtitle?: string;
|
|
1809
|
+
/**
|
|
1810
|
+
* `placement: "bubble"` only. Cards on the home screen that each start a
|
|
1811
|
+
* conversation with a preset message.
|
|
1812
|
+
*/
|
|
1813
|
+
conversationStarters?: ConversationStarter[];
|
|
1814
|
+
/**
|
|
1815
|
+
* `placement: "bubble"` only. Take the home screen's title, subtitle and
|
|
1816
|
+
* starter cards from the AGO dashboard (`GET /config`) instead of the
|
|
1817
|
+
* options above, the way the hosted widget does. One request on mount; the
|
|
1818
|
+
* home screen renders immediately with whatever was passed in code and
|
|
1819
|
+
* re-renders when the config lands.
|
|
1820
|
+
*
|
|
1821
|
+
* Each part is replaced only when the dashboard has a value for it, so
|
|
1822
|
+
* anything the dashboard leaves empty keeps what the code set. Off by
|
|
1823
|
+
* default: without it the widget makes no config request on mount.
|
|
1824
|
+
*
|
|
1825
|
+
* The dashboard's *widget starter* (a first message the agent sends by
|
|
1826
|
+
* itself) is honored too, on a fresh visit only.
|
|
1827
|
+
*/
|
|
1828
|
+
loadHomeConfig?: boolean;
|
|
1829
|
+
/**
|
|
1830
|
+
* `placement: "bubble"` only. On open, reopen the visitor's most recent
|
|
1831
|
+
* conversation if its last message is under two hours old. Defaults to `true`.
|
|
1832
|
+
*/
|
|
1833
|
+
autoResume?: boolean;
|
|
1834
|
+
/** `placement: "bubble"` only. Translate the chrome's strings. */
|
|
1835
|
+
labels?: Partial<Omit<WidgetLabels, "timeAgo">> & {
|
|
1836
|
+
timeAgo?: Partial<WidgetLabels["timeAgo"]>;
|
|
1837
|
+
};
|
|
1561
1838
|
/**
|
|
1562
1839
|
* For side placements, render the built-in floating launcher button that opens
|
|
1563
1840
|
* the panel (plus a close "×" in the header). Set `false` to drive open/close
|
|
@@ -1668,6 +1945,11 @@ export declare interface MountChatWidgetOptions {
|
|
|
1668
1945
|
* the visitor ignores the panel; the panel then files the detailed report.
|
|
1669
1946
|
*/
|
|
1670
1947
|
feedback?: boolean | WidgetFeedbackOptions;
|
|
1948
|
+
/**
|
|
1949
|
+
* The ticket form the agent can open in the conversation (labels, success
|
|
1950
|
+
* text, callbacks). See {@link WidgetToolCallFormOptions}.
|
|
1951
|
+
*/
|
|
1952
|
+
toolCallForm?: WidgetToolCallFormOptions;
|
|
1671
1953
|
/**
|
|
1672
1954
|
* How clicking a suggested follow-up reply behaves. Defaults to sending the
|
|
1673
1955
|
* reply as a new user message. Pass a handler to override, or `false` to
|
|
@@ -1892,12 +2174,37 @@ declare interface ProactiveTriggerWhen {
|
|
|
1892
2174
|
pageState?: Partial<Record<string, unknown>>;
|
|
1893
2175
|
/** Min rage-click bursts on the current route. */
|
|
1894
2176
|
rageClicks?: number;
|
|
2177
|
+
/**
|
|
2178
|
+
* Min JavaScript errors captured on the current route. Needs the client's
|
|
2179
|
+
* `errorWatcher` enabled; without it the count stays at 0 and the matcher
|
|
2180
|
+
* never passes.
|
|
2181
|
+
*/
|
|
2182
|
+
jsErrors?: number;
|
|
1895
2183
|
/** Min A→B→A→B route oscillations this session. */
|
|
1896
2184
|
routeBounces?: number;
|
|
1897
2185
|
/** Per-field minimum error counts (field NAME → min count). */
|
|
1898
2186
|
fieldErrors?: Record<string, number>;
|
|
1899
2187
|
}
|
|
1900
2188
|
|
|
2189
|
+
/**
|
|
2190
|
+
* Pick a legible foreground for a tenant-chosen background, which may be a
|
|
2191
|
+
* solid color or a gradient. A gradient is judged by its least-contrasting
|
|
2192
|
+
* stop, since the text has to survive the whole sweep.
|
|
2193
|
+
*
|
|
2194
|
+
* Deliberately biased toward white: it flips to black only below 3:1, where
|
|
2195
|
+
* white stops being readable at all. Unparseable input (a `var()`, a named
|
|
2196
|
+
* color) keeps white, which is what the default dark header wants.
|
|
2197
|
+
*/
|
|
2198
|
+
export declare function readableTextColor(background: string | undefined): string;
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* Registered function with handler
|
|
2202
|
+
*/
|
|
2203
|
+
declare interface RegisteredFunction extends ClientFunctionSettings {
|
|
2204
|
+
schema: ClientFunctionSchema;
|
|
2205
|
+
handler: ClientFunctionHandler;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
1901
2208
|
/**
|
|
1902
2209
|
* Tiny, dependency-free markdown → DOM renderer for the vanilla chat widget.
|
|
1903
2210
|
*
|
|
@@ -1937,10 +2244,71 @@ declare type ResumeGate = (info: {
|
|
|
1937
2244
|
messageId: string;
|
|
1938
2245
|
}) => Promise<void> | void;
|
|
1939
2246
|
|
|
2247
|
+
/** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
|
|
2248
|
+
declare interface SdkConfig {
|
|
2249
|
+
permissions: SdkPermissionConfig[];
|
|
2250
|
+
proactive: {
|
|
2251
|
+
enabled: boolean;
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
/** The dashboard's home screen content (title, subtitle, starter cards). */
|
|
2256
|
+
declare interface SdkHomePageConfig {
|
|
2257
|
+
title?: string;
|
|
2258
|
+
/** Markdown. */
|
|
2259
|
+
subtitle?: string;
|
|
2260
|
+
starters: SdkHomeStarter[];
|
|
2261
|
+
widgetStarter?: SdkWidgetStarter;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* A conversation starter card configured in the AGO dashboard. `label` is what
|
|
2266
|
+
* the card shows; clicking it sends `message`.
|
|
2267
|
+
*/
|
|
2268
|
+
declare interface SdkHomeStarter {
|
|
2269
|
+
id: string;
|
|
2270
|
+
/** The card's text (the starter's `description` in the dashboard). */
|
|
2271
|
+
label: string;
|
|
2272
|
+
/** What is sent when the card is clicked. */
|
|
2273
|
+
message: string;
|
|
2274
|
+
/** Answer with this agent instead of the configured default. */
|
|
2275
|
+
agentId?: string;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
/** One permission's configuration in {@link SdkConfig}. */
|
|
2279
|
+
declare interface SdkPermissionConfig {
|
|
2280
|
+
id?: string;
|
|
2281
|
+
name?: string;
|
|
2282
|
+
displayName?: string;
|
|
2283
|
+
agents: Array<{
|
|
2284
|
+
id: string;
|
|
2285
|
+
name?: string;
|
|
2286
|
+
}>;
|
|
2287
|
+
ticketForm?: TicketForm;
|
|
2288
|
+
/** Home screen content, when the tenant configured one. */
|
|
2289
|
+
homePage?: SdkHomePageConfig;
|
|
2290
|
+
fileAttachmentsEnabled: boolean;
|
|
2291
|
+
voiceEnabled: boolean;
|
|
2292
|
+
/** Whether audio uploads can be transcribed. Defaults to false on older backends. */
|
|
2293
|
+
speechToTextEnabled: boolean;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
/**
|
|
2297
|
+
* The starter the dashboard sends by itself on a fresh visit, before the
|
|
2298
|
+
* visitor types anything.
|
|
2299
|
+
*/
|
|
2300
|
+
declare interface SdkWidgetStarter {
|
|
2301
|
+
id: string;
|
|
2302
|
+
message: string;
|
|
2303
|
+
agentId?: string;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
1940
2306
|
/**
|
|
1941
2307
|
* Options for sending a message
|
|
1942
2308
|
*/
|
|
1943
2309
|
declare interface SendMessageOptions {
|
|
2310
|
+
/** Replaces config.metadata for this message; null omits metadata for this message. */
|
|
2311
|
+
metadata?: Record<string, unknown> | null;
|
|
1944
2312
|
/** Existing conversation ID */
|
|
1945
2313
|
conversationId?: string;
|
|
1946
2314
|
/** Override default agent */
|
|
@@ -2071,6 +2439,12 @@ declare interface SignalsSnapshot {
|
|
|
2071
2439
|
idleMs: number;
|
|
2072
2440
|
/** Rage-click bursts detected on the current route. */
|
|
2073
2441
|
rageClicks: number;
|
|
2442
|
+
/**
|
|
2443
|
+
* JavaScript errors captured on the current route (count only; the messages
|
|
2444
|
+
* travel in `client_context` under `errors:recent`). Always `0` unless the
|
|
2445
|
+
* client has `errorWatcher` enabled.
|
|
2446
|
+
*/
|
|
2447
|
+
jsErrors: number;
|
|
2074
2448
|
/**
|
|
2075
2449
|
* A→B→A→B route oscillations detected in the recent route sequence. Rolling
|
|
2076
2450
|
* session counter (cross-route by nature); trigger cooldowns and dismissal
|
|
@@ -2088,6 +2462,26 @@ declare interface SignalsSnapshot {
|
|
|
2088
2462
|
pageState: Record<string, unknown> | null;
|
|
2089
2463
|
}
|
|
2090
2464
|
|
|
2465
|
+
/** Strings used by the microphone control in every widget. */
|
|
2466
|
+
export declare interface SpeechToTextLabels {
|
|
2467
|
+
start: string;
|
|
2468
|
+
finish: string;
|
|
2469
|
+
cancel: string;
|
|
2470
|
+
requesting: string;
|
|
2471
|
+
recording: string;
|
|
2472
|
+
transcribing: string;
|
|
2473
|
+
limitApproaching: string;
|
|
2474
|
+
permissionDenied: string;
|
|
2475
|
+
recordingFailed: string;
|
|
2476
|
+
tooLarge: string;
|
|
2477
|
+
noSpeech: string;
|
|
2478
|
+
transcriptionFailed: string;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
export declare interface SpeechToTextOptions {
|
|
2482
|
+
labels?: Partial<SpeechToTextLabels>;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2091
2485
|
/**
|
|
2092
2486
|
* SSE stream chunk data
|
|
2093
2487
|
*/
|
|
@@ -2129,6 +2523,13 @@ declare interface SSEChunkData {
|
|
|
2129
2523
|
follow_up_replies?: string[];
|
|
2130
2524
|
satisfaction_feedback?: unknown;
|
|
2131
2525
|
ask_to_talk_to_human?: boolean;
|
|
2526
|
+
allowed_to_create_ticket?: boolean;
|
|
2527
|
+
ticket?: ToolCallTicketPrefill;
|
|
2528
|
+
mode?: "form" | "embed";
|
|
2529
|
+
ticket_form_id?: string;
|
|
2530
|
+
embed_html?: string;
|
|
2531
|
+
embed_description?: string;
|
|
2532
|
+
display_mode?: "collapsible" | "display" | "both";
|
|
2132
2533
|
/** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
|
|
2133
2534
|
waiting_tool_call_ids?: string[];
|
|
2134
2535
|
}
|
|
@@ -2182,12 +2583,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
|
|
|
2182
2583
|
declare interface SubmitToolCallResult {
|
|
2183
2584
|
status: string;
|
|
2184
2585
|
result?: unknown;
|
|
2586
|
+
/** Set when `status` is `"error"`. */
|
|
2587
|
+
error?: string;
|
|
2588
|
+
/** The ticket a ticketing `form` tool call resolved to, when it did. */
|
|
2589
|
+
ticket?: {
|
|
2590
|
+
ticket_id: string;
|
|
2591
|
+
ticket_url?: string;
|
|
2592
|
+
[key: string]: unknown;
|
|
2593
|
+
};
|
|
2185
2594
|
resume?: {
|
|
2186
2595
|
message_id: string;
|
|
2187
2596
|
ready: boolean;
|
|
2188
2597
|
};
|
|
2189
2598
|
}
|
|
2190
2599
|
|
|
2600
|
+
/** A custom field of a ticket form. */
|
|
2601
|
+
declare interface TicketField {
|
|
2602
|
+
id: string;
|
|
2603
|
+
/** The key the ticketing backend expects; used as the submit key when set. */
|
|
2604
|
+
externalId?: string;
|
|
2605
|
+
title?: string;
|
|
2606
|
+
/** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
|
|
2607
|
+
type?: string;
|
|
2608
|
+
required: boolean;
|
|
2609
|
+
/** Carried in the submission but never shown. */
|
|
2610
|
+
hidden: boolean;
|
|
2611
|
+
active?: boolean;
|
|
2612
|
+
/** Bypass progressive disclosure, while still respecting conditions. */
|
|
2613
|
+
alwaysVisible?: boolean;
|
|
2614
|
+
regexpForValidation?: string;
|
|
2615
|
+
position: number;
|
|
2616
|
+
/** Non-empty turns the field into a select. */
|
|
2617
|
+
options: TicketFieldOption[];
|
|
2618
|
+
/** Show this field only when the parent field holds `conditionalFieldValue`. */
|
|
2619
|
+
conditionalFieldId?: string;
|
|
2620
|
+
/** Legacy comma-separated condition values. */
|
|
2621
|
+
conditionalFieldValue?: string;
|
|
2622
|
+
/** Takes precedence over conditionalFieldValue when non-empty. */
|
|
2623
|
+
conditionalFieldValues?: string[];
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
/** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
|
|
2627
|
+
declare interface TicketFieldOption {
|
|
2628
|
+
id: string;
|
|
2629
|
+
/** Label shown to the user. */
|
|
2630
|
+
name?: string;
|
|
2631
|
+
/** Value submitted. Falls back to `name` when absent. */
|
|
2632
|
+
value?: string;
|
|
2633
|
+
/** Preselected when the form opens. */
|
|
2634
|
+
default: boolean;
|
|
2635
|
+
/** A note shown under the field once this option is picked. */
|
|
2636
|
+
message?: string;
|
|
2637
|
+
messageType: "info" | "warning" | "danger";
|
|
2638
|
+
position?: number;
|
|
2639
|
+
group?: string;
|
|
2640
|
+
noDisplay?: boolean;
|
|
2641
|
+
conditionalFieldId?: string;
|
|
2642
|
+
/** Available when the parent matches any of these values. */
|
|
2643
|
+
conditionalFieldValues?: string[];
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
/** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
|
|
2647
|
+
declare interface TicketForm {
|
|
2648
|
+
id: string;
|
|
2649
|
+
name?: string;
|
|
2650
|
+
/** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
|
|
2651
|
+
mode: "form" | "embed";
|
|
2652
|
+
showSubject: boolean;
|
|
2653
|
+
showBody: boolean;
|
|
2654
|
+
showPriority: boolean;
|
|
2655
|
+
showTypology: boolean;
|
|
2656
|
+
priorityTypologies?: string[];
|
|
2657
|
+
successMessageText?: string;
|
|
2658
|
+
successMessageUrlLabel?: string;
|
|
2659
|
+
fields: TicketField[];
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2191
2662
|
/**
|
|
2192
2663
|
* Tool call data from SSE stream
|
|
2193
2664
|
*/
|
|
@@ -2202,10 +2673,122 @@ declare interface ToolCallData {
|
|
|
2202
2673
|
data?: Record<string, unknown>;
|
|
2203
2674
|
functionName?: string;
|
|
2204
2675
|
arguments?: Record<string, unknown>;
|
|
2676
|
+
/**
|
|
2677
|
+
* Where the hosted widget shows the call: in the collapsible "reasoning"
|
|
2678
|
+
* section, in the message body, or both. Absent means collapsible only.
|
|
2679
|
+
*/
|
|
2680
|
+
displayMode?: "collapsible" | "display" | "both";
|
|
2681
|
+
/** The user asked to talk to a human. */
|
|
2682
|
+
askToTalkToHuman?: boolean;
|
|
2683
|
+
/** `false` when the tenant blocks ticket creation for this visitor. */
|
|
2684
|
+
allowedToCreateTicket?: boolean;
|
|
2685
|
+
/** Fields the agent pre-filled from the conversation. */
|
|
2686
|
+
ticket?: ToolCallTicketPrefill;
|
|
2687
|
+
/** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
|
|
2688
|
+
mode?: "form" | "embed";
|
|
2689
|
+
ticketFormId?: string;
|
|
2690
|
+
embedHtml?: string;
|
|
2691
|
+
embedDescription?: string;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
/**
|
|
2695
|
+
* Every string the ticket form and its surrounding chrome show, with the
|
|
2696
|
+
* hosted widget's English defaults, so a non-English site can translate them
|
|
2697
|
+
* through `toolCallForm.labels`.
|
|
2698
|
+
*/
|
|
2699
|
+
export declare interface ToolCallFormLabels {
|
|
2700
|
+
useFormToCreateTicket: string;
|
|
2701
|
+
yourEmail: string;
|
|
2702
|
+
emailPlaceholder: string;
|
|
2703
|
+
emailRequired: string;
|
|
2704
|
+
emailInvalid: string;
|
|
2705
|
+
subject: string;
|
|
2706
|
+
subjectRequired: string;
|
|
2707
|
+
typology: string;
|
|
2708
|
+
selectTypology: string;
|
|
2709
|
+
typologyRequired: string;
|
|
2710
|
+
question: string;
|
|
2711
|
+
task: string;
|
|
2712
|
+
incident: string;
|
|
2713
|
+
priority: string;
|
|
2714
|
+
selectPriority: string;
|
|
2715
|
+
priorityRequired: string;
|
|
2716
|
+
low: string;
|
|
2717
|
+
normal: string;
|
|
2718
|
+
high: string;
|
|
2719
|
+
urgent: string;
|
|
2720
|
+
detailedContext: string;
|
|
2721
|
+
detailedContextRequired: string;
|
|
2722
|
+
/** `{fieldTitle}` is substituted. */
|
|
2723
|
+
fieldRequired: string;
|
|
2724
|
+
fieldFormatInvalid: string;
|
|
2725
|
+
attachments: string;
|
|
2726
|
+
selectFile: string;
|
|
2727
|
+
submit: string;
|
|
2728
|
+
loading: string;
|
|
2729
|
+
maxCharacters: string;
|
|
2730
|
+
ticketSubmitted: string;
|
|
2731
|
+
findTicketHere: string;
|
|
2732
|
+
noTicketForm: string;
|
|
2733
|
+
notAllowed: string;
|
|
2734
|
+
submissionFailed: string;
|
|
2735
|
+
submissionFailedDescription: string;
|
|
2736
|
+
fileTooLarge: string;
|
|
2737
|
+
permissionDenied: string;
|
|
2738
|
+
validationFailed: string;
|
|
2739
|
+
pleaseCheckFields: string;
|
|
2740
|
+
embeddedFormSubmitted: string;
|
|
2741
|
+
noEmbedConfigured: string;
|
|
2742
|
+
embedSubmitTimeout: string;
|
|
2743
|
+
tryAgain: string;
|
|
2744
|
+
contactFormCreated: string;
|
|
2745
|
+
contactFormRejected: string;
|
|
2746
|
+
genericFormComingSoon: string;
|
|
2747
|
+
unknownToolCall: string;
|
|
2748
|
+
formPending: string;
|
|
2749
|
+
ticketCreatedBlocked: string;
|
|
2750
|
+
newConversation: string;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
/** The ticket the agent pre-filled on a ticketing `form` tool call. */
|
|
2754
|
+
declare interface ToolCallTicketPrefill {
|
|
2755
|
+
subject?: string;
|
|
2756
|
+
body?: string;
|
|
2757
|
+
typology?: string;
|
|
2758
|
+
priority?: string;
|
|
2759
|
+
tag?: string;
|
|
2760
|
+
products?: string[];
|
|
2761
|
+
/** Keyed by the field's external id, or a lowercased, underscored title. */
|
|
2762
|
+
custom_fields?: Record<string, string>;
|
|
2205
2763
|
}
|
|
2206
2764
|
|
|
2207
2765
|
declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
|
|
2208
2766
|
|
|
2767
|
+
/** Options for `AgoClient.transcribeAudio`. */
|
|
2768
|
+
declare interface TranscribeAudioOptions {
|
|
2769
|
+
/** Cancel the upload or stop waiting for its transcription. */
|
|
2770
|
+
signal?: AbortSignal;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
/** The MCP behavior hints AGO has no equivalent for. */
|
|
2774
|
+
declare interface WebMCPToolMeta {
|
|
2775
|
+
/**
|
|
2776
|
+
* Both default to `false`, so only set what is true: `readOnlyHint` marks a
|
|
2777
|
+
* function that changes nothing, `untrustedContentHint` one whose result may
|
|
2778
|
+
* carry third-party text.
|
|
2779
|
+
*/
|
|
2780
|
+
annotations?: {
|
|
2781
|
+
readOnlyHint?: boolean;
|
|
2782
|
+
untrustedContentHint?: boolean;
|
|
2783
|
+
};
|
|
2784
|
+
/**
|
|
2785
|
+
* This function navigates. The WebMCP call is held open until the function
|
|
2786
|
+
* registry goes quiet, so the caller sees the destination page's tools rather
|
|
2787
|
+
* than the departing page's. Already set on the built-in `navigateToPage`.
|
|
2788
|
+
*/
|
|
2789
|
+
navigates?: boolean;
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2209
2792
|
/**
|
|
2210
2793
|
* The greeting shown before any conversation has started. Pass a plain string
|
|
2211
2794
|
* for the classic centered empty-state placeholder, or an object to control how
|
|
@@ -2262,6 +2845,57 @@ export declare interface WidgetFeedbackOptions {
|
|
|
2262
2845
|
onError?: (error: Error) => void;
|
|
2263
2846
|
}
|
|
2264
2847
|
|
|
2848
|
+
/**
|
|
2849
|
+
* Every string the bubble widget's chrome shows (header, footer, home,
|
|
2850
|
+
* history, errors), so a non-English site can translate them. Message-level
|
|
2851
|
+
* strings live in {@link WidgetFeedbackOptions.labels}.
|
|
2852
|
+
*/
|
|
2853
|
+
export declare interface WidgetLabels {
|
|
2854
|
+
/** Footer tab. */
|
|
2855
|
+
home: string;
|
|
2856
|
+
/** Footer tab. */
|
|
2857
|
+
chats: string;
|
|
2858
|
+
/** Header title on the history screen. */
|
|
2859
|
+
history: string;
|
|
2860
|
+
/** The floating pill on the history screen, and a thread without a title. */
|
|
2861
|
+
newConversation: string;
|
|
2862
|
+
/** Empty history screen. */
|
|
2863
|
+
noHistory: string;
|
|
2864
|
+
/** Composer placeholder on the home screen. */
|
|
2865
|
+
askQuestion: string;
|
|
2866
|
+
/** Accessible name of the header back button. */
|
|
2867
|
+
back: string;
|
|
2868
|
+
/** Accessible name of the header close button. */
|
|
2869
|
+
close: string;
|
|
2870
|
+
/** Accessible name of the header new-chat button. */
|
|
2871
|
+
newChat: string;
|
|
2872
|
+
/** Title of the alert shown on a failed answer. */
|
|
2873
|
+
errorTitle: string;
|
|
2874
|
+
/** Body of the alert shown on a failed answer. */
|
|
2875
|
+
errorDescription: string;
|
|
2876
|
+
/** Accessible name of the scroll-to-bottom button. */
|
|
2877
|
+
scrollToBottom: string;
|
|
2878
|
+
/** Label of the button that hides a file error. */
|
|
2879
|
+
dismiss: string;
|
|
2880
|
+
/** Accessible name of the attach button. */
|
|
2881
|
+
attachFiles: string;
|
|
2882
|
+
/** Composer file errors; `{max}` / `{name}` are substituted. */
|
|
2883
|
+
tooManyFiles: string;
|
|
2884
|
+
invalidFileType: string;
|
|
2885
|
+
fileTooLarge: string;
|
|
2886
|
+
/** Relative time templates on the history screen; `{n}` is the count. */
|
|
2887
|
+
timeAgo: {
|
|
2888
|
+
minutes: string;
|
|
2889
|
+
hours: string;
|
|
2890
|
+
days: string;
|
|
2891
|
+
weeks: string;
|
|
2892
|
+
months: string;
|
|
2893
|
+
};
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
/** The three screens of the bubble widget (`placement: "bubble"`). */
|
|
2897
|
+
export declare type WidgetScreen = "home" | "chat" | "history";
|
|
2898
|
+
|
|
2265
2899
|
/**
|
|
2266
2900
|
* Theme overrides for `mountChatWidget`. The keys map to `--ago-*` custom
|
|
2267
2901
|
* properties (see `THEME_VARS` in `./styles`).
|
|
@@ -2296,6 +2930,54 @@ export declare interface WidgetTheme {
|
|
|
2296
2930
|
accent?: string;
|
|
2297
2931
|
/** Background of assistant message bubbles when `agentBubble` is on. Defaults to a light gray. (`--ago-agent-bubble-background`) */
|
|
2298
2932
|
agentBubbleBg?: string;
|
|
2933
|
+
/** Text color inside assistant messages. Defaults to `text`. (`--ago-agent-bubble-text-color`) */
|
|
2934
|
+
agentBubbleText?: string;
|
|
2935
|
+
/** User message card background. `placement: "bubble"` only; defaults to white there. (`--ago-user-bubble-background`) */
|
|
2936
|
+
userBubbleBg?: string;
|
|
2937
|
+
/** User message text color. `placement: "bubble"` only. (`--ago-user-bubble-text-color`) */
|
|
2938
|
+
userBubbleText?: string;
|
|
2939
|
+
/** Floating launcher circle. `placement: "bubble"` only; defaults to `#007bff`. (`--ago-launcher-background`) */
|
|
2940
|
+
launcherBg?: string;
|
|
2941
|
+
/** Glyph color on the launcher. (`--ago-launcher-text-color`) */
|
|
2942
|
+
launcherText?: string;
|
|
2943
|
+
/** Composer send/stop button. `placement: "bubble"` only; defaults to `brand`. (`--ago-send-button-background`) */
|
|
2944
|
+
sendBg?: string;
|
|
2945
|
+
/** Panel width for `placement: "bubble"`, e.g. `"700px"`. Defaults to `550px`. (`--ago-panel-width`) */
|
|
2946
|
+
panelWidth?: string;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
/**
|
|
2950
|
+
* Fine-tuning for the ticket form the agent's `ago_ticketing` tool opens in
|
|
2951
|
+
* the conversation (the `form` tool call). The form is always on: a tool call
|
|
2952
|
+
* the widget ignored would leave the visitor stuck.
|
|
2953
|
+
*/
|
|
2954
|
+
export declare interface WidgetToolCallFormOptions {
|
|
2955
|
+
/** Translate any of the form's strings. */
|
|
2956
|
+
labels?: Partial<ToolCallFormLabels>;
|
|
2957
|
+
/** Replace the success text once the ticket exists. */
|
|
2958
|
+
successMessage?: string;
|
|
2959
|
+
/** Replace the "You can find it here:" label before the ticket link. */
|
|
2960
|
+
successUrlLabel?: string;
|
|
2961
|
+
/**
|
|
2962
|
+
* Email of the visitor when the SDK has no identity for them (no `userEmail`
|
|
2963
|
+
* or `userJwt` in the client config). When absent, the form asks for it.
|
|
2964
|
+
*/
|
|
2965
|
+
userEmail?: string;
|
|
2966
|
+
/** Called once the ticket exists and the tool call is completed. */
|
|
2967
|
+
onSubmitted?: (data: {
|
|
2968
|
+
toolCallId: string;
|
|
2969
|
+
toolName: string;
|
|
2970
|
+
mode: "form" | "embed";
|
|
2971
|
+
ticket?: {
|
|
2972
|
+
id: string;
|
|
2973
|
+
url?: string;
|
|
2974
|
+
};
|
|
2975
|
+
values: Record<string, unknown>;
|
|
2976
|
+
}) => void;
|
|
2977
|
+
/** Called when creating the ticket or completing the tool call failed. */
|
|
2978
|
+
onError?: (error: Error) => void;
|
|
2979
|
+
/** Called when the visitor starts a new conversation from the blocked composer. */
|
|
2980
|
+
onNewConversation?: () => void;
|
|
2299
2981
|
}
|
|
2300
2982
|
|
|
2301
2983
|
export { }
|