@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.
Files changed (48) hide show
  1. package/CHANGELOG.md +71 -4
  2. package/README.md +73 -0
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +97 -28
  5. package/dist/angular.d.ts +97 -28
  6. package/dist/angular.js +4 -1
  7. package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-BfJg0WyA.js} +1 -1
  8. package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-CiOXKWl0.cjs} +1 -1
  9. package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-DN1xjAv5.js} +1 -1
  10. package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-DnQl77Ko.cjs} +1 -1
  11. package/dist/createMockClient-BPt1gSve.cjs +1 -0
  12. package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
  13. package/dist/devtools.cjs +4 -4
  14. package/dist/devtools.d.cts +95 -28
  15. package/dist/devtools.d.ts +95 -28
  16. package/dist/devtools.js +87 -84
  17. package/dist/helpers.d.cts +42 -12
  18. package/dist/helpers.d.ts +42 -12
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +101 -35
  21. package/dist/index.d.ts +101 -35
  22. package/dist/index.js +44 -43
  23. package/dist/react.cjs +4 -4
  24. package/dist/react.d.cts +147 -28
  25. package/dist/react.d.ts +147 -28
  26. package/dist/react.js +814 -727
  27. package/dist/speechToText-BV7qxqPF.js +704 -0
  28. package/dist/speechToText-ZciRyyJE.cjs +1 -0
  29. package/dist/testing.cjs +1 -1
  30. package/dist/testing.d.cts +95 -28
  31. package/dist/testing.d.ts +95 -28
  32. package/dist/testing.js +1 -1
  33. package/dist/{types-Ct1hlKwg.js → types-Q7t1peH-.js} +595 -419
  34. package/dist/types-a7teDBnC.cjs +10 -0
  35. package/dist/vue.cjs +1 -1
  36. package/dist/vue.d.cts +105 -28
  37. package/dist/vue.d.ts +105 -28
  38. package/dist/vue.js +103 -101
  39. package/dist/widget.cjs +6 -6
  40. package/dist/widget.d.cts +127 -28
  41. package/dist/widget.d.ts +127 -28
  42. package/dist/widget.js +1717 -1772
  43. package/llms-full.txt +129 -1
  44. package/package.json +1 -1
  45. package/dist/createMockClient-BEOXI8yW.cjs +0 -1
  46. package/dist/sheetController-BThJRtOu.cjs +0 -1
  47. package/dist/sheetController-aEKXIvjk.js +0 -343
  48. package/dist/types-mcW8vB1U.cjs +0 -10
package/CHANGELOG.md CHANGED
@@ -5,6 +5,72 @@ 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
+ ## [1.13.0] - 2026-09-10
9
+
10
+ ### Added
11
+
12
+ - **Knowledge language from your application.** Set `language: "fr"` on the
13
+ client or `<AgoProvider language={locale}>` to send `Accept-Language` with
14
+ SDK requests. Change it with `client.updateConfig({ language: "de" })`
15
+ without recreating the client. AGO selects available knowledge translations
16
+ and source titles. `null` clears the override; invalid locales are rejected
17
+ before changing the configuration. `createAgo` accepts the same option.
18
+ - **Audio transcription.** Call `client.transcribeAudio(file, { signal })` to
19
+ turn an audio file into editable text. The method uses the SDK's existing
20
+ authentication and supports cancellation. It is also available through the
21
+ Angular service and mock client. `getConfig()` exposes `speechToTextEnabled`
22
+ for each permission, defaulting to `false` on older backends.
23
+ - **Dictation in the chat composer.** Set `speechToText: true` on
24
+ `mountChatWidget`, or use `<ChatWidget speechToText />` in React. When the
25
+ tenant enables transcription, the microphone opens a volume waveform with
26
+ a timer and cancel/confirm controls. Confirming appends the transcript to
27
+ the draft for editing before sending. Recordings stop after two minutes;
28
+ closing the widget or changing conversations releases the microphone and
29
+ cancels pending transcription.
30
+ - **Reusable React dictation controls.** Use `<ChatInput speechToText />` or
31
+ `<SpeechToTextButton onTranscript={setDraft} />` in a custom composer.
32
+ Translate the controls with `SpeechToTextLabels` and
33
+ `DEFAULT_SPEECH_TO_TEXT_LABELS`. The waveform respects reduced motion.
34
+ - **WebMCP bridge (`webmcp` config).** Set `webmcp: true` and every registered
35
+ client function is also registered as a
36
+ [WebMCP](https://github.com/webmachinelearning/webmcp) tool on
37
+ `document.modelContext`, so the tools written for AGO's agent are offered to
38
+ whatever agent the user brings. A tool a page registers on mount is withdrawn
39
+ when that page unmounts. In React it is a prop on `AgoProvider`. Off by
40
+ default, and a no-op in browsers without WebMCP. Calls emit `function:invoke`
41
+ and `function:result` like any other. There is no approval gate on them, and
42
+ cancelling a call does not stop the handler.
43
+ - **`webmcp` on a function definition.** WebMCP-only metadata the AGO schema has
44
+ no room for: `annotations` (`readOnlyHint`, `untrustedContentHint`) and
45
+ `navigates`. `webmcp: false` keeps one function private to your own agent
46
+ while the bridge is on.
47
+ - **`webmcp: { navigates: true }`.** A navigating function's WebMCP call is held
48
+ open until the function registry has been quiet for 150ms (600ms when the
49
+ destination registers nothing, 4s ceiling), so the caller reads the
50
+ destination page's tools instead of the departing page's.
51
+ Already set on the built-in `navigateToPage`, so `registerNavigationFunction`
52
+ and `useAgoNavigation` need no change. Set it yourself on a custom function
53
+ whose handler navigates.
54
+ - **`autoScroll: false` on the chat widget.** `mountChatWidget` follows new
55
+ messages and streamed replies while the reader is at the bottom. Pass
56
+ `autoScroll: false` and the reader keeps their position during a reply:
57
+ sending a message or clicking the jump-to-latest button still moves to the end
58
+ once, and nothing follows after that. Automatic following stays the default.
59
+
60
+ ### Fixed
61
+
62
+ - `getConversation()` and `getMessages()` now preserve knowledge sources,
63
+ including translated titles, when loading conversation history.
64
+ - **`webmcp` and `requiresApproval` are no longer dropped by the framework
65
+ wrappers.** React's `useAgoFunction` dropped `webmcp`, and Vue's dropped both
66
+ `webmcp` and `requiresApproval`, so `webmcp: false` was silently ignored and
67
+ the function was mirrored anyway. An inline `webmcp` object is compared by
68
+ value, so it does not re-register the function on every render.
69
+ - **`functions:changed` event** and `client.onFunctionsChanged(listener)`, fired
70
+ when a function is registered, unregistered, or the registry is cleared. The
71
+ dev panel now repaints its function list from it instead of waiting for a
72
+ manual refresh.
73
+
8
74
  ## [1.12.0] - 2026-09-07
9
75
 
10
76
  ### Added
@@ -59,7 +125,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
59
125
  options set and re-renders when the config lands, and a failed request leaves
60
126
  the options in place. Each part is replaced only when the dashboard has a
61
127
  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
128
+ _widget starter_ (an opening message the agent sends by itself) fires when the
63
129
  panel is first opened, on a fresh visit only, never over a resumed thread.
64
130
  - **`agentId` on `ConversationStarter`.** A starter card can name the agent
65
131
  that answers it. Dashboard starters carry their own.
@@ -69,7 +135,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
69
135
  its `initial_message`; one with neither is dropped. New types
70
136
  `SdkHomePageConfig`, `SdkHomeStarter`, `SdkWidgetStarter`.
71
137
 
72
-
73
138
  ## [1.10.0] - 2026-09-03
74
139
 
75
140
  ### Added
@@ -232,9 +297,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
232
297
  also registers a read-only `readPageData` companion (no parameters, changes
233
298
  nothing, returns `{ data }`) for "what's on screen?" questions; it is removed
234
299
  by `unregisterPageStateFunction`.
300
+
235
301
  - The SDK waits for the work a control change triggered before reading the
236
302
  snapshot. Two ways to tell it when that work is done:
237
- - **`get()` returns a promise** (preferred): awaiting it *is* the completion
303
+ - **`get()` returns a promise** (preferred): awaiting it _is_ the completion
238
304
  signal, so the SDK is exact. `get: () => queryClient.ensureQueryData({...})`
239
305
  shares the single in-flight request with the UI.
240
306
  - **`isLoading` is declared**: the SDK polls it every 50 ms and treats two
@@ -245,6 +311,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
245
311
  Both are capped by `settleTimeoutMs` (10 s by default); a promise that never
246
312
  settles no longer holds the turn open, and a rejected `get()` is reported to
247
313
  the agent as a failed read instead of an empty page.
314
+
248
315
  - Oversized snapshots are truncated **by item**: the first whole items that fit
249
316
  the budget (`data.maxResultBytes`, defaulting to `maxFunctionResultBytes`) plus
250
317
  a `truncation` field carrying `{ truncated, returnedItems, totalItems, hint }`.
@@ -319,7 +386,7 @@ declared in `"placeholder"` mode.
319
386
  second call with identical arguments was swallowed: its result was never
320
387
  submitted, the backend never saw every result, and the paused turn stayed in
321
388
  `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
389
+ apart from a repeat _emission_ of the same call. Zero-argument functions (such
323
390
  as the new `readPageData`) hit this every time.
324
391
  - Vue's `useAgoPageState` no longer drops `requiresApproval` (and now forwards
325
392
  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-a7teDBnC.cjs"),c=require("./autoContinue-CP9pJR-V.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){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=s.FEEDBACK_REASONS;exports.provideAgo=u;
@@ -109,7 +109,10 @@ declare class AgoClient {
109
109
  * `null` otherwise.
110
110
  */
111
111
  proactive: ProactiveController | null;
112
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
113
+ private detachWebMCP;
112
114
  constructor(config: AgoConfig);
115
+ private attachWebMCPBridge;
113
116
  /**
114
117
  * Send a message and receive a streaming response
115
118
  */
@@ -221,6 +224,7 @@ declare class AgoClient {
221
224
  * (the agent decides what to do next). No-op if the invocation is unknown.
222
225
  */
223
226
  rejectFunction(invocationId: string): Promise<void>;
227
+ /* Excluded from this release type: runExternalFunction */
224
228
  /**
225
229
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
226
230
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -240,11 +244,20 @@ declare class AgoClient {
240
244
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
241
245
  */
242
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>;
243
256
  /**
244
257
  * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
245
258
  * 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.
259
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
260
+ * once, when a ticket form first appears in a conversation.
248
261
  */
249
262
  getConfig(): Promise<SdkConfig>;
250
263
  /**
@@ -381,6 +394,9 @@ declare class AgoClient {
381
394
  * Get all registered function schemas
382
395
  */
383
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 */
384
400
  /**
385
401
  * Execute a registered client function locally, through the same
386
402
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -713,6 +729,8 @@ export declare interface AgoClientEvents {
713
729
  * call running immediately.
714
730
  */
715
731
  "function:awaiting-approval": ClientFunctionInvocation;
732
+ /** A function was registered or unregistered, or the registry cleared. */
733
+ "functions:changed": ClientFunctionSchema[];
716
734
  "function:result": {
717
735
  invocationId: string;
718
736
  result: unknown;
@@ -785,6 +803,8 @@ export declare interface AgoConfig {
785
803
  defaultAgentId?: string;
786
804
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
787
805
  permission?: string;
806
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
807
+ language?: string | null;
788
808
  /** User email for identification */
789
809
  userEmail?: string;
790
810
  /** JWT token for authenticated users */
@@ -862,6 +882,15 @@ export declare interface AgoConfig {
862
882
  * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
863
883
  */
864
884
  errorWatcher?: boolean | ErrorWatcherOptions;
885
+ /** Mirror every registered client function into the browser's WebMCP registry
886
+ * (`document.modelContext`), so an external agent can call the same functions
887
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
888
+ *
889
+ * A mirrored function runs immediately: the approval gate
890
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
891
+ * Use `webmcp: false` on a definition to keep it out.
892
+ */
893
+ webmcp?: boolean;
865
894
  }
866
895
 
867
896
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -1048,6 +1077,8 @@ export declare class AgoService {
1048
1077
  private fromEvent;
1049
1078
  /** Send a message and get a streaming response */
1050
1079
  sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
1080
+ /** Transcribe an audio file into an editable draft. */
1081
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
1051
1082
  /**
1052
1083
  * Stop the turn that is generating: closes the stream and tells the backend to
1053
1084
  * stop generating. The partial answer is kept and the message ends as
@@ -1180,6 +1211,11 @@ declare type AgoStateSetResult = {
1180
1211
  result: "unchanged";
1181
1212
  };
1182
1213
 
1214
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1215
+ export declare interface AudioTranscription {
1216
+ text: string;
1217
+ }
1218
+
1183
1219
  /** One JavaScript error captured on the page (deduplicated, see `count`). */
1184
1220
  declare interface CapturedError {
1185
1221
  type: CapturedErrorType;
@@ -1219,22 +1255,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
1219
1255
  * client.registerFunction(fn);
1220
1256
  * ```
1221
1257
  */
1222
- declare interface ClientFunctionDefinition {
1258
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1223
1259
  name: string;
1224
1260
  description: string;
1225
1261
  parameters: ClientFunctionSchema["parameters"];
1226
1262
  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
1263
  }
1239
1264
 
1240
1265
  /**
@@ -1253,20 +1278,7 @@ declare interface ClientFunctionInvocation {
1253
1278
  * Schema-plus-settings object accepted when registering a function: the schema
1254
1279
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1255
1280
  */
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
- };
1281
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1270
1282
 
1271
1283
  /**
1272
1284
  * Schema for a client-side function that AGO can call
@@ -1293,6 +1305,28 @@ declare interface ClientFunctionSchema {
1293
1305
  };
1294
1306
  }
1295
1307
 
1308
+ /** SDK-side function settings that are never sent to the backend. */
1309
+ declare interface ClientFunctionSettings {
1310
+ /**
1311
+ * Max serialized result size in bytes before the SDK truncates it to a
1312
+ * flagged preview. Overrides the client-level default
1313
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1314
+ * 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
+ /**
1323
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1324
+ * `false` keeps this function out of WebMCP while leaving it available to the
1325
+ * in-app agent.
1326
+ */
1327
+ webmcp?: WebMCPToolMeta | false;
1328
+ }
1329
+
1296
1330
  /** See {@link AgoConfig.clientFunctionsMode}. */
1297
1331
  declare type ClientFunctionsMode = "placeholder" | "pause";
1298
1332
 
@@ -1795,6 +1829,14 @@ export declare function provideAgo(options: AgoProvideOptions): {
1795
1829
  useValue: AgoService;
1796
1830
  };
1797
1831
 
1832
+ /**
1833
+ * Registered function with handler
1834
+ */
1835
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1836
+ schema: ClientFunctionSchema;
1837
+ handler: ClientFunctionHandler;
1838
+ }
1839
+
1798
1840
  /**
1799
1841
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1800
1842
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1851,6 +1893,8 @@ declare interface SdkPermissionConfig {
1851
1893
  homePage?: SdkHomePageConfig;
1852
1894
  fileAttachmentsEnabled: boolean;
1853
1895
  voiceEnabled: boolean;
1896
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1897
+ speechToTextEnabled: boolean;
1854
1898
  }
1855
1899
 
1856
1900
  /**
@@ -2163,4 +2207,29 @@ declare interface ToolCallTicketPrefill {
2163
2207
 
2164
2208
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2165
2209
 
2210
+ /** Options for `AgoClient.transcribeAudio`. */
2211
+ export declare interface TranscribeAudioOptions {
2212
+ /** Cancel the upload or stop waiting for its transcription. */
2213
+ signal?: AbortSignal;
2214
+ }
2215
+
2216
+ /** The MCP behavior hints AGO has no equivalent for. */
2217
+ declare interface WebMCPToolMeta {
2218
+ /**
2219
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
2220
+ * function that changes nothing, `untrustedContentHint` one whose result may
2221
+ * carry third-party text.
2222
+ */
2223
+ annotations?: {
2224
+ readOnlyHint?: boolean;
2225
+ untrustedContentHint?: boolean;
2226
+ };
2227
+ /**
2228
+ * This function navigates. The WebMCP call is held open until the function
2229
+ * registry goes quiet, so the caller sees the destination page's tools rather
2230
+ * than the departing page's. Already set on the built-in `navigateToPage`.
2231
+ */
2232
+ navigates?: boolean;
2233
+ }
2234
+
2166
2235
  export { }
package/dist/angular.d.ts CHANGED
@@ -109,7 +109,10 @@ declare class AgoClient {
109
109
  * `null` otherwise.
110
110
  */
111
111
  proactive: ProactiveController | null;
112
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
113
+ private detachWebMCP;
112
114
  constructor(config: AgoConfig);
115
+ private attachWebMCPBridge;
113
116
  /**
114
117
  * Send a message and receive a streaming response
115
118
  */
@@ -221,6 +224,7 @@ declare class AgoClient {
221
224
  * (the agent decides what to do next). No-op if the invocation is unknown.
222
225
  */
223
226
  rejectFunction(invocationId: string): Promise<void>;
227
+ /* Excluded from this release type: runExternalFunction */
224
228
  /**
225
229
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
226
230
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -240,11 +244,20 @@ declare class AgoClient {
240
244
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
241
245
  */
242
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>;
243
256
  /**
244
257
  * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
245
258
  * 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.
259
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
260
+ * once, when a ticket form first appears in a conversation.
248
261
  */
249
262
  getConfig(): Promise<SdkConfig>;
250
263
  /**
@@ -381,6 +394,9 @@ declare class AgoClient {
381
394
  * Get all registered function schemas
382
395
  */
383
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 */
384
400
  /**
385
401
  * Execute a registered client function locally, through the same
386
402
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -713,6 +729,8 @@ export declare interface AgoClientEvents {
713
729
  * call running immediately.
714
730
  */
715
731
  "function:awaiting-approval": ClientFunctionInvocation;
732
+ /** A function was registered or unregistered, or the registry cleared. */
733
+ "functions:changed": ClientFunctionSchema[];
716
734
  "function:result": {
717
735
  invocationId: string;
718
736
  result: unknown;
@@ -785,6 +803,8 @@ export declare interface AgoConfig {
785
803
  defaultAgentId?: string;
786
804
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
787
805
  permission?: string;
806
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
807
+ language?: string | null;
788
808
  /** User email for identification */
789
809
  userEmail?: string;
790
810
  /** JWT token for authenticated users */
@@ -862,6 +882,15 @@ export declare interface AgoConfig {
862
882
  * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
863
883
  */
864
884
  errorWatcher?: boolean | ErrorWatcherOptions;
885
+ /** Mirror every registered client function into the browser's WebMCP registry
886
+ * (`document.modelContext`), so an external agent can call the same functions
887
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
888
+ *
889
+ * A mirrored function runs immediately: the approval gate
890
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
891
+ * Use `webmcp: false` on a definition to keep it out.
892
+ */
893
+ webmcp?: boolean;
865
894
  }
866
895
 
867
896
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -1048,6 +1077,8 @@ export declare class AgoService {
1048
1077
  private fromEvent;
1049
1078
  /** Send a message and get a streaming response */
1050
1079
  sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
1080
+ /** Transcribe an audio file into an editable draft. */
1081
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
1051
1082
  /**
1052
1083
  * Stop the turn that is generating: closes the stream and tells the backend to
1053
1084
  * stop generating. The partial answer is kept and the message ends as
@@ -1180,6 +1211,11 @@ declare type AgoStateSetResult = {
1180
1211
  result: "unchanged";
1181
1212
  };
1182
1213
 
1214
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1215
+ export declare interface AudioTranscription {
1216
+ text: string;
1217
+ }
1218
+
1183
1219
  /** One JavaScript error captured on the page (deduplicated, see `count`). */
1184
1220
  declare interface CapturedError {
1185
1221
  type: CapturedErrorType;
@@ -1219,22 +1255,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
1219
1255
  * client.registerFunction(fn);
1220
1256
  * ```
1221
1257
  */
1222
- declare interface ClientFunctionDefinition {
1258
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1223
1259
  name: string;
1224
1260
  description: string;
1225
1261
  parameters: ClientFunctionSchema["parameters"];
1226
1262
  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
1263
  }
1239
1264
 
1240
1265
  /**
@@ -1253,20 +1278,7 @@ declare interface ClientFunctionInvocation {
1253
1278
  * Schema-plus-settings object accepted when registering a function: the schema
1254
1279
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1255
1280
  */
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
- };
1281
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1270
1282
 
1271
1283
  /**
1272
1284
  * Schema for a client-side function that AGO can call
@@ -1293,6 +1305,28 @@ declare interface ClientFunctionSchema {
1293
1305
  };
1294
1306
  }
1295
1307
 
1308
+ /** SDK-side function settings that are never sent to the backend. */
1309
+ declare interface ClientFunctionSettings {
1310
+ /**
1311
+ * Max serialized result size in bytes before the SDK truncates it to a
1312
+ * flagged preview. Overrides the client-level default
1313
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1314
+ * 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
+ /**
1323
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1324
+ * `false` keeps this function out of WebMCP while leaving it available to the
1325
+ * in-app agent.
1326
+ */
1327
+ webmcp?: WebMCPToolMeta | false;
1328
+ }
1329
+
1296
1330
  /** See {@link AgoConfig.clientFunctionsMode}. */
1297
1331
  declare type ClientFunctionsMode = "placeholder" | "pause";
1298
1332
 
@@ -1795,6 +1829,14 @@ export declare function provideAgo(options: AgoProvideOptions): {
1795
1829
  useValue: AgoService;
1796
1830
  };
1797
1831
 
1832
+ /**
1833
+ * Registered function with handler
1834
+ */
1835
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1836
+ schema: ClientFunctionSchema;
1837
+ handler: ClientFunctionHandler;
1838
+ }
1839
+
1798
1840
  /**
1799
1841
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1800
1842
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1851,6 +1893,8 @@ declare interface SdkPermissionConfig {
1851
1893
  homePage?: SdkHomePageConfig;
1852
1894
  fileAttachmentsEnabled: boolean;
1853
1895
  voiceEnabled: boolean;
1896
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1897
+ speechToTextEnabled: boolean;
1854
1898
  }
1855
1899
 
1856
1900
  /**
@@ -2163,4 +2207,29 @@ declare interface ToolCallTicketPrefill {
2163
2207
 
2164
2208
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2165
2209
 
2210
+ /** Options for `AgoClient.transcribeAudio`. */
2211
+ export declare interface TranscribeAudioOptions {
2212
+ /** Cancel the upload or stop waiting for its transcription. */
2213
+ signal?: AbortSignal;
2214
+ }
2215
+
2216
+ /** The MCP behavior hints AGO has no equivalent for. */
2217
+ declare interface WebMCPToolMeta {
2218
+ /**
2219
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
2220
+ * function that changes nothing, `untrustedContentHint` one whose result may
2221
+ * carry third-party text.
2222
+ */
2223
+ annotations?: {
2224
+ readOnlyHint?: boolean;
2225
+ untrustedContentHint?: boolean;
2226
+ };
2227
+ /**
2228
+ * This function navigates. The WebMCP call is held open until the function
2229
+ * registry goes quiet, so the caller sees the destination page's tools rather
2230
+ * than the departing page's. Already set on the built-in `navigateToPage`.
2231
+ */
2232
+ navigates?: boolean;
2233
+ }
2234
+
2166
2235
  export { }