@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/testing.d.cts
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;
|
|
@@ -959,6 +1058,37 @@ declare type AgoStateSetResult = {
|
|
|
959
1058
|
result: "unchanged";
|
|
960
1059
|
};
|
|
961
1060
|
|
|
1061
|
+
/** Editable text returned by `AgoClient.transcribeAudio`. */
|
|
1062
|
+
declare interface AudioTranscription {
|
|
1063
|
+
text: string;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/** One JavaScript error captured on the page (deduplicated, see `count`). */
|
|
1067
|
+
declare interface CapturedError {
|
|
1068
|
+
type: CapturedErrorType;
|
|
1069
|
+
/** Error message, truncated to 500 chars. */
|
|
1070
|
+
message: string;
|
|
1071
|
+
/** Script URL the error came from, without its query string. */
|
|
1072
|
+
source?: string;
|
|
1073
|
+
line?: number;
|
|
1074
|
+
col?: number;
|
|
1075
|
+
/** Leading stack frames, truncated (see `maxStackChars`). */
|
|
1076
|
+
stack?: string;
|
|
1077
|
+
/** Pathname at capture time. */
|
|
1078
|
+
route: string;
|
|
1079
|
+
/** Epoch ms of the first occurrence. */
|
|
1080
|
+
firstAt: number;
|
|
1081
|
+
/** Epoch ms of the most recent occurrence. */
|
|
1082
|
+
lastAt: number;
|
|
1083
|
+
/** How many times this same error (type + message + source + line) fired. */
|
|
1084
|
+
count: number;
|
|
1085
|
+
/** App-provided context, manual reports only (size-clamped). */
|
|
1086
|
+
context?: Record<string, unknown>;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/** How an error reached the watcher. */
|
|
1090
|
+
declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
|
|
1091
|
+
|
|
962
1092
|
/**
|
|
963
1093
|
* Single-object function definition — combines name, schema, and handler.
|
|
964
1094
|
*
|
|
@@ -972,22 +1102,11 @@ declare type AgoStateSetResult = {
|
|
|
972
1102
|
* client.registerFunction(fn);
|
|
973
1103
|
* ```
|
|
974
1104
|
*/
|
|
975
|
-
declare interface ClientFunctionDefinition {
|
|
1105
|
+
declare interface ClientFunctionDefinition extends ClientFunctionSettings {
|
|
976
1106
|
name: string;
|
|
977
1107
|
description: string;
|
|
978
1108
|
parameters: ClientFunctionSchema["parameters"];
|
|
979
1109
|
handler: ClientFunctionHandler;
|
|
980
|
-
/**
|
|
981
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
982
|
-
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
983
|
-
* `Infinity` disables the guard for this function.
|
|
984
|
-
*/
|
|
985
|
-
maxResultBytes?: number;
|
|
986
|
-
/**
|
|
987
|
-
* Require explicit user approval before this function runs. See
|
|
988
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
989
|
-
*/
|
|
990
|
-
requiresApproval?: boolean;
|
|
991
1110
|
}
|
|
992
1111
|
|
|
993
1112
|
/**
|
|
@@ -1006,20 +1125,7 @@ declare interface ClientFunctionInvocation {
|
|
|
1006
1125
|
* Schema-plus-settings object accepted when registering a function: the schema
|
|
1007
1126
|
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
1008
1127
|
*/
|
|
1009
|
-
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> &
|
|
1010
|
-
/**
|
|
1011
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1012
|
-
* flagged preview. Overrides the client-level default
|
|
1013
|
-
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1014
|
-
* disables the guard for this function.
|
|
1015
|
-
*/
|
|
1016
|
-
maxResultBytes?: number;
|
|
1017
|
-
/**
|
|
1018
|
-
* Require explicit user approval before this function runs. See
|
|
1019
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1020
|
-
*/
|
|
1021
|
-
requiresApproval?: boolean;
|
|
1022
|
-
};
|
|
1128
|
+
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
|
|
1023
1129
|
|
|
1024
1130
|
/**
|
|
1025
1131
|
* Schema for a client-side function that AGO can call
|
|
@@ -1046,6 +1152,28 @@ declare interface ClientFunctionSchema {
|
|
|
1046
1152
|
};
|
|
1047
1153
|
}
|
|
1048
1154
|
|
|
1155
|
+
/** SDK-side function settings that are never sent to the backend. */
|
|
1156
|
+
declare interface ClientFunctionSettings {
|
|
1157
|
+
/**
|
|
1158
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1159
|
+
* flagged preview. Overrides the client-level default
|
|
1160
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1161
|
+
* disables the guard for this function.
|
|
1162
|
+
*/
|
|
1163
|
+
maxResultBytes?: number;
|
|
1164
|
+
/**
|
|
1165
|
+
* Require explicit user approval before this function runs. See
|
|
1166
|
+
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1167
|
+
*/
|
|
1168
|
+
requiresApproval?: boolean;
|
|
1169
|
+
/**
|
|
1170
|
+
* WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
|
|
1171
|
+
* `false` keeps this function out of WebMCP while leaving it available to the
|
|
1172
|
+
* in-app agent.
|
|
1173
|
+
*/
|
|
1174
|
+
webmcp?: WebMCPToolMeta | false;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1049
1177
|
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
1050
1178
|
declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
1051
1179
|
|
|
@@ -1105,6 +1233,30 @@ declare interface Conversation {
|
|
|
1105
1233
|
*/
|
|
1106
1234
|
export declare function createMockClient(options?: MockAgoClientOptions): MockAgoClient;
|
|
1107
1235
|
|
|
1236
|
+
/** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
|
|
1237
|
+
declare interface CreateTicketInput {
|
|
1238
|
+
subject: string;
|
|
1239
|
+
body: string;
|
|
1240
|
+
priority?: string;
|
|
1241
|
+
typology?: string;
|
|
1242
|
+
/** Conversation the ticket is filed from. */
|
|
1243
|
+
conversationId?: string;
|
|
1244
|
+
/** Reporter email, for a visitor the SDK does not otherwise identify. */
|
|
1245
|
+
email?: string;
|
|
1246
|
+
customFields?: Array<{
|
|
1247
|
+
id: string;
|
|
1248
|
+
value: string;
|
|
1249
|
+
}>;
|
|
1250
|
+
files?: File[];
|
|
1251
|
+
ticketFormId?: string;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/** Response of `AgoClient.createTicket`. */
|
|
1255
|
+
declare interface CreateTicketResult {
|
|
1256
|
+
id: string;
|
|
1257
|
+
url?: string;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1108
1260
|
/**
|
|
1109
1261
|
* A function that returns a fresh context entry on demand.
|
|
1110
1262
|
* Evaluated every time a message is sent — use it to pull data from stores,
|
|
@@ -1112,6 +1264,23 @@ export declare function createMockClient(options?: MockAgoClientOptions): MockAg
|
|
|
1112
1264
|
*/
|
|
1113
1265
|
declare type DynamicContextProvider = () => ContextEntry | null | undefined;
|
|
1114
1266
|
|
|
1267
|
+
declare interface ErrorWatcherOptions {
|
|
1268
|
+
/** Max distinct errors kept. Oldest dropped first. Default 10. */
|
|
1269
|
+
maxErrors?: number;
|
|
1270
|
+
/**
|
|
1271
|
+
* Errors older than this are pruned when the buffer is read, so a crash from
|
|
1272
|
+
* an hour ago does not confuse the agent. Default 600 000 (10 min).
|
|
1273
|
+
*/
|
|
1274
|
+
maxAgeMs?: number;
|
|
1275
|
+
/** Max chars of stack kept per error. Default 2000. */
|
|
1276
|
+
maxStackChars?: number;
|
|
1277
|
+
/**
|
|
1278
|
+
* Redact or drop an error before it is stored. Return the (possibly edited)
|
|
1279
|
+
* error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
|
|
1280
|
+
*/
|
|
1281
|
+
filter?: (error: CapturedError) => CapturedError | null;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1115
1284
|
/**
|
|
1116
1285
|
* Why the user is reporting a message (see `AgoClient.submitFeedback`).
|
|
1117
1286
|
*
|
|
@@ -1502,12 +1671,26 @@ declare interface ProactiveTriggerWhen {
|
|
|
1502
1671
|
pageState?: Partial<Record<string, unknown>>;
|
|
1503
1672
|
/** Min rage-click bursts on the current route. */
|
|
1504
1673
|
rageClicks?: number;
|
|
1674
|
+
/**
|
|
1675
|
+
* Min JavaScript errors captured on the current route. Needs the client's
|
|
1676
|
+
* `errorWatcher` enabled; without it the count stays at 0 and the matcher
|
|
1677
|
+
* never passes.
|
|
1678
|
+
*/
|
|
1679
|
+
jsErrors?: number;
|
|
1505
1680
|
/** Min A→B→A→B route oscillations this session. */
|
|
1506
1681
|
routeBounces?: number;
|
|
1507
1682
|
/** Per-field minimum error counts (field NAME → min count). */
|
|
1508
1683
|
fieldErrors?: Record<string, number>;
|
|
1509
1684
|
}
|
|
1510
1685
|
|
|
1686
|
+
/**
|
|
1687
|
+
* Registered function with handler
|
|
1688
|
+
*/
|
|
1689
|
+
declare interface RegisteredFunction extends ClientFunctionSettings {
|
|
1690
|
+
schema: ClientFunctionSchema;
|
|
1691
|
+
handler: ClientFunctionHandler;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1511
1694
|
/**
|
|
1512
1695
|
* Hook run before a paused turn is resumed, so the app controls WHEN the
|
|
1513
1696
|
* continuation fires (e.g. wait for the destination page to mount after a
|
|
@@ -1519,10 +1702,71 @@ declare type ResumeGate = (info: {
|
|
|
1519
1702
|
messageId: string;
|
|
1520
1703
|
}) => Promise<void> | void;
|
|
1521
1704
|
|
|
1705
|
+
/** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
|
|
1706
|
+
declare interface SdkConfig {
|
|
1707
|
+
permissions: SdkPermissionConfig[];
|
|
1708
|
+
proactive: {
|
|
1709
|
+
enabled: boolean;
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
/** The dashboard's home screen content (title, subtitle, starter cards). */
|
|
1714
|
+
declare interface SdkHomePageConfig {
|
|
1715
|
+
title?: string;
|
|
1716
|
+
/** Markdown. */
|
|
1717
|
+
subtitle?: string;
|
|
1718
|
+
starters: SdkHomeStarter[];
|
|
1719
|
+
widgetStarter?: SdkWidgetStarter;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* A conversation starter card configured in the AGO dashboard. `label` is what
|
|
1724
|
+
* the card shows; clicking it sends `message`.
|
|
1725
|
+
*/
|
|
1726
|
+
declare interface SdkHomeStarter {
|
|
1727
|
+
id: string;
|
|
1728
|
+
/** The card's text (the starter's `description` in the dashboard). */
|
|
1729
|
+
label: string;
|
|
1730
|
+
/** What is sent when the card is clicked. */
|
|
1731
|
+
message: string;
|
|
1732
|
+
/** Answer with this agent instead of the configured default. */
|
|
1733
|
+
agentId?: string;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/** One permission's configuration in {@link SdkConfig}. */
|
|
1737
|
+
declare interface SdkPermissionConfig {
|
|
1738
|
+
id?: string;
|
|
1739
|
+
name?: string;
|
|
1740
|
+
displayName?: string;
|
|
1741
|
+
agents: Array<{
|
|
1742
|
+
id: string;
|
|
1743
|
+
name?: string;
|
|
1744
|
+
}>;
|
|
1745
|
+
ticketForm?: TicketForm;
|
|
1746
|
+
/** Home screen content, when the tenant configured one. */
|
|
1747
|
+
homePage?: SdkHomePageConfig;
|
|
1748
|
+
fileAttachmentsEnabled: boolean;
|
|
1749
|
+
voiceEnabled: boolean;
|
|
1750
|
+
/** Whether audio uploads can be transcribed. Defaults to false on older backends. */
|
|
1751
|
+
speechToTextEnabled: boolean;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* The starter the dashboard sends by itself on a fresh visit, before the
|
|
1756
|
+
* visitor types anything.
|
|
1757
|
+
*/
|
|
1758
|
+
declare interface SdkWidgetStarter {
|
|
1759
|
+
id: string;
|
|
1760
|
+
message: string;
|
|
1761
|
+
agentId?: string;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1522
1764
|
/**
|
|
1523
1765
|
* Options for sending a message
|
|
1524
1766
|
*/
|
|
1525
1767
|
declare interface SendMessageOptions {
|
|
1768
|
+
/** Replaces config.metadata for this message; null omits metadata for this message. */
|
|
1769
|
+
metadata?: Record<string, unknown> | null;
|
|
1526
1770
|
/** Existing conversation ID */
|
|
1527
1771
|
conversationId?: string;
|
|
1528
1772
|
/** Override default agent */
|
|
@@ -1571,6 +1815,12 @@ declare interface SignalsSnapshot {
|
|
|
1571
1815
|
idleMs: number;
|
|
1572
1816
|
/** Rage-click bursts detected on the current route. */
|
|
1573
1817
|
rageClicks: number;
|
|
1818
|
+
/**
|
|
1819
|
+
* JavaScript errors captured on the current route (count only; the messages
|
|
1820
|
+
* travel in `client_context` under `errors:recent`). Always `0` unless the
|
|
1821
|
+
* client has `errorWatcher` enabled.
|
|
1822
|
+
*/
|
|
1823
|
+
jsErrors: number;
|
|
1574
1824
|
/**
|
|
1575
1825
|
* A→B→A→B route oscillations detected in the recent route sequence. Rolling
|
|
1576
1826
|
* session counter (cross-route by nature); trigger cooldowns and dismissal
|
|
@@ -1629,6 +1879,13 @@ declare interface SSEChunkData {
|
|
|
1629
1879
|
follow_up_replies?: string[];
|
|
1630
1880
|
satisfaction_feedback?: unknown;
|
|
1631
1881
|
ask_to_talk_to_human?: boolean;
|
|
1882
|
+
allowed_to_create_ticket?: boolean;
|
|
1883
|
+
ticket?: ToolCallTicketPrefill;
|
|
1884
|
+
mode?: "form" | "embed";
|
|
1885
|
+
ticket_form_id?: string;
|
|
1886
|
+
embed_html?: string;
|
|
1887
|
+
embed_description?: string;
|
|
1888
|
+
display_mode?: "collapsible" | "display" | "both";
|
|
1632
1889
|
/** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
|
|
1633
1890
|
waiting_tool_call_ids?: string[];
|
|
1634
1891
|
}
|
|
@@ -1682,12 +1939,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
|
|
|
1682
1939
|
declare interface SubmitToolCallResult {
|
|
1683
1940
|
status: string;
|
|
1684
1941
|
result?: unknown;
|
|
1942
|
+
/** Set when `status` is `"error"`. */
|
|
1943
|
+
error?: string;
|
|
1944
|
+
/** The ticket a ticketing `form` tool call resolved to, when it did. */
|
|
1945
|
+
ticket?: {
|
|
1946
|
+
ticket_id: string;
|
|
1947
|
+
ticket_url?: string;
|
|
1948
|
+
[key: string]: unknown;
|
|
1949
|
+
};
|
|
1685
1950
|
resume?: {
|
|
1686
1951
|
message_id: string;
|
|
1687
1952
|
ready: boolean;
|
|
1688
1953
|
};
|
|
1689
1954
|
}
|
|
1690
1955
|
|
|
1956
|
+
/** A custom field of a ticket form. */
|
|
1957
|
+
declare interface TicketField {
|
|
1958
|
+
id: string;
|
|
1959
|
+
/** The key the ticketing backend expects; used as the submit key when set. */
|
|
1960
|
+
externalId?: string;
|
|
1961
|
+
title?: string;
|
|
1962
|
+
/** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
|
|
1963
|
+
type?: string;
|
|
1964
|
+
required: boolean;
|
|
1965
|
+
/** Carried in the submission but never shown. */
|
|
1966
|
+
hidden: boolean;
|
|
1967
|
+
active?: boolean;
|
|
1968
|
+
/** Bypass progressive disclosure, while still respecting conditions. */
|
|
1969
|
+
alwaysVisible?: boolean;
|
|
1970
|
+
regexpForValidation?: string;
|
|
1971
|
+
position: number;
|
|
1972
|
+
/** Non-empty turns the field into a select. */
|
|
1973
|
+
options: TicketFieldOption[];
|
|
1974
|
+
/** Show this field only when the parent field holds `conditionalFieldValue`. */
|
|
1975
|
+
conditionalFieldId?: string;
|
|
1976
|
+
/** Legacy comma-separated condition values. */
|
|
1977
|
+
conditionalFieldValue?: string;
|
|
1978
|
+
/** Takes precedence over conditionalFieldValue when non-empty. */
|
|
1979
|
+
conditionalFieldValues?: string[];
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
/** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
|
|
1983
|
+
declare interface TicketFieldOption {
|
|
1984
|
+
id: string;
|
|
1985
|
+
/** Label shown to the user. */
|
|
1986
|
+
name?: string;
|
|
1987
|
+
/** Value submitted. Falls back to `name` when absent. */
|
|
1988
|
+
value?: string;
|
|
1989
|
+
/** Preselected when the form opens. */
|
|
1990
|
+
default: boolean;
|
|
1991
|
+
/** A note shown under the field once this option is picked. */
|
|
1992
|
+
message?: string;
|
|
1993
|
+
messageType: "info" | "warning" | "danger";
|
|
1994
|
+
position?: number;
|
|
1995
|
+
group?: string;
|
|
1996
|
+
noDisplay?: boolean;
|
|
1997
|
+
conditionalFieldId?: string;
|
|
1998
|
+
/** Available when the parent matches any of these values. */
|
|
1999
|
+
conditionalFieldValues?: string[];
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
|
|
2003
|
+
declare interface TicketForm {
|
|
2004
|
+
id: string;
|
|
2005
|
+
name?: string;
|
|
2006
|
+
/** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
|
|
2007
|
+
mode: "form" | "embed";
|
|
2008
|
+
showSubject: boolean;
|
|
2009
|
+
showBody: boolean;
|
|
2010
|
+
showPriority: boolean;
|
|
2011
|
+
showTypology: boolean;
|
|
2012
|
+
priorityTypologies?: string[];
|
|
2013
|
+
successMessageText?: string;
|
|
2014
|
+
successMessageUrlLabel?: string;
|
|
2015
|
+
fields: TicketField[];
|
|
2016
|
+
}
|
|
2017
|
+
|
|
1691
2018
|
/**
|
|
1692
2019
|
* Tool call data from SSE stream
|
|
1693
2020
|
*/
|
|
@@ -1702,8 +2029,61 @@ declare interface ToolCallData {
|
|
|
1702
2029
|
data?: Record<string, unknown>;
|
|
1703
2030
|
functionName?: string;
|
|
1704
2031
|
arguments?: Record<string, unknown>;
|
|
2032
|
+
/**
|
|
2033
|
+
* Where the hosted widget shows the call: in the collapsible "reasoning"
|
|
2034
|
+
* section, in the message body, or both. Absent means collapsible only.
|
|
2035
|
+
*/
|
|
2036
|
+
displayMode?: "collapsible" | "display" | "both";
|
|
2037
|
+
/** The user asked to talk to a human. */
|
|
2038
|
+
askToTalkToHuman?: boolean;
|
|
2039
|
+
/** `false` when the tenant blocks ticket creation for this visitor. */
|
|
2040
|
+
allowedToCreateTicket?: boolean;
|
|
2041
|
+
/** Fields the agent pre-filled from the conversation. */
|
|
2042
|
+
ticket?: ToolCallTicketPrefill;
|
|
2043
|
+
/** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
|
|
2044
|
+
mode?: "form" | "embed";
|
|
2045
|
+
ticketFormId?: string;
|
|
2046
|
+
embedHtml?: string;
|
|
2047
|
+
embedDescription?: string;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
/** The ticket the agent pre-filled on a ticketing `form` tool call. */
|
|
2051
|
+
declare interface ToolCallTicketPrefill {
|
|
2052
|
+
subject?: string;
|
|
2053
|
+
body?: string;
|
|
2054
|
+
typology?: string;
|
|
2055
|
+
priority?: string;
|
|
2056
|
+
tag?: string;
|
|
2057
|
+
products?: string[];
|
|
2058
|
+
/** Keyed by the field's external id, or a lowercased, underscored title. */
|
|
2059
|
+
custom_fields?: Record<string, string>;
|
|
1705
2060
|
}
|
|
1706
2061
|
|
|
1707
2062
|
declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
|
|
1708
2063
|
|
|
2064
|
+
/** Options for `AgoClient.transcribeAudio`. */
|
|
2065
|
+
declare interface TranscribeAudioOptions {
|
|
2066
|
+
/** Cancel the upload or stop waiting for its transcription. */
|
|
2067
|
+
signal?: AbortSignal;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
/** The MCP behavior hints AGO has no equivalent for. */
|
|
2071
|
+
declare interface WebMCPToolMeta {
|
|
2072
|
+
/**
|
|
2073
|
+
* Both default to `false`, so only set what is true: `readOnlyHint` marks a
|
|
2074
|
+
* function that changes nothing, `untrustedContentHint` one whose result may
|
|
2075
|
+
* carry third-party text.
|
|
2076
|
+
*/
|
|
2077
|
+
annotations?: {
|
|
2078
|
+
readOnlyHint?: boolean;
|
|
2079
|
+
untrustedContentHint?: boolean;
|
|
2080
|
+
};
|
|
2081
|
+
/**
|
|
2082
|
+
* This function navigates. The WebMCP call is held open until the function
|
|
2083
|
+
* registry goes quiet, so the caller sees the destination page's tools rather
|
|
2084
|
+
* than the departing page's. Already set on the built-in `navigateToPage`.
|
|
2085
|
+
*/
|
|
2086
|
+
navigates?: boolean;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
1709
2089
|
export { }
|