@whoz-oss/coday-client 3.23.0 → 3.25.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.
- package/browser/{chunk-KccQKSLr.js → chunk--j9cf9d6.js} +2 -2
- package/browser/chunk-2dXF6kxO.js +1 -0
- package/browser/{chunk-YGA4ansj.js → chunk-6ZQ87jQV.js} +1 -1
- package/browser/{chunk-BpzIo3TO.js → chunk-AfeufHde.js} +1 -1
- package/browser/{chunk-CqZF9JZo.js → chunk-B2UoGfZ3.js} +6 -6
- package/browser/{chunk-BfzDf8xE.js → chunk-B6pr9Now.js} +1 -1
- package/browser/{chunk-DNlBxwgK.js → chunk-BAyZlfDb.js} +1 -1
- package/browser/{chunk-VyuxzGHt.js → chunk-BH0AuKDN.js} +1 -1
- package/browser/{chunk-DVGYZ6ty.js → chunk-BP7WYYNR.js} +1 -1
- package/browser/{chunk-BIOQZPFJ.js → chunk-BRAKs_V4.js} +2 -2
- package/browser/{chunk-CMHnK5hV.js → chunk-BSmtz5y3.js} +2 -2
- package/browser/{chunk-BQFfxCd3.js → chunk-BUi4VbRk.js} +1 -1
- package/browser/{chunk-B3Yorxwd.js → chunk-BWE4takb.js} +1 -1
- package/browser/chunk-BZIfffSY.js +1 -0
- package/browser/chunk-BaAG5SRs.js +9 -0
- package/browser/{chunk-CWQR6xJk.js → chunk-BkZ4nMy0.js} +1 -1
- package/browser/{chunk-Cg68_3Ns.js → chunk-Bkl_Vpe1.js} +1 -1
- package/browser/{chunk-Bc0TgO1-.js → chunk-BorcVzNx.js} +1 -1
- package/browser/{chunk-COoOJuQT.js → chunk-Bsd6cfhc.js} +1 -1
- package/browser/{chunk-CXhfjTCk.js → chunk-Btjdv26a.js} +1 -1
- package/browser/{chunk-BrNRhqhm.js → chunk-Bv19t8Yr.js} +1 -1
- package/browser/{chunk-C3MIs5_Y.js → chunk-ByqToPFV.js} +1 -1
- package/browser/{chunk-BQwFVWSb.js → chunk-C0cIJD6B.js} +1 -1
- package/browser/{chunk-DHr7_ikE.js → chunk-C3uyXZ11.js} +1 -1
- package/browser/{chunk-BZCIYJOL.js → chunk-C4kiVp0I.js} +1 -1
- package/browser/{chunk-sz0CVF1-.js → chunk-CBsoAXBW.js} +1 -1
- package/browser/chunk-CCSxTkZ-.js +1 -0
- package/browser/{chunk-lkvHsW8k.js → chunk-CDteNbQE.js} +1 -1
- package/browser/{chunk-CuOGglmC.js → chunk-CIFgO2HT.js} +1 -1
- package/browser/{chunk-DH3pQb49.js → chunk-CKdscASQ.js} +1 -1
- package/browser/{chunk-B3kY-GQk.js → chunk-CPuMGlfm.js} +1 -1
- package/browser/{chunk-BCqtwdIe.js → chunk-CU9SkJlG.js} +1 -1
- package/browser/{chunk-CJD8ErVH.js → chunk-CWfLK-02.js} +1 -1
- package/browser/{chunk-CXwHeDac.js → chunk-CXFeBkf0.js} +1 -1
- package/browser/{chunk-D9wXETZp.js → chunk-Cc6av_kK.js} +2 -2
- package/browser/{chunk-D89TfP1E.js → chunk-Ccwn8U1w.js} +1 -1
- package/browser/chunk-Ce6h2FeE.js +1 -0
- package/browser/chunk-CfZ8rkw0.js +1 -0
- package/browser/{chunk-CT4atmse.js → chunk-CgtOp5dr.js} +3 -3
- package/browser/{chunk-CaL6ZXsO.js → chunk-CmWqV8dc.js} +6 -6
- package/browser/{chunk-CRyr4oOy.js → chunk-ComIIQUU.js} +1 -1
- package/browser/{chunk-D7p9n5a9.js → chunk-Cyh4DuAi.js} +1 -1
- package/browser/{chunk-DdUOdkVr.js → chunk-D26Rjl-2.js} +1 -1
- package/browser/{chunk-SsHAmybq.js → chunk-D62ekcvB.js} +1 -1
- package/browser/{chunk-bl1pitLA.js → chunk-DEUnwPWC.js} +1 -1
- package/browser/{chunk-DL11Jf1L.js → chunk-DIKc_N9D.js} +1 -1
- package/browser/{chunk-O1I9EEmj.js → chunk-DIY-0Lon.js} +1 -1
- package/browser/{chunk-DkP2MwMu.js → chunk-DT0j_Tak.js} +1 -1
- package/browser/{chunk-ChsKwSBf.js → chunk-DaphJW96.js} +1 -1
- package/browser/{chunk-BqC6QWDU.js → chunk-Dgr7xggj.js} +3 -3
- package/browser/chunk-DpWl8Hmh.js +2 -0
- package/browser/{chunk-BdZ0xOqX.js → chunk-DrcS-IIH.js} +5 -5
- package/browser/{chunk-DrKKLE1-.js → chunk-DuGczpUf.js} +2 -2
- package/browser/{chunk-BT7IPqmu.js → chunk-DwD-3Qe0.js} +1 -1
- package/browser/{chunk-CyJ_au6Y.js → chunk-Dx97073t.js} +5 -5
- package/browser/{chunk-BoiQFZ4H.js → chunk-DyyifT6r.js} +1 -1
- package/browser/chunk-GWd9G-Nj.js +1 -0
- package/browser/{chunk-B2FRxZw1.js → chunk-L0O9mlbO.js} +1 -1
- package/browser/{chunk-oqOgDyIj.js → chunk-OZvSiKvx.js} +1 -1
- package/browser/chunk-OpIcFxMt.js +1 -0
- package/browser/{chunk-B4K0ULQ8.js → chunk-OqElmTmR.js} +1 -1
- package/browser/{chunk-bHVjhtHf.js → chunk-RFOuzDB-.js} +1 -1
- package/browser/{chunk-B0USjT_j.js → chunk-bEyVnMri.js} +1 -1
- package/browser/{chunk-CZ4gj_xn.js → chunk-ehgi4mB8.js} +1 -1
- package/browser/{chunk-uY_BCJ93.js → chunk-iT-BBh_o.js} +1 -1
- package/browser/{chunk-C9T7UBD_.js → chunk-iiREShnX.js} +1 -1
- package/browser/{chunk-DF3Ha0Tb.js → chunk-pyvVjc-9.js} +1 -1
- package/browser/{chunk-BSc7HTHd.js → chunk-rWPj3GdK.js} +1 -1
- package/browser/{chunk-oIPYJtHA.js → chunk-sI2K91LE.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-RXIVNUWK.js → main-4LGWVPVH.js} +18 -18
- package/package.json +1 -1
- package/browser/chunk-7dyrHGkF.js +0 -1
- package/browser/chunk-BXGcSbBl.js +0 -1
- package/browser/chunk-BujvNLrF.js +0 -1
- package/browser/chunk-C4IJySYO.js +0 -2
- package/browser/chunk-CjgyOse7.js +0 -1
- package/browser/chunk-CzL7jU35.js +0 -1
- package/browser/chunk-D8dXXVY5.js +0 -9
- package/browser/chunk-DqfAYcrx.js +0 -1
- package/browser/chunk-yfVcVvz_.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {p}from'./chunk-
|
|
1
|
+
import {p}from'./chunk-BaAG5SRs.js';import {g,ao as V,E as vy,d4 as y,j as jw,aw as gl,J as JC,ax as ml,u as sI,a8 as em}from'./main-4LGWVPVH.js';import'./chunk-6ZQ87jQV.js';import'./chunk-CmWqV8dc.js';import'./chunk-B2UoGfZ3.js';import'./chunk-CPuMGlfm.js';var A=class r{route=g(V);http=g(vy);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=jw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(gl(0,"p",0),JC(1),ml()),t&2&&(sI(),em(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {i}from'./chunk-CCSxTkZ-.js';import {l}from'./chunk-BaAG5SRs.js';import {g,d9 as N$1,dj as fe,aJ as Tr,aD as zy,bS as Da,a7 as va,X as br,r as re,cE as Pd,bU as jd,Y as x}from'./main-4LGWVPVH.js';var y="none",O="me",N=class f{nsController=g(N$1);exportService=g(fe);userState=g(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=zy([this.namespaceId$,this.refresh$]).pipe(Da(([e])=>{let n=this.loadPlatformConfigs().pipe(va(()=>br([]))),t=this.loadUserConfigs("global").pipe(va(()=>br([])));return e?zy([n,this.loadNamespaceConfigs(e).pipe(va(()=>br([]))),this.loadUserConfigs(e).pipe(va(()=>br([]))),t]).pipe(re(([i,r,c,s])=>({platform:i,namespace:r,userOnNs:c,userGlobal:s}))):zy([n,t]).pipe(re(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),Pd({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(y)}loadUserConfigs(e){let n=e==="global"?y:e;return this.nsController.listIntegrationConfig(n,O)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):br([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let s={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(jd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let s={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(jd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(c).pipe(jd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0};return this.nsController.updateIntegrationConfig(e,r).pipe(jd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(jd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||f)};static \u0275prov=x({token:f,factory:f.\u0275fac,providedIn:"root"})};export{N};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v}from'./chunk-yfVcVvz_.js';import {R,q,J}from'./chunk-CWQR6xJk.js';import {g,ao as V,G,C as Ce$1,W as Wi,F,T as TT,cd as $f,b as U,z as z$1,a as P$1,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,a8 as Kg,u as cC,a9 as vC,q as dC,a4 as lC,a3 as ZI,M as Mg,ac as CC,_ as _g,a6 as QI,v as fC,a5 as Dl,cH as iC,aa as Cf,ab as Tf,b$ as UC,S as Sg}from'./main-RXIVNUWK.js';import'./chunk-D8dXXVY5.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-B3kY-GQk.js';import'./chunk-CzL7jU35.js';import'./chunk-YGA4ansj.js';import'./chunk-CaL6ZXsO.js';import'./chunk-CqZF9JZo.js';function se(i,t){i&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function ce(i,t){if(i&1&&(Cs(0,"label",23),Mg(1,"input",24),ZI(),Cs(2,"span"),JC(3),hl()()),i&2){let e=t.$implicit,o=CC(3);sI(),_g("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),QI(),sI(2),Kg(e.label);}}function de(i,t){if(i&1&&(Cs(0,"fieldset",8)(1,"legend",22),JC(2,"Configuration scope"),hl(),dC(3,ce,4,4,"label",23,iC().trackByScope,true),hl()),i&2){let e=CC(2);_g("disabled",e.isEditMode()),sI(3),fC(e.scopeOptions);}}function ue(i,t){if(i&1&&(Cs(0,"option",13),JC(1),hl()),i&2){let e=t.$implicit,o=CC(2);_g("value",e),sI(),Kg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&JC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(Cs(0,"span",11),JC(1,"*"),hl());}function me(i,t){if(i&1&&(Cs(0,"p",28),JC(1),hl()),i&2){let e=CC(2).$implicit;_g("id","as-hint-"+e.key),sI(),Kg(e.hint);}}function ge(i,t){if(i&1&&(Mg(0,"input",27),ZI(),aC(1,me,2,2,"p",28)),i&2){let e=CC().$implicit;UC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),_g("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Sg("aria-describedby",e.hint?"as-hint-"+e.key:null),QI(),sI(),cC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(Cs(0,"div",9)(1,"label",26),JC(2),aC(3,he,2,0,"span",11),hl(),aC(4,ge,2,9),hl()),i&2){let e,o=t.$implicit,l=CC(3);sI(),_g("for","as-cred-"+o.key),sI(),Dl(" ",o.label," "),sI(),cC(o.required?3:-1),sI(),cC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(Cs(0,"fieldset",18)(1,"legend",22),JC(2,"Credentials"),hl(),Cs(3,"p",25),JC(4," Values are stored encrypted and masked on read. "),aC(5,pe,1,0),hl(),dC(6,Ce,5,4,"div",9,iC().trackByField,true),hl()),i&2){let e=CC(2);sI(5),cC(e.isEditMode()?5:-1),sI(),fC(e.credentialFields());}}function ye(i,t){if(i&1){let e=vC();Cs(0,"form",7),kg("ngSubmit",function(){Cf(e);let l=CC();return Tf(l.submit())}),aC(1,de,5,1,"fieldset",8),Cs(2,"div",9)(3,"label",10),JC(4,"Auth type "),Cs(5,"span",11),JC(6,"*"),hl()(),Cs(7,"select",12),dC(8,ue,2,2,"option",13,lC),hl(),ZI(),hl(),Cs(10,"div",9)(11,"label",14),JC(12,"Name "),Cs(13,"span",11),JC(14,"*"),hl()(),Mg(15,"input",15),ZI(),hl(),Cs(16,"div",9)(17,"label",16),JC(18,"Description"),hl(),Mg(19,"input",17),ZI(),hl(),aC(20,fe,8,1,"fieldset",18),Cs(21,"div",19)(22,"button",20),JC(23),hl(),Cs(24,"button",21),kg("click",function(){Cf(e);let l=CC();return Tf(l.cancel())}),JC(25,"Cancel"),hl()()();}if(i&2){let e=CC();_g("formGroup",e.form),sI(),cC(e.isPlatformMode?-1:1),sI(6),_g("formControl",e.authTypeControl),QI(),sI(),fC(e.authTypeOptions),sI(7),_g("formControl",e.nameControl),QI(),sI(4),_g("formControl",e.descriptionControl),QI(),sI(),cC(e.credentialFields().length>0?20:-1),sI(2),_g("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(V);router=g(G);destroyRef=g(Ce$1);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Wi(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=TT(()=>Se[this.selectedAuthType()]);isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||$f(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return z$1(P$1({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return z$1(P$1({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return z$1(P$1({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return z$1(P$1({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return z$1(P$1({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),kg("click",function(){return o.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," Auth Settings "),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,se,2,0,"p",5)(9,ye,26,8,"form",6),hl()),e&2&&(sI(7),Kg(o.isEditMode()?"Edit auth setting":"New auth setting"),sI(),cC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
1
|
+
import {v}from'./chunk-OpIcFxMt.js';import {R,q,J}from'./chunk-BkZ4nMy0.js';import {g,ao as V,G,C as Ce$1,W as Wi,F,T as TT,cd as Wf,b as U,z as z$1,a as P$1,j as jw,k as Cs,n as Lg,J as JC,m as hl,o as aC,u as sI,a8 as em,v as cC,a9 as vC,q as dC,a4 as lC,a3 as ZI,A as Ag,ac as CC,x as xg,a6 as QI,w as fC,a5 as Dl,cH as iC,aa as Sf,ab as _f,b$ as UC,N as Ng}from'./main-4LGWVPVH.js';import'./chunk-BaAG5SRs.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-CPuMGlfm.js';import'./chunk-CCSxTkZ-.js';import'./chunk-6ZQ87jQV.js';import'./chunk-CmWqV8dc.js';import'./chunk-B2UoGfZ3.js';function se(i,t){i&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function ce(i,t){if(i&1&&(Cs(0,"label",23),Ag(1,"input",24),ZI(),Cs(2,"span"),JC(3),hl()()),i&2){let e=t.$implicit,o=CC(3);sI(),xg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),QI(),sI(2),em(e.label);}}function de(i,t){if(i&1&&(Cs(0,"fieldset",8)(1,"legend",22),JC(2,"Configuration scope"),hl(),dC(3,ce,4,4,"label",23,iC().trackByScope,true),hl()),i&2){let e=CC(2);xg("disabled",e.isEditMode()),sI(3),fC(e.scopeOptions);}}function ue(i,t){if(i&1&&(Cs(0,"option",13),JC(1),hl()),i&2){let e=t.$implicit,o=CC(2);xg("value",e),sI(),em(o.authTypeLabel[e]);}}function pe(i,t){i&1&&JC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(Cs(0,"span",11),JC(1,"*"),hl());}function me(i,t){if(i&1&&(Cs(0,"p",28),JC(1),hl()),i&2){let e=CC(2).$implicit;xg("id","as-hint-"+e.key),sI(),em(e.hint);}}function ge(i,t){if(i&1&&(Ag(0,"input",27),ZI(),aC(1,me,2,2,"p",28)),i&2){let e=CC().$implicit;UC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),xg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Ng("aria-describedby",e.hint?"as-hint-"+e.key:null),QI(),sI(),cC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(Cs(0,"div",9)(1,"label",26),JC(2),aC(3,he,2,0,"span",11),hl(),aC(4,ge,2,9),hl()),i&2){let e,o=t.$implicit,l=CC(3);sI(),xg("for","as-cred-"+o.key),sI(),Dl(" ",o.label," "),sI(),cC(o.required?3:-1),sI(),cC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(Cs(0,"fieldset",18)(1,"legend",22),JC(2,"Credentials"),hl(),Cs(3,"p",25),JC(4," Values are stored encrypted and masked on read. "),aC(5,pe,1,0),hl(),dC(6,Ce,5,4,"div",9,iC().trackByField,true),hl()),i&2){let e=CC(2);sI(5),cC(e.isEditMode()?5:-1),sI(),fC(e.credentialFields());}}function ye(i,t){if(i&1){let e=vC();Cs(0,"form",7),Lg("ngSubmit",function(){Sf(e);let l=CC();return _f(l.submit())}),aC(1,de,5,1,"fieldset",8),Cs(2,"div",9)(3,"label",10),JC(4,"Auth type "),Cs(5,"span",11),JC(6,"*"),hl()(),Cs(7,"select",12),dC(8,ue,2,2,"option",13,lC),hl(),ZI(),hl(),Cs(10,"div",9)(11,"label",14),JC(12,"Name "),Cs(13,"span",11),JC(14,"*"),hl()(),Ag(15,"input",15),ZI(),hl(),Cs(16,"div",9)(17,"label",16),JC(18,"Description"),hl(),Ag(19,"input",17),ZI(),hl(),aC(20,fe,8,1,"fieldset",18),Cs(21,"div",19)(22,"button",20),JC(23),hl(),Cs(24,"button",21),Lg("click",function(){Sf(e);let l=CC();return _f(l.cancel())}),JC(25,"Cancel"),hl()()();}if(i&2){let e=CC();xg("formGroup",e.form),sI(),cC(e.isPlatformMode?-1:1),sI(6),xg("formControl",e.authTypeControl),QI(),sI(),fC(e.authTypeOptions),sI(7),xg("formControl",e.nameControl),QI(),sI(4),xg("formControl",e.descriptionControl),QI(),sI(),cC(e.credentialFields().length>0?20:-1),sI(2),xg("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(V);router=g(G);destroyRef=g(Ce$1);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Wi(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=TT(()=>Se[this.selectedAuthType()]);isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Wf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return z$1(P$1({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return z$1(P$1({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return z$1(P$1({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return z$1(P$1({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return z$1(P$1({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return z$1(P$1({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),Lg("click",function(){return o.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," Auth Settings "),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,se,2,0,"p",5)(9,ye,26,8,"form",6),hl()),e&2&&(sI(7),em(o.isEditMode()?"Edit auth setting":"New auth setting"),sI(),cC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
2
2
|
export{le as AuthSettingFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,P,j as jw,h as hr,e as pr,k as Cs,n as
|
|
1
|
+
import {g,G,P,j as jw,h as hr,e as pr,k as Cs,n as Lg,J as JC,m as hl,o as aC,u as sI,x as xg,v as cC,a5 as Dl,al as vt,am as Xm,a9 as vC,ai as sm,aa as Sf,aj as iT,ab as _f,a3 as ZI,ak as im,a6 as QI,H as Hg,M as MC,B as NC,ac as CC,a8 as em}from'./main-4LGWVPVH.js';import {y as yt,w as wt,t as ti,Y as Ye,Z as Zn,c as cn}from'./chunk-CPuMGlfm.js';var J=["inputElement"];function K(o,r){if(o&1&&(Cs(0,"span",3),JC(1),hl()),o&2){let t=CC();sI(),em(t.label);}}function U(o,r){if(o&1&&(Cs(0,"small",5),JC(1),hl()),o&2){let t=CC();sI(),em(t.hint);}}var h=class o{label="";placeholder="";hint="";isDisabled=false;value="";autoFocus=true;valueChange=new vt;enterPressed=new vt;inputElement;inputValue="";ngAfterViewInit(){this.inputValue=this.value,this.autoFocus&&setTimeout(()=>this.inputElement?.nativeElement.focus(),100);}onValueChange(r){this.valueChange.emit(r);}onEnter(){this.inputValue.trim()&&this.enterPressed.emit(this.inputValue.trim());}focus(){this.inputElement?.nativeElement.focus();}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-text-input"]],viewQuery:function(t,e){if(t&1&&Hg(J,5),t&2){let p;MC(p=NC())&&(e.inputElement=p.first);}},inputs:{label:"label",placeholder:"placeholder",hint:"hint",isDisabled:"isDisabled",value:"value",autoFocus:"autoFocus"},outputs:{valueChange:"valueChange",enterPressed:"enterPressed"},decls:6,vars:5,consts:[["inputElement",""],[1,"text-input-container"],[1,"text-input-wrapper"],[1,"text-input-label"],["type","text",1,"text-input-field",3,"ngModelChange","keydown.enter","ngModel","placeholder","disabled"],[1,"text-input-hint"]],template:function(t,e){if(t&1){let p=vC();Cs(0,"div",1)(1,"label",2),aC(2,K,2,1,"span",3),Cs(3,"input",4,0),sm("ngModelChange",function(m){return Sf(p),iT(e.inputValue,m)||(e.inputValue=m),_f(m)}),Lg("ngModelChange",function(m){return e.onValueChange(m)})("keydown.enter",function(){return e.onEnter()}),hl(),ZI(),hl(),aC(5,U,2,1,"small",5),hl();}t&2&&(sI(2),cC(e.label?2:-1),sI(),im("ngModel",e.inputValue),xg("placeholder",e.placeholder)("disabled",e.isDisabled),QI(),sI(2),cC(e.hint?5:-1));},dependencies:[ti,Ye,Zn,cn,Xm],styles:[".text-input-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%}.text-input-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%;cursor:text}.text-input-label[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);margin:0}.text-input-field[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;font-size:1rem;color:var(--color-text);background:var(--color-bg);border:1px solid var(--color-border);border-radius:8px;outline:none;transition:all .2s ease}.text-input-field[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.7}.text-input-field[_ngcontent-%COMP%]:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.1)}.text-input-field[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed;background:var(--color-surface)}.text-input-hint[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);margin:0;font-style:italic}@media(max-width:768px){.text-input-field[_ngcontent-%COMP%]{padding:.65rem .85rem;font-size:.95rem}.text-input-label[_ngcontent-%COMP%]{font-size:.9rem}.text-input-hint[_ngcontent-%COMP%]{font-size:.8rem}}"],changeDetection:1})};function X(o,r){if(o&1&&(Cs(0,"div",8),JC(1),hl()),o&2){let t=CC();sI(),em(t.errorMessage);}}var L=class o{router=g(G);projectStateService=g(P);projectName="";projectPath="";isCreating=false;errorMessage=null;isValid(){return this.projectName.trim()!==""&&this.projectPath.trim()!==""}onCreate(){if(!this.isValid()){this.errorMessage="Both name and path are required";return}this.isCreating=true,this.errorMessage=null,this.projectStateService.createProject(this.projectName.trim(),this.projectPath.trim()).subscribe({next:()=>{let r=this.projectName.trim();this.isCreating=false,this.projectStateService.selectProject(r),this.router.navigate(["project",r]);},error:r=>{this.errorMessage=r.error?.error??"Failed to create project",this.isCreating=false;}});}onCancel(){this.router.navigate(["/"]);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-project-new"]],decls:19,vars:9,consts:[[1,"project-new-page"],[1,"project-new-card"],["mat-button","",1,"project-new__back",3,"click"],[1,"project-new__title"],[1,"project-new__subtitle"],[1,"project-new__form"],["label","Project name","placeholder","my-project",3,"valueChange","value","isDisabled","autoFocus"],["label","Project path","placeholder","/path/to/project","hint","Absolute path to the project directory",3,"valueChange","enterPressed","value","isDisabled"],[1,"project-new__error"],[1,"project-new__actions"],["mat-button","",3,"click","disabled"],["mat-flat-button","","color","primary",3,"click","disabled"]],template:function(t,e){t&1&&(Cs(0,"div",0)(1,"div",1)(2,"button",2),Lg("click",function(){return e.onCancel()}),Cs(3,"mat-icon"),JC(4,"arrow_back"),hl(),JC(5," Back to projects "),hl(),Cs(6,"h1",3),JC(7,"New project"),hl(),Cs(8,"p",4),JC(9,"Point Coday to an existing directory on your machine."),hl(),Cs(10,"div",5)(11,"app-text-input",6),Lg("valueChange",function(d){return e.projectName=d}),hl(),Cs(12,"app-text-input",7),Lg("valueChange",function(d){return e.projectPath=d})("enterPressed",function(){return e.onCreate()}),hl(),aC(13,X,2,1,"div",8),hl(),Cs(14,"div",9)(15,"button",10),Lg("click",function(){return e.onCancel()}),JC(16,"Cancel"),hl(),Cs(17,"button",11),Lg("click",function(){return e.onCreate()}),JC(18),hl()()()()),t&2&&(sI(11),xg("value",e.projectName)("isDisabled",e.isCreating)("autoFocus",true),sI(),xg("value",e.projectPath)("isDisabled",e.isCreating),sI(),cC(e.errorMessage?13:-1),sI(2),xg("disabled",e.isCreating),sI(2),xg("disabled",!e.isValid()||e.isCreating),sI(),Dl(" ",e.isCreating?"Creating\u2026":"Create project"," "));},dependencies:[hr,pr,yt,wt,h],styles:[".project-new-page[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:center;min-height:100vh;width:100%;background:var(--color-bg);padding:2rem 1.5rem;box-sizing:border-box}.project-new-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;width:100%;max-width:560px;padding:2rem;background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:16px;box-shadow:var(--glass-shadow, 0 8px 32px rgba(31, 38, 135, .15));margin-top:2rem}.project-new__back[_ngcontent-%COMP%]{align-self:flex-start;margin-left:-.5rem;color:var(--color-text-secondary, #6e6e73)}.project-new__title[_ngcontent-%COMP%]{margin:0;font-size:1.625rem;font-weight:700;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.project-new__subtitle[_ngcontent-%COMP%]{margin:-.75rem 0 0;font-size:.9375rem;color:var(--color-text-secondary, #6e6e73)}.project-new__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.project-new__error[_ngcontent-%COMP%]{padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}.project-new__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;justify-content:flex-end;padding-top:.25rem}"],changeDetection:1})};export{L as ProjectNewComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {l}from'./chunk-BaAG5SRs.js';import {g,dg as ee,dh as T,X as br,bS as Da,r as re,a7 as va,cE as Pd,Y as x}from'./main-4LGWVPVH.js';var v=class i{userState=g(l);membership=g(ee);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return br(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(Da(a=>a?a.isAdmin?br(true):this.membership.getMembersNamespaceMembership(e).pipe(re(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),va(()=>br(false))):br(false)),Pd({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {cb as JB,cc as XB,g,G as G$1,P,T as TT,j as jw,h as hr,i as Gn,k as Cs,n as kg,o as aC,J as JC,m as hl,b$ as UC,w as zg,S as Sg,t as sI,u as cC,a8 as Kg,a5 as Dl,_ as _g,a9 as vC,aa as Cf,ac as CC,ab as Tf,M as Mg}from'./main-RXIVNUWK.js';import {v as ve,n as ne}from'./chunk-CJD8ErVH.js';import {V as Ve,n as ne$1}from'./chunk-CqZF9JZo.js';import {y as yt,w as wt}from'./chunk-B3kY-GQk.js';function L(a,e){if(a&1){let n=vC();Cs(0,"div",1)(1,"mat-checkbox",21),kg("click",function(r){return r.stopPropagation()})("change",function(r){Cf(n);let i=CC();return Tf(i.selectionChanged.emit({id:i.task().id,selected:r.checked}))}),hl()();}if(a&2){let n=CC();sI(),_g("checked",n.selected()),Sg("aria-label","Select task: "+n.task().name);}}function Y(a,e){a&1&&(Cs(0,"mat-icon",2),JC(1,"star"),hl());}function W(a,e){a&1&&Mg(0,"span",6);}function U(a,e){if(a&1&&(Cs(0,"div",7)(1,"mat-icon",22),JC(2,"folder"),hl(),Cs(3,"span"),JC(4),hl()()),a&2){let n=CC();sI(4),Kg(n.projectName());}}function B(a,e){if(a&1&&(Cs(0,"p",9),JC(1),hl()),a&2){let n=CC();sI(),Kg(n.task().summary);}}function $(a,e){a&1&&(Cs(0,"p",10),JC(1,"No summary yet"),hl());}function H(a,e){if(a&1){let n=vC();Cs(0,"button",23),kg("click",function(r){Cf(n);let i=CC();return Tf(i.onOpenDirect(r))}),Cs(1,"mat-icon"),JC(2,"open_in_new"),hl()();}}function F(a,e){if(a&1){let n=vC();Cs(0,"button",24),kg("click",function(r){Cf(n);let i=CC();return Tf(i.onStop(r))}),Cs(1,"mat-icon"),JC(2,"stop_circle"),hl()();}}function G(a,e){if(a&1){let n=vC();Cs(0,"button",25),kg("click",function(r){Cf(n);let i=CC();return Tf(i.onMarkDone(r))}),Cs(1,"mat-icon"),JC(2,"check_circle_outline"),hl()();}}function K(a,e){if(a&1){let n=vC();Cs(0,"button",26),kg("click",function(r){Cf(n);let i=CC();return Tf(i.onMarkActive(r))}),Cs(1,"mat-icon"),JC(2,"replay"),hl()();}}function J(a,e){if(a&1){let n=vC();Cs(0,"button",27),kg("click",function(r){Cf(n);let i=CC();return Tf(i.onCloseTask(r))}),Cs(1,"mat-icon"),JC(2,"close_fullscreen"),hl()();}}var A=class a{task=JB.required();projectNameOverride=JB(null);showProject=JB(false);previewMode=JB(false);selectable=JB(false);selected=JB(false);stopRequested=XB();deleteRequested=XB();starToggled=XB();closeTaskRequested=XB();markDoneRequested=XB();markActiveRequested=XB();previewRequested=XB();selectionChanged=XB();router=g(G$1);projectState=g(P);projectName=TT(()=>this.projectNameOverride()??this.projectState.getSelectedProjectId());statusLabel=TT(()=>Q[this.task().status]);statusIcon=TT(()=>X[this.task().status]);isWorktree=TT(()=>!!this.task().worktreeProject);navigate(){if(this.previewMode()){this.previewRequested.emit(this.task().id);return}let e=this.projectName();e&&(this.projectState.selectProject(e),this.router.navigate(["project",e,"thread",this.task().id]));}onStop(e){e.stopPropagation(),this.stopRequested.emit(this.task().id);}onDelete(e){e.stopPropagation(),this.deleteRequested.emit(this.task().id);}onStarToggle(e){e.stopPropagation(),this.starToggled.emit(this.task().id);}onCloseTask(e){e.stopPropagation(),this.closeTaskRequested.emit(this.task().id);}onMarkDone(e){e.stopPropagation(),this.markDoneRequested.emit(this.task().id);}onMarkActive(e){e.stopPropagation(),this.markActiveRequested.emit(this.task().id);}onOpenDirect(e){e.stopPropagation();let n=this.projectName();n&&(this.projectState.selectProject(n),this.router.navigate(["project",n,"thread",this.task().id]));}formatRelativeTime(e){let n=Date.now()-new Date(e).getTime(),t=Math.floor(n/6e4);if(t<1)return "just now";if(t<60)return `${t} min ago`;let r=Math.floor(t/60);if(r<24)return `${r}h ago`;let i=Math.floor(r/24);return i===1?"yesterday":i<7?`${i} days ago`:new Date(e).toLocaleDateString("en",{day:"numeric",month:"short"})}static \u0275fac=function(n){return new(n||a)};static \u0275cmp=jw({type:a,selectors:[["app-task-card"]],inputs:{task:[1,"task"],projectNameOverride:[1,"projectNameOverride"],showProject:[1,"showProject"],previewMode:[1,"previewMode"],selectable:[1,"selectable"],selected:[1,"selected"]},outputs:{stopRequested:"stopRequested",deleteRequested:"deleteRequested",starToggled:"starToggled",closeTaskRequested:"closeTaskRequested",markDoneRequested:"markDoneRequested",markActiveRequested:"markActiveRequested",previewRequested:"previewRequested",selectionChanged:"selectionChanged"},decls:29,vars:25,consts:[["role","button","tabindex","0",1,"task-card",3,"click","keydown.enter","keydown.space"],[1,"selection-checkbox"],["aria-label","Starred",1,"starred-indicator"],[1,"status-badge"],[1,"status-icon"],[1,"status-label"],["aria-hidden","true",1,"pulse-ring"],[1,"task-project"],[1,"task-name"],[1,"task-summary"],[1,"task-summary","empty"],[1,"task-footer"],[1,"task-time"],[1,"task-actions"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn"],["mat-icon-button","",1,"action-btn","star-btn",3,"click","matTooltip"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn"],["mat-icon-button","","matTooltip","Delete task","aria-label","Delete task",1,"action-btn","delete-btn",3,"click"],[3,"click","change","checked"],[1,"project-icon"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn",3,"click"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn",3,"click"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn",3,"click"]],template:function(n,t){n&1&&(Cs(0,"article",0),kg("click",function(){return t.navigate()})("keydown.enter",function(){return t.navigate()})("keydown.space",function(i){return t.navigate(),i.preventDefault()}),aC(1,L,2,2,"div",1),aC(2,Y,2,0,"mat-icon",2),Cs(3,"div",3)(4,"mat-icon",4),JC(5),hl(),Cs(6,"span",5),JC(7),hl(),aC(8,W,1,0,"span",6),hl(),aC(9,U,5,1,"div",7),Cs(10,"h3",8),JC(11),hl(),aC(12,B,2,1,"p",9)(13,$,2,0,"p",10),Cs(14,"footer",11)(15,"span",12),JC(16),hl(),Cs(17,"div",13),aC(18,H,3,0,"button",14),aC(19,F,3,0,"button",15),aC(20,G,3,0,"button",16)(21,K,3,0,"button",17),Cs(22,"button",18),kg("click",function(i){return t.onStarToggle(i)}),Cs(23,"mat-icon"),JC(24),hl()(),aC(25,J,3,0,"button",19),Cs(26,"button",20),kg("click",function(i){return t.onDelete(i)}),Cs(27,"mat-icon"),JC(28,"delete_outline"),hl()()()()()),n&2&&(UC("status-"+t.task().status),zg("is-active",t.task().isActive)("is-selected",t.selected()),Sg("aria-label","Open task: "+t.task().name),sI(),cC(t.selectable()?1:-1),sI(),cC(t.task().starring.length>0?2:-1),sI(3),Kg(t.statusIcon()),sI(2),Kg(t.statusLabel()),sI(),cC(t.task().status==="waiting-you"?8:-1),sI(),cC(t.showProject()&&t.projectName()?9:-1),sI(2),Dl(" ",t.task().name||"Unnamed task"," "),sI(),cC(t.task().summary?12:13),sI(4),Kg(t.formatRelativeTime(t.task().modifiedDate)),sI(2),cC(t.previewMode()?18:-1),sI(),cC(t.task().status==="in-progress"?19:-1),sI(),cC(t.task().status!=="done"?20:21),sI(2),zg("starred",t.task().starring.length>0),_g("matTooltip",t.task().starring.length>0?"Unstar":"Star"),Sg("aria-label",t.task().starring.length>0?"Unstar task":"Star task"),sI(2),Kg(t.task().starring.length>0?"star":"star_border"),sI(),cC(t.isWorktree()?25:-1));},dependencies:[ve,ne,yt,wt,hr,Gn,Ve,ne$1],styles:['.glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:block}.task-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:16px;padding:1.25rem;cursor:pointer;position:relative;overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;outline:none;display:flex;flex-direction:column;gap:.5rem;min-height:160px}.task-card[_ngcontent-%COMP%]:hover, .task-card[_ngcontent-%COMP%]:focus-visible{transform:translateY(-3px);box-shadow:0 16px 48px #00000026}.task-card[_ngcontent-%COMP%]:active{transform:translateY(-1px)}.task-card[_ngcontent-%COMP%]:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;border-radius:16px 0 0 16px;background:var(--status-color, var(--color-text-secondary))}.task-card.status-waiting-you[_ngcontent-%COMP%]{--status-color: var(--color-error);border-color:#ff3b3040}.task-card.status-in-progress[_ngcontent-%COMP%]{--status-color: var(--color-warning);border-color:#ff950033}.task-card.status-done[_ngcontent-%COMP%]{--status-color: var(--color-success)}.task-card.status-paused[_ngcontent-%COMP%]{--status-color: var(--color-text-secondary)}.task-card.status-error[_ngcontent-%COMP%]{--status-color: var(--color-error)}.task-card.is-active[_ngcontent-%COMP%]{box-shadow:var(--glass-shadow),0 0 0 2px rgba(var(--color-primary),.3)}.selection-checkbox[_ngcontent-%COMP%]{position:absolute;right:.875rem;top:1.125rem;z-index:2}.task-card.is-selected[_ngcontent-%COMP%]{border-color:var(--color-primary);box-shadow:var(--glass-shadow),0 0 0 2px var(--color-primary)}.task-card.is-selected[_ngcontent-%COMP%]:before{background:var(--color-primary)}.starred-indicator[_ngcontent-%COMP%]{position:absolute;top:.75rem;right:.75rem;font-size:1rem;width:1rem;height:1rem;color:#f5a623;pointer-events:none}.status-badge[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;position:relative}.status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;color:var(--status-color, var(--color-text-secondary))}.status-in-progress[_ngcontent-%COMP%] .status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_spin 2s linear infinite}.status-badge[_ngcontent-%COMP%] .status-label[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--status-color, var(--color-text-secondary))}.status-badge[_ngcontent-%COMP%] .pulse-ring[_ngcontent-%COMP%]{position:absolute;left:-2px;top:-2px;width:20px;height:20px;border-radius:50%;border:2px solid var(--color-error);animation:_ngcontent-%COMP%_pulse 1.5s ease-out infinite;pointer-events:none}.task-project[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;font-size:.72rem;font-weight:600;color:var(--color-primary);opacity:.8;text-transform:uppercase;letter-spacing:.04em}.task-project[_ngcontent-%COMP%] .project-icon[_ngcontent-%COMP%]{font-size:.75rem;width:.75rem;height:.75rem}.task-name[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600;color:var(--color-text);line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.task-summary[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4;flex:1;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.task-summary.empty[_ngcontent-%COMP%]{font-style:italic;opacity:.6}.task-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-top:auto;padding-top:.25rem}.task-time[_ngcontent-%COMP%]{font-size:.72rem;color:var(--color-text-secondary);opacity:.8}.task-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.task-card[_ngcontent-%COMP%]:hover .task-actions[_ngcontent-%COMP%], .task-card[_ngcontent-%COMP%]:focus-within .task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:28px;height:28px;display:flex!important;align-items:center!important;justify-content:center!important;padding:0!important}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;display:flex;align-items:center;justify-content:center}.task-actions[_ngcontent-%COMP%] .stop-btn[_ngcontent-%COMP%]{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .mark-done-btn[_ngcontent-%COMP%]{color:var(--color-success)}.task-actions[_ngcontent-%COMP%] .star-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .star-btn.starred[_ngcontent-%COMP%]{color:#f5a623}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]{color:var(--color-primary)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover)}@media(max-width:600px){.task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:36px;height:36px}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_pulse{0%{transform:scale(.8);opacity:1}to{transform:scale(2.2);opacity:0}}']})},Q={"waiting-you":"Waiting for you","in-progress":"In progress\u2026",done:"Done",paused:"Paused",error:"Error"},X={"waiting-you":"mark_unread_chat_alt","in-progress":"pending",done:"check_circle",paused:"pause_circle",error:"error"};var bt=300*1e3,kt={"waiting-you":0,"in-progress":1,done:2,paused:3,error:4};export{A,bt as b,kt as k};
|
|
1
|
+
import {cb as nV,cc as tV,g,G as G$1,P,T as TT,j as jw,h as hr,i as Gn,k as Cs,n as Lg,o as aC,J as JC,m as hl,b$ as UC,y as qg,N as Ng,u as sI,v as cC,a8 as em,a5 as Dl,x as xg,a9 as vC,aa as Sf,ac as CC,ab as _f,A as Ag}from'./main-4LGWVPVH.js';import {v as ve,n as ne}from'./chunk-CWfLK-02.js';import {V as Ve,n as ne$1}from'./chunk-B2UoGfZ3.js';import {y as yt,w as wt}from'./chunk-CPuMGlfm.js';function L(a,e){if(a&1){let n=vC();Cs(0,"div",1)(1,"mat-checkbox",21),Lg("click",function(r){return r.stopPropagation()})("change",function(r){Sf(n);let i=CC();return _f(i.selectionChanged.emit({id:i.task().id,selected:r.checked}))}),hl()();}if(a&2){let n=CC();sI(),xg("checked",n.selected()),Ng("aria-label","Select task: "+n.task().name);}}function Y(a,e){a&1&&(Cs(0,"mat-icon",2),JC(1,"star"),hl());}function W(a,e){a&1&&Ag(0,"span",6);}function U(a,e){if(a&1&&(Cs(0,"div",7)(1,"mat-icon",22),JC(2,"folder"),hl(),Cs(3,"span"),JC(4),hl()()),a&2){let n=CC();sI(4),em(n.projectName());}}function B(a,e){if(a&1&&(Cs(0,"p",9),JC(1),hl()),a&2){let n=CC();sI(),em(n.task().summary);}}function $(a,e){a&1&&(Cs(0,"p",10),JC(1,"No summary yet"),hl());}function H(a,e){if(a&1){let n=vC();Cs(0,"button",23),Lg("click",function(r){Sf(n);let i=CC();return _f(i.onOpenDirect(r))}),Cs(1,"mat-icon"),JC(2,"open_in_new"),hl()();}}function F(a,e){if(a&1){let n=vC();Cs(0,"button",24),Lg("click",function(r){Sf(n);let i=CC();return _f(i.onStop(r))}),Cs(1,"mat-icon"),JC(2,"stop_circle"),hl()();}}function G(a,e){if(a&1){let n=vC();Cs(0,"button",25),Lg("click",function(r){Sf(n);let i=CC();return _f(i.onMarkDone(r))}),Cs(1,"mat-icon"),JC(2,"check_circle_outline"),hl()();}}function K(a,e){if(a&1){let n=vC();Cs(0,"button",26),Lg("click",function(r){Sf(n);let i=CC();return _f(i.onMarkActive(r))}),Cs(1,"mat-icon"),JC(2,"replay"),hl()();}}function J(a,e){if(a&1){let n=vC();Cs(0,"button",27),Lg("click",function(r){Sf(n);let i=CC();return _f(i.onCloseTask(r))}),Cs(1,"mat-icon"),JC(2,"close_fullscreen"),hl()();}}var A=class a{task=nV.required();projectNameOverride=nV(null);showProject=nV(false);previewMode=nV(false);selectable=nV(false);selected=nV(false);stopRequested=tV();deleteRequested=tV();starToggled=tV();closeTaskRequested=tV();markDoneRequested=tV();markActiveRequested=tV();previewRequested=tV();selectionChanged=tV();router=g(G$1);projectState=g(P);projectName=TT(()=>this.projectNameOverride()??this.projectState.getSelectedProjectId());statusLabel=TT(()=>Q[this.task().status]);statusIcon=TT(()=>X[this.task().status]);isWorktree=TT(()=>!!this.task().worktreeProject);navigate(){if(this.previewMode()){this.previewRequested.emit(this.task().id);return}let e=this.projectName();e&&(this.projectState.selectProject(e),this.router.navigate(["project",e,"thread",this.task().id]));}onStop(e){e.stopPropagation(),this.stopRequested.emit(this.task().id);}onDelete(e){e.stopPropagation(),this.deleteRequested.emit(this.task().id);}onStarToggle(e){e.stopPropagation(),this.starToggled.emit(this.task().id);}onCloseTask(e){e.stopPropagation(),this.closeTaskRequested.emit(this.task().id);}onMarkDone(e){e.stopPropagation(),this.markDoneRequested.emit(this.task().id);}onMarkActive(e){e.stopPropagation(),this.markActiveRequested.emit(this.task().id);}onOpenDirect(e){e.stopPropagation();let n=this.projectName();n&&(this.projectState.selectProject(n),this.router.navigate(["project",n,"thread",this.task().id]));}formatRelativeTime(e){let n=Date.now()-new Date(e).getTime(),t=Math.floor(n/6e4);if(t<1)return "just now";if(t<60)return `${t} min ago`;let r=Math.floor(t/60);if(r<24)return `${r}h ago`;let i=Math.floor(r/24);return i===1?"yesterday":i<7?`${i} days ago`:new Date(e).toLocaleDateString("en",{day:"numeric",month:"short"})}static \u0275fac=function(n){return new(n||a)};static \u0275cmp=jw({type:a,selectors:[["app-task-card"]],inputs:{task:[1,"task"],projectNameOverride:[1,"projectNameOverride"],showProject:[1,"showProject"],previewMode:[1,"previewMode"],selectable:[1,"selectable"],selected:[1,"selected"]},outputs:{stopRequested:"stopRequested",deleteRequested:"deleteRequested",starToggled:"starToggled",closeTaskRequested:"closeTaskRequested",markDoneRequested:"markDoneRequested",markActiveRequested:"markActiveRequested",previewRequested:"previewRequested",selectionChanged:"selectionChanged"},decls:29,vars:25,consts:[["role","button","tabindex","0",1,"task-card",3,"click","keydown.enter","keydown.space"],[1,"selection-checkbox"],["aria-label","Starred",1,"starred-indicator"],[1,"status-badge"],[1,"status-icon"],[1,"status-label"],["aria-hidden","true",1,"pulse-ring"],[1,"task-project"],[1,"task-name"],[1,"task-summary"],[1,"task-summary","empty"],[1,"task-footer"],[1,"task-time"],[1,"task-actions"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn"],["mat-icon-button","",1,"action-btn","star-btn",3,"click","matTooltip"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn"],["mat-icon-button","","matTooltip","Delete task","aria-label","Delete task",1,"action-btn","delete-btn",3,"click"],[3,"click","change","checked"],[1,"project-icon"],["mat-icon-button","","matTooltip","Open full view","aria-label","Open task in full view",1,"action-btn","open-btn",3,"click"],["mat-icon-button","","matTooltip","Stop agent","aria-label","Stop agent",1,"action-btn","stop-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as done","aria-label","Mark as done",1,"action-btn","mark-done-btn",3,"click"],["mat-icon-button","","matTooltip","Mark as active","aria-label","Mark as active",1,"action-btn","mark-active-btn",3,"click"],["mat-icon-button","","matTooltip","Close task (removes worktree)","aria-label","Close task",1,"action-btn","close-task-btn",3,"click"]],template:function(n,t){n&1&&(Cs(0,"article",0),Lg("click",function(){return t.navigate()})("keydown.enter",function(){return t.navigate()})("keydown.space",function(i){return t.navigate(),i.preventDefault()}),aC(1,L,2,2,"div",1),aC(2,Y,2,0,"mat-icon",2),Cs(3,"div",3)(4,"mat-icon",4),JC(5),hl(),Cs(6,"span",5),JC(7),hl(),aC(8,W,1,0,"span",6),hl(),aC(9,U,5,1,"div",7),Cs(10,"h3",8),JC(11),hl(),aC(12,B,2,1,"p",9)(13,$,2,0,"p",10),Cs(14,"footer",11)(15,"span",12),JC(16),hl(),Cs(17,"div",13),aC(18,H,3,0,"button",14),aC(19,F,3,0,"button",15),aC(20,G,3,0,"button",16)(21,K,3,0,"button",17),Cs(22,"button",18),Lg("click",function(i){return t.onStarToggle(i)}),Cs(23,"mat-icon"),JC(24),hl()(),aC(25,J,3,0,"button",19),Cs(26,"button",20),Lg("click",function(i){return t.onDelete(i)}),Cs(27,"mat-icon"),JC(28,"delete_outline"),hl()()()()()),n&2&&(UC("status-"+t.task().status),qg("is-active",t.task().isActive)("is-selected",t.selected()),Ng("aria-label","Open task: "+t.task().name),sI(),cC(t.selectable()?1:-1),sI(),cC(t.task().starring.length>0?2:-1),sI(3),em(t.statusIcon()),sI(2),em(t.statusLabel()),sI(),cC(t.task().status==="waiting-you"?8:-1),sI(),cC(t.showProject()&&t.projectName()?9:-1),sI(2),Dl(" ",t.task().name||"Unnamed task"," "),sI(),cC(t.task().summary?12:13),sI(4),em(t.formatRelativeTime(t.task().modifiedDate)),sI(2),cC(t.previewMode()?18:-1),sI(),cC(t.task().status==="in-progress"?19:-1),sI(),cC(t.task().status!=="done"?20:21),sI(2),qg("starred",t.task().starring.length>0),xg("matTooltip",t.task().starring.length>0?"Unstar":"Star"),Ng("aria-label",t.task().starring.length>0?"Unstar task":"Star task"),sI(2),em(t.task().starring.length>0?"star":"star_border"),sI(),cC(t.isWorktree()?25:-1));},dependencies:[ve,ne,yt,wt,hr,Gn,Ve,ne$1],styles:['.glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:block}.task-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:16px;padding:1.25rem;cursor:pointer;position:relative;overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;outline:none;display:flex;flex-direction:column;gap:.5rem;min-height:160px}.task-card[_ngcontent-%COMP%]:hover, .task-card[_ngcontent-%COMP%]:focus-visible{transform:translateY(-3px);box-shadow:0 16px 48px #00000026}.task-card[_ngcontent-%COMP%]:active{transform:translateY(-1px)}.task-card[_ngcontent-%COMP%]:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;border-radius:16px 0 0 16px;background:var(--status-color, var(--color-text-secondary))}.task-card.status-waiting-you[_ngcontent-%COMP%]{--status-color: var(--color-error);border-color:#ff3b3040}.task-card.status-in-progress[_ngcontent-%COMP%]{--status-color: var(--color-warning);border-color:#ff950033}.task-card.status-done[_ngcontent-%COMP%]{--status-color: var(--color-success)}.task-card.status-paused[_ngcontent-%COMP%]{--status-color: var(--color-text-secondary)}.task-card.status-error[_ngcontent-%COMP%]{--status-color: var(--color-error)}.task-card.is-active[_ngcontent-%COMP%]{box-shadow:var(--glass-shadow),0 0 0 2px rgba(var(--color-primary),.3)}.selection-checkbox[_ngcontent-%COMP%]{position:absolute;right:.875rem;top:1.125rem;z-index:2}.task-card.is-selected[_ngcontent-%COMP%]{border-color:var(--color-primary);box-shadow:var(--glass-shadow),0 0 0 2px var(--color-primary)}.task-card.is-selected[_ngcontent-%COMP%]:before{background:var(--color-primary)}.starred-indicator[_ngcontent-%COMP%]{position:absolute;top:.75rem;right:.75rem;font-size:1rem;width:1rem;height:1rem;color:#f5a623;pointer-events:none}.status-badge[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;position:relative}.status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;color:var(--status-color, var(--color-text-secondary))}.status-in-progress[_ngcontent-%COMP%] .status-badge[_ngcontent-%COMP%] .status-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_spin 2s linear infinite}.status-badge[_ngcontent-%COMP%] .status-label[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--status-color, var(--color-text-secondary))}.status-badge[_ngcontent-%COMP%] .pulse-ring[_ngcontent-%COMP%]{position:absolute;left:-2px;top:-2px;width:20px;height:20px;border-radius:50%;border:2px solid var(--color-error);animation:_ngcontent-%COMP%_pulse 1.5s ease-out infinite;pointer-events:none}.task-project[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;font-size:.72rem;font-weight:600;color:var(--color-primary);opacity:.8;text-transform:uppercase;letter-spacing:.04em}.task-project[_ngcontent-%COMP%] .project-icon[_ngcontent-%COMP%]{font-size:.75rem;width:.75rem;height:.75rem}.task-name[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600;color:var(--color-text);line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.task-summary[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4;flex:1;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.task-summary.empty[_ngcontent-%COMP%]{font-style:italic;opacity:.6}.task-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-top:auto;padding-top:.25rem}.task-time[_ngcontent-%COMP%]{font-size:.72rem;color:var(--color-text-secondary);opacity:.8}.task-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.task-card[_ngcontent-%COMP%]:hover .task-actions[_ngcontent-%COMP%], .task-card[_ngcontent-%COMP%]:focus-within .task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:28px;height:28px;display:flex!important;align-items:center!important;justify-content:center!important;padding:0!important}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;display:flex;align-items:center;justify-content:center}.task-actions[_ngcontent-%COMP%] .stop-btn[_ngcontent-%COMP%]{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .mark-done-btn[_ngcontent-%COMP%]{color:var(--color-success)}.task-actions[_ngcontent-%COMP%] .star-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .star-btn.starred[_ngcontent-%COMP%]{color:#f5a623}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.task-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{color:var(--color-error)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]{color:var(--color-primary)}.task-actions[_ngcontent-%COMP%] .open-btn[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover)}@media(max-width:600px){.task-actions[_ngcontent-%COMP%]{opacity:1}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:36px;height:36px}.task-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_pulse{0%{transform:scale(.8);opacity:1}to{transform:scale(2.2);opacity:0}}']})},Q={"waiting-you":"Waiting for you","in-progress":"In progress\u2026",done:"Done",paused:"Paused",error:"Error"},X={"waiting-you":"mark_unread_chat_alt","in-progress":"pending",done:"check_circle",paused:"pause_circle",error:"error"};var bt=300*1e3,kt={"waiting-you":0,"in-progress":1,done:2,paused:3,error:4};export{A,bt as b,kt as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bm as xm,R as Re,W as Wi,T as TT,j as jw,h as hr,i as Gn,k as Cs,n as kg,J as JC,m as hl,a3 as ZI,o as aC,af as wg,ag as ET,A as AC,t as sI,_ as _g,a6 as QI,u as cC,X as z,bl as Mt,Y as Ue$1,am as Ym,Z as zt,a0 as jt,a1 as Vt,a2 as Nt,e as pr,bn as Xt,ai as rm,aj as iT,q as dC,bo as uC,a8 as Kg,ak as nm,v as fC,a5 as Dl,ac as CC,a9 as vC,aa as Cf,ab as Tf,bp as yl,bq as vl,ah as dT,b4 as fT,w as zg}from'./main-RXIVNUWK.js';import {d}from'./chunk-oIPYJtHA.js';import {W,k as ke,s as se}from'./chunk-DrKKLE1-.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-BIOQZPFJ.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-CaL6ZXsO.js';import'./chunk-CqZF9JZo.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn,Y as Ye$1,a as wt$1,m as mn,g as gt}from'./chunk-B3kY-GQk.js';function Ue(s,i){if(s&1){let e=vC();Cs(0,"div",9)(1,"mat-form-field",18)(2,"mat-label"),JC(3),hl(),Cs(4,"textarea",19),rm("ngModelChange",function(r){let m=Cf(e).$index,D=CC();return iT(D.commands[m],r)||(D.commands[m]=r),Tf(r)}),hl(),ZI(),Cs(5,"mat-hint"),JC(6,"Use placeholder for dynamic values"),hl()(),Cs(7,"button",20),kg("click",function(){let r=Cf(e).$index,m=CC();return Tf(m.removeCommand(r))}),Cs(8,"mat-icon"),JC(9,"delete"),hl()()();}if(s&2){let e=i.$index,t=CC();sI(3),Dl("Prompt ",e+1),sI(),nm("ngModel",t.commands[e]),QI(),sI(3),_g("disabled",t.commands.length===1);}}function Ne(s,i){if(s&1){let e=vC();Cs(0,"div",10)(1,"h3"),JC(2,"Save to"),hl(),Cs(3,"div",21)(4,"label",22)(5,"input",23),rm("ngModelChange",function(r){Cf(e);let m=CC();return iT(m.source,r)||(m.source=r),Tf(r)}),hl(),ZI(),Cs(6,"div",24)(7,"div",25)(8,"span",26),JC(9,"\u{1F464}"),hl(),Cs(10,"span",27),JC(11,"Local"),hl()(),Cs(12,"p",28),JC(13,"Personal prompt in ~/.coday/... (not committed)"),hl()()(),Cs(14,"label",22)(15,"input",29),rm("ngModelChange",function(r){Cf(e);let m=CC();return iT(m.source,r)||(m.source=r),Tf(r)}),hl(),ZI(),Cs(16,"div",24)(17,"div",25)(18,"span",26),JC(19,"\u{1F4E6}"),hl(),Cs(20,"span",27),JC(21,"Project"),hl()(),Cs(22,"p",28),JC(23,"Shared prompt in ./prompts/ (committable)"),hl()()()(),Cs(24,"p",30),JC(25,"Storage location is permanent and cannot be changed after creation"),hl()();}if(s&2){let e=CC();sI(4),zg("selected",e.source==="local"),sI(),nm("ngModel",e.source),QI(),sI(9),zg("selected",e.source==="project"),sI(),nm("ngModel",e.source),QI();}}function je(s,i){if(s&1&&(Cs(0,"div",11)(1,"h3"),JC(2,"Storage Location"),hl(),Cs(3,"div",31)(4,"span",26),JC(5),hl(),Cs(6,"span",27),JC(7),hl()(),Cs(8,"p",30),JC(9,"Cannot be changed after creation"),hl()()),s&2){let e=CC();sI(3),zg("badge-local",e.source==="local")("badge-project",e.source==="project"),sI(2),Kg(e.source==="local"?"\u{1F464}":"\u{1F4E6}"),sI(2),Kg(e.source==="local"?"Local":"Project");}}function qe(s,i){if(s&1){let e=vC();Cs(0,"div",12)(1,"label",32)(2,"input",33),rm("ngModelChange",function(r){Cf(e);let m=CC();return iT(m.webhookEnabled,r)||(m.webhookEnabled=r),Tf(r)}),hl(),ZI(),Cs(3,"span"),JC(4,"Enable webhook"),hl()(),Cs(5,"p",30),JC(6,"Enable webhook to trigger this prompt via HTTP POST"),hl()();}if(s&2){let e=CC();sI(2),nm("ngModel",e.webhookEnabled),QI();}}function He(s,i){if(s&1){let e=vC();Cs(0,"div",13)(1,"div",34)(2,"mat-icon",35),JC(3,"link"),hl(),Cs(4,"h4"),JC(5,"Webhook URL"),hl()(),Cs(6,"div",36)(7,"p",37),JC(8),hl(),Cs(9,"button",38),kg("click",function(){Cf(e);let r=CC();return Tf(r.copyWebhookUrl())}),Cs(10,"mat-icon"),JC(11,"content_copy"),hl(),Cs(12,"span"),JC(13,"Copy URL"),hl()()(),Cs(14,"p",30),JC(15,"Use this URL to trigger the prompt via HTTP POST"),hl()();}if(s&2){let e=CC();sI(8),Kg(e.getWebhookUrl());}}function Ye(s,i){if(s&1&&(Cs(0,"div",14)(1,"mat-icon"),JC(2,"error"),hl(),Cs(3,"span"),JC(4),hl()()),s&2){let e=CC();sI(4),Kg(e.errorMessage);}}var S=class s{promptApi=g(d);dialogRef=g(z);configApi=g(W);snackBar=g(Mt);name="";description="";commands=[""];webhookEnabled=false;threadLifetime="";source="local";isSaving=false;errorMessage="";isAdmin=false;isEditMode=false;promptId="";data=g(Ue$1);constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false;},error:i=>{console.error("[PROMPT_FORM] Error loading user config:",i),this.isAdmin=false;}}),this.isEditMode&&this.data.prompt&&(this.promptId=this.data.prompt.id,this.name=this.data.prompt.name,this.description=this.data.prompt.description,this.commands=[...this.data.prompt.commands],this.webhookEnabled=this.data.prompt.webhookEnabled,this.source=this.data.prompt.source);}addCommand(){this.commands.push("");}removeCommand(i){this.commands.length>1&&this.commands.splice(i,1);}trackByIndex(i){return i}normalizeName(){this.name=this.name.replace(/[\s_.,;:!?()[\]{}]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase();}validateForm(){return this.name.trim()?this.description.trim()?this.commands.filter(e=>e.trim()).length===0?(this.errorMessage="At least one command is required",false):true:(this.errorMessage="Description is required",false):(this.errorMessage="Name is required",false)}save(){if(this.errorMessage="",!this.validateForm())return;let i=this.commands.filter(e=>e.trim());if(this.isSaving=true,this.isEditMode&&this.data.prompt){let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled};this.promptApi.updatePrompt(this.data.prompt.id,e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update prompt",this.isSaving=false;}});}else {let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled,source:this.source};this.promptApi.createPrompt(e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create prompt",this.isSaving=false;}});}}cancel(){this.dialogRef.close(false);}getWebhookUrl(){return `${window.location.origin}/api/webhooks/${this.promptId}/execute`}copyWebhookUrl(){if(!this.webhookEnabled){this.snackBar.open("Webhook is not enabled","Close",{duration:3e3});return}if(!this.promptId){this.snackBar.open("Prompt must be saved before getting webhook URL","Close",{duration:3e3});return}let i=this.getWebhookUrl();navigator.clipboard.writeText(i).then(()=>{this.snackBar.open("Webhook URL copied to clipboard!","Close",{duration:3e3});}).catch(e=>{console.error("Failed to copy webhook URL:",e),this.snackBar.open("Failed to copy URL","Close",{duration:3e3});});}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=jw({type:s,selectors:[["app-prompt-form"]],decls:36,vars:11,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-prompt","required","",3,"ngModelChange","blur","ngModel"],["matInput","","placeholder","What does this prompt do?","rows","3","required","",3,"ngModelChange","ngModel"],[1,"commands-section"],[1,"section-header"],["mat-icon-button","","type","button","title","Add command",3,"click"],[1,"commands-list"],[1,"command-item"],[1,"source-section"],[1,"source-display"],[1,"webhook-section"],[1,"webhook-url-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"command-field"],["matInput","","placeholder","Enter command with placeholders like \\{\\{key\\}\\}","rows","2",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove command",1,"remove-btn",3,"click","disabled"],[1,"source-options"],[1,"source-option"],["type","radio","name","source","value","local",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","source","value","project",3,"ngModelChange","ngModel"],[1,"hint"],[1,"source-badge"],[1,"checkbox-label"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"webhook-url-header"],[1,"webhook-icon"],[1,"webhook-url-content"],[1,"url-text"],["mat-raised-button","","color","accent","type","button",3,"click"]],template:function(e,t){e&1&&(Cs(0,"h2",0),JC(1),hl(),Cs(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),JC(6,"Name"),hl(),Cs(7,"input",3),rm("ngModelChange",function(m){return iT(t.name,m)||(t.name=m),m}),kg("blur",function(){return t.normalizeName()}),hl(),ZI(),Cs(8,"mat-hint"),JC(9,"A descriptive name (spaces and punctuation will be replaced with hyphens), will be used as command name"),hl()(),Cs(10,"mat-form-field",2)(11,"mat-label"),JC(12,"Description"),hl(),Cs(13,"textarea",4),rm("ngModelChange",function(m){return iT(t.description,m)||(t.description=m),m}),hl(),ZI(),Cs(14,"mat-hint"),JC(15,"Explain the purpose of this prompt, helps for searchability"),hl()(),Cs(16,"div",5)(17,"div",6)(18,"h3"),JC(19,"Prompts"),hl(),Cs(20,"button",7),kg("click",function(){return t.addCommand()}),Cs(21,"mat-icon"),JC(22,"add"),hl()()(),Cs(23,"div",8),dC(24,Ue,10,3,"div",9,uC),hl()(),aC(26,Ne,26,6,"div",10),aC(27,je,10,6,"div",11),aC(28,qe,7,1,"div",12),aC(29,He,16,1,"div",13),aC(30,Ye,5,1,"div",14),hl()(),Cs(31,"mat-dialog-actions",15)(32,"button",16),kg("click",function(){return t.cancel()}),JC(33,"Cancel"),hl(),Cs(34,"button",17),kg("click",function(){return t.save()}),JC(35),hl()()),e&2&&(sI(),Kg(t.isEditMode?"Edit Prompt":"Create Prompt"),sI(6),nm("ngModel",t.name),QI(),sI(6),nm("ngModel",t.description),QI(),sI(11),fC(t.commands),sI(2),cC(t.isEditMode?-1:26),sI(),cC(t.isEditMode?27:-1),sI(),cC(t.isAdmin?28:-1),sI(),cC(t.isEditMode&&t.webhookEnabled&&t.isAdmin?29:-1),sI(),cC(t.errorMessage?30:-1),sI(2),_g("disabled",t.isSaving),sI(2),_g("disabled",t.isSaving),sI(),Dl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Ym,ti,Ye$1,wt$1,mn,Zn,gt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt,ae,le,ce,yt,wt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:500px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.commands-section[_ngcontent-%COMP%] .commands-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .command-field[_ngcontent-%COMP%]{flex:1}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.webhook-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.95rem}.webhook-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.webhook-url-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.75rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] .webhook-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:.5rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{flex:1;margin:0;padding:.75rem;background:var(--color-bg);border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:.85rem;word-break:break-all;color:var(--color-text)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap;display:flex;align-items:center;gap:.5rem}.webhook-url-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:1rem;font-weight:600}.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.75rem}@media(max-width:768px){.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-section[_ngcontent-%COMP%] .source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.thread-lifetime-disabled[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:#2196f30d;border:1px solid rgba(33,150,243,.2);border-radius:8px;margin-bottom:1rem}.thread-lifetime-disabled[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#2196f3cc;font-size:1.25rem;width:1.25rem;height:1.25rem;margin-top:2px}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;flex:1}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:.95rem;color:var(--color-text)}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{display:block;margin-top:.25rem;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-display[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-display[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem;font-weight:600}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500;margin-bottom:.5rem}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.1rem}.source-display[_ngcontent-%COMP%] .source-badge.badge-local[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-display[_ngcontent-%COMP%] .source-badge.badge-project[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.source-display[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}"],changeDetection:1})};var Ge=()=>[],Ke=s=>({id:s});function Je(s,i){if(s&1&&(Cs(0,"div",6),JC(1),hl()),s&2){let e=CC();sI(),Kg(e.errorMessage());}}function Qe(s,i){if(s&1){let e=vC();Cs(0,"ds-entity-card",8),kg("selected",function(r){Cf(e);let m=CC();return Tf(m.onEdit(r))}),yl(1,9),Cs(2,"button",10),kg("click",function(r){return r.stopPropagation()}),Cs(3,"mat-icon"),JC(4,"more_vert"),hl()(),vl(),hl();}if(s&2){let e=i.$implicit;CC();let t=AC(11);_g("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??dT(6,Ge)),sI(2),_g("matMenuTriggerFor",t)("matMenuTriggerData",fT(7,Ke,e.id));}}function Xe(s,i){if(s&1){let e=vC();Cs(0,"button",11),kg("click",function(){Cf(e);let r=CC().id,m=CC();return Tf(m.onToggleWebhook(r))}),Cs(1,"mat-icon"),JC(2),hl(),JC(3),hl();}if(s&2){let e=CC().id,t=CC();sI(2),Kg(t.isWebhookEnabled(e)?"link_off":"link"),sI(),Dl(" ",t.isWebhookEnabled(e)?"Disable webhook":"Enable webhook"," ");}}function Ze(s,i){if(s&1){let e=vC();Cs(0,"button",11),kg("click",function(){let r=Cf(e).id,m=CC();return Tf(m.onEdit(r))}),Cs(1,"mat-icon"),JC(2,"edit"),hl(),JC(3," Edit "),hl(),aC(4,Xe,4,2,"button",12),Cs(5,"button",13),kg("click",function(){let r=Cf(e).id,m=CC();return Tf(m.onDelete(r))}),Cs(6,"mat-icon"),JC(7,"delete"),hl(),JC(8," Delete "),hl();}if(s&2){let e=CC();sI(4),cC(e.isAdmin()?4:-1);}}var Le="system",Ie=class s{promptApi=g(d);configApi=g(W);location=g(xm);dialog=g(Re);prompts=Wi([]);isLoading=Wi(false);errorMessage=Wi(null);showOnlyMine=Wi(true);isAdmin=Wi(false);currentUsername=Wi("");promptItems=TT(()=>{let i=this.prompts(),e=this.currentUsername(),r=this.showOnlyMine()&&e?i.filter(p=>this.isMyPrompt(p)):i,D=[...new Set(r.map(p=>p.createdBy))].sort((p,k)=>p===e&&k!==e?-1:k===e&&p!==e||p===Le?1:k===Le?-1:p.localeCompare(k)),H=[];for(let p of D){let k=p===e?`${p} (you)`:p;for(let F of r.filter(Ae=>Ae.createdBy===p))H.push({id:F.id,name:F.name,description:F.description,badges:this.buildBadges(F),groupKey:p,groupLabel:k});}return H});ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin.set(i.groups?.includes("CODAY_ADMIN")??false),this.currentUsername.set(i.username??"");},error:()=>this.isAdmin.set(false)}),this.loadPrompts();}loadPrompts(){this.isLoading.set(true),this.promptApi.listPrompts().subscribe({next:i=>{this.prompts.set(i.filter(e=>!e.id.startsWith("builtin"))),this.isLoading.set(false);},error:i=>{this.errorMessage.set(i?.error?.error??"Failed to load prompts"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadPrompts();});}onEdit(i){this.promptApi.getPrompt(i).subscribe({next:e=>{this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"edit",prompt:e}}).afterClosed().subscribe(r=>{r&&this.loadPrompts();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load prompt")});}onDelete(i){confirm("Are you sure you want to delete this prompt?")&&this.promptApi.deletePrompt(i).subscribe({next:()=>this.loadPrompts(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete prompt")});}onToggleWebhook(i){let e=this.prompts().find(r=>r.id===i);if(!e)return;(e.webhookEnabled?this.promptApi.disableWebhook(i):this.promptApi.enableWebhook(i)).subscribe({next:()=>this.loadPrompts(),error:r=>this.errorMessage.set(r?.error?.error??"Failed to toggle webhook")});}isWebhookEnabled(i){return this.prompts().find(e=>e.id===i)?.webhookEnabled??false}isMyPrompt(i){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(i.createdBy)===e(this.currentUsername())}buildBadges(i){let e=[];return i.source==="local"?e.push({label:"local",variant:"info"}):e.push({label:"project",variant:"success"}),i.webhookEnabled&&e.push({label:"webhook",variant:"warning"}),e}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=jw({type:s,selectors:[["app-prompt-list"]],decls:13,vars:6,consts:[["promptCard",""],["cardMenu","matMenu"],[1,"prompt-list-page"],["title","Prompts","cardMinWidth","320px","contentMaxWidth","1400px","searchPlaceholder","Filter prompts\u2026","emptyMessage","No prompts found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"prompt-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"prompt-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item",""],["mat-menu-item","",1,"prompt-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(Cs(0,"div",2)(1,"ds-entity-list",3),kg("createRequested",function(){return t.onCreate()}),Cs(2,"button",4),kg("click",function(){return t.onBack()}),Cs(3,"mat-icon"),JC(4,"chevron_left"),hl()(),Cs(5,"mat-slide-toggle",5),kg("ngModelChange",function(m){return t.showOnlyMine.set(m)}),JC(6," Mine "),hl(),ZI(),hl(),aC(7,Je,2,1,"div",6),hl(),wg(8,Qe,5,9,"ng-template",null,0,ET),Cs(10,"mat-menu",null,1),wg(12,Ze,9,1,"ng-template",7),hl()),e&2){let r=AC(9);sI(),_g("items",t.promptItems())("loading",t.isLoading())("showCreate",true)("itemTemplate",r),sI(4),_g("ngModel",t.showOnlyMine()),QI(),sI(2),cC(t.errorMessage()?7:-1);}},dependencies:[Wn,ot,it,hr,Gn,yt,wt,ke,se,In,De,Be,ya,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.prompt-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.prompt-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.prompt-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.prompt-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ie as PromptListComponent};
|
|
1
|
+
import {g,bm as Om,R as Re,W as Wi,T as TT,j as jw,h as hr,i as Gn,k as Cs,n as Lg,J as JC,m as hl,a3 as ZI,o as aC,af as bg,ag as ET,t as AC,u as sI,x as xg,a6 as QI,v as cC,Z as z,bl as Mt,_ as Ue$1,am as Xm,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,e as pr,bn as Xt,ai as sm,aj as iT,q as dC,bo as uC,a8 as em,ak as im,w as fC,a5 as Dl,ac as CC,a9 as vC,aa as Sf,ab as _f,bp as yl,bq as vl,ah as dT,b4 as fT,y as qg}from'./main-4LGWVPVH.js';import {d}from'./chunk-sI2K91LE.js';import {W,k as ke,s as se}from'./chunk-DuGczpUf.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-BRAKs_V4.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-CmWqV8dc.js';import'./chunk-B2UoGfZ3.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn,Y as Ye$1,a as wt$1,m as mn,g as gt}from'./chunk-CPuMGlfm.js';function Ue(s,i){if(s&1){let e=vC();Cs(0,"div",9)(1,"mat-form-field",18)(2,"mat-label"),JC(3),hl(),Cs(4,"textarea",19),sm("ngModelChange",function(r){let m=Sf(e).$index,D=CC();return iT(D.commands[m],r)||(D.commands[m]=r),_f(r)}),hl(),ZI(),Cs(5,"mat-hint"),JC(6,"Use placeholder for dynamic values"),hl()(),Cs(7,"button",20),Lg("click",function(){let r=Sf(e).$index,m=CC();return _f(m.removeCommand(r))}),Cs(8,"mat-icon"),JC(9,"delete"),hl()()();}if(s&2){let e=i.$index,t=CC();sI(3),Dl("Prompt ",e+1),sI(),im("ngModel",t.commands[e]),QI(),sI(3),xg("disabled",t.commands.length===1);}}function Ne(s,i){if(s&1){let e=vC();Cs(0,"div",10)(1,"h3"),JC(2,"Save to"),hl(),Cs(3,"div",21)(4,"label",22)(5,"input",23),sm("ngModelChange",function(r){Sf(e);let m=CC();return iT(m.source,r)||(m.source=r),_f(r)}),hl(),ZI(),Cs(6,"div",24)(7,"div",25)(8,"span",26),JC(9,"\u{1F464}"),hl(),Cs(10,"span",27),JC(11,"Local"),hl()(),Cs(12,"p",28),JC(13,"Personal prompt in ~/.coday/... (not committed)"),hl()()(),Cs(14,"label",22)(15,"input",29),sm("ngModelChange",function(r){Sf(e);let m=CC();return iT(m.source,r)||(m.source=r),_f(r)}),hl(),ZI(),Cs(16,"div",24)(17,"div",25)(18,"span",26),JC(19,"\u{1F4E6}"),hl(),Cs(20,"span",27),JC(21,"Project"),hl()(),Cs(22,"p",28),JC(23,"Shared prompt in ./prompts/ (committable)"),hl()()()(),Cs(24,"p",30),JC(25,"Storage location is permanent and cannot be changed after creation"),hl()();}if(s&2){let e=CC();sI(4),qg("selected",e.source==="local"),sI(),im("ngModel",e.source),QI(),sI(9),qg("selected",e.source==="project"),sI(),im("ngModel",e.source),QI();}}function je(s,i){if(s&1&&(Cs(0,"div",11)(1,"h3"),JC(2,"Storage Location"),hl(),Cs(3,"div",31)(4,"span",26),JC(5),hl(),Cs(6,"span",27),JC(7),hl()(),Cs(8,"p",30),JC(9,"Cannot be changed after creation"),hl()()),s&2){let e=CC();sI(3),qg("badge-local",e.source==="local")("badge-project",e.source==="project"),sI(2),em(e.source==="local"?"\u{1F464}":"\u{1F4E6}"),sI(2),em(e.source==="local"?"Local":"Project");}}function qe(s,i){if(s&1){let e=vC();Cs(0,"div",12)(1,"label",32)(2,"input",33),sm("ngModelChange",function(r){Sf(e);let m=CC();return iT(m.webhookEnabled,r)||(m.webhookEnabled=r),_f(r)}),hl(),ZI(),Cs(3,"span"),JC(4,"Enable webhook"),hl()(),Cs(5,"p",30),JC(6,"Enable webhook to trigger this prompt via HTTP POST"),hl()();}if(s&2){let e=CC();sI(2),im("ngModel",e.webhookEnabled),QI();}}function He(s,i){if(s&1){let e=vC();Cs(0,"div",13)(1,"div",34)(2,"mat-icon",35),JC(3,"link"),hl(),Cs(4,"h4"),JC(5,"Webhook URL"),hl()(),Cs(6,"div",36)(7,"p",37),JC(8),hl(),Cs(9,"button",38),Lg("click",function(){Sf(e);let r=CC();return _f(r.copyWebhookUrl())}),Cs(10,"mat-icon"),JC(11,"content_copy"),hl(),Cs(12,"span"),JC(13,"Copy URL"),hl()()(),Cs(14,"p",30),JC(15,"Use this URL to trigger the prompt via HTTP POST"),hl()();}if(s&2){let e=CC();sI(8),em(e.getWebhookUrl());}}function Ye(s,i){if(s&1&&(Cs(0,"div",14)(1,"mat-icon"),JC(2,"error"),hl(),Cs(3,"span"),JC(4),hl()()),s&2){let e=CC();sI(4),em(e.errorMessage);}}var S=class s{promptApi=g(d);dialogRef=g(z);configApi=g(W);snackBar=g(Mt);name="";description="";commands=[""];webhookEnabled=false;threadLifetime="";source="local";isSaving=false;errorMessage="";isAdmin=false;isEditMode=false;promptId="";data=g(Ue$1);constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false;},error:i=>{console.error("[PROMPT_FORM] Error loading user config:",i),this.isAdmin=false;}}),this.isEditMode&&this.data.prompt&&(this.promptId=this.data.prompt.id,this.name=this.data.prompt.name,this.description=this.data.prompt.description,this.commands=[...this.data.prompt.commands],this.webhookEnabled=this.data.prompt.webhookEnabled,this.source=this.data.prompt.source);}addCommand(){this.commands.push("");}removeCommand(i){this.commands.length>1&&this.commands.splice(i,1);}trackByIndex(i){return i}normalizeName(){this.name=this.name.replace(/[\s_.,;:!?()[\]{}]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase();}validateForm(){return this.name.trim()?this.description.trim()?this.commands.filter(e=>e.trim()).length===0?(this.errorMessage="At least one command is required",false):true:(this.errorMessage="Description is required",false):(this.errorMessage="Name is required",false)}save(){if(this.errorMessage="",!this.validateForm())return;let i=this.commands.filter(e=>e.trim());if(this.isSaving=true,this.isEditMode&&this.data.prompt){let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled};this.promptApi.updatePrompt(this.data.prompt.id,e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update prompt",this.isSaving=false;}});}else {let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled,source:this.source};this.promptApi.createPrompt(e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create prompt",this.isSaving=false;}});}}cancel(){this.dialogRef.close(false);}getWebhookUrl(){return `${window.location.origin}/api/webhooks/${this.promptId}/execute`}copyWebhookUrl(){if(!this.webhookEnabled){this.snackBar.open("Webhook is not enabled","Close",{duration:3e3});return}if(!this.promptId){this.snackBar.open("Prompt must be saved before getting webhook URL","Close",{duration:3e3});return}let i=this.getWebhookUrl();navigator.clipboard.writeText(i).then(()=>{this.snackBar.open("Webhook URL copied to clipboard!","Close",{duration:3e3});}).catch(e=>{console.error("Failed to copy webhook URL:",e),this.snackBar.open("Failed to copy URL","Close",{duration:3e3});});}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=jw({type:s,selectors:[["app-prompt-form"]],decls:36,vars:11,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-prompt","required","",3,"ngModelChange","blur","ngModel"],["matInput","","placeholder","What does this prompt do?","rows","3","required","",3,"ngModelChange","ngModel"],[1,"commands-section"],[1,"section-header"],["mat-icon-button","","type","button","title","Add command",3,"click"],[1,"commands-list"],[1,"command-item"],[1,"source-section"],[1,"source-display"],[1,"webhook-section"],[1,"webhook-url-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"command-field"],["matInput","","placeholder","Enter command with placeholders like \\{\\{key\\}\\}","rows","2",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove command",1,"remove-btn",3,"click","disabled"],[1,"source-options"],[1,"source-option"],["type","radio","name","source","value","local",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","source","value","project",3,"ngModelChange","ngModel"],[1,"hint"],[1,"source-badge"],[1,"checkbox-label"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"webhook-url-header"],[1,"webhook-icon"],[1,"webhook-url-content"],[1,"url-text"],["mat-raised-button","","color","accent","type","button",3,"click"]],template:function(e,t){e&1&&(Cs(0,"h2",0),JC(1),hl(),Cs(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),JC(6,"Name"),hl(),Cs(7,"input",3),sm("ngModelChange",function(m){return iT(t.name,m)||(t.name=m),m}),Lg("blur",function(){return t.normalizeName()}),hl(),ZI(),Cs(8,"mat-hint"),JC(9,"A descriptive name (spaces and punctuation will be replaced with hyphens), will be used as command name"),hl()(),Cs(10,"mat-form-field",2)(11,"mat-label"),JC(12,"Description"),hl(),Cs(13,"textarea",4),sm("ngModelChange",function(m){return iT(t.description,m)||(t.description=m),m}),hl(),ZI(),Cs(14,"mat-hint"),JC(15,"Explain the purpose of this prompt, helps for searchability"),hl()(),Cs(16,"div",5)(17,"div",6)(18,"h3"),JC(19,"Prompts"),hl(),Cs(20,"button",7),Lg("click",function(){return t.addCommand()}),Cs(21,"mat-icon"),JC(22,"add"),hl()()(),Cs(23,"div",8),dC(24,Ue,10,3,"div",9,uC),hl()(),aC(26,Ne,26,6,"div",10),aC(27,je,10,6,"div",11),aC(28,qe,7,1,"div",12),aC(29,He,16,1,"div",13),aC(30,Ye,5,1,"div",14),hl()(),Cs(31,"mat-dialog-actions",15)(32,"button",16),Lg("click",function(){return t.cancel()}),JC(33,"Cancel"),hl(),Cs(34,"button",17),Lg("click",function(){return t.save()}),JC(35),hl()()),e&2&&(sI(),em(t.isEditMode?"Edit Prompt":"Create Prompt"),sI(6),im("ngModel",t.name),QI(),sI(6),im("ngModel",t.description),QI(),sI(11),fC(t.commands),sI(2),cC(t.isEditMode?-1:26),sI(),cC(t.isEditMode?27:-1),sI(),cC(t.isAdmin?28:-1),sI(),cC(t.isEditMode&&t.webhookEnabled&&t.isAdmin?29:-1),sI(),cC(t.errorMessage?30:-1),sI(2),xg("disabled",t.isSaving),sI(2),xg("disabled",t.isSaving),sI(),Dl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Xm,ti,Ye$1,wt$1,mn,Zn,gt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt,ae,le,ce,yt,wt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:500px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.commands-section[_ngcontent-%COMP%] .commands-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .command-field[_ngcontent-%COMP%]{flex:1}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.webhook-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.95rem}.webhook-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.webhook-url-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.75rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] .webhook-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:.5rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{flex:1;margin:0;padding:.75rem;background:var(--color-bg);border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:.85rem;word-break:break-all;color:var(--color-text)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap;display:flex;align-items:center;gap:.5rem}.webhook-url-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:1rem;font-weight:600}.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.75rem}@media(max-width:768px){.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-section[_ngcontent-%COMP%] .source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.thread-lifetime-disabled[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:#2196f30d;border:1px solid rgba(33,150,243,.2);border-radius:8px;margin-bottom:1rem}.thread-lifetime-disabled[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#2196f3cc;font-size:1.25rem;width:1.25rem;height:1.25rem;margin-top:2px}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;flex:1}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:.95rem;color:var(--color-text)}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{display:block;margin-top:.25rem;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-display[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-display[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem;font-weight:600}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500;margin-bottom:.5rem}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.1rem}.source-display[_ngcontent-%COMP%] .source-badge.badge-local[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-display[_ngcontent-%COMP%] .source-badge.badge-project[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.source-display[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}"],changeDetection:1})};var Ge=()=>[],Ke=s=>({id:s});function Je(s,i){if(s&1&&(Cs(0,"div",6),JC(1),hl()),s&2){let e=CC();sI(),em(e.errorMessage());}}function Qe(s,i){if(s&1){let e=vC();Cs(0,"ds-entity-card",8),Lg("selected",function(r){Sf(e);let m=CC();return _f(m.onEdit(r))}),yl(1,9),Cs(2,"button",10),Lg("click",function(r){return r.stopPropagation()}),Cs(3,"mat-icon"),JC(4,"more_vert"),hl()(),vl(),hl();}if(s&2){let e=i.$implicit;CC();let t=AC(11);xg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??dT(6,Ge)),sI(2),xg("matMenuTriggerFor",t)("matMenuTriggerData",fT(7,Ke,e.id));}}function Xe(s,i){if(s&1){let e=vC();Cs(0,"button",11),Lg("click",function(){Sf(e);let r=CC().id,m=CC();return _f(m.onToggleWebhook(r))}),Cs(1,"mat-icon"),JC(2),hl(),JC(3),hl();}if(s&2){let e=CC().id,t=CC();sI(2),em(t.isWebhookEnabled(e)?"link_off":"link"),sI(),Dl(" ",t.isWebhookEnabled(e)?"Disable webhook":"Enable webhook"," ");}}function Ze(s,i){if(s&1){let e=vC();Cs(0,"button",11),Lg("click",function(){let r=Sf(e).id,m=CC();return _f(m.onEdit(r))}),Cs(1,"mat-icon"),JC(2,"edit"),hl(),JC(3," Edit "),hl(),aC(4,Xe,4,2,"button",12),Cs(5,"button",13),Lg("click",function(){let r=Sf(e).id,m=CC();return _f(m.onDelete(r))}),Cs(6,"mat-icon"),JC(7,"delete"),hl(),JC(8," Delete "),hl();}if(s&2){let e=CC();sI(4),cC(e.isAdmin()?4:-1);}}var Le="system",Ie=class s{promptApi=g(d);configApi=g(W);location=g(Om);dialog=g(Re);prompts=Wi([]);isLoading=Wi(false);errorMessage=Wi(null);showOnlyMine=Wi(true);isAdmin=Wi(false);currentUsername=Wi("");promptItems=TT(()=>{let i=this.prompts(),e=this.currentUsername(),r=this.showOnlyMine()&&e?i.filter(p=>this.isMyPrompt(p)):i,D=[...new Set(r.map(p=>p.createdBy))].sort((p,k)=>p===e&&k!==e?-1:k===e&&p!==e||p===Le?1:k===Le?-1:p.localeCompare(k)),H=[];for(let p of D){let k=p===e?`${p} (you)`:p;for(let F of r.filter(Ae=>Ae.createdBy===p))H.push({id:F.id,name:F.name,description:F.description,badges:this.buildBadges(F),groupKey:p,groupLabel:k});}return H});ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin.set(i.groups?.includes("CODAY_ADMIN")??false),this.currentUsername.set(i.username??"");},error:()=>this.isAdmin.set(false)}),this.loadPrompts();}loadPrompts(){this.isLoading.set(true),this.promptApi.listPrompts().subscribe({next:i=>{this.prompts.set(i.filter(e=>!e.id.startsWith("builtin"))),this.isLoading.set(false);},error:i=>{this.errorMessage.set(i?.error?.error??"Failed to load prompts"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadPrompts();});}onEdit(i){this.promptApi.getPrompt(i).subscribe({next:e=>{this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"edit",prompt:e}}).afterClosed().subscribe(r=>{r&&this.loadPrompts();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load prompt")});}onDelete(i){confirm("Are you sure you want to delete this prompt?")&&this.promptApi.deletePrompt(i).subscribe({next:()=>this.loadPrompts(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete prompt")});}onToggleWebhook(i){let e=this.prompts().find(r=>r.id===i);if(!e)return;(e.webhookEnabled?this.promptApi.disableWebhook(i):this.promptApi.enableWebhook(i)).subscribe({next:()=>this.loadPrompts(),error:r=>this.errorMessage.set(r?.error?.error??"Failed to toggle webhook")});}isWebhookEnabled(i){return this.prompts().find(e=>e.id===i)?.webhookEnabled??false}isMyPrompt(i){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(i.createdBy)===e(this.currentUsername())}buildBadges(i){let e=[];return i.source==="local"?e.push({label:"local",variant:"info"}):e.push({label:"project",variant:"success"}),i.webhookEnabled&&e.push({label:"webhook",variant:"warning"}),e}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=jw({type:s,selectors:[["app-prompt-list"]],decls:13,vars:6,consts:[["promptCard",""],["cardMenu","matMenu"],[1,"prompt-list-page"],["title","Prompts","cardMinWidth","320px","contentMaxWidth","1400px","searchPlaceholder","Filter prompts\u2026","emptyMessage","No prompts found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"prompt-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"prompt-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item",""],["mat-menu-item","",1,"prompt-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(Cs(0,"div",2)(1,"ds-entity-list",3),Lg("createRequested",function(){return t.onCreate()}),Cs(2,"button",4),Lg("click",function(){return t.onBack()}),Cs(3,"mat-icon"),JC(4,"chevron_left"),hl()(),Cs(5,"mat-slide-toggle",5),Lg("ngModelChange",function(m){return t.showOnlyMine.set(m)}),JC(6," Mine "),hl(),ZI(),hl(),aC(7,Je,2,1,"div",6),hl(),bg(8,Qe,5,9,"ng-template",null,0,ET),Cs(10,"mat-menu",null,1),bg(12,Ze,9,1,"ng-template",7),hl()),e&2){let r=AC(9);sI(),xg("items",t.promptItems())("loading",t.isLoading())("showCreate",true)("itemTemplate",r),sI(4),xg("ngModel",t.showOnlyMine()),QI(),sI(2),cC(t.errorMessage()?7:-1);}},dependencies:[Wn,ot,it,hr,Gn,yt,wt,ke,se,In,De,Be,ya,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.prompt-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.prompt-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.prompt-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.prompt-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ie as PromptListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {S as St}from'./chunk-CT4atmse.js';import {an as ue,g,L,ao as V,G,E as N$1,ap as zy,j as jw,aq as a,ar as S,as as F,at as c,k as Cs,n as kg,o as aC,m as hl,_ as _g,t as sI,u as cC,x as jg,y as MC,N as NC,au as cv,ae as kt,av as dt,K as x,aw as gl,J as JC,ax as ml,a8 as Kg,a9 as vC,aa as Cf,ac as CC,ab as Tf,M as Mg}from'./main-RXIVNUWK.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-CyJ_au6Y.js';import'./chunk-B3Yorxwd.js';import {G as Ge}from'./chunk-BdZ0xOqX.js';import'./chunk-YGA4ansj.js';import'./chunk-COoOJuQT.js';import'./chunk-oIPYJtHA.js';import'./chunk-DrKKLE1-.js';import'./chunk-BIOQZPFJ.js';import'./chunk-CaL6ZXsO.js';import'./chunk-CqZF9JZo.js';import'./chunk-B3kY-GQk.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(gl(0,"h1",0),JC(1),ml()),t&2&&(sI(),Kg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ue;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(zy(this.destroy$),cv(),kt(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(zy(this.destroy$),cv(),kt(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=vC();Cs(0,"app-thread",4),kg("chatFocused",function(){Cf(t);let n=CC();return Tf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){Cf(t);let r=CC();return Tf(r.onDrawerStateChange(n))}),hl();}if(o&2){let t=CC();_g("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=vC();Cs(0,"div",5),Mg(1,"app-welcome-message"),hl(),Cs(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),kg("messageSubmitted",function(n){Cf(t);let r=CC();return Tf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){Cf(t);let r=CC();return Tf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){Cf(t);let r=CC();return Tf(r.onVoiceToggled(n))})("heightChanged",function(n){Cf(t);let r=CC();return Tf(r.onInputHeightChanged(n))})("textareaFocused",function(){Cf(t);let n=CC();return Tf(n.onChatFocusedOnMobile())}),hl()()()();}if(o&2){let t=CC();sI(6),_g("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ue;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(zy(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&jg(Z,5)(St,5),t&2){let n;MC(n=NC())&&(i.inputSection=n.first),MC(n=NC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(Cs(0,"app-sidenav",1)(1,"div",2),kg("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),aC(2,ee,1,2,"app-thread",3)(3,te,7,5),hl()()),t&2&&(_g("drawerOpen",i.isDrawerOpen),sI(2),cC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
1
|
+
import {S as St}from'./chunk-CgtOp5dr.js';import {an as ue,g,L,ao as V,G,I as N$1,ap as _d,j as jw,aq as a,ar as S,as as F,at as c,k as Cs,n as Lg,o as aC,m as hl,x as xg,u as sI,v as cC,H as Hg,M as MC,B as NC,au as uv,ae as kt,av as dt,Y as x,aw as gl,J as JC,ax as ml,a8 as em,a9 as vC,aa as Sf,ac as CC,ab as _f,A as Ag}from'./main-4LGWVPVH.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-Dx97073t.js';import'./chunk-BWE4takb.js';import {G as Ge}from'./chunk-DrcS-IIH.js';import'./chunk-6ZQ87jQV.js';import'./chunk-Bsd6cfhc.js';import'./chunk-sI2K91LE.js';import'./chunk-DuGczpUf.js';import'./chunk-BRAKs_V4.js';import'./chunk-CmWqV8dc.js';import'./chunk-B2UoGfZ3.js';import'./chunk-CPuMGlfm.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(gl(0,"h1",0),JC(1),ml()),t&2&&(sI(),em(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ue;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(_d(this.destroy$),uv(),kt(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(_d(this.destroy$),uv(),kt(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=vC();Cs(0,"app-thread",4),Lg("chatFocused",function(){Sf(t);let n=CC();return _f(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){Sf(t);let r=CC();return _f(r.onDrawerStateChange(n))}),hl();}if(o&2){let t=CC();xg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=vC();Cs(0,"div",5),Ag(1,"app-welcome-message"),hl(),Cs(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Lg("messageSubmitted",function(n){Sf(t);let r=CC();return _f(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){Sf(t);let r=CC();return _f(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){Sf(t);let r=CC();return _f(r.onVoiceToggled(n))})("heightChanged",function(n){Sf(t);let r=CC();return _f(r.onInputHeightChanged(n))})("textareaFocused",function(){Sf(t);let n=CC();return _f(n.onChatFocusedOnMobile())}),hl()()()();}if(o&2){let t=CC();sI(6),xg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ue;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(_d(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=jw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Hg(Z,5)(St,5),t&2){let n;MC(n=NC())&&(i.inputSection=n.first),MC(n=NC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(Cs(0,"app-sidenav",1)(1,"div",2),Lg("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),aC(2,ee,1,2,"app-thread",3)(3,te,7,5),hl()()),t&2&&(xg("drawerOpen",i.isDrawerOpen),sI(2),cC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {B}from'./chunk-
|
|
1
|
+
import {B}from'./chunk-BaAG5SRs.js';import {g,G,j as jw,k as Cs,J as JC,m as hl,q as dC,u as sI,w as fC,a9 as vC,n as Lg,x as xg,aa as Sf,ac as CC,ab as _f}from'./main-4LGWVPVH.js';import'./chunk-CmWqV8dc.js';import'./chunk-B2UoGfZ3.js';import'./chunk-CPuMGlfm.js';import'./chunk-6ZQ87jQV.js';var M=(a,n)=>n.key;function b(a,n){if(a&1){let e=vC();Cs(0,"agentos-action-card",6),Lg("nameClicked",function(){let C=Sf(e).$implicit,x=CC();return _f(x.navigateTo(C.path))}),hl();}if(a&2){let e=n.$implicit;xg("name",e.name)("mark",e.mark)("markIsEmoji",true)("description",e.description)("clickable",true);}}var v=class a{router=g(G);sections=[{key:"users",mark:"\u{1F464}",name:"Users & Groups",description:"Manage platform users, their admin rights, and namespace user groups.",path:"/agentos/admin/users"},{key:"agents",mark:"\u{1F916}",name:"Platform agents",description:"Manage agent configs shared across all namespaces.",path:"/agentos/admin/agent-configs"},{key:"integrations",mark:"\u{1F517}",name:"Platform integrations",description:"Manage integration configs shared across all namespaces.",path:"/agentos/admin/integration-configs"},{key:"authSetting",mark:"\u{1F512}",name:"Auth settings",description:"Manage auth settings shared across all namespaces.",path:"/agentos/admin/auth-settings"},{key:"ai-providers",mark:"\u{1F9E0}",name:"Platform AI providers",description:"Manage AI provider configs shared across all namespaces.",path:"/agentos/admin/ai-providers"},{key:"ai-models",mark:"\u2728",name:"Platform AI models",description:"Manage AI model configs shared across all namespaces.",path:"/agentos/admin/ai-models"},{key:"prompts",mark:"\u{1F4C4}",name:"Platform prompts",description:"Manage prompts shared across all namespaces.",path:"/agentos/admin/prompts"},{key:"case-definitions",mark:"\u23F0",name:"Platform case definitions",description:"Manage scheduled case definitions shared across all namespaces.",path:"/agentos/admin/case-definitions"},{key:"tool-invoke",mark:"\u{1F9EA}",name:"Tool invoke",description:"Debug: execute any registered tool directly with a custom payload.",path:"/agentos/admin/tool-invoke"}];navigateTo(n){this.router.navigate([n]);}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=jw({type:a,selectors:[["agentos-admin-home"]],decls:9,vars:0,consts:[[1,"admin-home"],[1,"admin-home__header"],[1,"admin-home__title"],[1,"admin-home__subtitle"],[1,"admin-home__sections"],[3,"name","mark","markIsEmoji","description","clickable"],[3,"nameClicked","name","mark","markIsEmoji","description","clickable"]],template:function(e,s){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"h1",2),JC(3,"Administration"),hl(),Cs(4,"p",3),JC(5,"Platform-level settings, visible to super-admins only."),hl()(),Cs(6,"nav",4),dC(7,b,1,5,"agentos-action-card",5,M),hl()()),e&2&&(sI(7),fC(s.sections));},dependencies:[B],styles:[".admin-home[_ngcontent-%COMP%]{max-width:860px;margin:0 auto;padding:2rem 1rem;display:flex;flex-direction:column;gap:2rem}.admin-home__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.admin-home__title[_ngcontent-%COMP%]{margin:0;font-size:28px;font-weight:700;color:var(--color-text);font-family:var(--font-heading)}.admin-home__subtitle[_ngcontent-%COMP%]{margin:0;font-size:13px;color:var(--color-neutral-600)}.admin-home__sections[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}"]})};export{v as AdminHomeComponent};
|