@useago/sdk 1.9.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +173 -2
- package/README.md +126 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +408 -26
- package/dist/angular.d.ts +408 -26
- package/dist/angular.js +4 -1
- package/dist/{createConversationSession-BaaXBQ5b.js → createConversationSession-BfJg0WyA.js} +1 -1
- package/dist/{createConversationSession-CU0b-t1W.cjs → createConversationSession-CiOXKWl0.cjs} +1 -1
- package/dist/{createFormCollector-Cf7kGhCB.js → createFormCollector-DN1xjAv5.js} +1 -1
- package/dist/{createFormCollector-DfN1xZBy.cjs → createFormCollector-DnQl77Ko.cjs} +1 -1
- package/dist/createMockClient-BPt1gSve.cjs +1 -0
- package/dist/{createMockClient-5YF-ZbVu.js → createMockClient-YoYr3pQr.js} +16 -3
- package/dist/devtools.cjs +4 -4
- package/dist/devtools.d.cts +406 -26
- package/dist/devtools.d.ts +406 -26
- package/dist/devtools.js +87 -84
- package/dist/helpers.d.cts +42 -12
- package/dist/helpers.d.ts +42 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +486 -35
- package/dist/index.d.ts +486 -35
- package/dist/index.js +117 -112
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +458 -26
- package/dist/react.d.ts +458 -26
- package/dist/react.js +816 -727
- package/dist/speechToText-BV7qxqPF.js +704 -0
- package/dist/speechToText-ZciRyyJE.cjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +406 -26
- package/dist/testing.d.ts +406 -26
- package/dist/testing.js +1 -1
- package/dist/types-Q7t1peH-.js +2584 -0
- package/dist/types-a7teDBnC.cjs +10 -0
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +608 -26
- package/dist/vue.d.ts +608 -26
- package/dist/vue.js +103 -101
- package/dist/widget.cjs +6 -4
- package/dist/widget.d.cts +710 -28
- package/dist/widget.d.ts +710 -28
- package/dist/widget.js +3911 -976
- package/llms-full.txt +254 -7
- package/package.json +1 -1
- package/dist/createMockClient-BZbOe-23.cjs +0 -1
- package/dist/sheetController-CBUVOroo.js +0 -205
- package/dist/sheetController-DY-sC13T.cjs +0 -1
- package/dist/types-CPga11Of.js +0 -2068
- package/dist/types-D3YQl1jx.cjs +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,175 @@ 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
|
+
|
|
74
|
+
## [1.12.0] - 2026-09-07
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- **User metadata on messages.** Set `metadata` on the client config (or in
|
|
79
|
+
`window.AGO.metadata`) and the JSON-serializable object rides along with every
|
|
80
|
+
new message, both JSON and multipart uploads. `sendMessage(text, { metadata })`
|
|
81
|
+
replaces the defaults for that message, `null` omits the field, and
|
|
82
|
+
`updateConfig({ metadata })` changes it at runtime. In React, `useAgo`
|
|
83
|
+
re-applies the `metadata` prop without recreating the client. The API stores
|
|
84
|
+
it as widget metadata on the user, where field mappings can pull selected
|
|
85
|
+
values into tickets. It is untrusted browser-supplied context, not a
|
|
86
|
+
credential.
|
|
87
|
+
- **JavaScript errors as agent context.** Set `errorWatcher: true` (or options)
|
|
88
|
+
on the client config and the page's recent JS errors ride along with every
|
|
89
|
+
message as the `errors:recent` context entry: uncaught exceptions with file,
|
|
90
|
+
line and stack, unhandled promise rejections, `console.error` calls (the
|
|
91
|
+
method is wrapped, calls through, and is restored on `destroy()`), and
|
|
92
|
+
errors the app hands over with `client.reportError(error, context?)`.
|
|
93
|
+
Deduplicated with a `count`, capped at 10, pruned after 10 minutes, messages
|
|
94
|
+
and stacks truncated. Options `maxErrors`, `maxAgeMs`, `maxStackChars`,
|
|
95
|
+
`filter`. New client methods `enableErrorWatcher`, `disableErrorWatcher`,
|
|
96
|
+
`reportError`, `getRecentErrors`, `clearErrors`; new event `error:captured`;
|
|
97
|
+
new exports `ErrorWatcher`, `CapturedError`, `ErrorWatcherOptions`. Off by
|
|
98
|
+
default: error messages can carry PII.
|
|
99
|
+
- **`jsErrors` proactive matcher.** Captured errors count as friction on the
|
|
100
|
+
current route (`SignalsSnapshot.jsErrors`, reset on navigation), so a
|
|
101
|
+
trigger can nudge right after a crash with `when: { jsErrors: 1 }`. Needs
|
|
102
|
+
`errorWatcher` on; counts only, the messages stay in `client_context`.
|
|
103
|
+
|
|
104
|
+
### Fixed
|
|
105
|
+
|
|
106
|
+
- Ticket attachments become available when the dashboard form configuration
|
|
107
|
+
finishes loading.
|
|
108
|
+
- Ticket forms now support multiple condition values, nested questions and
|
|
109
|
+
conditional choices across ticketing providers. Changing a branch clears
|
|
110
|
+
answers that no longer apply. Required questions are checked before sending,
|
|
111
|
+
including those not yet revealed.
|
|
112
|
+
- Ticket forms respect option groups and order, fields marked always visible,
|
|
113
|
+
format validation, priority by request type and dashboard success messages
|
|
114
|
+
when the API supplies these settings.
|
|
115
|
+
|
|
116
|
+
## [1.11.0] - 2026-09-04
|
|
117
|
+
|
|
118
|
+
### Added
|
|
119
|
+
|
|
120
|
+
- **`loadHomeConfig` on the bubble widget: the home screen from the AGO
|
|
121
|
+
dashboard.** `mountChatWidget(el, { placement: "bubble", loadHomeConfig: true })`
|
|
122
|
+
takes the home title, the markdown subtitle and the starter cards from
|
|
123
|
+
`GET /config` instead of the options, the way the hosted widget does. One
|
|
124
|
+
request on mount, off the critical path: the panel renders with whatever the
|
|
125
|
+
options set and re-renders when the config lands, and a failed request leaves
|
|
126
|
+
the options in place. Each part is replaced only when the dashboard has a
|
|
127
|
+
value for it, and the header keeps the `title` option. The dashboard's
|
|
128
|
+
_widget starter_ (an opening message the agent sends by itself) fires when the
|
|
129
|
+
panel is first opened, on a fresh visit only, never over a resumed thread.
|
|
130
|
+
- **`agentId` on `ConversationStarter`.** A starter card can name the agent
|
|
131
|
+
that answers it. Dashboard starters carry their own.
|
|
132
|
+
- **`SdkPermissionConfig.homePage`.** `AgoClient.getConfig()` now maps the
|
|
133
|
+
`home_page` block (`title`, `subtitle`, `home_starters`, `widget_starter`)
|
|
134
|
+
when the backend sends one. A starter card shows its `description` and sends
|
|
135
|
+
its `initial_message`; one with neither is dropped. New types
|
|
136
|
+
`SdkHomePageConfig`, `SdkHomeStarter`, `SdkWidgetStarter`.
|
|
137
|
+
|
|
138
|
+
## [1.10.0] - 2026-09-03
|
|
139
|
+
|
|
140
|
+
### Added
|
|
141
|
+
|
|
142
|
+
- **`placement: "bubble"` on `mountChatWidget`.** The hosted embed widget
|
|
143
|
+
without the iframe: a 54px launcher bottom right, a teaser bubble one second
|
|
144
|
+
after mount, and a 550px panel with a home screen (title, markdown
|
|
145
|
+
`subtitle`, `conversationStarters` cards), a conversation screen, and a chat
|
|
146
|
+
history screen with relative times and a "New conversation" pill. Reopens
|
|
147
|
+
the visitor's most recent thread when its last message is under two hours
|
|
148
|
+
old (`autoResume`), goes full screen under 450px, closes on Escape, and
|
|
149
|
+
takes the embed snippet's `colors` (`button`, `header` with gradients,
|
|
150
|
+
`agentMessage`, `background`, `font`, `userMessage`) with the header text
|
|
151
|
+
derived for contrast. New options `prompt`, `icon`, `colors`, `hideFooter`,
|
|
152
|
+
`subtitle`, `conversationStarters`, `autoResume`, `labels`; new handle
|
|
153
|
+
members `screen`, `showScreen`, `openConversation`, `newConversation`. New
|
|
154
|
+
theme tokens `--ago-launcher-background`, `--ago-launcher-text-color`,
|
|
155
|
+
`--ago-send-button-background`, `--ago-user-bubble-background`,
|
|
156
|
+
`--ago-user-bubble-text-color`, `--ago-agent-bubble-text-color`,
|
|
157
|
+
`--ago-panel-width`.
|
|
158
|
+
- **The ticket form renders in the vanilla widget.** The `form` tool call the
|
|
159
|
+
agent's `ago_ticketing` tool opens now shows the tenant's contact form in the
|
|
160
|
+
conversation, on every placement: inline fields from `GET /config`, the
|
|
161
|
+
embedded (HubSpot) variant, the "not allowed" notice, a green success block,
|
|
162
|
+
and the composer replaced by a "complete the form" card, then "ticket
|
|
163
|
+
created" with a New conversation button. New `toolCallForm` option (labels,
|
|
164
|
+
success text, `userEmail`, callbacks).
|
|
165
|
+
- **`AgoClient.getConfig()`, `AgoClient.createTicket()`, and
|
|
166
|
+
`AgoClient.getUserIdentity()`.** `ToolCallData` carries the ticketing fields
|
|
167
|
+
(`displayMode`, `askToTalkToHuman`, `allowedToCreateTicket`, `ticket`,
|
|
168
|
+
`mode`, `ticketFormId`, `embedHtml`, `embedDescription`), streamed and
|
|
169
|
+
persisted alike. New exported types `TicketForm`, `TicketField`,
|
|
170
|
+
`SdkConfig`, `CreateTicketInput`, `CreateTicketResult`.
|
|
171
|
+
|
|
172
|
+
### Changed
|
|
173
|
+
|
|
174
|
+
- Nothing for the existing `inline`, `left`, and `right` placements. The
|
|
175
|
+
`newConversation()` handle method is new on all of them.
|
|
176
|
+
|
|
8
177
|
## [1.9.0] - 2026-08-28
|
|
9
178
|
|
|
10
179
|
### Changed
|
|
@@ -128,9 +297,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
128
297
|
also registers a read-only `readPageData` companion (no parameters, changes
|
|
129
298
|
nothing, returns `{ data }`) for "what's on screen?" questions; it is removed
|
|
130
299
|
by `unregisterPageStateFunction`.
|
|
300
|
+
|
|
131
301
|
- The SDK waits for the work a control change triggered before reading the
|
|
132
302
|
snapshot. Two ways to tell it when that work is done:
|
|
133
|
-
- **`get()` returns a promise** (preferred): awaiting it
|
|
303
|
+
- **`get()` returns a promise** (preferred): awaiting it _is_ the completion
|
|
134
304
|
signal, so the SDK is exact. `get: () => queryClient.ensureQueryData({...})`
|
|
135
305
|
shares the single in-flight request with the UI.
|
|
136
306
|
- **`isLoading` is declared**: the SDK polls it every 50 ms and treats two
|
|
@@ -141,6 +311,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
141
311
|
Both are capped by `settleTimeoutMs` (10 s by default); a promise that never
|
|
142
312
|
settles no longer holds the turn open, and a rejected `get()` is reported to
|
|
143
313
|
the agent as a failed read instead of an empty page.
|
|
314
|
+
|
|
144
315
|
- Oversized snapshots are truncated **by item**: the first whole items that fit
|
|
145
316
|
the budget (`data.maxResultBytes`, defaulting to `maxFunctionResultBytes`) plus
|
|
146
317
|
a `truncation` field carrying `{ truncated, returnedItems, totalItems, hint }`.
|
|
@@ -215,7 +386,7 @@ declared in `"placeholder"` mode.
|
|
|
215
386
|
second call with identical arguments was swallowed: its result was never
|
|
216
387
|
submitted, the backend never saw every result, and the paused turn stayed in
|
|
217
388
|
`WAITING_CLIENT` forever. It now uses the invocation id to tell a repeat call
|
|
218
|
-
apart from a repeat
|
|
389
|
+
apart from a repeat _emission_ of the same call. Zero-argument functions (such
|
|
219
390
|
as the new `readPageData`) hit this every time.
|
|
220
391
|
- Vue's `useAgoPageState` no longer drops `requiresApproval` (and now forwards
|
|
221
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,113 @@ 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
|
+
|
|
380
|
+
## Let the agent see what broke
|
|
381
|
+
|
|
382
|
+
"The button does nothing" is easier to answer with the exception in hand. Turn
|
|
383
|
+
on the error watcher and the page's recent JavaScript errors (uncaught
|
|
384
|
+
exceptions with file, line and stack, unhandled rejections, `console.error`
|
|
385
|
+
calls) ride along with every message, deduplicated and capped.
|
|
386
|
+
|
|
387
|
+
```ts
|
|
388
|
+
const ago = new AgoClient({
|
|
389
|
+
baseUrl: "https://playground.api.useago.com",
|
|
390
|
+
agent: "generic-guide",
|
|
391
|
+
errorWatcher: true, // off by default: error messages can carry PII
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
// Errors you already catch (error boundaries, framework handlers):
|
|
395
|
+
ago.reportError(error, { component: "OrderTable" });
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Same option on `<AgoProvider>`, the Vue plugin, `provideAgo` and
|
|
399
|
+
`mountChatWidget({ config })`. Redact with a `filter`, tune the caps, or use
|
|
400
|
+
`when: { jsErrors: 1 }` in a proactive trigger to nudge right after a crash.
|
|
401
|
+
Details in [JavaScript errors](docs/general/functions-and-context.md#javascript-errors).
|
|
402
|
+
|
|
403
|
+
## Drop the chat bubble on any page
|
|
404
|
+
|
|
405
|
+
The hosted embed widget, without the iframe: a launcher in the corner, a teaser
|
|
406
|
+
bubble, and a panel with a home screen, the conversation, and the chat history.
|
|
407
|
+
It reopens the visitor's last thread for two hours and goes full screen on a
|
|
408
|
+
phone.
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
import { mountChatWidget } from "@useago/sdk/widget";
|
|
412
|
+
|
|
413
|
+
mountChatWidget(document.body, {
|
|
414
|
+
config: { baseUrl: "https://playground.api.useago.com", agent: "generic-guide" },
|
|
415
|
+
placement: "bubble",
|
|
416
|
+
title: "Ask AGO",
|
|
417
|
+
conversationStarters: [{ label: "What can the SDK do?" }],
|
|
418
|
+
colors: { button: "#007bff", header: "#03182f" },
|
|
419
|
+
});
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
Add `loadHomeConfig: true` and the home title, subtitle and starter cards come
|
|
423
|
+
from your AGO dashboard instead of the options above.
|
|
424
|
+
|
|
425
|
+
When the visitor asks for a human, the agent's ticket form renders inside the
|
|
426
|
+
conversation on every placement, with the fields from your AGO dashboard.
|
|
427
|
+
Conditional questions and choices work across ticketing providers; changing an
|
|
428
|
+
answer clears responses that no longer apply. The API must include the form
|
|
429
|
+
metadata described in the ticket form guide.
|
|
430
|
+
Details in [Floating bubble](docs/general/widget.md#floating-bubble-placement-bubble)
|
|
431
|
+
and [Ticket form](docs/general/widget.md#ticket-form-the-form-tool-call).
|
|
432
|
+
|
|
307
433
|
## Show the source docs the agent retrieved
|
|
308
434
|
|
|
309
435
|
Each assistant message carries the knowledge sources it used in `m.sources`
|
package/dist/angular.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|