@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.
Files changed (51) hide show
  1. package/CHANGELOG.md +111 -4
  2. package/README.md +73 -0
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +140 -38
  5. package/dist/angular.d.ts +140 -38
  6. package/dist/angular.js +7 -4
  7. package/dist/autoContinue-C3UsCvT5.cjs +1 -0
  8. package/dist/{autoContinue-CC8K9mBU.js → autoContinue-Cb4_iEbO.js} +1 -1
  9. package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-D0vks-8C.js} +1 -1
  10. package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-Ri3EKIJU.cjs} +1 -1
  11. package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-BMN-blXs.js} +1 -1
  12. package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-BNCMIUw2.cjs} +1 -1
  13. package/dist/createMockClient-BPt1gSve.cjs +1 -0
  14. package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
  15. package/dist/devtools.cjs +4 -4
  16. package/dist/devtools.d.cts +129 -33
  17. package/dist/devtools.d.ts +129 -33
  18. package/dist/devtools.js +87 -84
  19. package/dist/helpers.d.cts +42 -12
  20. package/dist/helpers.d.ts +42 -12
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.cts +135 -40
  23. package/dist/index.d.ts +135 -40
  24. package/dist/index.js +44 -43
  25. package/dist/react.cjs +4 -4
  26. package/dist/react.d.cts +187 -34
  27. package/dist/react.d.ts +187 -34
  28. package/dist/react.js +822 -729
  29. package/dist/speechToText-BV7qxqPF.js +704 -0
  30. package/dist/speechToText-ZciRyyJE.cjs +1 -0
  31. package/dist/testing.cjs +1 -1
  32. package/dist/testing.d.cts +129 -33
  33. package/dist/testing.d.ts +129 -33
  34. package/dist/testing.js +1 -1
  35. package/dist/types-Ck3iZG0K.cjs +10 -0
  36. package/dist/{types-Ct1hlKwg.js → types-fX-VoHfa.js} +1042 -759
  37. package/dist/vue.cjs +1 -1
  38. package/dist/vue.d.cts +143 -35
  39. package/dist/vue.d.ts +143 -35
  40. package/dist/vue.js +133 -131
  41. package/dist/widget.cjs +6 -6
  42. package/dist/widget.d.cts +161 -33
  43. package/dist/widget.d.ts +161 -33
  44. package/dist/widget.js +1702 -1757
  45. package/llms-full.txt +166 -1
  46. package/package.json +1 -1
  47. package/dist/autoContinue-CP9pJR-V.cjs +0 -1
  48. package/dist/createMockClient-BEOXI8yW.cjs +0 -1
  49. package/dist/sheetController-BThJRtOu.cjs +0 -1
  50. package/dist/sheetController-aEKXIvjk.js +0 -343
  51. package/dist/types-mcW8vB1U.cjs +0 -10
package/dist/vue.d.ts CHANGED
@@ -66,6 +66,8 @@ declare class AgoClient {
66
66
  private config;
67
67
  /** Conversations already warned about an empty reply (one warning each). */
68
68
  private warnedEmptyConversations;
69
+ /** Client functions the backend has accepted from a WebMCP call report. */
70
+ private declaredExternally;
69
71
  /** Whether the placeholder-mode page-data warning has already been logged. */
70
72
  private warnedPageDataPlaceholder;
71
73
  /** `readPageData` companions this SDK registered, so cleanup only removes its own. */
@@ -100,7 +102,12 @@ declare class AgoClient {
100
102
  * `null` otherwise.
101
103
  */
102
104
  proactive: ProactiveController | null;
105
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
106
+ private detachWebMCP;
107
+ /** The `listPages` companion is live. */
108
+ private listPagesRegistered;
103
109
  constructor(config: AgoConfig);
110
+ private attachWebMCPBridge;
104
111
  /**
105
112
  * Send a message and receive a streaming response
106
113
  */
@@ -212,6 +219,12 @@ declare class AgoClient {
212
219
  * (the agent decides what to do next). No-op if the invocation is unknown.
213
220
  */
214
221
  rejectFunction(invocationId: string): Promise<void>;
222
+ /* Excluded from this release type: runExternalFunction */
223
+ /**
224
+ * Best-effort analytics for one WebMCP call. No agent: the caller is someone
225
+ * else's agent and cannot be known from `execute`.
226
+ */
227
+ private reportExternalCall;
215
228
  /**
216
229
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
217
230
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -231,11 +244,20 @@ declare class AgoClient {
231
244
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
232
245
  */
233
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>;
234
256
  /**
235
257
  * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
236
258
  * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
237
- * file-attachment flag. The vanilla widget fetches it once, when a ticket
238
- * form first appears in a conversation.
259
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
260
+ * once, when a ticket form first appears in a conversation.
239
261
  */
240
262
  getConfig(): Promise<SdkConfig>;
241
263
  /**
@@ -372,6 +394,9 @@ declare class AgoClient {
372
394
  * Get all registered function schemas
373
395
  */
374
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 */
375
400
  /**
376
401
  * Execute a registered client function locally, through the same
377
402
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -394,14 +419,15 @@ declare class AgoClient {
394
419
  * page of an entity. Flat arguments only: nested object parameters are not
395
420
  * reliably rendered to the model, so placeholders must not be named `page`.
396
421
  *
422
+ * For a large table, `{ catalogue: "onDemand" }` moves the route descriptions
423
+ * into a read-only `listPages` companion, leaving only the page names in the
424
+ * per-message schema. Routes may carry a `section` to group that companion.
425
+ *
397
426
  * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
398
427
  * @param routes - Map of route names to paths, with descriptions for the LLM
428
+ * @param opts - Where the catalogue lives; `"inline"` by default
399
429
  */
400
- registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
401
- name: string;
402
- path: string;
403
- description: string;
404
- }>): void;
430
+ registerNavigationFunction(navigate: (path: string) => void, routes: NavRoute[], opts?: AgoNavigationOptions): void;
405
431
  /**
406
432
  * Unregister the navigation function and its `current-page` context provider.
407
433
  */
@@ -704,6 +730,8 @@ declare interface AgoClientEvents {
704
730
  * call running immediately.
705
731
  */
706
732
  "function:awaiting-approval": ClientFunctionInvocation;
733
+ /** A function was registered or unregistered, or the registry cleared. */
734
+ "functions:changed": ClientFunctionSchema[];
707
735
  "function:result": {
708
736
  invocationId: string;
709
737
  result: unknown;
@@ -776,6 +804,8 @@ export declare interface AgoConfig {
776
804
  defaultAgentId?: string;
777
805
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
778
806
  permission?: string;
807
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
808
+ language?: string | null;
779
809
  /** User email for identification */
780
810
  userEmail?: string;
781
811
  /** JWT token for authenticated users */
@@ -853,6 +883,15 @@ export declare interface AgoConfig {
853
883
  * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
854
884
  */
855
885
  errorWatcher?: boolean | ErrorWatcherOptions;
886
+ /** Mirror every registered client function into the browser's WebMCP registry
887
+ * (`document.modelContext`), so an external agent can call the same functions
888
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
889
+ *
890
+ * A mirrored function runs immediately: the approval gate
891
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
892
+ * Use `webmcp: false` on a definition to keep it out.
893
+ */
894
+ webmcp?: boolean;
856
895
  }
857
896
 
858
897
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -883,6 +922,16 @@ export declare interface AgoMessage {
883
922
  createdAt: Date;
884
923
  }
885
924
 
925
+ /**
926
+ * Where the route catalogue lives: `"inline"` (default) in `navigateToPage`'s
927
+ * description, or `"onDemand"` in a `listPages` companion's result.
928
+ */
929
+ export declare type AgoNavigationOptions = {
930
+ catalogue?: "inline";
931
+ } | {
932
+ catalogue: "onDemand";
933
+ };
934
+
886
935
  /**
887
936
  * What the page currently displays, returned to the agent as the *result* of
888
937
  * `setPageState` instead of only as context on the next message.
@@ -1002,10 +1051,12 @@ export declare const AgoPlugin: {
1002
1051
 
1003
1052
  export declare type AgoPluginOptions = AgoConfig;
1004
1053
 
1005
- declare interface AgoRoute {
1054
+ export declare interface AgoRoute {
1006
1055
  name: string;
1007
1056
  path: string;
1008
1057
  description: string;
1058
+ /** Groups this route for `catalogue: "onDemand"`. Unused otherwise. */
1059
+ section?: string;
1009
1060
  }
1010
1061
 
1011
1062
  /**
@@ -1058,6 +1109,11 @@ declare type AgoStateSetResult = {
1058
1109
  result: "unchanged";
1059
1110
  };
1060
1111
 
1112
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1113
+ declare interface AudioTranscription {
1114
+ text: string;
1115
+ }
1116
+
1061
1117
  /** One JavaScript error captured on the page (deduplicated, see `count`). */
1062
1118
  declare interface CapturedError {
1063
1119
  type: CapturedErrorType;
@@ -1097,22 +1153,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
1097
1153
  * client.registerFunction(fn);
1098
1154
  * ```
1099
1155
  */
1100
- declare interface ClientFunctionDefinition {
1156
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1101
1157
  name: string;
1102
1158
  description: string;
1103
1159
  parameters: ClientFunctionSchema["parameters"];
1104
1160
  handler: ClientFunctionHandler;
1105
- /**
1106
- * Max serialized result size in bytes before the SDK truncates it to a
1107
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1108
- * `Infinity` disables the guard for this function.
1109
- */
1110
- maxResultBytes?: number;
1111
- /**
1112
- * Require explicit user approval before this function runs. See
1113
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1114
- */
1115
- requiresApproval?: boolean;
1116
1161
  }
1117
1162
 
1118
1163
  /**
@@ -1131,20 +1176,7 @@ declare interface ClientFunctionInvocation {
1131
1176
  * Schema-plus-settings object accepted when registering a function: the schema
1132
1177
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1133
1178
  */
1134
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1135
- /**
1136
- * Max serialized result size in bytes before the SDK truncates it to a
1137
- * flagged preview. Overrides the client-level default
1138
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1139
- * disables the guard for this function.
1140
- */
1141
- maxResultBytes?: number;
1142
- /**
1143
- * Require explicit user approval before this function runs. See
1144
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1145
- */
1146
- requiresApproval?: boolean;
1147
- };
1179
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1148
1180
 
1149
1181
  /**
1150
1182
  * Schema for a client-side function that AGO can call
@@ -1171,6 +1203,28 @@ declare interface ClientFunctionSchema {
1171
1203
  };
1172
1204
  }
1173
1205
 
1206
+ /** SDK-side function settings that are never sent to the backend. */
1207
+ declare interface ClientFunctionSettings {
1208
+ /**
1209
+ * Max serialized result size in bytes before the SDK truncates it to a
1210
+ * flagged preview. Overrides the client-level default
1211
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1212
+ * disables the guard for this function.
1213
+ */
1214
+ maxResultBytes?: number;
1215
+ /**
1216
+ * Require explicit user approval before this function runs. See
1217
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1218
+ */
1219
+ requiresApproval?: boolean;
1220
+ /**
1221
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1222
+ * `false` keeps this function out of WebMCP while leaving it available to the
1223
+ * in-app agent.
1224
+ */
1225
+ webmcp?: WebMCPToolMeta | false;
1226
+ }
1227
+
1174
1228
  /** See {@link AgoConfig.clientFunctionsMode}. */
1175
1229
  declare type ClientFunctionsMode = "placeholder" | "pause";
1176
1230
 
@@ -1464,6 +1518,15 @@ declare type MessageStatus_2 = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANC
1464
1518
  */
1465
1519
  | "WAITING_CLIENT";
1466
1520
 
1521
+ /** A navigable page. `path` may carry `:param` placeholders. */
1522
+ declare interface NavRoute {
1523
+ name: string;
1524
+ path: string;
1525
+ description: string;
1526
+ /** Only read under `catalogue: "onDemand"`. */
1527
+ section?: string;
1528
+ }
1529
+
1467
1530
  /**
1468
1531
  * Optional action attached to a nudge. Accepting a `functionName` action
1469
1532
  * executes the registered client function (same `FunctionRegistry` path as
@@ -1656,6 +1719,14 @@ declare interface ProactiveTriggerWhen {
1656
1719
  fieldErrors?: Record<string, number>;
1657
1720
  }
1658
1721
 
1722
+ /**
1723
+ * Registered function with handler
1724
+ */
1725
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1726
+ schema: ClientFunctionSchema;
1727
+ handler: ClientFunctionHandler;
1728
+ }
1729
+
1659
1730
  /**
1660
1731
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1661
1732
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1712,6 +1783,8 @@ declare interface SdkPermissionConfig {
1712
1783
  homePage?: SdkHomePageConfig;
1713
1784
  fileAttachmentsEnabled: boolean;
1714
1785
  voiceEnabled: boolean;
1786
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1787
+ speechToTextEnabled: boolean;
1715
1788
  }
1716
1789
 
1717
1790
  /**
@@ -2047,6 +2120,12 @@ declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "
2047
2120
 
2048
2121
  declare type ToolCallType_2 = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2049
2122
 
2123
+ /** Options for `AgoClient.transcribeAudio`. */
2124
+ declare interface TranscribeAudioOptions {
2125
+ /** Cancel the upload or stop waiting for its transcription. */
2126
+ signal?: AbortSignal;
2127
+ }
2128
+
2050
2129
  /**
2051
2130
  * Get or create an AgoClient.
2052
2131
  *
@@ -2095,6 +2174,16 @@ export declare function useAgoFunction(name: string, options: {
2095
2174
  * `Infinity` disables the guard for this function.
2096
2175
  */
2097
2176
  maxResultBytes?: number;
2177
+ /**
2178
+ * Require explicit user approval before this function runs (pause mode
2179
+ * only). See `AgoConfig.approvalPolicy`.
2180
+ */
2181
+ requiresApproval?: boolean;
2182
+ /**
2183
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
2184
+ * `false` keeps this function out of WebMCP.
2185
+ */
2186
+ webmcp?: WebMCPToolMeta | false;
2098
2187
  }): void;
2099
2188
 
2100
2189
  /**
@@ -2108,7 +2197,7 @@ export declare function useAgoFunction(name: string, options: {
2108
2197
  * ]);
2109
2198
  * ```
2110
2199
  */
2111
- export declare function useAgoNavigation(navigate: (path: string) => void, routes: AgoRoute[]): void;
2200
+ export declare function useAgoNavigation(navigate: (path: string) => void, routes: AgoRoute[], opts?: AgoNavigationOptions): void;
2112
2201
 
2113
2202
  /**
2114
2203
  * Register editable page-state controls with auto-cleanup on unmount.
@@ -3029,4 +3118,23 @@ export declare interface UseProactiveNudgeResult {
3029
3118
  dismiss: () => void;
3030
3119
  }
3031
3120
 
3121
+ /** The MCP behavior hints AGO has no equivalent for. */
3122
+ declare interface WebMCPToolMeta {
3123
+ /**
3124
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
3125
+ * function that changes nothing, `untrustedContentHint` one whose result may
3126
+ * carry third-party text.
3127
+ */
3128
+ annotations?: {
3129
+ readOnlyHint?: boolean;
3130
+ untrustedContentHint?: boolean;
3131
+ };
3132
+ /**
3133
+ * This function navigates. The WebMCP call is held open until the function
3134
+ * registry goes quiet, so the caller sees the destination page's tools rather
3135
+ * than the departing page's. Already set on the built-in `navigateToPage`.
3136
+ */
3137
+ navigates?: boolean;
3138
+ }
3139
+
3032
3140
  export { }