@useago/sdk 1.12.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 +71 -4
- package/README.md +73 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +97 -28
- package/dist/angular.d.ts +97 -28
- package/dist/angular.js +4 -1
- package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-BfJg0WyA.js} +1 -1
- package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-CiOXKWl0.cjs} +1 -1
- package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-DN1xjAv5.js} +1 -1
- package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-DnQl77Ko.cjs} +1 -1
- package/dist/createMockClient-BPt1gSve.cjs +1 -0
- package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
- package/dist/devtools.cjs +4 -4
- package/dist/devtools.d.cts +95 -28
- package/dist/devtools.d.ts +95 -28
- 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 +101 -35
- package/dist/index.d.ts +101 -35
- package/dist/index.js +44 -43
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +147 -28
- package/dist/react.d.ts +147 -28
- package/dist/react.js +814 -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 +95 -28
- package/dist/testing.d.ts +95 -28
- package/dist/testing.js +1 -1
- package/dist/{types-Ct1hlKwg.js → types-Q7t1peH-.js} +595 -419
- package/dist/types-a7teDBnC.cjs +10 -0
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +105 -28
- package/dist/vue.d.ts +105 -28
- package/dist/vue.js +103 -101
- package/dist/widget.cjs +6 -6
- package/dist/widget.d.cts +127 -28
- package/dist/widget.d.ts +127 -28
- package/dist/widget.js +1717 -1772
- package/llms-full.txt +129 -1
- package/package.json +1 -1
- package/dist/createMockClient-BEOXI8yW.cjs +0 -1
- package/dist/sheetController-BThJRtOu.cjs +0 -1
- package/dist/sheetController-aEKXIvjk.js +0 -343
- package/dist/types-mcW8vB1U.cjs +0 -10
package/dist/index.d.cts
CHANGED
|
@@ -131,7 +131,10 @@ export declare class AgoClient {
|
|
|
131
131
|
* `null` otherwise.
|
|
132
132
|
*/
|
|
133
133
|
proactive: ProactiveController | null;
|
|
134
|
+
/** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
|
|
135
|
+
private detachWebMCP;
|
|
134
136
|
constructor(config: AgoConfig);
|
|
137
|
+
private attachWebMCPBridge;
|
|
135
138
|
/**
|
|
136
139
|
* Send a message and receive a streaming response
|
|
137
140
|
*/
|
|
@@ -243,6 +246,7 @@ export declare class AgoClient {
|
|
|
243
246
|
* (the agent decides what to do next). No-op if the invocation is unknown.
|
|
244
247
|
*/
|
|
245
248
|
rejectFunction(invocationId: string): Promise<void>;
|
|
249
|
+
/* Excluded from this release type: runExternalFunction */
|
|
246
250
|
/**
|
|
247
251
|
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
248
252
|
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
@@ -262,11 +266,20 @@ export declare class AgoClient {
|
|
|
262
266
|
* `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
|
|
263
267
|
*/
|
|
264
268
|
private static mapPersistedToolCalls;
|
|
269
|
+
/**
|
|
270
|
+
* Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
|
|
271
|
+
* Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
|
|
272
|
+
* MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
|
|
273
|
+
* The filename must include the matching extension. For a MediaRecorder blob,
|
|
274
|
+
* wrap it in a File with the recording's extension and MIME type.
|
|
275
|
+
* Show the returned text as a draft; call `sendMessage` when the user sends it.
|
|
276
|
+
*/
|
|
277
|
+
transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
|
|
265
278
|
/**
|
|
266
279
|
* The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
|
|
267
280
|
* agents, the ticket form the agent's `ago_ticketing` tool opens, and the
|
|
268
|
-
* file-attachment
|
|
269
|
-
* form first appears in a conversation.
|
|
281
|
+
* file-attachment and speech-to-text flags. The vanilla widget fetches it
|
|
282
|
+
* once, when a ticket form first appears in a conversation.
|
|
270
283
|
*/
|
|
271
284
|
getConfig(): Promise<SdkConfig>;
|
|
272
285
|
/**
|
|
@@ -403,6 +416,9 @@ export declare class AgoClient {
|
|
|
403
416
|
* Get all registered function schemas
|
|
404
417
|
*/
|
|
405
418
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
419
|
+
/** The callback form of `functions:changed`. Returns an unsubscribe. */
|
|
420
|
+
onFunctionsChanged(listener: () => void): () => void;
|
|
421
|
+
/* Excluded from this release type: getFunctionRegistrations */
|
|
406
422
|
/**
|
|
407
423
|
* Execute a registered client function locally, through the same
|
|
408
424
|
* FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
|
|
@@ -735,6 +751,8 @@ export declare interface AgoClientEvents {
|
|
|
735
751
|
* call running immediately.
|
|
736
752
|
*/
|
|
737
753
|
"function:awaiting-approval": ClientFunctionInvocation;
|
|
754
|
+
/** A function was registered or unregistered, or the registry cleared. */
|
|
755
|
+
"functions:changed": ClientFunctionSchema[];
|
|
738
756
|
"function:result": {
|
|
739
757
|
invocationId: string;
|
|
740
758
|
result: unknown;
|
|
@@ -807,6 +825,8 @@ export declare interface AgoConfig {
|
|
|
807
825
|
defaultAgentId?: string;
|
|
808
826
|
/** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
|
|
809
827
|
permission?: string;
|
|
828
|
+
/** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
|
|
829
|
+
language?: string | null;
|
|
810
830
|
/** User email for identification */
|
|
811
831
|
userEmail?: string;
|
|
812
832
|
/** JWT token for authenticated users */
|
|
@@ -884,6 +904,15 @@ export declare interface AgoConfig {
|
|
|
884
904
|
* mode's `jsErrors` signal. See `client.reportError()` for caught errors.
|
|
885
905
|
*/
|
|
886
906
|
errorWatcher?: boolean | ErrorWatcherOptions;
|
|
907
|
+
/** Mirror every registered client function into the browser's WebMCP registry
|
|
908
|
+
* (`document.modelContext`), so an external agent can call the same functions
|
|
909
|
+
* the in-app agent calls. Off by default; no-ops without WebMCP.
|
|
910
|
+
*
|
|
911
|
+
* A mirrored function runs immediately: the approval gate
|
|
912
|
+
* ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
|
|
913
|
+
* Use `webmcp: false` on a definition to keep it out.
|
|
914
|
+
*/
|
|
915
|
+
webmcp?: boolean;
|
|
887
916
|
}
|
|
888
917
|
|
|
889
918
|
/**
|
|
@@ -1200,6 +1229,11 @@ declare interface ApiErrorResponse {
|
|
|
1200
1229
|
*/
|
|
1201
1230
|
export declare function attachAutoContinueAfterNavigation(client: AgoClient, options?: AgoAutoContinueOptions | (() => AgoAutoContinueOptions | undefined)): () => void;
|
|
1202
1231
|
|
|
1232
|
+
/** Editable text returned by `AgoClient.transcribeAudio`. */
|
|
1233
|
+
export declare interface AudioTranscription {
|
|
1234
|
+
text: string;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1203
1237
|
/**
|
|
1204
1238
|
* Auto-detect AGO configuration from the DOM environment.
|
|
1205
1239
|
*
|
|
@@ -1303,22 +1337,11 @@ export declare type ClientFunction = (args: Record<string, unknown>) => Promise<
|
|
|
1303
1337
|
* client.registerFunction(fn);
|
|
1304
1338
|
* ```
|
|
1305
1339
|
*/
|
|
1306
|
-
export declare interface ClientFunctionDefinition {
|
|
1340
|
+
export declare interface ClientFunctionDefinition extends ClientFunctionSettings {
|
|
1307
1341
|
name: string;
|
|
1308
1342
|
description: string;
|
|
1309
1343
|
parameters: ClientFunctionSchema["parameters"];
|
|
1310
1344
|
handler: ClientFunctionHandler;
|
|
1311
|
-
/**
|
|
1312
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1313
|
-
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
1314
|
-
* `Infinity` 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
1345
|
}
|
|
1323
1346
|
|
|
1324
1347
|
/**
|
|
@@ -1337,20 +1360,7 @@ export declare interface ClientFunctionInvocation {
|
|
|
1337
1360
|
* Schema-plus-settings object accepted when registering a function: the schema
|
|
1338
1361
|
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
1339
1362
|
*/
|
|
1340
|
-
export declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> &
|
|
1341
|
-
/**
|
|
1342
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1343
|
-
* flagged preview. Overrides the client-level default
|
|
1344
|
-
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1345
|
-
* disables the guard for this function.
|
|
1346
|
-
*/
|
|
1347
|
-
maxResultBytes?: number;
|
|
1348
|
-
/**
|
|
1349
|
-
* Require explicit user approval before this function runs. See
|
|
1350
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1351
|
-
*/
|
|
1352
|
-
requiresApproval?: boolean;
|
|
1353
|
-
};
|
|
1363
|
+
export declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
|
|
1354
1364
|
|
|
1355
1365
|
/**
|
|
1356
1366
|
* Schema for a client-side function that AGO can call
|
|
@@ -1377,6 +1387,28 @@ export declare interface ClientFunctionSchema {
|
|
|
1377
1387
|
};
|
|
1378
1388
|
}
|
|
1379
1389
|
|
|
1390
|
+
/** SDK-side function settings that are never sent to the backend. */
|
|
1391
|
+
declare interface ClientFunctionSettings {
|
|
1392
|
+
/**
|
|
1393
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1394
|
+
* flagged preview. Overrides the client-level default
|
|
1395
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1396
|
+
* disables the guard for this function.
|
|
1397
|
+
*/
|
|
1398
|
+
maxResultBytes?: number;
|
|
1399
|
+
/**
|
|
1400
|
+
* Require explicit user approval before this function runs. See
|
|
1401
|
+
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1402
|
+
*/
|
|
1403
|
+
requiresApproval?: boolean;
|
|
1404
|
+
/**
|
|
1405
|
+
* WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
|
|
1406
|
+
* `false` keeps this function out of WebMCP while leaving it available to the
|
|
1407
|
+
* in-app agent.
|
|
1408
|
+
*/
|
|
1409
|
+
webmcp?: WebMCPToolMeta | false;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1380
1412
|
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
1381
1413
|
export declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
1382
1414
|
|
|
@@ -2045,7 +2077,11 @@ export declare interface FunctionDefinition {
|
|
|
2045
2077
|
export declare class FunctionRegistry {
|
|
2046
2078
|
private functions;
|
|
2047
2079
|
private defaultMaxResultBytes;
|
|
2080
|
+
private changeListeners;
|
|
2048
2081
|
constructor(options?: FunctionRegistryOptions);
|
|
2082
|
+
/** Fires on registrations, unregistrations and clears. */
|
|
2083
|
+
onChange(listener: () => void): () => void;
|
|
2084
|
+
private emitChange;
|
|
2049
2085
|
/** Update the client-level result-size ceiling at runtime. */
|
|
2050
2086
|
setDefaultMaxResultBytes(bytes: number): void;
|
|
2051
2087
|
/**
|
|
@@ -2076,6 +2112,13 @@ export declare class FunctionRegistry {
|
|
|
2076
2112
|
* Get all registered function schemas (for sending to backend)
|
|
2077
2113
|
*/
|
|
2078
2114
|
getSchemas(): ClientFunctionSchema[];
|
|
2115
|
+
/**
|
|
2116
|
+
* Every registration, name included, with the SDK-side settings
|
|
2117
|
+
* {@link getSchemas} drops.
|
|
2118
|
+
*/
|
|
2119
|
+
getAll(): Array<RegisteredFunction & {
|
|
2120
|
+
name: string;
|
|
2121
|
+
}>;
|
|
2079
2122
|
/**
|
|
2080
2123
|
* Execute a registered function
|
|
2081
2124
|
*/
|
|
@@ -2587,13 +2630,9 @@ export declare interface ProactiveTriggerWhen {
|
|
|
2587
2630
|
/**
|
|
2588
2631
|
* Registered function with handler
|
|
2589
2632
|
*/
|
|
2590
|
-
export declare interface RegisteredFunction {
|
|
2633
|
+
export declare interface RegisteredFunction extends ClientFunctionSettings {
|
|
2591
2634
|
schema: ClientFunctionSchema;
|
|
2592
2635
|
handler: ClientFunctionHandler;
|
|
2593
|
-
/** Per-function result-size ceiling; falls back to the registry default. */
|
|
2594
|
-
maxResultBytes?: number;
|
|
2595
|
-
/** Require explicit user approval before running (pause mode only). */
|
|
2596
|
-
requiresApproval?: boolean;
|
|
2597
2636
|
}
|
|
2598
2637
|
|
|
2599
2638
|
/**
|
|
@@ -2622,7 +2661,7 @@ export declare function safeAttachmentUrl(url?: string): string | undefined;
|
|
|
2622
2661
|
export declare const scrollToElement: ClientFunctionDefinition;
|
|
2623
2662
|
|
|
2624
2663
|
/** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
|
|
2625
|
-
declare interface SdkConfig {
|
|
2664
|
+
export declare interface SdkConfig {
|
|
2626
2665
|
permissions: SdkPermissionConfig[];
|
|
2627
2666
|
proactive: {
|
|
2628
2667
|
enabled: boolean;
|
|
@@ -2653,7 +2692,7 @@ declare interface SdkHomeStarter {
|
|
|
2653
2692
|
}
|
|
2654
2693
|
|
|
2655
2694
|
/** One permission's configuration in {@link SdkConfig}. */
|
|
2656
|
-
declare interface SdkPermissionConfig {
|
|
2695
|
+
export declare interface SdkPermissionConfig {
|
|
2657
2696
|
id?: string;
|
|
2658
2697
|
name?: string;
|
|
2659
2698
|
displayName?: string;
|
|
@@ -2666,6 +2705,8 @@ declare interface SdkPermissionConfig {
|
|
|
2666
2705
|
homePage?: SdkHomePageConfig;
|
|
2667
2706
|
fileAttachmentsEnabled: boolean;
|
|
2668
2707
|
voiceEnabled: boolean;
|
|
2708
|
+
/** Whether audio uploads can be transcribed. Defaults to false on older backends. */
|
|
2709
|
+
speechToTextEnabled: boolean;
|
|
2669
2710
|
}
|
|
2670
2711
|
|
|
2671
2712
|
/**
|
|
@@ -3254,6 +3295,12 @@ export declare type ToolCallType = "form" | "confirmation_input" | "status_messa
|
|
|
3254
3295
|
*/
|
|
3255
3296
|
export declare const trackEvent: ClientFunctionDefinition;
|
|
3256
3297
|
|
|
3298
|
+
/** Options for `AgoClient.transcribeAudio`. */
|
|
3299
|
+
export declare interface TranscribeAudioOptions {
|
|
3300
|
+
/** Cancel the upload or stop waiting for its transcription. */
|
|
3301
|
+
signal?: AbortSignal;
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3257
3304
|
/**
|
|
3258
3305
|
* Validate an AgoConfig at the public API boundary.
|
|
3259
3306
|
*
|
|
@@ -3277,6 +3324,25 @@ export declare const trackEvent: ClientFunctionDefinition;
|
|
|
3277
3324
|
*/
|
|
3278
3325
|
export declare function validateConfig(config: unknown, context?: string): asserts config is AgoConfig;
|
|
3279
3326
|
|
|
3327
|
+
/** The MCP behavior hints AGO has no equivalent for. */
|
|
3328
|
+
export declare interface WebMCPToolMeta {
|
|
3329
|
+
/**
|
|
3330
|
+
* Both default to `false`, so only set what is true: `readOnlyHint` marks a
|
|
3331
|
+
* function that changes nothing, `untrustedContentHint` one whose result may
|
|
3332
|
+
* carry third-party text.
|
|
3333
|
+
*/
|
|
3334
|
+
annotations?: {
|
|
3335
|
+
readOnlyHint?: boolean;
|
|
3336
|
+
untrustedContentHint?: boolean;
|
|
3337
|
+
};
|
|
3338
|
+
/**
|
|
3339
|
+
* This function navigates. The WebMCP call is held open until the function
|
|
3340
|
+
* registry goes quiet, so the caller sees the destination page's tools rather
|
|
3341
|
+
* than the departing page's. Already set on the built-in `navigateToPage`.
|
|
3342
|
+
*/
|
|
3343
|
+
navigates?: boolean;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3280
3346
|
/**
|
|
3281
3347
|
* Attach a handler to a pre-built function definition.
|
|
3282
3348
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -131,7 +131,10 @@ export declare class AgoClient {
|
|
|
131
131
|
* `null` otherwise.
|
|
132
132
|
*/
|
|
133
133
|
proactive: ProactiveController | null;
|
|
134
|
+
/** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
|
|
135
|
+
private detachWebMCP;
|
|
134
136
|
constructor(config: AgoConfig);
|
|
137
|
+
private attachWebMCPBridge;
|
|
135
138
|
/**
|
|
136
139
|
* Send a message and receive a streaming response
|
|
137
140
|
*/
|
|
@@ -243,6 +246,7 @@ export declare class AgoClient {
|
|
|
243
246
|
* (the agent decides what to do next). No-op if the invocation is unknown.
|
|
244
247
|
*/
|
|
245
248
|
rejectFunction(invocationId: string): Promise<void>;
|
|
249
|
+
/* Excluded from this release type: runExternalFunction */
|
|
246
250
|
/**
|
|
247
251
|
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
248
252
|
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
@@ -262,11 +266,20 @@ export declare class AgoClient {
|
|
|
262
266
|
* `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
|
|
263
267
|
*/
|
|
264
268
|
private static mapPersistedToolCalls;
|
|
269
|
+
/**
|
|
270
|
+
* Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
|
|
271
|
+
* Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
|
|
272
|
+
* MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
|
|
273
|
+
* The filename must include the matching extension. For a MediaRecorder blob,
|
|
274
|
+
* wrap it in a File with the recording's extension and MIME type.
|
|
275
|
+
* Show the returned text as a draft; call `sendMessage` when the user sends it.
|
|
276
|
+
*/
|
|
277
|
+
transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
|
|
265
278
|
/**
|
|
266
279
|
* The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
|
|
267
280
|
* agents, the ticket form the agent's `ago_ticketing` tool opens, and the
|
|
268
|
-
* file-attachment
|
|
269
|
-
* form first appears in a conversation.
|
|
281
|
+
* file-attachment and speech-to-text flags. The vanilla widget fetches it
|
|
282
|
+
* once, when a ticket form first appears in a conversation.
|
|
270
283
|
*/
|
|
271
284
|
getConfig(): Promise<SdkConfig>;
|
|
272
285
|
/**
|
|
@@ -403,6 +416,9 @@ export declare class AgoClient {
|
|
|
403
416
|
* Get all registered function schemas
|
|
404
417
|
*/
|
|
405
418
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
419
|
+
/** The callback form of `functions:changed`. Returns an unsubscribe. */
|
|
420
|
+
onFunctionsChanged(listener: () => void): () => void;
|
|
421
|
+
/* Excluded from this release type: getFunctionRegistrations */
|
|
406
422
|
/**
|
|
407
423
|
* Execute a registered client function locally, through the same
|
|
408
424
|
* FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
|
|
@@ -735,6 +751,8 @@ export declare interface AgoClientEvents {
|
|
|
735
751
|
* call running immediately.
|
|
736
752
|
*/
|
|
737
753
|
"function:awaiting-approval": ClientFunctionInvocation;
|
|
754
|
+
/** A function was registered or unregistered, or the registry cleared. */
|
|
755
|
+
"functions:changed": ClientFunctionSchema[];
|
|
738
756
|
"function:result": {
|
|
739
757
|
invocationId: string;
|
|
740
758
|
result: unknown;
|
|
@@ -807,6 +825,8 @@ export declare interface AgoConfig {
|
|
|
807
825
|
defaultAgentId?: string;
|
|
808
826
|
/** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
|
|
809
827
|
permission?: string;
|
|
828
|
+
/** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
|
|
829
|
+
language?: string | null;
|
|
810
830
|
/** User email for identification */
|
|
811
831
|
userEmail?: string;
|
|
812
832
|
/** JWT token for authenticated users */
|
|
@@ -884,6 +904,15 @@ export declare interface AgoConfig {
|
|
|
884
904
|
* mode's `jsErrors` signal. See `client.reportError()` for caught errors.
|
|
885
905
|
*/
|
|
886
906
|
errorWatcher?: boolean | ErrorWatcherOptions;
|
|
907
|
+
/** Mirror every registered client function into the browser's WebMCP registry
|
|
908
|
+
* (`document.modelContext`), so an external agent can call the same functions
|
|
909
|
+
* the in-app agent calls. Off by default; no-ops without WebMCP.
|
|
910
|
+
*
|
|
911
|
+
* A mirrored function runs immediately: the approval gate
|
|
912
|
+
* ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
|
|
913
|
+
* Use `webmcp: false` on a definition to keep it out.
|
|
914
|
+
*/
|
|
915
|
+
webmcp?: boolean;
|
|
887
916
|
}
|
|
888
917
|
|
|
889
918
|
/**
|
|
@@ -1200,6 +1229,11 @@ declare interface ApiErrorResponse {
|
|
|
1200
1229
|
*/
|
|
1201
1230
|
export declare function attachAutoContinueAfterNavigation(client: AgoClient, options?: AgoAutoContinueOptions | (() => AgoAutoContinueOptions | undefined)): () => void;
|
|
1202
1231
|
|
|
1232
|
+
/** Editable text returned by `AgoClient.transcribeAudio`. */
|
|
1233
|
+
export declare interface AudioTranscription {
|
|
1234
|
+
text: string;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1203
1237
|
/**
|
|
1204
1238
|
* Auto-detect AGO configuration from the DOM environment.
|
|
1205
1239
|
*
|
|
@@ -1303,22 +1337,11 @@ export declare type ClientFunction = (args: Record<string, unknown>) => Promise<
|
|
|
1303
1337
|
* client.registerFunction(fn);
|
|
1304
1338
|
* ```
|
|
1305
1339
|
*/
|
|
1306
|
-
export declare interface ClientFunctionDefinition {
|
|
1340
|
+
export declare interface ClientFunctionDefinition extends ClientFunctionSettings {
|
|
1307
1341
|
name: string;
|
|
1308
1342
|
description: string;
|
|
1309
1343
|
parameters: ClientFunctionSchema["parameters"];
|
|
1310
1344
|
handler: ClientFunctionHandler;
|
|
1311
|
-
/**
|
|
1312
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1313
|
-
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
1314
|
-
* `Infinity` 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
1345
|
}
|
|
1323
1346
|
|
|
1324
1347
|
/**
|
|
@@ -1337,20 +1360,7 @@ export declare interface ClientFunctionInvocation {
|
|
|
1337
1360
|
* Schema-plus-settings object accepted when registering a function: the schema
|
|
1338
1361
|
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
1339
1362
|
*/
|
|
1340
|
-
export declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> &
|
|
1341
|
-
/**
|
|
1342
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1343
|
-
* flagged preview. Overrides the client-level default
|
|
1344
|
-
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1345
|
-
* disables the guard for this function.
|
|
1346
|
-
*/
|
|
1347
|
-
maxResultBytes?: number;
|
|
1348
|
-
/**
|
|
1349
|
-
* Require explicit user approval before this function runs. See
|
|
1350
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1351
|
-
*/
|
|
1352
|
-
requiresApproval?: boolean;
|
|
1353
|
-
};
|
|
1363
|
+
export declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
|
|
1354
1364
|
|
|
1355
1365
|
/**
|
|
1356
1366
|
* Schema for a client-side function that AGO can call
|
|
@@ -1377,6 +1387,28 @@ export declare interface ClientFunctionSchema {
|
|
|
1377
1387
|
};
|
|
1378
1388
|
}
|
|
1379
1389
|
|
|
1390
|
+
/** SDK-side function settings that are never sent to the backend. */
|
|
1391
|
+
declare interface ClientFunctionSettings {
|
|
1392
|
+
/**
|
|
1393
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1394
|
+
* flagged preview. Overrides the client-level default
|
|
1395
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1396
|
+
* disables the guard for this function.
|
|
1397
|
+
*/
|
|
1398
|
+
maxResultBytes?: number;
|
|
1399
|
+
/**
|
|
1400
|
+
* Require explicit user approval before this function runs. See
|
|
1401
|
+
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1402
|
+
*/
|
|
1403
|
+
requiresApproval?: boolean;
|
|
1404
|
+
/**
|
|
1405
|
+
* WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
|
|
1406
|
+
* `false` keeps this function out of WebMCP while leaving it available to the
|
|
1407
|
+
* in-app agent.
|
|
1408
|
+
*/
|
|
1409
|
+
webmcp?: WebMCPToolMeta | false;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1380
1412
|
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
1381
1413
|
export declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
1382
1414
|
|
|
@@ -2045,7 +2077,11 @@ export declare interface FunctionDefinition {
|
|
|
2045
2077
|
export declare class FunctionRegistry {
|
|
2046
2078
|
private functions;
|
|
2047
2079
|
private defaultMaxResultBytes;
|
|
2080
|
+
private changeListeners;
|
|
2048
2081
|
constructor(options?: FunctionRegistryOptions);
|
|
2082
|
+
/** Fires on registrations, unregistrations and clears. */
|
|
2083
|
+
onChange(listener: () => void): () => void;
|
|
2084
|
+
private emitChange;
|
|
2049
2085
|
/** Update the client-level result-size ceiling at runtime. */
|
|
2050
2086
|
setDefaultMaxResultBytes(bytes: number): void;
|
|
2051
2087
|
/**
|
|
@@ -2076,6 +2112,13 @@ export declare class FunctionRegistry {
|
|
|
2076
2112
|
* Get all registered function schemas (for sending to backend)
|
|
2077
2113
|
*/
|
|
2078
2114
|
getSchemas(): ClientFunctionSchema[];
|
|
2115
|
+
/**
|
|
2116
|
+
* Every registration, name included, with the SDK-side settings
|
|
2117
|
+
* {@link getSchemas} drops.
|
|
2118
|
+
*/
|
|
2119
|
+
getAll(): Array<RegisteredFunction & {
|
|
2120
|
+
name: string;
|
|
2121
|
+
}>;
|
|
2079
2122
|
/**
|
|
2080
2123
|
* Execute a registered function
|
|
2081
2124
|
*/
|
|
@@ -2587,13 +2630,9 @@ export declare interface ProactiveTriggerWhen {
|
|
|
2587
2630
|
/**
|
|
2588
2631
|
* Registered function with handler
|
|
2589
2632
|
*/
|
|
2590
|
-
export declare interface RegisteredFunction {
|
|
2633
|
+
export declare interface RegisteredFunction extends ClientFunctionSettings {
|
|
2591
2634
|
schema: ClientFunctionSchema;
|
|
2592
2635
|
handler: ClientFunctionHandler;
|
|
2593
|
-
/** Per-function result-size ceiling; falls back to the registry default. */
|
|
2594
|
-
maxResultBytes?: number;
|
|
2595
|
-
/** Require explicit user approval before running (pause mode only). */
|
|
2596
|
-
requiresApproval?: boolean;
|
|
2597
2636
|
}
|
|
2598
2637
|
|
|
2599
2638
|
/**
|
|
@@ -2622,7 +2661,7 @@ export declare function safeAttachmentUrl(url?: string): string | undefined;
|
|
|
2622
2661
|
export declare const scrollToElement: ClientFunctionDefinition;
|
|
2623
2662
|
|
|
2624
2663
|
/** Response of `GET /api/sdk/v1/config` (see `AgoClient.getConfig`). */
|
|
2625
|
-
declare interface SdkConfig {
|
|
2664
|
+
export declare interface SdkConfig {
|
|
2626
2665
|
permissions: SdkPermissionConfig[];
|
|
2627
2666
|
proactive: {
|
|
2628
2667
|
enabled: boolean;
|
|
@@ -2653,7 +2692,7 @@ declare interface SdkHomeStarter {
|
|
|
2653
2692
|
}
|
|
2654
2693
|
|
|
2655
2694
|
/** One permission's configuration in {@link SdkConfig}. */
|
|
2656
|
-
declare interface SdkPermissionConfig {
|
|
2695
|
+
export declare interface SdkPermissionConfig {
|
|
2657
2696
|
id?: string;
|
|
2658
2697
|
name?: string;
|
|
2659
2698
|
displayName?: string;
|
|
@@ -2666,6 +2705,8 @@ declare interface SdkPermissionConfig {
|
|
|
2666
2705
|
homePage?: SdkHomePageConfig;
|
|
2667
2706
|
fileAttachmentsEnabled: boolean;
|
|
2668
2707
|
voiceEnabled: boolean;
|
|
2708
|
+
/** Whether audio uploads can be transcribed. Defaults to false on older backends. */
|
|
2709
|
+
speechToTextEnabled: boolean;
|
|
2669
2710
|
}
|
|
2670
2711
|
|
|
2671
2712
|
/**
|
|
@@ -3254,6 +3295,12 @@ export declare type ToolCallType = "form" | "confirmation_input" | "status_messa
|
|
|
3254
3295
|
*/
|
|
3255
3296
|
export declare const trackEvent: ClientFunctionDefinition;
|
|
3256
3297
|
|
|
3298
|
+
/** Options for `AgoClient.transcribeAudio`. */
|
|
3299
|
+
export declare interface TranscribeAudioOptions {
|
|
3300
|
+
/** Cancel the upload or stop waiting for its transcription. */
|
|
3301
|
+
signal?: AbortSignal;
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3257
3304
|
/**
|
|
3258
3305
|
* Validate an AgoConfig at the public API boundary.
|
|
3259
3306
|
*
|
|
@@ -3277,6 +3324,25 @@ export declare const trackEvent: ClientFunctionDefinition;
|
|
|
3277
3324
|
*/
|
|
3278
3325
|
export declare function validateConfig(config: unknown, context?: string): asserts config is AgoConfig;
|
|
3279
3326
|
|
|
3327
|
+
/** The MCP behavior hints AGO has no equivalent for. */
|
|
3328
|
+
export declare interface WebMCPToolMeta {
|
|
3329
|
+
/**
|
|
3330
|
+
* Both default to `false`, so only set what is true: `readOnlyHint` marks a
|
|
3331
|
+
* function that changes nothing, `untrustedContentHint` one whose result may
|
|
3332
|
+
* carry third-party text.
|
|
3333
|
+
*/
|
|
3334
|
+
annotations?: {
|
|
3335
|
+
readOnlyHint?: boolean;
|
|
3336
|
+
untrustedContentHint?: boolean;
|
|
3337
|
+
};
|
|
3338
|
+
/**
|
|
3339
|
+
* This function navigates. The WebMCP call is held open until the function
|
|
3340
|
+
* registry goes quiet, so the caller sees the destination page's tools rather
|
|
3341
|
+
* than the departing page's. Already set on the built-in `navigateToPage`.
|
|
3342
|
+
*/
|
|
3343
|
+
navigates?: boolean;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3280
3346
|
/**
|
|
3281
3347
|
* Attach a handler to a pre-built function definition.
|
|
3282
3348
|
*
|