@yak-io/javascript 0.7.0 → 0.9.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/README.md CHANGED
@@ -1,80 +1,152 @@
1
1
  # @yak-io/javascript
2
2
 
3
- Framework-agnostic core SDK for embedding the Yak chat widget. This package provides the low-level client and DOM rendering layer. Most developers should use a framework-specific package (`@yak-io/react`, `@yak-io/vue`, etc.) instead.
3
+ > 📚 **Full documentation:** https://docs.yak.io/docs/sdks/javascript
4
+ >
5
+ > 🤖 **For LLMs / AI agents:** https://docs.yak.io/llms.txt
4
6
 
5
- ## When to use this package directly
7
+ Framework-agnostic core SDK for [Yak](https://docs.yak.io) — an embeddable AI assistant (text chat **and** push-to-talk voice) for web apps. This package is the low-level runtime that every framework SDK (`@yak-io/react`, `@yak-io/vue`, …) is built on. It owns iframe messaging, the WebRTC voice session, DOM rendering of the trigger pill + chat panel, and an optional server handler.
6
8
 
7
- - You are building a vanilla JS / TypeScript app
8
- - You are building a new framework adapter
9
- - You need the server-side handler utilities (`./server` export) outside Next.js
10
-
11
- ## Installation
9
+ **Use this package directly when** you're on vanilla JS/TS, building a new framework adapter, or need the server handler (`@yak-io/javascript/server`) outside Next.js. On a supported framework, prefer that framework's package instead.
12
10
 
13
11
  ```bash
14
12
  pnpm add @yak-io/javascript
15
13
  ```
16
14
 
17
- ## Quickstart — Vanilla JS
15
+ ## Exports
16
+
17
+ | Export | Kind | Purpose |
18
+ | --- | --- | --- |
19
+ | `YakEmbed` | class | Drop-in widget: trigger pill + chat panel + voice, all wired. Start here. |
20
+ | `YakClient` | class | Headless chat-only iframe client (no DOM). Advanced. |
21
+ | `YakVoiceSession` | class | Headless WebRTC voice session. Advanced. |
22
+ | `enableYakLogging` / `disableYakLogging` / `isYakLoggingEnabled` | fn | Toggle verbose SDK logging. |
23
+ | `EMBED_PROTOCOL_VERSION` | const | Host ↔ iframe protocol version. |
24
+ | Types | — | `YakEmbedConfig`, `YakClientConfig`, `Theme`, `WidgetMode`, `VoiceState`, `VoiceMachine`, `ToolCallEvent`, `ChatConfig`, and more (see [Types](#types)). |
25
+ | `@yak-io/javascript/server` | subpath | `createYakHandler` + route/tool source types (see [Server](#server-side-handler)). |
26
+
27
+ ## Quickstart
18
28
 
19
29
  ```ts
20
30
  import { YakEmbed } from "@yak-io/javascript";
21
31
 
22
32
  const embed = new YakEmbed({
23
33
  appId: "your-app-id",
34
+ mode: "both", // "chat" | "voice" | "both" — default "chat"
35
+ trigger: true, // render the floating launcher pill
24
36
  theme: { position: "bottom-right", colorMode: "system" },
25
- trigger: { label: "Ask with AI" },
26
- getConfig: async () => ({
27
- routes: {
28
- routes: [
29
- { path: "/", title: "Home", description: "Landing page" },
30
- { path: "/docs", title: "Docs", description: "Documentation" },
31
- ],
32
- generated_at: new Date().toISOString(),
33
- },
34
- tools: {
35
- tools: [
36
- {
37
- name: "tasks.list",
38
- displayName: "List Tasks",
39
- description: "Return all tasks",
40
- inputSchema: { type: "object", properties: {} },
41
- },
42
- ],
43
- generated_at: new Date().toISOString(),
44
- },
45
- }),
46
- onToolCall: async (name, args) => {
47
- if (name === "tasks.list") {
48
- return { tasks: [] };
49
- }
50
- throw new Error(`Unknown tool: ${name}`);
37
+ // Routes + tools the assistant may use. Usually fetched from your server.
38
+ getConfig: async () => {
39
+ const res = await fetch("/api/yak");
40
+ return res.json(); // ChatConfig: { routes, tools? }
51
41
  },
52
- onRedirect: (path) => {
53
- window.location.assign(path);
42
+ // Execute a tool the assistant decides to call.
43
+ onToolCall: async (name, args) => {
44
+ const res = await fetch("/api/yak", {
45
+ method: "POST",
46
+ headers: { "Content-Type": "application/json" },
47
+ body: JSON.stringify({ name, args }),
48
+ });
49
+ const data = await res.json();
50
+ if (!data.ok) throw new Error(data.error);
51
+ return data.result;
54
52
  },
55
53
  });
56
54
 
57
- embed.mount();
55
+ embed.mount(); // inject into the DOM
56
+ ```
57
+
58
+ ## Programmatic control
59
+
60
+ Every method works whether or not the trigger pill is shown — pass `trigger: false` to drive a fully custom UI.
61
+
62
+ ```ts
63
+ // Chat
64
+ embed.open();
65
+ embed.close();
66
+ embed.toggle();
67
+ embed.openWithPrompt("How do I export my data?");
68
+
69
+ // Voice (requires mode "voice" or "both"; must be called from a user gesture)
70
+ await embed.voiceStart();
71
+ await embed.voiceStop();
72
+ await embed.voiceToggle();
73
+
74
+ // State
75
+ embed.getState(); // { isOpen, isReady, isLoading, isExpanded }
76
+ const stop = embed.onStateChange((s) => console.log(s.isLoading));
77
+ const stopVoice = embed.onVoiceStateChange((m) => console.log(m.state));
58
78
  ```
59
79
 
60
- ## Server-side utilities
80
+ `isLoading` is `isOpen && !isReady` — true from the moment the panel opens until the iframe handshakes ready. Drive a custom loading spinner off it instead of re-deriving the condition. For voice, the equivalent "still spinning up" check is `getVoiceState().state === "connecting"`.
61
81
 
62
- Use `@yak-io/javascript/server` to build framework-agnostic API handlers:
82
+ ## API reference
83
+
84
+ ### `new YakEmbed(config)`
85
+
86
+ **Config** (`YakEmbedConfig`):
87
+
88
+ | Option | Type | Default | Description |
89
+ | --- | --- | --- | --- |
90
+ | `appId` | `string` | — | Your Yak app ID (required). |
91
+ | `mode` | `"chat" \| "voice" \| "both"` | `"chat"` | Which surfaces the widget exposes. |
92
+ | `trigger` | `boolean \| TriggerButtonConfig` | `true` | Show the floating pill. `false` = headless. `TriggerButtonConfig` recolors it. |
93
+ | `theme` | `Theme` | — | Position, color mode, and colors. |
94
+ | `getConfig` | `ChatConfigProvider` | — | Async provider of `{ routes, tools? }`. Called on open and on each voice start. |
95
+ | `onToolCall` | `ToolCallHandler` | — | Executes a tool the assistant calls. |
96
+ | `onGraphQLSchemaCall` | `GraphQLSchemaHandler` | — | Handles GraphQL schema tool calls. |
97
+ | `onRESTSchemaCall` | `RESTSchemaHandler` | — | Handles REST/OpenAPI schema tool calls. |
98
+ | `onRedirect` | `(path: string) => void` | `window.location.assign` | Handle navigation requested by the assistant. |
99
+ | `onToolCallComplete` | `(event: ToolCallEvent) => void` | — | Fires after every tool call (use for cache invalidation). |
100
+ | `user` | `UserIdentity` | — | Signed end-user identity for server-side conversation persistence. See [end-user identity](https://docs.yak.io/docs/customization/end-user-identity). |
101
+ | `target` | `HTMLElement` | `document.body` | Where to mount the widget DOM. |
102
+ | `options.disableRestartButton` | `boolean` | `false` | Hide the restart-session button in the header. |
103
+
104
+ **Methods:** `mount()`, `destroy()`, `open()`, `close()`, `toggle()`, `openWithPrompt(prompt)`, `getState()`, `onStateChange(fn)`, `voiceStart()`, `voiceStop()`, `voiceToggle()`, `getVoiceState()`, `onVoiceStateChange(fn)`, `getClient()`, `getVoiceSession()`, `getMode()`.
105
+
106
+ ### `Theme`
107
+
108
+ ```ts
109
+ type Theme = {
110
+ position?: WidgetPosition; // default "bottom-left"
111
+ colorMode?: "light" | "dark" | "system";
112
+ displayMode?: "chatbox" | "drawer"; // floating panel vs full-height side drawer
113
+ fullscreen?: boolean;
114
+ light?: ThemeColors; // { background?, border?, messageBackground?, ... }
115
+ dark?: ThemeColors;
116
+ };
117
+ // WidgetPosition: top-left | top-center | top-right | left-center | right-center
118
+ // | bottom-left | bottom-center | bottom-right
119
+ ```
120
+
121
+ ### `VoiceState` / `VoiceMachine`
122
+
123
+ ```ts
124
+ type VoiceState = "idle" | "connecting" | "listening" | "thinking" | "speaking" | "error";
125
+ interface VoiceMachine { state: VoiceState; errorMessage?: string }
126
+ ```
127
+
128
+ ### `YakClient` / `YakVoiceSession`
129
+
130
+ Headless building blocks used internally by `YakEmbed`. Reach for them only when composing a bespoke integration — most apps should use `YakEmbed`.
131
+
132
+ ## Server-side handler
133
+
134
+ `@yak-io/javascript/server` builds a framework-agnostic `Request`/`Response` handler (Remix, Fastify, Hono, plain Node, …):
63
135
 
64
136
  ```ts
65
137
  import { createYakHandler } from "@yak-io/javascript/server";
66
138
 
67
- // Works with any Request/Response runtime (Remix, Fastify, etc.)
68
- const { GET, POST } = createYakHandler({
139
+ export const { GET, POST } = createYakHandler({
140
+ // GET returns the route + tool manifest the assistant sees.
69
141
  routes: [
70
142
  { path: "/", title: "Home" },
71
143
  { path: "/tasks", title: "Tasks" },
72
144
  ],
145
+ // POST executes a tool call.
73
146
  tools: {
74
147
  getTools: async () => [
75
148
  {
76
149
  name: "tasks.list",
77
- displayName: "List Tasks",
78
150
  description: "Return all tasks",
79
151
  inputSchema: { type: "object", properties: {} },
80
152
  },
@@ -87,61 +159,17 @@ const { GET, POST } = createYakHandler({
87
159
  });
88
160
  ```
89
161
 
90
- ## API Reference
91
-
92
- ### `YakEmbed`
93
-
94
- High-level class that handles DOM rendering (panel, iframe, trigger button) and client wiring.
162
+ `routes` and `tools` each accept a single source or an array of sources, so you can compose filesystem routes with adapters like [`@yak-io/trpc`](https://docs.yak.io/docs/tool-adapters/trpc) or [`@yak-io/prismic`](https://docs.yak.io/docs/cms/prismic).
95
163
 
96
- ```ts
97
- new YakEmbed(config: YakEmbedConfig)
98
- ```
99
-
100
- **Key methods:**
101
-
102
- | Method | Description |
103
- |--------|-------------|
104
- | `mount()` | Injects the widget into the DOM |
105
- | `destroy()` | Removes the widget from the DOM |
106
- | `open()` | Open the chat panel |
107
- | `close()` | Close the chat panel |
108
- | `toggle()` | Toggle open/close |
109
- | `openWithPrompt(prompt)` | Open and pre-fill a prompt |
110
- | `getState()` | Get current `{ isOpen, isReady }` state |
111
- | `onStateChange(fn)` | Subscribe to state changes, returns unsubscribe |
112
- | `getClient()` | Access the underlying `YakClient` |
113
-
114
- **Configuration (`YakEmbedConfig`):**
115
-
116
- | Option | Type | Description |
117
- |--------|------|-------------|
118
- | `appId` | `string` | Your Yak app ID |
119
- | `theme` | `Theme` | Position, color mode, and widget colors |
120
- | `trigger` | `boolean \| TriggerButtonConfig` | Show built-in trigger button |
121
- | `getConfig` | `ChatConfigProvider` | Async function returning routes + tools config |
122
- | `chatConfig` | `ChatConfig` | Static config (alternative to `getConfig`) |
123
- | `onToolCall` | `ToolCallHandler` | Handle tool calls from the assistant |
124
- | `onGraphQLSchemaCall` | `GraphQLSchemaHandler` | Handle GraphQL schema tool calls |
125
- | `onRESTSchemaCall` | `RESTSchemaHandler` | Handle REST/OpenAPI schema tool calls |
126
- | `onRedirect` | `(path: string) => void` | Handle navigation requests |
127
- | `onToolCallComplete` | `(event: ToolCallEvent) => void` | Called after each tool call |
128
- | `options.disableRestartButton` | `boolean` | Hide the restart session button |
129
-
130
- ### `YakClient`
131
-
132
- Low-level iframe communication client. Use `YakEmbed` for most cases.
133
-
134
- ### Logging utilities
164
+ ## Logging
135
165
 
136
166
  ```ts
137
167
  import { enableYakLogging, disableYakLogging, isYakLoggingEnabled } from "@yak-io/javascript";
138
168
 
139
- enableYakLogging(); // Turn on verbose SDK logging
140
- disableYakLogging(); // Turn off SDK logging
141
- isYakLoggingEnabled(); // Returns current state
169
+ enableYakLogging(); // verbose SDK logs
142
170
  ```
143
171
 
144
- In development, set `window.__YAK_INTERNAL_DEV__ = true` before mounting to connect to a locally running chat UI.
172
+ In development, set `window.__YAK_INTERNAL_DEV__ = true` before `mount()` to connect to a locally running chat UI.
145
173
 
146
174
  ## Types
147
175
 
@@ -149,6 +177,16 @@ All types are exported from the package root:
149
177
 
150
178
  ```ts
151
179
  import type {
180
+ YakEmbedConfig,
181
+ YakEmbedState,
182
+ YakClientConfig,
183
+ WidgetMode,
184
+ Theme,
185
+ ThemeColors,
186
+ WidgetPosition,
187
+ TriggerButtonConfig,
188
+ VoiceState,
189
+ VoiceMachine,
152
190
  ChatConfig,
153
191
  ChatConfigProvider,
154
192
  RouteManifest,
@@ -157,25 +195,12 @@ import type {
157
195
  ToolDefinition,
158
196
  ToolCallHandler,
159
197
  ToolCallEvent,
160
- ToolCallPayload,
161
- ToolCallResult,
162
198
  GraphQLSchemaHandler,
163
199
  RESTSchemaHandler,
164
- GraphQLRequest,
165
- RESTRequest,
166
200
  SchemaSource,
167
- GraphQLSchemaSource,
168
- OpenAPISchemaSource,
169
- Theme,
170
- ThemeColors,
171
- TriggerButtonConfig,
172
- WidgetPosition,
173
- YakClientConfig,
174
- YakEmbedConfig,
175
- YakEmbedState,
176
201
  } from "@yak-io/javascript";
177
202
  ```
178
203
 
179
204
  ## License
180
205
 
181
- Proprietary — see LICENSE file.
206
+ Proprietary — see [LICENSE](./LICENSE).
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ChatConfig } from "./types/config.js";
2
- import type { Theme } from "./types/messaging.js";
3
- import type { ToolCallHandler, ToolCallEventListener, GraphQLSchemaHandler, RESTSchemaHandler } from "./types/tools.js";
2
+ import type { Theme, UserIdentity } from "./types/messaging.js";
3
+ import type { GraphQLSchemaHandler, RESTSchemaHandler, ToolCallEventListener, ToolCallHandler } from "./types/tools.js";
4
4
  declare global {
5
5
  interface Window {
6
6
  __YAK_INTERNAL_DEV__?: boolean;
@@ -104,6 +104,28 @@ export interface YakClientConfig {
104
104
  /** Disable the restart session button in the header */
105
105
  disableRestartButton?: boolean;
106
106
  };
107
+ /**
108
+ * Signed end-user identity. When supplied, the widget persists conversations
109
+ * server-side keyed to this user and surfaces a history pane. The `hash`
110
+ * must be HMAC-SHA256(apiSecret, id) computed on the integrator's backend —
111
+ * never expose `apiSecret` to the browser.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * // Integrator backend (Node.js)
116
+ * const hash = crypto
117
+ * .createHmac("sha256", process.env.YAK_API_SECRET)
118
+ * .update(currentUser.id)
119
+ * .digest("hex");
120
+ *
121
+ * // Browser
122
+ * new YakClient({
123
+ * appId: "app_abc",
124
+ * user: { id: currentUser.id, hash },
125
+ * });
126
+ * ```
127
+ */
128
+ user?: UserIdentity;
107
129
  }
108
130
  export declare class YakClient {
109
131
  private config;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAA8C,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA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ACI,WAAW,IAAI,MAAM;IAuB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;IACI,QAAQ,IAAI,MAAM;IAIzB;;OAEG;IACI,QAAQ,IAAI,KAAK,GAAG,SAAS;IAIpC;;;;;;;;;;OAUG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAavC;;;OAGG;IACI,SAAS,IAAI,IAAI;IAYxB;;OAEG;IACI,OAAO,IAAI,OAAO;IAIlB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOrC,aAAa,CAAC,MAAM,EAAE,OAAO;IAa7B,KAAK;IAOL,OAAO;IAQd,OAAO,CAAC,cAAc;IA+BtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,cAAc,CAGpB;IAEF,OAAO,CAAC,aAAa,CAkInB;IAEF,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,eAAe;YAoBT,cAAc;YA4Bd,uBAAuB;YAuBvB,oBAAoB;IAuBlC,OAAO,CAAC,sBAAsB;IAuB9B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,mBAAmB;IAU3B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAsB1B"}
package/dist/client.js CHANGED
@@ -1,6 +1,61 @@
1
- import { extractPageContext, debounce } from "./page-context.js";
1
+ import { isYakLoggingEnabled, logger } from "./logger.js";
2
+ import { debounce, extractPageContext } from "./page-context.js";
2
3
  import { EMBED_PROTOCOL_VERSION } from "./version.js";
3
- import { logger, isYakLoggingEnabled } from "./logger.js";
4
+ /** localStorage key for the per-app signed session token. */
5
+ const SESSION_STORAGE_KEY = (appId) => `yak:session:${appId}`;
6
+ /** localStorage key for the per-app active-conversation pointer. */
7
+ const CONVERSATION_POINTER_KEY = (appId) => `yak:conversation:${appId}`;
8
+ /** Read a stored session token for this app, if any. SSR-safe. */
9
+ function readStoredSessionToken(appId) {
10
+ if (typeof window === "undefined" || typeof window.localStorage === "undefined")
11
+ return undefined;
12
+ try {
13
+ return window.localStorage.getItem(SESSION_STORAGE_KEY(appId)) ?? undefined;
14
+ }
15
+ catch {
16
+ return undefined;
17
+ }
18
+ }
19
+ function writeStoredSessionToken(appId, token) {
20
+ if (typeof window === "undefined" || typeof window.localStorage === "undefined")
21
+ return;
22
+ try {
23
+ window.localStorage.setItem(SESSION_STORAGE_KEY(appId), token);
24
+ }
25
+ catch {
26
+ // localStorage can throw in private-browsing modes; silently ignore.
27
+ }
28
+ }
29
+ function readStoredConversationPointer(appId) {
30
+ if (typeof window === "undefined" || typeof window.localStorage === "undefined")
31
+ return undefined;
32
+ try {
33
+ return window.localStorage.getItem(CONVERSATION_POINTER_KEY(appId)) ?? undefined;
34
+ }
35
+ catch {
36
+ return undefined;
37
+ }
38
+ }
39
+ function writeStoredConversationPointer(appId, pointer) {
40
+ if (typeof window === "undefined" || typeof window.localStorage === "undefined")
41
+ return;
42
+ try {
43
+ window.localStorage.setItem(CONVERSATION_POINTER_KEY(appId), pointer);
44
+ }
45
+ catch {
46
+ // localStorage can throw in private-browsing modes; silently ignore.
47
+ }
48
+ }
49
+ function clearStoredConversationPointer(appId) {
50
+ if (typeof window === "undefined" || typeof window.localStorage === "undefined")
51
+ return;
52
+ try {
53
+ window.localStorage.removeItem(CONVERSATION_POINTER_KEY(appId));
54
+ }
55
+ catch {
56
+ // localStorage can throw in private-browsing modes; silently ignore.
57
+ }
58
+ }
4
59
  /**
5
60
  * Determines the iframe origin based on the current environment.
6
61
  * - Internal dev (localhost on *.yak.* domain) -> http://localhost:3001
@@ -43,7 +98,10 @@ export class YakClient {
43
98
  }
44
99
  updateConfig(newConfig) {
45
100
  this.config = { ...this.config, ...newConfig };
46
- if (this.readyTarget && this.config.chatConfig) {
101
+ // Resend config when the iframe is ready and we have anything to deliver —
102
+ // tool/route manifests, or a user identity that needs to land in the
103
+ // widget so persistence/history light up.
104
+ if (this.readyTarget && (this.config.chatConfig || this.config.user)) {
47
105
  this.sendConfigToIframe(this.readyTarget.window, this.readyTarget.origin);
48
106
  }
49
107
  }
@@ -220,7 +278,6 @@ export class YakClient {
220
278
  logger.debug("Navigation detected, sending page context");
221
279
  this.sendPageContext();
222
280
  };
223
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: message handler requires branching per message type
224
281
  handleMessage = (event) => {
225
282
  if (typeof window === "undefined")
226
283
  return;
@@ -304,6 +361,24 @@ export class YakClient {
304
361
  }
305
362
  break;
306
363
  }
364
+ case "yak:session": {
365
+ const { sessionToken } = message.payload;
366
+ logger.debug("Session token received from iframe; persisting");
367
+ writeStoredSessionToken(this.config.appId, sessionToken);
368
+ break;
369
+ }
370
+ case "yak:conversation": {
371
+ const { pointer } = message.payload;
372
+ if (pointer === null) {
373
+ logger.debug("Conversation pointer cleared by iframe");
374
+ clearStoredConversationPointer(this.config.appId);
375
+ }
376
+ else {
377
+ logger.debug("Conversation pointer received from iframe; persisting");
378
+ writeStoredConversationPointer(this.config.appId, pointer);
379
+ }
380
+ break;
381
+ }
307
382
  case "yak:close": {
308
383
  logger.debug("Close message received from iframe");
309
384
  this.config.onClose?.();
@@ -319,6 +394,8 @@ export class YakClient {
319
394
  const loggingEnabled = typeof window !== "undefined" && typeof window.__YAK_LOGGING_ENABLED__ === "boolean"
320
395
  ? window.__YAK_LOGGING_ENABLED__
321
396
  : undefined;
397
+ const storedSessionToken = readStoredSessionToken(this.config.appId);
398
+ const storedConversationPointer = readStoredConversationPointer(this.config.appId);
322
399
  const configMessage = {
323
400
  type: "yak:config",
324
401
  payload: {
@@ -330,6 +407,9 @@ export class YakClient {
330
407
  schemaSources: this.config.chatConfig?.schemaSources ?? undefined,
331
408
  options: this.config.options,
332
409
  loggingEnabled,
410
+ user: this.config.user,
411
+ sessionToken: storedSessionToken,
412
+ conversationPointer: storedConversationPointer,
333
413
  },
334
414
  };
335
415
  logger.debug("Posting config to iframe origin:", {
package/dist/embed.d.ts CHANGED
@@ -1,7 +1,15 @@
1
1
  import { YakClient, type YakClientConfig } from "./client.js";
2
+ import type { ChatConfigProvider } from "./types/config.js";
3
+ import { type VoiceMachine } from "./voice-machine.js";
4
+ import { type VoiceStateListener, YakVoiceSession } from "./voice-session.js";
5
+ /**
6
+ * Which experiences the widget exposes:
7
+ * - `chat` — chat icon only (opens the chat iframe panel). The default.
8
+ * - `voice` — voice icon only (starts a WebRTC voice session).
9
+ * - `both` — both icons, sharing one trigger pill.
10
+ */
11
+ export type WidgetMode = "chat" | "voice" | "both";
2
12
  export type TriggerButtonConfig = {
3
- /** Label displayed on the trigger button. Default: "Ask with AI" */
4
- label?: string;
5
13
  /** Custom color overrides for light mode */
6
14
  lightButton?: {
7
15
  background?: string;
@@ -20,22 +28,47 @@ export type YakEmbedConfig = YakClientConfig & {
20
28
  target?: HTMLElement;
21
29
  /** Show the floating trigger button. Default: true */
22
30
  trigger?: boolean | TriggerButtonConfig;
31
+ /**
32
+ * Which experiences this widget exposes.
33
+ * "chat" — chat icon only (opens the chat iframe).
34
+ * "voice" — voice icon only (starts a WebRTC voice session).
35
+ * "both" — both icons in one pill.
36
+ * Default: "chat".
37
+ */
38
+ mode?: WidgetMode;
39
+ /**
40
+ * Async provider for chat config (routes + tools). Used by the voice
41
+ * session on every `start()` and by the iframe via postMessage. Takes
42
+ * precedence over the static `chatConfig` on `YakClientConfig`.
43
+ */
44
+ getConfig?: ChatConfigProvider;
23
45
  };
24
46
  export type YakEmbedState = {
47
+ /** Whether the chat panel is open. */
25
48
  isOpen: boolean;
49
+ /** Whether the chat iframe has handshaked and can receive messages. */
26
50
  isReady: boolean;
51
+ /**
52
+ * Whether the chat is opening but not yet interactive — `isOpen && !isReady`.
53
+ * Stays true from the moment the panel opens until the iframe reports ready,
54
+ * so custom triggers can show a spinner without re-deriving it.
55
+ */
56
+ isLoading: boolean;
57
+ /** Whether the panel is expanded to (near) full-screen. */
27
58
  isExpanded: boolean;
28
59
  };
29
60
  export type YakEmbedStateListener = (state: YakEmbedState) => void;
30
61
  /**
31
- * Drop-in widget that renders the yak chat iframe + optional trigger button.
32
- * Wraps YakClient with DOM rendering, lazy iframe mounting, and consistent styling.
62
+ * Drop-in widget that renders the yak trigger pill plus, depending on mode,
63
+ * the chat iframe panel and/or a WebRTC voice session. Composes both
64
+ * `YakClient` (chat) and `YakVoiceSession` (voice) under one trigger.
33
65
  *
34
66
  * @example
35
67
  * ```ts
36
68
  * const embed = new YakEmbed({
37
69
  * appId: "my-app",
38
- * theme: { position: "bottom-right" },
70
+ * mode: "both",
71
+ * theme: { position: "bottom-left" },
39
72
  * onToolCall: async (name, args) => { ... },
40
73
  * });
41
74
  * embed.mount();
@@ -43,29 +76,40 @@ export type YakEmbedStateListener = (state: YakEmbedState) => void;
43
76
  */
44
77
  export declare class YakEmbed {
45
78
  private readonly client;
79
+ private readonly voice;
46
80
  private readonly config;
81
+ private readonly mode;
47
82
  private styleEl;
48
83
  private panelRoot;
49
84
  private container;
50
85
  private iframe;
51
- private triggerButton;
86
+ private triggerEl;
87
+ private chatButton;
88
+ private voiceButton;
52
89
  private isOpen;
53
90
  private isReady;
54
91
  private isExpanded;
55
92
  private hasBeenOpened;
56
93
  private pendingPrompt;
57
94
  private mounted;
95
+ private voiceMachine;
58
96
  private stateListeners;
97
+ private voiceListeners;
98
+ private unsubscribeVoice;
59
99
  private mobileQuery;
60
100
  private mobileHandler;
61
101
  private expandHandler;
62
102
  constructor(config: YakEmbedConfig);
63
103
  /** The underlying headless YakClient for advanced usage */
64
104
  getClient(): YakClient;
105
+ /** The underlying voice session — null when mode === "chat". */
106
+ getVoiceSession(): YakVoiceSession | null;
107
+ /** Current widget mode (immutable for the lifetime of the embed). */
108
+ getMode(): WidgetMode;
65
109
  /**
66
110
  * Mount the widget into the DOM. Call once after construction.
67
- * Inserts styles and trigger button (if enabled). The iframe is lazily
68
- * created on the first call to open().
111
+ * Inserts styles and trigger button (if enabled). The chat iframe is
112
+ * lazily created on the first call to open().
69
113
  */
70
114
  mount(target?: HTMLElement): void;
71
115
  /** Remove all DOM elements and event listeners. */
@@ -82,12 +126,24 @@ export declare class YakEmbed {
82
126
  getState(): YakEmbedState;
83
127
  /** Subscribe to state changes. Returns an unsubscribe function. */
84
128
  onStateChange(listener: YakEmbedStateListener): () => void;
129
+ /** Start a voice session. Must be invoked from a user gesture. */
130
+ voiceStart(): Promise<void>;
131
+ /** Stop the current voice session. */
132
+ voiceStop(): Promise<void>;
133
+ /** Toggle: start if idle/error, stop if active. */
134
+ voiceToggle(): Promise<void>;
135
+ /** Current voice machine snapshot. */
136
+ getVoiceState(): VoiceMachine;
137
+ /** Subscribe to voice state changes. */
138
+ onVoiceStateChange(listener: VoiceStateListener): () => void;
85
139
  private createPanel;
86
140
  private createTrigger;
87
141
  private buildTriggerClasses;
88
142
  private applyTriggerCustomColors;
89
143
  private updatePanelState;
90
- private updateTriggerState;
144
+ private updateChatButtonState;
145
+ private updateVoiceButtonState;
146
+ private iconForVoiceState;
91
147
  private sendPendingPrompt;
92
148
  private sendFocusIfOpen;
93
149
  private notifyMobileState;
@@ -1 +1 @@
1
- {"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAM9D,MAAM,MAAM,mBAAmB,GAAG;IAChC,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,WAAW,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvE,2CAA2C;IAC3C,UAAU,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE,CAAC;AAIF,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG;IA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