@astralbeam/sdk 0.15.1 → 0.16.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
@@ -8,7 +8,7 @@ npm install @astralbeam/sdk
8
8
 
9
9
  ## Quick start
10
10
 
11
- One component in React, one function everywhere else. Full setup, including the required token endpoint, is in [Getting started](https://app.astralbeam.ai/docs/sdk/getting-started).
11
+ One component in React, one function everywhere else. Full setup, including the required token endpoint, is in [Getting started](https://astralbeam.ai/docs/sdk/getting-started).
12
12
 
13
13
  ```tsx
14
14
  import { AstralBeamChat } from "@astralbeam/sdk/react"
@@ -25,11 +25,11 @@ const handle = mountAstralBeamChat(document.getElementById("sidebar"), {})
25
25
  // Update with handle.update({ colorScheme: "dark" }), then clean up with handle.unmount().
26
26
  ```
27
27
 
28
- Without npm or a bundler, import the same entry from jsDelivr in a module script. Pin an exact version and the full `/dist/client.js` path, because the loader imports its lazy chunks relative to itself. See [Script tag](https://app.astralbeam.ai/docs/sdk/script-tag).
28
+ Without npm or a bundler, import the same entry from jsDelivr in a module script. Pin an exact version and the full `/dist/client.js` path, because the loader imports its lazy chunks relative to itself. See [Script tag](https://astralbeam.ai/docs/sdk/script-tag).
29
29
 
30
30
  ```html
31
31
  <script type="module">
32
- import { mountAstralBeamChat } from "https://cdn.jsdelivr.net/npm/@astralbeam/sdk@0.15.1/dist/client.js"
32
+ import { mountAstralBeamChat } from "https://cdn.jsdelivr.net/npm/@astralbeam/sdk@0.16.0/dist/client.js"
33
33
 
34
34
  mountAstralBeamChat(document.getElementById("sidebar"), {})
35
35
  </script>
@@ -43,7 +43,7 @@ Without npm or a bundler, import the same entry from jsDelivr in a module script
43
43
 
44
44
  ## Authentication
45
45
 
46
- Your server must authenticate the host session and mint a chat token before the widget can chat. Keep the API key server-only. See [Authentication](https://app.astralbeam.ai/docs/sdk/authentication).
46
+ Your server must authenticate the host session and mint a chat token before the widget can chat. Keep the API key server-only. See [Authentication](https://astralbeam.ai/docs/sdk/authentication).
47
47
 
48
48
  ```ts
49
49
  import { createAstralBeamToken } from "@astralbeam/sdk/server"
@@ -79,35 +79,43 @@ export async function POST(request: Request) {
79
79
  - Authenticate once and derive stable `user.id` and `tenant.id` values from that trusted session.
80
80
  - Keep API keys server-only. Tokens are signed, not encrypted, so their claims must contain no secrets.
81
81
  - Return `Cache-Control: no-store` and fail closed when configuration or authentication is missing.
82
- - Directory access additionally requires signed `user.admin: true`, derived from trusted tenant permissions, and persisted records. Follow [Tenant directories](https://app.astralbeam.ai/docs/sdk/listings).
83
- - For employee-facing Tenant management, use `createAstralBeamOrganizationToken`. The [API client guide](https://app.astralbeam.ai/docs/sdk/api) covers database-backed roles and browser integration.
82
+ - Directory access additionally requires signed `user.admin: true`, derived from trusted tenant permissions, and persisted records. Follow [Tenant directories](https://astralbeam.ai/docs/sdk/listings).
83
+ - For employee-facing Tenant management, use `createAstralBeamOrganizationToken`. The [API client guide](https://astralbeam.ai/docs/sdk/api) covers database-backed roles and browser integration.
84
84
 
85
- Existing token props and the default chat endpoint keep working. After acquiring a token, components call `POST /api/v1/me` and renew before expiry. See [authentication and refresh behavior](https://app.astralbeam.ai/docs/sdk/authentication).
85
+ Existing token props and the default chat endpoint keep working. After acquiring a token, components call `POST /api/v1/me` and renew before expiry. See [authentication and refresh behavior](https://astralbeam.ai/docs/sdk/authentication).
86
86
 
87
87
  ## Options
88
88
 
89
- Every option is also a prop on `<AstralBeamChat>`. `handle.update(options)` applies any subset in place, and no option is fixed at mount. Details in [Configuration](https://app.astralbeam.ai/docs/sdk/configuration).
89
+ Every option is also a prop on `<AstralBeamChat>`. `handle.update(options)` applies any subset in place, and no option is fixed at mount. Details in [Configuration](https://astralbeam.ai/docs/sdk/configuration).
90
90
 
91
91
  | Option | Default | Meaning |
92
92
  | --- | --- | --- |
93
93
  | `agentId` | organization's default | `agent_<orgId>_<id>`, copied from the dashboard |
94
- | `apiUrl` | `https://app.astralbeam.ai/api` | Base URL of the AstralBeam API. The widget calls `/v1/chat` there |
94
+ | `threadId` | `"auto"` | Restore this tab's selection, use `"new"` for a fresh chat, or pass a saved thread UUID |
95
+ | `apiUrl` | `https://astralbeam.ai/api` | Base URL of the AstralBeam API. The widget calls `/v1/chat` there |
95
96
  | `fetchAstralBeamToken` | `{ url: "/api/astralbeam/token" }` | Chat auth token endpoint as `{ url, ...RequestInit }`, or a minter |
96
- | `title`, `showHeader` | `"AstralBeam"`, `true` | Header text, and whether the header and reset button show |
97
- | `emptyTitle`, `emptyDescription` | generic copy | Headline and subtitle of the empty transcript |
97
+ | `title`, `showHeader` | `"AstralBeam"`, `true` | Header text, and whether the header with its chat history and new chat buttons shows |
98
+ | `showConversationTitle` | `false` | Bar with a titled conversation's title and a rename, delete, and Copy Markdown menu |
99
+ | `emptyHeadline`, `emptyDescription` | generic copy | Headline and subtitle of the empty transcript |
98
100
  | `colorScheme`, `theme` | `"system"`, built-in palette | Light/dark/system, and shadcn token overrides |
99
101
  | `customCss` | None | Trusted CSS inside the widget's Shadow DOM |
100
102
  | `attachments` | `true` | `false` hides the feature, or pass limits |
101
103
  | `tools`, `widgets` | none | What the agent can do and draw in your app |
102
104
  | `sandboxPanel` | `false` | Collected sandbox panel: files with downloads, command log |
103
- | `header`, `empty`, `composerActions` | widget's own chrome | Host-rendered replacements (React props. `slots` on the handle) |
105
+ | `header`, `headerActions`, `empty`, `composerActions` | widget's own chrome | Host-rendered replacements (React props. `slots` on the handle) |
104
106
  | `debug` | `false` | Log SDK actions in the browser, with server logs in development only |
105
107
 
106
108
  A `ref` on `<AstralBeamChat>` (and the vanilla handle) exposes `reset()` and `stop()` for hosts that draw their own controls.
107
109
 
110
+ Conversations are saved automatically and start private. The widget searches saved conversation titles. Reopening history does not execute earlier tool calls. Disconnecting can interrupt the current response.
111
+
112
+ The headless session exposes conversation navigation, search, and pagination. With `useAstralBeamChat`, access these through `chat.core`, for example `chat.core.openThread(threadId)`. History loads a page at a time. `reset()` starts a new chat and keeps the saved one.
113
+
114
+ By default, `threadId: "auto"` restores this tab's selection after reload using session storage, scoped to the current account and API. A fresh, independently opened tab starts a new chat. Use `threadId: "new"` to bypass restoration, or pass a saved thread UUID. The widget's unsent text per thread stays in local storage and never sends automatically. Selected attachments remain in memory. The host owns sidebar visibility and can persist it separately in session storage.
115
+
108
116
  ## Tools and widgets
109
117
 
110
- A tool does something: its `execute` runs in your page. A widget shows something: its `render` draws your UI into the conversation. Both are declared with a `description` and a `parameters` schema. See [Tools and widgets](https://app.astralbeam.ai/docs/sdk/tools-and-widgets).
118
+ A tool does something: its `execute` runs in your page. A widget shows something: its `render` draws your UI into the conversation. Both are declared with a `description` and a `parameters` schema. See [Tools and widgets](https://astralbeam.ai/docs/sdk/tools-and-widgets).
111
119
 
112
120
  ```tsx
113
121
  tools: {
@@ -135,25 +143,25 @@ widgets: {
135
143
 
136
144
  | Guide | Covers |
137
145
  | --- | --- |
138
- | [API client](https://app.astralbeam.ai/docs/sdk/api) | Typed resource and chat requests with API keys or JWTs. |
139
- | [Getting started](https://app.astralbeam.ai/docs/sdk/getting-started) | install, mount, layout requirements. |
140
- | [Script tag](https://app.astralbeam.ai/docs/sdk/script-tag) | loading from jsDelivr without a bundler, and Ruby on Rails. |
141
- | [Authentication](https://app.astralbeam.ai/docs/sdk/authentication) | the token endpoint, its security rules, and minting in other languages. |
142
- | [Tenant directories](https://app.astralbeam.ai/docs/sdk/listings) | provisioning, tenant-user and Tenant listings, lifecycle, and options. |
143
- | [Configuration](https://app.astralbeam.ai/docs/sdk/configuration) | every option, and what `update` can change. |
144
- | [Theming](https://app.astralbeam.ai/docs/sdk/theming) | color schemes, CSS tokens, the shadow-root boundary. |
145
- | [Tools and widgets](https://app.astralbeam.ai/docs/sdk/tools-and-widgets) | schemas, live state, rendering into the transcript. |
146
- | [Attachments](https://app.astralbeam.ai/docs/sdk/attachments) | file kinds, limits, what the endpoint enforces. |
147
- | [Limits](https://app.astralbeam.ai/docs/sdk/limits) | request, attachment, and sandbox limits. |
148
- | [Sandbox](https://app.astralbeam.ai/docs/sdk/sandbox) | steps, the opt-in panel, downloads, inline images. |
149
- | [Headless](https://app.astralbeam.ai/docs/sdk/headless) | own the whole chat UI on the same session. |
150
- | [Security model](https://app.astralbeam.ai/docs/sdk/security) | who grants, who enforces, what the client can change. |
146
+ | [API client](https://astralbeam.ai/docs/sdk/api) | Typed resource and chat requests with API keys or JWTs. |
147
+ | [Getting started](https://astralbeam.ai/docs/sdk/getting-started) | install, mount, layout requirements. |
148
+ | [Script tag](https://astralbeam.ai/docs/sdk/script-tag) | loading from jsDelivr without a bundler, and Ruby on Rails. |
149
+ | [Authentication](https://astralbeam.ai/docs/sdk/authentication) | the token endpoint, its security rules, and minting in other languages. |
150
+ | [Tenant directories](https://astralbeam.ai/docs/sdk/listings) | provisioning, Tenant and user listings, saved conversation browsing, lifecycle, and options. |
151
+ | [Configuration](https://astralbeam.ai/docs/sdk/configuration) | every option, and what `update` can change. |
152
+ | [Theming](https://astralbeam.ai/docs/sdk/theming) | color schemes, CSS tokens, the shadow-root boundary. |
153
+ | [Tools and widgets](https://astralbeam.ai/docs/sdk/tools-and-widgets) | schemas, live state, rendering into the transcript. |
154
+ | [Attachments](https://astralbeam.ai/docs/sdk/attachments) | file kinds, limits, what the endpoint enforces. |
155
+ | [Limits](https://astralbeam.ai/docs/sdk/limits) | request, attachment, and sandbox limits. |
156
+ | [Sandbox](https://astralbeam.ai/docs/sdk/sandbox) | steps, the opt-in panel, downloads, inline images. |
157
+ | [Headless](https://astralbeam.ai/docs/sdk/headless) | own the whole chat UI on the same session. |
158
+ | [Security model](https://astralbeam.ai/docs/sdk/security) | who grants, who enforces, what the client can change. |
151
159
 
152
160
  ## Entry points
153
161
 
154
- Read-only Tenant and TenantUser widgets are available from `/client` and `/react`. See [Tenant directories](https://app.astralbeam.ai/docs/sdk/listings) for setup and embedding examples.
162
+ Read-only Tenant, TenantUser and conversation widgets are available from `/client` and `/react`. See [Tenant directories](https://astralbeam.ai/docs/sdk/listings) for setup and embedding examples.
155
163
 
156
- There is no root export. Conversation history is not built yet.
164
+ There is no root export. Conversations are saved on the server and can be reopened across clients.
157
165
 
158
166
  | Entry point | Contents | Peer dependency |
159
167
  | ------------------------ | -------------------------------------------- | -------------------- |