@rizom/brain 0.2.0-alpha.383 → 0.2.0-alpha.384
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/dist/brain.js +36 -36
- package/dist/chunks/{app-7z5e3c7s.js → app-zn0wshdg.js} +2 -2
- package/dist/chunks/{index-ymrghn05.js → index-fe19h0ey.js} +3 -3
- package/dist/chunks/{index-ymrghn05.js.map → index-fe19h0ey.js.map} +1 -1
- package/dist/chunks/{index-ccy24bdp.js → index-q8rrvgdf.js} +2 -2
- package/dist/chunks/{index-3dz3sh65.js → index-y41e244y.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/model.js +37 -37
- package/dist/model.js.map +2 -2
- package/dist/ui/studio-app.css +32 -18
- package/dist/ui/studio-app.js +3 -3
- package/dist/ui/studio-app.js.map +1 -1
- package/dist/ui/studio-asset-manifest.json +16 -16
- package/dist/ui/studio-chunks/account-view-811dnmr7.js +3 -0
- package/dist/ui/studio-chunks/{account-view-4544h367.js.map → account-view-811dnmr7.js.map} +2 -2
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-1w01z27m.js → highlighted-body-OFNGDK62-kw57xp1t.js} +2 -2
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-1w01z27m.js.map → highlighted-body-OFNGDK62-kw57xp1t.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-1gqf08r8.js → main-53ha0ekw.js} +18 -18
- package/dist/ui/studio-chunks/{main-1gqf08r8.js.map → main-53ha0ekw.js.map} +4 -7
- package/dist/ui/studio-chunks/{main-b34wmcw1.js → main-g0bad58x.js} +4 -4
- package/dist/ui/studio-chunks/{main-b34wmcw1.js.map → main-g0bad58x.js.map} +1 -1
- package/dist/ui/studio-chunks/main-g6b89p15.js +7 -0
- package/dist/ui/studio-chunks/{main-ptks77cs.js.map → main-g6b89p15.js.map} +3 -3
- package/dist/ui/studio-chunks/main-me847330.js +50 -0
- package/dist/ui/studio-chunks/{main-vzjqx8f9.js.map → main-me847330.js.map} +6 -3
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-hqacyqmt.js +3 -0
- package/dist/ui/studio-chunks/{mermaid-GHXKKRXX-ftrk50mv.js.map → mermaid-GHXKKRXX-hqacyqmt.js.map} +1 -1
- package/dist/ui/studio-chunks/studio-chat-workspace-hmkhk808.js +5 -0
- package/dist/ui/studio-chunks/studio-chat-workspace-hmkhk808.js.map +20 -0
- package/package.json +1 -1
- package/dist/ui/studio-chunks/account-view-4544h367.js +0 -3
- package/dist/ui/studio-chunks/main-ptks77cs.js +0 -7
- package/dist/ui/studio-chunks/main-vzjqx8f9.js +0 -50
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-ftrk50mv.js +0 -3
- package/dist/ui/studio-chunks/studio-chat-workspace-kpfmp85b.js +0 -5
- package/dist/ui/studio-chunks/studio-chat-workspace-kpfmp85b.js.map +0 -21
- /package/dist/chunks/{app-7z5e3c7s.js.map → app-zn0wshdg.js.map} +0 -0
- /package/dist/chunks/{index-ccy24bdp.js.map → index-q8rrvgdf.js.map} +0 -0
- /package/dist/chunks/{index-3dz3sh65.js.map → index-y41e244y.js.map} +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as R,b as Z,c as se,f as a,g as r}from"./main-vzjqx8f9.js";import{Bb as ce,Cb as ue,Qa as I,Ua as b,Va as K,Ya as ne,db as oe,pb as o,qb as x,xb as ie,yb as ae,zb as re}from"./main-1gqf08r8.js";import{Eb as k,Ib as Ne}from"./main-rjhqdb2v.js";var m={updateDisplayName:"updateDisplayName",revokePasskey:"revokePasskey",revokeSession:"revokeSession",revokeOtherSessions:"revokeOtherSessions",revokeAllSessions:"revokeAllSessions"};var u=k(Ne(),1);var y=k(I(),1);function C(e){return y.jsxDEV(b,{variant:e.tone==="danger"?"danger":e.tone==="primary"?"primary":"outline",type:e.type??"button",onClick:e.onClick,disabled:e.disabled,children:e.children},void 0,!1,void 0,this)}function N(e){return y.jsxDEV("div",{className:r("account-access-item",a.access),children:[y.jsxDEV(Z,{density:"comfortable",title:e.kind,description:e.description,metadata:e.metadata??[]},void 0,!1,void 0,this),e.action]},void 0,!0,void 0,this)}function T(e){return y.jsxDEV("section",{className:r("account-detail-section",a.section),children:[y.jsxDEV("div",{className:"account-section-label",children:[y.jsxDEV("h3",{className:r("",a.heading,x.section),children:e.title},void 0,!1,void 0,this),e.description?y.jsxDEV("p",{className:r("",a.description),children:e.description},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),y.jsxDEV("div",{className:r("people-stack",a.stack),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function G(e){return e.length===0?e:`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Q(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map((i)=>i.slice(0,1).toUpperCase()).join("")}function D(e,i){let c=i.indexOf("/");if(c<=0||c===i.length-1)return;let A=i.slice(0,c),p=i.slice(c+1);return`${e==="/"?"":e.replace(/\/+$/,"")}/entities/${encodeURIComponent(A)}/${encodeURIComponent(p)}`}var ye=o.object({displayName:o.string(),role:o.enum(["admin","trusted","public"]),profileEntityId:o.string().optional(),passkeys:o.array(o.object({id:o.string(),transports:o.array(o.string()).optional(),credentialDeviceType:o.string().optional(),credentialBackedUp:o.boolean(),createdAt:o.number(),updatedAt:o.number()})),connectedChannels:o.array(o.object({type:o.string(),label:o.string(),verifiedAt:o.number()})),pluginSettings:o.array(o.object({id:o.string(),title:o.string(),description:o.string().optional(),configured:o.boolean(),revision:o.number().nullable(),fields:o.array(o.object({name:o.string(),label:o.string(),control:o.enum(["text","url","number","checkbox"]),secret:o.boolean(),required:o.boolean(),value:o.union([o.string(),o.number(),o.boolean(),o.null()]).optional(),set:o.boolean().optional()}))})),sessions:o.array(o.object({id:o.string(),current:o.boolean(),createdAt:o.number(),expiresAt:o.number()}))});function he(e){return ye.safeParse(e).success}var X=o.custom(he,{message:"Invalid account response"}),B=o.object({account:X}),ge=o.object({account:X.optional(),revoked:o.object({sessions:o.number(),refreshTokens:o.number().optional()}).optional(),signedOut:o.boolean().optional()});function be(e){return ge.safeParse(e).success}var ve=o.custom(be,{message:"Invalid account mutation response"}),Se=o.custom((e)=>{if(!R(e))return!1;return typeof e.challenge==="string"&&R(e.rp)&&R(e.user)&&Array.isArray(e.pubKeyCredParams)},{message:"Invalid passkey registration options"});class ee extends Error{status;constructor(e,i){super(e);this.name="AccountApiError",this.status=i}}async function O(e,i){let c;try{c=await e.json()}catch{c={}}if(!e.ok){let A=typeof c==="object"&&c!==null&&"error"in c&&typeof c.error==="string"?c.error:"Account request failed";throw new ee(A,e.status)}return i.parse(c)}function F(e){let i=e.replaceAll("-","+").replaceAll("_","/").padEnd(Math.ceil(e.length/4)*4,"=");return Uint8Array.from(atob(i),(c)=>c.charCodeAt(0)).buffer}function L(e){let i=new Uint8Array(e),c="";for(let A of i)c+=String.fromCharCode(A);return btoa(c).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function ke(e){return{challenge:F(e.challenge),rp:e.rp,user:{...e.user,id:F(e.user.id)},pubKeyCredParams:e.pubKeyCredParams,...e.timeout!==void 0?{timeout:e.timeout}:{},...e.excludeCredentials?{excludeCredentials:e.excludeCredentials.map((i)=>({...i,id:F(i.id)}))}:{},...e.authenticatorSelection?{authenticatorSelection:e.authenticatorSelection}:{},...e.attestation?{attestation:e.attestation}:{},...e.extensions?{extensions:e.extensions}:{}}}var Ce=(e,i)=>fetch(e,i);class H{fetchFn;constructor(e={}){this.fetchFn=e.fetch??Ce}async fetchAccount(){return(await O(await this.fetchFn("/auth/account",{credentials:"same-origin",cache:"no-store"}),B)).account}async mutatePluginSettings(e){return(await O(await this.fetchFn("/auth/account/plugin-settings",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),B)).account}async mutateAccount(e){return O(await this.fetchFn("/auth/account/mutations",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ve)}async registerPasskey(){let e=await O(await this.fetchFn("/auth/account/passkeys/options",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"}),Se),i=await navigator.credentials.create({publicKey:ke(e)});if(!(i instanceof PublicKeyCredential))throw Error("Passkey registration was cancelled");if(!(i.response instanceof AuthenticatorAttestationResponse))throw Error("Authenticator returned an invalid passkey response");let c=i.response,A={id:i.id,rawId:L(i.rawId),type:i.type,...i.authenticatorAttachment?{authenticatorAttachment:i.authenticatorAttachment}:{},clientExtensionResults:i.getClientExtensionResults(),response:{clientDataJSON:L(c.clientDataJSON),attestationObject:L(c.attestationObject),transports:typeof c.getTransports==="function"?c.getTransports():[]}};return(await O(await this.fetchFn("/auth/account/passkeys/verify",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),B.extend({verified:o.literal(!0)}))).account}}var n=k(I(),1);function j(e,i=!1){return new Date(i?e:e*1000).toISOString()}function te(e){return ae(e,"Account request failed")}function Ve({bootstrap:e,initialAccount:i,client:c}){let A=ie(),p=u.useMemo(()=>c??new H({fetch:A.fetch}),[c,A]),[q,J]=u.useState(i),[Y,_]=u.useState(i?.displayName??e.displayName),[le,P]=u.useState(""),[V,E]=u.useState(!1),[f,z]=u.useState(!1),[S,v]=u.useState(null);u.useEffect(()=>{if(i)return;let t=!1;return p.fetchAccount().then((s)=>{if(t)return;J(s),_(s.displayName)}).catch((s)=>{if(t)return;E(!0),P(te(s))}),()=>{t=!0}},[p,i]);let h=u.useCallback(async(t,s,U)=>{z(!0),E(!1),P(t);try{let d=await U();if(d)J(d),_(d.displayName);P(s)}catch(d){E(!0),P(te(d))}finally{z(!1)}},[]),w=u.useCallback(async(t)=>(await p.mutateAccount(t)).account,[p]),de=(t)=>{t.preventDefault(),h("Saving…","Display name updated.",()=>w({action:m.updateDisplayName,confirmation:m.updateDisplayName,displayName:Y}))},pe=(t)=>{v({title:"Revoke this passkey?",message:"You will not be able to use this passkey again.",confirmLabel:"Revoke passkey",action:()=>{h("Revoking passkey…","Passkey revoked.",()=>w({action:m.revokePasskey,confirmation:m.revokePasskey,credentialId:t}))}})},me=(t)=>{v({title:"End this browser session?",message:"That browser will need a passkey to sign in again.",confirmLabel:"End session",action:()=>{h("Ending session…","Session ended.",()=>w({action:m.revokeSession,confirmation:m.revokeSession,sessionId:t}))}})},Ae=()=>{v({title:"End every other browser session?",message:"Your current browser will remain signed in.",confirmLabel:"End other sessions",action:()=>{h("Ending other sessions…","Other sessions ended.",()=>w({action:m.revokeOtherSessions,confirmation:m.revokeOtherSessions}))}})},fe=()=>{v({title:"Sign out everywhere?",message:"This ends every session, including this one. You will need your passkey to return.",confirmLabel:"Sign out everywhere",action:()=>{h("Signing out everywhere…","Signed out.",async()=>{await p.mutateAccount({action:m.revokeAllSessions,confirmation:m.revokeAllSessions}),window.location.assign(`/login?return_to=${encodeURIComponent(e.routePath)}`);return})}})},l=q,W=l?.role??e.role,M=l?.displayName??e.displayName;return n.jsxDEV(n.Fragment,{children:[n.jsxDEV("div",{className:r("account-shell",a.shell,re.inset),children:[n.jsxDEV(ue,{model:{access:ce("public"),title:"Account",totals:[]}},void 0,!1,void 0,this),n.jsxDEV("p",{className:r(`account-status${V?" is-error":""}`,a.feedback,V&&a.feedbackError),role:"status","aria-live":"polite",children:le},void 0,!1,void 0,this),!l?n.jsxDEV("p",{className:r("account-loading",a.loading),children:"Reading your account…"},void 0,!1,void 0,this):n.jsxDEV("section",{className:"account-details","aria-live":"polite",children:n.jsxDEV("div",{className:r("account-detail-sections",a.grid),children:[n.jsxDEV("div",{className:r("",a.column),children:[n.jsxDEV(T,{title:"Profile",children:[n.jsxDEV("div",{className:r("account-identity",a.identity),children:n.jsxDEV("div",{className:r("people-detail-person",a.person),children:[n.jsxDEV("span",{className:r("people-avatar people-avatar--large",a.avatar),children:Q(M)},void 0,!1,void 0,this),n.jsxDEV("span",{className:r("",a.personCopy),children:[n.jsxDEV("span",{className:r("people-detail-name",a.name,x.secondaryDisplay),children:M},void 0,!1,void 0,this),n.jsxDEV("span",{"data-account-role":W,className:r("account-role",a.role),children:G(W)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),l.profileEntityId?n.jsxDEV(n.Fragment,{children:[n.jsxDEV("p",{className:r("account-profile-note",a.description),children:"Managed by the Anchor profile — your account name follows the published profile."},void 0,!1,void 0,this),n.jsxDEV(N,{kind:"Anchor profile",description:M,action:D(e.studioPath,l.profileEntityId)?n.jsxDEV(b,{asChild:!0,variant:"link",children:n.jsxDEV("a",{href:D(e.studioPath,l.profileEntityId),children:"Edit in Studio →"},void 0,!1,void 0,this)},void 0,!1,void 0,this):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):n.jsxDEV("form",{className:r("name-form",a.form),onSubmit:de,children:[n.jsxDEV("label",{className:r("",a.formLabel),htmlFor:"display-name",children:"Display name"},void 0,!1,void 0,this),n.jsxDEV(K,{id:"display-name",maxLength:200,autoComplete:"name",required:!0,value:Y,onChange:(t)=>_(t.target.value)},void 0,!1,void 0,this),n.jsxDEV(C,{type:"submit",disabled:f,children:"Save name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),n.jsxDEV(T,{title:"Connected channels",children:l.connectedChannels.length===0?n.jsxDEV("p",{className:r("people-empty",a.empty),children:"No connected channels."},void 0,!1,void 0,this):l.connectedChannels.map((t)=>n.jsxDEV(N,{kind:t.type,description:t.label,metadata:[`Verified: ${j(t.verifiedAt,!0)}`]},`${t.type}:${t.label}`,!1,void 0,this))},void 0,!1,void 0,this),l.pluginSettings.map((t)=>n.jsxDEV(se,{label:t.title,density:"comfortable",presentation:"disclosure",children:[n.jsxDEV("p",{className:r("account-settings-description",a.description),children:t.description??"Private settings for this account."},void 0,!1,void 0,this),n.jsxDEV("form",{className:r("name-form",a.form),onSubmit:(s)=>{s.preventDefault();let U=new FormData(s.currentTarget),d=Object.fromEntries(U.entries());for(let g of t.fields)if(g.control==="checkbox")d[g.name]=U.has(g.name);else if(g.control==="number"&&typeof d[g.name]==="string"&&d[g.name]!=="")d[g.name]=Number(d[g.name]);h(`Saving ${t.title}…`,`${t.title} updated.`,()=>p.mutatePluginSettings({action:"save",definitionId:t.id,values:d}))},children:[t.fields.map((s)=>n.jsxDEV("label",{htmlFor:`setting-${t.id}-${s.name}`,className:r("",a.field),children:[n.jsxDEV("span",{className:r("",a.formLabel),children:s.label},void 0,!1,void 0,this),s.control==="checkbox"?n.jsxDEV(ne,{id:`setting-${t.id}-${s.name}`,name:s.name,defaultChecked:s.value===!0},void 0,!1,void 0,this):n.jsxDEV(K,{id:`setting-${t.id}-${s.name}`,name:s.name,type:s.secret?"password":s.control==="url"?"url":s.control==="number"?"number":"text",required:s.required&&(!t.configured||s.secret)&&!s.set,defaultValue:s.secret?"":typeof s.value==="string"||typeof s.value==="number"?s.value:"",placeholder:s.secret&&s.set?"Stored — leave blank to keep":void 0,autoComplete:"off"},void 0,!1,void 0,this)]},s.name,!0,void 0,this)),n.jsxDEV("div",{className:r("people-inline-actions",a.inlineActions),children:[n.jsxDEV(C,{type:"submit",tone:"primary",disabled:f,children:"Save settings"},void 0,!1,void 0,this),t.configured?n.jsxDEV(b,{variant:"danger",disabled:f,type:"button",onClick:()=>v({title:`Remove ${t.title}?`,message:"The stored settings for this integration will be removed.",confirmLabel:"Remove settings",action:()=>{h(`Removing ${t.title}…`,`${t.title} removed.`,()=>p.mutatePluginSettings({action:"delete",definitionId:t.id}))}}),children:"Remove"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},`${t.id}:${t.revision??"unset"}`,!0,void 0,this)]},t.id,!0,void 0,this))]},void 0,!0,void 0,this),n.jsxDEV("div",{className:r("",a.column),children:[n.jsxDEV(T,{title:"Sign-in",description:"Passkeys used to access this account. Your final passkey is protected from revocation.",children:[l.passkeys.map((t)=>n.jsxDEV(N,{kind:t.credentialBackedUp?"Synced passkey":"Device passkey",metadata:[`Added: ${j(t.createdAt,!0)}`],action:l.passkeys.length>1?n.jsxDEV(b,{variant:"danger",disabled:f,type:"button",onClick:()=>pe(t.id),children:"Revoke"},void 0,!1,void 0,this):void 0},t.id,!1,void 0,this)),n.jsxDEV("div",{className:r("people-inline-actions",a.inlineActions),children:n.jsxDEV(b,{variant:"outline",disabled:f,type:"button",onClick:()=>void h("Waiting for your authenticator…","Passkey added.",p.registerPasskey),children:"Add passkey"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.jsxDEV(T,{title:"Signed-in sessions",children:l.sessions.map((t)=>n.jsxDEV(N,{kind:t.current?"This session":"Browser session",metadata:[`Started: ${j(t.createdAt)}`,...t.current?["Current browser"]:[]],action:!t.current?n.jsxDEV(b,{variant:"danger",disabled:f,type:"button",onClick:()=>me(t.id),children:"End"},void 0,!1,void 0,this):void 0},t.id,!1,void 0,this))},void 0,!1,void 0,this),n.jsxDEV("footer",{className:r("account-session-actions",a.footer),children:[n.jsxDEV("small",{children:"Access changes require an Admin."},void 0,!1,void 0,this),n.jsxDEV("div",{className:r("",a.actions),children:[n.jsxDEV(C,{disabled:f||l.sessions.every((t)=>t.current),onClick:Ae,children:"End other sessions"},void 0,!1,void 0,this),n.jsxDEV(C,{tone:"danger",disabled:f,onClick:fe,children:"Sign out everywhere"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S&&n.jsxDEV(oe,{mark:"!",title:S.title,titleId:"account-confirmation-title",cancelLabel:"Cancel",confirmLabel:S.confirmLabel,confirmVariant:"danger",pending:f,onCancel:()=>v(null),onConfirm:()=>{let t=S.action;v(null),t()},children:n.jsxDEV("p",{children:S.message},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{Ve as AccountApp};
|
|
2
|
-
|
|
3
|
-
//# debugId=13E119A4CF16D60264756E2164756E21
|