@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/angular.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ declare class AgoClient {
|
|
|
70
70
|
private contextRegistry;
|
|
71
71
|
private eventEmitter;
|
|
72
72
|
private activityLedger;
|
|
73
|
+
private errorWatcher;
|
|
73
74
|
private lastSentPageState;
|
|
74
75
|
private config;
|
|
75
76
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
@@ -108,7 +109,10 @@ declare class AgoClient {
|
|
|
108
109
|
* `null` otherwise.
|
|
109
110
|
*/
|
|
110
111
|
proactive: ProactiveController | null;
|
|
112
|
+
/** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
|
|
113
|
+
private detachWebMCP;
|
|
111
114
|
constructor(config: AgoConfig);
|
|
115
|
+
private attachWebMCPBridge;
|
|
112
116
|
/**
|
|
113
117
|
* Send a message and receive a streaming response
|
|
114
118
|
*/
|
|
@@ -220,6 +224,7 @@ declare class AgoClient {
|
|
|
220
224
|
* (the agent decides what to do next). No-op if the invocation is unknown.
|
|
221
225
|
*/
|
|
222
226
|
rejectFunction(invocationId: string): Promise<void>;
|
|
227
|
+
/* Excluded from this release type: runExternalFunction */
|
|
223
228
|
/**
|
|
224
229
|
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
225
230
|
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
@@ -239,6 +244,35 @@ declare class AgoClient {
|
|
|
239
244
|
* `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
|
|
240
245
|
*/
|
|
241
246
|
private static mapPersistedToolCalls;
|
|
247
|
+
/**
|
|
248
|
+
* Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
|
|
249
|
+
* Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
|
|
250
|
+
* MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
|
|
251
|
+
* The filename must include the matching extension. For a MediaRecorder blob,
|
|
252
|
+
* wrap it in a File with the recording's extension and MIME type.
|
|
253
|
+
* Show the returned text as a draft; call `sendMessage` when the user sends it.
|
|
254
|
+
*/
|
|
255
|
+
transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
|
|
256
|
+
/**
|
|
257
|
+
* The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
|
|
258
|
+
* agents, the ticket form the agent's `ago_ticketing` tool opens, and the
|
|
259
|
+
* file-attachment and speech-to-text flags. The vanilla widget fetches it
|
|
260
|
+
* once, when a ticket form first appears in a conversation.
|
|
261
|
+
*/
|
|
262
|
+
getConfig(): Promise<SdkConfig>;
|
|
263
|
+
/**
|
|
264
|
+
* The dashboard's home screen content. A starter card shows its
|
|
265
|
+
* `description` and sends its `initial_message`; one with neither is
|
|
266
|
+
* unusable and is dropped rather than rendered as an empty card.
|
|
267
|
+
*/
|
|
268
|
+
private static mapHomePage;
|
|
269
|
+
private static mapTicketForm;
|
|
270
|
+
/**
|
|
271
|
+
* Create a support ticket (`POST /api/sdk/v1/tickets`, multipart). This is
|
|
272
|
+
* what the ticket form in the conversation does before it completes the
|
|
273
|
+
* `form` tool call with {@link submitToolCallForm}.
|
|
274
|
+
*/
|
|
275
|
+
createTicket(input: CreateTicketInput): Promise<CreateTicketResult>;
|
|
242
276
|
/**
|
|
243
277
|
* Get messages for a conversation
|
|
244
278
|
*/
|
|
@@ -360,6 +394,9 @@ declare class AgoClient {
|
|
|
360
394
|
* Get all registered function schemas
|
|
361
395
|
*/
|
|
362
396
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
397
|
+
/** The callback form of `functions:changed`. Returns an unsubscribe. */
|
|
398
|
+
onFunctionsChanged(listener: () => void): () => void;
|
|
399
|
+
/* Excluded from this release type: getFunctionRegistrations */
|
|
363
400
|
/**
|
|
364
401
|
* Execute a registered client function locally, through the same
|
|
365
402
|
* FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
|
|
@@ -497,6 +534,15 @@ declare class AgoClient {
|
|
|
497
534
|
/* Excluded from this release type: emitProactiveEvent */
|
|
498
535
|
/* Excluded from this release type: getHttp */
|
|
499
536
|
/* Excluded from this release type: getConfiguredAgent */
|
|
537
|
+
/**
|
|
538
|
+
* How the SDK identifies the visitor: the configured `userEmail`, and
|
|
539
|
+
* whether a `userJwt` is set. The ticket form asks for an email when it has
|
|
540
|
+
* neither.
|
|
541
|
+
*/
|
|
542
|
+
getUserIdentity(): {
|
|
543
|
+
email?: string;
|
|
544
|
+
hasJwt: boolean;
|
|
545
|
+
};
|
|
500
546
|
/**
|
|
501
547
|
* Enable automatic capture of the current browser page (URL + title).
|
|
502
548
|
* Injected as a dynamic context entry named `browser-page`.
|
|
@@ -519,6 +565,26 @@ declare class AgoClient {
|
|
|
519
565
|
private addActivity;
|
|
520
566
|
private recordAgentAction;
|
|
521
567
|
private registerActivityContext;
|
|
568
|
+
/**
|
|
569
|
+
* Start capturing the page's JavaScript errors (uncaught exceptions,
|
|
570
|
+
* unhandled rejections, `console.error` calls, {@link reportError}) and send
|
|
571
|
+
* the recent ones as the `errors:recent` context entry on every message.
|
|
572
|
+
* Same as setting `errorWatcher` in the config. Calling it again replaces
|
|
573
|
+
* the watcher (and its options); the captured errors are not kept.
|
|
574
|
+
*/
|
|
575
|
+
enableErrorWatcher(options?: ErrorWatcherOptions): void;
|
|
576
|
+
/** Stop capturing errors and drop the `errors:recent` context entry. */
|
|
577
|
+
disableErrorWatcher(): void;
|
|
578
|
+
/**
|
|
579
|
+
* Record an error the app caught itself (React error boundary, Vue
|
|
580
|
+
* `errorHandler`, Angular `ErrorHandler`, a try/catch) so the agent sees it
|
|
581
|
+
* like an uncaught one. No-op unless the error watcher is enabled. `context`
|
|
582
|
+
* is size-clamped before it is stored; keep it small and free of secrets.
|
|
583
|
+
*/
|
|
584
|
+
reportError(error: unknown, context?: Record<string, unknown>): void;
|
|
585
|
+
/** Errors the watcher currently holds, oldest first (a copy). Empty when disabled. */
|
|
586
|
+
getRecentErrors(): CapturedError[];
|
|
587
|
+
clearErrors(): void;
|
|
522
588
|
/**
|
|
523
589
|
* Subscribe to an event
|
|
524
590
|
*/
|
|
@@ -663,6 +729,8 @@ export declare interface AgoClientEvents {
|
|
|
663
729
|
* call running immediately.
|
|
664
730
|
*/
|
|
665
731
|
"function:awaiting-approval": ClientFunctionInvocation;
|
|
732
|
+
/** A function was registered or unregistered, or the registry cleared. */
|
|
733
|
+
"functions:changed": ClientFunctionSchema[];
|
|
666
734
|
"function:result": {
|
|
667
735
|
invocationId: string;
|
|
668
736
|
result: unknown;
|
|
@@ -713,6 +781,12 @@ export declare interface AgoClientEvents {
|
|
|
713
781
|
};
|
|
714
782
|
/** A user- or agent-action was recorded into the activity ledger. */
|
|
715
783
|
"activity:recorded": ActivityEntry;
|
|
784
|
+
/**
|
|
785
|
+
* The error watcher captured a JavaScript error (uncaught exception,
|
|
786
|
+
* unhandled rejection, `console.error` call, or `reportError`). Fires on
|
|
787
|
+
* repeats too, with the updated `count`. Requires `errorWatcher` in the config.
|
|
788
|
+
*/
|
|
789
|
+
"error:captured": CapturedError;
|
|
716
790
|
}
|
|
717
791
|
|
|
718
792
|
/**
|
|
@@ -729,10 +803,14 @@ export declare interface AgoConfig {
|
|
|
729
803
|
defaultAgentId?: string;
|
|
730
804
|
/** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
|
|
731
805
|
permission?: string;
|
|
806
|
+
/** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
|
|
807
|
+
language?: string | null;
|
|
732
808
|
/** User email for identification */
|
|
733
809
|
userEmail?: string;
|
|
734
810
|
/** JWT token for authenticated users */
|
|
735
811
|
userJwt?: string;
|
|
812
|
+
/** User metadata sent with messages. Use null to stop sending defaults. Not an authentication credential. */
|
|
813
|
+
metadata?: Record<string, unknown> | null;
|
|
736
814
|
/** Enable debug logging */
|
|
737
815
|
debug?: boolean;
|
|
738
816
|
/**
|
|
@@ -792,6 +870,27 @@ export declare interface AgoConfig {
|
|
|
792
870
|
* default otherwise.
|
|
793
871
|
*/
|
|
794
872
|
proactive?: ProactiveOptions;
|
|
873
|
+
/**
|
|
874
|
+
* Capture the page's JavaScript errors as agent context. When set, the SDK
|
|
875
|
+
* listens for uncaught exceptions and unhandled promise rejections, wraps
|
|
876
|
+
* `console.error` (calling through; restored on `destroy`), and sends the
|
|
877
|
+
* recent errors (deduplicated, capped, pruned after 10 min) as the
|
|
878
|
+
* `errors:recent` context entry on every message. `true` uses the defaults;
|
|
879
|
+
* pass {@link ErrorWatcherOptions} to tune the caps or add a `filter` that
|
|
880
|
+
* redacts messages. Off by default: error messages can carry PII or internal
|
|
881
|
+
* URLs, so enabling it is the host's call. Errors also feed the proactive
|
|
882
|
+
* mode's `jsErrors` signal. See `client.reportError()` for caught errors.
|
|
883
|
+
*/
|
|
884
|
+
errorWatcher?: boolean | ErrorWatcherOptions;
|
|
885
|
+
/** Mirror every registered client function into the browser's WebMCP registry
|
|
886
|
+
* (`document.modelContext`), so an external agent can call the same functions
|
|
887
|
+
* the in-app agent calls. Off by default; no-ops without WebMCP.
|
|
888
|
+
*
|
|
889
|
+
* A mirrored function runs immediately: the approval gate
|
|
890
|
+
* ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
|
|
891
|
+
* Use `webmcp: false` on a definition to keep it out.
|
|
892
|
+
*/
|
|
893
|
+
webmcp?: boolean;
|
|
795
894
|
}
|
|
796
895
|
|
|
797
896
|
declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
|
|
@@ -978,6 +1077,8 @@ export declare class AgoService {
|
|
|
978
1077
|
private fromEvent;
|
|
979
1078
|
/** Send a message and get a streaming response */
|
|
980
1079
|
sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
|
|
1080
|
+
/** Transcribe an audio file into an editable draft. */
|
|
1081
|
+
transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
|
|
981
1082
|
/**
|
|
982
1083
|
* Stop the turn that is generating: closes the stream and tells the backend to
|
|
983
1084
|
* stop generating. The partial answer is kept and the message ends as
|
|
@@ -1110,6 +1211,37 @@ declare type AgoStateSetResult = {
|
|
|
1110
1211
|
result: "unchanged";
|
|
1111
1212
|
};
|
|
1112
1213
|
|
|
1214
|
+
/** Editable text returned by `AgoClient.transcribeAudio`. */
|
|
1215
|
+
export declare interface AudioTranscription {
|
|
1216
|
+
text: string;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/** One JavaScript error captured on the page (deduplicated, see `count`). */
|
|
1220
|
+
declare interface CapturedError {
|
|
1221
|
+
type: CapturedErrorType;
|
|
1222
|
+
/** Error message, truncated to 500 chars. */
|
|
1223
|
+
message: string;
|
|
1224
|
+
/** Script URL the error came from, without its query string. */
|
|
1225
|
+
source?: string;
|
|
1226
|
+
line?: number;
|
|
1227
|
+
col?: number;
|
|
1228
|
+
/** Leading stack frames, truncated (see `maxStackChars`). */
|
|
1229
|
+
stack?: string;
|
|
1230
|
+
/** Pathname at capture time. */
|
|
1231
|
+
route: string;
|
|
1232
|
+
/** Epoch ms of the first occurrence. */
|
|
1233
|
+
firstAt: number;
|
|
1234
|
+
/** Epoch ms of the most recent occurrence. */
|
|
1235
|
+
lastAt: number;
|
|
1236
|
+
/** How many times this same error (type + message + source + line) fired. */
|
|
1237
|
+
count: number;
|
|
1238
|
+
/** App-provided context, manual reports only (size-clamped). */
|
|
1239
|
+
context?: Record<string, unknown>;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/** How an error reached the watcher. */
|
|
1243
|
+
declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
|
|
1244
|
+
|
|
1113
1245
|
/**
|
|
1114
1246
|
* Single-object function definition — combines name, schema, and handler.
|
|
1115
1247
|
*
|
|
@@ -1123,22 +1255,11 @@ declare type AgoStateSetResult = {
|
|
|
1123
1255
|
* client.registerFunction(fn);
|
|
1124
1256
|
* ```
|
|
1125
1257
|
*/
|
|
1126
|
-
declare interface ClientFunctionDefinition {
|
|
1258
|
+
declare interface ClientFunctionDefinition extends ClientFunctionSettings {
|
|
1127
1259
|
name: string;
|
|
1128
1260
|
description: string;
|
|
1129
1261
|
parameters: ClientFunctionSchema["parameters"];
|
|
1130
1262
|
handler: ClientFunctionHandler;
|
|
1131
|
-
/**
|
|
1132
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1133
|
-
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
1134
|
-
* `Infinity` disables the guard for this function.
|
|
1135
|
-
*/
|
|
1136
|
-
maxResultBytes?: number;
|
|
1137
|
-
/**
|
|
1138
|
-
* Require explicit user approval before this function runs. See
|
|
1139
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1140
|
-
*/
|
|
1141
|
-
requiresApproval?: boolean;
|
|
1142
1263
|
}
|
|
1143
1264
|
|
|
1144
1265
|
/**
|
|
@@ -1157,20 +1278,7 @@ declare interface ClientFunctionInvocation {
|
|
|
1157
1278
|
* Schema-plus-settings object accepted when registering a function: the schema
|
|
1158
1279
|
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
1159
1280
|
*/
|
|
1160
|
-
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> &
|
|
1161
|
-
/**
|
|
1162
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1163
|
-
* flagged preview. Overrides the client-level default
|
|
1164
|
-
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1165
|
-
* disables the guard for this function.
|
|
1166
|
-
*/
|
|
1167
|
-
maxResultBytes?: number;
|
|
1168
|
-
/**
|
|
1169
|
-
* Require explicit user approval before this function runs. See
|
|
1170
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1171
|
-
*/
|
|
1172
|
-
requiresApproval?: boolean;
|
|
1173
|
-
};
|
|
1281
|
+
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
|
|
1174
1282
|
|
|
1175
1283
|
/**
|
|
1176
1284
|
* Schema for a client-side function that AGO can call
|
|
@@ -1197,6 +1305,28 @@ declare interface ClientFunctionSchema {
|
|
|
1197
1305
|
};
|
|
1198
1306
|
}
|
|
1199
1307
|
|
|
1308
|
+
/** SDK-side function settings that are never sent to the backend. */
|
|
1309
|
+
declare interface ClientFunctionSettings {
|
|
1310
|
+
/**
|
|
1311
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1312
|
+
* flagged preview. Overrides the client-level default
|
|
1313
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1314
|
+
* disables the guard for this function.
|
|
1315
|
+
*/
|
|
1316
|
+
maxResultBytes?: number;
|
|
1317
|
+
/**
|
|
1318
|
+
* Require explicit user approval before this function runs. See
|
|
1319
|
+
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1320
|
+
*/
|
|
1321
|
+
requiresApproval?: boolean;
|
|
1322
|
+
/**
|
|
1323
|
+
* WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
|
|
1324
|
+
* `false` keeps this function out of WebMCP while leaving it available to the
|
|
1325
|
+
* in-app agent.
|
|
1326
|
+
*/
|
|
1327
|
+
webmcp?: WebMCPToolMeta | false;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1200
1330
|
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
1201
1331
|
declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
1202
1332
|
|
|
@@ -1243,6 +1373,30 @@ export declare interface Conversation {
|
|
|
1243
1373
|
messages?: AgoMessage[];
|
|
1244
1374
|
}
|
|
1245
1375
|
|
|
1376
|
+
/** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
|
|
1377
|
+
declare interface CreateTicketInput {
|
|
1378
|
+
subject: string;
|
|
1379
|
+
body: string;
|
|
1380
|
+
priority?: string;
|
|
1381
|
+
typology?: string;
|
|
1382
|
+
/** Conversation the ticket is filed from. */
|
|
1383
|
+
conversationId?: string;
|
|
1384
|
+
/** Reporter email, for a visitor the SDK does not otherwise identify. */
|
|
1385
|
+
email?: string;
|
|
1386
|
+
customFields?: Array<{
|
|
1387
|
+
id: string;
|
|
1388
|
+
value: string;
|
|
1389
|
+
}>;
|
|
1390
|
+
files?: File[];
|
|
1391
|
+
ticketFormId?: string;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
/** Response of `AgoClient.createTicket`. */
|
|
1395
|
+
declare interface CreateTicketResult {
|
|
1396
|
+
id: string;
|
|
1397
|
+
url?: string;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1246
1400
|
/**
|
|
1247
1401
|
* A function that returns a fresh context entry on demand.
|
|
1248
1402
|
* Evaluated every time a message is sent — use it to pull data from stores,
|
|
@@ -1250,6 +1404,23 @@ export declare interface Conversation {
|
|
|
1250
1404
|
*/
|
|
1251
1405
|
declare type DynamicContextProvider = () => ContextEntry | null | undefined;
|
|
1252
1406
|
|
|
1407
|
+
declare interface ErrorWatcherOptions {
|
|
1408
|
+
/** Max distinct errors kept. Oldest dropped first. Default 10. */
|
|
1409
|
+
maxErrors?: number;
|
|
1410
|
+
/**
|
|
1411
|
+
* Errors older than this are pruned when the buffer is read, so a crash from
|
|
1412
|
+
* an hour ago does not confuse the agent. Default 600 000 (10 min).
|
|
1413
|
+
*/
|
|
1414
|
+
maxAgeMs?: number;
|
|
1415
|
+
/** Max chars of stack kept per error. Default 2000. */
|
|
1416
|
+
maxStackChars?: number;
|
|
1417
|
+
/**
|
|
1418
|
+
* Redact or drop an error before it is stored. Return the (possibly edited)
|
|
1419
|
+
* error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
|
|
1420
|
+
*/
|
|
1421
|
+
filter?: (error: CapturedError) => CapturedError | null;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1253
1424
|
/** The four values of {@link FeedbackReason}, in dashboard order. */
|
|
1254
1425
|
export declare const FEEDBACK_REASONS: readonly FeedbackReason[];
|
|
1255
1426
|
|
|
@@ -1622,6 +1793,12 @@ declare interface ProactiveTriggerWhen {
|
|
|
1622
1793
|
pageState?: Partial<Record<string, unknown>>;
|
|
1623
1794
|
/** Min rage-click bursts on the current route. */
|
|
1624
1795
|
rageClicks?: number;
|
|
1796
|
+
/**
|
|
1797
|
+
* Min JavaScript errors captured on the current route. Needs the client's
|
|
1798
|
+
* `errorWatcher` enabled; without it the count stays at 0 and the matcher
|
|
1799
|
+
* never passes.
|
|
1800
|
+
*/
|
|
1801
|
+
jsErrors?: number;
|
|
1625
1802
|
/** Min A→B→A→B route oscillations this session. */
|
|
1626
1803
|
routeBounces?: number;
|
|
1627
1804
|
/** Per-field minimum error counts (field NAME → min count). */
|
|
@@ -1652,6 +1829,14 @@ export declare function provideAgo(options: AgoProvideOptions): {
|
|
|
1652
1829
|
useValue: AgoService;
|
|
1653
1830
|
};
|
|
1654
1831
|
|
|
1832
|
+
/**
|
|
1833
|
+
* Registered function with handler
|
|
1834
|
+
*/
|
|
1835
|
+
declare interface RegisteredFunction extends ClientFunctionSettings {
|
|
1836
|
+
schema: ClientFunctionSchema;
|
|
1837
|
+
handler: ClientFunctionHandler;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1655
1840
|
/**
|
|
1656
1841
|
* Hook run before a paused turn is resumed, so the app controls WHEN the
|
|
1657
1842
|
* continuation fires (e.g. wait for the destination page to mount after a
|
|
@@ -1663,10 +1848,71 @@ declare type ResumeGate = (info: {
|
|
|
1663
1848
|
messageId: string;
|
|
1664
1849
|
}) => Promise<void> | void;
|
|
1665
1850
|
|
|
1851
|
+
/** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
|
|
1852
|
+
declare interface SdkConfig {
|
|
1853
|
+
permissions: SdkPermissionConfig[];
|
|
1854
|
+
proactive: {
|
|
1855
|
+
enabled: boolean;
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
/** The dashboard's home screen content (title, subtitle, starter cards). */
|
|
1860
|
+
declare interface SdkHomePageConfig {
|
|
1861
|
+
title?: string;
|
|
1862
|
+
/** Markdown. */
|
|
1863
|
+
subtitle?: string;
|
|
1864
|
+
starters: SdkHomeStarter[];
|
|
1865
|
+
widgetStarter?: SdkWidgetStarter;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* A conversation starter card configured in the AGO dashboard. `label` is what
|
|
1870
|
+
* the card shows; clicking it sends `message`.
|
|
1871
|
+
*/
|
|
1872
|
+
declare interface SdkHomeStarter {
|
|
1873
|
+
id: string;
|
|
1874
|
+
/** The card's text (the starter's `description` in the dashboard). */
|
|
1875
|
+
label: string;
|
|
1876
|
+
/** What is sent when the card is clicked. */
|
|
1877
|
+
message: string;
|
|
1878
|
+
/** Answer with this agent instead of the configured default. */
|
|
1879
|
+
agentId?: string;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
/** One permission's configuration in {@link SdkConfig}. */
|
|
1883
|
+
declare interface SdkPermissionConfig {
|
|
1884
|
+
id?: string;
|
|
1885
|
+
name?: string;
|
|
1886
|
+
displayName?: string;
|
|
1887
|
+
agents: Array<{
|
|
1888
|
+
id: string;
|
|
1889
|
+
name?: string;
|
|
1890
|
+
}>;
|
|
1891
|
+
ticketForm?: TicketForm;
|
|
1892
|
+
/** Home screen content, when the tenant configured one. */
|
|
1893
|
+
homePage?: SdkHomePageConfig;
|
|
1894
|
+
fileAttachmentsEnabled: boolean;
|
|
1895
|
+
voiceEnabled: boolean;
|
|
1896
|
+
/** Whether audio uploads can be transcribed. Defaults to false on older backends. */
|
|
1897
|
+
speechToTextEnabled: boolean;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* The starter the dashboard sends by itself on a fresh visit, before the
|
|
1902
|
+
* visitor types anything.
|
|
1903
|
+
*/
|
|
1904
|
+
declare interface SdkWidgetStarter {
|
|
1905
|
+
id: string;
|
|
1906
|
+
message: string;
|
|
1907
|
+
agentId?: string;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1666
1910
|
/**
|
|
1667
1911
|
* Options for sending a message
|
|
1668
1912
|
*/
|
|
1669
1913
|
declare interface SendMessageOptions {
|
|
1914
|
+
/** Replaces config.metadata for this message; null omits metadata for this message. */
|
|
1915
|
+
metadata?: Record<string, unknown> | null;
|
|
1670
1916
|
/** Existing conversation ID */
|
|
1671
1917
|
conversationId?: string;
|
|
1672
1918
|
/** Override default agent */
|
|
@@ -1715,6 +1961,12 @@ declare interface SignalsSnapshot {
|
|
|
1715
1961
|
idleMs: number;
|
|
1716
1962
|
/** Rage-click bursts detected on the current route. */
|
|
1717
1963
|
rageClicks: number;
|
|
1964
|
+
/**
|
|
1965
|
+
* JavaScript errors captured on the current route (count only; the messages
|
|
1966
|
+
* travel in `client_context` under `errors:recent`). Always `0` unless the
|
|
1967
|
+
* client has `errorWatcher` enabled.
|
|
1968
|
+
*/
|
|
1969
|
+
jsErrors: number;
|
|
1718
1970
|
/**
|
|
1719
1971
|
* A→B→A→B route oscillations detected in the recent route sequence. Rolling
|
|
1720
1972
|
* session counter (cross-route by nature); trigger cooldowns and dismissal
|
|
@@ -1773,6 +2025,13 @@ declare interface SSEChunkData {
|
|
|
1773
2025
|
follow_up_replies?: string[];
|
|
1774
2026
|
satisfaction_feedback?: unknown;
|
|
1775
2027
|
ask_to_talk_to_human?: boolean;
|
|
2028
|
+
allowed_to_create_ticket?: boolean;
|
|
2029
|
+
ticket?: ToolCallTicketPrefill;
|
|
2030
|
+
mode?: "form" | "embed";
|
|
2031
|
+
ticket_form_id?: string;
|
|
2032
|
+
embed_html?: string;
|
|
2033
|
+
embed_description?: string;
|
|
2034
|
+
display_mode?: "collapsible" | "display" | "both";
|
|
1776
2035
|
/** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
|
|
1777
2036
|
waiting_tool_call_ids?: string[];
|
|
1778
2037
|
}
|
|
@@ -1826,12 +2085,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
|
|
|
1826
2085
|
declare interface SubmitToolCallResult {
|
|
1827
2086
|
status: string;
|
|
1828
2087
|
result?: unknown;
|
|
2088
|
+
/** Set when `status` is `"error"`. */
|
|
2089
|
+
error?: string;
|
|
2090
|
+
/** The ticket a ticketing `form` tool call resolved to, when it did. */
|
|
2091
|
+
ticket?: {
|
|
2092
|
+
ticket_id: string;
|
|
2093
|
+
ticket_url?: string;
|
|
2094
|
+
[key: string]: unknown;
|
|
2095
|
+
};
|
|
1829
2096
|
resume?: {
|
|
1830
2097
|
message_id: string;
|
|
1831
2098
|
ready: boolean;
|
|
1832
2099
|
};
|
|
1833
2100
|
}
|
|
1834
2101
|
|
|
2102
|
+
/** A custom field of a ticket form. */
|
|
2103
|
+
declare interface TicketField {
|
|
2104
|
+
id: string;
|
|
2105
|
+
/** The key the ticketing backend expects; used as the submit key when set. */
|
|
2106
|
+
externalId?: string;
|
|
2107
|
+
title?: string;
|
|
2108
|
+
/** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
|
|
2109
|
+
type?: string;
|
|
2110
|
+
required: boolean;
|
|
2111
|
+
/** Carried in the submission but never shown. */
|
|
2112
|
+
hidden: boolean;
|
|
2113
|
+
active?: boolean;
|
|
2114
|
+
/** Bypass progressive disclosure, while still respecting conditions. */
|
|
2115
|
+
alwaysVisible?: boolean;
|
|
2116
|
+
regexpForValidation?: string;
|
|
2117
|
+
position: number;
|
|
2118
|
+
/** Non-empty turns the field into a select. */
|
|
2119
|
+
options: TicketFieldOption[];
|
|
2120
|
+
/** Show this field only when the parent field holds `conditionalFieldValue`. */
|
|
2121
|
+
conditionalFieldId?: string;
|
|
2122
|
+
/** Legacy comma-separated condition values. */
|
|
2123
|
+
conditionalFieldValue?: string;
|
|
2124
|
+
/** Takes precedence over conditionalFieldValue when non-empty. */
|
|
2125
|
+
conditionalFieldValues?: string[];
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
/** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
|
|
2129
|
+
declare interface TicketFieldOption {
|
|
2130
|
+
id: string;
|
|
2131
|
+
/** Label shown to the user. */
|
|
2132
|
+
name?: string;
|
|
2133
|
+
/** Value submitted. Falls back to `name` when absent. */
|
|
2134
|
+
value?: string;
|
|
2135
|
+
/** Preselected when the form opens. */
|
|
2136
|
+
default: boolean;
|
|
2137
|
+
/** A note shown under the field once this option is picked. */
|
|
2138
|
+
message?: string;
|
|
2139
|
+
messageType: "info" | "warning" | "danger";
|
|
2140
|
+
position?: number;
|
|
2141
|
+
group?: string;
|
|
2142
|
+
noDisplay?: boolean;
|
|
2143
|
+
conditionalFieldId?: string;
|
|
2144
|
+
/** Available when the parent matches any of these values. */
|
|
2145
|
+
conditionalFieldValues?: string[];
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
/** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
|
|
2149
|
+
declare interface TicketForm {
|
|
2150
|
+
id: string;
|
|
2151
|
+
name?: string;
|
|
2152
|
+
/** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
|
|
2153
|
+
mode: "form" | "embed";
|
|
2154
|
+
showSubject: boolean;
|
|
2155
|
+
showBody: boolean;
|
|
2156
|
+
showPriority: boolean;
|
|
2157
|
+
showTypology: boolean;
|
|
2158
|
+
priorityTypologies?: string[];
|
|
2159
|
+
successMessageText?: string;
|
|
2160
|
+
successMessageUrlLabel?: string;
|
|
2161
|
+
fields: TicketField[];
|
|
2162
|
+
}
|
|
2163
|
+
|
|
1835
2164
|
/**
|
|
1836
2165
|
* Tool call data from SSE stream
|
|
1837
2166
|
*/
|
|
@@ -1846,8 +2175,61 @@ export declare interface ToolCallData {
|
|
|
1846
2175
|
data?: Record<string, unknown>;
|
|
1847
2176
|
functionName?: string;
|
|
1848
2177
|
arguments?: Record<string, unknown>;
|
|
2178
|
+
/**
|
|
2179
|
+
* Where the hosted widget shows the call: in the collapsible "reasoning"
|
|
2180
|
+
* section, in the message body, or both. Absent means collapsible only.
|
|
2181
|
+
*/
|
|
2182
|
+
displayMode?: "collapsible" | "display" | "both";
|
|
2183
|
+
/** The user asked to talk to a human. */
|
|
2184
|
+
askToTalkToHuman?: boolean;
|
|
2185
|
+
/** `false` when the tenant blocks ticket creation for this visitor. */
|
|
2186
|
+
allowedToCreateTicket?: boolean;
|
|
2187
|
+
/** Fields the agent pre-filled from the conversation. */
|
|
2188
|
+
ticket?: ToolCallTicketPrefill;
|
|
2189
|
+
/** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
|
|
2190
|
+
mode?: "form" | "embed";
|
|
2191
|
+
ticketFormId?: string;
|
|
2192
|
+
embedHtml?: string;
|
|
2193
|
+
embedDescription?: string;
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
/** The ticket the agent pre-filled on a ticketing `form` tool call. */
|
|
2197
|
+
declare interface ToolCallTicketPrefill {
|
|
2198
|
+
subject?: string;
|
|
2199
|
+
body?: string;
|
|
2200
|
+
typology?: string;
|
|
2201
|
+
priority?: string;
|
|
2202
|
+
tag?: string;
|
|
2203
|
+
products?: string[];
|
|
2204
|
+
/** Keyed by the field's external id, or a lowercased, underscored title. */
|
|
2205
|
+
custom_fields?: Record<string, string>;
|
|
1849
2206
|
}
|
|
1850
2207
|
|
|
1851
2208
|
declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
|
|
1852
2209
|
|
|
2210
|
+
/** Options for `AgoClient.transcribeAudio`. */
|
|
2211
|
+
export declare interface TranscribeAudioOptions {
|
|
2212
|
+
/** Cancel the upload or stop waiting for its transcription. */
|
|
2213
|
+
signal?: AbortSignal;
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
/** The MCP behavior hints AGO has no equivalent for. */
|
|
2217
|
+
declare interface WebMCPToolMeta {
|
|
2218
|
+
/**
|
|
2219
|
+
* Both default to `false`, so only set what is true: `readOnlyHint` marks a
|
|
2220
|
+
* function that changes nothing, `untrustedContentHint` one whose result may
|
|
2221
|
+
* carry third-party text.
|
|
2222
|
+
*/
|
|
2223
|
+
annotations?: {
|
|
2224
|
+
readOnlyHint?: boolean;
|
|
2225
|
+
untrustedContentHint?: boolean;
|
|
2226
|
+
};
|
|
2227
|
+
/**
|
|
2228
|
+
* This function navigates. The WebMCP call is held open until the function
|
|
2229
|
+
* registry goes quiet, so the caller sees the destination page's tools rather
|
|
2230
|
+
* than the departing page's. Already set on the built-in `navigateToPage`.
|
|
2231
|
+
*/
|
|
2232
|
+
navigates?: boolean;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
1853
2235
|
export { }
|
package/dist/angular.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as o, t as u } from "./types-
|
|
1
|
+
import { n as o, t as u } from "./types-Q7t1peH-.js";
|
|
2
2
|
import { t as a } from "./autoContinue-CC8K9mBU.js";
|
|
3
3
|
var s = class {
|
|
4
4
|
constructor(t) {
|
|
@@ -16,6 +16,9 @@ var s = class {
|
|
|
16
16
|
sendMessage(t, e) {
|
|
17
17
|
return this.client.sendMessage(t, e);
|
|
18
18
|
}
|
|
19
|
+
transcribeAudio(t, e) {
|
|
20
|
+
return this.client.transcribeAudio(t, e);
|
|
21
|
+
}
|
|
19
22
|
stop() {
|
|
20
23
|
return this.client.stop();
|
|
21
24
|
}
|
package/dist/{createConversationSession-BaaXBQ5b.js → createConversationSession-BfJg0WyA.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as d } from "./types-
|
|
1
|
+
import { g as d } from "./types-Q7t1peH-.js";
|
|
2
2
|
var f = "ago_widget_id", g = "ago_last_thread", y = 7200 * 1e3;
|
|
3
3
|
function v() {
|
|
4
4
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
package/dist/{createConversationSession-CU0b-t1W.cjs → createConversationSession-CiOXKWl0.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const d=require("./types-
|
|
1
|
+
const d=require("./types-a7teDBnC.cjs");var f="ago_widget_id",g="ago_last_thread",y=7200*1e3;function v(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.floor(Math.random()*16);return(e==="x"?r:r&3|8).toString(16)})}function _(e={}){const r=e.key??f,i=e.threadKey??g,u=e.ttlMs??y,l=e.storage??(typeof localStorage<"u"?localStorage:void 0);let n=e.widgetId??"";if(!n&&l)try{n=l.getItem(r)??""}catch{}if(n||(n=v()),l)try{l.setItem(r,n)}catch{}const o=d.createStore({value:null,lastMessageAt:null},{key:i,storage:l}),s=o.get();s.value!==null&&c(s.lastMessageAt)&&o.set({value:null,lastMessageAt:null});function c(t){return t===null?!0:Number.isFinite(u)?Date.now()-t>u:!1}return{widgetId:n,key:r,getLastActiveThread(){const{value:t,lastMessageAt:a}=o.get();return t===null||c(a)?null:t},setActiveThread(t,a){const x=a==null?null:a instanceof Date?a.getTime():a;o.set({value:t,lastMessageAt:x})},clear(){o.set({value:null,lastMessageAt:null})}}}Object.defineProperty(exports,"createConversationSession",{enumerable:!0,get:function(){return _}});
|