@talk2view/sdk 0.21.3 → 0.22.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 (53) hide show
  1. package/README.md +137 -50
  2. package/dist/assistant-ui/index.d.ts.map +1 -1
  3. package/dist/assistant-ui/index.js +12 -7
  4. package/dist/assistant-ui/index.js.map +1 -1
  5. package/dist/auth.d.ts +23 -4
  6. package/dist/auth.d.ts.map +1 -1
  7. package/dist/auth.js +48 -22
  8. package/dist/auth.js.map +1 -1
  9. package/dist/chat/lib/use-conversations.d.ts.map +1 -1
  10. package/dist/chat/lib/use-conversations.js +23 -6
  11. package/dist/chat/lib/use-conversations.js.map +1 -1
  12. package/dist/chat/provider.d.ts +20 -2
  13. package/dist/chat/provider.d.ts.map +1 -1
  14. package/dist/chat/provider.js +3 -1
  15. package/dist/chat/provider.js.map +1 -1
  16. package/dist/chat/views/account.d.ts.map +1 -1
  17. package/dist/chat/views/account.js +22 -9
  18. package/dist/chat/views/account.js.map +1 -1
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +15 -5
  21. package/dist/client.js.map +1 -1
  22. package/dist/errors.d.ts +32 -5
  23. package/dist/errors.d.ts.map +1 -1
  24. package/dist/errors.js +42 -10
  25. package/dist/errors.js.map +1 -1
  26. package/dist/index.d.ts +31 -9
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +64 -10
  29. package/dist/index.js.map +1 -1
  30. package/dist/sessions.d.ts.map +1 -1
  31. package/dist/sessions.js +1 -0
  32. package/dist/sessions.js.map +1 -1
  33. package/dist/storage.d.ts +6 -0
  34. package/dist/storage.d.ts.map +1 -1
  35. package/dist/storage.js +6 -0
  36. package/dist/storage.js.map +1 -1
  37. package/dist/tools.d.ts +2 -1
  38. package/dist/tools.d.ts.map +1 -1
  39. package/dist/tools.js +23 -10
  40. package/dist/tools.js.map +1 -1
  41. package/dist/types.d.ts +10 -1
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/ui/components/ChatPanel.d.ts +5 -1
  44. package/dist/ui/components/ChatPanel.d.ts.map +1 -1
  45. package/dist/ui/components/ChatPanel.js +5 -1
  46. package/dist/ui/components/ChatPanel.js.map +1 -1
  47. package/dist/version.d.ts +9 -0
  48. package/dist/version.d.ts.map +1 -0
  49. package/dist/version.js +9 -0
  50. package/dist/version.js.map +1 -0
  51. package/docs/chat.md +86 -15
  52. package/docs/voice.md +18 -8
  53. package/package.json +7 -7
package/docs/chat.md CHANGED
@@ -13,6 +13,14 @@ import '@talk2view/sdk/chat.css';
13
13
  A runnable version of everything below, in a Vite app with no Tailwind, is in
14
14
  [`examples/react-chat`](../examples/react-chat).
15
15
 
16
+ Talk2View is not a medical device and is not for diagnosis or treatment. Do not
17
+ let the chat carry protected health information (PHI) or any other data that
18
+ can identify a patient: what end-users type, attach or say, and what your tools
19
+ return, goes to third-party AI providers, and Talk2View has no safeguard that
20
+ detects, redacts or blocks it. The
21
+ [Terms of Use](https://talk2view.com/legal/terms-of-use) and the
22
+ [Privacy Policy](https://talk2view.com/legal/privacy-policy) say this in full.
23
+
16
24
  ---
17
25
 
18
26
  ## Contents
@@ -55,14 +63,31 @@ half-typed message.
55
63
 
56
64
  The views are Account, Skills, Settings and Chats.
57
65
 
66
+ **Account** signs the end-user in to their Talk2View account, or creates one,
67
+ with email and password, or with Apple or Google where those are available.
68
+ Both forms carry a consent line under the heading, above every way in: "By
69
+ continuing, you agree to Talk2View’s Terms of Use and Privacy Policy." The two
70
+ links open in a new tab. `termsUrl` and `privacyUrl` change where they point,
71
+ for another copy of Talk2View's own documents such as a translation. The
72
+ wording stays the same, because the accounts are Talk2View's: never point them
73
+ at your own terms, which belong in `footer`. Someone already signed in does not
74
+ see it.
75
+
76
+ **Chats** lists the end-user's earlier conversations. They are kept in the
77
+ browser, not in the account — see
78
+ [Conversations are kept in this browser](#conversations-are-kept-in-this-browser).
79
+
58
80
  **Skills** is the end-user's own knowledge: markdown they write once — a
59
81
  protocol, a house style, the way their team names things — that the agent can
60
- load when it helps. They are kept on that device and sent with that person's
61
- chats, where they merge with the partner's and the built-in skills and win over
62
- both. A skill can be switched off without deleting it, and a `.md` file can be
63
- imported, taking its `name` and `description` from frontmatter when it has any.
64
- Turn the view off with `features={{ skills: false }}`; the underlying
65
- `client.skills` API stays available either way.
82
+ load when it helps. They are kept in the browser, not in the account, and sent
83
+ with the chats made from it, where they merge with the partner's and the
84
+ built-in skills and win over both. They belong to the browser rather than to
85
+ anyone in it: signing out leaves them, and on a shared browser whoever signs in
86
+ next sees them in Skills and sends them with their own chats. A skill can be
87
+ switched off without deleting it, and a `.md` file can be imported, taking its
88
+ `name` and `description` from frontmatter when it has any. Turn the view off
89
+ with `features={{ skills: false }}`; the underlying `client.skills` API stays
90
+ available either way.
66
91
 
67
92
  ### `<Talk2ViewChatLauncher>`
68
93
 
@@ -108,10 +133,12 @@ take directly.
108
133
  | `tools` | none | Your client tools. They run in your app. |
109
134
  | `systemPrompt` | none | Your own instructions, sent with every message. Changing it does not restart the conversation. |
110
135
  | `welcome` | `{}` | `heading` and `suggestions` on the empty chat. Clicking a suggestion sends it. |
111
- | `allowAnonymous` | `true` | Logged-out visitors chat as guests. `false` shows sign-in first — **and see the note below**. |
136
+ | `allowAnonymous` | `true` | Logged-out visitors chat as guests where your key allows it. `false` shows sign-in first — **see the [notes below](#guest-sessions-need-guest-access-on-your-key)**. |
112
137
  | `features` | all on | `{ dictation, attachments, settings, account, threadList, skills, voice }`. `voice` is the realtime voice button beside the launcher, shown only for partners with voice enabled — see [voice.md](voice.md). |
113
138
  | `fontFamily` | inherit | Your own font stack. Default: whatever the page uses. |
114
139
  | `resetPasswordUrl` | none | Where "Forgot it?" goes. Without it the link is not shown. |
140
+ | `termsUrl` | `'https://talk2view.com/legal/terms-of-use'` | Where the consent line's "Terms of Use" link goes: Talk2View's own terms, or another copy of them. Not yours — the line names Talk2View's, and yours go in `footer`. An empty string means the default. |
141
+ | `privacyUrl` | `'https://talk2view.com/legal/privacy-policy'` | Where the consent line's "Privacy Policy" link goes: Talk2View's own policy, or another copy of it. An empty string means the default. |
115
142
  | `footer` | none | A short line under the composer — your terms, a disclaimer. |
116
143
  | `describeToolActivity` | none | `(name, args) => string \| null`. What a running tool is doing, in your words. |
117
144
  | `isToolDestructive` | none | `(name, args) => boolean`. Warn before this call. |
@@ -135,10 +162,21 @@ Launcher only:
135
162
  These are the things that surprise people. None of them is a bug; all of them
136
163
  have cost someone an afternoon.
137
164
 
165
+ ### Guest sessions need guest access on your key
166
+
167
+ `allowAnonymous` lets the chat try; the engine decides. It starts a guest
168
+ session only for a partner key with guest access switched on. That is off by
169
+ default: switch it on under **Settings → Anonymous access** in the dashboard.
170
+ Guest sign-in also needs a CAPTCHA check by default, and the chat sends none,
171
+ so ask Talk2View to set your key up for guests as well. Talk2View sets the
172
+ daily limit on new guests. When the engine refuses, or when a guest's allowance
173
+ or your daily guest limit runs out, the chat opens Account and asks the visitor
174
+ to sign in.
175
+
138
176
  ### `allowAnonymous: false` also stops guest sessions
139
177
 
140
178
  It is not only a screen. The gate is computed from whether anyone is signed in,
141
- and the client starts a guest session on demand — listing the models for
179
+ and the client tries to start a guest session on demand — listing the models for
142
180
  Settings would be enough — which would sign the visitor in and open the gate
143
181
  from behind. So `allowAnonymous: false` also turns off `anonymousAutoStart`.
144
182
 
@@ -149,6 +187,30 @@ to), pass both explicitly:
149
187
  <Talk2ViewChat partnerKey="…" allowAnonymous={false} anonymousAutoStart />
150
188
  ```
151
189
 
190
+ ### Conversations are kept in this browser
191
+
192
+ With the thread list on (`features.threadList`, the default), the conversations
193
+ in Chats are saved in the browser's `localStorage`: one entry per partner key
194
+ (`t2v_chat_conversations_v1:<partner key>`), divided by end-user, so each
195
+ account and each guest sees only their own. The engine has no API to list or
196
+ fetch a past conversation, so they do not follow anyone to another browser,
197
+ another device or another app. For each partner key the browser keeps up to 50
198
+ conversations per end-user, fewer if they are long, for the eight end-users —
199
+ guests included — who used it most recently.
200
+
201
+ The conversation on screen goes when its account signs out, when that session
202
+ ends, or when another account signs in. Signing out does not delete the saved
203
+ ones: they stay in the browser and are listed again when the same account signs
204
+ back in there. Only a conversation that a guest, or a visitor before any
205
+ session, started on the page carries on into the account they then sign in to —
206
+ never one from another account, and never past a sign-out.
207
+
208
+ With the thread list off, nothing is saved: the conversation lives in memory,
209
+ is lost on reload, and goes on the same sign-outs and account changes. When it
210
+ goes because an account's session ended on its own — the sign-in expired, or
211
+ the account signed out in another tab — the chat says "Session expired. Please
212
+ log in again."
213
+
152
214
  ### A page with no font gets a serif chat
153
215
 
154
216
  `--t2v-font` is `inherit`. That is the design: the chat looks like part of your
@@ -160,8 +222,8 @@ font on `body`, or pass one:
160
222
  <Talk2ViewChat partnerKey="…" fontFamily='"Space Grotesk", system-ui, sans-serif' />
161
223
  ```
162
224
 
163
- Nothing is fetched for it. The chat never loads a font, a stylesheet or a script
164
- from a third-party host, so whatever you name has to be available to the page.
225
+ Nothing is fetched for it. The chat never loads a font or a stylesheet, so
226
+ whatever you name has to be available to the page.
165
227
 
166
228
  ### `isToolDestructive` is your claim about your own tool
167
229
 
@@ -353,8 +415,17 @@ retires the label beside the mark.
353
415
 
354
416
  ## Content Security Policy, and hosts with no CSS loader
355
417
 
356
- The chat fetches nothing at runtime: no fonts, no CDN, no stylesheet, no script.
357
- A `connect-src` that allows your Talk2View engine is all it needs.
418
+ Without voice, the chat fetches nothing at runtime but your Talk2View engine: no
419
+ fonts, no CDN, no stylesheet, no script. A `connect-src` that allows the engine
420
+ is all it needs, plus `blob:` in a strict `img-src` for the previews of files
421
+ the end-user attaches.
422
+
423
+ Voice needs more. A call downloads Daily's call engine from
424
+ `https://c.daily.co` and runs it through `Function()`, so it needs
425
+ `https://c.daily.co` in `connect-src` and `'unsafe-eval'` in `script-src`, or no
426
+ call starts — see [voice.md](voice.md#browser-requirements). If you would rather
427
+ allow neither, `features={{ voice: false }}` keeps the microphone off the
428
+ launcher.
358
429
 
359
430
  `import '@talk2view/sdk/chat.css'` needs a build that can import CSS. Some hosts
360
431
  cannot — an Office add-in's webpack with no CSS rule, a strict `style-src` that
@@ -403,9 +474,9 @@ Stated plainly, because it is large.
403
474
 
404
475
  | | gzip |
405
476
  |---|---|
406
- | `@talk2view/sdk` (the core client) | 11.1 KB |
407
- | `@talk2view/sdk/ui` (the previous chat panel) | 40.3 KB |
408
- | **`@talk2view/sdk/chat`** | **372.4 KB** |
477
+ | `@talk2view/sdk` (the core client) | 11.5 KB |
478
+ | `@talk2view/sdk/ui` (the previous chat panel) | 40.9 KB |
479
+ | **`@talk2view/sdk/chat`** | **373.3 KB** |
409
480
  | A whole page containing the chat and React | ~437 KB |
410
481
 
411
482
  The first three exclude React and React DOM, which your app already has. The
package/docs/voice.md CHANGED
@@ -77,12 +77,22 @@ call ends with `'error'`), `auth_expired` (the sign-in expired; the call ends wi
77
77
  - **HTTPS.** Browsers only give microphone access on a secure page (localhost
78
78
  counts as secure).
79
79
  - **Microphone permission.** The browser asks on the first press. If the
80
- end-user refuses, the call ends with a `mic_unavailable` error.
81
- - **WebRTC.** The call is a WebRTC connection to Talk2View's voice service. A
82
- network that blocks WebRTC fails with `transport_error`.
80
+ end-user refuses, the call ends with a `mic_unavailable` error. Inside an
81
+ `<iframe>` from another origin, the iframe needs `allow="microphone"`.
82
+ - **WebRTC.** The call is a WebRTC connection to Talk2View's voice service,
83
+ through the ICE servers the engine hands out for each call. A network that
84
+ blocks WebRTC fails with `transport_error`.
83
85
  - **Content-Security-Policy.** Your bundler puts the Pipecat client libraries
84
- in a separate chunk that loads from your own origin on the first press. The
85
- call then connects to the voice service URL returned by the engine, so
86
- `connect-src` must allow that host as well as your engine.
87
-
88
- A chat-only integration never loads the Pipecat libraries.
86
+ in a separate chunk that loads from your own origin on the first press.
87
+ Starting a call, Pipecat's WebRTC transport has Daily's library
88
+ (`@daily-co/daily-js`) download its call engine from `https://c.daily.co`
89
+ and run it through `Function()`. So voice needs `https://c.daily.co` in
90
+ `connect-src` and `'unsafe-eval'` in `script-src`; without either, no call
91
+ starts. The call's offer then goes to the voice URL the engine returns,
92
+ which on Talk2View's hosted engine is the engine itself, so `connect-src`
93
+ must allow your engine too. If Daily's download fails, its library tries to
94
+ send an error report to Daily's own error tracking (Sentry); you can leave
95
+ that blocked.
96
+
97
+ A chat-only integration never loads the Pipecat libraries or Daily's call
98
+ engine.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talk2view/sdk",
3
- "version": "0.21.3",
3
+ "version": "0.22.0",
4
4
  "description": "Talk2View SDK — Add AI-powered natural language control to any application",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -86,7 +86,7 @@
86
86
  "@pipecat-ai/small-webrtc-transport": "1.10.8",
87
87
  "class-variance-authority": "^0.7.1",
88
88
  "clsx": "^2.1.1",
89
- "dompurify": "^3.4.13",
89
+ "dompurify": "^3.4.16",
90
90
  "lucide-react": "^1.8.0",
91
91
  "marked": "^15.0.0",
92
92
  "remark-gfm": "^4.0.1",
@@ -105,7 +105,7 @@
105
105
  "@types/dompurify": "^3.0.5",
106
106
  "@types/react": "^19.0.0",
107
107
  "@types/react-dom": "^19.0.0",
108
- "@vitest/coverage-v8": "^3.2.7",
108
+ "@vitest/coverage-v8": "^5.0.4",
109
109
  "browserslist": "^4.29.0",
110
110
  "esbuild": "^0.28.2",
111
111
  "jsdom": "^25.0.0",
@@ -114,7 +114,7 @@
114
114
  "tailwindcss": "^4.3.3",
115
115
  "tw-animate-css": "^1.4.0",
116
116
  "typescript": "^5.7.0",
117
- "vitest": "^3.2.7"
117
+ "vitest": "^5.0.4"
118
118
  },
119
119
  "peerDependencies": {
120
120
  "react": "^18.0.0 || ^19.0.0",
@@ -139,7 +139,7 @@
139
139
  "agent",
140
140
  "tools"
141
141
  ],
142
- "homepage": "https://talk2view.com",
142
+ "homepage": "https://docs.talk2view.com",
143
143
  "license": "MIT",
144
144
  "repository": {
145
145
  "type": "git",
@@ -149,10 +149,10 @@
149
149
  "*.css"
150
150
  ],
151
151
  "bugs": {
152
- "url": "https://talk2view.com/contact"
152
+ "url": "https://github.com/Talk2View/talk2view-typescript/issues"
153
153
  },
154
154
  "engines": {
155
- "node": ">=20.19"
155
+ "node": "^22.14.0 || ^24.0.0 || >=26.0.0"
156
156
  },
157
157
  "publishConfig": {
158
158
  "access": "public"