@astralbeam/sdk 0.17.0 → 0.18.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 +8 -1
- package/dist/{api-BaIPbj-Q.js → api-B3UxSTtl.js} +135 -1
- package/dist/api.d.ts +2 -2
- package/dist/api.js +1 -2
- package/dist/auth-lifecycle-B0BXyDr7.js +25 -0
- package/dist/badge-B9WuChHI.js +1 -0
- package/dist/client.d.ts +57 -8
- package/dist/client.js +1 -1
- package/dist/constants-C-Yp0Vhg.js +1 -0
- package/dist/{core-DeMY6_wQ.js → core-CLWlvgYl.js} +203 -72
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -2
- package/dist/css-BGIxQoYs.js +1 -0
- package/dist/css-DgaLhXQH.js +1 -0
- package/dist/{debug-qLts7gEt.js → debug-DLDY8CZb.js} +1 -1
- package/dist/diff-woXpYk--.js +1 -0
- package/dist/github-dark-C-LZuMrd.js +1 -0
- package/dist/github-light-EUqPIrTm.js +1 -0
- package/dist/highlighter-Bd_oZUcA.js +152 -0
- package/dist/html-B3xvRgDO.js +1 -0
- package/dist/{index-NT05_Yw_.d.ts → index-DDfmeUeU.d.ts} +76 -50
- package/dist/{index-CfGnT6Od.d.ts → index-DFxtXIXy.d.ts} +104 -3
- package/dist/item-a9y_9nk7.js +1 -0
- package/dist/javascript-BzbQS41l.js +1 -0
- package/dist/javascript-CpIGwZ_Y.js +1 -0
- package/dist/json-qhed-kSA.js +1 -0
- package/dist/jsx-Bz0zcwM4.js +1 -0
- package/dist/listings-DzxJtGCD.js +1 -0
- package/dist/markdown-BYOwaDjH.js +1 -0
- package/dist/mcp-servers-ESbOt00F.js +1 -0
- package/dist/python-gzcpVVnB.js +1 -0
- package/dist/react.d.ts +23 -16
- package/dist/react.js +46 -8
- package/dist/server.d.ts +14 -26
- package/dist/server.js +190 -347
- package/dist/shellscript-CLZ0U2zV.js +1 -0
- package/dist/sql-CEbI0hMM.js +1 -0
- package/dist/styles.generated-D4k7izMB.js +80 -0
- package/dist/tsx-udAQXfEw.js +1 -0
- package/dist/typescript-bsJCZSQ-.js +1 -0
- package/dist/validate-BOw-BAyv.js +140 -0
- package/dist/widget-DGmCPqzk.js +24 -0
- package/dist/yaml-rwi0_p6S.js +1 -0
- package/package.json +18 -15
- package/dist/constants-enyqxaJi.js +0 -1
- package/dist/listings-BH_hPkxx.js +0 -1
- package/dist/rolldown-runtime-QTnfLwEv.js +0 -1
- package/dist/styles.generated-D8sDOLu3.js +0 -98
- package/dist/type_checks-C-WTHaWs.js +0 -117
- package/dist/widget-BdiuWvPf.js +0 -24
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Jn as e,Or as t,Yn as n,qn as r,tt as i,ur as a,wr as o}from"./styles.generated-D4k7izMB.js";t();var s=r();function c({className:t,size:n=`default`,...r}){return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:e(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,t),"data-slot":`native-select-wrapper`,"data-size":n,children:[/* @__PURE__ */ (0,s.jsx)(`select`,{"data-slot":`native-select`,"data-size":n,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pe-8 ps-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...r}),/* @__PURE__ */ (0,s.jsx)(o,{className:`pointer-events-none absolute top-1/2 end-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function l({className:t,...n}){return/* @__PURE__ */ (0,s.jsx)(`option`,{"data-slot":`native-select-option`,className:e(`bg-[Canvas] text-[CanvasText]`,t),...n})}const u=n(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function d({className:t,variant:n=`default`,render:r,...o}){return i({defaultTagName:`span`,props:a({className:e(u({variant:n}),t)},o),render:r,state:{slot:`badge`,variant:n}})}export{c as n,l as r,d as t};
|
package/dist/client.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
|
3
3
|
readonly "~standard": {
|
|
4
4
|
readonly version: 1;
|
|
5
5
|
readonly vendor: string;
|
|
6
|
-
readonly validate: (value: unknown) => unknown;
|
|
6
|
+
readonly validate: (value: unknown) => unknown;
|
|
7
|
+
/** Type-level only; the spec keeps it undefined at runtime. */
|
|
7
8
|
readonly types?: {
|
|
8
9
|
readonly input: Input;
|
|
9
10
|
readonly output: Output;
|
|
@@ -153,6 +154,8 @@ interface MountAstralBeamChatOptions {
|
|
|
153
154
|
* `false` hides it and gives the transcript the full height. Default `true`.
|
|
154
155
|
*/
|
|
155
156
|
showHeader?: boolean | undefined;
|
|
157
|
+
/** Adds an X button and fullscreen chat at widths up to 900px. The host hides or unmounts chat in this callback. */
|
|
158
|
+
onClose?: (() => void) | undefined;
|
|
156
159
|
/**
|
|
157
160
|
* Shows a bar under the header with the open conversation's title, once it has one, and a menu
|
|
158
161
|
* to rename, delete, or copy it as Markdown. Default `false`.
|
|
@@ -236,9 +239,9 @@ interface TypedWidgetDefinition<S extends ParametersSchema = JsonSchemaObject> {
|
|
|
236
239
|
render: (props: InferParameters<S>, container: HTMLElement) => (() => void) | void;
|
|
237
240
|
}
|
|
238
241
|
/** Declares a host tool; a Standard Schema `parameters` types (and validates) `execute`'s input. */
|
|
239
|
-
declare function defineTool<const S extends ParametersSchema = JsonSchemaObject>(tool: TypedToolDefinition<S>): ToolDefinition;
|
|
242
|
+
export declare function defineTool<const S extends ParametersSchema = JsonSchemaObject>(tool: TypedToolDefinition<S>): ToolDefinition;
|
|
240
243
|
/** Declares a host widget; a Standard Schema `parameters` types (and validates) `render`'s props. */
|
|
241
|
-
declare function defineWidget<const S extends ParametersSchema = JsonSchemaObject>(widget: TypedWidgetDefinition<S>): WidgetDefinition;
|
|
244
|
+
export declare function defineWidget<const S extends ParametersSchema = JsonSchemaObject>(widget: TypedWidgetDefinition<S>): WidgetDefinition;
|
|
242
245
|
//#endregion
|
|
243
246
|
//#region src/api/generated/api.d.ts
|
|
244
247
|
/**
|
|
@@ -328,11 +331,57 @@ interface AstralBeamListingHandle<T extends AstralBeamListingOptions = AstralBea
|
|
|
328
331
|
}
|
|
329
332
|
type AstralBeamTenantListHandle = AstralBeamListingHandle<MountAstralBeamTenantListOptions>;
|
|
330
333
|
type AstralBeamTenantUserListHandle = AstralBeamListingHandle<MountAstralBeamTenantUserListOptions>;
|
|
331
|
-
declare function mountAstralBeamTenantList(target: HTMLElement, options: MountAstralBeamTenantListOptions): AstralBeamTenantListHandle;
|
|
332
|
-
declare function mountAstralBeamTenantUserList(target: HTMLElement, options: MountAstralBeamTenantUserListOptions): AstralBeamTenantUserListHandle;
|
|
333
|
-
declare function mountAstralBeamThreadList(target: HTMLElement, options: MountAstralBeamThreadListOptions): AstralBeamThreadListHandle;
|
|
334
|
+
export declare function mountAstralBeamTenantList(target: HTMLElement, options: MountAstralBeamTenantListOptions): AstralBeamTenantListHandle;
|
|
335
|
+
export declare function mountAstralBeamTenantUserList(target: HTMLElement, options: MountAstralBeamTenantUserListOptions): AstralBeamTenantUserListHandle;
|
|
336
|
+
export declare function mountAstralBeamThreadList(target: HTMLElement, options: MountAstralBeamThreadListOptions): AstralBeamThreadListHandle;
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/client/mcp-servers.d.ts
|
|
339
|
+
interface McpServerInput {
|
|
340
|
+
endpointUrl: string;
|
|
341
|
+
authConfig: {
|
|
342
|
+
kind: "none";
|
|
343
|
+
} | {
|
|
344
|
+
kind: "static_headers";
|
|
345
|
+
headerNames: readonly string[];
|
|
346
|
+
} | {
|
|
347
|
+
kind: "oauth";
|
|
348
|
+
profile: "standard" | "google";
|
|
349
|
+
applicationOrigin?: string;
|
|
350
|
+
requestedScopes: readonly string[];
|
|
351
|
+
client?: {
|
|
352
|
+
clientId: string;
|
|
353
|
+
clientSecret?: string;
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
interface McpServerItem {
|
|
358
|
+
id: string;
|
|
359
|
+
endpointUrl: string;
|
|
360
|
+
authKind: McpServerInput["authConfig"]["kind"] | null;
|
|
361
|
+
}
|
|
362
|
+
interface McpServerFormError {
|
|
363
|
+
field: string;
|
|
364
|
+
message: string;
|
|
365
|
+
}
|
|
366
|
+
interface MountAstralBeamMcpServersOptions {
|
|
367
|
+
servers: readonly McpServerItem[];
|
|
368
|
+
oauthRedirectUri?: string | null | undefined;
|
|
369
|
+
/** Host callbacks authorize writes and refresh servers. Omit them for a read-only list. */
|
|
370
|
+
onCreateServer?: ((input: McpServerInput) => Promise<void | {
|
|
371
|
+
errors: readonly McpServerFormError[];
|
|
372
|
+
}>) | undefined;
|
|
373
|
+
onRemoveServer?: ((id: string) => Promise<void>) | undefined;
|
|
374
|
+
colorScheme?: AstralBeamChatColorScheme | undefined;
|
|
375
|
+
theme?: AstralBeamChatTheme | undefined;
|
|
376
|
+
}
|
|
377
|
+
interface AstralBeamMcpServersHandle {
|
|
378
|
+
update(options: Partial<MountAstralBeamMcpServersOptions>): void;
|
|
379
|
+
unmount(): void;
|
|
380
|
+
}
|
|
381
|
+
/** Unmount when the host's authenticated identity or management scope changes. */
|
|
382
|
+
export declare function mountAstralBeamMcpServers(target: HTMLElement, options: MountAstralBeamMcpServersOptions): AstralBeamMcpServersHandle;
|
|
334
383
|
//#endregion
|
|
335
384
|
//#region src/client/index.d.ts
|
|
336
|
-
declare function mountAstralBeamChat(target: HTMLElement, options: MountAstralBeamChatOptions): AstralBeamChatHandle;
|
|
385
|
+
export declare function mountAstralBeamChat(target: HTMLElement, options: MountAstralBeamChatOptions): AstralBeamChatHandle;
|
|
337
386
|
//#endregion
|
|
338
|
-
export {
|
|
387
|
+
export type { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatHandle, AstralBeamChatSlotRenderer, AstralBeamChatSlots, AstralBeamChatTheme, AstralBeamChatThemeVariables, AstralBeamChatUpdate, AstralBeamListingHandle, AstralBeamListingOptions, AstralBeamMcpServersHandle, AstralBeamTenantListHandle, AstralBeamTenantUserListHandle, AstralBeamThreadListHandle, AstralBeamTokenRequest, AstralBeamTokenSource, InferParameters, JsonSchemaObject, McpServerFormError, McpServerInput, McpServerItem, MountAstralBeamChatOptions, MountAstralBeamMcpServersOptions, MountAstralBeamTenantListOptions, MountAstralBeamTenantUserListOptions, MountAstralBeamThreadListOptions, ParametersSchema, StandardSchemaV1, ToolDefinition, TypedToolDefinition, TypedWidgetDefinition, WidgetDefinition };
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./constants-
|
|
1
|
+
import{s as e}from"./constants-C-Yp0Vhg.js";import{t}from"./debug-DLDY8CZb.js";function n(e,t,n,r){let i=n.colorScheme??`system`,a=i===`dark`||i===`system`&&r;e.classList.toggle(`dark`,a);for(let n of t)e.style.removeProperty(n);t.clear();let o={...n.theme?.light,...a?n.theme?.dark:void 0};for(let[n,r]of Object.entries(o))n.startsWith(`--`)&&(e.style.setProperty(n,r),t.add(n));return{colorScheme:i,dark:a}}function r(e){return e}function i(e){return e}function a(e,t){return c(e,t,`tenants`)}function o(e,t){return c(e,t,`users`)}function s(e,t){return c(e,t,`threads`)}function c(t,n,r){let i=t.shadowRoot??t.attachShadow({mode:`open`}),a=document.createElement(`div`);a.className=`${e} bg-transparent`,a.style.height=`100%`,i.append(a);let o=matchMedia(`(prefers-color-scheme: dark)`),s={options:{...n},kind:r,shadow:i,container:a,media:o,variables:/* @__PURE__ */ new Set,disposed:!1},c=()=>l(s);return c(),o.addEventListener(`change`,c),u(s),{update:e=>d(s,e),refresh:()=>{!s.disposed&&s.renderer&&s.runtime.refreshListing(s.renderer)},reset:()=>{!s.disposed&&s.renderer&&s.runtime.resetListing(s.renderer)},unmount:()=>f(s,c)}}function l({options:e,media:t,container:r,variables:i}){n(r,i,e,t.matches)}async function u(e){e.retryLoad?.remove();try{if(e.runtime=await import(`./listings-DzxJtGCD.js`),e.disposed)return;e.renderer=e.runtime.renderListing(e.shadow,e.container,e.options,e.kind)}catch{if(e.disposed)return;e.retryLoad=document.createElement(`button`),e.retryLoad.textContent=`Could not load directory. Retry`,e.retryLoad.onclick=()=>void u(e),e.container.append(e.retryLoad)}}function d(e,t){e.disposed||(e.options={...e.options,...t},l(e),e.renderer&&e.runtime.updateListing(e.renderer,e.options))}function f(e,t){e.disposed||(e.disposed=!0,e.media.removeEventListener(`change`,t),e.renderer&&e.runtime.disposeListing(e.renderer),e.container.remove())}function p(t,r){let i=t.shadowRoot??t.attachShadow({mode:`open`}),a=document.createElement(`div`);a.className=e,i.append(a);let o=matchMedia(`(prefers-color-scheme: dark)`),s=/* @__PURE__ */ new Set,c=r,l=!1,u,d=()=>n(a,s,c,o.matches);d(),o.addEventListener(`change`,d);let f=async()=>{a.replaceChildren();try{let{renderMcpServers:e}=await import(`./mcp-servers-ESbOt00F.js`);l||(u=e(a,c))}catch{if(l)return;let e=document.createElement(`button`);e.textContent=`Could not load MCP servers. Retry`,e.onclick=()=>void f(),a.replaceChildren(e)}};return f(),{update(e){l||(c={...c,...e},d(),u?.update(c))},unmount(){l=!0,o.removeEventListener(`change`,d),u?.unmount(),a.remove()}}}function m(r,i){let a={...i},o=t(a.debug);o?.(`mount`,`mounting chat widget`,{agentId:a.agentId??`(organization default)`,title:a.title??`AstralBeam`,showHeader:a.showHeader??!0,emptyHeadline:a.emptyHeadline??`Ask the assistant`,emptyDescription:a.emptyDescription??`Ask a question or describe what you want to do in this app.`,apiUrl:a.apiUrl??`https://astralbeam.ai/api`,authentication:`configured`,colorScheme:a.colorScheme??`system`,theme:a.theme,tools:Object.keys(a.tools??{}),widgets:Object.keys(a.widgets??{}),attachments:a.attachments??!0});let s=r.shadowRoot??r.attachShadow({mode:`open`}),c=document.createElement(`div`);c.className=e,c.style.height=`100%`,s.append(c);let l=matchMedia(`(prefers-color-scheme: dark)`),u=/* @__PURE__ */ new Set,d=()=>{let{colorScheme:e,dark:t}=n(c,u,a,l.matches);o?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...u]})};d(),l.addEventListener(`change`,d);let f=!1,p;return import(`./widget-DGmCPqzk.js`).then(({renderChat:e})=>{o?.(`mount`,`chat chunk loaded`),f||(p=e(s,c,a))}),{update:e=>{a={...a,...e},o=t(a.debug),o?.(`mount`,`options updated`,{changed:Object.keys(e)}),d(),p?.update(a)},reset:()=>p?.reset(),stop:()=>p?.stop(),unmount:()=>{o?.(`mount`,`unmounting chat widget`),f=!0,l.removeEventListener(`change`,d),p?.dispose(),p=void 0,c.remove()}}}export{r as defineTool,i as defineWidget,m as mountAstralBeamChat,p as mountAstralBeamMcpServers,a as mountAstralBeamTenantList,o as mountAstralBeamTenantUserList,s as mountAstralBeamThreadList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`AstralBeam`,t=`Ask the assistant`,n=`Ask a question or describe what you want to do in this app.`,r=`https://astralbeam.ai/api`,i=`/api/astralbeam/token`,a=`system`,o=`astralbeam-root`;export{t as a,n as i,i as n,e as o,a as r,o as s,r as t};
|