@astralbeam/sdk 0.1.0 → 0.2.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 +16 -16
- package/dist/client.d.ts +7 -7
- package/dist/client.js +1 -1
- package/dist/{core-9Q6FGvSX.js → core-BVlttAaO.js} +18 -6
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/debug-DyjRg3e0.js +1 -0
- package/dist/{index-BBBBbB1x.d.ts → index-DtIS-V14.d.ts} +3 -3
- package/dist/react.d.ts +4 -4
- package/dist/react.js +4 -4
- package/dist/widget-CncI3L44.js +79 -0
- package/package.json +1 -1
- package/dist/debug-DBysy3en.js +0 -1
- package/dist/widget-C7XKsfTv.js +0 -79
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ const handle = mountAstralBeamChat(document.getElementById("sidebar"), {})
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
- The widget fills its container, so give it a parent with a definite height (`min-h-0` in a flex column).
|
|
29
|
-
- Two origins by design: chat streams to the hosted cloud by default, while the token comes from your own app's endpoint. Self-hosted deployments set `
|
|
29
|
+
- Two origins by design: chat streams to the hosted cloud by default, while the token comes from your own app's endpoint. Self-hosted deployments set `apiUrl` to their own origin.
|
|
30
30
|
- `@astralbeam/sdk/client` ships no React; the chat loads as a lazy chunk with its own bundled copy.
|
|
31
31
|
- `react` and `react-dom` are optional peer dependencies used only by `@astralbeam/sdk/react`.
|
|
32
32
|
- Mount it above your router if the transcript should survive page navigation.
|
|
@@ -55,21 +55,21 @@ export const POST = createAstralBeamTokenRoute({
|
|
|
55
55
|
|
|
56
56
|
## Options
|
|
57
57
|
|
|
58
|
-
Every option is also a prop on `<AstralBeamChat>`; `handle.update(options)` applies any subset in place. `agentId`, `
|
|
59
|
-
|
|
60
|
-
| Option | Default
|
|
61
|
-
| ------------------------------------ |
|
|
62
|
-
| `agentId` | organization's default
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `title`, `showHeader` | `"AstralBeam"`, `true`
|
|
66
|
-
| `emptyTitle`, `emptyDescription` | generic copy
|
|
67
|
-
| `colorScheme`, `theme` | `"system"`, built-in palette
|
|
68
|
-
| `attachments` | `true`
|
|
69
|
-
| `tools`, `widgets` | none
|
|
70
|
-
| `sandboxPanel` | `false`
|
|
71
|
-
| `header`, `empty`, `composerActions` | widget's own chrome
|
|
72
|
-
| `debug` | `false`
|
|
58
|
+
Every option is also a prop on `<AstralBeamChat>`; `handle.update(options)` applies any subset in place. `agentId`, `apiUrl`, and `authTokenUrl` are fixed at mount. Details in [Configuration](https://app.astralbeam.ai/docs/sdk/configuration).
|
|
59
|
+
|
|
60
|
+
| Option | Default | Meaning |
|
|
61
|
+
| ------------------------------------ | ------------------------------- | --------------------------------------------------------------- |
|
|
62
|
+
| `agentId` | organization's default | `agt_<organization>_<agent>` from the dashboard |
|
|
63
|
+
| `apiUrl` | `https://app.astralbeam.ai/api` | Base URL of the AstralBeam API; the widget calls `/chat` there |
|
|
64
|
+
| `authTokenUrl` | `/api/astralbeam/token` | Your token endpoint |
|
|
65
|
+
| `title`, `showHeader` | `"AstralBeam"`, `true` | Header text, and whether the header and reset button show |
|
|
66
|
+
| `emptyTitle`, `emptyDescription` | generic copy | Headline and subtitle of the empty transcript |
|
|
67
|
+
| `colorScheme`, `theme` | `"system"`, built-in palette | Light/dark/system, and shadcn token overrides |
|
|
68
|
+
| `attachments` | `true` | `false` hides the feature, or pass limits |
|
|
69
|
+
| `tools`, `widgets` | none | What the agent can do and draw in your app |
|
|
70
|
+
| `sandboxPanel` | `false` | Collected sandbox panel: files with downloads, command log |
|
|
71
|
+
| `header`, `empty`, `composerActions` | widget's own chrome | Host-rendered replacements (React props; `slots` on the handle) |
|
|
72
|
+
| `debug` | `false` | Log every SDK action in the browser and on the server |
|
|
73
73
|
|
|
74
74
|
A `ref` on `<AstralBeamChat>` (and the vanilla handle) exposes `reset()` and `stop()` for hosts that draw their own controls.
|
|
75
75
|
|
package/dist/client.d.ts
CHANGED
|
@@ -126,13 +126,13 @@ interface MountAstralBeamChatOptions {
|
|
|
126
126
|
/** Subtitle shown under the empty transcript's headline. Default describes the app's tools and widgets. */
|
|
127
127
|
emptyDescription?: string | undefined;
|
|
128
128
|
/**
|
|
129
|
-
* URL of the AstralBeam
|
|
130
|
-
* `"https://app.astralbeam.ai/api
|
|
131
|
-
* their own origin.
|
|
129
|
+
* Base URL of the AstralBeam API; the widget calls `/chat` and its subroutes under it. Fixed at
|
|
130
|
+
* mount. Default `"https://app.astralbeam.ai/api"`, the hosted cloud; self-hosted deployments
|
|
131
|
+
* must set their own origin.
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
apiUrl?: string | undefined;
|
|
134
134
|
/** Application endpoint that mints a short-lived chat JWT. Fixed at mount. Default `"/api/astralbeam/token"`. */
|
|
135
|
-
|
|
135
|
+
authTokenUrl?: string | undefined;
|
|
136
136
|
/** Host-defined tools the agent can call, executed in the host page, keyed by tool name. */
|
|
137
137
|
tools?: Record<string, ToolDefinition> | undefined;
|
|
138
138
|
/** Host-defined widgets the agent can render inline in the conversation, keyed by identifier. */
|
|
@@ -161,10 +161,10 @@ interface MountAstralBeamChatOptions {
|
|
|
161
161
|
debug?: boolean | undefined;
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
|
-
* Mount options the handle can change afterwards. The agent and transport
|
|
164
|
+
* Mount options the handle can change afterwards. The agent and the transport URLs are fixed:
|
|
165
165
|
* changing any of them would mean a new client and a discarded transcript.
|
|
166
166
|
*/
|
|
167
|
-
type AstralBeamChatUpdate = Partial<Omit<MountAstralBeamChatOptions, "agentId" | "
|
|
167
|
+
type AstralBeamChatUpdate = Partial<Omit<MountAstralBeamChatOptions, "agentId" | "apiUrl" | "authTokenUrl">>;
|
|
168
168
|
interface AstralBeamChatHandle {
|
|
169
169
|
unmount: () => void;
|
|
170
170
|
/**
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,t}from"./debug-
|
|
1
|
+
import{c as e,t}from"./debug-DyjRg3e0.js";function n(e){return e}function r(e){return e}function i(n,r){let i={...r},a=t(i.debug);a?.(`mount`,`mounting chat widget`,{agentId:i.agentId??`(organization default)`,title:i.title??`AstralBeam`,showHeader:i.showHeader??!0,emptyTitle:i.emptyTitle??`Ask the assistant`,emptyDescription:i.emptyDescription??`It can answer questions and act through this app's own tools and widgets.`,apiUrl:i.apiUrl??`https://app.astralbeam.ai/api`,authentication:`configured`,colorScheme:i.colorScheme??`system`,theme:i.theme,tools:Object.keys(i.tools??{}),widgets:Object.keys(i.widgets??{}),attachments:i.attachments??!0});let o=n.shadowRoot??n.attachShadow({mode:`open`}),s=document.createElement(`div`);s.className=e,s.style.height=`100%`,o.append(s);let c=matchMedia(`(prefers-color-scheme: dark)`),l=new Set,u=e=>{for(let e of l)s.style.removeProperty(e);l.clear();let t={...i.theme?.light,...e?i.theme?.dark:void 0};for(let[e,n]of Object.entries(t))e.startsWith(`--`)&&(s.style.setProperty(e,n),l.add(e))},d=()=>{let e=i.colorScheme??`system`,t=e===`dark`||e===`system`&&c.matches;s.classList.toggle(`dark`,t),u(t),a?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...l]})};d(),c.addEventListener(`change`,d);let f=!1,p;return import(`./widget-CncI3L44.js`).then(({renderChat:e})=>{a?.(`mount`,`chat chunk loaded`),f||(p=e(o,s,i))}),{update:e=>{if(Object.hasOwn(e,`agentId`)||Object.hasOwn(e,`apiUrl`)||Object.hasOwn(e,`authTokenUrl`))throw Error(`agentId, apiUrl, and authTokenUrl are fixed at mount`);i={...i,...e},a=t(i.debug),a?.(`mount`,`options updated`,{changed:Object.keys(e)}),d(),p?.update(i)},reset:()=>p?.reset(),stop:()=>p?.stop(),unmount:()=>{a?.(`mount`,`unmounting chat widget`),f=!0,c.removeEventListener(`change`,d),p?.dispose(),p=void 0,s.remove()}}}export{n as defineTool,r as defineWidget,i as mountAstralBeamChat};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
2
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
3
|
+
/**
|
|
4
|
+
* The chat API's URLs under an API base: the stream itself, the agent capability handshake,
|
|
5
|
+
* and artifact downloads. Chat is one API under the base; others will sit beside it.
|
|
6
|
+
*/
|
|
7
|
+
function chatApiUrls(apiUrl) {
|
|
8
|
+
const chat = `${(apiUrl ?? "https://app.astralbeam.ai/api").replace(/\/+$/, "")}/chat`;
|
|
9
|
+
return {
|
|
10
|
+
chat,
|
|
11
|
+
config: `${chat}/config`,
|
|
12
|
+
files: `${chat}/files`
|
|
13
|
+
};
|
|
14
|
+
}
|
|
3
15
|
/** Color scheme used when the mount options and the React prop give none. */
|
|
4
16
|
const DEFAULT_COLOR_SCHEME = "system";
|
|
5
17
|
//#endregion
|
|
@@ -7850,10 +7862,10 @@ function bearerToken(headers) {
|
|
|
7850
7862
|
return authorization?.startsWith("Bearer ") ? authorization.slice(7) : void 0;
|
|
7851
7863
|
}
|
|
7852
7864
|
async function fetchChatToken(options) {
|
|
7853
|
-
const {
|
|
7865
|
+
const { authTokenUrl, session, onStateChange, fetchClient, debug } = options;
|
|
7854
7866
|
const { signal } = session.abortController;
|
|
7855
7867
|
try {
|
|
7856
|
-
const response = await fetchClient(
|
|
7868
|
+
const response = await fetchClient(authTokenUrl, {
|
|
7857
7869
|
method: "POST",
|
|
7858
7870
|
headers: { accept: "application/json" },
|
|
7859
7871
|
credentials: "include",
|
|
@@ -8061,7 +8073,7 @@ function describeSandboxCommandRun(run) {
|
|
|
8061
8073
|
*/
|
|
8062
8074
|
function createAstralBeamChat(options) {
|
|
8063
8075
|
const debug = createDebugLogger(options.debug);
|
|
8064
|
-
const
|
|
8076
|
+
const urls = chatApiUrls(options.apiUrl);
|
|
8065
8077
|
const widgets = options.widgets ?? {};
|
|
8066
8078
|
const listeners = /* @__PURE__ */ new Set();
|
|
8067
8079
|
let state = {
|
|
@@ -8084,7 +8096,7 @@ function createAstralBeamChat(options) {
|
|
|
8084
8096
|
for (const listener of listeners) listener();
|
|
8085
8097
|
};
|
|
8086
8098
|
const authentication = {
|
|
8087
|
-
|
|
8099
|
+
authTokenUrl: options.authTokenUrl ?? "/api/astralbeam/token",
|
|
8088
8100
|
session: {
|
|
8089
8101
|
cached: void 0,
|
|
8090
8102
|
refreshPromise: void 0,
|
|
@@ -8097,7 +8109,7 @@ function createAstralBeamChat(options) {
|
|
|
8097
8109
|
initializeChatAuthentication(authentication).catch(() => void 0);
|
|
8098
8110
|
(async () => {
|
|
8099
8111
|
try {
|
|
8100
|
-
const url = new URL(
|
|
8112
|
+
const url = new URL(urls.config, globalThis.location?.href);
|
|
8101
8113
|
if (options.agentId) url.searchParams.set("agentId", options.agentId);
|
|
8102
8114
|
const token = await getValidChatToken(authentication);
|
|
8103
8115
|
const response = await fetch(url, { headers: { authorization: `Bearer ${token}` } });
|
|
@@ -8132,7 +8144,7 @@ function createAstralBeamChat(options) {
|
|
|
8132
8144
|
};
|
|
8133
8145
|
};
|
|
8134
8146
|
const client = new ChatClient({
|
|
8135
|
-
connection: fetchServerSentEvents(
|
|
8147
|
+
connection: fetchServerSentEvents(urls.chat, async () => ({
|
|
8136
8148
|
headers: { authorization: `Bearer ${await getValidChatToken(authentication)}` },
|
|
8137
8149
|
fetchClient: (input, init) => fetchAuthenticatedChat({
|
|
8138
8150
|
...authentication,
|
package/dist/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SandboxActivity, C as AstralBeamChatState, D as WidgetDeclaration, E as ChatAuthenticationState, F as InferParameters, I as JsonSchemaObject, L as ParametersSchema, M as SandboxCommandRun, N as SandboxFileWrite, O as buildAgentTools, P as SandboxStatus, R as StandardSchemaV1, S as AstralBeamChatCoreOptions, T as createAstralBeamChat, _ as sandboxRefusal, a as SANDBOX_LIST_FILES_TOOL, b as lastPartInProgress, c as SANDBOX_RUN_COMMAND_TOOL, d as collectSandboxActivity, f as describeSandboxCommandRun, g as readSandboxFileWrite, h as readSandboxCommandRun, i as RENDER_WIDGET_TOOL, j as SandboxArtifact, k as RenderWidgetInput, l as SANDBOX_STATUS_EVENT, m as readSandboxArtifact, n as defineWidget, o as SANDBOX_PUBLISH_ARTIFACT_TOOL, p as isSandboxTool, r as ASK_QUESTIONNAIRE_TOOL, s as SANDBOX_READ_FILE_TOOL, t as defineTool, u as SANDBOX_WRITE_FILE_TOOL, v as hasPendingToolRun, w as WidgetRenderRequest, x as AstralBeamChatCore, y as isSettledToolCall, z as ToolDefinition } from "./index-
|
|
1
|
+
import { A as SandboxActivity, C as AstralBeamChatState, D as WidgetDeclaration, E as ChatAuthenticationState, F as InferParameters, I as JsonSchemaObject, L as ParametersSchema, M as SandboxCommandRun, N as SandboxFileWrite, O as buildAgentTools, P as SandboxStatus, R as StandardSchemaV1, S as AstralBeamChatCoreOptions, T as createAstralBeamChat, _ as sandboxRefusal, a as SANDBOX_LIST_FILES_TOOL, b as lastPartInProgress, c as SANDBOX_RUN_COMMAND_TOOL, d as collectSandboxActivity, f as describeSandboxCommandRun, g as readSandboxFileWrite, h as readSandboxCommandRun, i as RENDER_WIDGET_TOOL, j as SandboxArtifact, k as RenderWidgetInput, l as SANDBOX_STATUS_EVENT, m as readSandboxArtifact, n as defineWidget, o as SANDBOX_PUBLISH_ARTIFACT_TOOL, p as isSandboxTool, r as ASK_QUESTIONNAIRE_TOOL, s as SANDBOX_READ_FILE_TOOL, t as defineTool, u as SANDBOX_WRITE_FILE_TOOL, v as hasPendingToolRun, w as WidgetRenderRequest, x as AstralBeamChatCore, y as isSettledToolCall, z as ToolDefinition } from "./index-DtIS-V14.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, type AstralBeamChatCore, type AstralBeamChatCoreOptions, type AstralBeamChatState, type ChatAuthenticationState, type InferParameters, type JsonSchemaObject, type ParametersSchema, RENDER_WIDGET_TOOL, type RenderWidgetInput, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, type SandboxActivity, type SandboxArtifact, type SandboxCommandRun, type SandboxFileWrite, type SandboxStatus, type StandardSchemaV1, type ToolDefinition, type WidgetDeclaration, type WidgetRenderRequest, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, defineWidget, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, n as defineWidget, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-
|
|
1
|
+
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, n as defineWidget, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-BVlttAaO.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, RENDER_WIDGET_TOOL, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, defineWidget, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`AstralBeam`,t=`Ask the assistant`,n=`It can answer questions and act through this app's own tools and widgets.`,r=`https://app.astralbeam.ai/api`,i=`/api/astralbeam/token`;function a(e){let t=`${(e??`https://app.astralbeam.ai/api`).replace(/\/+$/,``)}/chat`;return{chat:t,config:`${t}/config`,files:`${t}/files`}}const o=`system`,s=`astralbeam-root`,c=e=>`background:${e};color:#fff;border-radius:3px;padding:1px 5px`,l=`${c(`#7c3aed`)};font-weight:600`,u={mount:`#7c3aed`,auth:`#be185d`,theme:`#8b5cf6`,send:`#2563eb`,run:`#0891b2`,stream:`#0e7490`,text:`#16a34a`,reasoning:`#64748b`,tool:`#d97706`,widget:`#db2777`,attachment:`#0d9488`,sandbox:`#0369a1`,questionnaire:`#9333ea`,status:`#475569`,error:`#dc2626`};function d(e){if(e)return(e,t,n)=>{console.log(`%cAstralBeam%c ${new Date().toISOString().slice(11,19)} %c${e}%c ${t}`,l,`color:#94a3b8;font-weight:400`,c(u[e]),``,...n===void 0?[]:[n])}}export{n as a,s as c,o as i,a as l,r as n,t as o,i as r,e as s,d as t};
|
|
@@ -3590,10 +3590,10 @@ interface WidgetRenderRequest {
|
|
|
3590
3590
|
interface AstralBeamChatCoreOptions {
|
|
3591
3591
|
/** Public ID of the organization-owned agent; omitted, the organization's default answers. */
|
|
3592
3592
|
agentId?: string | undefined;
|
|
3593
|
-
/**
|
|
3594
|
-
|
|
3593
|
+
/** Base URL of the AstralBeam API; `/chat` hangs off it. Default the hosted cloud. */
|
|
3594
|
+
apiUrl?: string | undefined;
|
|
3595
3595
|
/** The application endpoint that mints short-lived chat JWTs. Default `/api/astralbeam/token`. */
|
|
3596
|
-
|
|
3596
|
+
authTokenUrl?: string | undefined;
|
|
3597
3597
|
/** Host tools the agent can call; `execute` runs wherever this session lives. */
|
|
3598
3598
|
tools?: Record<string, ToolDefinition> | undefined;
|
|
3599
3599
|
/** Widgets declared to the agent; `onRenderWidget` is asked to draw them. */
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as AstralBeamChatState, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-
|
|
1
|
+
import { C as AstralBeamChatState, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-DtIS-V14.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatTheme, InferParameters, JsonSchemaObject, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
|
|
4
4
|
|
|
@@ -63,10 +63,10 @@ interface AstralBeamChatProps {
|
|
|
63
63
|
emptyTitle?: string;
|
|
64
64
|
/** Subtitle under the empty transcript's headline; prop changes apply immediately. */
|
|
65
65
|
emptyDescription?: string;
|
|
66
|
-
/** URL of the AstralBeam
|
|
67
|
-
|
|
66
|
+
/** Base URL of the AstralBeam API; the widget calls `/chat` under it. Default the hosted cloud. */
|
|
67
|
+
apiUrl?: string;
|
|
68
68
|
/** Application endpoint that mints a short-lived chat JWT. Default `"/api/astralbeam/token"`. */
|
|
69
|
-
|
|
69
|
+
authTokenUrl?: string;
|
|
70
70
|
/** Host-defined tools the agent can call, executed in the host's React app, keyed by name. */
|
|
71
71
|
tools?: Record<string, ToolDefinition>;
|
|
72
72
|
/** Host-defined widgets the agent can render inline in the conversation, keyed by identifier. */
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as DEFAULT_COLOR_SCHEME, r as createAstralBeamChat } from "./core-
|
|
1
|
+
import { C as DEFAULT_COLOR_SCHEME, r as createAstralBeamChat } from "./core-BVlttAaO.js";
|
|
2
2
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { defineTool, mountAstralBeamChat } from "@astralbeam/sdk/client";
|
|
@@ -42,7 +42,7 @@ function useAstralBeamChat(options) {
|
|
|
42
42
|
core
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, showHeader, header, empty, composerActions, emptyTitle, emptyDescription,
|
|
45
|
+
const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, showHeader, header, empty, composerActions, emptyTitle, emptyDescription, apiUrl, authTokenUrl, tools, widgets = {}, colorScheme = DEFAULT_COLOR_SCHEME, theme, attachments, sandboxPanel, debug }, ref) {
|
|
46
46
|
const targetRef = useRef(null);
|
|
47
47
|
const handleRef = useRef(null);
|
|
48
48
|
const [activeRenders, setActiveRenders] = useState(/* @__PURE__ */ new Map());
|
|
@@ -140,8 +140,8 @@ const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, show
|
|
|
140
140
|
const handle = mountAstralBeamChat(targetRef.current, {
|
|
141
141
|
...liveRef.current,
|
|
142
142
|
agentId,
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
apiUrl,
|
|
144
|
+
authTokenUrl
|
|
145
145
|
});
|
|
146
146
|
handleRef.current = handle;
|
|
147
147
|
return () => {
|