@useago/sdk 1.7.2 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +175 -0
- package/README.md +96 -1
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +402 -5
- package/dist/angular.d.ts +402 -5
- package/dist/angular.js +11 -7
- package/dist/{createConversationSession-DP90nY71.js → createConversationSession-B1Qn-y0I.js} +3 -3
- package/dist/createConversationSession-B3v_xOU7.cjs +1 -0
- package/dist/createFormCollector-FvwDOqnV.cjs +1 -0
- package/dist/{createFormCollector-BivHRIAe.js → createFormCollector-m79zk_NA.js} +1 -1
- package/dist/createMockClient-BEOXI8yW.cjs +1 -0
- package/dist/{createMockClient-BDLW6tVc.js → createMockClient-Beao82tu.js} +31 -18
- package/dist/devtools.cjs +61 -12
- package/dist/devtools.d.cts +403 -5
- package/dist/devtools.d.ts +403 -5
- package/dist/devtools.js +225 -73
- package/dist/errors-BLfjXnLB.js +32 -0
- package/dist/errors-o1IB5fEu.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +489 -7
- package/dist/index.d.ts +489 -7
- package/dist/index.js +124 -118
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +510 -3
- package/dist/react.d.ts +510 -3
- package/dist/react.js +1036 -752
- package/dist/sheetController-BThJRtOu.cjs +1 -0
- package/dist/sheetController-aEKXIvjk.js +343 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +393 -3
- package/dist/testing.d.ts +393 -3
- package/dist/testing.js +1 -1
- package/dist/types-Ct1hlKwg.js +2408 -0
- package/dist/types-mcW8vB1U.cjs +10 -0
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +615 -3
- package/dist/vue.d.ts +615 -3
- package/dist/vue.js +202 -154
- package/dist/widget.cjs +6 -4
- package/dist/widget.d.cts +733 -5
- package/dist/widget.d.ts +733 -5
- package/dist/widget.js +3996 -786
- package/llms-full.txt +264 -31
- package/package.json +1 -1
- package/dist/AgoClient-7yXQ6R3O.cjs +0 -9
- package/dist/AgoClient-DTkBRGFE.js +0 -1965
- package/dist/createConversationSession-Bv6a15E0.cjs +0 -1
- package/dist/createFormCollector-CwfiYn0V.cjs +0 -1
- package/dist/createMockClient-BSNuN3ys.cjs +0 -1
- package/dist/sheetController-CBUVOroo.js +0 -205
- package/dist/sheetController-DY-sC13T.cjs +0 -1
package/dist/angular.d.cts
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). */
|
|
@@ -239,6 +240,26 @@ declare class AgoClient {
|
|
|
239
240
|
* `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
|
|
240
241
|
*/
|
|
241
242
|
private static mapPersistedToolCalls;
|
|
243
|
+
/**
|
|
244
|
+
* The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
|
|
245
|
+
* agents, the ticket form the agent's `ago_ticketing` tool opens, and the
|
|
246
|
+
* file-attachment flag. The vanilla widget fetches it once, when a ticket
|
|
247
|
+
* form first appears in a conversation.
|
|
248
|
+
*/
|
|
249
|
+
getConfig(): Promise<SdkConfig>;
|
|
250
|
+
/**
|
|
251
|
+
* The dashboard's home screen content. A starter card shows its
|
|
252
|
+
* `description` and sends its `initial_message`; one with neither is
|
|
253
|
+
* unusable and is dropped rather than rendered as an empty card.
|
|
254
|
+
*/
|
|
255
|
+
private static mapHomePage;
|
|
256
|
+
private static mapTicketForm;
|
|
257
|
+
/**
|
|
258
|
+
* Create a support ticket (`POST /api/sdk/v1/tickets`, multipart). This is
|
|
259
|
+
* what the ticket form in the conversation does before it completes the
|
|
260
|
+
* `form` tool call with {@link submitToolCallForm}.
|
|
261
|
+
*/
|
|
262
|
+
createTicket(input: CreateTicketInput): Promise<CreateTicketResult>;
|
|
242
263
|
/**
|
|
243
264
|
* Get messages for a conversation
|
|
244
265
|
*/
|
|
@@ -290,9 +311,40 @@ declare class AgoClient {
|
|
|
290
311
|
*/
|
|
291
312
|
submitFormCollector(name: string, values: Record<string, unknown>): Promise<unknown>;
|
|
292
313
|
/**
|
|
293
|
-
*
|
|
314
|
+
* Report an answer: thumbs up/down, optionally with what went wrong.
|
|
315
|
+
*
|
|
316
|
+
* ```ts
|
|
317
|
+
* await client.submitFeedback(message.id, "negative", {
|
|
318
|
+
* reasons: ["inaccurate"],
|
|
319
|
+
* comment: "The price it quoted is from last year.",
|
|
320
|
+
* });
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* A bare rating is a reaction (the thumbs counted in the dashboard). Adding a
|
|
324
|
+
* reason or a comment also files it in the feedback list, the analytics and
|
|
325
|
+
* the CSV export, so someone can act on it.
|
|
294
326
|
*/
|
|
295
|
-
submitFeedback(messageId: string, rating:
|
|
327
|
+
submitFeedback(messageId: string, rating: FeedbackRating, details?: FeedbackDetails): Promise<void>;
|
|
328
|
+
/**
|
|
329
|
+
* Report a whole conversation ("this chat is not working").
|
|
330
|
+
*
|
|
331
|
+
* ```ts
|
|
332
|
+
* await client.submitConversationFeedback(conversationId, "negative", {
|
|
333
|
+
* reasons: ["information_not_found"],
|
|
334
|
+
* comment: "It never answered my question.",
|
|
335
|
+
* });
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* Feedback is stored per message, so this attaches the report to the last
|
|
339
|
+
* answer of the conversation, which is the one the user is reacting to.
|
|
340
|
+
* Returns the message id it landed on.
|
|
341
|
+
*
|
|
342
|
+
* Pass `lastMessageId` when you already have it (the widget does) to skip the
|
|
343
|
+
* lookup round-trip.
|
|
344
|
+
*/
|
|
345
|
+
submitConversationFeedback(conversationId: string, rating: FeedbackRating, details?: FeedbackDetails & {
|
|
346
|
+
lastMessageId?: string;
|
|
347
|
+
}): Promise<string>;
|
|
296
348
|
/**
|
|
297
349
|
* Register a client-side function that AGO can call.
|
|
298
350
|
* Accepts either a definition object or (name, handler, schema) args.
|
|
@@ -466,6 +518,15 @@ declare class AgoClient {
|
|
|
466
518
|
/* Excluded from this release type: emitProactiveEvent */
|
|
467
519
|
/* Excluded from this release type: getHttp */
|
|
468
520
|
/* Excluded from this release type: getConfiguredAgent */
|
|
521
|
+
/**
|
|
522
|
+
* How the SDK identifies the visitor: the configured `userEmail`, and
|
|
523
|
+
* whether a `userJwt` is set. The ticket form asks for an email when it has
|
|
524
|
+
* neither.
|
|
525
|
+
*/
|
|
526
|
+
getUserIdentity(): {
|
|
527
|
+
email?: string;
|
|
528
|
+
hasJwt: boolean;
|
|
529
|
+
};
|
|
469
530
|
/**
|
|
470
531
|
* Enable automatic capture of the current browser page (URL + title).
|
|
471
532
|
* Injected as a dynamic context entry named `browser-page`.
|
|
@@ -488,6 +549,26 @@ declare class AgoClient {
|
|
|
488
549
|
private addActivity;
|
|
489
550
|
private recordAgentAction;
|
|
490
551
|
private registerActivityContext;
|
|
552
|
+
/**
|
|
553
|
+
* Start capturing the page's JavaScript errors (uncaught exceptions,
|
|
554
|
+
* unhandled rejections, `console.error` calls, {@link reportError}) and send
|
|
555
|
+
* the recent ones as the `errors:recent` context entry on every message.
|
|
556
|
+
* Same as setting `errorWatcher` in the config. Calling it again replaces
|
|
557
|
+
* the watcher (and its options); the captured errors are not kept.
|
|
558
|
+
*/
|
|
559
|
+
enableErrorWatcher(options?: ErrorWatcherOptions): void;
|
|
560
|
+
/** Stop capturing errors and drop the `errors:recent` context entry. */
|
|
561
|
+
disableErrorWatcher(): void;
|
|
562
|
+
/**
|
|
563
|
+
* Record an error the app caught itself (React error boundary, Vue
|
|
564
|
+
* `errorHandler`, Angular `ErrorHandler`, a try/catch) so the agent sees it
|
|
565
|
+
* like an uncaught one. No-op unless the error watcher is enabled. `context`
|
|
566
|
+
* is size-clamped before it is stored; keep it small and free of secrets.
|
|
567
|
+
*/
|
|
568
|
+
reportError(error: unknown, context?: Record<string, unknown>): void;
|
|
569
|
+
/** Errors the watcher currently holds, oldest first (a copy). Empty when disabled. */
|
|
570
|
+
getRecentErrors(): CapturedError[];
|
|
571
|
+
clearErrors(): void;
|
|
491
572
|
/**
|
|
492
573
|
* Subscribe to an event
|
|
493
574
|
*/
|
|
@@ -682,6 +763,12 @@ export declare interface AgoClientEvents {
|
|
|
682
763
|
};
|
|
683
764
|
/** A user- or agent-action was recorded into the activity ledger. */
|
|
684
765
|
"activity:recorded": ActivityEntry;
|
|
766
|
+
/**
|
|
767
|
+
* The error watcher captured a JavaScript error (uncaught exception,
|
|
768
|
+
* unhandled rejection, `console.error` call, or `reportError`). Fires on
|
|
769
|
+
* repeats too, with the updated `count`. Requires `errorWatcher` in the config.
|
|
770
|
+
*/
|
|
771
|
+
"error:captured": CapturedError;
|
|
685
772
|
}
|
|
686
773
|
|
|
687
774
|
/**
|
|
@@ -702,6 +789,8 @@ export declare interface AgoConfig {
|
|
|
702
789
|
userEmail?: string;
|
|
703
790
|
/** JWT token for authenticated users */
|
|
704
791
|
userJwt?: string;
|
|
792
|
+
/** User metadata sent with messages. Use null to stop sending defaults. Not an authentication credential. */
|
|
793
|
+
metadata?: Record<string, unknown> | null;
|
|
705
794
|
/** Enable debug logging */
|
|
706
795
|
debug?: boolean;
|
|
707
796
|
/**
|
|
@@ -761,6 +850,18 @@ export declare interface AgoConfig {
|
|
|
761
850
|
* default otherwise.
|
|
762
851
|
*/
|
|
763
852
|
proactive?: ProactiveOptions;
|
|
853
|
+
/**
|
|
854
|
+
* Capture the page's JavaScript errors as agent context. When set, the SDK
|
|
855
|
+
* listens for uncaught exceptions and unhandled promise rejections, wraps
|
|
856
|
+
* `console.error` (calling through; restored on `destroy`), and sends the
|
|
857
|
+
* recent errors (deduplicated, capped, pruned after 10 min) as the
|
|
858
|
+
* `errors:recent` context entry on every message. `true` uses the defaults;
|
|
859
|
+
* pass {@link ErrorWatcherOptions} to tune the caps or add a `filter` that
|
|
860
|
+
* redacts messages. Off by default: error messages can carry PII or internal
|
|
861
|
+
* URLs, so enabling it is the host's call. Errors also feed the proactive
|
|
862
|
+
* mode's `jsErrors` signal. See `client.reportError()` for caught errors.
|
|
863
|
+
*/
|
|
864
|
+
errorWatcher?: boolean | ErrorWatcherOptions;
|
|
764
865
|
}
|
|
765
866
|
|
|
766
867
|
declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
|
|
@@ -969,8 +1070,12 @@ export declare class AgoService {
|
|
|
969
1070
|
confirmToolCall(toolCallId: string): Promise<void>;
|
|
970
1071
|
/** Reject a tool call */
|
|
971
1072
|
rejectToolCall(toolCallId: string): Promise<void>;
|
|
972
|
-
/**
|
|
973
|
-
submitFeedback(messageId: string, rating:
|
|
1073
|
+
/** Report an answer: thumbs up/down, optionally with what went wrong */
|
|
1074
|
+
submitFeedback(messageId: string, rating: FeedbackRating, details?: FeedbackDetails): Promise<void>;
|
|
1075
|
+
/** Report a whole conversation; lands on its last answer, whose id is returned */
|
|
1076
|
+
submitConversationFeedback(conversationId: string, rating: FeedbackRating, details?: FeedbackDetails & {
|
|
1077
|
+
lastMessageId?: string;
|
|
1078
|
+
}): Promise<string>;
|
|
974
1079
|
/** Register a client-side function */
|
|
975
1080
|
registerFunction(definition: ClientFunctionDefinition): void;
|
|
976
1081
|
registerFunction(name: string, handler: ClientFunctionHandler, schema: ClientFunctionRegisterOptions): void;
|
|
@@ -1054,12 +1159,53 @@ export declare interface AgoStateControl<T = unknown> {
|
|
|
1054
1159
|
enum?: (string | number)[];
|
|
1055
1160
|
};
|
|
1056
1161
|
};
|
|
1162
|
+
/** String-only: `""` means "clear" instead of being dropped as filler. */
|
|
1163
|
+
clearable?: boolean;
|
|
1057
1164
|
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
1058
1165
|
get?: () => T;
|
|
1059
1166
|
/** Apply the state change on the page. May be async. */
|
|
1060
|
-
set: (value: T) => void | Promise<void>;
|
|
1167
|
+
set: (value: T) => void | AgoStateSetResult | Promise<void | AgoStateSetResult>;
|
|
1061
1168
|
}
|
|
1062
1169
|
|
|
1170
|
+
/**
|
|
1171
|
+
* Tagged outcome a page setter may return to reject or mark unchanged.
|
|
1172
|
+
*
|
|
1173
|
+
* Returning nothing (void) means APPLY. Returning an unrecognized JS value
|
|
1174
|
+
* (e.g. a string from an assignment expression) is also treated as APPLY.
|
|
1175
|
+
*/
|
|
1176
|
+
declare type AgoStateSetResult = {
|
|
1177
|
+
result: "rejected";
|
|
1178
|
+
reason: string;
|
|
1179
|
+
} | {
|
|
1180
|
+
result: "unchanged";
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
/** One JavaScript error captured on the page (deduplicated, see `count`). */
|
|
1184
|
+
declare interface CapturedError {
|
|
1185
|
+
type: CapturedErrorType;
|
|
1186
|
+
/** Error message, truncated to 500 chars. */
|
|
1187
|
+
message: string;
|
|
1188
|
+
/** Script URL the error came from, without its query string. */
|
|
1189
|
+
source?: string;
|
|
1190
|
+
line?: number;
|
|
1191
|
+
col?: number;
|
|
1192
|
+
/** Leading stack frames, truncated (see `maxStackChars`). */
|
|
1193
|
+
stack?: string;
|
|
1194
|
+
/** Pathname at capture time. */
|
|
1195
|
+
route: string;
|
|
1196
|
+
/** Epoch ms of the first occurrence. */
|
|
1197
|
+
firstAt: number;
|
|
1198
|
+
/** Epoch ms of the most recent occurrence. */
|
|
1199
|
+
lastAt: number;
|
|
1200
|
+
/** How many times this same error (type + message + source + line) fired. */
|
|
1201
|
+
count: number;
|
|
1202
|
+
/** App-provided context, manual reports only (size-clamped). */
|
|
1203
|
+
context?: Record<string, unknown>;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/** How an error reached the watcher. */
|
|
1207
|
+
declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "manual";
|
|
1208
|
+
|
|
1063
1209
|
/**
|
|
1064
1210
|
* Single-object function definition — combines name, schema, and handler.
|
|
1065
1211
|
*
|
|
@@ -1193,6 +1339,30 @@ export declare interface Conversation {
|
|
|
1193
1339
|
messages?: AgoMessage[];
|
|
1194
1340
|
}
|
|
1195
1341
|
|
|
1342
|
+
/** Input of `AgoClient.createTicket` (`POST /api/sdk/v1/tickets`). */
|
|
1343
|
+
declare interface CreateTicketInput {
|
|
1344
|
+
subject: string;
|
|
1345
|
+
body: string;
|
|
1346
|
+
priority?: string;
|
|
1347
|
+
typology?: string;
|
|
1348
|
+
/** Conversation the ticket is filed from. */
|
|
1349
|
+
conversationId?: string;
|
|
1350
|
+
/** Reporter email, for a visitor the SDK does not otherwise identify. */
|
|
1351
|
+
email?: string;
|
|
1352
|
+
customFields?: Array<{
|
|
1353
|
+
id: string;
|
|
1354
|
+
value: string;
|
|
1355
|
+
}>;
|
|
1356
|
+
files?: File[];
|
|
1357
|
+
ticketFormId?: string;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
/** Response of `AgoClient.createTicket`. */
|
|
1361
|
+
declare interface CreateTicketResult {
|
|
1362
|
+
id: string;
|
|
1363
|
+
url?: string;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1196
1366
|
/**
|
|
1197
1367
|
* A function that returns a fresh context entry on demand.
|
|
1198
1368
|
* Evaluated every time a message is sent — use it to pull data from stores,
|
|
@@ -1200,6 +1370,57 @@ export declare interface Conversation {
|
|
|
1200
1370
|
*/
|
|
1201
1371
|
declare type DynamicContextProvider = () => ContextEntry | null | undefined;
|
|
1202
1372
|
|
|
1373
|
+
declare interface ErrorWatcherOptions {
|
|
1374
|
+
/** Max distinct errors kept. Oldest dropped first. Default 10. */
|
|
1375
|
+
maxErrors?: number;
|
|
1376
|
+
/**
|
|
1377
|
+
* Errors older than this are pruned when the buffer is read, so a crash from
|
|
1378
|
+
* an hour ago does not confuse the agent. Default 600 000 (10 min).
|
|
1379
|
+
*/
|
|
1380
|
+
maxAgeMs?: number;
|
|
1381
|
+
/** Max chars of stack kept per error. Default 2000. */
|
|
1382
|
+
maxStackChars?: number;
|
|
1383
|
+
/**
|
|
1384
|
+
* Redact or drop an error before it is stored. Return the (possibly edited)
|
|
1385
|
+
* error to keep it, `null` to drop it. Runs on every capture, so keep it cheap.
|
|
1386
|
+
*/
|
|
1387
|
+
filter?: (error: CapturedError) => CapturedError | null;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/** The four values of {@link FeedbackReason}, in dashboard order. */
|
|
1391
|
+
export declare const FEEDBACK_REASONS: readonly FeedbackReason[];
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Why the user is reporting a message (see `AgoClient.submitFeedback`).
|
|
1395
|
+
*
|
|
1396
|
+
* A rating on its own is a reaction (the thumbs count). Add a reason or a
|
|
1397
|
+
* comment and the report also lands in the feedback dashboard, the analytics
|
|
1398
|
+
* and the CSV export, where someone can act on it.
|
|
1399
|
+
*/
|
|
1400
|
+
export declare interface FeedbackDetails {
|
|
1401
|
+
/** What went wrong. Several can apply at once. */
|
|
1402
|
+
reasons?: FeedbackReason[];
|
|
1403
|
+
/** The user's own words. Trimmed server-side; 5000 characters max. */
|
|
1404
|
+
comment?: string;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/** Thumbs up / thumbs down on an answer. */
|
|
1408
|
+
export declare type FeedbackRating = "positive" | "negative";
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* What went wrong with an answer. These are the four buckets the AGO feedback
|
|
1412
|
+
* dashboard filters and charts on.
|
|
1413
|
+
*/
|
|
1414
|
+
export declare type FeedbackReason =
|
|
1415
|
+
/** The answer states something false. */
|
|
1416
|
+
"inaccurate"
|
|
1417
|
+
/** The answer is right but stops short. */
|
|
1418
|
+
| "incomplete"
|
|
1419
|
+
/** The agent could not find the information. */
|
|
1420
|
+
| "information_not_found"
|
|
1421
|
+
/** Something broke: the widget, a tool call, the stream. */
|
|
1422
|
+
| "technical_issue";
|
|
1423
|
+
|
|
1203
1424
|
/**
|
|
1204
1425
|
* The backend-stored shape returned by `GET /api/sdk/v1/forms/{name}` (see
|
|
1205
1426
|
* {@link AgoClient.getFormCollector}). Mirrors the persistable subset of
|
|
@@ -1538,6 +1759,12 @@ declare interface ProactiveTriggerWhen {
|
|
|
1538
1759
|
pageState?: Partial<Record<string, unknown>>;
|
|
1539
1760
|
/** Min rage-click bursts on the current route. */
|
|
1540
1761
|
rageClicks?: number;
|
|
1762
|
+
/**
|
|
1763
|
+
* Min JavaScript errors captured on the current route. Needs the client's
|
|
1764
|
+
* `errorWatcher` enabled; without it the count stays at 0 and the matcher
|
|
1765
|
+
* never passes.
|
|
1766
|
+
*/
|
|
1767
|
+
jsErrors?: number;
|
|
1541
1768
|
/** Min A→B→A→B route oscillations this session. */
|
|
1542
1769
|
routeBounces?: number;
|
|
1543
1770
|
/** Per-field minimum error counts (field NAME → min count). */
|
|
@@ -1579,10 +1806,69 @@ declare type ResumeGate = (info: {
|
|
|
1579
1806
|
messageId: string;
|
|
1580
1807
|
}) => Promise<void> | void;
|
|
1581
1808
|
|
|
1809
|
+
/** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
|
|
1810
|
+
declare interface SdkConfig {
|
|
1811
|
+
permissions: SdkPermissionConfig[];
|
|
1812
|
+
proactive: {
|
|
1813
|
+
enabled: boolean;
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
/** The dashboard's home screen content (title, subtitle, starter cards). */
|
|
1818
|
+
declare interface SdkHomePageConfig {
|
|
1819
|
+
title?: string;
|
|
1820
|
+
/** Markdown. */
|
|
1821
|
+
subtitle?: string;
|
|
1822
|
+
starters: SdkHomeStarter[];
|
|
1823
|
+
widgetStarter?: SdkWidgetStarter;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* A conversation starter card configured in the AGO dashboard. `label` is what
|
|
1828
|
+
* the card shows; clicking it sends `message`.
|
|
1829
|
+
*/
|
|
1830
|
+
declare interface SdkHomeStarter {
|
|
1831
|
+
id: string;
|
|
1832
|
+
/** The card's text (the starter's `description` in the dashboard). */
|
|
1833
|
+
label: string;
|
|
1834
|
+
/** What is sent when the card is clicked. */
|
|
1835
|
+
message: string;
|
|
1836
|
+
/** Answer with this agent instead of the configured default. */
|
|
1837
|
+
agentId?: string;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
/** One permission's configuration in {@link SdkConfig}. */
|
|
1841
|
+
declare interface SdkPermissionConfig {
|
|
1842
|
+
id?: string;
|
|
1843
|
+
name?: string;
|
|
1844
|
+
displayName?: string;
|
|
1845
|
+
agents: Array<{
|
|
1846
|
+
id: string;
|
|
1847
|
+
name?: string;
|
|
1848
|
+
}>;
|
|
1849
|
+
ticketForm?: TicketForm;
|
|
1850
|
+
/** Home screen content, when the tenant configured one. */
|
|
1851
|
+
homePage?: SdkHomePageConfig;
|
|
1852
|
+
fileAttachmentsEnabled: boolean;
|
|
1853
|
+
voiceEnabled: boolean;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* The starter the dashboard sends by itself on a fresh visit, before the
|
|
1858
|
+
* visitor types anything.
|
|
1859
|
+
*/
|
|
1860
|
+
declare interface SdkWidgetStarter {
|
|
1861
|
+
id: string;
|
|
1862
|
+
message: string;
|
|
1863
|
+
agentId?: string;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1582
1866
|
/**
|
|
1583
1867
|
* Options for sending a message
|
|
1584
1868
|
*/
|
|
1585
1869
|
declare interface SendMessageOptions {
|
|
1870
|
+
/** Replaces config.metadata for this message; null omits metadata for this message. */
|
|
1871
|
+
metadata?: Record<string, unknown> | null;
|
|
1586
1872
|
/** Existing conversation ID */
|
|
1587
1873
|
conversationId?: string;
|
|
1588
1874
|
/** Override default agent */
|
|
@@ -1631,6 +1917,12 @@ declare interface SignalsSnapshot {
|
|
|
1631
1917
|
idleMs: number;
|
|
1632
1918
|
/** Rage-click bursts detected on the current route. */
|
|
1633
1919
|
rageClicks: number;
|
|
1920
|
+
/**
|
|
1921
|
+
* JavaScript errors captured on the current route (count only; the messages
|
|
1922
|
+
* travel in `client_context` under `errors:recent`). Always `0` unless the
|
|
1923
|
+
* client has `errorWatcher` enabled.
|
|
1924
|
+
*/
|
|
1925
|
+
jsErrors: number;
|
|
1634
1926
|
/**
|
|
1635
1927
|
* A→B→A→B route oscillations detected in the recent route sequence. Rolling
|
|
1636
1928
|
* session counter (cross-route by nature); trigger cooldowns and dismissal
|
|
@@ -1689,6 +1981,13 @@ declare interface SSEChunkData {
|
|
|
1689
1981
|
follow_up_replies?: string[];
|
|
1690
1982
|
satisfaction_feedback?: unknown;
|
|
1691
1983
|
ask_to_talk_to_human?: boolean;
|
|
1984
|
+
allowed_to_create_ticket?: boolean;
|
|
1985
|
+
ticket?: ToolCallTicketPrefill;
|
|
1986
|
+
mode?: "form" | "embed";
|
|
1987
|
+
ticket_form_id?: string;
|
|
1988
|
+
embed_html?: string;
|
|
1989
|
+
embed_description?: string;
|
|
1990
|
+
display_mode?: "collapsible" | "display" | "both";
|
|
1692
1991
|
/** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
|
|
1693
1992
|
waiting_tool_call_ids?: string[];
|
|
1694
1993
|
}
|
|
@@ -1742,12 +2041,82 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
|
|
|
1742
2041
|
declare interface SubmitToolCallResult {
|
|
1743
2042
|
status: string;
|
|
1744
2043
|
result?: unknown;
|
|
2044
|
+
/** Set when `status` is `"error"`. */
|
|
2045
|
+
error?: string;
|
|
2046
|
+
/** The ticket a ticketing `form` tool call resolved to, when it did. */
|
|
2047
|
+
ticket?: {
|
|
2048
|
+
ticket_id: string;
|
|
2049
|
+
ticket_url?: string;
|
|
2050
|
+
[key: string]: unknown;
|
|
2051
|
+
};
|
|
1745
2052
|
resume?: {
|
|
1746
2053
|
message_id: string;
|
|
1747
2054
|
ready: boolean;
|
|
1748
2055
|
};
|
|
1749
2056
|
}
|
|
1750
2057
|
|
|
2058
|
+
/** A custom field of a ticket form. */
|
|
2059
|
+
declare interface TicketField {
|
|
2060
|
+
id: string;
|
|
2061
|
+
/** The key the ticketing backend expects; used as the submit key when set. */
|
|
2062
|
+
externalId?: string;
|
|
2063
|
+
title?: string;
|
|
2064
|
+
/** Field kind, e.g. `"text"`, `"checkbox"`, `"tagger"`. */
|
|
2065
|
+
type?: string;
|
|
2066
|
+
required: boolean;
|
|
2067
|
+
/** Carried in the submission but never shown. */
|
|
2068
|
+
hidden: boolean;
|
|
2069
|
+
active?: boolean;
|
|
2070
|
+
/** Bypass progressive disclosure, while still respecting conditions. */
|
|
2071
|
+
alwaysVisible?: boolean;
|
|
2072
|
+
regexpForValidation?: string;
|
|
2073
|
+
position: number;
|
|
2074
|
+
/** Non-empty turns the field into a select. */
|
|
2075
|
+
options: TicketFieldOption[];
|
|
2076
|
+
/** Show this field only when the parent field holds `conditionalFieldValue`. */
|
|
2077
|
+
conditionalFieldId?: string;
|
|
2078
|
+
/** Legacy comma-separated condition values. */
|
|
2079
|
+
conditionalFieldValue?: string;
|
|
2080
|
+
/** Takes precedence over conditionalFieldValue when non-empty. */
|
|
2081
|
+
conditionalFieldValues?: string[];
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
/** An option of a ticket form field (`GET /config` → `ticket_form.fields[].options[]`). */
|
|
2085
|
+
declare interface TicketFieldOption {
|
|
2086
|
+
id: string;
|
|
2087
|
+
/** Label shown to the user. */
|
|
2088
|
+
name?: string;
|
|
2089
|
+
/** Value submitted. Falls back to `name` when absent. */
|
|
2090
|
+
value?: string;
|
|
2091
|
+
/** Preselected when the form opens. */
|
|
2092
|
+
default: boolean;
|
|
2093
|
+
/** A note shown under the field once this option is picked. */
|
|
2094
|
+
message?: string;
|
|
2095
|
+
messageType: "info" | "warning" | "danger";
|
|
2096
|
+
position?: number;
|
|
2097
|
+
group?: string;
|
|
2098
|
+
noDisplay?: boolean;
|
|
2099
|
+
conditionalFieldId?: string;
|
|
2100
|
+
/** Available when the parent matches any of these values. */
|
|
2101
|
+
conditionalFieldValues?: string[];
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
/** The ticket form an agent's `ago_ticketing` tool opens in the conversation. */
|
|
2105
|
+
declare interface TicketForm {
|
|
2106
|
+
id: string;
|
|
2107
|
+
name?: string;
|
|
2108
|
+
/** `"form"` renders the SDK's own fields; `"embed"` hosts third-party HTML. */
|
|
2109
|
+
mode: "form" | "embed";
|
|
2110
|
+
showSubject: boolean;
|
|
2111
|
+
showBody: boolean;
|
|
2112
|
+
showPriority: boolean;
|
|
2113
|
+
showTypology: boolean;
|
|
2114
|
+
priorityTypologies?: string[];
|
|
2115
|
+
successMessageText?: string;
|
|
2116
|
+
successMessageUrlLabel?: string;
|
|
2117
|
+
fields: TicketField[];
|
|
2118
|
+
}
|
|
2119
|
+
|
|
1751
2120
|
/**
|
|
1752
2121
|
* Tool call data from SSE stream
|
|
1753
2122
|
*/
|
|
@@ -1762,6 +2131,34 @@ export declare interface ToolCallData {
|
|
|
1762
2131
|
data?: Record<string, unknown>;
|
|
1763
2132
|
functionName?: string;
|
|
1764
2133
|
arguments?: Record<string, unknown>;
|
|
2134
|
+
/**
|
|
2135
|
+
* Where the hosted widget shows the call: in the collapsible "reasoning"
|
|
2136
|
+
* section, in the message body, or both. Absent means collapsible only.
|
|
2137
|
+
*/
|
|
2138
|
+
displayMode?: "collapsible" | "display" | "both";
|
|
2139
|
+
/** The user asked to talk to a human. */
|
|
2140
|
+
askToTalkToHuman?: boolean;
|
|
2141
|
+
/** `false` when the tenant blocks ticket creation for this visitor. */
|
|
2142
|
+
allowedToCreateTicket?: boolean;
|
|
2143
|
+
/** Fields the agent pre-filled from the conversation. */
|
|
2144
|
+
ticket?: ToolCallTicketPrefill;
|
|
2145
|
+
/** `"embed"` hosts third-party HTML (`embedHtml`); otherwise the SDK's form. */
|
|
2146
|
+
mode?: "form" | "embed";
|
|
2147
|
+
ticketFormId?: string;
|
|
2148
|
+
embedHtml?: string;
|
|
2149
|
+
embedDescription?: string;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
/** The ticket the agent pre-filled on a ticketing `form` tool call. */
|
|
2153
|
+
declare interface ToolCallTicketPrefill {
|
|
2154
|
+
subject?: string;
|
|
2155
|
+
body?: string;
|
|
2156
|
+
typology?: string;
|
|
2157
|
+
priority?: string;
|
|
2158
|
+
tag?: string;
|
|
2159
|
+
products?: string[];
|
|
2160
|
+
/** Keyed by the field's external id, or a lowercased, underscored title. */
|
|
2161
|
+
custom_fields?: Record<string, string>;
|
|
1765
2162
|
}
|
|
1766
2163
|
|
|
1767
2164
|
declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
|