@astralbeam/sdk 0.0.2 → 0.0.4
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 +5 -3
- package/dist/chat-DPX4FOaL.js +77 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.js +1 -1
- package/dist/react.d.ts +6 -0
- package/dist/react.js +3 -1
- package/package.json +2 -1
- package/dist/chat-DdU0uj9s.js +0 -65
package/dist/client.d.ts
CHANGED
|
@@ -32,6 +32,11 @@ interface WidgetDefinition {
|
|
|
32
32
|
interface ToolDefinition {
|
|
33
33
|
/** Tells the agent what the tool does so it can decide when to call it. */
|
|
34
34
|
description: string;
|
|
35
|
+
/**
|
|
36
|
+
* Forwarded verbatim as the tool definition's metadata. A string `title` labels the tool's
|
|
37
|
+
* transcript entry instead of its registry name (`refresh_invoices` reads as "Refresh invoices").
|
|
38
|
+
*/
|
|
39
|
+
metadata?: Record<string, unknown> | undefined;
|
|
35
40
|
/**
|
|
36
41
|
* Forwarded to the agent as JSON Schema. Only a Standard Schema also validates the
|
|
37
42
|
* input before `execute` runs; with a plain JSON Schema, treat the input as untrusted.
|
|
@@ -83,6 +88,11 @@ interface AstralBeamChatTheme {
|
|
|
83
88
|
interface MountAstralBeamChatOptions {
|
|
84
89
|
/** Name shown in the widget's header. Default `"AstralBeam"`. */
|
|
85
90
|
title?: string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Shows the widget's header, which carries the title and the reset button. `false` hides both
|
|
93
|
+
* and gives the transcript the full height. Default `true`.
|
|
94
|
+
*/
|
|
95
|
+
showHeader?: boolean | undefined;
|
|
86
96
|
/** URL of the AstralBeam chat endpoint the widget streams from. Fixed at mount. Default `"/api/chat"`. */
|
|
87
97
|
chatEndpoint?: string | undefined;
|
|
88
98
|
/** Application endpoint that mints a short-lived chat JWT. Fixed at mount; omit for guest chat. */
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,t}from"./client-utils-DyEcBInP.js";function n(n,r={}){let i={...r},a=t(i.debug);a?.(`mount`,`mounting chat widget`,{title:i.title??`AstralBeam`,chatEndpoint:i.chatEndpoint??`/api/chat`,authentication:i.authEndpoint?`configured`:`guest`,colorScheme:i.colorScheme??`system`,theme:i.theme,systemPrompt:i.systemPrompt,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(`./chat-
|
|
1
|
+
import{a as e,t}from"./client-utils-DyEcBInP.js";function n(n,r={}){let i={...r},a=t(i.debug);a?.(`mount`,`mounting chat widget`,{title:i.title??`AstralBeam`,showHeader:i.showHeader??!0,chatEndpoint:i.chatEndpoint??`/api/chat`,authentication:i.authEndpoint?`configured`:`guest`,colorScheme:i.colorScheme??`system`,theme:i.theme,systemPrompt:i.systemPrompt,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(`./chat-DPX4FOaL.js`).then(({renderChat:e})=>{a?.(`mount`,`chat chunk loaded`),f||(p=e(o,s,i))}),{update:e=>{i={...i,...e},a=t(i.debug),a?.(`mount`,`options updated`,{changed:Object.keys(e)}),d(),p?.update(i)},unmount:()=>{a?.(`mount`,`unmounting chat widget`),f=!0,c.removeEventListener(`change`,d),p?.dispose(),p=void 0,s.remove()}}}export{n as mountAstralBeamChat};
|
package/dist/react.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ interface WidgetDefinition extends Omit<WidgetDefinition$1, "render"> {
|
|
|
9
9
|
interface AstralBeamChatProps {
|
|
10
10
|
/** Name shown in the widget's header; prop changes apply immediately. Default `"AstralBeam"`. */
|
|
11
11
|
title?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Shows the widget's header with the title and the reset button; `false` hides both and gives
|
|
14
|
+
* the transcript the full height. Prop changes apply immediately. Default `true`.
|
|
15
|
+
*/
|
|
16
|
+
showHeader?: boolean;
|
|
12
17
|
/** URL of the AstralBeam chat endpoint the widget streams from. Default `"/api/chat"`. */
|
|
13
18
|
chatEndpoint?: string;
|
|
14
19
|
/** Application endpoint that mints a short-lived chat JWT; omit for guest chat. */
|
|
@@ -33,6 +38,7 @@ interface AstralBeamChatProps {
|
|
|
33
38
|
}
|
|
34
39
|
declare function AstralBeamChat({
|
|
35
40
|
title,
|
|
41
|
+
showHeader,
|
|
36
42
|
chatEndpoint,
|
|
37
43
|
authEndpoint,
|
|
38
44
|
systemPrompt,
|
package/dist/react.js
CHANGED
|
@@ -7,7 +7,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
const DEFAULT_COLOR_SCHEME = "system";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/react.tsx
|
|
10
|
-
function AstralBeamChat({ title, chatEndpoint, authEndpoint, systemPrompt, tools, widgets = {}, colorScheme = DEFAULT_COLOR_SCHEME, theme, attachments, debug }) {
|
|
10
|
+
function AstralBeamChat({ title, showHeader, chatEndpoint, authEndpoint, systemPrompt, tools, widgets = {}, colorScheme = DEFAULT_COLOR_SCHEME, theme, attachments, debug }) {
|
|
11
11
|
const targetRef = useRef(null);
|
|
12
12
|
const handleRef = useRef(null);
|
|
13
13
|
const [activeRenders, setActiveRenders] = useState(/* @__PURE__ */ new Map());
|
|
@@ -44,6 +44,7 @@ function AstralBeamChat({ title, chatEndpoint, authEndpoint, systemPrompt, tools
|
|
|
44
44
|
}])), [widgets]);
|
|
45
45
|
const live = useMemo(() => ({
|
|
46
46
|
title,
|
|
47
|
+
showHeader,
|
|
47
48
|
systemPrompt,
|
|
48
49
|
colorScheme,
|
|
49
50
|
theme,
|
|
@@ -53,6 +54,7 @@ function AstralBeamChat({ title, chatEndpoint, authEndpoint, systemPrompt, tools
|
|
|
53
54
|
widgets: hostWidgets
|
|
54
55
|
}), [
|
|
55
56
|
title,
|
|
57
|
+
showHeader,
|
|
56
58
|
systemPrompt,
|
|
57
59
|
colorScheme,
|
|
58
60
|
theme,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astralbeam/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Frontend SDK for AstralBeam: drop-in agent UI, chat streaming, and server helpers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"@tanstack/ai": "^0.49.1",
|
|
75
75
|
"@tanstack/ai-client": "^0.28.0",
|
|
76
76
|
"@tanstack/ai-react": "^0.22.1",
|
|
77
|
+
"@tanstack/markdown": "^0.0.13",
|
|
77
78
|
"@types/react": "^19.2.13",
|
|
78
79
|
"@types/react-dom": "^19.2.3",
|
|
79
80
|
"class-variance-authority": "^0.7.1",
|