@astralbeam/sdk 0.30.4 → 0.30.6

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.
@@ -1 +1 @@
1
- import{Er as e,Gn as t,Or as n,Tr as r,jr as i,n as a,nt as o,qn as s,r as c,t as l}from"./styles.generated-BBScqnSk.js";import{a as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T}from"./item-U0ZPJBqA.js";import{n as E,t as D}from"./badge-Do9jhFNO.js";var O=/* @__PURE__ */ i(n(),1);const k=/* @__PURE__ */ new Map([[`bold`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),/* @__PURE__ */ O.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),A=O.forwardRef((e,t)=>/* @__PURE__ */ O.createElement(r,{ref:t,...e,weights:k}));A.displayName=`PlusIcon`;var j=e(),M=s();function N(e,t){let n=(0,j.createRoot)(e),r=e=>n.render(/* @__PURE__ */ (0,M.jsxs)(M.Fragment,{children:[/* @__PURE__ */ (0,M.jsx)(`style`,{children:l}),/* @__PURE__ */ (0,M.jsx)(c,{delay:400,children:/* @__PURE__ */ (0,M.jsx)(P,{...e})})]}));return r(t),{update:r,unmount:()=>n.unmount()}}function P(e){let[n,r]=(0,O.useState)(!1),[i,o]=(0,O.useState)(null),[s,c]=(0,O.useState)(!1),[l,d]=(0,O.useState)(``),f=async t=>{c(!0),d(``);try{await e.onRemoveServer?.(t),o(null)}catch(e){d(e instanceof Error?e.message:`Could not remove the server`)}finally{c(!1)}};return/* @__PURE__ */ (0,M.jsxs)(`section`,{className:`grid grid-cols-1 gap-2 bg-background text-foreground`,"data-slot":`mcp-servers`,children:[/* @__PURE__ */ (0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[/* @__PURE__ */ (0,M.jsx)(`h2`,{className:`font-heading text-sm font-medium`,children:`Configured MCP servers`}),e.onCreateServer&&!n&&/* @__PURE__ */ (0,M.jsxs)(t,{size:`sm`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,onClick:()=>r(!0),children:[/* @__PURE__ */ (0,M.jsx)(A,{}),` Add MCP server`]})]}),n&&e.onCreateServer&&/* @__PURE__ */ (0,M.jsx)(F,{oauthRedirectUri:e.oauthRedirectUri,save:e.onCreateServer,close:()=>r(!1)}),l&&/* @__PURE__ */ (0,M.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:l}),e.servers.length===0&&/* @__PURE__ */ (0,M.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-2.5 text-sm text-muted-foreground`,children:`No MCP servers are available.`}),/* @__PURE__ */ (0,M.jsx)(`div`,{className:`divide-y rounded-lg border bg-card text-card-foreground empty:hidden`,children:e.servers.map(n=>/* @__PURE__ */ (0,M.jsxs)(w,{render:/* @__PURE__ */ (0,M.jsx)(`article`,{}),size:`xs`,className:`rounded-none border-0 py-1.5`,children:[/* @__PURE__ */ (0,M.jsx)(u,{variant:`icon`,className:`text-muted-foreground`,children:/* @__PURE__ */ (0,M.jsx)(m,{"aria-hidden":!0})}),/* @__PURE__ */ (0,M.jsxs)(S,{className:`min-w-0`,children:[/* @__PURE__ */ (0,M.jsx)(`h3`,{className:`truncate text-sm font-medium`,children:new URL(n.endpointUrl).hostname}),/* @__PURE__ */ (0,M.jsx)(g,{className:`line-clamp-none truncate`,title:n.endpointUrl,children:n.endpointUrl})]}),/* @__PURE__ */ (0,M.jsxs)(y,{children:[/* @__PURE__ */ (0,M.jsx)(D,{variant:`secondary`,children:n.authKind?{none:`Public`,oauth:`OAuth`,static_headers:`API key`}[n.authKind]:`Unavailable`}),e.onRemoveServer&&/* @__PURE__ */ (0,M.jsx)(a,{variant:`ghost`,size:`icon-sm`,disabled:s,"aria-label":`Remove server: ${new URL(n.endpointUrl).hostname}`,tooltip:`Remove server`,onClick:()=>{d(``),o(n.id)},children:/* @__PURE__ */ (0,M.jsx)(h,{})})]}),i===n.id&&e.onRemoveServer&&/* @__PURE__ */ (0,M.jsxs)(`div`,{className:`grid basis-full gap-2 text-sm`,role:`group`,"aria-label":`Remove server?`,children:[/* @__PURE__ */ (0,M.jsx)(`p`,{children:`Remove this server and its connections? People will need to connect again if it is added later.`}),/* @__PURE__ */ (0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[/* @__PURE__ */ (0,M.jsx)(t,{size:`xs`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,variant:`outline`,disabled:s,onClick:()=>o(null),children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{size:`xs`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,variant:`destructive`,disabled:s,onClick:()=>void f(n.id),children:`Remove server`})]})]})]},n.id))})]})}function F({oauthRedirectUri:e,save:n,close:r}){let i=(0,O.useId)(),[a,s]=(0,O.useState)(`none`),[c,l]=(0,O.useState)(`automatic`),[u,m]=(0,O.useState)([]),[h,g]=(0,O.useState)(``),[y,S]=(0,O.useState)(!1),w=(e,t,{description:n,...r}={})=>{let a=u.filter(t=>t.field===e);return/* @__PURE__ */ (0,M.jsxs)(b,{className:`gap-1`,"data-invalid":a.length>0,children:[/* @__PURE__ */ (0,M.jsx)(_,{htmlFor:`${i}-${e}`,className:`text-xs`,children:t}),/* @__PURE__ */ (0,M.jsx)(o,{id:`${i}-${e}`,name:e,"aria-invalid":a.length>0,"aria-describedby":[n&&`${i}-${e}-help`,a.length>0&&`${i}-${e}-error`].filter(Boolean).join(` `)||void 0,...r}),n&&/* @__PURE__ */ (0,M.jsx)(C,{id:`${i}-${e}-help`,className:`text-xs nth-last-2:mt-0`,children:n}),a.length>0&&/* @__PURE__ */ (0,M.jsx)(d,{id:`${i}-${e}-error`,className:`text-xs`,children:a.map(e=>e.message).join(`. `)})]})},D=async e=>{e.preventDefault();let t=new FormData(e.currentTarget),i=e=>(t.get(e)??``).trim(),o=a===`none`?{kind:`none`}:a===`static_headers`?{kind:`static_headers`,headerNames:i(`headerNames`).split(`,`).map(e=>e.trim()).filter(Boolean)}:{kind:`oauth`,profile:`standard`,requestedScopes:i(`requestedScopes`).split(/\s+/).filter(Boolean),...i(`applicationOrigin`)?{applicationOrigin:i(`applicationOrigin`)}:{},...c===`automatic`?{}:{client:{issuer:i(`issuer`),clientId:i(`clientId`),...t.get(`clientSecret`)?{clientSecret:t.get(`clientSecret`)}:{}}}};S(!0),g(``),m([]);try{let e=await n({endpointUrl:i(`endpointUrl`),authConfig:o});e?.errors.length?m(e.errors):r()}catch(e){g(e instanceof Error?e.message:`Could not add the server`)}finally{S(!1)}};return/* @__PURE__ */ (0,M.jsx)(`form`,{"aria-label":`Add MCP server`,onSubmit:e=>void D(e),onChange:()=>{m([]),g(``)},children:/* @__PURE__ */ (0,M.jsx)(`fieldset`,{className:`min-w-0`,disabled:y,children:/* @__PURE__ */ (0,M.jsxs)(T,{size:`sm`,className:`gap-2.5 text-xs`,children:[/* @__PURE__ */ (0,M.jsx)(x,{children:/* @__PURE__ */ (0,M.jsx)(v,{className:`text-sm`,children:`Add MCP server`})}),/* @__PURE__ */ (0,M.jsxs)(f,{className:`grid grid-cols-1 gap-2.5 [&_[data-slot=input]]:text-xs [&_[data-slot=native-select]]:text-xs any-pointer-coarse:[&_input]:min-h-11 any-pointer-coarse:[&_[data-slot=input]]:text-base any-pointer-coarse:[&_[data-slot=native-select]]:text-base any-pointer-coarse:[&_select]:min-h-11`,children:[w(`endpointUrl`,`Server URL`,{type:`url`,autoFocus:!0,required:!0,maxLength:2048,placeholder:`https://mcp.example.com/mcp`,description:`Public HTTPS endpoint using Streamable HTTP.`}),/* @__PURE__ */ (0,M.jsxs)(b,{className:`gap-1`,children:[/* @__PURE__ */ (0,M.jsx)(_,{className:`text-xs`,htmlFor:`${i}-authentication`,children:`Authentication`}),/* @__PURE__ */ (0,M.jsxs)(E,{id:`${i}-authentication`,value:a,onChange:e=>s(e.currentTarget.value),children:[/* @__PURE__ */ (0,M.jsx)(`option`,{value:`none`,children:`No authentication`}),/* @__PURE__ */ (0,M.jsx)(`option`,{value:`static_headers`,children:`API key / headers`}),/* @__PURE__ */ (0,M.jsx)(`option`,{value:`oauth`,children:`OAuth`})]})]}),a===`static_headers`&&w(`headerNames`,`Header names, comma separated`,{required:!0,placeholder:`Authorization, X-Api-Key`,description:`Values are entered when creating a connection.`}),a===`oauth`&&/* @__PURE__ */ (0,M.jsxs)(M.Fragment,{children:[/* @__PURE__ */ (0,M.jsxs)(b,{className:`gap-1`,children:[/* @__PURE__ */ (0,M.jsx)(_,{className:`text-xs`,htmlFor:`${i}-oauth-setup`,children:`OAuth setup`}),/* @__PURE__ */ (0,M.jsxs)(E,{id:`${i}-oauth-setup`,value:c,onChange:e=>l(e.currentTarget.value),children:[/* @__PURE__ */ (0,M.jsx)(`option`,{value:`automatic`,children:`Automatic discovery`}),/* @__PURE__ */ (0,M.jsx)(`option`,{value:`manual`,children:`Pre-registered application`})]})]}),w(`applicationOrigin`,`Application origin, optional`,{type:`url`,maxLength:2048,placeholder:`https://app.example.com`,description:`Allow OAuth from this embedded application's origin. The dashboard origin is always allowed.`}),w(`requestedScopes`,`Requested scopes, optional`),c!==`automatic`&&/* @__PURE__ */ (0,M.jsxs)(M.Fragment,{children:[w(`redirectUri`,`Redirect URI`,{value:e??`Configure the application URL first`,readOnly:!0,onFocus:e=>e.currentTarget.select()}),w(`issuer`,`Authorization server issuer`,{type:`url`,required:!0,maxLength:2048,placeholder:`https://auth.example.com`,description:`Use the trusted issuer from your application's OAuth provider.`}),w(`clientId`,`Client ID`,{required:!0,maxLength:2048}),w(`clientSecret`,`Client secret`,{type:`password`,autoComplete:`off`,maxLength:8192})]})]}),/* @__PURE__ */ (0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`To change the endpoint or authentication later, remove and add the server again.`}),h&&/* @__PURE__ */ (0,M.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:h})]}),/* @__PURE__ */ (0,M.jsxs)(p,{className:`justify-end gap-2 bg-card py-2`,children:[/* @__PURE__ */ (0,M.jsx)(t,{type:`button`,size:`sm`,variant:`outline`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,onClick:r,children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{type:`submit`,size:`sm`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,children:y?`Saving…`:`Add MCP server`})]})]})})})}export{N as renderMcpServers};
1
+ import{Er as e,Gn as t,Or as n,Tr as r,jr as i,n as a,nt as o,qn as s,r as c,t as l}from"./styles.generated-BrC_vo9p.js";import{a as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T}from"./item-D7P71wsB.js";import{n as E,t as D}from"./badge-C5nSyoPM.js";var O=/* @__PURE__ */ i(n(),1);const k=/* @__PURE__ */ new Map([[`bold`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),/* @__PURE__ */ O.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,/* @__PURE__ */ O.createElement(O.Fragment,null,/* @__PURE__ */ O.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),A=O.forwardRef((e,t)=>/* @__PURE__ */ O.createElement(r,{ref:t,...e,weights:k}));A.displayName=`PlusIcon`;var j=e(),M=s();function N(e,t){let n=(0,j.createRoot)(e),r=e=>n.render(/* @__PURE__ */ (0,M.jsxs)(M.Fragment,{children:[/* @__PURE__ */ (0,M.jsx)(`style`,{children:l}),/* @__PURE__ */ (0,M.jsx)(c,{delay:400,children:/* @__PURE__ */ (0,M.jsx)(P,{...e})})]}));return r(t),{update:r,unmount:()=>n.unmount()}}function P(e){let[n,r]=(0,O.useState)(!1),[i,o]=(0,O.useState)(null),[s,c]=(0,O.useState)(!1),[l,d]=(0,O.useState)(``),f=async t=>{c(!0),d(``);try{await e.onRemoveServer?.(t),o(null)}catch(e){d(e instanceof Error?e.message:`Could not remove the server`)}finally{c(!1)}};return/* @__PURE__ */ (0,M.jsxs)(`section`,{className:`grid grid-cols-1 gap-2 bg-background text-foreground`,"data-slot":`mcp-servers`,children:[/* @__PURE__ */ (0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[/* @__PURE__ */ (0,M.jsx)(`h2`,{className:`font-heading text-sm font-medium`,children:`Configured MCP servers`}),e.onCreateServer&&!n&&/* @__PURE__ */ (0,M.jsxs)(t,{size:`sm`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,onClick:()=>r(!0),children:[/* @__PURE__ */ (0,M.jsx)(A,{}),` Add MCP server`]})]}),n&&e.onCreateServer&&/* @__PURE__ */ (0,M.jsx)(F,{oauthRedirectUri:e.oauthRedirectUri,save:e.onCreateServer,close:()=>r(!1)}),l&&/* @__PURE__ */ (0,M.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:l}),e.servers.length===0&&/* @__PURE__ */ (0,M.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-2.5 text-sm text-muted-foreground`,children:`No MCP servers are available.`}),/* @__PURE__ */ (0,M.jsx)(`div`,{className:`divide-y rounded-lg border bg-card text-card-foreground empty:hidden`,children:e.servers.map(n=>/* @__PURE__ */ (0,M.jsxs)(w,{render:/* @__PURE__ */ (0,M.jsx)(`article`,{}),size:`xs`,className:`rounded-none border-0 py-1.5`,children:[/* @__PURE__ */ (0,M.jsx)(u,{variant:`icon`,className:`text-muted-foreground`,children:/* @__PURE__ */ (0,M.jsx)(m,{"aria-hidden":!0})}),/* @__PURE__ */ (0,M.jsxs)(S,{className:`min-w-0`,children:[/* @__PURE__ */ (0,M.jsx)(`h3`,{className:`truncate text-sm font-medium`,children:new URL(n.endpointUrl).hostname}),/* @__PURE__ */ (0,M.jsx)(g,{className:`line-clamp-none truncate`,title:n.endpointUrl,children:n.endpointUrl})]}),/* @__PURE__ */ (0,M.jsxs)(y,{children:[/* @__PURE__ */ (0,M.jsx)(D,{variant:`secondary`,children:n.authKind?{none:`Public`,oauth:`OAuth`,static_headers:`API key`}[n.authKind]:`Unavailable`}),e.onRemoveServer&&/* @__PURE__ */ (0,M.jsx)(a,{variant:`ghost`,size:`icon-sm`,disabled:s,"aria-label":`Remove server: ${new URL(n.endpointUrl).hostname}`,tooltip:`Remove server`,onClick:()=>{d(``),o(n.id)},children:/* @__PURE__ */ (0,M.jsx)(h,{})})]}),i===n.id&&e.onRemoveServer&&/* @__PURE__ */ (0,M.jsxs)(`div`,{className:`grid basis-full gap-2 text-sm`,role:`group`,"aria-label":`Remove server?`,children:[/* @__PURE__ */ (0,M.jsx)(`p`,{children:`Remove this server and its connections? People will need to connect again if it is added later.`}),/* @__PURE__ */ (0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[/* @__PURE__ */ (0,M.jsx)(t,{size:`xs`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,variant:`outline`,disabled:s,onClick:()=>o(null),children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{size:`xs`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,variant:`destructive`,disabled:s,onClick:()=>void f(n.id),children:`Remove server`})]})]})]},n.id))})]})}function F({oauthRedirectUri:e,save:n,close:r}){let i=(0,O.useId)(),[a,s]=(0,O.useState)(`none`),[c,l]=(0,O.useState)(`automatic`),[u,m]=(0,O.useState)([]),[h,g]=(0,O.useState)(``),[y,S]=(0,O.useState)(!1),w=(e,t,{description:n,...r}={})=>{let a=u.filter(t=>t.field===e);return/* @__PURE__ */ (0,M.jsxs)(b,{className:`gap-1`,"data-invalid":a.length>0,children:[/* @__PURE__ */ (0,M.jsx)(_,{htmlFor:`${i}-${e}`,className:`text-xs`,children:t}),/* @__PURE__ */ (0,M.jsx)(o,{id:`${i}-${e}`,name:e,"aria-invalid":a.length>0,"aria-describedby":[n&&`${i}-${e}-help`,a.length>0&&`${i}-${e}-error`].filter(Boolean).join(` `)||void 0,...r}),n&&/* @__PURE__ */ (0,M.jsx)(C,{id:`${i}-${e}-help`,className:`text-xs nth-last-2:mt-0`,children:n}),a.length>0&&/* @__PURE__ */ (0,M.jsx)(d,{id:`${i}-${e}-error`,className:`text-xs`,children:a.map(e=>e.message).join(`. `)})]})},D=async e=>{e.preventDefault();let t=new FormData(e.currentTarget),i=e=>(t.get(e)??``).trim(),o=a===`none`?{kind:`none`}:a===`static_headers`?{kind:`static_headers`,headerNames:i(`headerNames`).split(`,`).map(e=>e.trim()).filter(Boolean)}:{kind:`oauth`,profile:`standard`,requestedScopes:i(`requestedScopes`).split(/\s+/).filter(Boolean),...i(`applicationOrigin`)?{applicationOrigin:i(`applicationOrigin`)}:{},...c===`automatic`?{}:{client:{issuer:i(`issuer`),clientId:i(`clientId`),...t.get(`clientSecret`)?{clientSecret:t.get(`clientSecret`)}:{}}}};S(!0),g(``),m([]);try{let e=await n({endpointUrl:i(`endpointUrl`),authConfig:o});e?.errors.length?m(e.errors):r()}catch(e){g(e instanceof Error?e.message:`Could not add the server`)}finally{S(!1)}};return/* @__PURE__ */ (0,M.jsx)(`form`,{"aria-label":`Add MCP server`,onSubmit:e=>void D(e),onChange:()=>{m([]),g(``)},children:/* @__PURE__ */ (0,M.jsx)(`fieldset`,{className:`min-w-0`,disabled:y,children:/* @__PURE__ */ (0,M.jsxs)(T,{size:`sm`,className:`gap-2.5 text-xs`,children:[/* @__PURE__ */ (0,M.jsx)(x,{children:/* @__PURE__ */ (0,M.jsx)(v,{className:`text-sm`,children:`Add MCP server`})}),/* @__PURE__ */ (0,M.jsxs)(f,{className:`grid grid-cols-1 gap-2.5 [&_[data-slot=input]]:text-xs [&_[data-slot=native-select]]:text-xs any-pointer-coarse:[&_input]:min-h-11 any-pointer-coarse:[&_[data-slot=input]]:text-base any-pointer-coarse:[&_[data-slot=native-select]]:text-base any-pointer-coarse:[&_select]:min-h-11`,children:[w(`endpointUrl`,`Server URL`,{type:`url`,autoFocus:!0,required:!0,maxLength:2048,placeholder:`https://mcp.example.com/mcp`,description:`Public HTTPS endpoint using Streamable HTTP.`}),/* @__PURE__ */ (0,M.jsxs)(b,{className:`gap-1`,children:[/* @__PURE__ */ (0,M.jsx)(_,{className:`text-xs`,htmlFor:`${i}-authentication`,children:`Authentication`}),/* @__PURE__ */ (0,M.jsxs)(E,{id:`${i}-authentication`,value:a,onChange:e=>s(e.currentTarget.value),children:[/* @__PURE__ */ (0,M.jsx)(`option`,{value:`none`,children:`No authentication`}),/* @__PURE__ */ (0,M.jsx)(`option`,{value:`static_headers`,children:`API key / headers`}),/* @__PURE__ */ (0,M.jsx)(`option`,{value:`oauth`,children:`OAuth`})]})]}),a===`static_headers`&&w(`headerNames`,`Header names, comma separated`,{required:!0,placeholder:`Authorization, X-Api-Key`,description:`Values are entered when creating a connection.`}),a===`oauth`&&/* @__PURE__ */ (0,M.jsxs)(M.Fragment,{children:[/* @__PURE__ */ (0,M.jsxs)(b,{className:`gap-1`,children:[/* @__PURE__ */ (0,M.jsx)(_,{className:`text-xs`,htmlFor:`${i}-oauth-setup`,children:`OAuth setup`}),/* @__PURE__ */ (0,M.jsxs)(E,{id:`${i}-oauth-setup`,value:c,onChange:e=>l(e.currentTarget.value),children:[/* @__PURE__ */ (0,M.jsx)(`option`,{value:`automatic`,children:`Automatic discovery`}),/* @__PURE__ */ (0,M.jsx)(`option`,{value:`manual`,children:`Pre-registered application`})]})]}),w(`applicationOrigin`,`Application origin, optional`,{type:`url`,maxLength:2048,placeholder:`https://app.example.com`,description:`Allow OAuth from this embedded application's origin. The dashboard origin is always allowed.`}),w(`requestedScopes`,`Requested scopes, optional`),c!==`automatic`&&/* @__PURE__ */ (0,M.jsxs)(M.Fragment,{children:[w(`redirectUri`,`Redirect URI`,{value:e??`Configure the application URL first`,readOnly:!0,onFocus:e=>e.currentTarget.select()}),w(`issuer`,`Authorization server issuer`,{type:`url`,required:!0,maxLength:2048,placeholder:`https://auth.example.com`,description:`Use the trusted issuer from your application's OAuth provider.`}),w(`clientId`,`Client ID`,{required:!0,maxLength:2048}),w(`clientSecret`,`Client secret`,{type:`password`,autoComplete:`off`,maxLength:8192})]})]}),/* @__PURE__ */ (0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`To change the endpoint or authentication later, remove and add the server again.`}),h&&/* @__PURE__ */ (0,M.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:h})]}),/* @__PURE__ */ (0,M.jsxs)(p,{className:`justify-end gap-2 bg-card py-2`,children:[/* @__PURE__ */ (0,M.jsx)(t,{type:`button`,size:`sm`,variant:`outline`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,onClick:r,children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{type:`submit`,size:`sm`,className:`any-pointer-coarse:min-h-11 any-pointer-coarse:min-w-11`,children:y?`Saving…`:`Add MCP server`})]})]})})})}export{N as renderMcpServers};
package/dist/react.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { D as AstralBeamChatState, E as AstralBeamChatCoreOptions, T as AstralBeamChatCore } from "./index-COWV2LM7.js";
1
+ import { D as AstralBeamChatState, E as AstralBeamChatCoreOptions, T as AstralBeamChatCore } from "./index-b-MbK0XS.js";
2
2
  import { CSSProperties, ReactNode } from "react";
3
3
  import { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatTheme, AstralBeamListingHandle, AstralBeamTokenRequest, AstralBeamTokenSource, InferParameters, JsonSchemaObject, MountAstralBeamChatOptions, MountAstralBeamMcpServersOptions, MountAstralBeamTenantListOptions, MountAstralBeamTenantUserListOptions, MountAstralBeamThreadListOptions, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
4
- //#region src/react/listings.d.ts
5
4
  type ContainerProps = {
6
5
  className?: string | undefined;
7
6
  style?: CSSProperties | undefined;
@@ -17,16 +16,12 @@ export declare const AstralBeamTenantList: import("react").ForwardRefExoticCompo
17
16
  export declare const AstralBeamTenantUserList: import("react").ForwardRefExoticComponent<MountAstralBeamTenantUserListOptions & ContainerProps & import("react").RefAttributes<AstralBeamListingRef>>;
18
17
  type AstralBeamThreadListProps = MountAstralBeamThreadListOptions & ContainerProps;
19
18
  export declare const AstralBeamThreadList: import("react").ForwardRefExoticComponent<MountAstralBeamThreadListOptions & ContainerProps & import("react").RefAttributes<AstralBeamListingRef>>;
20
- //#endregion
21
- //#region src/react/mcp-servers.d.ts
22
19
  type AstralBeamMcpServersProps = MountAstralBeamMcpServersOptions & {
23
20
  className?: string | undefined;
24
21
  style?: CSSProperties | undefined;
25
22
  };
26
23
  /** Key by the authenticated identity and management scope to clear pending form values. */
27
24
  export declare function AstralBeamMcpServers({ className, style, servers, oauthRedirectUri, onCreateServer, onRemoveServer, colorScheme, theme }: AstralBeamMcpServersProps): import("react").JSX.Element;
28
- //#endregion
29
- //#region src/react/index.d.ts
30
25
  export interface WidgetDefinition extends Omit<WidgetDefinition$1, "render"> {
31
26
  /** Draws the widget with the agent-chosen props, in the host's own React tree. */
32
27
  render: (props: Record<string, unknown>) => ReactNode;
@@ -60,5 +55,4 @@ export interface AstralBeamChatProps extends Omit<MountAstralBeamChatOptions, "w
60
55
  composerActions?: ReactNode;
61
56
  }
62
57
  export declare function AstralBeamChat({ chat, id, agentId, threadId, placementKey, title, showHeader, resizable, defaultWidth, resizeContainer, onClose, showConversationTitle, header, headerActions, empty, composerActions, emptyHeadline, emptyDescription, apiUrl, fetchAstralBeamToken, tools, widgets, colorScheme, theme, customCss, attachments, sandboxPanel, debug }: AstralBeamChatProps): import("react").JSX.Element;
63
- //#endregion
64
58
  export { type AstralBeamChatAttachmentOptions, type AstralBeamChatColorScheme, type AstralBeamChatCore, type AstralBeamChatCoreOptions, type AstralBeamChatState, type AstralBeamChatTheme, type AstralBeamMcpServersProps, type AstralBeamTenantListProps, type AstralBeamTenantListRef, type AstralBeamTenantUserListProps, type AstralBeamTenantUserListRef, type AstralBeamThreadListProps, type AstralBeamThreadListRef, type AstralBeamTokenRequest, type AstralBeamTokenSource, type InferParameters, type ParametersSchema, type ToolDefinition, defineTool };
package/dist/react.js CHANGED
@@ -1,10 +1,10 @@
1
- import { n as CORE_OPTION_KEYS, r as createAstralBeamChat } from "./core-BJ_Td5TR.js";
2
- import { Kt as DEFAULT_COLOR_SCHEME } from "./api-CzXKVU8Z.js";
1
+ import { Kt as DEFAULT_COLOR_SCHEME } from "./api-CHFaeV-i.js";
2
+ import { n as CORE_OPTION_KEYS, r as createAstralBeamChat } from "./core-DJGoi0HX.js";
3
3
  import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { defineTool, mountAstralBeamChat, mountAstralBeamMcpServers, mountAstralBeamTenantList, mountAstralBeamTenantUserList, mountAstralBeamThreadList } from "@astralbeam/sdk/client";
6
6
  import { createPortal } from "react-dom";
7
- //#region src/react/listings.tsx
7
+ // src/react/listings.tsx
8
8
  const AstralBeamTenantList = forwardRef(function AstralBeamTenantList({ className, style, ...options }, ref) {
9
9
  const target = useListingMount(mountAstralBeamTenantList, options, ref);
10
10
  return /* @__PURE__ */ jsx("div", {
@@ -32,10 +32,11 @@ const AstralBeamThreadList = forwardRef(function AstralBeamThreadList({ classNam
32
32
  function useListingMount(mount, options, ref) {
33
33
  const target = useRef(null);
34
34
  const handle = useRef(null);
35
- const { apiUrl, cacheKey, fetchAstralBeamToken, scope, tenantId, tenantExternalId, showAdmin, pageSize, title, showHeader, customCss, colorScheme, theme, onError, onTenantChange, onTenantSelect, onTenantUserSelect } = options;
35
+ const { apiUrl, cacheKey, revalidateOnMount, fetchAstralBeamToken, scope, tenantId, tenantExternalId, showAdmin, pageSize, title, showHeader, customCss, colorScheme, theme, onError, onTenantChange, onTenantSelect, onTenantUserSelect } = options;
36
36
  const live = useMemo(() => ({
37
37
  apiUrl,
38
38
  cacheKey,
39
+ revalidateOnMount,
39
40
  fetchAstralBeamToken,
40
41
  scope,
41
42
  tenantId,
@@ -54,6 +55,7 @@ function useListingMount(mount, options, ref) {
54
55
  }), [
55
56
  apiUrl,
56
57
  cacheKey,
58
+ revalidateOnMount,
57
59
  fetchAstralBeamToken,
58
60
  scope,
59
61
  tenantId,
@@ -92,8 +94,7 @@ function useListingMount(mount, options, ref) {
92
94
  }, []);
93
95
  return target;
94
96
  }
95
- //#endregion
96
- //#region src/react/mcp-servers.tsx
97
+ // src/react/mcp-servers.tsx
97
98
  /** Key by the authenticated identity and management scope to clear pending form values. */
98
99
  function AstralBeamMcpServers({ className, style, servers, oauthRedirectUri, onCreateServer, onRemoveServer, colorScheme, theme }) {
99
100
  const options = {
@@ -125,8 +126,7 @@ function AstralBeamMcpServers({ className, style, servers, oauthRedirectUri, onC
125
126
  style
126
127
  });
127
128
  }
128
- //#endregion
129
- //#region src/react/index.tsx
129
+ // src/react/index.tsx
130
130
  /** Declares a host widget; a Standard Schema `parameters` types (and validates) `render`'s props. */
131
131
  function defineWidget(widget) {
132
132
  return widget;
@@ -283,5 +283,4 @@ function AstralBeamChat({ chat, id, agentId, threadId, placementKey, title, show
283
283
  }), [...chromeContainers].map(([name, container]) => createPortal(chromeContent[name], container, `astralbeam-chrome-${name}`))]
284
284
  });
285
285
  }
286
- //#endregion
287
286
  export { AstralBeamChat, AstralBeamMcpServers, AstralBeamTenantList, AstralBeamTenantUserList, AstralBeamThreadList, defineTool, defineWidget, useAstralBeamChat };
package/dist/server.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/server/index.d.ts
2
1
  export declare const CHAT_AUTH_TOKEN_AUDIENCE = "astralbeam";
3
2
  export declare const CHAT_AUTH_TOKEN_TYPE = "astralbeam+jwt";
4
3
  export declare const CHAT_AUTH_TOKEN_VERSION = 4;
@@ -46,5 +45,4 @@ export interface CreateAstralBeamOrganizationTokenOptions {
46
45
  /** Delegates a member's current database permissions. Does not restrict the API-key holder's authority. */
47
46
  export declare function createAstralBeamOrganizationToken({ apiKey, email, organizationId, expiresInSeconds }: CreateAstralBeamOrganizationTokenOptions): Promise<string>;
48
47
  /** Creates the short-lived bearer token returned by an application's server auth endpoint. */
49
- export declare function createAstralBeamToken<TTenantUser extends TenantUser = TenantUser, TTenant extends Tenant = Tenant>({ apiKey, user, tenant, usageLimits, expiresInSeconds }: CreateAstralBeamTokenOptions<TTenantUser, TTenant>): Promise<string>;
50
- //#endregion
48
+ export declare function createAstralBeamToken<TTenantUser extends TenantUser = TenantUser, TTenant extends Tenant = Tenant>({ apiKey, user, tenant, usageLimits, expiresInSeconds }: CreateAstralBeamTokenOptions<TTenantUser, TTenant>): Promise<string>;
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as serializeJoseHeader, c as validateCritDuplicates, d as JOSENotSupported, f as JWSInvalid, g as encoder, h as encode$1, i as isObject, l as decode, m as concat, n as assertNotSet, o as validateB64, p as JWTInvalid, r as isDisjoint, s as validateCrit, t as JWS_RECOGNIZED, u as encode } from "./validate-lNXZvCeQ.js";
2
- //#region ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/key.js
1
+ import { a as serializeJoseHeader, c as validateCritDuplicates, d as JOSENotSupported, f as JWSInvalid, g as encoder, h as encode$1, i as isObject, l as decode, m as concat, n as assertNotSet, o as validateB64, p as JWTInvalid, r as isDisjoint, s as validateCrit, t as JWS_RECOGNIZED, u as encode } from "./validate-DB08s2p8.js";
2
+ // ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/key.js
3
3
  const tag = (key) => key[Symbol.toStringTag];
4
4
  const jwkMatchesOp = (entry, key, usage) => {
5
5
  const { alg } = entry;
@@ -127,8 +127,7 @@ async function jwkToKey(entry, jwk, extractable) {
127
127
  async function rawKey(key, expected, usage, extractable = !1) {
128
128
  return key instanceof Uint8Array && (key = await crypto.subtle.importKey("raw", key, expected, extractable, [usage])), checkCryptoKey(key, expected, usage), key;
129
129
  }
130
- //#endregion
131
- //#region ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/key_descriptor.js
130
+ // ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/key_descriptor.js
132
131
  function table(entries) {
133
132
  const out = { __proto__: null };
134
133
  for (const alg in entries) out[alg] = {
@@ -137,8 +136,7 @@ function table(entries) {
137
136
  };
138
137
  return out;
139
138
  }
140
- //#endregion
141
- //#region ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/jws_algorithms.js
139
+ // ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/jws_algorithms.js
142
140
  const sig = [["verify"], ["sign"]];
143
141
  function hmac(bits) {
144
142
  const subtle = {
@@ -227,8 +225,7 @@ function jwsAlgorithm(alg) {
227
225
  if (!entry) throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
228
226
  return entry;
229
227
  }
230
- //#endregion
231
- //#region ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
228
+ // ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
232
229
  const epoch = (date) => Math.floor(date.getTime() / 1e3);
233
230
  const multipliers = {
234
231
  s: 1,
@@ -306,8 +303,7 @@ var JWTClaimsBuilder = class {
306
303
  return value === void 0 ? claimsSet.iat = epoch(/* @__PURE__ */ new Date()) : typeof value == "string" ? claimsSet.iat = validateInput("setIssuedAt", epoch(/* @__PURE__ */ new Date()) + secs(value)) : claimsSet.iat = numericDate(value, "setIssuedAt"), this;
307
304
  }
308
305
  };
309
- //#endregion
310
- //#region ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/jws_sign.js
306
+ // ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/lib/jws_sign.js
311
307
  async function createSignature(input, key, rejectUnencoded) {
312
308
  let [payload, protectedHeader, unprotectedHeader, crit] = input, encodedProtectedHeader = "";
313
309
  if (protectedHeader !== void 0) {
@@ -349,8 +345,7 @@ async function createCompactSignature(payload, protectedHeader, crit, key, rejec
349
345
  ], key, rejectUnencoded);
350
346
  return `${jws.protected}.${jws.payload}.${jws.signature}`;
351
347
  }
352
- //#endregion
353
- //#region ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/jwt/sign.js
348
+ // ../node_modules/.bun/jose@6.2.15/node_modules/jose/dist/webapi/jwt/sign.js
354
349
  const SignJWT_base = JWTClaimsBuilder;
355
350
  var SignJWT = class extends SignJWT_base {
356
351
  #protectedHeader;
@@ -363,8 +358,7 @@ var SignJWT = class extends SignJWT_base {
363
358
  });
364
359
  }
365
360
  };
366
- //#endregion
367
- //#region src/server/index.ts
361
+ // src/server/index.ts
368
362
  const CHAT_AUTH_TOKEN_AUDIENCE = "astralbeam";
369
363
  const CHAT_AUTH_TOKEN_TYPE = "astralbeam+jwt";
370
364
  const CHAT_AUTH_TOKEN_VERSION = 4;
@@ -471,5 +465,4 @@ async function createAstralBeamToken({ apiKey, user, tenant, usageLimits, expire
471
465
  if (textEncoder.encode(token).byteLength > CHAT_AUTH_TOKEN_MAX_BYTES) throw new Error(`chat auth tokens must not exceed ${CHAT_AUTH_TOKEN_MAX_BYTES} bytes`);
472
466
  return token;
473
467
  }
474
- //#endregion
475
468
  export { CHAT_AUTH_TOKEN_AUDIENCE, CHAT_AUTH_TOKEN_LIFETIME_SECONDS, CHAT_AUTH_TOKEN_MAX_LIFETIME_SECONDS, CHAT_AUTH_TOKEN_TYPE, CHAT_AUTH_TOKEN_VERSION, createAstralBeamOrganizationToken, createAstralBeamToken };