@rizom/brain 0.2.0-alpha.816 → 0.2.0-alpha.817
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 +5 -5
- package/dist/chunks/{app-7q3g0xrw.js → app-q13n1xkz.js} +2 -2
- package/dist/chunks/{index-3277dmf1.js → index-7r0tknwz.js} +3 -3
- package/dist/chunks/{index-3277dmf1.js.map → index-7r0tknwz.js.map} +1 -1
- package/dist/chunks/{index-hycsahah.js → index-ns276s6m.js} +2 -2
- package/dist/chunks/{package-fnvqp0ja.js → package-5tmsdn4d.js} +3 -3
- package/dist/chunks/{package-fnvqp0ja.js.map → package-5tmsdn4d.js.map} +1 -1
- package/dist/model.js +138 -138
- package/dist/model.js.map +3 -3
- package/dist/testing.js +1 -1
- package/dist/ui/{studio-app-5bdcd9cd016f80c11395bbe23b418696473441a81e00d56a4b57c35311be00ab.css → studio-app-70f8cb17b11c4ae4bb0ceee02c8ead933816ed55051403304c181bf263738790.css} +6 -11
- package/dist/ui/studio-app-eg6b1nap.js +251 -0
- package/dist/ui/{studio-app-a4m82nj9.js.map → studio-app-eg6b1nap.js.map} +7 -4
- package/dist/ui/studio-asset-manifest.json +39 -39
- package/dist/ui/studio-chunks/{account-view-sd644z6m.js → account-view-xfe0b3nd.js} +2 -2
- package/dist/ui/studio-chunks/{account-view-sd644z6m.js.map → account-view-xfe0b3nd.js.map} +1 -1
- package/dist/ui/studio-chunks/{chat-yvjjpyqb.js → chat-q43ev522.js} +2 -2
- package/dist/ui/studio-chunks/{chat-yvjjpyqb.js.map → chat-q43ev522.js.map} +1 -1
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-6etvn2rv.js → highlighted-body-OFNGDK62-k61yr3cv.js} +2 -2
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-6etvn2rv.js.map → highlighted-body-OFNGDK62-k61yr3cv.js.map} +1 -1
- package/dist/ui/studio-chunks/main-77snes8p.js +6 -0
- package/dist/ui/studio-chunks/{main-7pdzr1ew.js.map → main-77snes8p.js.map} +3 -3
- package/dist/ui/studio-chunks/{main-s8mh4mst.js → main-as971bnz.js} +3 -3
- package/dist/ui/studio-chunks/{main-s8mh4mst.js.map → main-as971bnz.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-63p7zhs5.js → main-b4w7s6mx.js} +5 -5
- package/dist/ui/studio-chunks/{main-63p7zhs5.js.map → main-b4w7s6mx.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-sh3gd7gt.js → main-bgz7jfx7.js} +2 -2
- package/dist/ui/studio-chunks/{main-sh3gd7gt.js.map → main-bgz7jfx7.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-5v2rted1.js → main-e0gm5z75.js} +3 -3
- package/dist/ui/studio-chunks/{main-5v2rted1.js.map → main-e0gm5z75.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-v1mxpp7f.js → main-jrb0wvq4.js} +3 -3
- package/dist/ui/studio-chunks/{main-v1mxpp7f.js.map → main-jrb0wvq4.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-gttn05ps.js → main-n6x2vadq.js} +2 -2
- package/dist/ui/studio-chunks/{main-gttn05ps.js.map → main-n6x2vadq.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-3e2eqw0x.js → main-n70s4zbm.js} +3 -3
- package/dist/ui/studio-chunks/{main-3e2eqw0x.js.map → main-n70s4zbm.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-k8ma5kkx.js → main-qtwkt52a.js} +3 -3
- package/dist/ui/studio-chunks/{main-k8ma5kkx.js.map → main-qtwkt52a.js.map} +1 -1
- package/dist/ui/studio-chunks/main-tn4apj9j.js +4 -0
- package/dist/ui/studio-chunks/main-tn4apj9j.js.map +13 -0
- package/dist/ui/studio-chunks/main-x4eqqte5.js +4 -0
- package/dist/ui/studio-chunks/{main-dy9t18a9.js.map → main-x4eqqte5.js.map} +6 -9
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-s4k3pbv0.js +3 -0
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-s4k3pbv0.js.map +9 -0
- package/dist/ui/studio-chunks/studio-ask-panel-j4r3wbrv.js +5 -0
- package/dist/ui/studio-chunks/{studio-ask-panel-jak88gdb.js.map → studio-ask-panel-j4r3wbrv.js.map} +2 -2
- package/dist/ui/studio-chunks/studio-chat-workspace-essbhwrc.js +3 -0
- package/dist/ui/studio-chunks/{studio-chat-workspace-1zvhm04c.js.map → studio-chat-workspace-essbhwrc.js.map} +5 -5
- package/package.json +1 -1
- package/dist/ui/studio-app-a4m82nj9.js +0 -251
- package/dist/ui/studio-chunks/main-6h6376xx.js +0 -4
- package/dist/ui/studio-chunks/main-6h6376xx.js.map +0 -12
- package/dist/ui/studio-chunks/main-7pdzr1ew.js +0 -6
- package/dist/ui/studio-chunks/main-dy9t18a9.js +0 -4
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-2d3nmnjs.js +0 -3
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-2d3nmnjs.js.map +0 -9
- package/dist/ui/studio-chunks/studio-ask-panel-jak88gdb.js +0 -5
- package/dist/ui/studio-chunks/studio-chat-workspace-1zvhm04c.js +0 -3
- /package/dist/chunks/{app-7q3g0xrw.js.map → app-q13n1xkz.js.map} +0 -0
- /package/dist/chunks/{index-hycsahah.js.map → index-ns276s6m.js.map} +0 -0
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 2,
|
|
3
3
|
"entrypoints": {
|
|
4
|
-
"script": "studio-app-
|
|
5
|
-
"stylesheet": "studio-app-
|
|
4
|
+
"script": "studio-app-eg6b1nap.js",
|
|
5
|
+
"stylesheet": "studio-app-70f8cb17b11c4ae4bb0ceee02c8ead933816ed55051403304c181bf263738790.css"
|
|
6
6
|
},
|
|
7
7
|
"assets": {
|
|
8
|
-
"studio-app-
|
|
9
|
-
"studio-app-
|
|
10
|
-
"studio-app-
|
|
11
|
-
"studio-chunks/account-view-
|
|
12
|
-
"studio-chunks/account-view-
|
|
13
|
-
"studio-chunks/chat-
|
|
14
|
-
"studio-chunks/chat-
|
|
15
|
-
"studio-chunks/highlighted-body-OFNGDK62-
|
|
16
|
-
"studio-chunks/highlighted-body-OFNGDK62-
|
|
17
|
-
"studio-chunks/main-
|
|
18
|
-
"studio-chunks/main-
|
|
19
|
-
"studio-chunks/main-
|
|
20
|
-
"studio-chunks/main-
|
|
21
|
-
"studio-chunks/main-
|
|
22
|
-
"studio-chunks/main-
|
|
23
|
-
"studio-chunks/main-
|
|
24
|
-
"studio-chunks/main-
|
|
25
|
-
"studio-chunks/main-
|
|
26
|
-
"studio-chunks/main-
|
|
27
|
-
"studio-chunks/main-
|
|
28
|
-
"studio-chunks/main-
|
|
29
|
-
"studio-chunks/main-
|
|
30
|
-
"studio-chunks/main-
|
|
31
|
-
"studio-chunks/main-
|
|
32
|
-
"studio-chunks/main-
|
|
33
|
-
"studio-chunks/main-
|
|
34
|
-
"studio-chunks/main-
|
|
35
|
-
"studio-chunks/main-
|
|
36
|
-
"studio-chunks/main-
|
|
37
|
-
"studio-chunks/main-
|
|
38
|
-
"studio-chunks/main-
|
|
39
|
-
"studio-chunks/mermaid-GHXKKRXX-
|
|
40
|
-
"studio-chunks/mermaid-GHXKKRXX-
|
|
41
|
-
"studio-chunks/studio-ask-panel-
|
|
42
|
-
"studio-chunks/studio-ask-panel-
|
|
43
|
-
"studio-chunks/studio-chat-workspace-
|
|
44
|
-
"studio-chunks/studio-chat-workspace-
|
|
8
|
+
"studio-app-70f8cb17b11c4ae4bb0ceee02c8ead933816ed55051403304c181bf263738790.css": "studio-app-70f8cb17b11c4ae4bb0ceee02c8ead933816ed55051403304c181bf263738790.css",
|
|
9
|
+
"studio-app-eg6b1nap.js": "studio-app-eg6b1nap.js",
|
|
10
|
+
"studio-app-eg6b1nap.js.map": "studio-app-eg6b1nap.js.map",
|
|
11
|
+
"studio-chunks/account-view-xfe0b3nd.js": "studio-chunks/account-view-xfe0b3nd.js",
|
|
12
|
+
"studio-chunks/account-view-xfe0b3nd.js.map": "studio-chunks/account-view-xfe0b3nd.js.map",
|
|
13
|
+
"studio-chunks/chat-q43ev522.js": "studio-chunks/chat-q43ev522.js",
|
|
14
|
+
"studio-chunks/chat-q43ev522.js.map": "studio-chunks/chat-q43ev522.js.map",
|
|
15
|
+
"studio-chunks/highlighted-body-OFNGDK62-k61yr3cv.js": "studio-chunks/highlighted-body-OFNGDK62-k61yr3cv.js",
|
|
16
|
+
"studio-chunks/highlighted-body-OFNGDK62-k61yr3cv.js.map": "studio-chunks/highlighted-body-OFNGDK62-k61yr3cv.js.map",
|
|
17
|
+
"studio-chunks/main-77snes8p.js": "studio-chunks/main-77snes8p.js",
|
|
18
|
+
"studio-chunks/main-77snes8p.js.map": "studio-chunks/main-77snes8p.js.map",
|
|
19
|
+
"studio-chunks/main-as971bnz.js": "studio-chunks/main-as971bnz.js",
|
|
20
|
+
"studio-chunks/main-as971bnz.js.map": "studio-chunks/main-as971bnz.js.map",
|
|
21
|
+
"studio-chunks/main-b4w7s6mx.js": "studio-chunks/main-b4w7s6mx.js",
|
|
22
|
+
"studio-chunks/main-b4w7s6mx.js.map": "studio-chunks/main-b4w7s6mx.js.map",
|
|
23
|
+
"studio-chunks/main-bgz7jfx7.js": "studio-chunks/main-bgz7jfx7.js",
|
|
24
|
+
"studio-chunks/main-bgz7jfx7.js.map": "studio-chunks/main-bgz7jfx7.js.map",
|
|
25
|
+
"studio-chunks/main-e0gm5z75.js": "studio-chunks/main-e0gm5z75.js",
|
|
26
|
+
"studio-chunks/main-e0gm5z75.js.map": "studio-chunks/main-e0gm5z75.js.map",
|
|
27
|
+
"studio-chunks/main-jrb0wvq4.js": "studio-chunks/main-jrb0wvq4.js",
|
|
28
|
+
"studio-chunks/main-jrb0wvq4.js.map": "studio-chunks/main-jrb0wvq4.js.map",
|
|
29
|
+
"studio-chunks/main-n6x2vadq.js": "studio-chunks/main-n6x2vadq.js",
|
|
30
|
+
"studio-chunks/main-n6x2vadq.js.map": "studio-chunks/main-n6x2vadq.js.map",
|
|
31
|
+
"studio-chunks/main-n70s4zbm.js": "studio-chunks/main-n70s4zbm.js",
|
|
32
|
+
"studio-chunks/main-n70s4zbm.js.map": "studio-chunks/main-n70s4zbm.js.map",
|
|
33
|
+
"studio-chunks/main-qtwkt52a.js": "studio-chunks/main-qtwkt52a.js",
|
|
34
|
+
"studio-chunks/main-qtwkt52a.js.map": "studio-chunks/main-qtwkt52a.js.map",
|
|
35
|
+
"studio-chunks/main-tn4apj9j.js": "studio-chunks/main-tn4apj9j.js",
|
|
36
|
+
"studio-chunks/main-tn4apj9j.js.map": "studio-chunks/main-tn4apj9j.js.map",
|
|
37
|
+
"studio-chunks/main-x4eqqte5.js": "studio-chunks/main-x4eqqte5.js",
|
|
38
|
+
"studio-chunks/main-x4eqqte5.js.map": "studio-chunks/main-x4eqqte5.js.map",
|
|
39
|
+
"studio-chunks/mermaid-GHXKKRXX-s4k3pbv0.js": "studio-chunks/mermaid-GHXKKRXX-s4k3pbv0.js",
|
|
40
|
+
"studio-chunks/mermaid-GHXKKRXX-s4k3pbv0.js.map": "studio-chunks/mermaid-GHXKKRXX-s4k3pbv0.js.map",
|
|
41
|
+
"studio-chunks/studio-ask-panel-j4r3wbrv.js": "studio-chunks/studio-ask-panel-j4r3wbrv.js",
|
|
42
|
+
"studio-chunks/studio-ask-panel-j4r3wbrv.js.map": "studio-chunks/studio-ask-panel-j4r3wbrv.js.map",
|
|
43
|
+
"studio-chunks/studio-chat-workspace-essbhwrc.js": "studio-chunks/studio-chat-workspace-essbhwrc.js",
|
|
44
|
+
"studio-chunks/studio-chat-workspace-essbhwrc.js.map": "studio-chunks/studio-chat-workspace-essbhwrc.js.map"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Mb as c,Nb as o,Ob as d,Qb as Ue,Rb as Le,Sb as $e,Tb as Me,Ub as Ae,Wb as ke}from"./main-3e2eqw0x.js";import{$b as ze,Zb as Ve,ac as Je}from"./main-6h6376xx.js";import{Jc as Se,Nc as Q,Oc as A,Pc as je,Uc as K,Vc as F,fc as x,hc as y,ic as z,kd as Ce,lc as ee,rc as Ke,sd as qe,tc as Ye,td as X,uc as He,vc as L,wc as M}from"./main-k8ma5kkx.js";import{Ud as a}from"./main-s8mh4mst.js";import{ef as te}from"./main-v1mxpp7f.js";import{Mf as v}from"./main-sh3gd7gt.js";var ae=v(te(),1);var We=a.object({displayName:a.string(),role:a.enum(["admin","trusted","public"]),profileEntityId:a.string().optional(),passkeys:a.array(a.object({id:a.string(),transports:a.array(a.string()).optional(),credentialDeviceType:a.string().optional(),credentialBackedUp:a.boolean(),createdAt:a.number(),updatedAt:a.number()})),appPasswords:a.array(a.object({id:a.string(),username:a.string(),label:a.string(),access:a.enum(["read","write"]),createdAt:a.number(),expiresAt:a.number(),lastUsedAt:a.number().optional()})),connectedChannels:a.array(a.object({type:a.string(),label:a.string(),verifiedAt:a.number()})),pluginSettings:a.array(a.object({id:a.string(),title:a.string(),description:a.string().optional(),configured:a.boolean(),revision:a.number().nullable(),fields:a.array(a.object({name:a.string(),label:a.string(),control:a.enum(["text","url","number","checkbox"]),secret:a.boolean(),required:a.boolean(),value:a.union([a.string(),a.number(),a.boolean(),a.null()]).optional(),set:a.boolean().optional()}))})),sessions:a.array(a.object({id:a.string(),current:a.boolean(),createdAt:a.number(),expiresAt:a.number()}))});function Ge(e){return We.safeParse(e).success}var fe=a.custom(Ge,{message:"Invalid account response"}),ie=a.object({account:fe}),Ze=a.object({account:fe.optional(),appPassword:a.object({username:a.string(),password:a.string()}).optional(),revoked:a.object({sessions:a.number(),refreshTokens:a.number().optional()}).optional(),signedOut:a.boolean().optional()});function Qe(e){return Ze.safeParse(e).success}var Xe=a.custom(Qe,{message:"Invalid account mutation response"}),et=a.custom((e)=>{if(!Q(e))return!1;return typeof e.challenge==="string"&&Q(e.rp)&&Q(e.user)&&Array.isArray(e.pubKeyCredParams)},{message:"Invalid passkey registration options"});class ge extends Error{status;constructor(e,t){super(e);this.name="AccountApiError",this.status=t}}async function q(e,t){let n;try{n=await e.json()}catch{n={}}if(!e.ok){let i=typeof n==="object"&&n!==null&&"error"in n&&typeof n.error==="string"?n.error:"Account request failed";throw new ge(i,e.status)}return t.parse(n)}function se(e){let t=e.replaceAll("-","+").replaceAll("_","/").padEnd(Math.ceil(e.length/4)*4,"=");return Uint8Array.from(atob(t),(n)=>n.charCodeAt(0)).buffer}function re(e){let t=new Uint8Array(e),n="";for(let i of t)n+=String.fromCharCode(i);return btoa(n).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function tt(e){return{challenge:se(e.challenge),rp:e.rp,user:{...e.user,id:se(e.user.id)},pubKeyCredParams:e.pubKeyCredParams,...e.timeout!==void 0?{timeout:e.timeout}:{},...e.excludeCredentials?{excludeCredentials:e.excludeCredentials.map((t)=>({...t,id:se(t.id)}))}:{},...e.authenticatorSelection?{authenticatorSelection:e.authenticatorSelection}:{},...e.attestation?{attestation:e.attestation}:{},...e.extensions?{extensions:e.extensions}:{}}}var nt=(e,t)=>fetch(e,t);class ce{fetchFn;constructor(e={}){this.fetchFn=e.fetch??nt}async fetchAccount(){return(await q(await this.fetchFn("/auth/account",{credentials:"same-origin",cache:"no-store"}),ie)).account}async mutatePluginSettings(e){return(await q(await this.fetchFn("/auth/account/plugin-settings",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ie)).account}async mutateAccount(e){return q(await this.fetchFn("/auth/account/mutations",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Xe)}async registerPasskey(){let e=await q(await this.fetchFn("/auth/account/passkeys/options",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"}),et),t=await navigator.credentials.create({publicKey:tt(e)});if(!(t instanceof PublicKeyCredential))throw Error("Passkey registration was cancelled");if(!(t.response instanceof AuthenticatorAttestationResponse))throw Error("Authenticator returned an invalid passkey response");let n=t.response,i={id:t.id,rawId:re(t.rawId),type:t.type,...t.authenticatorAttachment?{authenticatorAttachment:t.authenticatorAttachment}:{},clientExtensionResults:t.getClientExtensionResults(),response:{clientDataJSON:re(n.clientDataJSON),attestationObject:re(n.attestationObject),transports:typeof n.getTransports==="function"?n.getTransports():[]}};return(await q(await this.fetchFn("/auth/account/passkeys/verify",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),ie.extend({verified:a.literal(!0)}))).account}}function he(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map((t)=>t.slice(0,1).toUpperCase()).join("")}function ye(e,t){let n=t.indexOf("/");if(n<=0||n===t.length-1)return;let i=t.slice(0,n),s=t.slice(n+1);return`${e==="/"?"":e.replace(/\/+$/,"")}/entities/${encodeURIComponent(i)}/${encodeURIComponent(s)}`}function j(e,t=!1){return new Date(t?e:e*1000).toISOString()}var R=v(x(),1);function V(e){return R.jsxDEV(y,{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 U(e){return R.jsxDEV("div",{className:o("account-access-item",c.access),children:[R.jsxDEV(Ae,{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 k(e){return R.jsxDEV("section",{className:o("account-detail-section",c.section),children:[R.jsxDEV("div",{className:"account-section-label",children:[R.jsxDEV("h3",{className:o("",c.heading,X.section),children:e.title},void 0,!1,void 0,this),e.description?R.jsxDEV("p",{className:o("",c.description),children:e.description},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),R.jsxDEV("div",{className:o("people-stack",c.stack),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function be(e,t){let n=Object.fromEntries(t.entries());for(let i of e)if(i.control==="checkbox")n[i.name]=t.has(i.name);else if(i.control==="number"&&typeof n[i.name]==="string"&&n[i.name]!=="")n[i.name]=Number(n[i.name]);return n}function ve(e){if(e.secret)return"password";if(e.control==="url"||e.control==="number")return e.control;return"text"}var r=v(x(),1);function we(e){let{account:t,actions:n,title:i,studioPath:s}=e,g=t.role,h=t.profileEntityId?ye(s,t.profileEntityId):void 0;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV(k,{title:"Profile",children:[r.jsxDEV("div",{className:o("account-identity",c.identity),children:r.jsxDEV("div",{className:o("people-detail-person",c.person),children:[r.jsxDEV("span",{className:o("people-avatar people-avatar--large",c.avatar),children:he(i)},void 0,!1,void 0,this),r.jsxDEV("span",{className:o("",c.personCopy),children:[r.jsxDEV("span",{className:o("people-detail-name",c.name,X.secondaryDisplay),children:i},void 0,!1,void 0,this),r.jsxDEV("span",{"data-account-role":g,className:o("account-role",c.role),children:Se(g)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t.profileEntityId?r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("account-profile-note",c.description),children:"Managed by the Anchor profile — your account name follows the published profile."},void 0,!1,void 0,this),r.jsxDEV(U,{kind:"Anchor profile",description:i,action:h?r.jsxDEV(y,{asChild:!0,variant:"link",children:r.jsxDEV("a",{href:h,children:"Edit Anchor Profile →"},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):r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(O)=>{O.preventDefault(),n.saveName()},children:[r.jsxDEV("label",{className:o("",c.formLabel),htmlFor:"display-name",children:"Display name"},void 0,!1,void 0,this),r.jsxDEV(z,{id:"display-name",maxLength:200,autoComplete:"name",required:!0,value:n.displayName,onChange:(O)=>n.setDisplayName(O.target.value)},void 0,!1,void 0,this),r.jsxDEV(V,{type:"submit",disabled:n.busy,children:"Save name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV("p",{className:o("",c.description),children:"Your role controls access to this brain. An administrator manages access in Administration."},void 0,!1,void 0,this),g==="admin"&&r.jsxDEV(y,{asChild:!0,variant:"outline",children:r.jsxDEV("a",{href:Ce(s,"admin:administration"),children:"Manage people in Administration →"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ne(e){let t=e.account.connectedChannels;return r.jsxDEV(k,{title:"Linked identities",description:"How this brain recognizes messages from you. These are your identities, not services configured for the whole brain.",children:t.length===0?r.jsxDEV("p",{className:o("people-empty",c.empty),children:"No linked identities."},void 0,!1,void 0,this):t.map((n)=>r.jsxDEV(U,{kind:n.type,description:n.label,metadata:[`Verified: ${j(n.verifiedAt,!0)}`]},`${n.type}:${n.label}`,!1,void 0,this))},void 0,!1,void 0,this)}function Te(e){let{account:t,actions:n}=e;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("",c.description),children:"Settings for your account only. These do not configure shared services for the brain."},void 0,!1,void 0,this),t.pluginSettings.map((i)=>r.jsxDEV(ke,{label:i.title,density:"comfortable",presentation:"disclosure",children:[r.jsxDEV("p",{className:o("account-settings-description",c.description),children:i.description??"Private settings for this account."},void 0,!1,void 0,this),r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(s)=>{s.preventDefault(),n.saveSettings(i,new FormData(s.currentTarget))},children:[i.fields.map((s)=>r.jsxDEV("label",{htmlFor:`setting-${i.id}-${s.name}`,className:o("",c.field),children:[r.jsxDEV("span",{className:o("",c.formLabel),children:s.label},void 0,!1,void 0,this),s.control==="checkbox"?r.jsxDEV(ee,{id:`setting-${i.id}-${s.name}`,name:s.name,defaultChecked:s.value===!0},void 0,!1,void 0,this):r.jsxDEV(z,{id:`setting-${i.id}-${s.name}`,name:s.name,type:ve(s),required:s.required&&(!i.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)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:[r.jsxDEV(V,{type:"submit",tone:"primary",disabled:n.busy,children:"Save settings"},void 0,!1,void 0,this),i.configured?r.jsxDEV(y,{variant:"danger",disabled:n.busy,type:"button",onClick:()=>n.removeSettings(i),children:"Remove"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},`${i.id}:${i.revision??"unset"}`,!0,void 0,this)]},i.id,!0,void 0,this))]},void 0,!0,void 0,this)}function Pe(e){let{account:t,actions:n}=e,{busy:i}=n;return r.jsxDEV("div",{className:o("",c.column),children:[r.jsxDEV(k,{title:"Sign-in",description:"Passkeys used to access this account. Your final passkey is protected from revocation.",children:[t.passkeys.map((s)=>r.jsxDEV(U,{kind:s.credentialBackedUp?"Synced passkey":"Device passkey",metadata:[`Added: ${j(s.createdAt,!0)}`],action:t.passkeys.length>1?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokePasskey(s.id),children:"Revoke"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:r.jsxDEV(y,{variant:"outline",disabled:i,type:"button",onClick:n.addPasskey,children:"Add passkey"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV(k,{title:"Signed-in sessions",children:t.sessions.map((s)=>r.jsxDEV(U,{kind:s.current?"This session":"Browser session",metadata:[`Started: ${j(s.createdAt)}`,...s.current?["Current browser"]:[]],action:!s.current?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokeSession(s.id),children:"End"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this))},void 0,!1,void 0,this),r.jsxDEV("footer",{className:o("account-session-actions",c.footer),children:[r.jsxDEV("small",{children:"Access changes require an Admin."},void 0,!1,void 0,this),r.jsxDEV("div",{className:o("",c.actions),children:[r.jsxDEV(V,{disabled:i||t.sessions.every((s)=>s.current),onClick:n.revokeOtherSessions,children:"End other sessions"},void 0,!1,void 0,this),r.jsxDEV(V,{tone:"danger",disabled:i,onClick:n.revokeAllSessions,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)}var Re=v(te(),1);function de(e){return new URL(e).host.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function le(e){return JSON.stringify(e,null,2)}function xe(e,t,n){return["Already have servers there? Add only the ",{code:`"${n}"`}," entry inside ",{code:`"${t}"`},` of ${e}.`]}function Oe(e){let t=de(e),n="Sign in with your passkey when asked.";return[{id:"claude",group:"primary",name:"Claude",note:["Desktop app and claude.ai."],steps:[["Open Settings → Connectors → Add custom connector."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when asked."]]},{id:"chatgpt",group:"primary",name:"ChatGPT",steps:[["Open Settings → Apps & Connectors → Advanced and turn on Developer mode."],["Choose Create, name it ",{code:t},", paste your brain’s address and pick OAuth."],["Sign in with your passkey when asked."]]},{id:"claude-code",group:"developer",name:"Claude Code",lead:[["Add the server in your terminal:"]],snippet:{label:"Claude Code command",code:`claude mcp add --transport http ${t} ${e}`},after:[["Then start Claude Code, run ",{code:"/mcp"},", choose ",{code:t}," and sign in with your passkey."]]},{id:"cursor",group:"developer",name:"Cursor",steps:[["Open Cursor Settings → MCP → Add new global MCP server."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when Cursor asks."]],lead:[["Or add it to ",{code:"~/.cursor/mcp.json"},":"]],snippet:{label:"Cursor configuration",code:le({mcpServers:{[t]:{url:e}}})},after:[xe("the file","mcpServers",t)]},{id:"vscode",group:"developer",name:"VS Code",steps:[["Open the Command Palette and run ",{code:"MCP: Add Server"},"."],["Choose HTTP, paste your brain’s address and name it ",{code:t},"."],["Choose Global, then sign in with your passkey when asked."]],lead:[["Or run ",{code:"MCP: Open User Configuration"}," and add:"]],snippet:{label:"VS Code configuration",code:le({servers:{[t]:{type:"http",url:e}}})},after:[xe("your user configuration","servers",t)]},{id:"other",group:"developer",name:"Any other MCP client",inlineName:"any other MCP client",note:["Look for “add MCP server”, “connector” or “integration” in the tool’s settings and fill in:"],fields:[{label:"Name",value:[{code:t}]},{label:"Type",value:["Remote server, Streamable HTTP — not stdio, not SSE"]},{label:"URL",value:[{code:e}]},{label:"Authentication",value:["OAuth. Leave API key, token, client ID and secret empty; the tool registers itself."]}],lead:[["When you connect, your browser opens “Authorize <tool>?” on your brain. Approve MCP access with your passkey. The tool then has two tools: ",{code:"chat"},", to ask your brain anything as you would in chat, and ",{code:"confirm"},", to approve changes when the brain asks."],["Tool only takes local (stdio) servers, or insists on an API key? Bridge it with ",{code:"mcp-remote"},", which handles the sign-in:"]],snippet:{label:"mcp-remote bridge configuration",code:le({mcpServers:{[t]:{command:"npx",args:["-y","mcp-remote",e]}}})}}]}var u=v(x(),1);function J(e){return u.jsxDEV(u.Fragment,{children:e.text.map((t,n)=>typeof t==="string"?t:u.jsxDEV("code",{className:o("",d.code),children:t.code},n,!1,void 0,this))},void 0,!1,void 0,this)}function _(e){let[t,n]=Re.useState("idle"),i=async()=>{try{await navigator.clipboard.writeText(e.code),n("copied")}catch{n("unavailable")}};return u.jsxDEV("div",{className:o("ai-tools-snippet",d.snippet),children:[u.jsxDEV("pre",{className:o("",d.snippetCode),"aria-label":e.label,children:e.code},void 0,!1,void 0,this),u.jsxDEV(y,{variant:"outline",size:"sm",onClick:()=>void i(),"aria-label":`Copy ${e.label}`,children:t==="copied"?"Copied":t==="unavailable"?"Select to copy":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function W(e){let{client:t}=e;return u.jsxDEV("article",{className:o("ai-tools-client",d.client),children:[u.jsxDEV("h4",{className:o("",d.clientName),children:t.name},void 0,!1,void 0,this),t.note?u.jsxDEV("p",{className:o("",d.text),children:u.jsxDEV(J,{text:t.note},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,t.steps?u.jsxDEV("ol",{className:o("",d.steps),children:t.steps.map((n,i)=>u.jsxDEV("li",{children:u.jsxDEV(J,{text:n},void 0,!1,void 0,this)},i,!1,void 0,this))},void 0,!1,void 0,this):null,t.fields?u.jsxDEV("dl",{className:o("",d.fields),children:t.fields.map((n)=>u.jsxDEV("div",{className:o("",d.field),children:[u.jsxDEV("dt",{className:o("",d.fieldLabel),children:n.label},void 0,!1,void 0,this),u.jsxDEV("dd",{className:o("",d.fieldValue),children:u.jsxDEV(J,{text:n.value},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},n.label,!0,void 0,this))},void 0,!1,void 0,this):null,t.lead?.map((n,i)=>u.jsxDEV("p",{className:o("",d.text),children:u.jsxDEV(J,{text:n},void 0,!1,void 0,this)},`lead-${i}`,!1,void 0,this)),t.snippet?u.jsxDEV(_,{...t.snippet},void 0,!1,void 0,this):null,t.after?.map((n,i)=>u.jsxDEV("p",{className:o("",d.text),children:u.jsxDEV(J,{text:n},void 0,!1,void 0,this)},`after-${i}`,!1,void 0,this))]},void 0,!0,void 0,this)}function ot(e){return e.length<2?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}function Ee(e){let t=Oe(e.mcpUrl),n=t.filter((s)=>s.group==="primary"),i=t.filter((s)=>s.group==="developer");return u.jsxDEV(k,{title:"AI tools",description:"Connect AI tools you already use to this brain. A connected tool talks to the brain as you do in chat — asking, saving and updating within your access — after you sign in with your passkey.",children:[u.jsxDEV("article",{className:o("ai-tools-address",d.client),children:[u.jsxDEV("h4",{className:o("",d.clientName),children:"Your brain’s address"},void 0,!1,void 0,this),u.jsxDEV(_,{label:"brain address",code:e.mcpUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.jsxDEV("div",{className:o("ai-tools-clients",d.clients),children:n.map((s)=>u.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this),u.jsxDEV("details",{className:o("ai-tools-developer",d.developer),children:[u.jsxDEV("summary",{className:o("",d.developerSummary),children:["Developer tools and other clients",u.jsxDEV("span",{className:o("",d.developerHint),children:ot(i.map((s)=>s.inlineName??s.name))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.jsxDEV("div",{className:o("ai-tools-clients",d.clients,d.developerClients),children:i.map((s)=>u.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var G=v(te(),1);var ue="Enter the username and password of an app password from this page.";function Ie(e){let t=new URL(e),n=`${t.protocol==="https:"?"davs":"dav"}://${t.host}${t.pathname}`,i=de(e);return[{id:"macos",group:"file-manager",name:"macOS",note:["Finder, on any Mac."],steps:[["In Finder, choose Go → Connect to Server (⌘K)."],["Paste the address below and click Connect."],["Choose Registered User. ",ue]],snippet:{label:"macOS address",code:e}},{id:"windows",group:"file-manager",name:"Windows",note:["File Explorer, on Windows 10 and 11."],steps:[["In File Explorer, open This PC and choose Map network drive."],["Paste the address below as the folder, tick Connect using different credentials, and click Finish."],[ue]],snippet:{label:"Windows address",code:e}},{id:"gnome-files",group:"file-manager",name:"GNOME Files",note:["The file manager on Ubuntu, Fedora and other GNOME desktops."],steps:[["Open Files → Other Locations (or Network)."],["Under Connect to Server, enter the address below and connect."],[ue]],snippet:{label:"GNOME Files address",code:n}},{id:"rclone",group:"command-line",name:"rclone",note:["Linux, macOS and Windows, from a terminal."],lead:[["Store the drive as a remote, with your app password’s username and password:"]],snippet:{label:"rclone remote command",code:`rclone config create ${i} webdav url=${e} vendor=other user=YOUR_USERNAME pass=YOUR_PASSWORD --obscure`},after:[["Then mount it on an empty folder: ",{code:`rclone mount ${i}: ~/Brain --vfs-cache-mode writes`},"."]]}]}var l=v(x(),1),ne="app-password-label",De="app-password-write";function pe(e){return j(e).slice(0,10)}function at(e,t){return[`Created: ${pe(e.createdAt)}`,`${e.expiresAt<=t?"Expired":"Expires"}: ${pe(e.expiresAt)}`,e.lastUsedAt===void 0?"Never used":`Last used: ${pe(e.lastUsedAt)}`]}function Fe(e){let{account:t,actions:n,connect:i}=e,{busy:s,createdAppPassword:g}=n,[h,O]=G.useState(void 0),b=i!==void 0&&h!==void 0?Le(g,h,t.appPasswords):null;G.useEffect(()=>{if(i&&b)window.location.assign($e(i.state,b))},[i,b]);let N=Math.floor(Date.now()/1000),[T,C]=G.useState(!1),I=Ie(e.davUrl),D=I.filter((f)=>f.group==="file-manager"),E=I.filter((f)=>f.group==="command-line");return l.jsxDEV("div",{className:o("",c.column),children:[l.jsxDEV(k,{title:"Drive",description:"Mount this brain as a network drive. It shows the notes, posts and files you can see here, as folders and files, to open and edit on your computer.",children:[i?l.jsxDEV(Me,{connect:i,created:b,busy:s||h!==void 0&&b===null,onConnect:()=>{O(g?.username??null),n.createAppPassword(Ue,"write")}},void 0,!1,void 0,this):null,l.jsxDEV("article",{className:o("drive-address",d.client),children:[l.jsxDEV("h4",{className:o("",d.clientName),children:"Your brain’s drive address"},void 0,!1,void 0,this),l.jsxDEV(_,{label:"drive address",code:e.davUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV(k,{title:"App passwords",description:"A mount signs in with an app password instead of your passkey. It works only for the drive, expires after a year and can be revoked here. It can only read unless you allow saving changes.",children:[g&&g!==b?l.jsxDEV("article",{"data-app-password-reveal":!0,className:o("drive-reveal",d.client),children:[l.jsxDEV("h4",{className:o("",d.clientName),children:"Your new app password"},void 0,!1,void 0,this),l.jsxDEV("p",{className:o("",d.text),children:"Copy both now. The password is shown only once."},void 0,!1,void 0,this),l.jsxDEV(_,{label:"username",code:g.username},void 0,!1,void 0,this),l.jsxDEV(_,{label:"password",code:g.password},void 0,!1,void 0,this),l.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:l.jsxDEV(y,{variant:"outline",type:"button",onClick:n.dismissCreatedAppPassword,children:"Done"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,t.appPasswords.length===0?l.jsxDEV("p",{className:o("",d.text),children:"No app passwords yet."},void 0,!1,void 0,this):t.appPasswords.map((f)=>l.jsxDEV(U,{kind:f.label,description:`${f.username} · ${f.access==="write"?"Read and write":"Read-only"}`,metadata:at(f,N),action:l.jsxDEV(y,{variant:"danger",disabled:s,type:"button",onClick:()=>n.revokeAppPassword(f.id),children:"Revoke"},void 0,!1,void 0,this)},f.id,!1,void 0,this)),l.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(f)=>{f.preventDefault();let Y=f.currentTarget,P=String(new FormData(Y).get(ne)??"");if(P.trim()==="")return;n.createAppPassword(P.trim(),T?"write":"read"),Y.reset(),C(!1)},children:[l.jsxDEV("label",{htmlFor:ne,className:o("",c.field),children:[l.jsxDEV("span",{className:o("",c.formLabel),children:"Name it after the computer it is for"},void 0,!1,void 0,this),l.jsxDEV(z,{id:ne,name:ne,type:"text",required:!0,maxLength:100,placeholder:"Laptop",autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("label",{htmlFor:De,className:o("",c.field),children:[l.jsxDEV("span",{className:o("",c.formLabel),children:"Allow saving changes"},void 0,!1,void 0,this),l.jsxDEV(ee,{id:De,"aria-label":"Allow saving changes",checked:T,onCheckedChange:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:l.jsxDEV(y,{variant:"outline",disabled:s,type:"submit",children:"New app password"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV(k,{title:"Use it in Obsidian",description:"Keep an Obsidian vault on your computer in step with your brain. Obsidian stays fast and works offline; notes and images sync in the background.",children:l.jsxDEV("article",{className:o("drive-obsidian",d.client),children:[l.jsxDEV("h4",{className:o("",d.clientName),children:"Rizom Brain"},void 0,!1,void 0,this),l.jsxDEV("ol",{className:o("",d.steps),children:[l.jsxDEV("li",{children:"Install the Rizom Brain plugin in Obsidian and turn it on."},void 0,!1,void 0,this),l.jsxDEV("li",{children:["In its settings, enter your brain’s address:"," ",l.jsxDEV("code",{children:new URL(e.davUrl).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("li",{children:"Choose Connect, and confirm on the page that opens here."},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.jsxDEV(k,{title:"Connect your computer",description:"Use your computer’s own file manager. The brain then appears as a drive beside your other folders.",children:[l.jsxDEV("div",{className:o("drive-clients",d.clients),children:D.map((f)=>l.jsxDEV(W,{client:f},f.id,!1,void 0,this))},void 0,!1,void 0,this),l.jsxDEV("details",{className:o("drive-command-line",d.developer),children:[l.jsxDEV("summary",{className:o("",d.developerSummary),children:["Command line",l.jsxDEV("span",{className:o("",d.developerHint),children:E.map((f)=>f.name).join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("drive-command-line-clients",d.clients,d.developerClients),children:E.map((f)=>l.jsxDEV(W,{client:f},f.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var w=v(te(),1);var oe={revokePasskey:{title:"Revoke this passkey?",message:"You will not be able to use this passkey again.",confirmLabel:"Revoke passkey",pending:"Revoking passkey…",complete:"Passkey revoked."},revokeSession:{title:"End this browser session?",message:"That browser will need a passkey to sign in again.",confirmLabel:"End session",pending:"Ending session…",complete:"Session ended."},revokeAppPassword:{title:"Revoke this app password?",message:"Anything mounted with it stops working at once. Its password cannot be recovered.",confirmLabel:"Revoke app password",pending:"Revoking app password…",complete:"App password revoked."},revokeOtherSessions:{title:"End every other browser session?",message:"Your current browser will remain signed in.",confirmLabel:"End other sessions",pending:"Ending other sessions…",complete:"Other sessions ended."}};function Be(e){return je(e,"Account request failed")}function _e(e){let{client:t,initialAccount:n}=e,[i,s]=w.useState(n),[g,h]=w.useState(n?.displayName??e.initialDisplayName),[O,b]=w.useState(""),[N,T]=w.useState(!1),[C,I]=w.useState(!1),[D,E]=w.useState(null),[f,Y]=w.useState(null);w.useEffect(()=>{if(n)return;let p=!1;return t.fetchAccount().then((S)=>{if(p)return;s(S),h(S.displayName)}).catch((S)=>{if(p)return;T(!0),b(Be(S))}),()=>{p=!0}},[t,n]);let P=w.useCallback(async(p,S,B)=>{I(!0),T(!1),b(p);try{let H=await B();if(H)s(H),h(H.displayName);b(S)}catch(H){T(!0),b(Be(H))}finally{I(!1)}},[]),me=async(p)=>(await t.mutateAccount(p)).account,Z=(p,S)=>E({title:p.title,message:p.message,confirmLabel:p.confirmLabel,action:()=>{P(p.pending,p.complete,()=>me(S))}});return{account:i,displayName:g,setDisplayName:h,status:O,error:N,busy:C,confirmation:D,cancelConfirmation:()=>E(null),confirm:()=>{if(!D)return;E(null),D.action()},saveName:()=>{P("Saving…","Display name updated.",()=>me({action:A.updateDisplayName,confirmation:A.updateDisplayName,displayName:g}))},addPasskey:()=>{P("Waiting for your authenticator…","Passkey added.",()=>t.registerPasskey())},revokePasskey:(p)=>Z(oe.revokePasskey,{action:A.revokePasskey,confirmation:A.revokePasskey,credentialId:p}),revokeSession:(p)=>Z(oe.revokeSession,{action:A.revokeSession,confirmation:A.revokeSession,sessionId:p}),revokeOtherSessions:()=>Z(oe.revokeOtherSessions,{action:A.revokeOtherSessions,confirmation:A.revokeOtherSessions}),revokeAllSessions:()=>E({title:"Sign out everywhere?",message:"This ends every session, including this one. You will need your passkey to return.",confirmLabel:"Sign out everywhere",action:()=>{P("Signing out everywhere…","Signed out.",async()=>{await t.mutateAccount({action:A.revokeAllSessions,confirmation:A.revokeAllSessions}),window.location.assign(`/login?return_to=${encodeURIComponent(e.routePath)}`);return})}}),saveSettings:(p,S)=>{let B=be(p.fields,S);P(`Saving ${p.title}…`,`${p.title} updated.`,()=>t.mutatePluginSettings({action:"save",definitionId:p.id,values:B}))},createdAppPassword:f,createAppPassword:(p,S)=>{P("Creating app password…","App password created.",async()=>{let B=await t.mutateAccount({action:A.createAppPassword,confirmation:A.createAppPassword,label:p,...S==="write"?{access:S}:{}});return Y(B.appPassword??null),B.account})},dismissCreatedAppPassword:()=>Y(null),revokeAppPassword:(p)=>Z(oe.revokeAppPassword,{action:A.revokeAppPassword,confirmation:A.revokeAppPassword,appPasswordId:p}),removeSettings:(p)=>E({title:`Remove ${p.title}?`,message:"The stored settings for this integration will be removed from your account only.",confirmLabel:"Remove settings",action:()=>{P(`Removing ${p.title}…`,`${p.title} removed.`,()=>t.mutatePluginSettings({action:"delete",definitionId:p.id}))}})}}var m=v(x(),1),it=["profile","security","identities","settings",K,F];function st(e){let t=e.connect?F:it.find((n)=>n===e.initialSection);if(!t||t===K&&!e.mcpUrl||t===F&&!e.davUrl)return"profile";return t}function rt(e){let t=["your profile","sign-in security","linked identities",...e.settings?["personal settings"]:[],...e.aiTools?["AI tools"]:[],...e.drive?["your drive"]:[]];return`Your account on this brain. Manage ${`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`} here—not shared services or other people’s access.`}function cn({bootstrap:e,initialAccount:t,client:n}){let i=qe(),s=ae.useMemo(()=>n??new ce({fetch:i.fetch}),[n,i]),g=_e({client:s,initialAccount:t,initialDisplayName:e.displayName,routePath:e.routePath}),{account:h,status:O,error:b,busy:N,confirmation:T}=g,[C,I]=ae.useState(()=>st(e)),D=h?.displayName??e.displayName;return m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:o("account-shell",c.shell,Ve.inset),children:[m.jsxDEV(Je,{model:{access:ze("public"),title:"Your account",totals:[]}},void 0,!1,void 0,this),m.jsxDEV("p",{className:o("account-scope",c.description),children:rt({settings:(h?.pluginSettings.length??0)>0,aiTools:Boolean(e.mcpUrl),drive:Boolean(e.davUrl)})},void 0,!1,void 0,this),m.jsxDEV("p",{className:o(`account-status${b?" is-error":""}`,c.feedback,b&&c.feedbackError),role:"status","aria-live":"polite",children:O},void 0,!1,void 0,this),!h?m.jsxDEV("p",{className:o("account-loading",c.loading),children:"Reading your account…"},void 0,!1,void 0,this):m.jsxDEV(Ye,{className:"account-details",value:C,onValueChange:I,children:[m.jsxDEV(He,{"aria-label":"Account sections",className:o("account-tabs",c.tabs),children:[m.jsxDEV(L,{value:"profile",disabled:N,children:"Profile"},void 0,!1,void 0,this),m.jsxDEV(L,{value:"security",disabled:N,children:"Sign-in & sessions"},void 0,!1,void 0,this),m.jsxDEV(L,{value:"identities",disabled:N,children:"Linked identities"},void 0,!1,void 0,this),h.pluginSettings.length>0&&m.jsxDEV(L,{value:"settings",disabled:N,children:"Personal settings"},void 0,!1,void 0,this),e.mcpUrl&&m.jsxDEV(L,{value:K,disabled:N,children:"AI tools"},void 0,!1,void 0,this),e.davUrl&&m.jsxDEV(L,{value:F,disabled:N,children:"Drive"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV(M,{value:"profile",forceMount:!0,hidden:C!=="profile",className:o("account-detail-sections",c.tabPanel),children:m.jsxDEV(we,{account:h,actions:g,title:D,studioPath:e.studioPath},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV(M,{value:"identities",forceMount:!0,hidden:C!=="identities",className:o("",c.tabPanel),children:m.jsxDEV(Ne,{account:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),h.pluginSettings.length>0&&m.jsxDEV(M,{value:"settings",forceMount:!0,hidden:C!=="settings",className:o("",c.tabPanel),children:m.jsxDEV(Te,{account:h,actions:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV(M,{value:"security",forceMount:!0,hidden:C!=="security",className:o("",c.tabPanel),children:m.jsxDEV(Pe,{account:h,actions:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.mcpUrl&&m.jsxDEV(M,{value:K,forceMount:!0,hidden:C!==K,className:o("",c.tabPanel),children:m.jsxDEV(Ee,{mcpUrl:e.mcpUrl},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.davUrl&&m.jsxDEV(M,{value:F,forceMount:!0,hidden:C!==F,className:o("",c.tabPanel),children:m.jsxDEV(Fe,{davUrl:e.davUrl,account:h,actions:g,connect:e.connect},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T&&m.jsxDEV(Ke,{mark:"!",title:T.title,titleId:"account-confirmation-title",cancelLabel:"Cancel",confirmLabel:T.confirmLabel,confirmVariant:"danger",pending:N,onCancel:g.cancelConfirmation,onConfirm:g.confirm,children:m.jsxDEV("p",{children:T.message},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{cn as AccountApp};
|
|
1
|
+
import{Eb as c,Fb as o,Gb as d,Ib as Ue,Jb as Le,Kb as $e,Lb as Me,Mb as Ae,Ob as ke}from"./main-n70s4zbm.js";import{Rb as Ve,Vb as ze,Wb as Je}from"./main-tn4apj9j.js";import{$b as x,Dc as Se,Hc as Q,Ic as A,Jc as je,Oc as K,Pc as F,bc as y,cc as z,ed as Ce,fc as ee,lc as Ke,md as qe,nc as Ye,nd as X,oc as He,pc as L,qc as M}from"./main-qtwkt52a.js";import{Od as a}from"./main-as971bnz.js";import{_e as te}from"./main-jrb0wvq4.js";import{Gf as v}from"./main-bgz7jfx7.js";var ae=v(te(),1);var We=a.object({displayName:a.string(),role:a.enum(["admin","trusted","public"]),profileEntityId:a.string().optional(),passkeys:a.array(a.object({id:a.string(),transports:a.array(a.string()).optional(),credentialDeviceType:a.string().optional(),credentialBackedUp:a.boolean(),createdAt:a.number(),updatedAt:a.number()})),appPasswords:a.array(a.object({id:a.string(),username:a.string(),label:a.string(),access:a.enum(["read","write"]),createdAt:a.number(),expiresAt:a.number(),lastUsedAt:a.number().optional()})),connectedChannels:a.array(a.object({type:a.string(),label:a.string(),verifiedAt:a.number()})),pluginSettings:a.array(a.object({id:a.string(),title:a.string(),description:a.string().optional(),configured:a.boolean(),revision:a.number().nullable(),fields:a.array(a.object({name:a.string(),label:a.string(),control:a.enum(["text","url","number","checkbox"]),secret:a.boolean(),required:a.boolean(),value:a.union([a.string(),a.number(),a.boolean(),a.null()]).optional(),set:a.boolean().optional()}))})),sessions:a.array(a.object({id:a.string(),current:a.boolean(),createdAt:a.number(),expiresAt:a.number()}))});function Ge(e){return We.safeParse(e).success}var fe=a.custom(Ge,{message:"Invalid account response"}),ie=a.object({account:fe}),Ze=a.object({account:fe.optional(),appPassword:a.object({username:a.string(),password:a.string()}).optional(),revoked:a.object({sessions:a.number(),refreshTokens:a.number().optional()}).optional(),signedOut:a.boolean().optional()});function Qe(e){return Ze.safeParse(e).success}var Xe=a.custom(Qe,{message:"Invalid account mutation response"}),et=a.custom((e)=>{if(!Q(e))return!1;return typeof e.challenge==="string"&&Q(e.rp)&&Q(e.user)&&Array.isArray(e.pubKeyCredParams)},{message:"Invalid passkey registration options"});class ge extends Error{status;constructor(e,t){super(e);this.name="AccountApiError",this.status=t}}async function q(e,t){let n;try{n=await e.json()}catch{n={}}if(!e.ok){let i=typeof n==="object"&&n!==null&&"error"in n&&typeof n.error==="string"?n.error:"Account request failed";throw new ge(i,e.status)}return t.parse(n)}function se(e){let t=e.replaceAll("-","+").replaceAll("_","/").padEnd(Math.ceil(e.length/4)*4,"=");return Uint8Array.from(atob(t),(n)=>n.charCodeAt(0)).buffer}function re(e){let t=new Uint8Array(e),n="";for(let i of t)n+=String.fromCharCode(i);return btoa(n).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function tt(e){return{challenge:se(e.challenge),rp:e.rp,user:{...e.user,id:se(e.user.id)},pubKeyCredParams:e.pubKeyCredParams,...e.timeout!==void 0?{timeout:e.timeout}:{},...e.excludeCredentials?{excludeCredentials:e.excludeCredentials.map((t)=>({...t,id:se(t.id)}))}:{},...e.authenticatorSelection?{authenticatorSelection:e.authenticatorSelection}:{},...e.attestation?{attestation:e.attestation}:{},...e.extensions?{extensions:e.extensions}:{}}}var nt=(e,t)=>fetch(e,t);class ce{fetchFn;constructor(e={}){this.fetchFn=e.fetch??nt}async fetchAccount(){return(await q(await this.fetchFn("/auth/account",{credentials:"same-origin",cache:"no-store"}),ie)).account}async mutatePluginSettings(e){return(await q(await this.fetchFn("/auth/account/plugin-settings",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ie)).account}async mutateAccount(e){return q(await this.fetchFn("/auth/account/mutations",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Xe)}async registerPasskey(){let e=await q(await this.fetchFn("/auth/account/passkeys/options",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"}),et),t=await navigator.credentials.create({publicKey:tt(e)});if(!(t instanceof PublicKeyCredential))throw Error("Passkey registration was cancelled");if(!(t.response instanceof AuthenticatorAttestationResponse))throw Error("Authenticator returned an invalid passkey response");let n=t.response,i={id:t.id,rawId:re(t.rawId),type:t.type,...t.authenticatorAttachment?{authenticatorAttachment:t.authenticatorAttachment}:{},clientExtensionResults:t.getClientExtensionResults(),response:{clientDataJSON:re(n.clientDataJSON),attestationObject:re(n.attestationObject),transports:typeof n.getTransports==="function"?n.getTransports():[]}};return(await q(await this.fetchFn("/auth/account/passkeys/verify",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),ie.extend({verified:a.literal(!0)}))).account}}function he(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map((t)=>t.slice(0,1).toUpperCase()).join("")}function ye(e,t){let n=t.indexOf("/");if(n<=0||n===t.length-1)return;let i=t.slice(0,n),s=t.slice(n+1);return`${e==="/"?"":e.replace(/\/+$/,"")}/entities/${encodeURIComponent(i)}/${encodeURIComponent(s)}`}function j(e,t=!1){return new Date(t?e:e*1000).toISOString()}var R=v(x(),1);function V(e){return R.jsxDEV(y,{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 U(e){return R.jsxDEV("div",{className:o("account-access-item",c.access),children:[R.jsxDEV(Ae,{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 k(e){return R.jsxDEV("section",{className:o("account-detail-section",c.section),children:[R.jsxDEV("div",{className:"account-section-label",children:[R.jsxDEV("h3",{className:o("",c.heading,X.section),children:e.title},void 0,!1,void 0,this),e.description?R.jsxDEV("p",{className:o("",c.description),children:e.description},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),R.jsxDEV("div",{className:o("people-stack",c.stack),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function be(e,t){let n=Object.fromEntries(t.entries());for(let i of e)if(i.control==="checkbox")n[i.name]=t.has(i.name);else if(i.control==="number"&&typeof n[i.name]==="string"&&n[i.name]!=="")n[i.name]=Number(n[i.name]);return n}function ve(e){if(e.secret)return"password";if(e.control==="url"||e.control==="number")return e.control;return"text"}var r=v(x(),1);function we(e){let{account:t,actions:n,title:i,studioPath:s}=e,g=t.role,h=t.profileEntityId?ye(s,t.profileEntityId):void 0;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV(k,{title:"Profile",children:[r.jsxDEV("div",{className:o("account-identity",c.identity),children:r.jsxDEV("div",{className:o("people-detail-person",c.person),children:[r.jsxDEV("span",{className:o("people-avatar people-avatar--large",c.avatar),children:he(i)},void 0,!1,void 0,this),r.jsxDEV("span",{className:o("",c.personCopy),children:[r.jsxDEV("span",{className:o("people-detail-name",c.name,X.secondaryDisplay),children:i},void 0,!1,void 0,this),r.jsxDEV("span",{"data-account-role":g,className:o("account-role",c.role),children:Se(g)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t.profileEntityId?r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("account-profile-note",c.description),children:"Managed by the Anchor profile — your account name follows the published profile."},void 0,!1,void 0,this),r.jsxDEV(U,{kind:"Anchor profile",description:i,action:h?r.jsxDEV(y,{asChild:!0,variant:"link",children:r.jsxDEV("a",{href:h,children:"Edit Anchor Profile →"},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):r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(O)=>{O.preventDefault(),n.saveName()},children:[r.jsxDEV("label",{className:o("",c.formLabel),htmlFor:"display-name",children:"Display name"},void 0,!1,void 0,this),r.jsxDEV(z,{id:"display-name",maxLength:200,autoComplete:"name",required:!0,value:n.displayName,onChange:(O)=>n.setDisplayName(O.target.value)},void 0,!1,void 0,this),r.jsxDEV(V,{type:"submit",disabled:n.busy,children:"Save name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV("p",{className:o("",c.description),children:"Your role controls access to this brain. An administrator manages access in Administration."},void 0,!1,void 0,this),g==="admin"&&r.jsxDEV(y,{asChild:!0,variant:"outline",children:r.jsxDEV("a",{href:Ce(s,"admin:administration"),children:"Manage people in Administration →"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ne(e){let t=e.account.connectedChannels;return r.jsxDEV(k,{title:"Linked identities",description:"How this brain recognizes messages from you. These are your identities, not services configured for the whole brain.",children:t.length===0?r.jsxDEV("p",{className:o("people-empty",c.empty),children:"No linked identities."},void 0,!1,void 0,this):t.map((n)=>r.jsxDEV(U,{kind:n.type,description:n.label,metadata:[`Verified: ${j(n.verifiedAt,!0)}`]},`${n.type}:${n.label}`,!1,void 0,this))},void 0,!1,void 0,this)}function Te(e){let{account:t,actions:n}=e;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("",c.description),children:"Settings for your account only. These do not configure shared services for the brain."},void 0,!1,void 0,this),t.pluginSettings.map((i)=>r.jsxDEV(ke,{label:i.title,density:"comfortable",presentation:"disclosure",children:[r.jsxDEV("p",{className:o("account-settings-description",c.description),children:i.description??"Private settings for this account."},void 0,!1,void 0,this),r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(s)=>{s.preventDefault(),n.saveSettings(i,new FormData(s.currentTarget))},children:[i.fields.map((s)=>r.jsxDEV("label",{htmlFor:`setting-${i.id}-${s.name}`,className:o("",c.field),children:[r.jsxDEV("span",{className:o("",c.formLabel),children:s.label},void 0,!1,void 0,this),s.control==="checkbox"?r.jsxDEV(ee,{id:`setting-${i.id}-${s.name}`,name:s.name,defaultChecked:s.value===!0},void 0,!1,void 0,this):r.jsxDEV(z,{id:`setting-${i.id}-${s.name}`,name:s.name,type:ve(s),required:s.required&&(!i.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)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:[r.jsxDEV(V,{type:"submit",tone:"primary",disabled:n.busy,children:"Save settings"},void 0,!1,void 0,this),i.configured?r.jsxDEV(y,{variant:"danger",disabled:n.busy,type:"button",onClick:()=>n.removeSettings(i),children:"Remove"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},`${i.id}:${i.revision??"unset"}`,!0,void 0,this)]},i.id,!0,void 0,this))]},void 0,!0,void 0,this)}function Pe(e){let{account:t,actions:n}=e,{busy:i}=n;return r.jsxDEV("div",{className:o("",c.column),children:[r.jsxDEV(k,{title:"Sign-in",description:"Passkeys used to access this account. Your final passkey is protected from revocation.",children:[t.passkeys.map((s)=>r.jsxDEV(U,{kind:s.credentialBackedUp?"Synced passkey":"Device passkey",metadata:[`Added: ${j(s.createdAt,!0)}`],action:t.passkeys.length>1?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokePasskey(s.id),children:"Revoke"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:r.jsxDEV(y,{variant:"outline",disabled:i,type:"button",onClick:n.addPasskey,children:"Add passkey"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV(k,{title:"Signed-in sessions",children:t.sessions.map((s)=>r.jsxDEV(U,{kind:s.current?"This session":"Browser session",metadata:[`Started: ${j(s.createdAt)}`,...s.current?["Current browser"]:[]],action:!s.current?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokeSession(s.id),children:"End"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this))},void 0,!1,void 0,this),r.jsxDEV("footer",{className:o("account-session-actions",c.footer),children:[r.jsxDEV("small",{children:"Access changes require an Admin."},void 0,!1,void 0,this),r.jsxDEV("div",{className:o("",c.actions),children:[r.jsxDEV(V,{disabled:i||t.sessions.every((s)=>s.current),onClick:n.revokeOtherSessions,children:"End other sessions"},void 0,!1,void 0,this),r.jsxDEV(V,{tone:"danger",disabled:i,onClick:n.revokeAllSessions,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)}var Re=v(te(),1);function de(e){return new URL(e).host.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function le(e){return JSON.stringify(e,null,2)}function xe(e,t,n){return["Already have servers there? Add only the ",{code:`"${n}"`}," entry inside ",{code:`"${t}"`},` of ${e}.`]}function Oe(e){let t=de(e),n="Sign in with your passkey when asked.";return[{id:"claude",group:"primary",name:"Claude",note:["Desktop app and claude.ai."],steps:[["Open Settings → Connectors → Add custom connector."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when asked."]]},{id:"chatgpt",group:"primary",name:"ChatGPT",steps:[["Open Settings → Apps & Connectors → Advanced and turn on Developer mode."],["Choose Create, name it ",{code:t},", paste your brain’s address and pick OAuth."],["Sign in with your passkey when asked."]]},{id:"claude-code",group:"developer",name:"Claude Code",lead:[["Add the server in your terminal:"]],snippet:{label:"Claude Code command",code:`claude mcp add --transport http ${t} ${e}`},after:[["Then start Claude Code, run ",{code:"/mcp"},", choose ",{code:t}," and sign in with your passkey."]]},{id:"cursor",group:"developer",name:"Cursor",steps:[["Open Cursor Settings → MCP → Add new global MCP server."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when Cursor asks."]],lead:[["Or add it to ",{code:"~/.cursor/mcp.json"},":"]],snippet:{label:"Cursor configuration",code:le({mcpServers:{[t]:{url:e}}})},after:[xe("the file","mcpServers",t)]},{id:"vscode",group:"developer",name:"VS Code",steps:[["Open the Command Palette and run ",{code:"MCP: Add Server"},"."],["Choose HTTP, paste your brain’s address and name it ",{code:t},"."],["Choose Global, then sign in with your passkey when asked."]],lead:[["Or run ",{code:"MCP: Open User Configuration"}," and add:"]],snippet:{label:"VS Code configuration",code:le({servers:{[t]:{type:"http",url:e}}})},after:[xe("your user configuration","servers",t)]},{id:"other",group:"developer",name:"Any other MCP client",inlineName:"any other MCP client",note:["Look for “add MCP server”, “connector” or “integration” in the tool’s settings and fill in:"],fields:[{label:"Name",value:[{code:t}]},{label:"Type",value:["Remote server, Streamable HTTP — not stdio, not SSE"]},{label:"URL",value:[{code:e}]},{label:"Authentication",value:["OAuth. Leave API key, token, client ID and secret empty; the tool registers itself."]}],lead:[["When you connect, your browser opens “Authorize <tool>?” on your brain. Approve MCP access with your passkey. The tool then has two tools: ",{code:"chat"},", to ask your brain anything as you would in chat, and ",{code:"confirm"},", to approve changes when the brain asks."],["Tool only takes local (stdio) servers, or insists on an API key? Bridge it with ",{code:"mcp-remote"},", which handles the sign-in:"]],snippet:{label:"mcp-remote bridge configuration",code:le({mcpServers:{[t]:{command:"npx",args:["-y","mcp-remote",e]}}})}}]}var u=v(x(),1);function J(e){return u.jsxDEV(u.Fragment,{children:e.text.map((t,n)=>typeof t==="string"?t:u.jsxDEV("code",{className:o("",d.code),children:t.code},n,!1,void 0,this))},void 0,!1,void 0,this)}function _(e){let[t,n]=Re.useState("idle"),i=async()=>{try{await navigator.clipboard.writeText(e.code),n("copied")}catch{n("unavailable")}};return u.jsxDEV("div",{className:o("ai-tools-snippet",d.snippet),children:[u.jsxDEV("pre",{className:o("",d.snippetCode),"aria-label":e.label,children:e.code},void 0,!1,void 0,this),u.jsxDEV(y,{variant:"outline",size:"sm",onClick:()=>void i(),"aria-label":`Copy ${e.label}`,children:t==="copied"?"Copied":t==="unavailable"?"Select to copy":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function W(e){let{client:t}=e;return u.jsxDEV("article",{className:o("ai-tools-client",d.client),children:[u.jsxDEV("h4",{className:o("",d.clientName),children:t.name},void 0,!1,void 0,this),t.note?u.jsxDEV("p",{className:o("",d.text),children:u.jsxDEV(J,{text:t.note},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,t.steps?u.jsxDEV("ol",{className:o("",d.steps),children:t.steps.map((n,i)=>u.jsxDEV("li",{children:u.jsxDEV(J,{text:n},void 0,!1,void 0,this)},i,!1,void 0,this))},void 0,!1,void 0,this):null,t.fields?u.jsxDEV("dl",{className:o("",d.fields),children:t.fields.map((n)=>u.jsxDEV("div",{className:o("",d.field),children:[u.jsxDEV("dt",{className:o("",d.fieldLabel),children:n.label},void 0,!1,void 0,this),u.jsxDEV("dd",{className:o("",d.fieldValue),children:u.jsxDEV(J,{text:n.value},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},n.label,!0,void 0,this))},void 0,!1,void 0,this):null,t.lead?.map((n,i)=>u.jsxDEV("p",{className:o("",d.text),children:u.jsxDEV(J,{text:n},void 0,!1,void 0,this)},`lead-${i}`,!1,void 0,this)),t.snippet?u.jsxDEV(_,{...t.snippet},void 0,!1,void 0,this):null,t.after?.map((n,i)=>u.jsxDEV("p",{className:o("",d.text),children:u.jsxDEV(J,{text:n},void 0,!1,void 0,this)},`after-${i}`,!1,void 0,this))]},void 0,!0,void 0,this)}function ot(e){return e.length<2?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}function Ee(e){let t=Oe(e.mcpUrl),n=t.filter((s)=>s.group==="primary"),i=t.filter((s)=>s.group==="developer");return u.jsxDEV(k,{title:"AI tools",description:"Connect AI tools you already use to this brain. A connected tool talks to the brain as you do in chat — asking, saving and updating within your access — after you sign in with your passkey.",children:[u.jsxDEV("article",{className:o("ai-tools-address",d.client),children:[u.jsxDEV("h4",{className:o("",d.clientName),children:"Your brain’s address"},void 0,!1,void 0,this),u.jsxDEV(_,{label:"brain address",code:e.mcpUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.jsxDEV("div",{className:o("ai-tools-clients",d.clients),children:n.map((s)=>u.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this),u.jsxDEV("details",{className:o("ai-tools-developer",d.developer),children:[u.jsxDEV("summary",{className:o("",d.developerSummary),children:["Developer tools and other clients",u.jsxDEV("span",{className:o("",d.developerHint),children:ot(i.map((s)=>s.inlineName??s.name))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.jsxDEV("div",{className:o("ai-tools-clients",d.clients,d.developerClients),children:i.map((s)=>u.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var G=v(te(),1);var ue="Enter the username and password of an app password from this page.";function Ie(e){let t=new URL(e),n=`${t.protocol==="https:"?"davs":"dav"}://${t.host}${t.pathname}`,i=de(e);return[{id:"macos",group:"file-manager",name:"macOS",note:["Finder, on any Mac."],steps:[["In Finder, choose Go → Connect to Server (⌘K)."],["Paste the address below and click Connect."],["Choose Registered User. ",ue]],snippet:{label:"macOS address",code:e}},{id:"windows",group:"file-manager",name:"Windows",note:["File Explorer, on Windows 10 and 11."],steps:[["In File Explorer, open This PC and choose Map network drive."],["Paste the address below as the folder, tick Connect using different credentials, and click Finish."],[ue]],snippet:{label:"Windows address",code:e}},{id:"gnome-files",group:"file-manager",name:"GNOME Files",note:["The file manager on Ubuntu, Fedora and other GNOME desktops."],steps:[["Open Files → Other Locations (or Network)."],["Under Connect to Server, enter the address below and connect."],[ue]],snippet:{label:"GNOME Files address",code:n}},{id:"rclone",group:"command-line",name:"rclone",note:["Linux, macOS and Windows, from a terminal."],lead:[["Store the drive as a remote, with your app password’s username and password:"]],snippet:{label:"rclone remote command",code:`rclone config create ${i} webdav url=${e} vendor=other user=YOUR_USERNAME pass=YOUR_PASSWORD --obscure`},after:[["Then mount it on an empty folder: ",{code:`rclone mount ${i}: ~/Brain --vfs-cache-mode writes`},"."]]}]}var l=v(x(),1),ne="app-password-label",De="app-password-write";function pe(e){return j(e).slice(0,10)}function at(e,t){return[`Created: ${pe(e.createdAt)}`,`${e.expiresAt<=t?"Expired":"Expires"}: ${pe(e.expiresAt)}`,e.lastUsedAt===void 0?"Never used":`Last used: ${pe(e.lastUsedAt)}`]}function Fe(e){let{account:t,actions:n,connect:i}=e,{busy:s,createdAppPassword:g}=n,[h,O]=G.useState(void 0),b=i!==void 0&&h!==void 0?Le(g,h,t.appPasswords):null;G.useEffect(()=>{if(i&&b)window.location.assign($e(i.state,b))},[i,b]);let N=Math.floor(Date.now()/1000),[T,C]=G.useState(!1),I=Ie(e.davUrl),D=I.filter((f)=>f.group==="file-manager"),E=I.filter((f)=>f.group==="command-line");return l.jsxDEV("div",{className:o("",c.column),children:[l.jsxDEV(k,{title:"Drive",description:"Mount this brain as a network drive. It shows the notes, posts and files you can see here, as folders and files, to open and edit on your computer.",children:[i?l.jsxDEV(Me,{connect:i,created:b,busy:s||h!==void 0&&b===null,onConnect:()=>{O(g?.username??null),n.createAppPassword(Ue,"write")}},void 0,!1,void 0,this):null,l.jsxDEV("article",{className:o("drive-address",d.client),children:[l.jsxDEV("h4",{className:o("",d.clientName),children:"Your brain’s drive address"},void 0,!1,void 0,this),l.jsxDEV(_,{label:"drive address",code:e.davUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV(k,{title:"App passwords",description:"A mount signs in with an app password instead of your passkey. It works only for the drive, expires after a year and can be revoked here. It can only read unless you allow saving changes.",children:[g&&g!==b?l.jsxDEV("article",{"data-app-password-reveal":!0,className:o("drive-reveal",d.client),children:[l.jsxDEV("h4",{className:o("",d.clientName),children:"Your new app password"},void 0,!1,void 0,this),l.jsxDEV("p",{className:o("",d.text),children:"Copy both now. The password is shown only once."},void 0,!1,void 0,this),l.jsxDEV(_,{label:"username",code:g.username},void 0,!1,void 0,this),l.jsxDEV(_,{label:"password",code:g.password},void 0,!1,void 0,this),l.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:l.jsxDEV(y,{variant:"outline",type:"button",onClick:n.dismissCreatedAppPassword,children:"Done"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,t.appPasswords.length===0?l.jsxDEV("p",{className:o("",d.text),children:"No app passwords yet."},void 0,!1,void 0,this):t.appPasswords.map((f)=>l.jsxDEV(U,{kind:f.label,description:`${f.username} · ${f.access==="write"?"Read and write":"Read-only"}`,metadata:at(f,N),action:l.jsxDEV(y,{variant:"danger",disabled:s,type:"button",onClick:()=>n.revokeAppPassword(f.id),children:"Revoke"},void 0,!1,void 0,this)},f.id,!1,void 0,this)),l.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(f)=>{f.preventDefault();let Y=f.currentTarget,P=String(new FormData(Y).get(ne)??"");if(P.trim()==="")return;n.createAppPassword(P.trim(),T?"write":"read"),Y.reset(),C(!1)},children:[l.jsxDEV("label",{htmlFor:ne,className:o("",c.field),children:[l.jsxDEV("span",{className:o("",c.formLabel),children:"Name it after the computer it is for"},void 0,!1,void 0,this),l.jsxDEV(z,{id:ne,name:ne,type:"text",required:!0,maxLength:100,placeholder:"Laptop",autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("label",{htmlFor:De,className:o("",c.field),children:[l.jsxDEV("span",{className:o("",c.formLabel),children:"Allow saving changes"},void 0,!1,void 0,this),l.jsxDEV(ee,{id:De,"aria-label":"Allow saving changes",checked:T,onCheckedChange:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:l.jsxDEV(y,{variant:"outline",disabled:s,type:"submit",children:"New app password"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV(k,{title:"Use it in Obsidian",description:"Keep an Obsidian vault on your computer in step with your brain. Obsidian stays fast and works offline; notes and images sync in the background.",children:l.jsxDEV("article",{className:o("drive-obsidian",d.client),children:[l.jsxDEV("h4",{className:o("",d.clientName),children:"Rizom Brain"},void 0,!1,void 0,this),l.jsxDEV("ol",{className:o("",d.steps),children:[l.jsxDEV("li",{children:"Install the Rizom Brain plugin in Obsidian and turn it on."},void 0,!1,void 0,this),l.jsxDEV("li",{children:["In its settings, enter your brain’s address:"," ",l.jsxDEV("code",{children:new URL(e.davUrl).host},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("li",{children:"Choose Connect, and confirm on the page that opens here."},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.jsxDEV(k,{title:"Connect your computer",description:"Use your computer’s own file manager. The brain then appears as a drive beside your other folders.",children:[l.jsxDEV("div",{className:o("drive-clients",d.clients),children:D.map((f)=>l.jsxDEV(W,{client:f},f.id,!1,void 0,this))},void 0,!1,void 0,this),l.jsxDEV("details",{className:o("drive-command-line",d.developer),children:[l.jsxDEV("summary",{className:o("",d.developerSummary),children:["Command line",l.jsxDEV("span",{className:o("",d.developerHint),children:E.map((f)=>f.name).join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("drive-command-line-clients",d.clients,d.developerClients),children:E.map((f)=>l.jsxDEV(W,{client:f},f.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var w=v(te(),1);var oe={revokePasskey:{title:"Revoke this passkey?",message:"You will not be able to use this passkey again.",confirmLabel:"Revoke passkey",pending:"Revoking passkey…",complete:"Passkey revoked."},revokeSession:{title:"End this browser session?",message:"That browser will need a passkey to sign in again.",confirmLabel:"End session",pending:"Ending session…",complete:"Session ended."},revokeAppPassword:{title:"Revoke this app password?",message:"Anything mounted with it stops working at once. Its password cannot be recovered.",confirmLabel:"Revoke app password",pending:"Revoking app password…",complete:"App password revoked."},revokeOtherSessions:{title:"End every other browser session?",message:"Your current browser will remain signed in.",confirmLabel:"End other sessions",pending:"Ending other sessions…",complete:"Other sessions ended."}};function Be(e){return je(e,"Account request failed")}function _e(e){let{client:t,initialAccount:n}=e,[i,s]=w.useState(n),[g,h]=w.useState(n?.displayName??e.initialDisplayName),[O,b]=w.useState(""),[N,T]=w.useState(!1),[C,I]=w.useState(!1),[D,E]=w.useState(null),[f,Y]=w.useState(null);w.useEffect(()=>{if(n)return;let p=!1;return t.fetchAccount().then((S)=>{if(p)return;s(S),h(S.displayName)}).catch((S)=>{if(p)return;T(!0),b(Be(S))}),()=>{p=!0}},[t,n]);let P=w.useCallback(async(p,S,B)=>{I(!0),T(!1),b(p);try{let H=await B();if(H)s(H),h(H.displayName);b(S)}catch(H){T(!0),b(Be(H))}finally{I(!1)}},[]),me=async(p)=>(await t.mutateAccount(p)).account,Z=(p,S)=>E({title:p.title,message:p.message,confirmLabel:p.confirmLabel,action:()=>{P(p.pending,p.complete,()=>me(S))}});return{account:i,displayName:g,setDisplayName:h,status:O,error:N,busy:C,confirmation:D,cancelConfirmation:()=>E(null),confirm:()=>{if(!D)return;E(null),D.action()},saveName:()=>{P("Saving…","Display name updated.",()=>me({action:A.updateDisplayName,confirmation:A.updateDisplayName,displayName:g}))},addPasskey:()=>{P("Waiting for your authenticator…","Passkey added.",()=>t.registerPasskey())},revokePasskey:(p)=>Z(oe.revokePasskey,{action:A.revokePasskey,confirmation:A.revokePasskey,credentialId:p}),revokeSession:(p)=>Z(oe.revokeSession,{action:A.revokeSession,confirmation:A.revokeSession,sessionId:p}),revokeOtherSessions:()=>Z(oe.revokeOtherSessions,{action:A.revokeOtherSessions,confirmation:A.revokeOtherSessions}),revokeAllSessions:()=>E({title:"Sign out everywhere?",message:"This ends every session, including this one. You will need your passkey to return.",confirmLabel:"Sign out everywhere",action:()=>{P("Signing out everywhere…","Signed out.",async()=>{await t.mutateAccount({action:A.revokeAllSessions,confirmation:A.revokeAllSessions}),window.location.assign(`/login?return_to=${encodeURIComponent(e.routePath)}`);return})}}),saveSettings:(p,S)=>{let B=be(p.fields,S);P(`Saving ${p.title}…`,`${p.title} updated.`,()=>t.mutatePluginSettings({action:"save",definitionId:p.id,values:B}))},createdAppPassword:f,createAppPassword:(p,S)=>{P("Creating app password…","App password created.",async()=>{let B=await t.mutateAccount({action:A.createAppPassword,confirmation:A.createAppPassword,label:p,...S==="write"?{access:S}:{}});return Y(B.appPassword??null),B.account})},dismissCreatedAppPassword:()=>Y(null),revokeAppPassword:(p)=>Z(oe.revokeAppPassword,{action:A.revokeAppPassword,confirmation:A.revokeAppPassword,appPasswordId:p}),removeSettings:(p)=>E({title:`Remove ${p.title}?`,message:"The stored settings for this integration will be removed from your account only.",confirmLabel:"Remove settings",action:()=>{P(`Removing ${p.title}…`,`${p.title} removed.`,()=>t.mutatePluginSettings({action:"delete",definitionId:p.id}))}})}}var m=v(x(),1),it=["profile","security","identities","settings",K,F];function st(e){let t=e.connect?F:it.find((n)=>n===e.initialSection);if(!t||t===K&&!e.mcpUrl||t===F&&!e.davUrl)return"profile";return t}function rt(e){let t=["your profile","sign-in security","linked identities",...e.settings?["personal settings"]:[],...e.aiTools?["AI tools"]:[],...e.drive?["your drive"]:[]];return`Your account on this brain. Manage ${`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`} here—not shared services or other people’s access.`}function cn({bootstrap:e,initialAccount:t,client:n}){let i=qe(),s=ae.useMemo(()=>n??new ce({fetch:i.fetch}),[n,i]),g=_e({client:s,initialAccount:t,initialDisplayName:e.displayName,routePath:e.routePath}),{account:h,status:O,error:b,busy:N,confirmation:T}=g,[C,I]=ae.useState(()=>st(e)),D=h?.displayName??e.displayName;return m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:o("account-shell",c.shell,Ve.inset),children:[m.jsxDEV(Je,{model:{access:ze("public"),title:"Your account",totals:[]}},void 0,!1,void 0,this),m.jsxDEV("p",{className:o("account-scope",c.description),children:rt({settings:(h?.pluginSettings.length??0)>0,aiTools:Boolean(e.mcpUrl),drive:Boolean(e.davUrl)})},void 0,!1,void 0,this),m.jsxDEV("p",{className:o(`account-status${b?" is-error":""}`,c.feedback,b&&c.feedbackError),role:"status","aria-live":"polite",children:O},void 0,!1,void 0,this),!h?m.jsxDEV("p",{className:o("account-loading",c.loading),children:"Reading your account…"},void 0,!1,void 0,this):m.jsxDEV(Ye,{className:"account-details",value:C,onValueChange:I,children:[m.jsxDEV(He,{"aria-label":"Account sections",className:o("account-tabs",c.tabs),children:[m.jsxDEV(L,{value:"profile",disabled:N,children:"Profile"},void 0,!1,void 0,this),m.jsxDEV(L,{value:"security",disabled:N,children:"Sign-in & sessions"},void 0,!1,void 0,this),m.jsxDEV(L,{value:"identities",disabled:N,children:"Linked identities"},void 0,!1,void 0,this),h.pluginSettings.length>0&&m.jsxDEV(L,{value:"settings",disabled:N,children:"Personal settings"},void 0,!1,void 0,this),e.mcpUrl&&m.jsxDEV(L,{value:K,disabled:N,children:"AI tools"},void 0,!1,void 0,this),e.davUrl&&m.jsxDEV(L,{value:F,disabled:N,children:"Drive"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV(M,{value:"profile",forceMount:!0,hidden:C!=="profile",className:o("account-detail-sections",c.tabPanel),children:m.jsxDEV(we,{account:h,actions:g,title:D,studioPath:e.studioPath},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV(M,{value:"identities",forceMount:!0,hidden:C!=="identities",className:o("",c.tabPanel),children:m.jsxDEV(Ne,{account:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),h.pluginSettings.length>0&&m.jsxDEV(M,{value:"settings",forceMount:!0,hidden:C!=="settings",className:o("",c.tabPanel),children:m.jsxDEV(Te,{account:h,actions:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV(M,{value:"security",forceMount:!0,hidden:C!=="security",className:o("",c.tabPanel),children:m.jsxDEV(Pe,{account:h,actions:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.mcpUrl&&m.jsxDEV(M,{value:K,forceMount:!0,hidden:C!==K,className:o("",c.tabPanel),children:m.jsxDEV(Ee,{mcpUrl:e.mcpUrl},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.davUrl&&m.jsxDEV(M,{value:F,forceMount:!0,hidden:C!==F,className:o("",c.tabPanel),children:m.jsxDEV(Fe,{davUrl:e.davUrl,account:h,actions:g,connect:e.connect},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T&&m.jsxDEV(Ke,{mark:"!",title:T.title,titleId:"account-confirmation-title",cancelLabel:"Cancel",confirmLabel:T.confirmLabel,confirmVariant:"danger",pending:N,onCancel:g.cancelConfirmation,onConfirm:g.confirm,children:m.jsxDEV("p",{children:T.message},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{cn as AccountApp};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=4A7C931D3058EEFA64756E2164756E21
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"import { useCallback, useEffect, useState } from \"react\";\nimport {\n AUTH_ACCOUNT_MUTATION_ACTIONS,\n type AuthAccountAppPasswordSecret,\n type AuthAccountMutation,\n type AuthAppPasswordAccess,\n type AuthAccountPluginSettingsForm,\n type AuthAccountSnapshot,\n} from \"@brains/contracts\";\nimport { getErrorMessage } from \"@brains/utils/error\";\nimport type { AccountClient } from \"./account-api\";\nimport { settingsFormValues } from \"./account-settings\";\n\nexport interface AccountConfirmation {\n title: string;\n message: string;\n confirmLabel: string;\n action: () => void;\n}\n\ninterface ConfirmedMutationCopy {\n title: string;\n message: string;\n confirmLabel: string;\n pending: string;\n complete: string;\n}\n\n/** The copy for each account change that asks before it runs. */\nconst CONFIRMED_MUTATIONS = {\n revokePasskey: {\n title: \"Revoke this passkey?\",\n message: \"You will not be able to use this passkey again.\",\n confirmLabel: \"Revoke passkey\",\n pending: \"Revoking passkey…\",\n complete: \"Passkey revoked.\",\n },\n revokeSession: {\n title: \"End this browser session?\",\n message: \"That browser will need a passkey to sign in again.\",\n confirmLabel: \"End session\",\n pending: \"Ending session…\",\n complete: \"Session ended.\",\n },\n revokeAppPassword: {\n title: \"Revoke this app password?\",\n message:\n \"Anything mounted with it stops working at once. Its password cannot be recovered.\",\n confirmLabel: \"Revoke app password\",\n pending: \"Revoking app password…\",\n complete: \"App password revoked.\",\n },\n revokeOtherSessions: {\n title: \"End every other browser session?\",\n message: \"Your current browser will remain signed in.\",\n confirmLabel: \"End other sessions\",\n pending: \"Ending other sessions…\",\n complete: \"Other sessions ended.\",\n },\n} satisfies Record<string, ConfirmedMutationCopy>;\n\nfunction messageOf(error: unknown): string {\n return getErrorMessage(error, \"Account request failed\");\n}\n\nexport interface AccountActionsInput {\n client: AccountClient;\n initialAccount: AuthAccountSnapshot | undefined;\n initialDisplayName: string;\n /** Where to come back to after signing out everywhere. */\n routePath: string;\n}\n\nexport interface AccountActions {\n account: AuthAccountSnapshot | undefined;\n displayName: string;\n setDisplayName: (value: string) => void;\n status: string;\n error: boolean;\n busy: boolean;\n confirmation: AccountConfirmation | null;\n cancelConfirmation: () => void;\n confirm: () => void;\n saveName: () => void;\n addPasskey: () => void;\n revokePasskey: (credentialId: string) => void;\n revokeSession: (sessionId: string) => void;\n revokeOtherSessions: () => void;\n revokeAllSessions: () => void;\n saveSettings: (\n settings: AuthAccountPluginSettingsForm,\n formData: FormData,\n ) => void;\n removeSettings: (settings: AuthAccountPluginSettingsForm) => void;\n /** The app password just created: the only time its password is known. */\n createdAppPassword: AuthAccountAppPasswordSecret | null;\n createAppPassword: (label: string, access: AuthAppPasswordAccess) => void;\n dismissCreatedAppPassword: () => void;\n revokeAppPassword: (appPasswordId: string) => void;\n}\n\n/**\n * The signed-in account and every change the Account page can make to it.\n * Each change reports its progress in one status line; destructive ones ask\n * first through a single pending confirmation.\n */\nexport function useAccountActions(input: AccountActionsInput): AccountActions {\n const { client, initialAccount } = input;\n const [account, setAccount] = useState(initialAccount);\n const [displayName, setDisplayName] = useState(\n initialAccount?.displayName ?? input.initialDisplayName,\n );\n const [status, setStatus] = useState(\"\");\n const [error, setError] = useState(false);\n const [busy, setBusy] = useState(false);\n const [confirmation, setConfirmation] = useState<AccountConfirmation | null>(\n null,\n );\n const [createdAppPassword, setCreatedAppPassword] =\n useState<AuthAccountAppPasswordSecret | null>(null);\n\n useEffect(() => {\n if (initialAccount) return;\n let cancelled = false;\n client\n .fetchAccount()\n .then((next) => {\n if (cancelled) return;\n setAccount(next);\n setDisplayName(next.displayName);\n })\n .catch((nextError: unknown) => {\n if (cancelled) return;\n setError(true);\n setStatus(messageOf(nextError));\n });\n return (): void => {\n cancelled = true;\n };\n }, [client, initialAccount]);\n\n const run = useCallback(\n async (\n pending: string,\n complete: string,\n action: () => Promise<AuthAccountSnapshot | undefined>,\n ): Promise<void> => {\n setBusy(true);\n setError(false);\n setStatus(pending);\n try {\n const next = await action();\n if (next) {\n setAccount(next);\n setDisplayName(next.displayName);\n }\n setStatus(complete);\n } catch (nextError) {\n setError(true);\n setStatus(messageOf(nextError));\n } finally {\n setBusy(false);\n }\n },\n [],\n );\n\n const mutate = async (\n mutation: AuthAccountMutation,\n ): Promise<AuthAccountSnapshot | undefined> =>\n (await client.mutateAccount(mutation)).account;\n\n const confirmMutation = (\n copy: ConfirmedMutationCopy,\n mutation: AuthAccountMutation,\n ): void =>\n setConfirmation({\n title: copy.title,\n message: copy.message,\n confirmLabel: copy.confirmLabel,\n action: () => {\n void run(copy.pending, copy.complete, () => mutate(mutation));\n },\n });\n\n return {\n account,\n displayName,\n setDisplayName,\n status,\n error,\n busy,\n confirmation,\n cancelConfirmation: () => setConfirmation(null),\n confirm: (): void => {\n if (!confirmation) return;\n setConfirmation(null);\n confirmation.action();\n },\n saveName: (): void => {\n void run(\"Saving…\", \"Display name updated.\", () =>\n mutate({\n action: AUTH_ACCOUNT_MUTATION_ACTIONS.updateDisplayName,\n confirmation: AUTH_ACCOUNT_MUTATION_ACTIONS.updateDisplayName,\n displayName,\n }),\n );\n },\n addPasskey: (): void => {\n void run(\"Waiting for your authenticator…\", \"Passkey added.\", () =>\n client.registerPasskey(),\n );\n },\n revokePasskey: (credentialId) =>\n confirmMutation(CONFIRMED_MUTATIONS.revokePasskey, {\n action: AUTH_ACCOUNT_MUTATION_ACTIONS.revokePasskey,\n confirmation: AUTH_ACCOUNT_MUTATION_ACTIONS.revokePasskey,\n credentialId,\n }),\n revokeSession: (sessionId) =>\n confirmMutation(CONFIRMED_MUTATIONS.revokeSession, {\n action: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeSession,\n confirmation: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeSession,\n sessionId,\n }),\n revokeOtherSessions: () =>\n confirmMutation(CONFIRMED_MUTATIONS.revokeOtherSessions, {\n action: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeOtherSessions,\n confirmation: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeOtherSessions,\n }),\n // Ending this session too, so the page leaves for the login instead of\n // showing an account it can no longer read.\n revokeAllSessions: () =>\n setConfirmation({\n title: \"Sign out everywhere?\",\n message:\n \"This ends every session, including this one. You will need your passkey to return.\",\n confirmLabel: \"Sign out everywhere\",\n action: () => {\n void run(\"Signing out everywhere…\", \"Signed out.\", async () => {\n await client.mutateAccount({\n action: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeAllSessions,\n confirmation: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeAllSessions,\n });\n window.location.assign(\n `/login?return_to=${encodeURIComponent(input.routePath)}`,\n );\n return undefined;\n });\n },\n }),\n saveSettings: (settings, formData): void => {\n const values = settingsFormValues(settings.fields, formData);\n void run(`Saving ${settings.title}…`, `${settings.title} updated.`, () =>\n client.mutatePluginSettings({\n action: \"save\",\n definitionId: settings.id,\n values,\n }),\n );\n },\n createdAppPassword,\n createAppPassword: (label, access): void => {\n void run(\"Creating app password…\", \"App password created.\", async () => {\n const created = await client.mutateAccount({\n action: AUTH_ACCOUNT_MUTATION_ACTIONS.createAppPassword,\n confirmation: AUTH_ACCOUNT_MUTATION_ACTIONS.createAppPassword,\n label,\n // Read-only is the default; only the wider access is named.\n ...(access === \"write\" ? { access } : {}),\n });\n setCreatedAppPassword(created.appPassword ?? null);\n return created.account;\n });\n },\n dismissCreatedAppPassword: () => setCreatedAppPassword(null),\n revokeAppPassword: (appPasswordId) =>\n confirmMutation(CONFIRMED_MUTATIONS.revokeAppPassword, {\n action: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeAppPassword,\n confirmation: AUTH_ACCOUNT_MUTATION_ACTIONS.revokeAppPassword,\n appPasswordId,\n }),\n removeSettings: (settings) =>\n setConfirmation({\n title: `Remove ${settings.title}?`,\n message:\n \"The stored settings for this integration will be removed from your account only.\",\n confirmLabel: \"Remove settings\",\n action: () => {\n void run(\n `Removing ${settings.title}…`,\n `${settings.title} removed.`,\n () =>\n client.mutatePluginSettings({\n action: \"delete\",\n definitionId: settings.id,\n }),\n );\n },\n }),\n };\n}\n"
|
|
16
16
|
],
|
|
17
17
|
"mappings": "0dAkBA,iBCcA,IAAM,GAA2B,EAAE,OAAO,CACxC,YAAa,EAAE,OAAO,EACtB,KAAM,EAAE,KAAK,CAAC,QAAS,UAAW,QAAQ,CAAC,EAC3C,gBAAiB,EAAE,OAAO,EAAE,SAAS,EACrC,SAAU,EAAE,MACV,EAAE,OAAO,CACP,GAAI,EAAE,OAAO,EACb,WAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EACzC,qBAAsB,EAAE,OAAO,EAAE,SAAS,EAC1C,mBAAoB,EAAE,QAAQ,EAC9B,UAAW,EAAE,OAAO,EACpB,U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ACE,MAAM,WACN,WAAU,GACV,OAAQ,IAAY,WACpB,UAAW,EAAa,GAAI,EAAc,QAAQ,EAJpD,SAME,SAAC,GAAD,CAAoB,QAAS,EAAS,QAAS,GAA/C,qBAAwD,GAN1D,qBAOE,EAEJ,SAOE,EAPF,CACE,MAAM,WACN,WAAU,GACV,OAAQ,IAAY,WACpB,UAAW,EAAa,GAAI,EAAc,QAAQ,EAJpD,SAME,SAAC,GAAD,CAAoB,QAAS,EAAS,QAAS,GAA/C,qBAAwD,GAN1D,qBAOE,EACD,EAAU,QACT,SAOE,EAPF,CACE,MAAO,EACP,WAAU,GACV,OAAQ,IAAY,EACpB,UAAW,EAAa,GAAI,EAAc,QAAQ,EAJpD,SAME,SAAC,GAAD,CAAmB,OAAQ,EAAU,QAArC,qBAA6C,GAN/C,qBAOE,EAEH,EAAU,QACT,SAYE,EAZF,CACE,MAAO,EACP,WAAU,GACV,OAAQ,IAAY,EACpB,UAAW,EAAa,GAAI,EAAc,QAAQ,EAJpD,SAME,SAAC,GAAD,CACE,OAAQ,EAAU,OAClB,QAAS,EACT,QAAS,EACT,QAAS,EAAU,SAJrB,qBAKA,GAXF,qBAYE,IAnGN,qBAqGE,IA3IN,qBA6IE,EACD,GACC,SAYE,GAZF,CACE,KAAK,IACL,MAAO,EAAa,MACpB,QAAQ,6BACR,YAAY,SACZ,aAAc,EAAa,aAC3B,eAAe,SACf,QAAS,EACT,SAAU,EAAQ,mBAClB,UAAW,EAAQ,QATrB,SAWE,SAA2B,IAA3B,UAAI,EAAa,SAAjB,qBAA2B,GAX7B,qBAYE,IA5JN,qBA8JE",
|
|
18
|
-
"debugId": "
|
|
18
|
+
"debugId": "4A7C931D3058EEFA64756E2164756E21",
|
|
19
19
|
"names": []
|
|
20
20
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ae as E,Be as F,Ce as G,De as H,Ee as I,Fe as J,Ge as K,He as L,Ie as M,Je as N,Ke as O,Le as P,Me as Q,Ne as R,Oe as S,Pe as T,Qd as a,Qe as U,Rd as b,Re as V,Sd as c,Se as W,Td as d,Te as X,Ud as e,Ue as Y,Vd as f,Ve as Z,Wd as g,We as _,Xd as h,Xe as aa,Yd as i,Ye as ba,Ze as ca,fe as j,ge as k,he as l,ie as m,je as n,ke as o,le as p,me as q,ne as r,oe as s,pe as t,qe as u,re as v,se as w,te as x,ue as y,ve as z,we as A,xe as B,ye as C,ze as D}from"./main-as971bnz.js";import"./main-bgz7jfx7.js";export{a as ASK_SOURCES_EVENT,j as CHAT_API_VERSION,o as CHAT_CONVERSATION_ID_HEADER,aa as ChatApiError,k as DEFAULT_CHAT_API_PATH,W as archiveChatSessionResponseSchema,b as askSourcesDetailSchema,Y as chatActionRequestSchema,v as chatActionResponseSchema,M as chatApprovalResponsePartSchema,L as chatApprovalResponseSchema,s as chatCardSchema,x as chatContextHandoffRequestSchema,T as chatContextHandoffResponseSchema,u as chatEventActionSchema,I as chatFilePartSchema,C as chatHistoryAttachmentSchema,B as chatHistoryAttachmentSourceSchema,D as chatHistoryMessageSchema,Z as chatJobStatusSchema,O as chatMessageRequestSchema,N as chatMessageSchema,E as chatMessagesResponseSchema,Q as chatProgressEventSchema,S as chatProtocolEventSchema,y as chatSessionListQuerySchema,z as chatSessionSchema,A as chatSessionsResponseSchema,r as chatSourceCitationSchema,H as chatTextPartSchema,R as chatToolStatusEventSchema,K as chatUploadPartSchema,J as chatUploadRefSchema,_ as chatUploadResponseSchema,w as createChatApiPaths,ca as createChatClient,X as deleteChatSessionResponseSchema,t as getGuestSourceCards,G as guestChatHistoryResponseSchema,P as guestChatMessageRequestSchema,p as guestChatSessionResponseSchema,F as guestChatSubmissionIdSchema,q as guestChatSubmissionStatusSchema,n as guestConversationOwnershipSchema,c as guestExecutionLimitsSchema,d as guestExecutionPolicySchema,l as guestInterfaceType,i as guestRefusalCategorySchema,m as guestRetentionSchema,h as guestScreeningCategorySchema,g as guestScreeningSchema,f as guestTurnCostSchema,e as guestTurnUsageSchema,ba as readChatProtocolEvents,U as renameChatSessionRequestSchema,V as renameChatSessionResponseSchema};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=6B36B7A107AF612664756E2164756E21
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Bb as c,xb as n,zb as g}from"./main-b4w7s6mx.js";import{$e as k,_e as b}from"./main-jrb0wvq4.js";import{Gf as m}from"./main-bgz7jfx7.js";var e=m(b(),1),u=m(k(),1),C=({code:s,language:t,raw:r,className:h,startLine:f,lineNumbers:d,...p})=>{let{shikiTheme:l}=e.useContext(c),a=g(),[N,i]=e.useState(r);return e.useEffect(()=>{if(!a){i(r);return}let o=a.highlight({code:s,language:t,themes:l},(x)=>{i(x)});o&&i(o)},[s,t,l,a,r]),u.jsx(n,{className:h,language:t,lineNumbers:d,result:N,startLine:f,...p})};export{C as HighlightedCodeBlockBody};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=9AFBFDEB7325775064756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"\"use client\";\nimport {A,f,c}from'./chunk-BO2N2NFS.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var R=({code:s,language:e,raw:t,className:h,startLine:d,lineNumbers:m,...p})=>{let{shikiTheme:l}=useContext(A),o=f(),[a,i]=useState(t);return useEffect(()=>{if(!o){i(t);return}let r=o.highlight({code:s,language:e,themes:l},c=>{i(c);});r&&i(r);},[s,e,l,o,t]),jsx(c,{className:h,language:e,lineNumbers:m,result:a,startLine:d,...p})};export{R as HighlightedCodeBlockBody};"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "gJACwC,eAAkD,WAAwC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,KAAK,KAAK,CAAC,IAAI,WAAW,GAAG,aAAW,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,WAAS,CAAC,EAAE,OAAO,YAAU,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,IAAI,EAAE,EAAE,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,KAAG,CAAC,EAAE,CAAC,EAAG,EAAE,GAAG,EAAE,CAAC,GAAI,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAI,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,KAAK,CAAC,CAAC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "9AFBFDEB7325775064756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{Ga as ut,ab as Mt,bb as F,ta as Y,vb as wt,wb as It,za as jt}from"./main-e0gm5z75.js";import{$b as V,Hc as zt,Uc as ot,Vc as rt,Wc as nt,Xc as it,Yb as kt,Yc as lt,bc as C,cd as dt,gc as yt,hc as bt,jc as vt}from"./main-qtwkt52a.js";import{Je as Nt,Xe as Ct,Ye as Dt}from"./main-as971bnz.js";import{_e as X}from"./main-jrb0wvq4.js";import{Gf as I}from"./main-bgz7jfx7.js";var s={imageTrigger:{k1xSpc:"x1lliihq",kzqmXN:"xh8yej3",kmVPX3:"x1717udv",kMzoRj:"xc342km",kWkggS:"xjbqb8w",kkrTdU:"x1huxd7x",kAzted:"x1gg8mnh",k3Woio:"x16dl9wz",kiEn40:"x7s97pk",$$css:!0},fullImage:{kzqmXN:"xh8yej3",kZKoxP:"xt7dq6l",kskxy:"x6kd6ug",kVIFPx:"x19kjcj4",$$css:!0},toolbar:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x195vfkc",kmuXW:"x2lah0s",$$css:!0},toolbarButton:{kAzted:"x1gg8mnh",k7Eaqz:"x1nb6za0",kmVPX3:"x1160tuk",kGuDYH:"xfifm61",$$css:!0},details:{k1xSpc:"xrvj5dj",kOIVth:"xou54vl",k7Eaqz:"xeuugli",$$css:!0},composerBar:{k1xSpc:"x78zum5",kjj79g:"x1qughib",kGNEyG:"x6s0dn4",kOIVth:"x167g77z",$$css:!0},userTurn:{koQZXg:"x8x9d4c",ks0D6T:"x1v8xovm",kWkggS:"xbslqsl",kaIpWk:"x1cxwkf3",kmVPX3:"x1j671cp",$$css:!0},source:{khDVqt:"x126k92a",kHjlTd:"xj0a0fe",kVQacm:"xysyzu8",kskxy:"x8ln6o7",kmVPX3:"xc7ga6q",kogj98:"x1ghz6dp",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kLWn49:"x1dbl2gt",kWkggS:"xbslqsl",$$css:!0},sourceType:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},uploadStrip:{k1xSpc:"x78zum5",kXHlph:"xw2csxc",kskxy:"x569fbc",kOIVth:"x167g77z",k7Eaqz:"xeuugli",k5wCbM:"x1597r2g",k1K539:"xzueoph",$$css:!0},uploadPreview:{kzqmXN:"x100vrsf",kZKoxP:"x1vqgdyp",kVIFPx:"xl1xv1r",kaIpWk:"x12oqio5",$$css:!0},uploadName:{k7Eaqz:"xeuugli",kUk6DE:"x98rzlu",kHjlTd:"xj0a0fe",kGuDYH:"xfifm61",$$css:!0},sessionControls:{k1xSpc:"xrvj5dj",kOIVth:"x167g77z",k7Eaqz:"xeuugli",kmVPX3:"x68fgpq",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},sessionFilterSelect:{kzqmXN:"xh8yej3",k7Eaqz:"xeuugli",kAzted:"x141feeh x1c4ya5t",kGuDYH:"x4z9k3i xf2x79s",$$css:!0},composerHint:{k1xSpc:"x1lliihq xkaaz9w",keoZOQ:"x1xmf6yo",kGuDYH:"x1j6dyjg",kLWn49:"x37zpob",kMwMTN:"x1ar3pfp",$$css:!0},shell:{k1xSpc:"xrvj5dj",kUk6DE:"x98rzlu",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kVQacm:"xb3r6kr",$$css:!0},root:{k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kZKoxP:"xtdtrs8",kskxy:"x1wj9ous",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kVQacm:"xb3r6kr",$$css:!0},frame:{k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kVQacm:"xb3r6kr",kmVPX3:"x1717udv",kOIVth:"xxhr3t",$$css:!0},room:{k1xSpc:"xrvj5dj",kumcoG:"xoilou0 x4jmfmw",kOIVth:"xxhr3t",kUk6DE:"x98rzlu",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kVQacm:"xb3r6kr",$$css:!0},emptyConversation:{kogj98:"x1ghz6dp",$$css:!0},conversations:{k1xSpc:"xrvj5dj",k9llMU:"x16p6thf",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kVQacm:"xb3r6kr",kWqL5O:"xs1s249 x13ymtvt",kSWEuD:"x32b0ac",k26BEO:"x3a9l4s",kWkggS:"xrbo6c7",$$css:!0},conversationsHidden:{k1xSpc:"xrvj5dj xkaaz9w",$$css:!0},threadHidden:{k1xSpc:"x78zum5 xkaaz9w",$$css:!0},phoneGoneFlex:{k1xSpc:"x78zum5 xkaaz9w",$$css:!0},railHead:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"x167g77z",k7Eaqz:"xeuugli",$$css:!0},railTitle:{kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"x1jvydc1",k63SB2:"x1s688f",kMwMTN:"xqvuw85",$$css:!0},railEmpty:{kogj98:"x1ghz6dp",k8WAf4:"x10dr8xq",kg3NbH:"x1hr3lfm",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kLWn49:"x1dbl2gt",kMwMTN:"x1ar3pfp",$$css:!0},dayLabel:{kogj98:"x6a0dku",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",k63SB2:"x1s688f",kb6lSQ:"x1dgsrnt",kP9fke:"xtvhhri",kMwMTN:"x1ar3pfp",$$css:!0},sessionNote:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x17d4w8g",k7Eaqz:"xeuugli",kVQacm:"xb3r6kr",kg5iWk:"xlyipyv",khDVqt:"xuxw1ft",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kLWn49:"x1evy7pa",kMwMTN:"x1ar3pfp",$$css:!0},brainMark:{kmuXW:"x2lah0s",kzqmXN:"x1v4s8kt",kZKoxP:"xols6we",kaIpWk:"x1e6avla",kWkggS:"x15vqgvx",kGVxlE:"xur0l8h",$$css:!0},about:{kmuXW:"xs83m0k",k7Eaqz:"xeuugli",kVQacm:"xb3r6kr",kg5iWk:"xlyipyv",khDVqt:"xuxw1ft",k8WAf4:"xj8oexa",kg3NbH:"x1awh872",kaIpWk:"x1e6avla",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kMwMTN:"x1q7454x",kWkggS:"x9kxhyz",k1xSpc:"x1rg5ohu xkaaz9w",$$css:!0},openEntry:{k1xSpc:"x3nfvp2",kGNEyG:"x6s0dn4",kAzted:"x1gg8mnh",kg3NbH:"x1awh872",khDVqt:"xuxw1ft",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp x18m2ztq",kybGjl:"x1hl2dhg",$$css:!0},openEntryIcon:{kjj79g:"xl56j7k",k7Eaqz:"x1nb6za0",kg3NbH:"xnjsko4",kGuDYH:"xosj86m",kMwMTN:"xqvuw85",$$css:!0},starters:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x17d4w8g",k1K539:"x1e56ztr",$$css:!0},starter:{kAzted:"x1rz828m x1c4ya5t",k8WAf4:"x12ulsxz",kg3NbH:"xaope02",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h",kaIpWk:"x1e6avla",kWkggS:"x18s3upu",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kkrTdU:"x1ypdohk",$$css:!0},answer:{kMv6JI:"xssy22x",k63SB2:"xj8qvsk",ka26j:"xvy63o1",kGuDYH:"x19d36u7 xf2x79s",kLWn49:"x1dbl2gt",$$css:!0},picker:{"--console-text-muted":"x1phc7po",k1xSpc:"xrvj5dj",k9llMU:"x1yn14it",kskxy:"x1j65ot3",kAzted:"x2lwn1j",kVQacm:"xb3r6kr",$$css:!0},thread:{k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kVQacm:"xb3r6kr",$$css:!0},threadHead:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"x167g77z",k7Eaqz:"xeuugli",kmuXW:"x2lah0s",kAzted:"xt55aet",kmVPX3:"xsoouyo xbqoc8e",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",k1K539:"xat24cr",$$css:!0},title:{kogj98:"x1ghz6dp",kVQacm:"xb3r6kr",kg5iWk:"xlyipyv",khDVqt:"xuxw1ft",k7Eaqz:"xeuugli",kMv6JI:"x5ddh9m",kGuDYH:"x1jvydc1",k63SB2:"x1s688f",kLWn49:"x1evy7pa",kMwMTN:"xqvuw85",$$css:!0},headCopy:{k7Eaqz:"xeuugli",kUk6DE:"x98rzlu",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kGNEyG:"x6s0dn4",kOIVth:"x883omv",$$css:!0},sessionList:{k1xSpc:"xrvj5dj",kfiyM8:"x10ukxgv",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kORKVm:"x1odjw0f",$$css:!0},session:{k1xSpc:"xrvj5dj",kOIVth:"x195vfkc",kzqmXN:"xh8yej3",k7Eaqz:"xeuugli",kmVPX3:"x1jx5nlt xa4az6k",kMzoRj:"xc342km",kZ1KPB:"x19sr0n1",ksu8eU:"x1y0btm7",kVAM5u:"x9r1u3d",kWkggS:"xjbqb8w",kMwMTN:"xqvuw85",k9WMMc:"xdpxx8g",kkrTdU:"x1ypdohk",kDPRdz:"x1xiaf3t",k3Woio:"x16dl9wz",kiEn40:"x1bqaal",$$css:!0},activeSession:{kaZRDh:"x1yn89ol",kWkggS:"x1dd94t5",$$css:!0},sessionTitle:{kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",k63SB2:"xo1l8bm",kLWn49:"xfrs9s4",kHjlTd:"xj0a0fe",k1xSpc:"x104kibb",kgKLqz:"x1ua5tub",kJFfOR:"x1h7i4cw",kVQacm:"xb3r6kr",$$css:!0},timestamp:{kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kLWn49:"xa7kkou",kMwMTN:"x1ar3pfp",kHjlTd:"xj0a0fe",$$css:!0},context:{k7Eaqz:"xeuugli",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",$$css:!0},contextBody:{k1xSpc:"xrvj5dj",kI3sdo:"x16dl9wz",kInvED:"x2ssjo2",kOIVth:"xou54vl",kskxy:"xtgemb3",kORKVm:"x1odjw0f",kGO01o:"x1l90r2v",kg3NbH:"xfn1xvj",k7Eaqz:"xeuugli",$$css:!0},contextItem:{k1xSpc:"xrvj5dj",kOIVth:"x17d4w8g",k7Eaqz:"xeuugli",kmVPX3:"x1b4vry6",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kLWn49:"x1dbl2gt",$$css:!0},threadScroll:{kUk6DE:"x98rzlu",kI3sdo:"x16dl9wz",kInvED:"x2ssjo2",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kORKVm:"x1odjw0f",kZeWKH:"xish69e",k5wCbM:"x1597r2g",k6w4Gs:"xgwpcrc",$$css:!0},manuscript:{k7Eaqz:"xeuugli",ks0D6T:"x1ac2792",kUOVxO:"xvueqy4",kmVPX3:"x12mnf9l xvc418b",$$css:!0},turn:{k1xSpc:"xrvj5dj",kumcoG:"x1mkdm3x",kOIVth:"x167g77z",kmVPX3:"x1717udv",k1K539:"x1xka2u1",k7Eaqz:"xeuugli",$$css:!0},speaker:{k1xSpc:"x3nfvp2",kGNEyG:"x6s0dn4",kOIVth:"x17d4w8g",kLKAdn:"xexx8yu",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kLWn49:"x1dbl2gt",kMwMTN:"x1ar3pfp",$$css:!0},turnBody:{k1xSpc:"xrvj5dj",kOIVth:"x1v2ro7d",k7Eaqz:"xeuugli",kMv6JI:"x5ddh9m",kGuDYH:"x1j61zf2 x1sgj8az",k63SB2:"xo1l8bm",kLWn49:"x11m8ghp",kMwMTN:"xqvuw85",kHjlTd:"xj0a0fe",$$css:!0},userBody:{k63SB2:"xo1l8bm",$$css:!0},paragraph:{kogj98:"x1ghz6dp",khDVqt:"x126k92a",kHjlTd:"xj0a0fe",$$css:!0},cards:{k1xSpc:"xrvj5dj",kOIVth:"x1v2ro7d",k7Eaqz:"xeuugli",$$css:!0},attachmentPreview:{k1xSpc:"x1lliihq",kzqmXN:"xh8yej3",ks0D6T:"x193iq5w",kZKoxP:"xt7dq6l",kskxy:"x1iuus0c",kVIFPx:"x19kjcj4",kWkggS:"x18s3upu",$$css:!0},card:{k1xSpc:"xrvj5dj",kOIVth:"x883omv",k7Eaqz:"xeuugli",kmVPX3:"x1tamke2",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"x1sxf85j",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",k63SB2:"xo1l8bm",kLWn49:"x1dbl2gt",kHjlTd:"xj0a0fe",kXHlph:"xw2csxc",$$css:!0},kicker:{kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kMwMTN:"xgi1xjn",$$css:!0},cardHeading:{kogj98:"x1ghz6dp",$$css:!0},cardText:{kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kLWn49:"x1dbl2gt",$$css:!0},empty:{kogj98:"xhv1u6h",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kLWn49:"x1dbl2gt",kMwMTN:"xgi1xjn",kHjlTd:"xj0a0fe",$$css:!0},error:{kMwMTN:"x1mel2pz",$$css:!0},form:{k1xSpc:"xrvj5dj",kOIVth:"x1jnr06f",k7Eaqz:"xeuugli",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h x5nc5hl",kGVxlE:"x1gnnqk1 x79sx2d",kaIpWk:"x4pepcl",kmVPX3:"x1160tuk",kWkggS:"x18s3upu",$$css:!0},composer:{kmuXW:"x2lah0s",k7Eaqz:"xeuugli",kzqmXN:"xh8yej3",ks0D6T:"x1ac2792",kSGwAc:"xamitd3",kmVPX3:"x17udgi5 x1lbfznl",$$css:!0},input:{kzqmXN:"xh8yej3",kB7OPa:"x9f619",k7Eaqz:"xeuugli",kZKoxP:"xn3w4p2",kAzted:"x1gg8mnh",kskxy:"x1hyak1l",kHenm0:"xtt52l0",kmVPX3:"x14odnwx",kMzoRj:"xc342km",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"x1sxf85j",kWkggS:"xjbqb8w",kMv6JI:"x5ddh9m",kGuDYH:"x1j61zf2",kLWn49:"x1evy7pa",kMwMTN:"xqvuw85",kI3sdo:"x1a2a7pz",$$css:!0},attachButton:{k1xSpc:"x3nfvp2",kGNEyG:"x6s0dn4",kAzted:"x1ba4aug x126n28w",kmVPX3:"x153ncpu",kB7OPa:"x9f619",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"x1sxf85j",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kMwMTN:"xqvuw85",kkrTdU:"x1ypdohk",k8PahR:"xt2bx3g",kfQpEX:"x1fanpfn",$$css:!0},uploadInput:{kVAEAm:"x10l6tqk",kzqmXN:"x1i1rx1s",kZKoxP:"xjm9jq1",kz4h6p:"x1hyvwdk",kVQacm:"xb3r6kr",khDVqt:"xuxw1ft",$$css:!0},uploadList:{k1xSpc:"x78zum5",kwnvtZ:"xozqiw3",kmuXW:"x2lah0s",kOIVth:"x167g77z",kogj98:"x1ghz6dp",kmVPX3:"x1717udv",kH6xsr:"x3ct3a4",$$css:!0},upload:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x17d4w8g",kmuXW:"x2lah0s",kogj98:"x1ghz6dp",ks0D6T:"x1jkqq1h",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",k63SB2:"xo1l8bm",kMwMTN:"x1ar3pfp",kHjlTd:"xj0a0fe",$$css:!0},button:{kAzted:"x1gg8mnh",kmVPX3:"x153ncpu",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"x1sxf85j",kWkggS:"xjbqb8w",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kkrTdU:"x1ypdohk",k3Woio:"x16dl9wz",kiEn40:"x7s97pk",kWCcOm:"xijokvz",kYPGJ8:"xtgyt42",$$css:!0},primaryButton:{kWkggS:"x15vqgvx",kVAM5u:"xawfzfr",kMwMTN:"xb8ja0n",$$css:!0},subheading:{kogj98:"x1ghz6dp",kLWn49:"x1evy7pa",$$css:!0}};function o(t,...e){return`${t} ${kt(...e).className??""}`}var mt=I(X(),1);var xt=`Text/Markdown up to ${rt/1000} KB; PNG, JPEG, WebP, GIF or PDF up to ${nt/1e6} MB.`,L={sessions:["studio","chat","sessions"],messages:(t)=>["studio","chat","messages",t]};var d=I(V(),1);function ue(t){let e=(a)=>{if(a.key==="Enter"&&!a.shiftKey&&!a.nativeEvent.isComposing)a.preventDefault(),a.currentTarget.form?.requestSubmit()};return d.jsxDEV("footer",{className:o("studio-chat-composer",s.composer),children:[t.onJumpToLatest&&d.jsxDEV(C,{type:"button",variant:"ghost",onClick:t.onJumpToLatest,children:"Jump to latest ↓"},void 0,!1,void 0,this),t.above,d.jsxDEV("form",{className:o("studio-chat-composer-form",s.form),onSubmit:t.onSubmit,children:[(t.uploadAttempts.length>0||t.uploads.length>0)&&d.jsxDEV("div",{className:o("studio-chat-upload-strip",s.uploadStrip),role:"region","aria-label":"Draft attachments",tabIndex:0,children:d.jsxDEV("ul",{className:o("studio-chat-upload-list",s.uploadList),"aria-label":t.uploadAttempts.length>0?"File upload progress":"Attached files",children:[t.uploadAttempts.map((a)=>d.jsxDEV("li",{className:o("studio-chat-upload",s.upload),children:[d.jsxDEV("div",{className:o("",s.uploadName),children:[d.jsxDEV("span",{role:a.status==="failed"?"alert":"status",children:[a.file.name,":"," ",a.status==="uploading"?"Uploading…":a.error??"Upload failed"]},void 0,!0,void 0,this),a.status==="uploading"&&d.jsxDEV("progress",{"aria-label":`Uploading ${a.file.name}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a.status==="failed"&&d.jsxDEV(d.Fragment,{children:[d.jsxDEV(C,{type:"button",variant:"ghost",size:"sm",xstyle:s.toolbarButton,"aria-label":`Retry uploading ${a.file.name}`,disabled:t.uploading||t.sending||t.locked,onClick:()=>t.onRetryUpload(a),children:"Retry"},void 0,!1,void 0,this),d.jsxDEV(C,{type:"button",variant:"ghost",size:"sm",xstyle:s.toolbarButton,"aria-label":`Dismiss failed upload ${a.file.name}`,onClick:()=>t.onDismissUpload(a.id),children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},a.id,!0,void 0,this)),t.uploads.map((a)=>d.jsxDEV("li",{className:o("studio-chat-upload",s.upload),children:[d.jsxDEV(Bt,{upload:a},void 0,!1,void 0,this),d.jsxDEV("span",{className:o("",s.uploadName),children:[a.filename,d.jsxDEV("br",{},void 0,!1,void 0,this),"Ready · draft only"]},void 0,!0,void 0,this),d.jsxDEV(C,{type:"button",variant:"ghost",size:"sm",xstyle:s.toolbarButton,"aria-label":`Remove ${a.filename} from message`,disabled:t.locked,onClick:()=>t.onRemoveUpload(a.id),children:"×"},void 0,!1,void 0,this)]},a.id,!0,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this),d.jsxDEV("textarea",{className:o("studio-chat-message",s.input),"aria-label":"Message","aria-describedby":"studio-chat-composer-hint",placeholder:t.placeholder??"Message…",value:t.draft,disabled:t.locked,onChange:(a)=>t.onDraft(a.target.value),onKeyDown:e},void 0,!1,void 0,this),d.jsxDEV("div",{className:o("studio-chat-composer-actions",s.composerBar),children:[t.allowFiles!==!1&&d.jsxDEV("label",{className:o("studio-chat-composer-action",s.attachButton),title:xt,children:[d.jsxDEV("span",{"aria-hidden":"true",children:"+"},void 0,!1,void 0,this),d.jsxDEV("input",{className:o("studio-chat-upload-input",s.uploadInput),"aria-label":"Attach files",type:"file",accept:ot,multiple:!0,disabled:t.locked||t.sending||t.uploading,onChange:(a)=>void t.onFiles(a)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.uploadAttempts.length>0&&d.jsxDEV("span",{className:o("",s.kicker),children:"Resolve uploads before sending"},void 0,!1,void 0,this),t.locked?d.jsxDEV(C,{type:"button",disabled:!0,children:"Archiving…"},void 0,!1,void 0,this):t.sending?d.jsxDEV(C,{type:"button",variant:"outline",xstyle:s.toolbarButton,onClick:t.onStop,disabled:!t.onStop,title:"Stop receiving the response. Completed actions are not undone.",children:"Stop"},void 0,!1,void 0,this):d.jsxDEV(C,{className:"studio-chat-composer-action",type:"submit",xstyle:s.toolbarButton,"aria-label":"Send message",disabled:t.uploading||t.uploadAttempts.length>0||!t.draft.trim()&&t.uploads.length===0,children:"↑"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV("small",{id:"studio-chat-composer-hint",className:o("studio-chat-composer-hint",s.composerHint),children:"Enter to send · Shift+Enter for a new line"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Bt({upload:t}){let[e,a]=mt.useState(!1);if(e||!t.mediaType.startsWith("image/"))return null;return d.jsxDEV("img",{className:o("studio-chat-draft-preview",s.uploadPreview),src:t.url,alt:t.filename,onError:()=>a(!0)},void 0,!1,void 0,this)}function gt(t){if(t.brain||!t.entityType||!t.entityId)return null;return{type:t.entityType,id:t.entityId}}var Gt=4;function ht(t,e){let a=gt(t);if(a)return dt(e,a.type,a.id);return t.url}function Ot(t,e){let a=t.slice(0,e);if((a.split("`").length-1)%2===1)return!0;let i=a.lastIndexOf("["),u=a.lastIndexOf("]");return i>u}function ft(t,e,a){return e.reduce((n,i)=>{let u=i.title?.trim();if(!u||u.length<Gt)return n;let l=gt(i);if(!l)return n;let c=n.indexOf(u);if(c<0||Ot(n,c))return n;let p=dt(a,l.type,l.id);return`${n.slice(0,c)}[${u}](${p})${n.slice(c+u.length)}`},t)}function ke(t){let e=(n)=>t.workspaces.some((i)=>i.endsWith(`:${n}`)),a=[...e("inbox")?["Summarize what is in my inbox this week"]:[],...e("publishing")?["What did I publish last month?"]:[],...t.types.includes("post")?["Draft a post from my recent notes"]:[],...t.types.includes("note")?["What have I been writing about lately?"]:[]].slice(0,4);return a.length>0?a:["What can you help me with?"]}var U=I(X(),1);var k=I(V(),1);function St(t){let{card:e,client:a}=t,n=Y({queryKey:["studio","chat","attachment-job",a.paths.jobStatus,e.jobId],queryFn:()=>a.getJobStatus(e.jobId??""),enabled:Boolean(e.jobId),retry:!1,refetchInterval:(z)=>z.state.data?.status==="pending"||z.state.data?.status==="processing"?2000:!1}),i=n.error instanceof Ct&&n.error.status===404,u=n.isError&&!i,l=lt(e.jobId?it(n.data?.status):null),c=!e.jobId||i||!n.isError&&n.data!==void 0&&(l.status==="completed"||l.status==="unknown"),p=e.attachment.previewUrl??e.attachment.url,[S,b]=U.useState(null),[q,W]=U.useState(!1),[K,Z]=U.useState(null),M=U.useRef(null),_=u?"Status unavailable":e.jobId&&n.isPending?"Checking generation status":l.label;return k.jsxDEV("section",{className:o("studio-chat-card",s.card),"aria-label":e.title,children:[k.jsxDEV("span",{className:o("studio-chat-card-kicker",s.kicker),children:"Artifact"},void 0,!1,void 0,this),k.jsxDEV("strong",{children:e.title},void 0,!1,void 0,this),k.jsxDEV("span",{role:"status",className:o("studio-chat-card-description",s.cardText),children:_},void 0,!1,void 0,this),e.description?k.jsxDEV("p",{className:o("studio-chat-card-description",s.cardText),children:e.description},void 0,!1,void 0,this):null,c&&e.attachment.mediaType.startsWith("image/")?S===p?k.jsxDEV("p",{role:"status",children:"Image preview unavailable. You can still open or download the file."},void 0,!1,void 0,this):k.jsxDEV("button",{ref:M,type:"button","aria-label":`Enlarge ${e.title}`,className:o("studio-chat-image-trigger",s.imageTrigger),onClick:()=>W(!0),children:k.jsxDEV("img",{className:o("studio-chat-attachment-preview",s.attachmentPreview),src:p,alt:e.title,loading:"lazy",onError:()=>b(p)},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,c?k.jsxDEV("div",{className:o("studio-chat-card-actions",s.actions),children:[k.jsxDEV("a",{className:o("studio-chat-card-action",s.button),href:e.attachment.url,children:"Open"},void 0,!1,void 0,this),k.jsxDEV("a",{className:o("studio-chat-card-action",s.button),href:e.attachment.downloadUrl??e.attachment.url,download:e.attachment.filename??!0,children:"Download"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,k.jsxDEV(yt,{open:q&&c,onOpenChange:W,children:k.jsxDEV(bt,{"aria-describedby":void 0,onCloseAutoFocus:(z)=>{z.preventDefault(),M.current?.focus()},children:[k.jsxDEV(vt,{children:e.title},void 0,!1,void 0,this),K===e.attachment.url?k.jsxDEV("p",{role:"status",children:"Image unavailable. You can still try opening or downloading the file."},void 0,!1,void 0,this):k.jsxDEV("img",{className:o("studio-chat-full-image",s.fullImage),src:e.attachment.url,alt:e.title,onError:()=>Z(e.attachment.url)},void 0,!1,void 0,this),k.jsxDEV("a",{href:e.attachment.downloadUrl??e.attachment.url,download:e.attachment.filename??!0,children:"Download image"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),u?k.jsxDEV(C,{type:"button",variant:"outline",onClick:()=>void n.refetch(),children:"Check status"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var Lt=/```proposal[ \t]+([A-Za-z0-9_-]+)[ \t]*\n([\s\S]*?)\n```/g;function $t(t,e){let a=[],n=t.replace(Lt,(i,u,l)=>{let c=e.find((p)=>p.name===u);if(!c)return i;return a.push({field:c.name,label:c.label,text:l}),""});return{prose:a.length>0?n.replace(/\n{3,}/g,`
|
|
2
|
+
|
|
3
|
+
`).trim():t,proposals:a}}var r=I(V(),1);function Ne(t){let e=t.onStart?t.starters??[]:[];return r.jsxDEV("section",{className:o("studio-chat-empty",s.empty,s.emptyConversation),"aria-label":"New conversation",children:[r.jsxDEV("p",{className:o("",s.cardText),children:"No messages yet. Your draft stays in the composer until you send it."},void 0,!1,void 0,this),e.length>0&&r.jsxDEV("div",{"data-studio-chat-starters":"",className:o("studio-chat-actions",s.actions),"aria-label":"Ways to start",children:e.map((a)=>r.jsxDEV("button",{type:"button",onClick:()=>t.onStart?.(a),children:a},a,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ae(t){let e=t.proposals&&t.message.role==="assistant"?$t(t.message.content,t.proposals.fields):{prose:t.message.content,proposals:[]};return r.jsxDEV("article",{className:o("studio-chat-turn",s.turn,t.message.role==="user"&&s.userTurn),"data-role":t.message.role,children:[r.jsxDEV("span",{className:o("studio-chat-turn-label",s.speaker),children:[t.message.role==="assistant"&&(t.speaker??"Brain")==="Your brain"&&r.jsxDEV("span",{"aria-hidden":"true",className:o("",s.brainMark)},void 0,!1,void 0,this),t.message.role==="user"?"You":t.speaker??"Brain"]},void 0,!0,void 0,this),r.jsxDEV("div",{className:o("studio-chat-turn-body",s.turnBody,t.message.role==="user"&&s.userBody,t.message.role==="assistant"&&t.reading==="manuscript"&&s.answer),children:[e.proposals.map((a)=>r.jsxDEV("section",{className:o("studio-chat-proposal",s.card),"aria-label":`Proposed ${a.label.toLowerCase()}`,"data-studio-chat-proposal":a.field,children:[r.jsxDEV("p",{className:o("",s.kicker),children:a.label},void 0,!1,void 0,this),r.jsxDEV("blockquote",{className:o("",s.cardText),children:a.text},void 0,!1,void 0,this),r.jsxDEV("div",{className:o("studio-chat-actions",s.actions),children:[r.jsxDEV(C,{type:"button",size:"sm",variant:"secondary",disabled:t.disabled,onClick:()=>t.proposals?.onApply(a),children:a.field==="selection"?"Replace selection":`Apply to ${a.label.toLowerCase()}`},void 0,!1,void 0,this),r.jsxDEV(C,{type:"button",size:"sm",variant:"ghost",disabled:t.disabled,onClick:()=>t.proposals?.onTryAnother(a),children:"Try another"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},a.field,!0,void 0,this)),e.prose?t.message.role==="assistant"?r.jsxDEV(It,{className:o("studio-chat-prose",s.cards),presentation:"chat",children:ft(e.prose,Kt(t.message.cards),ut())},void 0,!1,void 0,this):r.jsxDEV("p",{className:o("studio-chat-text",s.paragraph),children:t.message.content},void 0,!1,void 0,this):null,t.message.attachments?.map((a)=>r.jsxDEV("p",{className:o("studio-chat-upload",s.upload),children:a.filename},`${a.filename}-${a.createdAt}`,!1,void 0,this)),t.message.cards?.length?r.jsxDEV("div",{className:o("studio-chat-cards",s.cards),children:t.message.cards.map((a)=>r.jsxDEV(Xt,{card:a,client:t.client,disabled:t.disabled,onAction:t.onAction,onApproval:t.onApproval},`${a.kind}-${a.id}`,!1,void 0,this))},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Xt(t){let{card:e}=t;if(e.kind==="actions")return r.jsxDEV("section",{className:o("studio-chat-card",s.card),children:[r.jsxDEV("span",{className:o("studio-chat-card-kicker",s.kicker),children:"Actions"},void 0,!1,void 0,this),e.title?r.jsxDEV("strong",{children:e.title},void 0,!1,void 0,this):null,r.jsxDEV("div",{className:o("studio-chat-card-actions",s.actions),children:e.actions.map((i)=>r.jsxDEV("button",{className:o("studio-chat-card-action",s.button),type:"button",disabled:t.disabled,onClick:()=>void t.onAction(i),children:i.label},i.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.kind==="sources")return r.jsxDEV("nav",{className:o("studio-chat-sources",s.card),"aria-label":e.title??"Sources",children:r.jsxDEV("ul",{"data-studio-chat-source-chips":"",children:e.sources.map((i)=>{let u=ht(i,ut()),l=i.title??i.source;return r.jsxDEV("li",{children:[u?r.jsxDEV(Jt,{href:u,children:l},void 0,!1,void 0,this):l," ",r.jsxDEV("span",{className:o("",s.sourceType),children:i.brain?.name??i.entityType??i.source},void 0,!1,void 0,this)]},i.id,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.kind==="attachment")return r.jsxDEV(St,{card:e,client:t.client},void 0,!1,void 0,this);let a=e.state==="approval-requested",n={approvalId:e.id,toolCallId:e.toolCallId??e.id,toolName:e.toolName,...e.input?{input:e.input}:{},...e.summary?{title:e.summary}:{}};return r.jsxDEV("section",{className:o("studio-chat-card",s.card),children:[r.jsxDEV("span",{className:o("studio-chat-card-kicker",s.kicker),children:a?"Approval required":e.state==="approval-responded"?"Decision received · awaiting result":e.state==="output-available"?"Completed":e.state==="output-denied"?"Declined":"Action failed"},void 0,!1,void 0,this),r.jsxDEV("strong",{children:e.summary},void 0,!1,void 0,this),e.state==="output-available"&&e.completionSummary&&r.jsxDEV("p",{children:e.completionSummary},void 0,!1,void 0,this),e.error!==void 0&&r.jsxDEV("p",{role:"alert",children:e.error},void 0,!1,void 0,this),(e.preview!==void 0||e.input!==void 0)&&r.jsxDEV("details",{children:[r.jsxDEV("summary",{children:"Review exact action"},void 0,!1,void 0,this),r.jsxDEV("pre",{className:o("studio-chat-card-preview",s.source),children:e.preview??JSON.stringify(e.input,null,2)},void 0,!1,void 0,this),e.preview!==void 0&&e.input!==void 0&&r.jsxDEV("details",{children:[r.jsxDEV("summary",{children:"Tool input"},void 0,!1,void 0,this),r.jsxDEV("pre",{className:o("",s.source),children:JSON.stringify(e.input,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV("p",{className:o("",s.cardText),children:["Tool: ",e.toolName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.output!==void 0&&r.jsxDEV("details",{children:[r.jsxDEV("summary",{children:"Action result"},void 0,!1,void 0,this),r.jsxDEV("pre",{className:o("",s.source),children:typeof e.output==="string"?e.output:JSON.stringify(e.output,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a?r.jsxDEV("div",{className:o("studio-chat-approval-actions",s.actions),children:[r.jsxDEV("button",{className:o("studio-chat-approval-action",s.button),type:"button",disabled:t.disabled,onClick:()=>void t.onApproval(n,!1),children:"Decline"},void 0,!1,void 0,this),r.jsxDEV("button",{className:o("studio-chat-approval-action",s.button,s.primaryButton),"data-primary":"true",type:"button",disabled:t.disabled,onClick:()=>void t.onApproval(n,!0),children:"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function qe(t){return r.jsxDEV("section",{className:o("studio-chat-approval",s.card),children:[r.jsxDEV("span",{className:o("studio-chat-card-kicker",s.kicker),children:"Approval required"},void 0,!1,void 0,this),r.jsxDEV("strong",{children:t.approval.title??t.approval.toolName},void 0,!1,void 0,this),t.approval.input!==void 0&&r.jsxDEV("details",{children:[r.jsxDEV("summary",{children:"Review exact action"},void 0,!1,void 0,this),r.jsxDEV("pre",{className:o("",s.source),children:JSON.stringify(t.approval.input,null,2)},void 0,!1,void 0,this),r.jsxDEV("p",{children:["Tool: ",t.approval.toolName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV("div",{className:o("studio-chat-approval-actions",s.actions),children:[r.jsxDEV("button",{className:o("studio-chat-approval-action",s.button),type:"button",disabled:t.disabled,onClick:()=>void t.onDecision(t.approval,!1),children:"Decline"},void 0,!1,void 0,this),r.jsxDEV("button",{className:o("studio-chat-approval-action",s.button,s.primaryButton),"data-primary":"true",type:"button",disabled:t.disabled,onClick:()=>void t.onDecision(t.approval,!0),children:"Approve"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Kt(t){return(t??[]).flatMap((e)=>e.kind==="sources"?e.sources:[])}function Jt(t){let e=wt(),a=t.href.startsWith("/");return r.jsxDEV("a",{href:t.href,...a?{}:{target:"_blank",rel:"noopener noreferrer"},onClick:(n)=>{if(!a||!e||!jt(n))return;n.preventDefault(),e(t.href)},children:t.children},void 0,!1,void 0,this)}var N=I(X(),1);function Pe(t){let[e]=N.useState(()=>new Mt),a=t.draftStore??e,n=F(t.apiPath,t.sessionId),i=N.useRef(n);i.current=n;let{text:u,uploads:l}=N.useSyncExternalStore(a.subscribe,()=>a.read(n),()=>a.read(n)),c=N.useCallback((S)=>a.update(n,{text:S}),[a,n]),p=N.useCallback((S)=>a.update(n,{uploads:typeof S==="function"?S(a.read(n).uploads):S}),[a,n]);return{draftStore:a,draftKey:n,currentDraftKey:i,draft:u,uploads:l,setDraft:c,setUploads:p}}var m=I(X(),1);function At(){return{messageId:"assistant-stream",text:"",cards:[],approvals:[],progress:[],statuses:[],toolInputs:{},finished:!1,error:null}}function qt(t,e){switch(e.type){case"start":return e.messageId?{...t,messageId:e.messageId}:t;case"text-delta":return{...t,text:`${t.text}${e.delta}`};case"tool-input-available":return{...t,toolInputs:{...t.toolInputs,[e.toolCallId]:{toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,...e.title?{title:e.title}:{}}}};case"tool-approval-request":{let a=t.toolInputs[e.toolCallId],n={approvalId:e.approvalId,toolCallId:e.toolCallId,toolName:a?.toolName??"tool",...zt(a?.input)?{input:a.input}:{},...a?.title?{title:a.title}:{}};return{...t,approvals:[...t.approvals.filter((i)=>i.approvalId!==e.approvalId),n]}}case"tool-output-available":case"tool-output-error":case"tool-output-denied":return{...t,approvals:t.approvals.filter((a)=>a.toolCallId!==e.toolCallId)};case"data-progress":return{...t,progress:[...t.progress,e.data]};case"data-status":return{...t,statuses:[...t.statuses,e.data]};case"data-actions":case"data-sources":case"data-attachment":return{...t,cards:[...t.cards,e.data]};case"finish":return{...t,finished:!0};case"abort":return{...t,finished:!0,error:e.reason??"Response stopped"};case"error":return{...t,finished:!0,error:e.errorText};default:return t}}function Q(t){return{id:t.messageId,role:"assistant",content:t.text,...t.cards.length>0?{cards:t.cards}:{}}}function Et(t,e){let a={id:t.approvalId,approved:e,toolCallId:t.toolCallId,toolName:t.toolName,...t.input?{input:t.input}:{},...t.title?{title:t.title}:{}};return Nt.parse({role:"assistant",parts:[{state:"approval-responded",toolCallId:t.toolCallId,toolName:t.toolName,...t.input?{input:t.input}:{},...t.title?{title:t.title}:{},approval:a}]})}function ct(t,e){return t instanceof Error&&t.message?t.message:e}function Ke(t){let{chatClient:e,queryClient:a,sessionId:n,apiPath:i,draftStore:u,draftKey:l,currentDraftKey:c,mountedRef:p,adoptedSessionRef:S,uploads:b,uploading:q,uploadAttemptCount:W,navigateToSession:K}=t,[Z,M]=m.useState([]),[_,z]=m.useState(null),[E,T]=m.useState(!1),[Tt,B]=m.useState(null),[Pt,J]=m.useState(null),j=m.useRef(null),Ht=m.useCallback(()=>j.current!==null,[]),Rt=m.useCallback(()=>{j.current?.abort()},[]),tt=m.useCallback(()=>{let x=j.current;j.current=null,x?.abort()},[]),Vt=m.useCallback(()=>{tt(),T(!1),M([]),z(null),B(null),J(null)},[tt]),G=m.useCallback(async(x,y,A,D)=>{j.current?.abort();let g=new AbortController;j.current=g,T(!0),B(null),J(null);let O=!1,h={...At(),messageId:crypto.randomUUID()};z(h);let w=!1,P=!1,H=()=>{if(P||!h.text&&h.cards.length===0)return;P=!0;let R=Q(h);M((f)=>[...f,R]),z({...h,text:"",cards:[]})};try{let R=await e.streamMessages({id:x,messages:y,trigger:"submit-message"},{signal:g.signal});w=!0,A?.();for await(let f of Dt(R)){if(j.current!==g)return w;if(f.type==="abort")O=!0;h=qt(h,f),z(h)}if(j.current!==g)return w;if(H(),g.signal.aborted||O||h.error!==null||!h.finished)return J({kind:g.signal.aborted||O?"stopped":h.error!==null?"failed":"disconnected",...h.error?{detail:h.error}:{},...D?{retry:D}:{}}),w;try{let f=await e.getMessages(x);if(j.current!==g)return w;a.setQueryData(L.messages(x),f),M([]),z(null)}catch{}await a.invalidateQueries({queryKey:L.sessions})}catch(R){if(j.current!==g)return w;H(),J({kind:g.signal.aborted?"stopped":w?"disconnected":"failed",...!g.signal.aborted?{detail:ct(R,"Chat could not complete the response")}:{},...D?{retry:D}:{}})}finally{if(j.current===g)j.current=null,T(!1)}return w},[e,a]),et=m.useCallback(async(x)=>{let y=x.trim();if(!y&&b.length===0||E||q||W>0)return;let A=n??`web-${crypto.randomUUID()}`,D=F(i,A),g=crypto.randomUUID(),O=b.map((f)=>({type:"data-upload",data:{ref:f.ref}})),h=[...y?[{type:"text",text:y}]:[],...O];M((f)=>[...f,{id:g,role:"user",content:y,cards:b.map((v)=>({kind:"attachment",id:v.id,title:v.filename,attachment:{mediaType:v.mediaType,filename:v.filename,sizeBytes:v.sizeBytes,url:v.url,downloadUrl:v.downloadUrl}}))}]);let w=[...b],P=u.read(l),H=P.text===x;if(H||w.length>0)u.update(l,{text:H?"":P.text,uploads:P.uploads.filter((f)=>!w.some((v)=>v.id===f.id))});if(!await G(A,[{id:g,role:"user",parts:h}],()=>{if(!n&&p.current&&c.current===l)u.adopt(l,D),S.current=A,K(A,!0)},{text:x,uploads:[...b]})&&(c.current===D||!n&&c.current===l)){M((at)=>at.filter((st)=>st.id!==g));let f=c.current,v=u.read(f);u.update(f,{...H&&!v.text?{text:x}:{},uploads:[...w.filter((at)=>!v.uploads.some((st)=>st.id===at.id)),...v.uploads]})}},[K,n,i,u,l,c,p,S,G,E,q,b,W]),Ut=m.useCallback(async(x,y)=>{if(!n||E)return;await G(n,[Et(x,y)])},[n,G,E]),Wt=m.useCallback(async(x)=>{if(x.type==="prompt"){await et(x.prompt);return}if(!n||E)return;T(!0),B(null);try{let y=await e.runAction({conversationId:n,action:{type:"event",event:x.event,...x.fromState?{fromState:x.fromState}:{}}});if(!p.current||c.current!==l)return;M((A)=>[...A,{id:crypto.randomUUID(),role:"assistant",content:y.text,...y.cards?{cards:y.cards}:{}}])}catch(y){if(p.current&&c.current===l)B(ct(y,"Chat action failed"))}finally{if(p.current&&c.current===l)T(!1)}},[e,n,E,et,l,c,p]);return{pendingMessages:Z,stream:_,sending:E,error:Tt,interrupted:Pt,setSending:T,setError:B,setPendingMessages:M,runStream:G,submitPrompt:et,respondToApproval:Ut,runSuggestedAction:Wt,hasActiveStream:Ht,stopActiveStream:Rt,abortActiveStream:tt,reset:Vt}}var pt=I(X(),1);function Ze(t){let{chatClient:e,sessionId:a,sending:n,pendingMessages:i,stream:u}=t,l=Y({queryKey:L.messages(a??""),queryFn:()=>e.getMessages(a??""),enabled:a!==null&&a!==void 0&&!n&&i.length===0}),c=l.data??[],p=pt.useMemo(()=>{let b=[...c,...i];if(u&&(u.text||u.cards.length>0))b.push(Q(u));return b},[i,c,u]),S=pt.useMemo(()=>p.flatMap((b)=>(b.cards??[]).filter((q)=>q.kind==="sources"||q.kind==="attachment")),[p]);return{visibleMessages:p,contextCards:S,historyFailed:l.error!==null,historyOpening:l.isPending,historyReading:l.isFetching,hasStoredHistory:c.length>0,retryHistory:()=>void l.refetch()}}
|
|
4
|
+
export{s as W,o as X,xt as Y,L as Z,ue as _,ke as $,Ne as aa,Ae as ba,qe as ca,Pe as da,ct as ea,Ke as fa,Ze as ga};
|
|
5
|
+
|
|
6
|
+
//# debugId=1643ED45CEFF862F64756E2164756E21
|