@useago/sdk 1.12.0 → 1.13.1
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 +111 -4
- package/README.md +73 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +140 -38
- package/dist/angular.d.ts +140 -38
- package/dist/angular.js +7 -4
- package/dist/autoContinue-C3UsCvT5.cjs +1 -0
- package/dist/{autoContinue-CC8K9mBU.js → autoContinue-Cb4_iEbO.js} +1 -1
- package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-D0vks-8C.js} +1 -1
- package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-Ri3EKIJU.cjs} +1 -1
- package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-BMN-blXs.js} +1 -1
- package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-BNCMIUw2.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 +129 -33
- package/dist/devtools.d.ts +129 -33
- 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 +135 -40
- package/dist/index.d.ts +135 -40
- package/dist/index.js +44 -43
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +187 -34
- package/dist/react.d.ts +187 -34
- package/dist/react.js +822 -729
- 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 +129 -33
- package/dist/testing.d.ts +129 -33
- package/dist/testing.js +1 -1
- package/dist/types-Ck3iZG0K.cjs +10 -0
- package/dist/{types-Ct1hlKwg.js → types-fX-VoHfa.js} +1042 -759
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +143 -35
- package/dist/vue.d.ts +143 -35
- package/dist/vue.js +133 -131
- package/dist/widget.cjs +6 -6
- package/dist/widget.d.cts +161 -33
- package/dist/widget.d.ts +161 -33
- package/dist/widget.js +1702 -1757
- package/llms-full.txt +166 -1
- package/package.json +1 -1
- package/dist/autoContinue-CP9pJR-V.cjs +0 -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/devtools.d.cts
CHANGED
|
@@ -58,6 +58,8 @@ declare class AgoClient {
|
|
|
58
58
|
private config;
|
|
59
59
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
60
60
|
private warnedEmptyConversations;
|
|
61
|
+
/** Client functions the backend has accepted from a WebMCP call report. */
|
|
62
|
+
private declaredExternally;
|
|
61
63
|
/** Whether the placeholder-mode page-data warning has already been logged. */
|
|
62
64
|
private warnedPageDataPlaceholder;
|
|
63
65
|
/** `readPageData` companions this SDK registered, so cleanup only removes its own. */
|
|
@@ -92,7 +94,12 @@ declare class AgoClient {
|
|
|
92
94
|
* `null` otherwise.
|
|
93
95
|
*/
|
|
94
96
|
proactive: ProactiveController | null;
|
|
97
|
+
/** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
|
|
98
|
+
private detachWebMCP;
|
|
99
|
+
/** The `listPages` companion is live. */
|
|
100
|
+
private listPagesRegistered;
|
|
95
101
|
constructor(config: AgoConfig);
|
|
102
|
+
private attachWebMCPBridge;
|
|
96
103
|
/**
|
|
97
104
|
* Send a message and receive a streaming response
|
|
98
105
|
*/
|
|
@@ -204,6 +211,12 @@ declare class AgoClient {
|
|
|
204
211
|
* (the agent decides what to do next). No-op if the invocation is unknown.
|
|
205
212
|
*/
|
|
206
213
|
rejectFunction(invocationId: string): Promise<void>;
|
|
214
|
+
/* Excluded from this release type: runExternalFunction */
|
|
215
|
+
/**
|
|
216
|
+
* Best-effort analytics for one WebMCP call. No agent: the caller is someone
|
|
217
|
+
* else's agent and cannot be known from `execute`.
|
|
218
|
+
*/
|
|
219
|
+
private reportExternalCall;
|
|
207
220
|
/**
|
|
208
221
|
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
209
222
|
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
@@ -223,11 +236,20 @@ declare class AgoClient {
|
|
|
223
236
|
* `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
|
|
224
237
|
*/
|
|
225
238
|
private static mapPersistedToolCalls;
|
|
239
|
+
/**
|
|
240
|
+
* Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
|
|
241
|
+
* Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
|
|
242
|
+
* MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
|
|
243
|
+
* The filename must include the matching extension. For a MediaRecorder blob,
|
|
244
|
+
* wrap it in a File with the recording's extension and MIME type.
|
|
245
|
+
* Show the returned text as a draft; call `sendMessage` when the user sends it.
|
|
246
|
+
*/
|
|
247
|
+
transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
|
|
226
248
|
/**
|
|
227
249
|
* The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
|
|
228
250
|
* agents, the ticket form the agent's `ago_ticketing` tool opens, and the
|
|
229
|
-
* file-attachment
|
|
230
|
-
* form first appears in a conversation.
|
|
251
|
+
* file-attachment and speech-to-text flags. The vanilla widget fetches it
|
|
252
|
+
* once, when a ticket form first appears in a conversation.
|
|
231
253
|
*/
|
|
232
254
|
getConfig(): Promise<SdkConfig>;
|
|
233
255
|
/**
|
|
@@ -364,6 +386,9 @@ declare class AgoClient {
|
|
|
364
386
|
* Get all registered function schemas
|
|
365
387
|
*/
|
|
366
388
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
389
|
+
/** The callback form of `functions:changed`. Returns an unsubscribe. */
|
|
390
|
+
onFunctionsChanged(listener: () => void): () => void;
|
|
391
|
+
/* Excluded from this release type: getFunctionRegistrations */
|
|
367
392
|
/**
|
|
368
393
|
* Execute a registered client function locally, through the same
|
|
369
394
|
* FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
|
|
@@ -386,14 +411,15 @@ declare class AgoClient {
|
|
|
386
411
|
* page of an entity. Flat arguments only: nested object parameters are not
|
|
387
412
|
* reliably rendered to the model, so placeholders must not be named `page`.
|
|
388
413
|
*
|
|
414
|
+
* For a large table, `{ catalogue: "onDemand" }` moves the route descriptions
|
|
415
|
+
* into a read-only `listPages` companion, leaving only the page names in the
|
|
416
|
+
* per-message schema. Routes may carry a `section` to group that companion.
|
|
417
|
+
*
|
|
389
418
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
390
419
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
420
|
+
* @param opts - Where the catalogue lives; `"inline"` by default
|
|
391
421
|
*/
|
|
392
|
-
registerNavigationFunction(navigate: (path: string) => void, routes:
|
|
393
|
-
name: string;
|
|
394
|
-
path: string;
|
|
395
|
-
description: string;
|
|
396
|
-
}>): void;
|
|
422
|
+
registerNavigationFunction(navigate: (path: string) => void, routes: NavRoute[], opts?: AgoNavigationOptions): void;
|
|
397
423
|
/**
|
|
398
424
|
* Unregister the navigation function and its `current-page` context provider.
|
|
399
425
|
*/
|
|
@@ -696,6 +722,8 @@ declare interface AgoClientEvents {
|
|
|
696
722
|
* call running immediately.
|
|
697
723
|
*/
|
|
698
724
|
"function:awaiting-approval": ClientFunctionInvocation;
|
|
725
|
+
/** A function was registered or unregistered, or the registry cleared. */
|
|
726
|
+
"functions:changed": ClientFunctionSchema[];
|
|
699
727
|
"function:result": {
|
|
700
728
|
invocationId: string;
|
|
701
729
|
result: unknown;
|
|
@@ -768,6 +796,8 @@ declare interface AgoConfig {
|
|
|
768
796
|
defaultAgentId?: string;
|
|
769
797
|
/** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
|
|
770
798
|
permission?: string;
|
|
799
|
+
/** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
|
|
800
|
+
language?: string | null;
|
|
771
801
|
/** User email for identification */
|
|
772
802
|
userEmail?: string;
|
|
773
803
|
/** JWT token for authenticated users */
|
|
@@ -845,6 +875,15 @@ declare interface AgoConfig {
|
|
|
845
875
|
* mode's `jsErrors` signal. See `client.reportError()` for caught errors.
|
|
846
876
|
*/
|
|
847
877
|
errorWatcher?: boolean | ErrorWatcherOptions;
|
|
878
|
+
/** Mirror every registered client function into the browser's WebMCP registry
|
|
879
|
+
* (`document.modelContext`), so an external agent can call the same functions
|
|
880
|
+
* the in-app agent calls. Off by default; no-ops without WebMCP.
|
|
881
|
+
*
|
|
882
|
+
* A mirrored function runs immediately: the approval gate
|
|
883
|
+
* ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
|
|
884
|
+
* Use `webmcp: false` on a definition to keep it out.
|
|
885
|
+
*/
|
|
886
|
+
webmcp?: boolean;
|
|
848
887
|
}
|
|
849
888
|
|
|
850
889
|
declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
|
|
@@ -875,6 +914,16 @@ declare interface AgoMessage {
|
|
|
875
914
|
createdAt: Date;
|
|
876
915
|
}
|
|
877
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Where the route catalogue lives: `"inline"` (default) in `navigateToPage`'s
|
|
919
|
+
* description, or `"onDemand"` in a `listPages` companion's result.
|
|
920
|
+
*/
|
|
921
|
+
declare type AgoNavigationOptions = {
|
|
922
|
+
catalogue?: "inline";
|
|
923
|
+
} | {
|
|
924
|
+
catalogue: "onDemand";
|
|
925
|
+
};
|
|
926
|
+
|
|
878
927
|
/**
|
|
879
928
|
* What the page currently displays, returned to the agent as the *result* of
|
|
880
929
|
* `setPageState` instead of only as context on the next message.
|
|
@@ -1029,6 +1078,11 @@ declare type AgoStateSetResult = {
|
|
|
1029
1078
|
result: "unchanged";
|
|
1030
1079
|
};
|
|
1031
1080
|
|
|
1081
|
+
/** Editable text returned by `AgoClient.transcribeAudio`. */
|
|
1082
|
+
declare interface AudioTranscription {
|
|
1083
|
+
text: string;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1032
1086
|
/** One JavaScript error captured on the page (deduplicated, see `count`). */
|
|
1033
1087
|
declare interface CapturedError {
|
|
1034
1088
|
type: CapturedErrorType;
|
|
@@ -1068,22 +1122,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
|
|
|
1068
1122
|
* client.registerFunction(fn);
|
|
1069
1123
|
* ```
|
|
1070
1124
|
*/
|
|
1071
|
-
declare interface ClientFunctionDefinition {
|
|
1125
|
+
declare interface ClientFunctionDefinition extends ClientFunctionSettings {
|
|
1072
1126
|
name: string;
|
|
1073
1127
|
description: string;
|
|
1074
1128
|
parameters: ClientFunctionSchema["parameters"];
|
|
1075
1129
|
handler: ClientFunctionHandler;
|
|
1076
|
-
/**
|
|
1077
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1078
|
-
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
1079
|
-
* `Infinity` disables the guard for this function.
|
|
1080
|
-
*/
|
|
1081
|
-
maxResultBytes?: number;
|
|
1082
|
-
/**
|
|
1083
|
-
* Require explicit user approval before this function runs. See
|
|
1084
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1085
|
-
*/
|
|
1086
|
-
requiresApproval?: boolean;
|
|
1087
1130
|
}
|
|
1088
1131
|
|
|
1089
1132
|
/**
|
|
@@ -1102,20 +1145,7 @@ declare interface ClientFunctionInvocation {
|
|
|
1102
1145
|
* Schema-plus-settings object accepted when registering a function: the schema
|
|
1103
1146
|
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
1104
1147
|
*/
|
|
1105
|
-
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> &
|
|
1106
|
-
/**
|
|
1107
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1108
|
-
* flagged preview. Overrides the client-level default
|
|
1109
|
-
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1110
|
-
* disables the guard for this function.
|
|
1111
|
-
*/
|
|
1112
|
-
maxResultBytes?: number;
|
|
1113
|
-
/**
|
|
1114
|
-
* Require explicit user approval before this function runs. See
|
|
1115
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1116
|
-
*/
|
|
1117
|
-
requiresApproval?: boolean;
|
|
1118
|
-
};
|
|
1148
|
+
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
|
|
1119
1149
|
|
|
1120
1150
|
/**
|
|
1121
1151
|
* Schema for a client-side function that AGO can call
|
|
@@ -1142,6 +1172,28 @@ declare interface ClientFunctionSchema {
|
|
|
1142
1172
|
};
|
|
1143
1173
|
}
|
|
1144
1174
|
|
|
1175
|
+
/** SDK-side function settings that are never sent to the backend. */
|
|
1176
|
+
declare interface ClientFunctionSettings {
|
|
1177
|
+
/**
|
|
1178
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1179
|
+
* flagged preview. Overrides the client-level default
|
|
1180
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1181
|
+
* disables the guard for this function.
|
|
1182
|
+
*/
|
|
1183
|
+
maxResultBytes?: number;
|
|
1184
|
+
/**
|
|
1185
|
+
* Require explicit user approval before this function runs. See
|
|
1186
|
+
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1187
|
+
*/
|
|
1188
|
+
requiresApproval?: boolean;
|
|
1189
|
+
/**
|
|
1190
|
+
* WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
|
|
1191
|
+
* `false` keeps this function out of WebMCP while leaving it available to the
|
|
1192
|
+
* in-app agent.
|
|
1193
|
+
*/
|
|
1194
|
+
webmcp?: WebMCPToolMeta | false;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1145
1197
|
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
1146
1198
|
declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
1147
1199
|
|
|
@@ -1449,6 +1501,15 @@ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCEL
|
|
|
1449
1501
|
*/
|
|
1450
1502
|
| "WAITING_CLIENT";
|
|
1451
1503
|
|
|
1504
|
+
/** A navigable page. `path` may carry `:param` placeholders. */
|
|
1505
|
+
declare interface NavRoute {
|
|
1506
|
+
name: string;
|
|
1507
|
+
path: string;
|
|
1508
|
+
description: string;
|
|
1509
|
+
/** Only read under `catalogue: "onDemand"`. */
|
|
1510
|
+
section?: string;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1452
1513
|
/**
|
|
1453
1514
|
* Optional action attached to a nudge. Accepting a `functionName` action
|
|
1454
1515
|
* executes the registered client function (same `FunctionRegistry` path as
|
|
@@ -1641,6 +1702,14 @@ declare interface ProactiveTriggerWhen {
|
|
|
1641
1702
|
fieldErrors?: Record<string, number>;
|
|
1642
1703
|
}
|
|
1643
1704
|
|
|
1705
|
+
/**
|
|
1706
|
+
* Registered function with handler
|
|
1707
|
+
*/
|
|
1708
|
+
declare interface RegisteredFunction extends ClientFunctionSettings {
|
|
1709
|
+
schema: ClientFunctionSchema;
|
|
1710
|
+
handler: ClientFunctionHandler;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1644
1713
|
/**
|
|
1645
1714
|
* Hook run before a paused turn is resumed, so the app controls WHEN the
|
|
1646
1715
|
* continuation fires (e.g. wait for the destination page to mount after a
|
|
@@ -1697,6 +1766,8 @@ declare interface SdkPermissionConfig {
|
|
|
1697
1766
|
homePage?: SdkHomePageConfig;
|
|
1698
1767
|
fileAttachmentsEnabled: boolean;
|
|
1699
1768
|
voiceEnabled: boolean;
|
|
1769
|
+
/** Whether audio uploads can be transcribed. Defaults to false on older backends. */
|
|
1770
|
+
speechToTextEnabled: boolean;
|
|
1700
1771
|
}
|
|
1701
1772
|
|
|
1702
1773
|
/**
|
|
@@ -2009,4 +2080,29 @@ declare interface ToolCallTicketPrefill {
|
|
|
2009
2080
|
|
|
2010
2081
|
declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
|
|
2011
2082
|
|
|
2083
|
+
/** Options for `AgoClient.transcribeAudio`. */
|
|
2084
|
+
declare interface TranscribeAudioOptions {
|
|
2085
|
+
/** Cancel the upload or stop waiting for its transcription. */
|
|
2086
|
+
signal?: AbortSignal;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
/** The MCP behavior hints AGO has no equivalent for. */
|
|
2090
|
+
declare interface WebMCPToolMeta {
|
|
2091
|
+
/**
|
|
2092
|
+
* Both default to `false`, so only set what is true: `readOnlyHint` marks a
|
|
2093
|
+
* function that changes nothing, `untrustedContentHint` one whose result may
|
|
2094
|
+
* carry third-party text.
|
|
2095
|
+
*/
|
|
2096
|
+
annotations?: {
|
|
2097
|
+
readOnlyHint?: boolean;
|
|
2098
|
+
untrustedContentHint?: boolean;
|
|
2099
|
+
};
|
|
2100
|
+
/**
|
|
2101
|
+
* This function navigates. The WebMCP call is held open until the function
|
|
2102
|
+
* registry goes quiet, so the caller sees the destination page's tools rather
|
|
2103
|
+
* than the departing page's. Already set on the built-in `navigateToPage`.
|
|
2104
|
+
*/
|
|
2105
|
+
navigates?: boolean;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2012
2108
|
export { }
|
package/dist/devtools.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ declare class AgoClient {
|
|
|
58
58
|
private config;
|
|
59
59
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
60
60
|
private warnedEmptyConversations;
|
|
61
|
+
/** Client functions the backend has accepted from a WebMCP call report. */
|
|
62
|
+
private declaredExternally;
|
|
61
63
|
/** Whether the placeholder-mode page-data warning has already been logged. */
|
|
62
64
|
private warnedPageDataPlaceholder;
|
|
63
65
|
/** `readPageData` companions this SDK registered, so cleanup only removes its own. */
|
|
@@ -92,7 +94,12 @@ declare class AgoClient {
|
|
|
92
94
|
* `null` otherwise.
|
|
93
95
|
*/
|
|
94
96
|
proactive: ProactiveController | null;
|
|
97
|
+
/** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
|
|
98
|
+
private detachWebMCP;
|
|
99
|
+
/** The `listPages` companion is live. */
|
|
100
|
+
private listPagesRegistered;
|
|
95
101
|
constructor(config: AgoConfig);
|
|
102
|
+
private attachWebMCPBridge;
|
|
96
103
|
/**
|
|
97
104
|
* Send a message and receive a streaming response
|
|
98
105
|
*/
|
|
@@ -204,6 +211,12 @@ declare class AgoClient {
|
|
|
204
211
|
* (the agent decides what to do next). No-op if the invocation is unknown.
|
|
205
212
|
*/
|
|
206
213
|
rejectFunction(invocationId: string): Promise<void>;
|
|
214
|
+
/* Excluded from this release type: runExternalFunction */
|
|
215
|
+
/**
|
|
216
|
+
* Best-effort analytics for one WebMCP call. No agent: the caller is someone
|
|
217
|
+
* else's agent and cannot be known from `execute`.
|
|
218
|
+
*/
|
|
219
|
+
private reportExternalCall;
|
|
207
220
|
/**
|
|
208
221
|
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
209
222
|
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
@@ -223,11 +236,20 @@ declare class AgoClient {
|
|
|
223
236
|
* `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
|
|
224
237
|
*/
|
|
225
238
|
private static mapPersistedToolCalls;
|
|
239
|
+
/**
|
|
240
|
+
* Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
|
|
241
|
+
* Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
|
|
242
|
+
* MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
|
|
243
|
+
* The filename must include the matching extension. For a MediaRecorder blob,
|
|
244
|
+
* wrap it in a File with the recording's extension and MIME type.
|
|
245
|
+
* Show the returned text as a draft; call `sendMessage` when the user sends it.
|
|
246
|
+
*/
|
|
247
|
+
transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
|
|
226
248
|
/**
|
|
227
249
|
* The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
|
|
228
250
|
* agents, the ticket form the agent's `ago_ticketing` tool opens, and the
|
|
229
|
-
* file-attachment
|
|
230
|
-
* form first appears in a conversation.
|
|
251
|
+
* file-attachment and speech-to-text flags. The vanilla widget fetches it
|
|
252
|
+
* once, when a ticket form first appears in a conversation.
|
|
231
253
|
*/
|
|
232
254
|
getConfig(): Promise<SdkConfig>;
|
|
233
255
|
/**
|
|
@@ -364,6 +386,9 @@ declare class AgoClient {
|
|
|
364
386
|
* Get all registered function schemas
|
|
365
387
|
*/
|
|
366
388
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
389
|
+
/** The callback form of `functions:changed`. Returns an unsubscribe. */
|
|
390
|
+
onFunctionsChanged(listener: () => void): () => void;
|
|
391
|
+
/* Excluded from this release type: getFunctionRegistrations */
|
|
367
392
|
/**
|
|
368
393
|
* Execute a registered client function locally, through the same
|
|
369
394
|
* FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
|
|
@@ -386,14 +411,15 @@ declare class AgoClient {
|
|
|
386
411
|
* page of an entity. Flat arguments only: nested object parameters are not
|
|
387
412
|
* reliably rendered to the model, so placeholders must not be named `page`.
|
|
388
413
|
*
|
|
414
|
+
* For a large table, `{ catalogue: "onDemand" }` moves the route descriptions
|
|
415
|
+
* into a read-only `listPages` companion, leaving only the page names in the
|
|
416
|
+
* per-message schema. Routes may carry a `section` to group that companion.
|
|
417
|
+
*
|
|
389
418
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
390
419
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
420
|
+
* @param opts - Where the catalogue lives; `"inline"` by default
|
|
391
421
|
*/
|
|
392
|
-
registerNavigationFunction(navigate: (path: string) => void, routes:
|
|
393
|
-
name: string;
|
|
394
|
-
path: string;
|
|
395
|
-
description: string;
|
|
396
|
-
}>): void;
|
|
422
|
+
registerNavigationFunction(navigate: (path: string) => void, routes: NavRoute[], opts?: AgoNavigationOptions): void;
|
|
397
423
|
/**
|
|
398
424
|
* Unregister the navigation function and its `current-page` context provider.
|
|
399
425
|
*/
|
|
@@ -696,6 +722,8 @@ declare interface AgoClientEvents {
|
|
|
696
722
|
* call running immediately.
|
|
697
723
|
*/
|
|
698
724
|
"function:awaiting-approval": ClientFunctionInvocation;
|
|
725
|
+
/** A function was registered or unregistered, or the registry cleared. */
|
|
726
|
+
"functions:changed": ClientFunctionSchema[];
|
|
699
727
|
"function:result": {
|
|
700
728
|
invocationId: string;
|
|
701
729
|
result: unknown;
|
|
@@ -768,6 +796,8 @@ declare interface AgoConfig {
|
|
|
768
796
|
defaultAgentId?: string;
|
|
769
797
|
/** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
|
|
770
798
|
permission?: string;
|
|
799
|
+
/** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
|
|
800
|
+
language?: string | null;
|
|
771
801
|
/** User email for identification */
|
|
772
802
|
userEmail?: string;
|
|
773
803
|
/** JWT token for authenticated users */
|
|
@@ -845,6 +875,15 @@ declare interface AgoConfig {
|
|
|
845
875
|
* mode's `jsErrors` signal. See `client.reportError()` for caught errors.
|
|
846
876
|
*/
|
|
847
877
|
errorWatcher?: boolean | ErrorWatcherOptions;
|
|
878
|
+
/** Mirror every registered client function into the browser's WebMCP registry
|
|
879
|
+
* (`document.modelContext`), so an external agent can call the same functions
|
|
880
|
+
* the in-app agent calls. Off by default; no-ops without WebMCP.
|
|
881
|
+
*
|
|
882
|
+
* A mirrored function runs immediately: the approval gate
|
|
883
|
+
* ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
|
|
884
|
+
* Use `webmcp: false` on a definition to keep it out.
|
|
885
|
+
*/
|
|
886
|
+
webmcp?: boolean;
|
|
848
887
|
}
|
|
849
888
|
|
|
850
889
|
declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
|
|
@@ -875,6 +914,16 @@ declare interface AgoMessage {
|
|
|
875
914
|
createdAt: Date;
|
|
876
915
|
}
|
|
877
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Where the route catalogue lives: `"inline"` (default) in `navigateToPage`'s
|
|
919
|
+
* description, or `"onDemand"` in a `listPages` companion's result.
|
|
920
|
+
*/
|
|
921
|
+
declare type AgoNavigationOptions = {
|
|
922
|
+
catalogue?: "inline";
|
|
923
|
+
} | {
|
|
924
|
+
catalogue: "onDemand";
|
|
925
|
+
};
|
|
926
|
+
|
|
878
927
|
/**
|
|
879
928
|
* What the page currently displays, returned to the agent as the *result* of
|
|
880
929
|
* `setPageState` instead of only as context on the next message.
|
|
@@ -1029,6 +1078,11 @@ declare type AgoStateSetResult = {
|
|
|
1029
1078
|
result: "unchanged";
|
|
1030
1079
|
};
|
|
1031
1080
|
|
|
1081
|
+
/** Editable text returned by `AgoClient.transcribeAudio`. */
|
|
1082
|
+
declare interface AudioTranscription {
|
|
1083
|
+
text: string;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1032
1086
|
/** One JavaScript error captured on the page (deduplicated, see `count`). */
|
|
1033
1087
|
declare interface CapturedError {
|
|
1034
1088
|
type: CapturedErrorType;
|
|
@@ -1068,22 +1122,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
|
|
|
1068
1122
|
* client.registerFunction(fn);
|
|
1069
1123
|
* ```
|
|
1070
1124
|
*/
|
|
1071
|
-
declare interface ClientFunctionDefinition {
|
|
1125
|
+
declare interface ClientFunctionDefinition extends ClientFunctionSettings {
|
|
1072
1126
|
name: string;
|
|
1073
1127
|
description: string;
|
|
1074
1128
|
parameters: ClientFunctionSchema["parameters"];
|
|
1075
1129
|
handler: ClientFunctionHandler;
|
|
1076
|
-
/**
|
|
1077
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1078
|
-
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
1079
|
-
* `Infinity` disables the guard for this function.
|
|
1080
|
-
*/
|
|
1081
|
-
maxResultBytes?: number;
|
|
1082
|
-
/**
|
|
1083
|
-
* Require explicit user approval before this function runs. See
|
|
1084
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1085
|
-
*/
|
|
1086
|
-
requiresApproval?: boolean;
|
|
1087
1130
|
}
|
|
1088
1131
|
|
|
1089
1132
|
/**
|
|
@@ -1102,20 +1145,7 @@ declare interface ClientFunctionInvocation {
|
|
|
1102
1145
|
* Schema-plus-settings object accepted when registering a function: the schema
|
|
1103
1146
|
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
1104
1147
|
*/
|
|
1105
|
-
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> &
|
|
1106
|
-
/**
|
|
1107
|
-
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1108
|
-
* flagged preview. Overrides the client-level default
|
|
1109
|
-
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1110
|
-
* disables the guard for this function.
|
|
1111
|
-
*/
|
|
1112
|
-
maxResultBytes?: number;
|
|
1113
|
-
/**
|
|
1114
|
-
* Require explicit user approval before this function runs. See
|
|
1115
|
-
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1116
|
-
*/
|
|
1117
|
-
requiresApproval?: boolean;
|
|
1118
|
-
};
|
|
1148
|
+
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
|
|
1119
1149
|
|
|
1120
1150
|
/**
|
|
1121
1151
|
* Schema for a client-side function that AGO can call
|
|
@@ -1142,6 +1172,28 @@ declare interface ClientFunctionSchema {
|
|
|
1142
1172
|
};
|
|
1143
1173
|
}
|
|
1144
1174
|
|
|
1175
|
+
/** SDK-side function settings that are never sent to the backend. */
|
|
1176
|
+
declare interface ClientFunctionSettings {
|
|
1177
|
+
/**
|
|
1178
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
1179
|
+
* flagged preview. Overrides the client-level default
|
|
1180
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
1181
|
+
* disables the guard for this function.
|
|
1182
|
+
*/
|
|
1183
|
+
maxResultBytes?: number;
|
|
1184
|
+
/**
|
|
1185
|
+
* Require explicit user approval before this function runs. See
|
|
1186
|
+
* {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
|
|
1187
|
+
*/
|
|
1188
|
+
requiresApproval?: boolean;
|
|
1189
|
+
/**
|
|
1190
|
+
* WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
|
|
1191
|
+
* `false` keeps this function out of WebMCP while leaving it available to the
|
|
1192
|
+
* in-app agent.
|
|
1193
|
+
*/
|
|
1194
|
+
webmcp?: WebMCPToolMeta | false;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1145
1197
|
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
1146
1198
|
declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
1147
1199
|
|
|
@@ -1449,6 +1501,15 @@ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCEL
|
|
|
1449
1501
|
*/
|
|
1450
1502
|
| "WAITING_CLIENT";
|
|
1451
1503
|
|
|
1504
|
+
/** A navigable page. `path` may carry `:param` placeholders. */
|
|
1505
|
+
declare interface NavRoute {
|
|
1506
|
+
name: string;
|
|
1507
|
+
path: string;
|
|
1508
|
+
description: string;
|
|
1509
|
+
/** Only read under `catalogue: "onDemand"`. */
|
|
1510
|
+
section?: string;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1452
1513
|
/**
|
|
1453
1514
|
* Optional action attached to a nudge. Accepting a `functionName` action
|
|
1454
1515
|
* executes the registered client function (same `FunctionRegistry` path as
|
|
@@ -1641,6 +1702,14 @@ declare interface ProactiveTriggerWhen {
|
|
|
1641
1702
|
fieldErrors?: Record<string, number>;
|
|
1642
1703
|
}
|
|
1643
1704
|
|
|
1705
|
+
/**
|
|
1706
|
+
* Registered function with handler
|
|
1707
|
+
*/
|
|
1708
|
+
declare interface RegisteredFunction extends ClientFunctionSettings {
|
|
1709
|
+
schema: ClientFunctionSchema;
|
|
1710
|
+
handler: ClientFunctionHandler;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1644
1713
|
/**
|
|
1645
1714
|
* Hook run before a paused turn is resumed, so the app controls WHEN the
|
|
1646
1715
|
* continuation fires (e.g. wait for the destination page to mount after a
|
|
@@ -1697,6 +1766,8 @@ declare interface SdkPermissionConfig {
|
|
|
1697
1766
|
homePage?: SdkHomePageConfig;
|
|
1698
1767
|
fileAttachmentsEnabled: boolean;
|
|
1699
1768
|
voiceEnabled: boolean;
|
|
1769
|
+
/** Whether audio uploads can be transcribed. Defaults to false on older backends. */
|
|
1770
|
+
speechToTextEnabled: boolean;
|
|
1700
1771
|
}
|
|
1701
1772
|
|
|
1702
1773
|
/**
|
|
@@ -2009,4 +2080,29 @@ declare interface ToolCallTicketPrefill {
|
|
|
2009
2080
|
|
|
2010
2081
|
declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
|
|
2011
2082
|
|
|
2083
|
+
/** Options for `AgoClient.transcribeAudio`. */
|
|
2084
|
+
declare interface TranscribeAudioOptions {
|
|
2085
|
+
/** Cancel the upload or stop waiting for its transcription. */
|
|
2086
|
+
signal?: AbortSignal;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
/** The MCP behavior hints AGO has no equivalent for. */
|
|
2090
|
+
declare interface WebMCPToolMeta {
|
|
2091
|
+
/**
|
|
2092
|
+
* Both default to `false`, so only set what is true: `readOnlyHint` marks a
|
|
2093
|
+
* function that changes nothing, `untrustedContentHint` one whose result may
|
|
2094
|
+
* carry third-party text.
|
|
2095
|
+
*/
|
|
2096
|
+
annotations?: {
|
|
2097
|
+
readOnlyHint?: boolean;
|
|
2098
|
+
untrustedContentHint?: boolean;
|
|
2099
|
+
};
|
|
2100
|
+
/**
|
|
2101
|
+
* This function navigates. The WebMCP call is held open until the function
|
|
2102
|
+
* registry goes quiet, so the caller sees the destination page's tools rather
|
|
2103
|
+
* than the departing page's. Already set on the built-in `navigateToPage`.
|
|
2104
|
+
*/
|
|
2105
|
+
navigates?: boolean;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2012
2108
|
export { }
|