@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/CHANGELOG.md CHANGED
@@ -5,6 +5,112 @@ All notable changes to `@useago/sdk` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - **`catalogue: "onDemand"` for navigation.** Route descriptions ride in the
13
+ prompt on every message, so a large table costs on every turn. Pass
14
+ `registerNavigationFunction(navigate, routes, { catalogue: "onDemand" })`, or
15
+ the same third argument to `useAgoNavigation`, and they move into a read-only
16
+ `listPages` companion instead. `navigateToPage` keeps the page names as its
17
+ `page` enum, and an unknown page answers with the valid names. On a large
18
+ table this can cut the tool's schema by around 70%.
19
+ - **`section` on a route.** Makes `section` a required argument of `listPages`,
20
+ so the agent asks for one group at a time and no single answer has to carry
21
+ the whole catalogue. Only read under `catalogue: "onDemand"`.
22
+
23
+ Without `catalogue` the generated schema is unchanged.
24
+
25
+ - **WebMCP calls are reported to AGO for analytics.** With `webmcp` on, each call
26
+ an external agent makes through the bridge is sent to AGO, so it shows up in
27
+ the dashboard alongside the calls your AGO agent makes. One request per call,
28
+ carrying the function name, arguments, the handler's result or its failure,
29
+ the duration, and a per-tab id that groups one external agent's run of calls.
30
+ The result is the same value your AGO agent's calls already store, under the
31
+ same `maxResultBytes`. Best-effort: nothing blocks the call, and a failed
32
+ report is not retried. There is no separate switch: turning `webmcp` on also
33
+ turns reporting on.
34
+
35
+ ### Fixed
36
+
37
+ - **`useAgoFunction` no longer re-registers on every render.** `parameters` was
38
+ compared by identity, so a component that re-renders on navigation (anything
39
+ calling react-router's `useNavigate`) unregistered and re-registered its
40
+ function on every route change. Now compared by value, like `webmcp` already
41
+ was.
42
+ - **A WebMCP navigation no longer triggers a continuation on the next turn.**
43
+ `autoContinue` watched `function:invoke` without checking where the call came
44
+ from, and the flag it sets is sticky. An external `navigateToPage` would sit on
45
+ that flag until the user's next message completed, which then fired a hidden
46
+ continuation prompt for something the agent never did.
47
+
48
+ ## [1.13.0] - 2026-09-10
49
+
50
+ ### Added
51
+
52
+ - **Knowledge language from your application.** Set `language: "fr"` on the
53
+ client or `<AgoProvider language={locale}>` to send `Accept-Language` with
54
+ SDK requests. Change it with `client.updateConfig({ language: "de" })`
55
+ without recreating the client. AGO selects available knowledge translations
56
+ and source titles. `null` clears the override; invalid locales are rejected
57
+ before changing the configuration. `createAgo` accepts the same option.
58
+ - **Audio transcription.** Call `client.transcribeAudio(file, { signal })` to
59
+ turn an audio file into editable text. The method uses the SDK's existing
60
+ authentication and supports cancellation. It is also available through the
61
+ Angular service and mock client. `getConfig()` exposes `speechToTextEnabled`
62
+ for each permission, defaulting to `false` on older backends.
63
+ - **Dictation in the chat composer.** Set `speechToText: true` on
64
+ `mountChatWidget`, or use `<ChatWidget speechToText />` in React. When the
65
+ tenant enables transcription, the microphone opens a volume waveform with
66
+ a timer and cancel/confirm controls. Confirming appends the transcript to
67
+ the draft for editing before sending. Recordings stop after two minutes;
68
+ closing the widget or changing conversations releases the microphone and
69
+ cancels pending transcription.
70
+ - **Reusable React dictation controls.** Use `<ChatInput speechToText />` or
71
+ `<SpeechToTextButton onTranscript={setDraft} />` in a custom composer.
72
+ Translate the controls with `SpeechToTextLabels` and
73
+ `DEFAULT_SPEECH_TO_TEXT_LABELS`. The waveform respects reduced motion.
74
+ - **WebMCP bridge (`webmcp` config).** Set `webmcp: true` and every registered
75
+ client function is also registered as a
76
+ [WebMCP](https://github.com/webmachinelearning/webmcp) tool on
77
+ `document.modelContext`, so the tools written for AGO's agent are offered to
78
+ whatever agent the user brings. A tool a page registers on mount is withdrawn
79
+ when that page unmounts. In React it is a prop on `AgoProvider`. Off by
80
+ default, and a no-op in browsers without WebMCP. Calls emit `function:invoke`
81
+ and `function:result` like any other. There is no approval gate on them, and
82
+ cancelling a call does not stop the handler.
83
+ - **`webmcp` on a function definition.** WebMCP-only metadata the AGO schema has
84
+ no room for: `annotations` (`readOnlyHint`, `untrustedContentHint`) and
85
+ `navigates`. `webmcp: false` keeps one function private to your own agent
86
+ while the bridge is on.
87
+ - **`webmcp: { navigates: true }`.** A navigating function's WebMCP call is held
88
+ open until the function registry has been quiet for 150ms (600ms when the
89
+ destination registers nothing, 4s ceiling), so the caller reads the
90
+ destination page's tools instead of the departing page's.
91
+ Already set on the built-in `navigateToPage`, so `registerNavigationFunction`
92
+ and `useAgoNavigation` need no change. Set it yourself on a custom function
93
+ whose handler navigates.
94
+ - **`autoScroll: false` on the chat widget.** `mountChatWidget` follows new
95
+ messages and streamed replies while the reader is at the bottom. Pass
96
+ `autoScroll: false` and the reader keeps their position during a reply:
97
+ sending a message or clicking the jump-to-latest button still moves to the end
98
+ once, and nothing follows after that. Automatic following stays the default.
99
+
100
+ ### Fixed
101
+
102
+ - `getConversation()` and `getMessages()` now preserve knowledge sources,
103
+ including translated titles, when loading conversation history.
104
+ - **`webmcp` and `requiresApproval` are no longer dropped by the framework
105
+ wrappers.** React's `useAgoFunction` dropped `webmcp`, and Vue's dropped both
106
+ `webmcp` and `requiresApproval`, so `webmcp: false` was silently ignored and
107
+ the function was mirrored anyway. An inline `webmcp` object is compared by
108
+ value, so it does not re-register the function on every render.
109
+ - **`functions:changed` event** and `client.onFunctionsChanged(listener)`, fired
110
+ when a function is registered, unregistered, or the registry is cleared. The
111
+ dev panel now repaints its function list from it instead of waiting for a
112
+ manual refresh.
113
+
8
114
  ## [1.12.0] - 2026-09-07
9
115
 
10
116
  ### Added
@@ -59,7 +165,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
59
165
  options set and re-renders when the config lands, and a failed request leaves
60
166
  the options in place. Each part is replaced only when the dashboard has a
61
167
  value for it, and the header keeps the `title` option. The dashboard's
62
- *widget starter* (an opening message the agent sends by itself) fires when the
168
+ _widget starter_ (an opening message the agent sends by itself) fires when the
63
169
  panel is first opened, on a fresh visit only, never over a resumed thread.
64
170
  - **`agentId` on `ConversationStarter`.** A starter card can name the agent
65
171
  that answers it. Dashboard starters carry their own.
@@ -69,7 +175,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
69
175
  its `initial_message`; one with neither is dropped. New types
70
176
  `SdkHomePageConfig`, `SdkHomeStarter`, `SdkWidgetStarter`.
71
177
 
72
-
73
178
  ## [1.10.0] - 2026-09-03
74
179
 
75
180
  ### Added
@@ -232,9 +337,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
232
337
  also registers a read-only `readPageData` companion (no parameters, changes
233
338
  nothing, returns `{ data }`) for "what's on screen?" questions; it is removed
234
339
  by `unregisterPageStateFunction`.
340
+
235
341
  - The SDK waits for the work a control change triggered before reading the
236
342
  snapshot. Two ways to tell it when that work is done:
237
- - **`get()` returns a promise** (preferred): awaiting it *is* the completion
343
+ - **`get()` returns a promise** (preferred): awaiting it _is_ the completion
238
344
  signal, so the SDK is exact. `get: () => queryClient.ensureQueryData({...})`
239
345
  shares the single in-flight request with the UI.
240
346
  - **`isLoading` is declared**: the SDK polls it every 50 ms and treats two
@@ -245,6 +351,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
245
351
  Both are capped by `settleTimeoutMs` (10 s by default); a promise that never
246
352
  settles no longer holds the turn open, and a rejected `get()` is reported to
247
353
  the agent as a failed read instead of an empty page.
354
+
248
355
  - Oversized snapshots are truncated **by item**: the first whole items that fit
249
356
  the budget (`data.maxResultBytes`, defaulting to `maxFunctionResultBytes`) plus
250
357
  a `truncation` field carrying `{ truncated, returnedItems, totalItems, hint }`.
@@ -319,7 +426,7 @@ declared in `"placeholder"` mode.
319
426
  second call with identical arguments was swallowed: its result was never
320
427
  submitted, the backend never saw every result, and the paused turn stayed in
321
428
  `WAITING_CLIENT` forever. It now uses the invocation id to tell a repeat call
322
- apart from a repeat *emission* of the same call. Zero-argument functions (such
429
+ apart from a repeat _emission_ of the same call. Zero-argument functions (such
323
430
  as the new `readPageData`) hit this every time.
324
431
  - Vue's `useAgoPageState` no longer drops `requiresApproval` (and now forwards
325
432
  every option, matching React and Angular).
package/README.md CHANGED
@@ -232,6 +232,25 @@ Whenever the agent calls the tool, the SDK runs your handler in the browser
232
232
  with the generated arguments and sends its return value back to the agent. Keep
233
233
  the return value small and structured so the agent can use it reliably.
234
234
 
235
+ ## Share the same tools with the user's own browser agent
236
+
237
+ [WebMCP](https://github.com/webmachinelearning/webmcp) lets a page hand tools to
238
+ whatever agent the user brings, such as an agentic browser or an extension. Set
239
+ `webmcp` and every function you register is offered there too:
240
+
241
+ ```tsx
242
+ <AgoProvider baseUrl="https://api.example.com" agent="support-agent" webmcp>
243
+ <ChatWidget />
244
+ </AgoProvider>
245
+ ```
246
+
247
+ Off by default, and a no-op where the browser has no WebMCP. A mirrored function
248
+ runs as soon as the external agent calls it, with no approval gate, so set
249
+ `webmcp: false` on anything that must not run unattended. Navigation is handled:
250
+ a call that changes page resolves only once the destination has registered its
251
+ own tools. See
252
+ [functions and context](docs/general/functions-and-context.md#webmcp-bridge-share-your-functions-with-browser-agents).
253
+
235
254
  ## Let the user stop a long answer
236
255
 
237
256
  `<ChatWidget>` already does this: while the agent answers, its send button turns
@@ -304,6 +323,60 @@ React and Vue have a `useFeedback()` hook/composable; React also exports the
304
323
  `<MessageFeedback messageId={...} />` row for a custom message list. Details in
305
324
  [Feedback](docs/general/widget.md#feedback).
306
325
 
326
+ ## Choose the knowledge language
327
+
328
+ ```ts
329
+ ago.updateConfig({ language: "fr" });
330
+ const conversation = await ago.getConversation(conversationId);
331
+ const sources = conversation.messages?.flatMap((message) => message.sources ?? []);
332
+ ```
333
+
334
+ Pass your app's locale as `language` when creating the client, or update it when
335
+ the visitor changes languages. The API uses `Accept-Language` to select existing
336
+ knowledge translations. Reloading a conversation refreshes its source titles.
337
+ In React, pass `language={i18n.language}` to `AgoProvider`.
338
+ See [Language](docs/general/configuration.md#language) for regional tags and
339
+ fallback behavior.
340
+
341
+ ## Transcribe audio into a draft
342
+
343
+ ```ts
344
+ const { text } = await ago.transcribeAudio(audioFile);
345
+ messageInput.value = text; // The user can edit it before sending.
346
+ ```
347
+
348
+ Pass an audio `File` (up to 25 MB). Check `speechToTextEnabled` in the
349
+ permissions returned by `ago.getConfig()` before showing a recording control.
350
+ Supports cancellation with `{ signal }` and works through the client in every
351
+ framework, including `AgoService.transcribeAudio` in Angular.
352
+ See [Speech to text](docs/general/core.md#speech-to-text) for recording blobs,
353
+ supported formats and error handling.
354
+
355
+ For the complete dictation UI in the floating chat widget:
356
+
357
+ ```ts
358
+ mountChatWidget(document.body, {
359
+ config: { baseUrl: "https://playground.api.useago.com" },
360
+ placement: "bubble",
361
+ speechToText: true,
362
+ });
363
+ ```
364
+
365
+ Use your tenant's API domain with speech to text enabled. The microphone appears
366
+ when the tenant allows it and the browser supports recording. While recording,
367
+ the editor becomes a waveform that follows the microphone volume, with a timer
368
+ and cancel/confirm controls. A spinner appears during transcription; the text
369
+ then returns to the editable draft.
370
+
371
+ The same UI ships in React:
372
+
373
+ ```tsx
374
+ <ChatWidget speechToText />
375
+ ```
376
+
377
+ For a custom React composer, use `SpeechToTextButton` with an `onTranscript`
378
+ callback. See [Dictation](docs/frameworks/react.md#dictation) for examples.
379
+
307
380
  ## Let the agent see what broke
308
381
 
309
382
  "The button does nothing" is easier to answer with the exception in hand. Turn
package/dist/angular.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./types-mcW8vB1U.cjs"),c=require("./autoContinue-CP9pJR-V.cjs");var n=class{constructor(t){this.client=new r.AgoClient(t),this.messages$=this.fromEvent("message:complete"),this.chunks$=this.fromEvent("message:chunk"),this.errors$=this.fromEvent("message:error"),this.messageStart$=this.fromEvent("message:start")}fromEvent(t){const e=this.client;return{subscribe(i){const s=o=>{i.next?.(o)};return e.on(t,s),{unsubscribe:()=>e.off(t,s)}}}}sendMessage(t,e){return this.client.sendMessage(t,e)}stop(){return this.client.stop()}stopMessage(t){return this.client.stopMessage(t)}isGenerating(){return this.client.isGenerating()}getConversations(){return this.client.getConversations().then(t=>t.data)}getConversation(t){return this.client.getConversation(t)}getMessages(t){return this.client.getMessages(t)}submitToolCallForm(t,e){return this.client.submitToolCallForm(t,e)}confirmToolCall(t){return this.client.confirmToolCall(t)}rejectToolCall(t){return this.client.rejectToolCall(t)}submitFeedback(t,e,i){return this.client.submitFeedback(t,e,i)}submitConversationFeedback(t,e,i){return this.client.submitConversationFeedback(t,e,i)}registerFunction(t,e,i){typeof t=="object"?this.client.registerFunction(t):this.client.registerFunction(t,e,i)}unregisterFunction(t){return this.client.unregisterFunction(t)}registerNavigationFunction(t,e){this.client.registerNavigationFunction(t,e)}unregisterNavigationFunction(){this.client.unregisterNavigationFunction()}enableAutoContinueAfterNavigation(t){return c.attachAutoContinueAfterNavigation(this.client,t)}registerPageStateFunction(t,e){this.client.registerPageStateFunction(t,e)}unregisterPageStateFunction(t){this.client.unregisterPageStateFunction(t)}on(t,e){this.client.on(t,e)}off(t,e){this.client.off(t,e)}updateConfig(t){this.client.updateConfig(t)}getClient(){return this.client}destroy(){this.client.destroy()}};function u(t){return{provide:n,useValue:new n(t)}}exports.AgoService=n;exports.FEEDBACK_REASONS=r.FEEDBACK_REASONS;exports.provideAgo=u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./types-Ck3iZG0K.cjs"),a=require("./autoContinue-C3UsCvT5.cjs");var n=class{constructor(t){this.client=new s.AgoClient(t),this.messages$=this.fromEvent("message:complete"),this.chunks$=this.fromEvent("message:chunk"),this.errors$=this.fromEvent("message:error"),this.messageStart$=this.fromEvent("message:start")}fromEvent(t){const e=this.client;return{subscribe(i){const r=o=>{i.next?.(o)};return e.on(t,r),{unsubscribe:()=>e.off(t,r)}}}}sendMessage(t,e){return this.client.sendMessage(t,e)}transcribeAudio(t,e){return this.client.transcribeAudio(t,e)}stop(){return this.client.stop()}stopMessage(t){return this.client.stopMessage(t)}isGenerating(){return this.client.isGenerating()}getConversations(){return this.client.getConversations().then(t=>t.data)}getConversation(t){return this.client.getConversation(t)}getMessages(t){return this.client.getMessages(t)}submitToolCallForm(t,e){return this.client.submitToolCallForm(t,e)}confirmToolCall(t){return this.client.confirmToolCall(t)}rejectToolCall(t){return this.client.rejectToolCall(t)}submitFeedback(t,e,i){return this.client.submitFeedback(t,e,i)}submitConversationFeedback(t,e,i){return this.client.submitConversationFeedback(t,e,i)}registerFunction(t,e,i){typeof t=="object"?this.client.registerFunction(t):this.client.registerFunction(t,e,i)}unregisterFunction(t){return this.client.unregisterFunction(t)}registerNavigationFunction(t,e,i){this.client.registerNavigationFunction(t,e,{catalogue:i?.catalogue==="onDemand"?"onDemand":"inline"})}unregisterNavigationFunction(){this.client.unregisterNavigationFunction()}enableAutoContinueAfterNavigation(t){return a.attachAutoContinueAfterNavigation(this.client,t)}registerPageStateFunction(t,e){this.client.registerPageStateFunction(t,e)}unregisterPageStateFunction(t){this.client.unregisterPageStateFunction(t)}on(t,e){this.client.on(t,e)}off(t,e){this.client.off(t,e)}updateConfig(t){this.client.updateConfig(t)}getClient(){return this.client}destroy(){this.client.destroy()}};function c(t){return{provide:n,useValue:new n(t)}}exports.AgoService=n;exports.FEEDBACK_REASONS=s.FEEDBACK_REASONS;exports.provideAgo=c;
@@ -75,6 +75,8 @@ declare class AgoClient {
75
75
  private config;
76
76
  /** Conversations already warned about an empty reply (one warning each). */
77
77
  private warnedEmptyConversations;
78
+ /** Client functions the backend has accepted from a WebMCP call report. */
79
+ private declaredExternally;
78
80
  /** Whether the placeholder-mode page-data warning has already been logged. */
79
81
  private warnedPageDataPlaceholder;
80
82
  /** `readPageData` companions this SDK registered, so cleanup only removes its own. */
@@ -109,7 +111,12 @@ declare class AgoClient {
109
111
  * `null` otherwise.
110
112
  */
111
113
  proactive: ProactiveController | null;
114
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
115
+ private detachWebMCP;
116
+ /** The `listPages` companion is live. */
117
+ private listPagesRegistered;
112
118
  constructor(config: AgoConfig);
119
+ private attachWebMCPBridge;
113
120
  /**
114
121
  * Send a message and receive a streaming response
115
122
  */
@@ -221,6 +228,12 @@ declare class AgoClient {
221
228
  * (the agent decides what to do next). No-op if the invocation is unknown.
222
229
  */
223
230
  rejectFunction(invocationId: string): Promise<void>;
231
+ /* Excluded from this release type: runExternalFunction */
232
+ /**
233
+ * Best-effort analytics for one WebMCP call. No agent: the caller is someone
234
+ * else's agent and cannot be known from `execute`.
235
+ */
236
+ private reportExternalCall;
224
237
  /**
225
238
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
226
239
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -240,11 +253,20 @@ declare class AgoClient {
240
253
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
241
254
  */
242
255
  private static mapPersistedToolCalls;
256
+ /**
257
+ * Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
258
+ * Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
259
+ * MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
260
+ * The filename must include the matching extension. For a MediaRecorder blob,
261
+ * wrap it in a File with the recording's extension and MIME type.
262
+ * Show the returned text as a draft; call `sendMessage` when the user sends it.
263
+ */
264
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
243
265
  /**
244
266
  * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
245
267
  * 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.
268
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
269
+ * once, when a ticket form first appears in a conversation.
248
270
  */
249
271
  getConfig(): Promise<SdkConfig>;
250
272
  /**
@@ -381,6 +403,9 @@ declare class AgoClient {
381
403
  * Get all registered function schemas
382
404
  */
383
405
  getRegisteredFunctions(): ClientFunctionSchema[];
406
+ /** The callback form of `functions:changed`. Returns an unsubscribe. */
407
+ onFunctionsChanged(listener: () => void): () => void;
408
+ /* Excluded from this release type: getFunctionRegistrations */
384
409
  /**
385
410
  * Execute a registered client function locally, through the same
386
411
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -403,14 +428,15 @@ declare class AgoClient {
403
428
  * page of an entity. Flat arguments only: nested object parameters are not
404
429
  * reliably rendered to the model, so placeholders must not be named `page`.
405
430
  *
431
+ * For a large table, `{ catalogue: "onDemand" }` moves the route descriptions
432
+ * into a read-only `listPages` companion, leaving only the page names in the
433
+ * per-message schema. Routes may carry a `section` to group that companion.
434
+ *
406
435
  * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
407
436
  * @param routes - Map of route names to paths, with descriptions for the LLM
437
+ * @param opts - Where the catalogue lives; `"inline"` by default
408
438
  */
409
- registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
410
- name: string;
411
- path: string;
412
- description: string;
413
- }>): void;
439
+ registerNavigationFunction(navigate: (path: string) => void, routes: NavRoute[], opts?: AgoNavigationOptions): void;
414
440
  /**
415
441
  * Unregister the navigation function and its `current-page` context provider.
416
442
  */
@@ -713,6 +739,8 @@ export declare interface AgoClientEvents {
713
739
  * call running immediately.
714
740
  */
715
741
  "function:awaiting-approval": ClientFunctionInvocation;
742
+ /** A function was registered or unregistered, or the registry cleared. */
743
+ "functions:changed": ClientFunctionSchema[];
716
744
  "function:result": {
717
745
  invocationId: string;
718
746
  result: unknown;
@@ -785,6 +813,8 @@ export declare interface AgoConfig {
785
813
  defaultAgentId?: string;
786
814
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
787
815
  permission?: string;
816
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
817
+ language?: string | null;
788
818
  /** User email for identification */
789
819
  userEmail?: string;
790
820
  /** JWT token for authenticated users */
@@ -862,6 +892,15 @@ export declare interface AgoConfig {
862
892
  * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
863
893
  */
864
894
  errorWatcher?: boolean | ErrorWatcherOptions;
895
+ /** Mirror every registered client function into the browser's WebMCP registry
896
+ * (`document.modelContext`), so an external agent can call the same functions
897
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
898
+ *
899
+ * A mirrored function runs immediately: the approval gate
900
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
901
+ * Use `webmcp: false` on a definition to keep it out.
902
+ */
903
+ webmcp?: boolean;
865
904
  }
866
905
 
867
906
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -892,6 +931,16 @@ export declare interface AgoMessage {
892
931
  createdAt: Date;
893
932
  }
894
933
 
934
+ /**
935
+ * Where the route catalogue lives: `"inline"` (default) in `navigateToPage`'s
936
+ * description, or `"onDemand"` in a `listPages` companion's result.
937
+ */
938
+ declare type AgoNavigationOptions = {
939
+ catalogue?: "inline";
940
+ } | {
941
+ catalogue: "onDemand";
942
+ };
943
+
895
944
  /**
896
945
  * What the page currently displays, returned to the agent as the *result* of
897
946
  * `setPageState` instead of only as context on the next message.
@@ -998,6 +1047,14 @@ export declare interface AgoPageStateOptions {
998
1047
 
999
1048
  export declare type AgoProvideOptions = AgoConfig;
1000
1049
 
1050
+ declare interface AgoRoute {
1051
+ name: string;
1052
+ path: string;
1053
+ description: string;
1054
+ /** Groups this route for `catalogue: "onDemand"`. Unused otherwise. */
1055
+ section?: string;
1056
+ }
1057
+
1001
1058
  /**
1002
1059
  * Angular-style service wrapping AgoClient.
1003
1060
  * Provides RxJS-like Observables for streaming events and standard Promise-based methods.
@@ -1048,6 +1105,8 @@ export declare class AgoService {
1048
1105
  private fromEvent;
1049
1106
  /** Send a message and get a streaming response */
1050
1107
  sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
1108
+ /** Transcribe an audio file into an editable draft. */
1109
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
1051
1110
  /**
1052
1111
  * Stop the turn that is generating: closes the stream and tells the backend to
1053
1112
  * stop generating. The partial answer is kept and the message ends as
@@ -1082,11 +1141,7 @@ export declare class AgoService {
1082
1141
  /** Unregister a client-side function */
1083
1142
  unregisterFunction(name: string): boolean;
1084
1143
  /** Register navigation routes */
1085
- registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
1086
- name: string;
1087
- path: string;
1088
- description: string;
1089
- }>): void;
1144
+ registerNavigationFunction(navigate: (path: string) => void, routes: AgoRoute[], opts?: AgoNavigationOptions): void;
1090
1145
  /** Unregister navigation (function + current-page context) */
1091
1146
  unregisterNavigationFunction(): void;
1092
1147
  /**
@@ -1180,6 +1235,11 @@ declare type AgoStateSetResult = {
1180
1235
  result: "unchanged";
1181
1236
  };
1182
1237
 
1238
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1239
+ export declare interface AudioTranscription {
1240
+ text: string;
1241
+ }
1242
+
1183
1243
  /** One JavaScript error captured on the page (deduplicated, see `count`). */
1184
1244
  declare interface CapturedError {
1185
1245
  type: CapturedErrorType;
@@ -1219,22 +1279,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
1219
1279
  * client.registerFunction(fn);
1220
1280
  * ```
1221
1281
  */
1222
- declare interface ClientFunctionDefinition {
1282
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1223
1283
  name: string;
1224
1284
  description: string;
1225
1285
  parameters: ClientFunctionSchema["parameters"];
1226
1286
  handler: ClientFunctionHandler;
1227
- /**
1228
- * Max serialized result size in bytes before the SDK truncates it to a
1229
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1230
- * `Infinity` disables the guard for this function.
1231
- */
1232
- maxResultBytes?: number;
1233
- /**
1234
- * Require explicit user approval before this function runs. See
1235
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1236
- */
1237
- requiresApproval?: boolean;
1238
1287
  }
1239
1288
 
1240
1289
  /**
@@ -1253,20 +1302,7 @@ declare interface ClientFunctionInvocation {
1253
1302
  * Schema-plus-settings object accepted when registering a function: the schema
1254
1303
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1255
1304
  */
1256
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1257
- /**
1258
- * Max serialized result size in bytes before the SDK truncates it to a
1259
- * flagged preview. Overrides the client-level default
1260
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1261
- * disables the guard for this function.
1262
- */
1263
- maxResultBytes?: number;
1264
- /**
1265
- * Require explicit user approval before this function runs. See
1266
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1267
- */
1268
- requiresApproval?: boolean;
1269
- };
1305
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1270
1306
 
1271
1307
  /**
1272
1308
  * Schema for a client-side function that AGO can call
@@ -1293,6 +1329,28 @@ declare interface ClientFunctionSchema {
1293
1329
  };
1294
1330
  }
1295
1331
 
1332
+ /** SDK-side function settings that are never sent to the backend. */
1333
+ declare interface ClientFunctionSettings {
1334
+ /**
1335
+ * Max serialized result size in bytes before the SDK truncates it to a
1336
+ * flagged preview. Overrides the client-level default
1337
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1338
+ * disables the guard for this function.
1339
+ */
1340
+ maxResultBytes?: number;
1341
+ /**
1342
+ * Require explicit user approval before this function runs. See
1343
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1344
+ */
1345
+ requiresApproval?: boolean;
1346
+ /**
1347
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1348
+ * `false` keeps this function out of WebMCP while leaving it available to the
1349
+ * in-app agent.
1350
+ */
1351
+ webmcp?: WebMCPToolMeta | false;
1352
+ }
1353
+
1296
1354
  /** See {@link AgoConfig.clientFunctionsMode}. */
1297
1355
  declare type ClientFunctionsMode = "placeholder" | "pause";
1298
1356
 
@@ -1570,6 +1628,15 @@ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCEL
1570
1628
  */
1571
1629
  | "WAITING_CLIENT";
1572
1630
 
1631
+ /** A navigable page. `path` may carry `:param` placeholders. */
1632
+ declare interface NavRoute {
1633
+ name: string;
1634
+ path: string;
1635
+ description: string;
1636
+ /** Only read under `catalogue: "onDemand"`. */
1637
+ section?: string;
1638
+ }
1639
+
1573
1640
  /**
1574
1641
  * Optional action attached to a nudge. Accepting a `functionName` action
1575
1642
  * executes the registered client function (same `FunctionRegistry` path as
@@ -1795,6 +1862,14 @@ export declare function provideAgo(options: AgoProvideOptions): {
1795
1862
  useValue: AgoService;
1796
1863
  };
1797
1864
 
1865
+ /**
1866
+ * Registered function with handler
1867
+ */
1868
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1869
+ schema: ClientFunctionSchema;
1870
+ handler: ClientFunctionHandler;
1871
+ }
1872
+
1798
1873
  /**
1799
1874
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1800
1875
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1851,6 +1926,8 @@ declare interface SdkPermissionConfig {
1851
1926
  homePage?: SdkHomePageConfig;
1852
1927
  fileAttachmentsEnabled: boolean;
1853
1928
  voiceEnabled: boolean;
1929
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1930
+ speechToTextEnabled: boolean;
1854
1931
  }
1855
1932
 
1856
1933
  /**
@@ -2163,4 +2240,29 @@ declare interface ToolCallTicketPrefill {
2163
2240
 
2164
2241
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2165
2242
 
2243
+ /** Options for `AgoClient.transcribeAudio`. */
2244
+ export declare interface TranscribeAudioOptions {
2245
+ /** Cancel the upload or stop waiting for its transcription. */
2246
+ signal?: AbortSignal;
2247
+ }
2248
+
2249
+ /** The MCP behavior hints AGO has no equivalent for. */
2250
+ declare interface WebMCPToolMeta {
2251
+ /**
2252
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
2253
+ * function that changes nothing, `untrustedContentHint` one whose result may
2254
+ * carry third-party text.
2255
+ */
2256
+ annotations?: {
2257
+ readOnlyHint?: boolean;
2258
+ untrustedContentHint?: boolean;
2259
+ };
2260
+ /**
2261
+ * This function navigates. The WebMCP call is held open until the function
2262
+ * registry goes quiet, so the caller sees the destination page's tools rather
2263
+ * than the departing page's. Already set on the built-in `navigateToPage`.
2264
+ */
2265
+ navigates?: boolean;
2266
+ }
2267
+
2166
2268
  export { }