@astralbeam/sdk 0.19.1 → 0.20.1

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-D4k7izMB.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-a9y_9nk7.js";import{n as E,t as D}from"./badge-B9WuChHI.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-9`,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-9`,variant:`outline`,disabled:s,onClick:()=>o(null),children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{size:`xs`,className:`any-pointer-coarse:min-h-9`,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:{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(`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-9`,onClick:r,children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{type:`submit`,size:`sm`,className:`any-pointer-coarse:min-h-9`,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-DUb9y6Qp.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-BzAQVqAa.js";import{n as E,t as D}from"./badge-CCWjBUs7.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-9`,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-9`,variant:`outline`,disabled:s,onClick:()=>o(null),children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{size:`xs`,className:`any-pointer-coarse:min-h-9`,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:{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(`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-9`,onClick:r,children:`Cancel`}),/* @__PURE__ */ (0,M.jsx)(t,{type:`submit`,size:`sm`,className:`any-pointer-coarse:min-h-9`,children:y?`Saving…`:`Add MCP server`})]})]})})})}export{N as renderMcpServers};
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { At as TenantUserRecordEncoded, Dt as TenantRecordEncoded } from "./index-DFxtXIXy.js";
2
- import { D as AstralBeamChatState, E as AstralBeamChatCoreOptions, G as AstralBeamChatColorScheme$1, K as AstralBeamChatTheme$1, T as AstralBeamChatCore, q as AstralBeamTokenSource$1 } from "./index-DDfmeUeU.js";
2
+ import { D as AstralBeamChatState, E as AstralBeamChatCoreOptions, J as AstralBeamTokenSource$1, K as AstralBeamChatColorScheme$1, T as AstralBeamChatCore, q as AstralBeamChatTheme$1 } from "./index-Bgv7DalS.js";
3
3
  import { CSSProperties, ReactNode } from "react";
4
4
  import { AstralBeamChatAttachmentOptions, AstralBeamChatColorScheme, AstralBeamChatTheme, AstralBeamTenantListHandle as AstralBeamTenantListHandle$1, AstralBeamTenantUserListHandle as AstralBeamTenantUserListHandle$1, AstralBeamThreadListHandle as AstralBeamThreadListHandle$1, AstralBeamTokenRequest, AstralBeamTokenSource, InferParameters, JsonSchemaObject, MountAstralBeamChatOptions, MountAstralBeamMcpServersOptions, MountAstralBeamTenantListOptions, MountAstralBeamTenantUserListOptions, MountAstralBeamThreadListOptions, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
5
5
  //#region src/react/listings.d.ts
@@ -86,6 +86,7 @@ export declare function defineWidget<const S extends ParametersSchema = JsonSche
86
86
  /** Everything `useAstralBeamChat` returns: the live state plus the session's actions. */
87
87
  export interface UseAstralBeamChatResult extends AstralBeamChatState {
88
88
  sendMessage: AstralBeamChatCore["sendMessage"];
89
+ retry: AstralBeamChatCore["retry"];
89
90
  addToolResult: AstralBeamChatCore["addToolResult"];
90
91
  stop: () => void;
91
92
  reload: () => Promise<void>;
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as CORE_OPTION_KEYS, r as createAstralBeamChat } from "./core-CLWlvgYl.js";
1
+ import { n as CORE_OPTION_KEYS, r as createAstralBeamChat } from "./core-D53b-MKt.js";
2
2
  import { Gt as DEFAULT_COLOR_SCHEME } from "./api-B3UxSTtl.js";
3
3
  import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -153,6 +153,7 @@ function useAstralBeamChat(options) {
153
153
  return {
154
154
  ...useSyncExternalStore(core.subscribe, core.getState, core.getState),
155
155
  sendMessage: core.sendMessage,
156
+ retry: core.retry,
156
157
  addToolResult: core.addToolResult,
157
158
  stop: core.stop,
158
159
  reload: core.reload,