@standardagents/builder 0.17.3 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{d as Y,X as J,Y as X,r as s,c as O,o as $,O as z,b as l,e as o,f as t,j as d,k as h,q as c,u as I,F as Q,z as Z,J as A,s as S,m as ee}from"./vue.js";import{r as te,s as L,a as v,_ as P,b as ae,l as re,c as se,d as j,e as F,f as G}from"./index.js";import"./formkit.js";import"./vendor.js";import"./syntax.js";import"./monaco.js";const ne={class:"login-container flex-1 flex items-center justify-center px-4"},oe={class:"max-w-md w-full space-y-8"},le={class:"flex justify-center"},ie=["src"],ue={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 py-8 px-6 rounded-lg"},de={key:0,class:"bg-red-50 dark:bg-red-950 border border-red-500 text-red-700 dark:text-red-400 px-4 py-3 mb-6 rounded"},ce={key:1,class:"py-6 text-center text-sm text-neutral-600 dark:text-neutral-300"},fe={key:0,class:"space-y-3"},ve={key:1,class:"space-y-3"},ge={key:2,class:"relative my-6"},pe={class:"mt-6"},me={key:3,class:"mt-6"},Ce=Y({__name:"LoginView",setup(he){function q(a){return a.startsWith("/src/")||a.startsWith("data:")?a:a.replace("/agents/","/")}const V=q(re),T=q(se),b=J(),w=X(),r=s(""),y=s(!1),k=s(!1),x=s(!0),g=s(!1),_=s(!1),B=s(!1),C=s(!1),p=s(!1),m=s(!1),E=s(te()==="dark"),f=s(null),H=O(()=>E.value?T:V),M=O(()=>!g.value||_.value);async function N(a=!1){try{const e=await fetch(v("/api/auth/bootstrap"),{method:"POST",headers:{Accept:"application/json"}});if(e.status===204)return a&&(r.value="Standard Agents sign-in is not available for this instance."),!1;if(!e.ok){if(a){const i=await e.json().catch(()=>({}));r.value=i.error||"Standard Agents sign-in failed."}return!1}const n=await e.json();return n.token?(L(n.token),j(),await b.push("/"),!0):(a&&(r.value="Standard Agents sign-in is not available for this instance."),!1)}catch(e){return a&&(r.value=e instanceof Error?e.message:"Standard Agents sign-in failed."),!1}}async function K(){r.value="",F(f),k.value=!0;try{await N(!0)}finally{k.value=!1}}function R(){window.location.href=v("/api/auth/sa/start")}$(async()=>{const a=w.query.token,e=w.query.error,n=w.query.sa_error;if(a){L(a),j(),b.push("/");return}e==="oauth_failed"?r.value="OAuth authentication failed. Please try again.":e==="oauth_not_configured"&&(r.value="OAuth provider is not configured."),n&&(r.value=n==="forbidden"?"Your Standard Agents account doesn't have access to this instance.":"Standard Agents sign-in didn't complete. Please try again.");try{const i=await fetch(v("/api/auth/config"));if(i.ok){const u=await i.json();p.value=u.github||!1,m.value=u.google||!1,g.value=u.platformConnected||!1,_.value=u.localPassword||!1,B.value=u.hosted||!1,C.value=u.standardAgentsLogin||!1}}catch{p.value=!1,m.value=!1,g.value=!1,_.value=!1}!B.value&&await N()||(x.value=!1)});async function D(a){r.value="",F(f),y.value=!0;try{const e=await fetch(v("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:a.username,password:a.password})}),n=await e.json();e.ok?(L(n.token),j(),b.push("/")):G(n,f)||(r.value=n.error||"Login failed")}catch{G({error:"Network error. Please try again."},f)}finally{y.value=!1}}function U(){window.location.href=v("/api/auth/oauth/github")}function W(){window.location.href=v("/api/auth/oauth/google")}return(a,e)=>{const n=z("FormKitMessages"),i=z("FormKit");return o(),l("div",ne,[t("div",oe,[t("div",le,[t("img",{src:H.value,alt:"AgentBuilder",class:"h-16 pointer-events-none select-none"},null,8,ie)]),d(ae,{offsetX:8,offsetY:8,intensity:.2,pattern:"crosshatch"},{default:h(()=>[t("div",ue,[r.value?(o(),l("div",de,I(r.value),1)):c("",!0),x.value?(o(),l("div",ce," Connecting to your Standard Agents account... ")):(o(),l(Q,{key:2},[C.value?(o(),l("div",fe,[d(A(P),{type:"button",variant:"primary","full-width":"",onClick:R},{default:h(()=>[...e[1]||(e[1]=[S(" Login with Standard Agents ",-1)])]),_:1})])):g.value?(o(),l("div",ve,[d(A(P),{type:"button",variant:"primary","full-width":"",loading:k.value,onClick:K},{default:h(()=>[...e[2]||(e[2]=[S(" Continue with Standard Agents ",-1)])]),_:1},8,["loading"])])):c("",!0),(C.value||g.value)&&M.value?(o(),l("div",ge,[...e[3]||(e[3]=[t("div",{class:"absolute inset-0 flex items-center"},[t("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})],-1),t("div",{class:"relative flex justify-center text-sm"},[t("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or sign in locally")],-1)])])):c("",!0),M.value?(o(),Z(i,{key:3,type:"form",actions:!1,onSubmit:D,onNode:e[0]||(e[0]=u=>f.value=u),disabled:y.value},{default:h(()=>[d(n,{node:f.value||void 0},null,8,["node"]),d(i,{type:"text",name:"username",label:"Username",placeholder:"Enter your username",validation:"required","validation-messages":{required:"Username is required"}}),d(i,{type:"password",name:"password",label:"Password",placeholder:"Enter your password",validation:"required","validation-messages":{required:"Password is required"}}),t("div",pe,[d(A(P),{type:"submit",variant:"primary","full-width":"",loading:y.value},{default:h(()=>[...e[4]||(e[4]=[S(" Sign in ",-1)])]),_:1},8,["loading"])])]),_:1},8,["disabled"])):c("",!0)],64)),!x.value&&(p.value||m.value)?(o(),l("div",me,[e[7]||(e[7]=t("div",{class:"relative"},[t("div",{class:"absolute inset-0 flex items-center"},[t("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})]),t("div",{class:"relative flex justify-center text-sm"},[t("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or continue with")])],-1)),t("div",{class:ee(["mt-6 grid gap-3",p.value&&m.value?"grid-cols-2":"grid-cols-1"])},[p.value?(o(),l("button",{key:0,onClick:U,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...e[5]||(e[5]=[t("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20"},[t("path",{"fill-rule":"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z","clip-rule":"evenodd"})],-1),t("span",{class:"ml-2"},"GitHub",-1)])])):c("",!0),m.value?(o(),l("button",{key:1,onClick:W,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...e[6]||(e[6]=[t("svg",{class:"h-5 w-5",viewBox:"0 0 24 24"},[t("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),t("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),t("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),t("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})],-1),t("span",{class:"ml-2"},"Google",-1)])])):c("",!0)],2)])):c("",!0)])]),_:1})])])}}});export{Ce as default};
1
+ import{d as Y,X as J,Y as X,r as s,c as O,o as $,O as z,b as l,e as o,f as t,j as d,k as h,q as c,u as I,F as Q,z as Z,J as S,s as L,m as ee}from"./vue.js";import{r as te,s as P,a as p,_ as j,b as ae,l as re,c as se,d as q,e as F,f as G}from"./index.js";import"./formkit.js";import"./vendor.js";import"./syntax.js";import"./monaco.js";const ne={class:"login-container flex-1 flex items-center justify-center px-4"},oe={class:"max-w-md w-full space-y-8"},le={class:"flex justify-center"},ie=["src"],ue={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 py-8 px-6 rounded-lg"},de={key:0,class:"bg-red-50 dark:bg-red-950 border border-red-500 text-red-700 dark:text-red-400 px-4 py-3 mb-6 rounded"},ce={key:1,class:"py-6 text-center text-sm text-neutral-600 dark:text-neutral-300"},fe={key:0,class:"space-y-3"},ve={key:1,class:"space-y-3"},ge={key:2,class:"relative my-6"},pe={class:"mt-6"},me={key:3,class:"mt-6"},Ce=Y({__name:"LoginView",setup(he){function B(a){return a.startsWith("/src/")||a.startsWith("data:")?a:a.replace("/agents/","/")}const V=B(re),T=B(se),w=J(),k=X(),r=s(""),y=s(!1),x=s(!1),_=s(!0),m=s(!1),C=s(!1),b=s(!1),A=s(!1),f=s(!1),v=s(!1),E=s(te()==="dark"),g=s(null),H=O(()=>E.value?T:V),M=O(()=>!b.value&&(!m.value||C.value));async function N(a=!1){try{const e=await fetch(p("/api/auth/bootstrap"),{method:"POST",headers:{Accept:"application/json"}});if(e.status===204)return a&&(r.value="Standard Agents sign-in is not available for this instance."),!1;if(!e.ok){if(a){const i=await e.json().catch(()=>({}));r.value=i.error||"Standard Agents sign-in failed."}return!1}const n=await e.json();return n.token?(P(n.token),q(),await w.push("/"),!0):(a&&(r.value="Standard Agents sign-in is not available for this instance."),!1)}catch(e){return a&&(r.value=e instanceof Error?e.message:"Standard Agents sign-in failed."),!1}}async function K(){r.value="",F(g),x.value=!0;try{await N(!0)}finally{x.value=!1}}function R(){window.location.href=p("/api/auth/sa/start")}$(async()=>{const a=k.query.token,e=k.query.error,n=k.query.sa_error;if(a){P(a),q(),w.push("/");return}e==="oauth_failed"?r.value="OAuth authentication failed. Please try again.":e==="oauth_not_configured"&&(r.value="OAuth provider is not configured."),n&&(r.value=n==="forbidden"?"Your Standard Agents account doesn't have access to this instance.":"Standard Agents sign-in didn't complete. Please try again.");try{const i=await fetch(p("/api/auth/config"));if(i.ok){const u=await i.json();f.value=u.github||!1,v.value=u.google||!1,m.value=u.platformConnected||!1,C.value=u.localPassword||!1,b.value=u.hosted||!1,A.value=u.standardAgentsLogin||!1,b.value&&(f.value=!1,v.value=!1)}}catch{f.value=!1,v.value=!1,m.value=!1,C.value=!1}!b.value&&await N()||(_.value=!1)});async function D(a){r.value="",F(g),y.value=!0;try{const e=await fetch(p("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:a.username,password:a.password})}),n=await e.json();e.ok?(P(n.token),q(),w.push("/")):G(n,g)||(r.value=n.error||"Login failed")}catch{G({error:"Network error. Please try again."},g)}finally{y.value=!1}}function U(){window.location.href=p("/api/auth/oauth/github")}function W(){window.location.href=p("/api/auth/oauth/google")}return(a,e)=>{const n=z("FormKitMessages"),i=z("FormKit");return o(),l("div",ne,[t("div",oe,[t("div",le,[t("img",{src:H.value,alt:"AgentBuilder",class:"h-16 pointer-events-none select-none"},null,8,ie)]),d(ae,{offsetX:8,offsetY:8,intensity:.2,pattern:"crosshatch"},{default:h(()=>[t("div",ue,[r.value?(o(),l("div",de,I(r.value),1)):c("",!0),_.value?(o(),l("div",ce," Connecting to your Standard Agents account... ")):(o(),l(Q,{key:2},[A.value?(o(),l("div",fe,[d(S(j),{type:"button",variant:"primary","full-width":"",onClick:R},{default:h(()=>[...e[1]||(e[1]=[L(" Login with Standard Agents ",-1)])]),_:1})])):m.value?(o(),l("div",ve,[d(S(j),{type:"button",variant:"primary","full-width":"",loading:x.value,onClick:K},{default:h(()=>[...e[2]||(e[2]=[L(" Continue with Standard Agents ",-1)])]),_:1},8,["loading"])])):c("",!0),(A.value||m.value)&&M.value?(o(),l("div",ge,[...e[3]||(e[3]=[t("div",{class:"absolute inset-0 flex items-center"},[t("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})],-1),t("div",{class:"relative flex justify-center text-sm"},[t("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or sign in locally")],-1)])])):c("",!0),M.value?(o(),Z(i,{key:3,type:"form",actions:!1,onSubmit:D,onNode:e[0]||(e[0]=u=>g.value=u),disabled:y.value},{default:h(()=>[d(n,{node:g.value||void 0},null,8,["node"]),d(i,{type:"text",name:"username",label:"Username",placeholder:"Enter your username",validation:"required","validation-messages":{required:"Username is required"}}),d(i,{type:"password",name:"password",label:"Password",placeholder:"Enter your password",validation:"required","validation-messages":{required:"Password is required"}}),t("div",pe,[d(S(j),{type:"submit",variant:"primary","full-width":"",loading:y.value},{default:h(()=>[...e[4]||(e[4]=[L(" Sign in ",-1)])]),_:1},8,["loading"])])]),_:1},8,["disabled"])):c("",!0)],64)),!_.value&&(f.value||v.value)?(o(),l("div",me,[e[7]||(e[7]=t("div",{class:"relative"},[t("div",{class:"absolute inset-0 flex items-center"},[t("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})]),t("div",{class:"relative flex justify-center text-sm"},[t("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or continue with")])],-1)),t("div",{class:ee(["mt-6 grid gap-3",f.value&&v.value?"grid-cols-2":"grid-cols-1"])},[f.value?(o(),l("button",{key:0,onClick:U,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...e[5]||(e[5]=[t("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20"},[t("path",{"fill-rule":"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z","clip-rule":"evenodd"})],-1),t("span",{class:"ml-2"},"GitHub",-1)])])):c("",!0),v.value?(o(),l("button",{key:1,onClick:W,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...e[6]||(e[6]=[t("svg",{class:"h-5 w-5",viewBox:"0 0 24 24"},[t("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),t("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),t("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),t("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})],-1),t("span",{class:"ml-2"},"Google",-1)])])):c("",!0)],2)])):c("",!0)])]),_:1})])])}}});export{Ce as default};