@whoz-oss/coday-client 0.0.0-workstream-messaging.9 → 0.0.0-workstream-forge.269
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-5l4dJKzj.js +1 -0
- package/browser/chunk-6G_HDlLt.js +1 -0
- package/browser/chunk-8ZA-dXSc.js +2 -0
- package/browser/chunk-B1-Po7IP.js +1 -0
- package/browser/chunk-B1ETqMnn.js +1 -0
- package/browser/chunk-B6ucC9JA.js +1 -0
- package/browser/chunk-B8yw58sL.js +1 -0
- package/browser/chunk-B9m_Pv-N.js +1 -0
- package/browser/chunk-BAFDJC7n.js +1 -0
- package/browser/chunk-BCtLUKA1.js +1 -0
- package/browser/chunk-BEGiDML0.js +1 -0
- package/browser/chunk-BItNUZzz.js +1 -0
- package/browser/chunk-BMgJXfSE.js +1 -0
- package/browser/chunk-BUdZ5OqC.js +1 -0
- package/browser/chunk-BVY2wOIp.js +1 -0
- package/browser/chunk-BeAWBIRs.js +671 -0
- package/browser/chunk-BeGVJrPy.js +1 -0
- package/browser/chunk-BfJl60vA.js +1 -0
- package/browser/chunk-BkRwWFjx.js +2 -0
- package/browser/chunk-BoLw7dqx.js +1 -0
- package/browser/{chunk-C4mkvgOW.js → chunk-BzTXrMsf.js} +1 -1
- package/browser/chunk-C1mIsJc9.js +1 -0
- package/browser/{chunk-DoVW4Qid.js → chunk-C3fz6Nhs.js} +1 -1
- package/browser/{chunk-_ojJ8Ms-.js → chunk-CXhczMHJ.js} +1 -1
- package/browser/chunk-CfLZEoOb.js +1 -0
- package/browser/chunk-ChYykPZM.js +1 -0
- package/browser/chunk-CkDaEVkZ.js +1 -0
- package/browser/chunk-CmjEguYB.js +1 -0
- package/browser/chunk-Cq9rgtVx.js +1 -0
- package/browser/chunk-CvFTKrrN.js +1 -0
- package/browser/{chunk-DnJZx-N1.js → chunk-D15w64SG.js} +1 -1
- package/browser/chunk-D8O-XquS.js +1 -0
- package/browser/chunk-D9cyFDnZ.js +1 -0
- package/browser/chunk-DAC1_8mf.js +1 -0
- package/browser/{chunk-CdzB1hlk.js → chunk-DA_ON43Y.js} +1 -1
- package/browser/chunk-DSe6H4u5.js +1 -0
- package/browser/chunk-DYGNedc1.js +1 -0
- package/browser/chunk-Db_G9wnV.js +1 -0
- package/browser/{chunk-Do3ec7CW.js → chunk-DxjesQXu.js} +1 -1
- package/browser/{chunk-C6aXXb6M.js → chunk-IMqSwtoo.js} +1 -1
- package/browser/{chunk-BnIh2Agv.js → chunk-MzRAkbwR.js} +1 -1
- package/browser/chunk-Tz-PZzVS.js +1 -0
- package/browser/chunk-Vn-xaj9q.js +1 -0
- package/browser/chunk-fbDk9ppW.js +1 -0
- package/browser/chunk-jfM6q-6w.js +1 -0
- package/browser/chunk-t3EN_XZw.js +1 -0
- package/browser/index.html +2 -2
- package/browser/main-P6EOYPYG.js +1253 -0
- package/package.json +1 -1
- package/browser/chunk-B2OdW-y7.js +0 -1
- package/browser/chunk-B4aagjFN.js +0 -1
- package/browser/chunk-BDBFLLoa.js +0 -2
- package/browser/chunk-BS4UgHRO.js +0 -1
- package/browser/chunk-BZ4F5_xt.js +0 -1
- package/browser/chunk-BZ8SegKy.js +0 -1
- package/browser/chunk-BatABxZT.js +0 -1
- package/browser/chunk-Bb1dx-Ci.js +0 -1
- package/browser/chunk-Bh7y7EIZ.js +0 -1
- package/browser/chunk-BjTEffSr.js +0 -1
- package/browser/chunk-BsPrQGCO.js +0 -1
- package/browser/chunk-BtzGwr18.js +0 -1
- package/browser/chunk-Bv223hQn.js +0 -1
- package/browser/chunk-BxNPtuPg.js +0 -1
- package/browser/chunk-C86Xogns.js +0 -1
- package/browser/chunk-CEHHoMbA.js +0 -2
- package/browser/chunk-CHRZly0o.js +0 -1
- package/browser/chunk-CKcknwaO.js +0 -1
- package/browser/chunk-CZkST2Zn.js +0 -1
- package/browser/chunk-CkbrWR16.js +0 -1
- package/browser/chunk-Cng5sc1A.js +0 -1
- package/browser/chunk-CpLFr6wl.js +0 -1
- package/browser/chunk-CwbSc94v.js +0 -1
- package/browser/chunk-DCYS0PGC.js +0 -1
- package/browser/chunk-DGU69dIe.js +0 -1
- package/browser/chunk-D_dIjWIZ.js +0 -1
- package/browser/chunk-DcX96pJb.js +0 -1
- package/browser/chunk-Ddc_ENU1.js +0 -1
- package/browser/chunk-DmkvfivC.js +0 -1
- package/browser/chunk-DvtbHzPu.js +0 -671
- package/browser/chunk-DymDoxBo.js +0 -1
- package/browser/chunk-DzQphzTy.js +0 -1
- package/browser/chunk-KYe8W5ss.js +0 -1
- package/browser/chunk-MdjBSjZT.js +0 -1
- package/browser/chunk-RltTZwlz.js +0 -1
- package/browser/chunk-bst4n40I.js +0 -1
- package/browser/chunk-iZXu2H1x.js +0 -1
- package/browser/chunk-lCKocljz.js +0 -1
- package/browser/chunk-t-Kfnaoc.js +0 -1
- package/browser/chunk-tEeX_Ukz.js +0 -1
- package/browser/chunk-yULRQNfZ.js +0 -1
- package/browser/main-OQ262YIZ.js +0 -1254
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {i}from'./chunk-Cq9rgtVx.js';import {y}from'./chunk-BeAWBIRs.js';import {g,af as G,aI as Pe,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,a5 as vd,a6 as x}from'./main-P6EOYPYG.js';var u=s=>s,N="none",w="me",O=class s{nsController=g(G);exportService=g(Pe);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([e])=>{let n=this.loadPlatformConfigs().pipe(ha(()=>br([]))),t=this.loadUserConfigs("global").pipe(ha(()=>br([])));return e?Cy([n,this.loadNamespaceConfigs(e).pipe(ha(()=>br([]))),this.loadUserConfigs(e).pipe(ha(()=>br([]))),t]).pipe(ne(([i,r,c,g])=>({platform:i,namespace:r,userOnNs:c,userGlobal:g}))):Cy([n,t]).pipe(ne(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(N)}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,w)}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 g={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let g={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(g)).pipe(vd(()=>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,autoGrant:e.autoGrant??false};return this.nsController.createIntegrationConfig(u(c)).pipe(vd(()=>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,autoGrant:n.autoGrant??false};return this.nsController.updateIntegrationConfig(e,u(r)).pipe(vd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(vd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{O};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-fbDk9ppW.js';import {O}from'./chunk-BeGVJrPy.js';import {g,W as W$1,t as F,K as we,I as J,$ as $i,U as U$1,ad as ne$1,a1 as ga,aa as br,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,P as dg,d as VE,i as Vw,v as tC,F as Fg,q as $w,z as zw,u as Dl,Q as Qw,n as lg,w as pf,x as hf}from'./main-P6EOYPYG.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-BeAWBIRs.js';import'./chunk-Cq9rgtVx.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let t=tC();VE(),Fg(t.deletion.error());}}function X(n,e){n&1&&(Es(0,"p",4),AC(1,"Loading integrations\u2026"),hl());}function Z(n,e){n&1&&(Es(0,"p",5),AC(1,"No integrations available."),hl());}function ee(n,e){n&1&&(Es(0,"p",4),AC(1,"No integrations match the current filter."),hl());}function te(n,e){n&1&&(Es(0,"ds-tag",20),AC(1,"YAML"),hl(),Es(2,"ds-tag",21),AC(3,"Read-only"),hl());}function ne(n,e){if(n&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let s=tC().$implicit,c=tC(2);return hf(c.view(s))}),AC(1,"View"),hl();}if(n&2){let t=tC().$implicit;lg("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let s=tC(3).$implicit,c=tC(2);return hf(c.edit(s))}),AC(1," Edit "),hl();}if(n&2){let t=tC(3).$implicit;lg("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let s=tC(2).$implicit,c=tC(2);return hf(c.duplicate(s))}),AC(1," Duplicate "),hl(),Bw(2,ie,2,1,"button",19);}if(n&2){let t=tC(2).$implicit;lg("aria-label","Duplicate "+t.config.name),VE(2),Vw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Qw();Es(0,"agentos-row-delete-action",25),vg("deleteRequested",function(){pf(t);let s=tC(2).$implicit,c=tC(2);return hf(c.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=tC(2).$implicit,c=tC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=tC(4);return hf(s.deletion.cancel())}),hl();}if(n&2){let t=tC(2).$implicit,a=tC(2);dg("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(Es(0,"button",24),AC(1,"Inherited"),hl());}function le(n,e){if(n&1&&(Bw(0,oe,3,2),Bw(1,ae,1,3,"agentos-row-delete-action",23),Bw(2,re,2,0,"button",24)),n&2){let t=tC().$implicit,a=tC(2);Vw(a.deletion.confirmingId()!==t.key?0:-1),VE(),Vw(t.canDelete?1:-1),VE(),Vw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),AC(8),hl(),Bw(9,te,4,0),hl()(),Es(10,"td",17)(11,"div",18),Bw(12,ne,2,1,"button",19)(13,le,3,3),hl()()()),n&2){let t=e.$implicit;VE(2),Fg(t.config.name),VE(2),Dl(" ",t.config.integrationType," "),VE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),VE(),Dl(" ",t.scopeLabel," "),VE(),Vw(t.source==="FILESYSTEM"?9:-1),VE(3),Vw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Type"),hl(),Es(8,"th",10),AC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,se,14,6,"tr",9,Q),hl()()()),n&2){let t=tC();VE(14),zw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(J);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=$i("this namespace");isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=Dw({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),AC(3,"New integration"),hl()(),Bw(4,W,2,1,"p",3),Bw(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(dg("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {g,V,A as A$1,h as he$1,W as W$1,e as ee$1,B,D as Dw,E as Es,f as fg,a as Bw,b as AC,c as hl,d as VE,i as Vw,M as Mg,j as gl,k as Dg,m as ml,p as pg,l as mg,n as lg,$ as $i,o as oT,q as $w,z as zw,r as f,F as Fg,s as $C,t as F,O as Of,C as Co,u as Dl,v as tC,Q as Qw,w as pf,x as hf,y as sh,G as EC,_ as _g}from'./main-P6EOYPYG.js';function ne(t,n){if(t&1&&(gl(0,"p",7),AC(1),ml()),t&2){let e=tC();VE(),Fg(e.state.error());}}var K=class t{state=g(V);onInput(n){this.state.email.set(n.target.value);}submit(n){n.preventDefault(),this.state.submitEmail();}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["app-email-step"]],decls:16,vars:4,consts:[["novalidate","",1,"step",3,"submit"],[1,"step__title"],[1,"step__lead"],[1,"field"],[1,"field__label"],["type","email","name","email","autocomplete","email","placeholder","you@company.com","data-testid","email-input",1,"field__input",3,"input","value"],[1,"field__hint"],["role","alert",1,"step__error"],[1,"step__actions"],["type","submit","data-testid","email-next",1,"btn","btn--primary",3,"disabled"]],template:function(e,o){e&1&&(gl(0,"form",0),Dg("submit",function(c){return o.submit(c)}),gl(1,"h2",1),AC(2,"What is your email?"),ml(),gl(3,"p",2),AC(4," It identifies you in Coday and makes you the administrator of this installation. Nothing is sent anywhere: it stays on this machine. "),ml(),gl(5,"label",3)(6,"span",4),AC(7,"Email"),ml(),gl(8,"input",5),Dg("input",function(c){return o.onInput(c)}),ml(),gl(9,"span",6),AC(10,"We are already downloading AgentOS in the background while you answer."),ml()(),Bw(11,ne,2,1,"p",7),gl(12,"div",8),pg(13,"span"),gl(14,"button",9),AC(15," Continue "),ml()()()),e&2&&(VE(8),mg("value",o.state.email()),lg("aria-invalid",o.state.email()&&!o.state.emailValid()?"true":null),VE(3),Vw(o.state.error()?11:-1),VE(3),mg("disabled",!o.state.emailValid()||o.state.busy()));},styles:[".step[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.step__title[_ngcontent-%COMP%]{margin:0;font-size:18px;font-weight:620}.step__lead[_ngcontent-%COMP%]{margin:-8px 0 0;font-size:14px;color:var(--color-text-secondary);line-height:1.5}.step__error[_ngcontent-%COMP%]{margin:0;padding:10px 14px;border-radius:10px;font-size:13px;color:var(--color-error);background:color-mix(in srgb,var(--color-error) 12%,transparent)}.step__actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:8px}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.field__label[_ngcontent-%COMP%]{font-size:13px;font-weight:560}.field__hint[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-tertiary)}.field__input[_ngcontent-%COMP%]{width:100%;box-sizing:border-box;padding:12px 14px;font:inherit;color:var(--color-text);background:var(--color-input-bg);border:1px solid var(--color-border);border-radius:12px;outline:none;transition:border-color .15s,box-shadow .15s}.field__input[_ngcontent-%COMP%]:focus-visible{border-color:var(--color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--color-primary) 25%,transparent)}.field__input[aria-invalid=true][_ngcontent-%COMP%]{border-color:var(--color-error)}.btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 20px;font:inherit;font-weight:580;color:var(--color-text);background:transparent;border:1px solid var(--color-border);border-radius:12px;cursor:pointer;transition:background .15s,transform .1s,box-shadow .15s,opacity .15s}.btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.btn[_ngcontent-%COMP%]:active:not(:disabled){transform:translateY(1px)}.btn[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.btn--primary[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-primary);border-color:transparent;box-shadow:0 4px 14px color-mix(in srgb,var(--color-primary) 35%,transparent)}.btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover)}.btn--big[_ngcontent-%COMP%]{padding:16px 32px;font-size:17px;border-radius:14px}.btn--ghost[_ngcontent-%COMP%]{border-color:transparent;color:var(--color-text-secondary)}"]})};var oe=()=>[],re=(t,n)=>n.path;function ie(t,n){t&1&&(gl(0,"span",21),AC(1,"link"),ml());}function ae(t,n){if(t&1){let e=Qw();gl(0,"li")(1,"button",18),Dg("click",function(){let d=pf(e).$implicit,c=tC();return hf(c.navigate(d.path))}),gl(2,"span",19),AC(3,"\u{1F4C1}"),ml(),gl(4,"span",20),AC(5),ml(),Bw(6,ie,2,0,"span",21),ml()();}if(t&2){let e=n.$implicit;VE(5),Fg(e.name),VE(),Vw(e.symlink?6:-1);}}function le(t,n){t&1&&(gl(0,"li",22),AC(1,"No sub-folders here."),ml());}function de(t,n){if(t&1&&Bw(0,le,2,0,"li",22),t&2){let e=tC();Vw(e.loading()?-1:0);}}function se(t,n){if(t&1){let e=Qw();gl(0,"form",23),Dg("submit",function(d){pf(e);let c=tC();return hf(c.create(d))}),gl(1,"input",24),Dg("input",function(d){pf(e);let c=tC();return hf(c.onName(d))}),ml(),gl(2,"button",25),AC(3,"Create"),ml(),gl(4,"button",16),Dg("click",function(){pf(e);let d=tC();return hf(d.creating.set(false))}),AC(5,"Cancel"),ml()();}if(t&2){let e=tC();VE(),mg("value",e.newName()),VE(),mg("disabled",!e.newName().trim());}}function ce(t,n){if(t&1&&(gl(0,"span"),AC(1),ml()),t&2){let e=tC(2);VE(),Dl("(",e.listing()?.hiddenCount,")");}}function pe(t,n){if(t&1){let e=Qw();gl(0,"button",26),Dg("click",function(){pf(e);let d=tC();return hf(d.startCreate())}),AC(1," + New folder "),ml(),gl(2,"label",27)(3,"input",28),Dg("change",function(){pf(e);let d=tC();return hf(d.toggleHidden())}),ml(),AC(4," Show hidden "),Bw(5,ce,2,1,"span"),ml();}if(t&2){let e=tC();VE(3),mg("checked",e.showHidden()),VE(2),Vw(e.listing()?.hiddenCount?5:-1);}}function me(t,n){if(t&1&&(gl(0,"p",14),AC(1),ml()),t&2){let e=tC();VE(),Fg(e.browseError());}}function _e(t,n){if(t&1&&(gl(0,"p",14),AC(1),ml()),t&2){let e=tC();VE(),Fg(e.state.error());}}var $=class t{state=g(V);listing=$i(null);loading=$i(false);browseError=$i(null);showHidden=$i(false);creating=$i(false);newName=$i("");ngOnInit(){this.open(this.parentOfSelection());}parentOfSelection(){let n=this.state.folder(),e=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\"));return e>0?n.slice(0,e):void 0}navigate(n){return this.open(n,true)}open(n,e=false){return B(this,null,function*(){this.loading.set(true),this.browseError.set(null);try{let o=yield this.state.browse(n,this.showHidden());this.listing.set(o),e&&this.state.selectFolder(o.path);}catch(o){if(e){this.browseError.set(f(o,"Cannot open this folder."));return}if(n)return this.open(void 0);this.browseError.set(f(o,"Cannot list this folder."));}finally{this.loading.set(false);}})}toggleHidden(){this.showHidden.update(n=>!n),this.open(this.listing()?.path);}startCreate(){this.creating.set(true),this.newName.set("");}onName(n){this.newName.set(n.target.value);}create(n){return B(this,null,function*(){n.preventDefault();let e=this.listing()?.path,o=this.newName().trim();if(!(!e||!o))try{let d=yield this.state.mkdir(e,o);this.creating.set(!1),this.state.selectFolder(d.path),yield this.open(d.path,!0);}catch(d){this.browseError.set(f(d,"Could not create this folder."));}})}submit(){this.state.submitFolderAndApply();}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["app-folder-step"]],decls:32,vars:11,consts:[[1,"step"],[1,"step__title"],[1,"step__lead"],["data-testid","selected-folder",1,"selected"],[1,"selected__label"],[1,"selected__path"],[1,"browser"],[1,"browser__bar"],["type","button","aria-label","Parent folder",1,"browser__icon",3,"click","disabled"],["type","button","aria-label","Home folder",1,"browser__icon",3,"click"],[1,"browser__path",3,"title"],["role","list",1,"browser__list"],[1,"browser__footer"],[1,"browser__new"],["role","alert",1,"step__error"],[1,"step__actions"],["type","button",1,"btn","btn--ghost",3,"click"],["type","button","data-testid","folder-next",1,"btn","btn--primary",3,"click","disabled"],["type","button",1,"entry",3,"click"],["aria-hidden","true"],[1,"entry__name"],[1,"entry__tag"],[1,"browser__empty"],[1,"browser__new",3,"submit"],["type","text","placeholder","New folder name","aria-label","New folder name","data-testid","new-folder-name",1,"field__input",3,"input","value"],["type","submit",1,"btn",3,"disabled"],["type","button","data-testid","new-folder",1,"btn","btn--ghost",3,"click"],[1,"browser__hidden"],["type","checkbox",3,"change","checked"]],template:function(e,o){e&1&&(gl(0,"section",0)(1,"h2",1),AC(2,"Where should Coday keep your files?"),ml(),gl(3,"p",2),AC(4," The agent reads and writes the files of your personal workspace in this folder. The default is fine for most people; it is created if it does not exist. To choose another one, open it below. "),ml(),gl(5,"div",3)(6,"span",4),AC(7,"Selected folder"),ml(),gl(8,"code",5),AC(9),ml()(),gl(10,"div",6)(11,"div",7)(12,"button",8),Dg("click",function(){return o.navigate(o.listing()?.parent??void 0)}),AC(13," \u2191 "),ml(),gl(14,"button",9),Dg("click",function(){return o.navigate(o.listing()?.home)}),AC(15," \u2302 "),ml(),gl(16,"code",10),AC(17),ml()(),gl(18,"ul",11),$w(19,ae,7,2,"li",null,re,false,de,1,1),ml(),gl(22,"div",12),Bw(23,se,6,2,"form",13)(24,pe,6,2),ml()(),Bw(25,me,2,1,"p",14),Bw(26,_e,2,1,"p",14),gl(27,"div",15)(28,"button",16),Dg("click",function(){return o.state.back()}),AC(29,"Back"),ml(),gl(30,"button",17),Dg("click",function(){return o.submit()}),AC(31," Set everything up "),ml()()()),e&2&&(VE(9),Fg(o.state.folder()),VE(3),mg("disabled",!o.listing()?.parent),VE(4),mg("title",o.listing()?.path??""),VE(),Fg(o.listing()?.path),VE(),lg("aria-busy",o.loading()),VE(),zw(o.listing()?.entries??$C(10,oe)),VE(4),Vw(o.creating()?23:24),VE(2),Vw(o.browseError()?25:-1),VE(),Vw(o.state.error()?26:-1),VE(4),mg("disabled",!o.state.folderValid()||o.state.busy()));},styles:[".step[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.step__title[_ngcontent-%COMP%]{margin:0;font-size:18px;font-weight:620}.step__lead[_ngcontent-%COMP%]{margin:-8px 0 0;font-size:14px;color:var(--color-text-secondary);line-height:1.5}.step__error[_ngcontent-%COMP%]{margin:0;padding:10px 14px;border-radius:10px;font-size:13px;color:var(--color-error);background:color-mix(in srgb,var(--color-error) 12%,transparent)}.step__actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:8px}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.field__label[_ngcontent-%COMP%]{font-size:13px;font-weight:560}.field__hint[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-tertiary)}.field__input[_ngcontent-%COMP%]{width:100%;box-sizing:border-box;padding:12px 14px;font:inherit;color:var(--color-text);background:var(--color-input-bg);border:1px solid var(--color-border);border-radius:12px;outline:none;transition:border-color .15s,box-shadow .15s}.field__input[_ngcontent-%COMP%]:focus-visible{border-color:var(--color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--color-primary) 25%,transparent)}.field__input[aria-invalid=true][_ngcontent-%COMP%]{border-color:var(--color-error)}.btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 20px;font:inherit;font-weight:580;color:var(--color-text);background:transparent;border:1px solid var(--color-border);border-radius:12px;cursor:pointer;transition:background .15s,transform .1s,box-shadow .15s,opacity .15s}.btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.btn[_ngcontent-%COMP%]:active:not(:disabled){transform:translateY(1px)}.btn[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.btn--primary[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-primary);border-color:transparent;box-shadow:0 4px 14px color-mix(in srgb,var(--color-primary) 35%,transparent)}.btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover)}.btn--big[_ngcontent-%COMP%]{padding:16px 32px;font-size:17px;border-radius:14px}.btn--ghost[_ngcontent-%COMP%]{border-color:transparent;color:var(--color-text-secondary)}",".selected[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:12px;background:color-mix(in srgb,var(--color-primary) 8%,transparent)}.selected__label[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-secondary)}.selected__path[_ngcontent-%COMP%]{font-size:14px;word-break:break-all}.browser[_ngcontent-%COMP%]{display:flex;flex-direction:column;border:1px solid var(--color-border);border-radius:14px;overflow:hidden}.browser__bar[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:8px;background:var(--color-surface-muted);border-bottom:1px solid var(--color-border)}.browser__icon[_ngcontent-%COMP%]{flex:none;width:32px;height:32px;font:inherit;color:var(--color-text);background:var(--color-bg-hover);border:none;border-radius:8px;cursor:pointer}.browser__icon[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:default}.browser__path[_ngcontent-%COMP%]{flex:1;min-width:0;overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap;direction:rtl;text-align:left}.browser__list[_ngcontent-%COMP%]{margin:0;padding:4px;max-height:220px;overflow-y:auto;list-style:none}.browser__empty[_ngcontent-%COMP%]{padding:18px;text-align:center;font-size:13px;color:var(--color-text-tertiary)}.browser__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 8px;border-top:1px solid var(--color-border)}.browser__new[_ngcontent-%COMP%]{display:flex;flex:1;gap:8px}.browser__new[_ngcontent-%COMP%] .field__input[_ngcontent-%COMP%]{padding:8px 12px}.browser__hidden[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--color-text-secondary)}.entry[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;font:inherit;color:var(--color-text);text-align:left;background:transparent;border:none;border-radius:8px;cursor:pointer}.entry[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.entry[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary)}.entry__name[_ngcontent-%COMP%]{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.entry__tag[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-tertiary)}"]})};var ge=(t,n)=>n.key;function ue(t,n){if(t&1){let e=Qw();gl(0,"div",1)(1,"div",2),AC(2,"\u2713"),ml(),gl(3,"h2",3),AC(4,"You are all set"),ml(),gl(5,"p",4),AC(6,"Your workspace is ready and the Coday agent is waiting for you."),ml(),gl(7,"button",5),Dg("click",function(){pf(e);let d=tC();return hf(d.start())}),AC(8," Start with Coday "),ml()();}}function xe(t,n){t&1&&(gl(0,"h2",11),AC(1,"Starting Coday"),ml(),gl(2,"p",4),AC(3,"Just a moment, you will land in the app by yourself."),ml());}function be(t,n){t&1&&(gl(0,"h2",3),AC(1,"Setting things up"),ml(),gl(2,"p",4),AC(3,"This only happens once. You can keep this page open."),ml());}function fe(t,n){t&1&&pg(0,"span",14);}function ye(t,n){if(t&1&&AC(0),t&2){let e=tC().$implicit,o=tC(2);Dl(" ",o.icon(e.state)," ");}}function ve(t,n){if(t&1&&(gl(0,"span",18),pg(1,"span",19),ml(),gl(2,"span",17),AC(3),ml()),t&2){let e=tC().$implicit;lg("aria-valuenow",e.percent??0),VE(),_g("width",e.percent??0,"%"),VE(2),Dl("",e.percent??0,"%");}}function Ce(t,n){if(t&1&&(gl(0,"span",17),AC(1),ml()),t&2){let e=tC().$implicit;VE(),Fg(e.message);}}function he(t,n){if(t&1&&(gl(0,"li",12)(1,"span",13),Bw(2,fe,1,0,"span",14)(3,ye,1,1),ml(),gl(4,"span",15)(5,"span",16),AC(6),ml(),Bw(7,ve,4,4)(8,Ce,2,1,"span",17),ml()()),t&2){let e=n.$implicit;EC("item item--"+e.state),lg("data-testid","step-"+e.key)("data-state",e.state),VE(2),Vw(e.state==="running"?2:3),VE(4),Fg(e.label),VE(),Vw(e.key==="download"&&e.state==="running"?7:e.message?8:-1);}}function Ee(t,n){if(t&1&&(gl(0,"div",8)(1,"strong"),AC(2,"Java 25 is required."),ml(),gl(3,"span"),AC(4),ml(),gl(5,"span"),AC(6,"Install it, then come back: this page continues by itself."),ml()()),t&2){let e=tC(2);VE(4),Fg(e.javaHint());}}function Pe(t,n){if(t&1){let e=Qw();gl(0,"div",9)(1,"strong"),AC(2,"Something went wrong."),ml(),gl(3,"span"),AC(4),ml(),gl(5,"span"),AC(6,"Fix your answers and run the setup again, or retry as is."),ml(),gl(7,"div",20)(8,"button",21),Dg("click",function(){pf(e);let d=tC(2);return hf(d.state.editAfterFailure("providers"))}),AC(9," Change the API keys "),ml(),gl(10,"button",22),Dg("click",function(){pf(e);let d=tC(2);return hf(d.state.editAfterFailure("folder"))}),AC(11," Change the folder "),ml(),gl(12,"button",23),Dg("click",function(){pf(e);let d=tC(2);return hf(d.retry())}),AC(13," Try again "),ml()()();}if(t&2){let e=tC(2);VE(4),Fg(e.applyError()),VE(4),mg("disabled",e.state.busy()),VE(2),mg("disabled",e.state.busy()),VE(2),mg("disabled",e.state.busy());}}function we(t,n){if(t&1&&(gl(0,"p",10),AC(1),ml()),t&2){let e=tC(2);VE(),Fg(e.state.statusError());}}function Me(t,n){if(t&1&&(Bw(0,xe,4,0)(1,be,4,0),gl(2,"ul",6),$w(3,he,9,7,"li",7,ge),ml(),Bw(5,Ee,7,1,"div",8),Bw(6,Pe,14,4,"div",9),Bw(7,we,2,1,"p",10)),t&2){let e=tC();Vw(e.loading()?0:1),VE(3),zw(e.items()),VE(2),Vw(e.state.javaBlocked()?5:-1),VE(),Vw(!e.loading()&&e.state.failed()?6:-1),VE(),Vw(e.state.statusError()?7:-1);}}var Se={pending:"\u25CB",running:"",done:"\u2713",error:"!",blocked:"!"},j=class t{state=g(V);router=g(F);icon=n=>Se[n];javaHint=oT(()=>this.state.status()?.steps.java.hint??"");applyError=oT(()=>this.state.status()?.apply.error??null);loading=oT(()=>this.state.mode()==="loading");items=oT(()=>this.loading()?this.state.loadingChecklist():this.state.checklist());leaving=false;constructor(){Of(()=>{!this.loading()||!this.state.loadingReady()||this.state.preview()||Co(()=>{this.leaveToPersonalNamespace();});});}start(){let n=this.state.landingCommands();n&&this.leave(n);}leaveToPersonalNamespace(){return B(this,null,function*(){this.leaving||(this.leaving=true,this.state.stopPolling(),this.leave(yield this.state.loadingTarget()));})}leave(n){this.state.stopPolling(),this.router.navigate([n.path],{queryParams:n.queryParams});}retry(){this.state.retry();}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["app-progress-step"]],decls:3,vars:1,consts:[[1,"step"],["data-testid","ready",1,"ready"],["aria-hidden","true",1,"ready__badge"],[1,"step__title"],[1,"step__lead"],["type","button","data-testid","start-with-coday",1,"btn","btn--primary","btn--big",3,"click"],["role","list","data-testid","checklist",1,"checklist"],[1,"item",3,"class"],["role","alert","data-testid","java-hint",1,"callout"],["role","alert","data-testid","apply-error",1,"callout","callout--error"],["role","status",1,"step__error"],["data-testid","loading-title",1,"step__title"],[1,"item"],["aria-hidden","true",1,"item__icon"],[1,"spinner"],[1,"item__body"],[1,"item__label"],[1,"item__note"],["role","progressbar","aria-valuemin","0","aria-valuemax","100",1,"bar"],[1,"bar__fill"],[1,"callout__actions"],["type","button","data-testid","edit-providers",1,"btn",3,"click","disabled"],["type","button","data-testid","edit-folder",1,"btn",3,"click","disabled"],["type","button","data-testid","retry",1,"btn","btn--ghost",3,"click","disabled"]],template:function(e,o){e&1&&(gl(0,"section",0),Bw(1,ue,9,0,"div",1)(2,Me,8,4),ml()),e&2&&(VE(),Vw(!o.loading()&&o.state.ready()?1:2));},styles:[".step[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.step__title[_ngcontent-%COMP%]{margin:0;font-size:18px;font-weight:620}.step__lead[_ngcontent-%COMP%]{margin:-8px 0 0;font-size:14px;color:var(--color-text-secondary);line-height:1.5}.step__error[_ngcontent-%COMP%]{margin:0;padding:10px 14px;border-radius:10px;font-size:13px;color:var(--color-error);background:color-mix(in srgb,var(--color-error) 12%,transparent)}.step__actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:8px}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.field__label[_ngcontent-%COMP%]{font-size:13px;font-weight:560}.field__hint[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-tertiary)}.field__input[_ngcontent-%COMP%]{width:100%;box-sizing:border-box;padding:12px 14px;font:inherit;color:var(--color-text);background:var(--color-input-bg);border:1px solid var(--color-border);border-radius:12px;outline:none;transition:border-color .15s,box-shadow .15s}.field__input[_ngcontent-%COMP%]:focus-visible{border-color:var(--color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--color-primary) 25%,transparent)}.field__input[aria-invalid=true][_ngcontent-%COMP%]{border-color:var(--color-error)}.btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 20px;font:inherit;font-weight:580;color:var(--color-text);background:transparent;border:1px solid var(--color-border);border-radius:12px;cursor:pointer;transition:background .15s,transform .1s,box-shadow .15s,opacity .15s}.btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.btn[_ngcontent-%COMP%]:active:not(:disabled){transform:translateY(1px)}.btn[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.btn--primary[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-primary);border-color:transparent;box-shadow:0 4px 14px color-mix(in srgb,var(--color-primary) 35%,transparent)}.btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover)}.btn--big[_ngcontent-%COMP%]{padding:16px 32px;font-size:17px;border-radius:14px}.btn--ghost[_ngcontent-%COMP%]{border-color:transparent;color:var(--color-text-secondary)}",".checklist[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}.item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:12px;padding:10px 12px;border-radius:12px;color:var(--color-text-tertiary);transition:color .2s,background .2s}.item--running[_ngcontent-%COMP%]{color:var(--color-text);background:color-mix(in srgb,var(--color-primary) 8%,transparent)}.item--done[_ngcontent-%COMP%]{color:var(--color-text)}.item--error[_ngcontent-%COMP%], .item--blocked[_ngcontent-%COMP%]{color:var(--color-text);background:color-mix(in srgb,var(--color-warning) 12%,transparent)}.item--error[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-error) 12%,transparent)}.item__icon[_ngcontent-%COMP%]{display:grid;place-items:center;flex:none;width:22px;height:22px;font-size:13px;font-weight:700;border-radius:50%;border:1.5px solid currentColor}.item--done[_ngcontent-%COMP%] .item__icon[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-success);border-color:var(--color-success)}.item--error[_ngcontent-%COMP%] .item__icon[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-error);border-color:var(--color-error)}.item--blocked[_ngcontent-%COMP%] .item__icon[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-warning);border-color:var(--color-warning)}.item--running[_ngcontent-%COMP%] .item__icon[_ngcontent-%COMP%]{border-color:transparent}.item__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.item__label[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:22px;font-size:14px;font-weight:540;line-height:1.3}.item__note[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-secondary);word-break:break-word}.spinner[_ngcontent-%COMP%]{width:18px;height:18px;border-radius:50%;border:2px solid color-mix(in srgb,var(--color-primary) 25%,transparent);border-top-color:var(--color-primary);animation:_ngcontent-%COMP%_spin .8s linear infinite}.bar[_ngcontent-%COMP%]{display:block;height:6px;border-radius:999px;overflow:hidden;background:var(--color-border)}.bar__fill[_ngcontent-%COMP%]{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--color-primary),var(--color-accent));transition:width .4s ease}.callout[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px 16px;border-radius:12px;font-size:13px;line-height:1.5;background:color-mix(in srgb,var(--color-warning) 14%,transparent)}.callout[_ngcontent-%COMP%] code[_ngcontent-%COMP%], .callout[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{word-break:break-word}.callout--error[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-error) 12%,transparent)}.callout__actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}.ready[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:16px;padding:24px 0;text-align:center;animation:_ngcontent-%COMP%_pop .42s cubic-bezier(.2,.9,.3,1.2) both}.ready__badge[_ngcontent-%COMP%]{display:grid;place-items:center;width:64px;height:64px;font-size:32px;color:var(--color-text-inverse);border-radius:50%;background:var(--color-success);box-shadow:0 8px 24px color-mix(in srgb,var(--color-success) 40%,transparent)}@media(prefers-reduced-motion:reduce){.spinner[_ngcontent-%COMP%]{animation-duration:2.4s}.ready[_ngcontent-%COMP%]{animation:none}.bar__fill[_ngcontent-%COMP%]{transition:none}}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_pop{0%{opacity:0;transform:scale(.92)}}"]})};var Oe=(t,n)=>n.draft.id;function ke(t,n){if(t&1){let e=Qw();gl(0,"span",17)(1,"button",18),Dg("click",function(){pf(e);let d=tC(2).$implicit,c=tC();return hf(c.state.moveProvider(d.draft.id,-1))}),AC(2," \u2191 "),ml(),gl(3,"button",19),Dg("click",function(){pf(e);let d=tC(2).$implicit,c=tC();return hf(c.state.moveProvider(d.draft.id,1))}),AC(4," \u2193 "),ml()();}if(t&2){let e=tC(2).$implicit,o=tC();VE(),mg("disabled",e.rank===1),VE(2),mg("disabled",e.rank===o.enabledCount());}}function Te(t,n){if(t&1&&(gl(0,"span",16),AC(1),ml(),Bw(2,ke,5,2,"span",17)),t&2){let e=tC().$implicit,o=tC();lg("aria-label","Rank "+e.rank),VE(),Dl("#",e.rank),VE(),Vw(o.enabledCount()>1?2:-1);}}function Ie(t,n){if(t&1){let e=Qw();gl(0,"label",15)(1,"span",20),AC(2,"API key"),ml(),gl(3,"input",21),Dg("input",function(d){pf(e);let c=tC().$implicit,h=tC();return hf(h.onKey(c.draft.id,d))})("keydown",function(d){pf(e);let c=tC().$implicit,h=tC();return hf(h.onCardKeydown(c.draft.id,d))}),ml(),gl(4,"span",22),AC(5," Stored on this machine only. "),gl(6,"a",23),AC(7,"Get a key"),ml()()();}if(t&2){let e=tC().$implicit,o=tC();VE(3),mg("value",e.draft.apiKey),lg("data-testid","provider-key-"+e.draft.id)("aria-invalid",o.keyTooShort(e.draft.id)?"true":null),VE(3),mg("href",e.info.keyUrl,sh);}}function De(t,n){if(t&1){let e=Qw();gl(0,"li",9),Dg("dragstart",function(d){let c=pf(e).$implicit,h=tC();return hf(h.onDragStart(c.draft.id,d))})("dragover",function(d){let c=pf(e).$implicit,h=tC();return hf(h.onDragOver(c.draft.id,d))})("drop",function(d){let c=pf(e).$implicit,h=tC();return hf(h.onDrop(c.draft.id,d))})("dragend",function(){pf(e);let d=tC();return hf(d.onDragEnd())}),gl(1,"div",10)(2,"label",11)(3,"input",12),Dg("change",function(){let d=pf(e).$implicit,c=tC();return hf(c.state.toggleProvider(d.draft.id))})("keydown",function(d){let c=pf(e).$implicit,h=tC();return hf(h.onCardKeydown(c.draft.id,d))}),ml(),gl(4,"span",13),AC(5),ml()(),Bw(6,Te,3,3),ml(),gl(7,"p",14),AC(8),ml(),Bw(9,Ie,8,4,"label",15),ml();}if(t&2){let e=n.$implicit,o=tC();Mg("card--on",e.draft.enabled)("card--dragging",o.dragging()===e.draft.id)("card--over",o.dragOver()===e.draft.id&&o.dragging()!==e.draft.id),lg("draggable",e.draft.enabled&&o.enabledCount()>1?"true":null)("data-testid","provider-"+e.draft.id),VE(3),mg("checked",e.draft.enabled),lg("data-testid","provider-toggle-"+e.draft.id),VE(2),Fg(e.info.label),VE(),Vw(e.rank!==null?6:-1),VE(2),Fg(e.info.description),VE(),Vw(e.draft.enabled?9:-1);}}function Fe(t,n){if(t&1&&(gl(0,"p",5),AC(1),ml()),t&2){let e=tC();VE(),Fg(e.state.error());}}function Ve(t,n){if(t&1){let e=Qw();gl(0,"button",24),Dg("click",function(){pf(e);let d=tC();return hf(d.state.back())}),AC(1,"Back"),ml();}}var ee=[{id:"anthropic",label:"Anthropic",description:"Claude models, directly from Anthropic.",keyUrl:"https://console.anthropic.com/settings/keys"},{id:"openai",label:"OpenAI",description:"GPT models, directly from OpenAI.",keyUrl:"https://platform.openai.com/api-keys"},{id:"requesty",label:"Requesty",description:"Requires Requesty policies named claude-fable, claude-opus, claude-sonnet and claude-haiku configured in your account.",keyUrl:"https://app.requesty.ai/api-keys"}],W=class t{state=g(V);dragging=$i(null);dragOver=$i(null);info=oT(()=>this.state.status()?.providers??ee);cards=oT(()=>this.state.providers().map(n=>({draft:n,info:this.info().find(e=>e.id===n.id)??ee.find(e=>e.id===n.id),rank:this.state.rankOf(n.id)})));enabledCount=oT(()=>this.state.enabledProviders().length);onKey(n,e){this.state.setApiKey(n,e.target.value);}keyTooShort(n){let e=this.state.providers().find(o=>o.id===n);return !!e&&e.enabled&&e.apiKey.length>0&&e.apiKey.trim().length<8}onDragStart(n,e){this.dragging.set(n),e.dataTransfer?.setData("text/plain",n),e.dataTransfer&&(e.dataTransfer.effectAllowed="move");}onDragOver(n,e){!this.dragging()||this.state.rankOf(n)===null||(e.preventDefault(),this.dragOver.set(n));}onDrop(n,e){e.preventDefault();let o=this.dragging();o&&this.state.moveProviderTo(o,n),this.onDragEnd();}onDragEnd(){this.dragging.set(null),this.dragOver.set(null);}onCardKeydown(n,e){e.altKey&&(e.key==="ArrowUp"?(e.preventDefault(),this.state.moveProvider(n,-1)):e.key==="ArrowDown"&&(e.preventDefault(),this.state.moveProvider(n,1)));}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["app-providers-step"]],decls:13,vars:3,consts:[[1,"step"],[1,"step__title"],[1,"step__lead"],["role","list",1,"cards"],[1,"card",3,"card--on","card--dragging","card--over"],["role","alert",1,"step__error"],[1,"step__actions"],["type","button",1,"btn","btn--ghost"],["type","button","data-testid","providers-next",1,"btn","btn--primary",3,"click","disabled"],[1,"card",3,"dragstart","dragover","drop","dragend"],[1,"card__head"],[1,"card__toggle"],["type","checkbox",3,"change","keydown","checked"],[1,"card__name"],[1,"card__desc"],[1,"field"],[1,"card__rank"],[1,"card__move"],["type","button","aria-label","Prefer this provider more",1,"card__arrow",3,"click","disabled"],["type","button","aria-label","Prefer this provider less",1,"card__arrow",3,"click","disabled"],[1,"field__label"],["type","password","autocomplete","off","spellcheck","false","placeholder","Paste your key",1,"field__input",3,"input","keydown","value"],[1,"field__hint"],["target","_blank","rel","noopener noreferrer",3,"href"],["type","button",1,"btn","btn--ghost",3,"click"]],template:function(e,o){e&1&&(gl(0,"section",0)(1,"h2",1),AC(2,"Which models do you want to use?"),ml(),gl(3,"p",2),AC(4," Pick at least one provider and paste its API key. With several, drag the cards (or use the arrows) to say which one you prefer for shared model aliases. The default alias for utility calls is currently provided only by Requesty, regardless of this order. "),ml(),gl(5,"ul",3),$w(6,De,10,14,"li",4,Oe),ml(),Bw(8,Fe,2,1,"p",5),gl(9,"div",6),Bw(10,Ve,2,0,"button",7),gl(11,"button",8),Dg("click",function(){return o.state.submitProviders()}),AC(12," Continue "),ml()()()),e&2&&(VE(6),zw(o.cards()),VE(2),Vw(o.state.error()?8:-1),VE(2),Vw(o.state.emailLocked()?-1:10),VE(),mg("disabled",!o.state.providersValid()));},styles:[".step[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.step__title[_ngcontent-%COMP%]{margin:0;font-size:18px;font-weight:620}.step__lead[_ngcontent-%COMP%]{margin:-8px 0 0;font-size:14px;color:var(--color-text-secondary);line-height:1.5}.step__error[_ngcontent-%COMP%]{margin:0;padding:10px 14px;border-radius:10px;font-size:13px;color:var(--color-error);background:color-mix(in srgb,var(--color-error) 12%,transparent)}.step__actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:8px}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.field__label[_ngcontent-%COMP%]{font-size:13px;font-weight:560}.field__hint[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-tertiary)}.field__input[_ngcontent-%COMP%]{width:100%;box-sizing:border-box;padding:12px 14px;font:inherit;color:var(--color-text);background:var(--color-input-bg);border:1px solid var(--color-border);border-radius:12px;outline:none;transition:border-color .15s,box-shadow .15s}.field__input[_ngcontent-%COMP%]:focus-visible{border-color:var(--color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--color-primary) 25%,transparent)}.field__input[aria-invalid=true][_ngcontent-%COMP%]{border-color:var(--color-error)}.btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 20px;font:inherit;font-weight:580;color:var(--color-text);background:transparent;border:1px solid var(--color-border);border-radius:12px;cursor:pointer;transition:background .15s,transform .1s,box-shadow .15s,opacity .15s}.btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.btn[_ngcontent-%COMP%]:active:not(:disabled){transform:translateY(1px)}.btn[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.btn--primary[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-primary);border-color:transparent;box-shadow:0 4px 14px color-mix(in srgb,var(--color-primary) 35%,transparent)}.btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover)}.btn--big[_ngcontent-%COMP%]{padding:16px 32px;font-size:17px;border-radius:14px}.btn--ghost[_ngcontent-%COMP%]{border-color:transparent;color:var(--color-text-secondary)}",".cards[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;margin:0;padding:0;list-style:none}.card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid var(--color-border);border-radius:14px;background:var(--color-surface-muted);transition:border-color .18s,background .18s,box-shadow .18s,transform .18s}.card--on[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--color-primary) 60%,transparent);background:color-mix(in srgb,var(--color-primary) 7%,transparent)}.card[draggable=true][_ngcontent-%COMP%]{cursor:grab}.card--dragging[_ngcontent-%COMP%]{opacity:.5;transform:scale(.99)}.card--over[_ngcontent-%COMP%]{border-color:var(--color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--color-primary) 25%,transparent)}.card__head[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px}.card__toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;flex:1;cursor:pointer}.card__toggle[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:18px;height:18px;accent-color:var(--color-primary)}.card__name[_ngcontent-%COMP%]{font-weight:620;font-size:16px}.card__rank[_ngcontent-%COMP%]{padding:2px 10px;font-size:12px;font-weight:650;border-radius:999px;color:var(--color-text-inverse);background:var(--color-primary)}.card__move[_ngcontent-%COMP%]{display:inline-flex;gap:4px}.card__arrow[_ngcontent-%COMP%]{width:28px;height:28px;font:inherit;color:var(--color-text);background:var(--color-bg-hover);border:none;border-radius:8px;cursor:pointer}.card__arrow[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:default}.card__arrow[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary)}.card__desc[_ngcontent-%COMP%]{margin:0;font-size:13px;color:var(--color-text-secondary)}a[_ngcontent-%COMP%]{color:var(--color-link)}@media(prefers-reduced-motion:reduce){.card[_ngcontent-%COMP%]{transition:none}}"]})};var ze=(t,n)=>n.name;function Ne(t,n){if(t&1){let e=Qw();gl(0,"label",3)(1,"span",7),AC(2,"Email"),ml(),gl(3,"input",8),Dg("input",function(d){pf(e);let c=tC();return hf(c.onEmail(d))}),ml(),gl(4,"span",9),AC(5,"Saved in your personal settings."),ml()();}if(t&2){let e=tC();VE(3),mg("value",e.state.profileEmail()),lg("aria-invalid",e.state.profileEmail()&&!e.state.profileEmailValid()?"true":null);}}function Le(t,n){if(t&1){let e=Qw();gl(0,"li")(1,"label",3)(2,"span",7),AC(3),ml(),gl(4,"input",11),Dg("input",function(d){let c=pf(e).$implicit,h=tC(2);return hf(h.onKey(c.name,d))}),ml(),gl(5,"span",9),AC(6,"Saved in your personal settings, used for you only."),ml()()();}if(t&2){let e=n.$implicit,o=tC(2);VE(3),Fg(e.name),VE(),mg("value",e.apiKey),lg("data-testid","user-key-"+e.name)("aria-invalid",o.keyTooShort(e.apiKey)?"true":null);}}function Ke(t,n){if(t&1&&(gl(0,"p",2),AC(1,"Paste a key for at least one of these providers, the others are optional."),ml(),gl(2,"ul",10),$w(3,Le,7,4,"li",null,ze),ml()),t&2){let e=tC();VE(3),zw(e.state.userKeys());}}function $e(t,n){if(t&1&&(gl(0,"p",4),AC(1),ml()),t&2){let e=tC();VE(),Fg(e.state.error());}}var je=8,A=class t{state=g(V);onEmail(n){this.state.setProfileEmail(n.target.value);}onKey(n,e){this.state.setUserKey(n,e.target.value);}keyTooShort(n){return n.length>0&&n.trim().length<je}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["app-user-keys-step"]],decls:12,vars:4,consts:[[1,"step"],[1,"step__title"],[1,"step__lead"],[1,"field"],["role","alert",1,"step__error"],[1,"step__actions"],["type","button","data-testid","user-keys-save",1,"btn","btn--primary",3,"click","disabled"],[1,"field__label"],["type","email","autocomplete","email","placeholder","you@company.com","data-testid","profile-email",1,"field__input",3,"input","value"],[1,"field__hint"],["role","list","data-testid","user-keys",1,"keys"],["type","password","autocomplete","off","spellcheck","false","placeholder","Paste your key",1,"field__input",3,"input","value"]],template:function(e,o){e&1&&(gl(0,"section",0)(1,"h2",1),AC(2,"Complete your profile"),ml(),gl(3,"p",2),AC(4," Your platform provides the AI providers, and Coday needs your email and at least one personal API key to start. "),ml(),Bw(5,Ne,6,2,"label",3),Bw(6,Ke,5,0),Bw(7,$e,2,1,"p",4),gl(8,"div",5),pg(9,"span"),gl(10,"button",6),Dg("click",function(){return o.state.submitProfile()}),AC(11," Save and continue "),ml()()()),e&2&&(VE(5),Vw(o.state.needsEmail()?5:-1),VE(),Vw(o.state.needsUserKeys()?6:-1),VE(),Vw(o.state.error()?7:-1),VE(3),mg("disabled",!o.state.profileValid()||o.state.busy()));},styles:[".step[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.step__title[_ngcontent-%COMP%]{margin:0;font-size:18px;font-weight:620}.step__lead[_ngcontent-%COMP%]{margin:-8px 0 0;font-size:14px;color:var(--color-text-secondary);line-height:1.5}.step__error[_ngcontent-%COMP%]{margin:0;padding:10px 14px;border-radius:10px;font-size:13px;color:var(--color-error);background:color-mix(in srgb,var(--color-error) 12%,transparent)}.step__actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:8px}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.field__label[_ngcontent-%COMP%]{font-size:13px;font-weight:560}.field__hint[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-tertiary)}.field__input[_ngcontent-%COMP%]{width:100%;box-sizing:border-box;padding:12px 14px;font:inherit;color:var(--color-text);background:var(--color-input-bg);border:1px solid var(--color-border);border-radius:12px;outline:none;transition:border-color .15s,box-shadow .15s}.field__input[_ngcontent-%COMP%]:focus-visible{border-color:var(--color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--color-primary) 25%,transparent)}.field__input[aria-invalid=true][_ngcontent-%COMP%]{border-color:var(--color-error)}.btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 20px;font:inherit;font-weight:580;color:var(--color-text);background:transparent;border:1px solid var(--color-border);border-radius:12px;cursor:pointer;transition:background .15s,transform .1s,box-shadow .15s,opacity .15s}.btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.btn[_ngcontent-%COMP%]:active:not(:disabled){transform:translateY(1px)}.btn[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.btn--primary[_ngcontent-%COMP%]{color:var(--color-text-inverse);background:var(--color-primary);border-color:transparent;box-shadow:0 4px 14px color-mix(in srgb,var(--color-primary) 35%,transparent)}.btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover)}.btn--big[_ngcontent-%COMP%]{padding:16px 32px;font-size:17px;border-radius:14px}.btn--ghost[_ngcontent-%COMP%]{border-color:transparent;color:var(--color-text-secondary)}",".keys[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;margin:0;padding:0;list-style:none}"]})};var We=(t,n)=>n.id;function Ae(t,n){t&1&&(Es(0,"p",3),AC(1),hl()),t&2&&(VE(),Dl(" Preview: ",n,". Nothing is saved and this page stays here. "));}function Ue(t,n){t&1&&(Es(0,"h1",6),AC(1,"Coday"),hl());}function He(t,n){t&1&&(Es(0,"h1",6),AC(1,"Welcome to Coday"),hl(),Es(2,"p",10),AC(3,"A few questions, then you are working with your first agent."),hl());}function Re(t,n){if(t&1&&(Es(0,"li",12)(1,"span",13),AC(2),hl(),Es(3,"span",14),AC(4),hl()()),t&2){let e=n.$implicit,o=n.$index,d=tC(2);Mg("stepper__item--active",d.state.step()===e.id)("stepper__item--done",o<d.state.stepIndex()),lg("aria-current",d.state.step()===e.id?"step":null),VE(2),Fg(o<d.state.stepIndex()?"\u2713":o+1),VE(2),Fg(e.label);}}function Ye(t,n){if(t&1&&(Es(0,"ol",7),$w(1,Re,5,7,"li",11,We),hl()),t&2){let e=tC();VE(),zw(e.steps);}}function qe(t,n){if(t&1&&(Es(0,"p",8),AC(1),hl()),t&2){let e=tC();VE(),Fg(e.state.statusError());}}function Be(t,n){t&1&&fg(0,"app-email-step");}function Ge(t,n){t&1&&fg(0,"app-providers-step");}function Je(t,n){t&1&&fg(0,"app-folder-step");}function Ze(t,n){t&1&&fg(0,"app-user-keys-step");}function Qe(t,n){t&1&&fg(0,"app-progress-step");}function Xe(t,n){if(t&1&&Bw(0,Ze,1,0,"app-user-keys-step")(1,Qe,1,0,"app-progress-step"),t&2){let e=tC();Vw(e.state.mode()==="loading"&&e.state.needsProfile()?0:1);}}var et={email:"You",providers:"Models",folder:"Files",progress:"Launch"},te=class t{state=g(V);steps=A$1.map(n=>({id:n,label:et[n]}));injector=g(he$1);route=g(W$1);ngOnInit(){this.applyTheme(),this.state.init(ee$1(this.route.snapshot.queryParamMap.get("preview")));}ngOnDestroy(){this.state.stopPolling();}applyTheme(){return B(this,null,function*(){try{let{THEME_PORT:n}=yield import('./chunk-BeAWBIRs.js').then(function(n){return n.ad});this.injector.get(n);}catch(n){}})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["app-welcome"]],decls:17,vars:7,consts:[[1,"welcome"],["aria-hidden","true",1,"welcome__aurora"],["aria-live","polite",1,"welcome__card"],["data-testid","preview-badge",1,"welcome__preview"],[1,"welcome__header"],["aria-hidden","true",1,"welcome__logo"],[1,"welcome__title"],["aria-label","Setup progress",1,"stepper"],["role","alert",1,"welcome__banner","welcome__banner--error"],[1,"welcome__step"],[1,"welcome__subtitle"],[1,"stepper__item",3,"stepper__item--active","stepper__item--done"],[1,"stepper__item"],[1,"stepper__dot"],[1,"stepper__label"]],template:function(e,o){if(e&1&&(Es(0,"main",0),fg(1,"div",1),Es(2,"section",2),Bw(3,Ae,2,1,"p",3),Es(4,"header",4)(5,"div",5),AC(6,"C"),hl(),Es(7,"div"),Bw(8,Ue,2,0,"h1",6)(9,He,4,0),hl()(),Bw(10,Ye,3,0,"ol",7),Bw(11,qe,2,1,"p",8),Es(12,"div",9),Bw(13,Be,1,0,"app-email-step")(14,Ge,1,0,"app-providers-step")(15,Je,1,0,"app-folder-step")(16,Xe,2,1),hl()()()),e&2){let d,c;VE(3),Vw((d=o.state.preview())?3:-1,d),VE(5),Vw(o.state.mode()==="loading"?8:9),VE(2),Vw(o.state.mode()==="wizard"?10:-1),VE(),Vw(o.state.statusError()&&!o.state.status()?11:-1),VE(),Mg("welcome__step--loading",o.state.mode()==="loading"),VE(),Vw((c=o.state.step())==="email"?13:c==="providers"?14:c==="folder"?15:c==="progress"?16:-1);}},dependencies:[K,W,$,j,A],styles:['[_nghost-%COMP%]{display:block;min-height:100vh;background:var(--color-bg);color:var(--color-text)}.welcome[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;min-height:100vh;padding:32px 16px;overflow:hidden}.welcome__aurora[_ngcontent-%COMP%]{position:absolute;inset:-20%;background:radial-gradient(40% 40% at 20% 25%,color-mix(in srgb,var(--color-primary) 28%,transparent),transparent 70%),radial-gradient(35% 35% at 80% 20%,color-mix(in srgb,var(--color-accent) 24%,transparent),transparent 70%),radial-gradient(45% 45% at 60% 85%,color-mix(in srgb,var(--color-info) 18%,transparent),transparent 70%);pointer-events:none}.welcome__card[_ngcontent-%COMP%]{position:relative;width:100%;max-width:640px;padding:32px;border-radius:20px;background:var(--glass-bg);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);animation:_ngcontent-%COMP%_rise .48s cubic-bezier(.2,.8,.2,1) both}.welcome__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:16px;margin-bottom:24px}.welcome__preview[_ngcontent-%COMP%]{margin:0 0 16px;padding:6px 12px;border-radius:8px;font-size:12px;font-weight:560;color:var(--color-text-secondary);background:color-mix(in srgb,var(--color-warning) 14%,transparent)}.welcome__logo[_ngcontent-%COMP%]{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;font-size:24px;font-weight:700;color:var(--color-text-inverse);background:linear-gradient(135deg,var(--color-primary),var(--color-accent));box-shadow:0 6px 18px color-mix(in srgb,var(--color-primary) 40%,transparent)}.welcome__title[_ngcontent-%COMP%]{margin:0;font-size:24px;font-weight:650;letter-spacing:-.02em}.welcome__subtitle[_ngcontent-%COMP%]{margin:2px 0 0;color:var(--color-text-secondary);font-size:14px}.welcome__banner[_ngcontent-%COMP%]{margin:0 0 16px;padding:10px 14px;border-radius:10px;font-size:13px}.welcome__banner--error[_ngcontent-%COMP%]{color:var(--color-error);background:color-mix(in srgb,var(--color-error) 12%,transparent)}.welcome__step[_ngcontent-%COMP%]{min-height:280px;animation:_ngcontent-%COMP%_fade .24s ease both}.welcome__step--loading[_ngcontent-%COMP%]{min-height:0}.stepper[_ngcontent-%COMP%]{display:flex;gap:8px;margin:0 0 28px;padding:0;list-style:none}.stepper__item[_ngcontent-%COMP%]{display:flex;flex:1;align-items:center;gap:8px;font-size:12px;font-weight:500;color:var(--color-text-tertiary);transition:color .2s}.stepper__item[_ngcontent-%COMP%]:after{content:"";flex:1;height:2px;border-radius:2px;background:var(--color-border)}.stepper__item[_ngcontent-%COMP%]:last-child:after{display:none}.stepper__item--active[_ngcontent-%COMP%]{color:var(--color-text)}.stepper__item--done[_ngcontent-%COMP%]{color:var(--color-success)}.stepper__item--done[_ngcontent-%COMP%]:after{background:var(--color-success)}.stepper__dot[_ngcontent-%COMP%]{display:grid;place-items:center;flex:none;width:24px;height:24px;border-radius:50%;font-size:12px;border:1.5px solid currentColor;transition:background .2s,color .2s}.stepper__item--active[_ngcontent-%COMP%] .stepper__dot[_ngcontent-%COMP%]{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.stepper__item--done[_ngcontent-%COMP%] .stepper__dot[_ngcontent-%COMP%]{background:var(--color-success);border-color:var(--color-success);color:var(--color-text-inverse)}@media(max-width:520px){.welcome__card[_ngcontent-%COMP%]{padding:22px 18px}.stepper__label[_ngcontent-%COMP%]{display:none}}@media(prefers-reduced-motion:reduce){.welcome__card[_ngcontent-%COMP%], .welcome__step[_ngcontent-%COMP%]{animation:none}}@keyframes _ngcontent-%COMP%_rise{0%{opacity:0;transform:translateY(14px)}}@keyframes _ngcontent-%COMP%_fade{0%{opacity:0}}']})};
|
|
2
|
+
export{te as WelcomeComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-DxjesQXu.js';import {B as s,v as vn,d as yn,k as dn,_ as _n,i as at,m as mn,A as Ao,F as Ni,G as On}from'./chunk-BeAWBIRs.js';import {g,W,t as F,K as we,$ as $i,o as oT,U,ac as by,a2 as ha,aa as br,D as Dw,au as $t,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,i as Vw,v as tC,P as dg,Q as Qw,f as fg,av as QC,F as Fg,u as Dl,aw as XC,q as $w,z as zw,ao as Uw,w as pf,x as hf,ax as YD}from'./main-P6EOYPYG.js';var Y=(e,t)=>t.name+t.grant;function Z(e,t){if(e&1&&(Es(0,"a",2),AC(1,"Edit skill \u2192"),hl()),e&2){let n=tC();dg("routerLink",n.editRoute());}}function ee(e,t){e&1&&(Es(0,"ds-tag",3),AC(1,"Platform level"),hl());}function te(e,t){e&1&&(Es(0,"p",4),AC(1,"Loading\u2026"),hl());}function ne(e,t){e&1&&(Es(0,"ds-notice"),AC(1,"Failed to load skill."),hl());}function ie(e,t){if(e&1&&(Es(0,"dt"),AC(1,"Created by"),hl(),Es(2,"dd"),AC(3),hl()),e&2){let n=tC(2);VE(3),Fg(n.createdBy);}}function oe(e,t){if(e&1&&(Es(0,"dt"),AC(1,"Last updated"),hl(),Es(2,"dd"),AC(3),hl()),e&2){let n=tC(2);VE(3),Fg(n.updatedOn);}}function ae(e,t){if(e&1&&(Bw(0,ie,4,1),Bw(1,oe,4,1)),e&2){let n=tC();Vw(n.createdBy?0:-1),VE(),Vw(n.updatedOn?1:-1);}}function le(e,t){e&1&&(Es(0,"p",4),AC(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),hl());}function se(e,t){e&1&&(Es(0,"p",4),AC(1,"Loading\u2026"),hl());}function re(e,t){e&1&&(Es(0,"ds-notice"),AC(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),hl());}function de(e,t){e&1&&(Es(0,"p",4),AC(1,"No agent references this skill."),hl());}function ce(e,t){e&1&&(Es(0,"ds-tag",15),AC(1,"platform agent"),hl());}function me(e,t){e&1&&(Es(0,"ds-tag",15),AC(1,"via *"),hl());}function pe(e,t){if(e&1&&(Es(0,"li",13)(1,"span",14),AC(2),hl(),Bw(3,ce,2,0,"ds-tag",15),Bw(4,me,2,0,"ds-tag",15),hl()),e&2){let n=t.$implicit;VE(2),Fg(n.name),VE(),Vw(n.platform?3:-1),VE(),Vw(n.grant==="all"?4:-1);}}function ue(e,t){if(e&1&&(Es(0,"ul",12),$w(1,pe,5,3,"li",13,Y),hl(),Es(3,"p",4),AC(4," An agent listed "),Es(5,"code"),AC(6,"via *"),hl(),AC(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),hl()),e&2){let n=tC(2);VE(),zw(n.consumers());}}function _e(e,t){e&1&&(Es(0,"p",4),AC(1,"No resources bundled with this skill."),hl());}function ge(e,t){if(e&1){let n=Qw();Es(0,"li")(1,"ds-disclosure",16),vg("toggled",function(){let r=pf(n).$implicit,g=tC(3);return hf(g.toggleResource(r))}),Es(2,"pre",17),AC(3),hl()()();}if(e&2){let n=t.$implicit,o=tC(3);VE(),dg("heading",n)("open",o.isResourceExpanded(n)),VE(2),Fg(o.resourceContent(n));}}function Ce(e,t){if(e&1&&(Es(0,"ul",12),$w(1,ge,4,3,"li",null,Uw),hl()),e&2){let n=tC(2);VE(),zw(n.resourcePaths());}}function fe(e,t){if(e&1){let n=Qw();Es(0,"ds-card",5)(1,"dl",6)(2,"dt"),AC(3,"Name"),hl(),Es(4,"dd",7),AC(5),hl(),Es(6,"dt"),AC(7,"Description"),hl(),Es(8,"dd"),AC(9),hl(),Es(10,"dt"),AC(11,"Scope"),hl(),Es(12,"dd"),AC(13),hl(),Es(14,"dt"),AC(15,"Storage"),hl(),Es(16,"dd")(17,"ds-tag",8),AC(18),hl()(),Bw(19,ae,2,2),hl()(),Es(20,"ds-card",9),Bw(21,le,2,0,"p",4)(22,se,2,0,"p",4)(23,re,2,0,"ds-notice")(24,de,2,0,"p",4)(25,ue,8,0),hl(),Es(26,"ds-card")(27,"ds-disclosure",10),vg("toggled",function(){pf(n);let r=tC();return hf(r.toggleBody())}),fg(28,"div",11),QC(29,"agentosMarkdown"),hl()(),Es(30,"ds-card",9),Bw(31,_e,2,0,"p",4)(32,Ce,3,0,"ul",12),hl();}if(e&2){let n=t,o=tC();VE(5),Fg(n.name),VE(4),Fg(n.description),VE(4),Fg(n.namespaceId?"Namespace":"Platform"),VE(4),dg("variant",o.isFilesystemBacked()?"outline":"neutral"),VE(),Dl(" ",o.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),VE(),Vw(o.isFilesystemBacked()?-1:19),VE(),dg("heading","Used by"+(!o.isPlatformMode&&!o.consumersLoading()&&!o.consumersUnavailable()?" ("+o.consumers().length+")":"")),VE(),Vw(o.isPlatformMode?21:o.consumersLoading()?22:o.consumersUnavailable()?23:o.consumers().length===0?24:25),VE(6),dg("open",!o.bodyCollapsed()),VE(),dg("innerHTML",XC(29,12,n.body),YD),VE(2),dg("heading","Resources ("+o.resourcePaths().length+")"),VE(),Vw(o.resourcePaths().length===0?31:32);}}var X=class e{route=g(W);router=g(F);destroyRef=g(we);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);skill=$i(null);bodyCollapsed=$i(false);expandedResources=$i(new Set);resourcePaths=oT(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=oT(()=>this.skill()?.readOnly===true);consumers=$i([]);consumersUnavailable=$i(false);consumersLoading=$i(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:t=>{this.skill.set(t),this.isLoading.set(false),this.loadConsumers(t.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(t){this.namespaceId&&(this.consumersLoading.set(true),by({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ha(()=>br([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:n,platform:o})=>{let r=[...this.toConsumers(n,t,false),...this.toConsumers(o,t,true)];this.consumers.set([...r.filter(g=>g.grant==="named"),...r.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(t,n,o){return t.map(r=>({config:r,grant:a(r.skillSelectors,n)})).filter(r=>r.grant!=="none").map(({config:r,grant:g})=>({name:r.name,grant:g,platform:o}))}toggleBody(){this.bodyCollapsed.update(t=>!t);}toggleResource(t){this.expandedResources.update(n=>{let o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o});}isResourceExpanded(t){return this.expandedResources().has(t)}resourceContent(t){return this.skill()?.resources?.[t]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Dw({type:e,selectors:[["agentos-skill-inspect"]],decls:9,vars:3,consts:[["title","Skill"],["dsButton","","variant","ghost","type","button","title","Back to skills",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[3,"variant"],[3,"heading"],["heading","Body",3,"toggled","open"],[1,"ds-pre","ds-pre--prose","ds-prose",3,"innerHTML"],[1,"ds-list"],[1,"ds-inline","ds-inline--wrap"],[1,"ds-strong"],["variant","neutral"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-pre"]],template:function(n,o){if(n&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return o.back()}),AC(3,"\u2190 Skills"),hl(),Bw(4,Z,2,1,"a",2),Bw(5,ee,2,0,"ds-tag",3),hl(),Bw(6,te,2,0,"p",4)(7,ne,2,0,"ds-notice")(8,fe,33,14),hl()),n&2){let r;VE(4),Vw(o.skill()&&!o.isFilesystemBacked()?4:-1),VE(),Vw(o.isPlatformMode?5:-1),VE(),Vw(o.isLoading()?6:o.hasError()?7:(r=o.skill())?8:-1,r);}},dependencies:[$t,vn,yn,dn,_n,at,mn,Ao,Ni,On],encapsulation:2})};export{X as SkillInspectComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v}from'./chunk-t-Kfnaoc.js';import {I,n as nt,i as it}from'./chunk-DGU69dIe.js';import {g,W,F,v as we,M as Mi,ad as F$1,i as VC,s as sf,x as U,E as x,C as w,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,R as Rw,T as Tw,as as bw,N as lI,H as Hh,L as Lw,Q as fI,_ as _w,Y as Yu,ai as Dw,l as lg,h as Bh,P as Pd,n as Ld}from'./main-OQ262YIZ.js';import {T as Te,b as bn,p as pt,v as vn,d as yn,e as fn,n as pn,h as hn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn}from'./chunk-DvtbHzPu.js';import'./chunk-iZXu2H1x.js';function Ce(i,t){i&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function ye(i,t){if(i&1&&(os(0,"label",16),Hh(1,"input",17),lI(),pC(2),zu()),i&2){let e=t.$implicit,n=Lw(3);IE(),Vh("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),fI(),IE(),Yu(" ",e.label," ");}}function ge(i,t){if(i&1&&(os(0,"ds-fieldset",5),Tw(1,ye,3,4,"label",16,Dw().trackByScope,true),zu()),i&2){let e=Lw(2);Vh("disabled",e.isEditMode()),IE(),_w(e.scopeOptions);}}function fe(i,t){if(i&1&&(os(0,"option",8),pC(1),zu()),i&2){let e=t.$implicit,n=Lw(2);Vh("value",e),IE(),lg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(os(0,"ds-form-field",18),Hh(1,"input",19),lI(),zu()),i&2){let e=Lw().$implicit;Vh("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),IE(),Vh("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Bh("aria-describedby",e.hint?"as-hint-"+e.key:null),fI();}}function Ae(i,t){if(i&1&&Iw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=Lw(3);ww((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(os(0,"ds-fieldset",13),Tw(1,Ae,1,1,null,null,Dw().trackByField,true),zu()),i&2){let e=Lw(2);Vh("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),IE(),_w(e.credentialFields());}}function be(i,t){if(i&1){let e=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let o=Lw();return Ld(o.submit())}),Iw(1,ge,3,1,"ds-fieldset",5),os(2,"ds-form-field",6)(3,"select",7),Tw(4,fe,2,2,"option",8,bw),zu(),lI(),zu(),os(6,"ds-form-field",9),Hh(7,"input",10),lI(),zu(),os(8,"ds-form-field",11),Hh(9,"input",12),lI(),zu(),Iw(10,ve,3,1,"ds-fieldset",13),os(11,"ds-form-actions")(12,"button",14),pC(13),zu(),os(14,"button",15),qh("click",function(){Pd(e);let o=Lw();return Ld(o.cancel())}),pC(15,"Cancel"),zu()()();}if(i&2){let e=Lw();Vh("formGroup",e.form),IE(),ww(e.isPlatformMode?-1:1),IE(2),Vh("formControl",e.authTypeControl),fI(),IE(),_w(e.authTypeOptions),IE(3),Vh("formControl",e.nameControl),fI(),IE(2),Vh("formControl",e.descriptionControl),fI(),IE(),ww(e.credentialFields().length>0?10:-1),IE(2),Vh("disabled",e.form.invalid||e.isSubmitting()),IE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={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}]},me=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Mi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[bn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=VC(()=>_e[this.selectedAuthType()]);isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||sf(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.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,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;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,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{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 x(w({},o),{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 x(w({},o),{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 x(w({},o),{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=ew({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return n.cancel()}),pC(3," \u2190 Auth settings "),zu()(),Iw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),zu()),e&2&&(IE(),Vh("title",n.isEditMode()?"Edit auth setting":"New auth setting"),IE(3),ww(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn],encapsulation:2})};
|
|
1
|
+
import {v}from'./chunk-fbDk9ppW.js';import {I,n as nt,i as it}from'./chunk-Db_G9wnV.js';import {g,W,t as F,K as we,$ as $i,a9 as F$1,o as oT,O as Of,U,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,Q as Qw,q as $w,ao as Uw,S as NI,f as fg,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,n as lg,w as pf,x as hf}from'./main-P6EOYPYG.js';import {T as Te,b as bn,p as pt,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn}from'./chunk-BeAWBIRs.js';import'./chunk-Cq9rgtVx.js';function Ce(i,t){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function ye(i,t){if(i&1&&(Es(0,"label",16),fg(1,"input",17),NI(),AC(2),hl()),i&2){let e=t.$implicit,n=tC(3);VE(),dg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Es(0,"ds-fieldset",5),$w(1,ye,3,4,"label",16,Lw().trackByScope,true),hl()),i&2){let e=tC(2);dg("disabled",e.isEditMode()),VE(),zw(e.scopeOptions);}}function fe(i,t){if(i&1&&(Es(0,"option",8),AC(1),hl()),i&2){let e=t.$implicit,n=tC(2);dg("value",e),VE(),Fg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Es(0,"ds-form-field",18),fg(1,"input",19),NI(),hl()),i&2){let e=tC().$implicit;dg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),VE(),dg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),lg("aria-describedby",e.hint?"as-hint-"+e.key:null),AI();}}function Ae(i,t){if(i&1&&Bw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=tC(3);Vw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Es(0,"ds-fieldset",13),$w(1,Ae,1,1,null,null,Lw().trackByField,true),hl()),i&2){let e=tC(2);dg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),VE(),zw(e.credentialFields());}}function be(i,t){if(i&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let o=tC();return hf(o.submit())}),Bw(1,ge,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),$w(4,fe,2,2,"option",8,Uw),hl(),NI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),NI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),NI(),hl(),Bw(10,ve,3,1,"ds-fieldset",13),Es(11,"ds-form-actions")(12,"button",14),AC(13),hl(),Es(14,"button",15),vg("click",function(){pf(e);let o=tC();return hf(o.cancel())}),AC(15,"Cancel"),hl()()();}if(i&2){let e=tC();dg("formGroup",e.form),VE(),Vw(e.isPlatformMode?-1:1),VE(2),dg("formControl",e.authTypeControl),AI(),VE(),zw(e.authTypeOptions),VE(3),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.credentialFields().length>0?10:-1),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={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}]},me=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[bn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=oT(()=>_e[this.selectedAuthType()]);isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Of(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.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,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;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,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{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 x(w({},o),{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 x(w({},o),{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 x(w({},o),{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=Dw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Auth settings "),hl()(),Bw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),hl()),e&2&&(VE(),dg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn],encapsulation:2})};
|
|
2
2
|
export{me as AuthSettingFormComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,a6 as gd,a as fd,U as Ut,c as fo,g as go,a7 as uo,a8 as _a,a9 as pa,v as vn,d as yn,e as fn,_ as _n,i as at,u as un,V as Vo,aa as f$1}from'./chunk-BeAWBIRs.js';import {g,W,aM as Y,$ as $i,ab as le,O as Of,D as Dw,aN as Eb,E as Es,f as fg,a as Bw,c as hl,d as VE,i as Vw,ak as yd,a1 as ga,a3 as rn,ac as by,a2 as ha,b as AC,Q as Qw,R as vg,aO as Hg,S as NI,v as tC,aP as Vg,T as AI,q as $w,z as zw,aQ as GC,aR as zC,F as Fg,n as lg,av as QC,aw as XC,as as Pg,u as Dl,aS as JC,w as pf,x as hf,aT as LC}from'./main-P6EOYPYG.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Es(0,"p",2),AC(1,"Loading usage settings\u2026"),hl());}function fe(e,a){if(e&1){let t=Qw();Es(0,"ds-notice"),AC(1,"Could not load usage settings. Please try again."),hl(),Es(2,"div")(3,"button",3),vg("click",function(){pf(t);let s=tC();return hf(s.configuration.retry())}),AC(4,"Retry usage settings"),hl()();}}function ye(e,a){e&1&&(Es(0,"p",2),AC(1,"Usage tracking is disabled."),hl());}function be(e,a){e&1&&(Es(0,"ds-notice"),AC(1),hl()),e&2&&(VE(),Fg(a));}function xe(e,a){e&1&&(Es(0,"p",2),AC(1,"Loading usage\u2026"),hl());}function he(e,a){e&1&&(Es(0,"p",12),AC(1,"No recorded usage for this period."),hl());}function Se(e,a){if(e&1&&(Es(0,"p",10),AC(1),hl()),e&2){let t=tC().$implicit;VE(),Dl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Es(0,"tr",16)(1,"td",18),AC(2),hl(),Es(3,"td",19),AC(4),QC(5,"number"),hl(),Es(6,"td",20),AC(7),QC(8,"number"),QC(9,"number"),hl(),Es(10,"td",21),AC(11),QC(12,"number"),QC(13,"number"),hl(),Es(14,"td",22),AC(15),QC(16,"agentosCost"),Bw(17,Se,2,1,"p",10),hl()()),e&2){let t=a.$implicit;VE(2),Fg(t.key),VE(2),Fg(XC(5,8,t.aggregate.totalTokens)),VE(3),Pg(" ",XC(8,10,t.aggregate.inputTokens)," / ",XC(9,12,t.aggregate.outputTokens)," "),VE(4),Pg(" ",XC(12,14,t.aggregate.cacheReadTokens)," / ",XC(13,16,t.aggregate.cacheWriteTokens)," "),VE(4),Dl(" ",JC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),VE(2),Vw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Es(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),AC(5,"Name"),hl(),Es(6,"th",17),AC(7,"Tokens"),hl(),Es(8,"th",17),AC(9,"Input / output"),hl(),Es(10,"th",17),AC(11,"Cache read / write"),hl(),Es(12,"th",17),AC(13,"Estimated cost"),hl()()(),Es(14,"tbody",15),$w(15,we,18,21,"tr",16,_e),hl()()()),e&2){let t=tC().$implicit;VE(),lg("aria-label","Usage "+t.title.toLowerCase()),VE(14),zw(t.rows);}}function Ne(e,a){if(e&1&&(Es(0,"h3",11),AC(1),hl(),Bw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;VE(),Fg(t.title),VE(),Vw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&($w(0,Ne,4,2,null,null,ue),Es(2,"p",10),AC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),hl()),e&2){let t=tC(2);zw(GC(4,ge,zC(0,ce,t.agents()),zC(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let s=tC();return hf(s.load())}),Es(1,"ds-form-field",5)(2,"input",6),Hg("ngModelChange",function(s){pf(t);let m=tC();return LC(m.from,s)||(m.from=s),hf(s)}),hl(),NI(),hl(),Es(3,"ds-form-field",7)(4,"input",8),Hg("ngModelChange",function(s){pf(t);let m=tC();return LC(m.to,s)||(m.to=s),hf(s)}),hl(),NI(),hl(),Es(5,"button",9),AC(6,"Refresh"),hl()(),Bw(7,be,2,1,"ds-notice"),Bw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=tC();VE(2),Vg("ngModel",r.from),AI(),VE(2),Vg("ngModel",r.to),AI(),VE(3),Vw((t=r.error())?7:-1,t),VE(),Vw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=$i([]);models=$i([]);error=$i(null);loading=$i(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Of(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(yd(void 0),ga(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),rn):(this.loading.set(true),by({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ha(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),rn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=Dw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),Bw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),hl()),t&2&&(VE(2),Vw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[gd,fd,Ut,fo,go,uo,_a,pa,vn,yn,fn,_n,at,un,Vo,Eb,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-BjTEffSr.js';import {v}from'./chunk-t-Kfnaoc.js';import {g,W,F,v as we,M as Mi,ad as F$1,ar as Ue,s as sf,x as U,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,R as Rw,T as Tw,as as bw,N as lI,H as Hh,aq as Cw,L as Lw,Q as fI,_ as _w,Y as Yu,ai as Dw,l as lg,P as Pd,n as Ld}from'./main-OQ262YIZ.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,n as pn,h as hn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,z as yo,B as bo}from'./chunk-DvtbHzPu.js';import'./chunk-iZXu2H1x.js';function ge(o,t){o&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function be(o,t){if(o&1&&(os(0,"label",23),Hh(1,"input",24),lI(),pC(2),zu()),o&2){let e=t.$implicit,r=Lw(3);IE(),Vh("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),fI(),IE(),Yu(" ",e.label," ");}}function _e(o,t){if(o&1&&(os(0,"ds-fieldset",5),Tw(1,be,3,4,"label",23,Dw().trackByScope,true),zu()),o&2){let e=Lw(2);Vh("disabled",e.isEditMode()),IE(),_w(e.scopeOptions);}}function Ae(o,t){if(o&1&&(os(0,"option",8),pC(1),zu()),o&2){let e=t.$implicit;Vh("value",e),IE(),lg(e);}}function Se(o,t){if(o&1){let e=Rw();os(0,"div",19),Hh(1,"input",25),lI(),Hh(2,"input",26),lI(),os(3,"button",27),qh("click",function(){let l=Pd(e).$index,f=Lw(2);return Ld(f.removeHeader(l))}),pC(4," \xD7 "),zu()();}if(o&2){let e=t.$index;Vh("formGroupName",e),IE(),fI(),IE(),fI();}}function Pe(o,t){if(o&1){let e=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let l=Lw();return Ld(l.submit())}),Iw(1,_e,3,1,"ds-fieldset",5),os(2,"ds-form-field",6)(3,"select",7),Tw(4,Ae,2,2,"option",8,bw),zu(),lI(),zu(),os(6,"ds-form-field",9),Hh(7,"input",10),lI(),zu(),os(8,"ds-form-field",11),Hh(9,"input",12),lI(),zu(),os(10,"ds-form-field",13),Hh(11,"input",14),lI(),zu(),os(12,"ds-form-field",15),Hh(13,"input",16),lI(),zu(),os(14,"ds-form-field",17)(15,"div",18),Tw(16,Se,5,1,"div",19,Cw),os(18,"div")(19,"button",20),qh("click",function(){Pd(e);let l=Lw();return Ld(l.addHeader())}),pC(20,"+ Add header"),zu()()()(),os(21,"ds-form-actions")(22,"button",21),pC(23),zu(),os(24,"button",22),qh("click",function(){Pd(e);let l=Lw();return Ld(l.cancel())}),pC(25,"Cancel"),zu()()();}if(o&2){let e=Lw();Vh("formGroup",e.form),IE(),ww(e.isPlatformMode?-1:1),IE(2),Vh("formControl",e.apiTypeControl),fI(),IE(),_w(e.apiTypeOptions),IE(3),Vh("formControl",e.nameControl),fI(),IE(2),Vh("formControl",e.descriptionControl),fI(),IE(2),Vh("formControl",e.baseUrlControl),fI(),IE(2),Vh("formControl",e.apiKeyControl),fI(),IE(2),Vh("formArrayName","headers"),IE(),_w(e.headersArray.controls),IE(6),Vh("disabled",e.form.invalid||e.isSubmitting()),IE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Mi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Ue);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||sf(()=>{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,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}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(`[AiProviderForm] Could not load provider '${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.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] 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){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=ew({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return r.cancel()}),pC(3," \u2190 AI providers "),zu()(),Iw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),zu()),e&2&&(IE(),Vh("title",r.isEditMode()?"Edit AI provider":"New AI provider"),IE(3),ww(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
|
|
1
|
+
import {O}from'./chunk-jfM6q-6w.js';import {v}from'./chunk-fbDk9ppW.js';import {g,W,t as F,K as we,$ as $i,a9 as F$1,an as $e,O as Of,U,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,Q as Qw,q as $w,ao as Uw,S as NI,f as fg,am as Hw,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,w as pf,x as hf}from'./main-P6EOYPYG.js';import {p as pt,W as Wt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo}from'./chunk-BeAWBIRs.js';import'./chunk-Cq9rgtVx.js';function ge(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function be(o,t){if(o&1&&(Es(0,"label",23),fg(1,"input",24),NI(),AC(2),hl()),o&2){let e=t.$implicit,r=tC(3);VE(),dg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),AI(),VE(),Dl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Es(0,"ds-fieldset",5),$w(1,be,3,4,"label",23,Lw().trackByScope,true),hl()),o&2){let e=tC(2);dg("disabled",e.isEditMode()),VE(),zw(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Es(0,"option",8),AC(1),hl()),o&2){let e=t.$implicit;dg("value",e),VE(),Fg(e);}}function Se(o,t){if(o&1){let e=Qw();Es(0,"div",19),fg(1,"input",25),NI(),fg(2,"input",26),NI(),Es(3,"button",27),vg("click",function(){let l=pf(e).$index,f=tC(2);return hf(f.removeHeader(l))}),AC(4," \xD7 "),hl()();}if(o&2){let e=t.$index;dg("formGroupName",e),VE(),AI(),VE(),AI();}}function Pe(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let l=tC();return hf(l.submit())}),Bw(1,_e,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),$w(4,Ae,2,2,"option",8,Uw),hl(),NI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),NI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),NI(),hl(),Es(10,"ds-form-field",13),fg(11,"input",14),NI(),hl(),Es(12,"ds-form-field",15),fg(13,"input",16),NI(),hl(),Es(14,"ds-form-field",17)(15,"div",18),$w(16,Se,5,1,"div",19,Hw),Es(18,"div")(19,"button",20),vg("click",function(){pf(e);let l=tC();return hf(l.addHeader())}),AC(20,"+ Add header"),hl()()()(),Es(21,"ds-form-actions")(22,"button",21),AC(23),hl(),Es(24,"button",22),vg("click",function(){pf(e);let l=tC();return hf(l.cancel())}),AC(25,"Cancel"),hl()()();}if(o&2){let e=tC();dg("formGroup",e.form),VE(),Vw(e.isPlatformMode?-1:1),VE(2),dg("formControl",e.apiTypeControl),AI(),VE(),zw(e.apiTypeOptions),VE(3),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.baseUrlControl),AI(),VE(2),dg("formControl",e.apiKeyControl),AI(),VE(2),dg("formArrayName","headers"),VE(),zw(e.headersArray.controls),VE(6),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values($e);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[bn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Wt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[bn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Of(()=>{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,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}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(`[AiProviderForm] Could not load provider '${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.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] 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){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[bn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3," \u2190 AI providers "),hl()(),Bw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),VE(3),Vw(r.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn,Ea,yo,bo],encapsulation:2})};export{ye as AiProviderFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {v}from'./chunk-t-Kfnaoc.js';import {I}from'./chunk-DGU69dIe.js';import {O}from'./chunk-RltTZwlz.js';import {g,W,F,v as we,ac as _,ad as F$1,ae as Dr,M as Mi,af as ue,i as VC,a5 as Ys,x as U,s as sf,ag as Gm,a as ew,o as os,K as qh,b as pC,z as zu,I as Iw,c as IE,J as Vh,w as ww,a6 as Zs,ah as te,R as Rw,T as Tw,ai as Dw,N as lI,H as Hh,L as Lw,_ as _w,Q as fI,Y as Yu,l as lg,P as Pd,n as Ld}from'./main-OQ262YIZ.js';import {p as pt,T as Te$1,b as bn,v as vn,d as yn,e as fn,n as pn,h as hn,l as dn,i as at,u as un,o as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,q as Mn,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,Y as Yt}from'./chunk-DvtbHzPu.js';import'./chunk-iZXu2H1x.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(os(0,"p",2),pC(1,"Loading\u2026"),zu());}function xe(i,e){if(i&1&&(os(0,"label",6),Hh(1,"input",22),lI(),pC(2),zu()),i&2){let t=e.$implicit,n=Lw(2);IE(),Vh("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),fI(),IE(),Yu(" ",t.label," ");}}function Ie(i,e){if(i&1&&(os(0,"option",10),pC(1),zu()),i&2){let t=e.$implicit;Vh("value",t.type),IE(),lg(t.displayName);}}function Ne(i,e){if(i&1&&(os(0,"option",10),pC(1),zu()),i&2){let t=e.$implicit;Vh("value",t.value),IE(),lg(t.label);}}function Ae(i,e){if(i&1&&(os(0,"div",18)(1,"label",6),Hh(2,"input",23),lI(),pC(3," Grant automatically "),zu(),os(4,"p",2),pC(5),zu()()),i&2){let t=Lw(2);IE(2),Vh("formControl",t.autoGrantControl),fI(),IE(3),Yu(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Rw();os(0,"ds-card")(1,"ds-json-schema-form",24),qh("valueChange",function(a){Pd(t);let p=Lw(2);return Ld(p.onParamsChange(a))}),zu()();}if(i&2){let t=Lw(2);IE(),Vh("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Rw();os(0,"button",25),qh("click",function(){Pd(t);let a=Lw(2);return Ld(a.exportYaml())}),pC(1),zu();}if(i&2){let t=Lw(2);Vh("disabled",t.isExporting()),IE(),Yu(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Rw();os(0,"form",4),qh("ngSubmit",function(){Pd(t);let a=Lw();return Ld(a.submit())}),os(1,"ds-fieldset",5),Tw(2,xe,3,4,"label",6,Dw().trackByScope,true),zu(),os(4,"ds-form-field",7)(5,"select",8)(6,"option",9),pC(7,"Select type"),zu(),Tw(8,Ie,2,2,"option",10,Dw().trackByType,true),zu(),lI(),zu(),os(10,"ds-form-field",11),Hh(11,"input",12),lI(),zu(),os(12,"ds-form-field",13),Hh(13,"textarea",14),lI(),zu(),os(14,"ds-form-field",15)(15,"select",16)(16,"option",17),pC(17,"None"),zu(),Tw(18,Ne,2,2,"option",10,be),zu(),lI(),zu(),Iw(20,Ae,6,2,"div",18),Iw(21,Ee,2,2,"ds-card"),os(22,"ds-form-actions")(23,"button",19),pC(24),zu(),Iw(25,Fe,2,2,"button",20),os(26,"button",21),qh("click",function(){Pd(t);let a=Lw();return Ld(a.cancel())}),pC(27,"Cancel"),zu()()();}if(i&2){let t,n=Lw();Vh("formGroup",n.form),IE(),Vh("disabled",n.isEditMode()),IE(),_w(n.scopeOptions),IE(3),Vh("formControl",n.typeControl),fI(),IE(3),_w(n.integrationTypes()),IE(3),Vh("formControl",n.nameControl),fI(),IE(2),Vh("formControl",n.descriptionControl),fI(),IE(2),Vh("formControl",n.authSettingNameControl),fI(),IE(),Vh("ngValue",null),IE(2),_w(n.authSettingOptions()),IE(2),ww(n.isAutoGrantable()?20:-1),IE(),ww((t=n.schema())?21:-1,t),IE(2),Vh("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),IE(),Yu(" ",n.isEditMode()?"Save changes":"Create"," "),IE(),ww(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Dr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[bn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);isExporting=Mi(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Mi([]);authSettingsLoaded=Mi(false);savedAuthSettingName=Mi(null);authSettingsScope$=new ue;authSettingOptions=VC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Mi(null);initialParams=Mi(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=VC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=VC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=VC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(Ys(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),sf(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(Zs(()=>Dr([])),te(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Gm([a,n]):Gm([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=ew({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return n.cancel()}),pC(3," \u2190 Integrations "),zu()(),Iw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),zu()),t&2&&(IE(),Vh("title",n.isEditMode()?"Edit integration":"New integration"),IE(3),ww(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,dn,at,un,cn,Kt,fd,Mo,Do,Ut,Mn,Qt,Ca,fo,go,Nn,Rn,Yt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
1
|
+
import {v}from'./chunk-fbDk9ppW.js';import {I}from'./chunk-Db_G9wnV.js';import {O}from'./chunk-BeGVJrPy.js';import {g,W,t as F,K as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,o as oT,a1 as ga,U,O as Of,ac as by,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,a2 as ha,ad as ne,Q as Qw,q as $w,ae as Lw,S as NI,f as fg,v as tC,z as zw,T as AI,u as Dl,F as Fg,w as pf,x as hf}from'./main-P6EOYPYG.js';import {p as pt,T as Te$1,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,k as dn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn,Y as Yt}from'./chunk-BeAWBIRs.js';import'./chunk-Cq9rgtVx.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),NI(),AC(2),hl()),i&2){let t=e.$implicit,n=tC(2);VE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),VE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),VE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),NI(),AC(3," Grant automatically "),hl(),Es(4,"p",2),AC(5),hl()()),i&2){let t=tC(2);VE(2),dg("formControl",t.autoGrantControl),AI(),VE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Qw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=tC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=tC(2);VE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let a=tC(2);return hf(a.exportYaml())}),AC(1),hl();}if(i&2){let t=tC(2);dg("disabled",t.isExporting()),VE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=tC();return hf(a.submit())}),Es(1,"ds-fieldset",5),$w(2,xe,3,4,"label",6,Lw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),AC(7,"Select type"),hl(),$w(8,Ie,2,2,"option",10,Lw().trackByType,true),hl(),NI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),NI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),NI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),AC(17,"None"),hl(),$w(18,Ne,2,2,"option",10,be),hl(),NI(),hl(),Bw(20,Ae,6,2,"div",18),Bw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),AC(24),hl(),Bw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=tC();return hf(a.cancel())}),AC(27,"Cancel"),hl()()();}if(i&2){let t,n=tC();dg("formGroup",n.form),VE(),dg("disabled",n.isEditMode()),VE(),zw(n.scopeOptions),VE(3),dg("formControl",n.typeControl),AI(),VE(3),zw(n.integrationTypes()),VE(3),dg("formControl",n.nameControl),AI(),VE(2),dg("formControl",n.descriptionControl),AI(),VE(2),dg("formControl",n.authSettingNameControl),AI(),VE(),dg("ngValue",null),VE(2),zw(n.authSettingOptions()),VE(2),Vw(n.isAutoGrantable()?20:-1),VE(),Vw((t=n.schema())?21:-1,t),VE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),VE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),VE(),Vw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[bn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=oT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=oT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Integrations "),hl()(),Bw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(VE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,dn,at,un,cn,Kt,fd,Mo,Do,Ut,Mn,Qt,Ca,fo,go,Nn,Rn,Yt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {p as pt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,Z as Zr,N as Nn,R as Rn,E as Ea}from'./chunk-BeAWBIRs.js';import {g,W,t as F,K as we,aq as k,ap as F$1,a9 as F$2,a2 as ha,aa as br,ar as Ne,o as oT,$ as $i,O as Of,U,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,Q as Qw,f as fg,S as NI,q as $w,ao as Uw,v as tC,T as AI,z as zw,u as Dl,ae as Lw,F as Fg,as as Pg,w as pf,x as hf}from'./main-P6EOYPYG.js';function he(r,t){r&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function ve(r,t){if(r&1&&fg(0,"input",6),r&2){let e=tC(2);dg("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Es(0,"option",44),AC(1),hl()),r&2){let e=t.$implicit;dg("value",e.id),VE(),Pg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Es(0,"select",7)(1,"option",43),AC(2,"Select provider"),hl(),$w(3,ye,2,3,"option",44,Lw().trackByProvider,true),hl(),NI()),r&2){let e=tC(2);dg("formControl",e.aiProviderIdControl),AI(),VE(3),zw(e.providers());}}function xe(r,t){if(r&1&&(Es(0,"option",25),AC(1),hl()),r&2){let e=t.$implicit;dg("ngValue",e),VE(),Fg(e.toLowerCase());}}function _e(r,t){r&1&&(Es(0,"p",2),AC(1,"Not supported yet for Anthropic and Gemini providers."),hl());}function Me(r,t){r&1&&(Es(0,"p",2),AC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),hl());}function Ee(r,t){r&1&&(Es(0,"p",26),AC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),hl());}function Ae(r,t){if(r&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let u=tC();return hf(u.submit())}),Es(1,"ds-form-field",5),Bw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),hl(),Es(4,"ds-form-field",8),fg(5,"input",9),NI(),hl(),Es(6,"ds-form-field",10),fg(7,"input",11),NI(),hl(),Es(8,"ds-form-field",12),fg(9,"input",13),NI(),hl(),Es(10,"ds-form-field",14),fg(11,"input",15),NI(),hl(),Es(12,"div",16)(13,"ds-form-field",17),fg(14,"input",18),NI(),hl(),Es(15,"ds-form-field",19),fg(16,"input",20),NI(),hl()(),Es(17,"ds-form-field",21),fg(18,"input",22),NI(),hl(),Es(19,"ds-form-field",23)(20,"select",24)(21,"option",25),AC(22,"Provider default"),hl(),$w(23,xe,2,2,"option",25,Uw),hl(),NI(),Bw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Bw(27,Ee,2,0,"p",26),hl(),Es(28,"div",27)(29,"label",28),fg(30,"input",29),NI(),Es(31,"span",30),AC(32,"Supports advanced execution"),hl()(),Es(33,"p",31),AC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),hl()(),Es(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),fg(38,"input",34),NI(),hl(),Es(39,"ds-form-field",35),fg(40,"input",36),NI(),hl()(),Es(41,"div",16)(42,"ds-form-field",37),fg(43,"input",38),NI(),hl(),Es(44,"ds-form-field",39),fg(45,"input",40),NI(),hl()()(),Es(46,"ds-form-actions")(47,"button",41),AC(48),hl(),Es(49,"button",42),vg("click",function(){pf(e);let u=tC();return hf(u.cancel())}),AC(50,"Cancel"),hl()()();}if(r&2){let e=tC();dg("formGroup",e.form),VE(2),Vw(e.isEditMode()?2:3),VE(3),dg("formControl",e.apiModelNameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(2),dg("formControl",e.aliasControl),AI(),VE(2),dg("formControl",e.priorityControl),AI(),VE(3),dg("formControl",e.temperatureControl),AI(),VE(2),dg("formControl",e.contextWindowControl),AI(),VE(2),dg("formControl",e.maxCompletionTokensControl),AI(),VE(2),dg("formControl",e.reasoningEffortControl),AI(),VE(),dg("ngValue",null),VE(2),zw(e.reasoningEffortOptions),VE(2),Vw(e.reasoningEffortUnsupported()?25:26),VE(2),Vw(e.temperatureMayConflictWithEffort()?27:-1),VE(3),dg("formControl",e.supportsAdvancedExecutionControl),AI(),VE(5),dg("formGroup",e.pricingGroup),VE(3),AI(),VE(2),AI(),VE(3),AI(),VE(2),AI(),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ha(()=>br([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[bn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Ne);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=oT(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=oT(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);selectedProviderLabel=oT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Of(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Dw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return c.cancel()}),AC(3," \u2190 AI models "),hl()(),Bw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),hl()),e&2&&(VE(),dg("title",c.isEditMode()?"Edit AI model":"New AI model"),VE(3),Vw(c.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,Ea],encapsulation:2})};export{ge as AiModelFormComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-BeAWBIRs.js';import {g,W as W$1,t as F,K as we,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,U as U$1,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,u as Dl,Q as Qw,w as pf,x as hf,n as lg}from'./main-P6EOYPYG.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let t=tC();VE(),Fg(t.deletion.error());}}function G(n,e){n&1&&(Es(0,"p",4),AC(1,"Loading prompts\u2026"),hl());}function O(n,e){n&1&&(Es(0,"p",5),AC(1,"No prompts available."),hl());}function Q(n,e){n&1&&(Es(0,"p",4),AC(1,"No prompts match the current filter."),hl());}function W(n,e){n&1&&(Es(0,"ds-tag",17),AC(1,"Read-only"),hl());}function X(n,e){if(n&1){let t=Qw();Es(0,"button",23),vg("click",function(){pf(t);let l=tC(2).$implicit,m=tC(2);return hf(m.edit(l))}),AC(1," Edit "),hl();}if(n&2){let t=tC(2).$implicit;lg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=Qw();Bw(0,X,2,1,"button",21),Es(1,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(t);let l=tC().$implicit,m=tC(2);return hf(m.deletion.request(l.key))})("deleteConfirmed",function(){pf(t);let l=tC().$implicit,m=tC(2);return hf(m.confirmDelete(l))})("deleteCancelled",function(){pf(t);let l=tC(3);return hf(l.deletion.cancel())}),hl();}if(n&2){let t=tC().$implicit,i=tC(2);Vw(i.deletion.confirmingId()!==t.key?0:-1),VE(),dg("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Es(0,"button",20),AC(1,"Inherited"),hl());}function ee(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),AC(8),hl(),Bw(9,W,2,0,"ds-tag",17),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,Y,2,4)(13,Z,2,0,"button",20),hl()()()),n&2){let t=e.$implicit;VE(2),Fg(t.prompt.name),VE(2),Dl(" ",t.prompt.description||"\u2014"," "),VE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),VE(),Fg(t.scope==="platform"?"Platform":"Namespace"),VE(),Vw(t.scope==="platform"?9:-1),VE(3),Vw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Description"),hl(),Es(8,"th",10),AC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,ee,14,6,"tr",9,U),hl()()()),n&2){let t=tC();VE(14),zw(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(we);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();rows=$i([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({platform:this.promptState.listPlatform().pipe(ha(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return i.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),AC(3,"New prompt"),hl()(),Bw(4,z,2,1,"p",3),Bw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(VE(),dg("query",i.rowFilter.query()),VE(3),Vw(i.deletion.error()?4:-1),VE(),Vw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as NamespacePromptsComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-BeAWBIRs.js';import {g,t as F,K as we,Z as Tr,$ as $i,a1 as ga,U as U$1,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,u as Dl,Q as Qw,n as lg,w as pf,x as hf}from'./main-P6EOYPYG.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Es(0,"p",3),AC(1),hl()),t&2){let n=tC();VE(),Fg(n.deletion.error());}}function K(t,e){t&1&&(Es(0,"p",4),AC(1,"Loading prompts\u2026"),hl());}function H(t,e){t&1&&(Es(0,"p",5),AC(1,"No platform prompts defined yet."),hl());}function U(t,e){t&1&&(Es(0,"p",4),AC(1,"No prompts match the current filter."),hl());}function z(t,e){if(t&1){let n=Qw();Es(0,"button",18),vg("click",function(){pf(n);let m=tC().$implicit,p=tC(2);return hf(p.edit(m))}),AC(1,"Edit"),hl();}if(t&2){let n=tC().$implicit;lg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Qw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let m=tC().$implicit,p=tC(2);return hf(p.deletion.request(m.id))})("deleteConfirmed",function(){pf(n);let m=tC().$implicit,p=tC(2);return hf(p.confirmDelete(m))})("deleteCancelled",function(){pf(n);let m=tC(3);return hf(m.deletion.cancel())}),hl();}if(t&2){let n=tC().$implicit,r=tC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15),Bw(7,z,2,1,"button",16),Bw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),t&2){let n=e.$implicit,r=tC(2);VE(2),Fg(n.name),VE(2),Dl(" ",n.description||"\u2014"," "),VE(3),Vw(r.deletion.confirmingId()!==n.id?7:-1),VE(),Vw(n.id?8:-1);}}function O(t,e){if(t&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Description"),hl(),Es(8,"th",10)(9,"span",11),AC(10,"Actions"),hl()()()(),Es(11,"tbody",8),$w(12,J,9,4,"tr",9,j),hl()()()),t&2){let n=tC();VE(12),zw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);promptState=g(m);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();prompts=$i([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return r.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),AC(3,"New prompt"),hl()(),Bw(4,A,2,1,"p",3),Bw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(VE(),dg("query",r.rowFilter.query()),VE(3),Vw(r.deletion.error()?4:-1),VE(),Vw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c}from'./chunk-MzRAkbwR.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-BeAWBIRs.js';import {g,W,t as F,K as we,$ as $i,ac as by,a2 as ha,aa as br,U,N as x,L as w,ai as ke,al as We,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,w as pf,x as hf,n as lg}from'./main-P6EOYPYG.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let e=tC();VE(),Fg(e.deletion.error());}}function Y(n,t){n&1&&(Es(0,"p",4),AC(1,"Loading scheduled prompts\u2026"),hl());}function z(n,t){n&1&&(Es(0,"p",5),AC(1,"No scheduled prompts available."),hl());}function G(n,t){n&1&&(Es(0,"p",4),AC(1,"No scheduled prompts match the current filter."),hl());}function Q(n,t){if(n&1&&(Es(0,"span",14),AC(1),hl()),n&2){let e=tC().$implicit;VE(),Fg(e.prompt.description);}}function X(n,t){n&1&&(Es(0,"ds-tag",20),AC(1,"Read-only"),hl());}function Z(n,t){if(n&1){let e=Qw();Es(0,"button",25),vg("click",function(){pf(e);let l=tC(2).$implicit,p=tC(2);return hf(p.toggle(l))}),AC(1),hl(),Es(2,"button",25),vg("click",function(){pf(e);let l=tC(2).$implicit,p=tC(2);return hf(p.edit(l))}),AC(3," Edit "),hl();}if(n&2){let e=tC(2).$implicit;VE(),Fg(e.prompt.enabled?"Disable":"Enable"),VE(),lg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Qw();Bw(0,Z,4,2),Es(1,"agentos-row-delete-action",24),vg("deleteRequested",function(){pf(e);let l=tC().$implicit,p=tC(2);return hf(p.deletion.request(l.key))})("deleteConfirmed",function(){pf(e);let l=tC().$implicit,p=tC(2);return hf(p.confirmDelete(l))})("deleteCancelled",function(){pf(e);let l=tC(3);return hf(l.deletion.cancel())}),hl();}if(n&2){let e=tC().$implicit,i=tC(2);Vw(i.deletion.confirmingId()!==e.key?0:-1),VE(),dg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Es(0,"button",23),AC(1,"Inherited"),hl());}function ne(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),AC(3),hl(),Bw(4,Q,2,1,"span",14),hl(),Es(5,"td",15),AC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),AC(9),hl()(),Es(10,"td",18)(11,"div",19)(12,"ds-tag",17),AC(13),hl(),Bw(14,X,2,0,"ds-tag",20),hl()(),Es(15,"td",21)(16,"div",22),Bw(17,ee,2,4)(18,te,2,0,"button",23),hl()()()),n&2){let e=t.$implicit,i=tC(2);VE(3),Fg(e.prompt.name),VE(),Vw(e.prompt.description?4:-1),VE(2),Fg(i.scheduleLabel(e.prompt)),VE(2),dg("variant",e.prompt.enabled?"accent":"outline"),VE(),Fg(e.prompt.enabled?"Enabled":"Disabled"),VE(3),dg("variant",e.scope==="platform"?"neutral":"accent"),VE(),Fg(e.scope==="platform"?"Platform":"Namespace"),VE(),Vw(e.scope==="platform"?14:-1),VE(3),Vw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Schedule"),hl(),Es(8,"th",10),AC(9,"Status"),hl(),Es(10,"th",10),AC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),AC(14,"Actions"),hl()()()(),Es(15,"tbody",8),$w(16,ne,19,9,"tr",9,J),hl()()()),n&2){let e=tC();VE(16),zw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){by({platform:this.state.listPlatform().pipe(ha(()=>br([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===ke.WEEK?"week":"month",l=e.unit===ke.WEEK&&e.days?.length?` (${e.days.map(p=>We[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return i.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),AC(3,"New scheduled prompt"),hl()(),Bw(4,O,2,1,"p",3),Bw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(VE(),dg("query",i.rowFilter.query()),VE(3),Vw(i.deletion.error()?4:-1),VE(),Vw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a1 as ga,a2 as ha,aa as br,aD as $y}from'./main-P6EOYPYG.js';function i(t,o,p){return t.pipe(ga(()=>o().pipe(ha(()=>br(p)))),$y({bufferSize:1,refCount:true}))}export{i};
|