@fluxyte/sdk 0.5.0 → 0.5.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 (2) hide show
  1. package/README.md +52 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -3,11 +3,12 @@
3
3
  The official TypeScript SDK for the Fluxyte Onboarding AI API: a context-aware,
4
4
  documentation-grounded assistant designed for onboarding and setup flows (not generic chat).
5
5
 
6
- ## What's New In 0.4.0
6
+ ## What's New In 0.5.0
7
7
 
8
- - Voice chat API via `client.voiceChat(...)` for speech input.
9
- - Optional synthesized audio reply output.
10
- - React voice chat hook support for UI integration.
8
+ - Structured resources are available on chat, streaming, and voice responses.
9
+ - Supported resource kinds: `VIDEO`, `AUDIO`, `STORE`, `REDIRECT`, `REFERRAL`, and `CHECKOUT`.
10
+ - Video and audio resources can include a safe `embedUrl` for inline rendering.
11
+ - `useStreamingChat()` now exposes the completed response's `resources`.
11
12
 
12
13
  ## Install
13
14
 
@@ -138,6 +139,41 @@ console.log(res.answerId);
138
139
  console.log(res.reply);
139
140
  console.log(res.confidence);
140
141
  console.log(res.sources);
142
+ console.log(res.resources);
143
+ ```
144
+
145
+ ### Rich Content Resources
146
+
147
+ When approved knowledge or a flow step includes a related resource, the response
148
+ can contain:
149
+
150
+ ```ts
151
+ type ContentResource = {
152
+ id: string;
153
+ kind:
154
+ | "VIDEO"
155
+ | "AUDIO"
156
+ | "STORE"
157
+ | "REDIRECT"
158
+ | "REFERRAL"
159
+ | "CHECKOUT";
160
+ url: string;
161
+ label: string;
162
+ embedUrl?: string | null;
163
+ };
164
+ ```
165
+
166
+ Use `url` for links and actions. Use `embedUrl` only when it is present; it is
167
+ the server-approved URL intended for an embedded video or audio player.
168
+
169
+ ```ts
170
+ for (const resource of res.resources ?? []) {
171
+ if (resource.embedUrl) {
172
+ renderEmbeddedMedia(resource.embedUrl, resource.label);
173
+ } else {
174
+ renderResourceLink(resource.url, resource.label);
175
+ }
176
+ }
141
177
  ```
142
178
 
143
179
  ## Chat Completions (Streaming via SSE)
@@ -152,7 +188,7 @@ Streaming lifecycle:
152
188
 
153
189
  1. `meta` (contains `answerId`)
154
190
  2. `delta` (partial text; one or more)
155
- 3. `done` (confidence, sources)
191
+ 3. `done` (confidence, sources, resources)
156
192
 
157
193
  ```ts
158
194
  const stop = client.streamChat(
@@ -167,6 +203,7 @@ const stop = client.streamChat(
167
203
  if (event.type === "done") {
168
204
  console.log("\nConfidence:", event.confidence);
169
205
  console.log("Sources:", event.sources);
206
+ console.log("Resources:", event.resources);
170
207
  }
171
208
  },
172
209
  (err) => {
@@ -196,6 +233,7 @@ const voice = await client.voiceChat({
196
233
  console.log(voice.transcript); // text recognized from audio
197
234
  console.log(voice.reply); // AI text reply
198
235
  console.log(voice.replyAudioBase64); // optional synthesized voice
236
+ console.log(voice.resources); // approved related links or embedded media
199
237
  ```
200
238
 
201
239
  ## Context
@@ -323,7 +361,15 @@ await send({
323
361
  ```tsx
324
362
  import { useStreamingChat } from "@fluxyte/sdk/react";
325
363
 
326
- const { text, answerId, confidence, streaming, start, stop } = useStreamingChat();
364
+ const {
365
+ text,
366
+ answerId,
367
+ confidence,
368
+ resources,
369
+ streaming,
370
+ start,
371
+ stop,
372
+ } = useStreamingChat();
327
373
 
328
374
  start({
329
375
  message: "What's the next step?",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxyte/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Official Fluxyte SDK (TypeScript) for the Fluxyte Onboarding AI API",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",