@whoz-oss/coday-client 0.0.0-workstream-forge.286 → 0.0.0-workstream-forge.288
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-DvgyKpON.js → chunk--N43m_5o.js} +1 -1
- package/browser/{chunk-C8kRHbPY.js → chunk-ARX7xO57.js} +1 -1
- package/browser/{chunk-CTnGJhEu.js → chunk-B0gKv16w.js} +1 -1
- package/browser/{chunk-BRKEdS-H.js → chunk-B84wcmlL.js} +1 -1
- package/browser/{chunk-O_4Rn5qq.js → chunk-BAW_bOac.js} +1 -1
- package/browser/{chunk-C4AQsMm0.js → chunk-BNV6A7zQ.js} +1 -1
- package/browser/chunk-BSz21_Vu.js +1 -0
- package/browser/{chunk-DZzoCiPa.js → chunk-BWCkWdmU.js} +1 -1
- package/browser/{chunk-cs0QcDnt.js → chunk-BZ7MHHlT.js} +1 -1
- package/browser/{chunk-DWnk-InR.js → chunk-BbgQs8ay.js} +1 -1
- package/browser/{chunk-CR2ZgYm1.js → chunk-Bc30sqfv.js} +1 -1
- package/browser/{chunk-DtO-loh9.js → chunk-BgfuCnTj.js} +1 -1
- package/browser/{chunk-C9I0IDkC.js → chunk-Bw2kVgKL.js} +1 -1
- package/browser/{chunk-BuupDt2w.js → chunk-By9Xd-3K.js} +1 -1
- package/browser/{chunk-YSYGmtzS.js → chunk-BzrVRPNK.js} +1 -1
- package/browser/{chunk-C9Im1XQZ.js → chunk-C8EjYY3L.js} +1 -1
- package/browser/{chunk-BYBCnWol.js → chunk-CBHdjoSo.js} +1 -1
- package/browser/{chunk-CpXnuzhL.js → chunk-CGhT80Z4.js} +1 -1
- package/browser/{chunk-BFMfi7bN.js → chunk-CT-NYgHo.js} +1 -1
- package/browser/{chunk-B4ZKQxLi.js → chunk-CWBuB3TV.js} +1 -1
- package/browser/{chunk-DUksmlzj.js → chunk-CWRaz0m6.js} +1 -1
- package/browser/{chunk-wS9pwsFZ.js → chunk-CfJrOSzi.js} +1 -1
- package/browser/{chunk-DeS6UHdw.js → chunk-Ch_tCQDO.js} +1 -1
- package/browser/{chunk-DII4lC8r.js → chunk-CknQyFqR.js} +1 -1
- package/browser/{chunk-Cht3Sl44.js → chunk-CqXT8Tpx.js} +1 -1
- package/browser/chunk-CqeuplQz.js +1 -0
- package/browser/{chunk-DEd4dYEy.js → chunk-D-F4_F5P.js} +1 -1
- package/browser/{chunk-BWOdgPpL.js → chunk-D0PFoBR9.js} +1 -1
- package/browser/{chunk-BaZs2cqq.js → chunk-DJblpySR.js} +1 -1
- package/browser/{chunk-5mGW4E0G.js → chunk-DLffGFin.js} +1 -1
- package/browser/{chunk-CV72_wbg.js → chunk-DNpsnpVA.js} +3 -3
- package/browser/{chunk-BecFkRj3.js → chunk-DT4fihVQ.js} +1 -1
- package/browser/{chunk-Cgng0NyG.js → chunk-DUVTlyRi.js} +1 -1
- package/browser/{chunk-spovbUSX.js → chunk-D_KNMuBZ.js} +1 -1
- package/browser/{chunk-BDdxWZSD.js → chunk-DaMifMs9.js} +1 -1
- package/browser/{chunk-Da_8VPJd.js → chunk-DdMcbWCx.js} +1 -1
- package/browser/{chunk-C-TFPDAn.js → chunk-Dkderx1H.js} +1 -1
- package/browser/{chunk-BGKOG_jF.js → chunk-Dnbp1gjx.js} +1 -1
- package/browser/{chunk-D48e7Jxo.js → chunk-DqNu3dCC.js} +1 -1
- package/browser/{chunk-B6Jjbp7r.js → chunk-Dxv38Ish.js} +1 -1
- package/browser/{chunk-CBa63htl.js → chunk-H7KUSNF6.js} +1 -1
- package/browser/{chunk-BgspkyJn.js → chunk-I4zoVvDE.js} +1 -1
- package/browser/{chunk-BSLGGdgS.js → chunk-JWkB7UsB.js} +1 -1
- package/browser/{chunk-hqzAiSeU.js → chunk-dhcgEEkx.js} +1 -1
- package/browser/{chunk-BIv3GA0j.js → chunk-lsjaR1SF.js} +1 -1
- package/browser/{chunk-Cw_G-BTP.js → chunk-pXoj-NgV.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-2W2EKPFF.js → main-IUUK3O6C.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-RNbGWl1w.js +0 -1
- package/browser/chunk-gOvITjLx.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {q as k$1,O,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-
|
|
1
|
+
import {q as k$1,O,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-DNpsnpVA.js';import {g,W as W$1,F,K as we,aq as F$1,ap as k,$ as Sr,z as zi,a1 as ma,ac as Ny,a2 as ga,aa as _r,U,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,J as Jw,k as eC,o as Il,s as sC,q as mf,r as yf,i as fg}from'./main-IUUK3O6C.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let t=dC();QE(),Lg(t.deletion.error());}}function W(i,e){i&1&&(Is(0,"p",4),HC(1,"Loading AI models\u2026"),ml());}function X(i,e){i&1&&(Is(0,"p",5),HC(1,"No AI models configured."),ml());}function Y(i,e){i&1&&(Is(0,"p",4),HC(1,"No AI models match the current filter."),ml());}function Z(i,e){i&1&&(Is(0,"ds-tag",18),HC(1,"Read-only"),ml());}function ee(i,e){if(i&1){let t=sC();Is(0,"button",24),Eg("click",function(){mf(t);let s=dC(2).$implicit,m=dC(2);return yf(m.edit(s))}),HC(1,"Edit"),ml();}if(i&2){let t=dC(2).$implicit,n=dC(2);fg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=sC();Yw(0,ee,2,1,"button",22),Is(1,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let s=dC().$implicit,m=dC(2);return yf(m.deletion.request(s.key))})("deleteConfirmed",function(){mf(t);let s=dC().$implicit,m=dC(2);return yf(m.confirmDelete(s))})("deleteCancelled",function(){mf(t);let s=dC(3);return yf(s.deletion.cancel())}),ml();}if(i&2){let t=dC().$implicit,n=dC(2);Qw(n.deletion.confirmingId()!==t.key?0:-1),QE(),pg("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Is(0,"button",21),HC(1,"Inherited"),ml());}function ne(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12),HC(2),ml(),Is(3,"td",13),HC(4),ml(),Is(5,"td",14),HC(6),ml(),Is(7,"td",15)(8,"div",16)(9,"ds-tag",17),HC(10),ml(),Yw(11,Z,2,0,"ds-tag",18),ml()(),Is(12,"td",19)(13,"div",20),Yw(14,te,2,4)(15,ie,2,0,"button",21),ml()()()),i&2){let t=e.$implicit,n=dC(2);QE(2),Lg(n.title(t)),QE(2),Lg(t.providerName),QE(2),Il(" ",t.model.apiModelName," "),QE(3),pg("variant",t.scope==="platform"?"neutral":"accent"),QE(),Lg(t.scope==="platform"?"Platform":"Namespace"),QE(),Qw(t.scope==="platform"?11:-1),QE(3),Qw(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),HC(5,"Name"),ml(),Is(6,"th",10),HC(7,"Provider"),ml(),Is(8,"th",10),HC(9,"API model name"),ml(),Is(10,"th",10),HC(11,"Scope"),ml(),Is(12,"th",10)(13,"span",11),HC(14,"Actions"),ml()()()(),Is(15,"tbody",8),Jw(16,ne,16,7,"tr",9,G),ml()()()),i&2){let t=dC();QE(16),eC(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Sr(void 0);isLoading=zi(true);deletion=k$1();rows=zi([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(ma(()=>(this.isLoading.set(true),Ny({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ga(()=>_r([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(ma(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return Ny({namespace:_r(e),platform:_r(t),providers:_r(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(ga(()=>_r([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Nw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\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","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",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,n){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return n.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return n.openCreateForm()}),HC(3,"New AI model"),ml()(),Yw(4,Q,2,1,"p",3),Yw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(QE(),pg("query",n.rowFilter.query()),QE(3),Qw(n.deletion.error()?4:-1),QE(),Qw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-BgspkyJn.js';import {p as pt,T as Te$1,b as bn,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,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-CV72_wbg.js';import {g,W,F,K as we$1,ag as U,ah as ke$1,ai as Fe$1,z as zi,aj as De$1,a9 as F$1,ak as Dd,j as mT,ac as Ny,U as U$1,a2 as ga,aa as _r,O as x,M as w,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,o as Il,b as Qw,s as sC,a as hg,S as BI,J as Jw,p as dC,T as HI,k as eC,L as Lg,q as mf,r as yf,u as ch}from'./main-2W2EKPFF.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function _e(n,t){if(n&1&&(Is(0,"ds-form-field",9),hg(1,"input",38),ml()),n&2){let e=dC(2);QE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Is(0,"a",39),HC(1,"Add an agent config"),ml(),HC(2," first. ")),n&2){let e=dC(3);pg("href","/agentos/"+e.namespaceId+"/agent-configs/new",ch);}}function xe(n,t){if(n&1&&(Is(0,"ds-form-field",10)(1,"p",2),HC(2," No agent configs available in this scope yet. "),Yw(3,Se,3,1),ml()()),n&2){let e=dC(2);QE(3),Qw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.id),QE(),Lg(e.name);}}function De(n,t){if(n&1&&(Is(0,"ds-form-field",11)(1,"select",40)(2,"option",41),HC(3,"Select an agent config\u2026"),ml(),Jw(4,Ee,2,2,"option",17,ve),ml(),BI(),ml()),n&2){let e=dC(2);pg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),QE(),pg("formControl",e.agentConfigIdControl),HI(),QE(3),eC(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Ne(n,t){if(n&1){let e=sC();Is(0,"label",31)(1,"input",43),Eg("change",function(){let f=mf(e).$implicit,h=dC(3);return yf(h.toggleDay(f.value))}),ml(),HC(2),ml();}if(n&2){let e=t.$implicit,l=dC(3);QE(),pg("checked",l.isDaySelected(e.value)),QE(),Il(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Is(0,"ds-form-field",18)(1,"div",42),Jw(2,Ne,3,2,"label",31,V),ml()()),n&2){let e=dC(2);QE(2),eC(e.dayOptions);}}function Me(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Pe(n,t){if(n&1&&(Is(0,"ds-form-field",28),hg(1,"input",44),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),QE(),pg("formControl",e.endDateControl),HI();}}function we(n,t){if(n&1&&(Is(0,"ds-form-field",29),hg(1,"input",45),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),QE(),pg("formControl",e.occurrenceCountControl),HI();}}function Fe(n,t){if(n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2){let e=dC(2);QE(),Lg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let f=dC();return yf(f.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),BI(),ml(),Yw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Is(8,"ds-form-field",12),hg(9,"textarea",13),BI(),ml(),Is(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Jw(13,Te,2,2,"option",17,V),ml(),BI(),ml(),Yw(15,Ie,4,0,"ds-form-field",18),Is(16,"ds-form-field",19)(17,"div",20),hg(18,"input",21),BI(),Is(19,"span",22),HC(20,"UTC"),ml()()()(),Is(21,"ds-fieldset",23)(22,"ds-form-field",24),hg(23,"input",25),BI(),ml(),Is(24,"ds-form-field",26)(25,"select",27),Jw(26,Me,2,2,"option",17,V),ml(),BI(),ml(),Yw(28,Pe,2,2,"ds-form-field",28),Yw(29,we,2,2,"ds-form-field",29),ml(),Is(30,"div",30)(31,"label",31),hg(32,"input",32),BI(),HC(33," Enabled "),ml(),Is(34,"p",33),HC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),ml()(),Is(36,"ds-form-field",34),hg(37,"textarea",35),BI(),ml(),Yw(38,Fe,2,1,"ds-notice"),Is(39,"ds-form-actions")(40,"button",36),HC(41),ml(),Is(42,"button",37),Eg("click",function(){mf(e);let f=dC();return yf(f.cancel())}),HC(43,"Cancel"),ml()()();}if(n&2){let e=dC();pg("formGroup",e.form),QE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),QE(),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(),Qw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),QE(3),pg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),QE(),pg("formControl",e.promptContentControl),HI(),QE(3),pg("formControl",e.unitControl),HI(),QE(),eC(e.schedulerUnits),QE(2),Qw(e.showDayFilter()?15:-1),QE(),pg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),QE(2),pg("formControl",e.timeUtcControl),HI(),QE(4),pg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),QE(),pg("formControl",e.startDateControl),HI(),QE(2),pg("formControl",e.endTypeControl),HI(),QE(),eC(e.endTypes),QE(2),Qw(e.showEndDate()?28:-1),QE(),Qw(e.showOccurrenceCount()?29:-1),QE(3),pg("formControl",e.enabledControl),HI(),QE(4),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),QE(),pg("formControl",e.externalMetadataJsonControl),HI(),QE(),Qw(e.errorMessage()?38:-1),QE(2),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[bn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[bn.required]}),unit:new Te$1(Fe$1.WEEK,{nonNullable:true,validators:[bn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[bn.required,bn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[bn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[bn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);errorMessage=zi(null);SchedulerUnit=Fe$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Fe$1.WEEK,label:"Week(s)"},{value:Fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(Dd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(Dd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=zi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ny({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>_r([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return l.cancel()}),HC(3),ml()(),Yw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),ml()),e&2&&(QE(),pg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),QE(2),Il(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),QE(),Qw(l.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
|
|
1
|
+
import {c}from'./chunk-I4zoVvDE.js';import {p as pt,T as Te$1,b as bn,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,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-DNpsnpVA.js';import {g,W,F,K as we$1,ag as U,ah as ke$1,ai as Fe$1,z as zi,aj as De$1,a9 as F$1,ak as Dd,j as mT,ac as Ny,U as U$1,a2 as ga,aa as _r,O as x,M as w,N as Nw,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,o as Il,b as Qw,s as sC,a as hg,S as BI,J as Jw,p as dC,T as HI,k as eC,L as Lg,q as mf,r as yf,u as ch}from'./main-IUUK3O6C.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Is(0,"p",2),HC(1,"Loading\u2026"),ml());}function _e(n,t){if(n&1&&(Is(0,"ds-form-field",9),hg(1,"input",38),ml()),n&2){let e=dC(2);QE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Is(0,"a",39),HC(1,"Add an agent config"),ml(),HC(2," first. ")),n&2){let e=dC(3);pg("href","/agentos/"+e.namespaceId+"/agent-configs/new",ch);}}function xe(n,t){if(n&1&&(Is(0,"ds-form-field",10)(1,"p",2),HC(2," No agent configs available in this scope yet. "),Yw(3,Se,3,1),ml()()),n&2){let e=dC(2);QE(3),Qw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.id),QE(),Lg(e.name);}}function De(n,t){if(n&1&&(Is(0,"ds-form-field",11)(1,"select",40)(2,"option",41),HC(3,"Select an agent config\u2026"),ml(),Jw(4,Ee,2,2,"option",17,ve),ml(),BI(),ml()),n&2){let e=dC(2);pg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),QE(),pg("formControl",e.agentConfigIdControl),HI(),QE(3),eC(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Ne(n,t){if(n&1){let e=sC();Is(0,"label",31)(1,"input",43),Eg("change",function(){let f=mf(e).$implicit,h=dC(3);return yf(h.toggleDay(f.value))}),ml(),HC(2),ml();}if(n&2){let e=t.$implicit,l=dC(3);QE(),pg("checked",l.isDaySelected(e.value)),QE(),Il(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Is(0,"ds-form-field",18)(1,"div",42),Jw(2,Ne,3,2,"label",31,V),ml()()),n&2){let e=dC(2);QE(2),eC(e.dayOptions);}}function Me(n,t){if(n&1&&(Is(0,"option",17),HC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),QE(),Lg(e.label);}}function Pe(n,t){if(n&1&&(Is(0,"ds-form-field",28),hg(1,"input",44),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),QE(),pg("formControl",e.endDateControl),HI();}}function we(n,t){if(n&1&&(Is(0,"ds-form-field",29),hg(1,"input",45),BI(),ml()),n&2){let e=dC(2);pg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),QE(),pg("formControl",e.occurrenceCountControl),HI();}}function Fe(n,t){if(n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2){let e=dC(2);QE(),Lg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=sC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let f=dC();return yf(f.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),BI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),BI(),ml(),Yw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Is(8,"ds-form-field",12),hg(9,"textarea",13),BI(),ml(),Is(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Jw(13,Te,2,2,"option",17,V),ml(),BI(),ml(),Yw(15,Ie,4,0,"ds-form-field",18),Is(16,"ds-form-field",19)(17,"div",20),hg(18,"input",21),BI(),Is(19,"span",22),HC(20,"UTC"),ml()()()(),Is(21,"ds-fieldset",23)(22,"ds-form-field",24),hg(23,"input",25),BI(),ml(),Is(24,"ds-form-field",26)(25,"select",27),Jw(26,Me,2,2,"option",17,V),ml(),BI(),ml(),Yw(28,Pe,2,2,"ds-form-field",28),Yw(29,we,2,2,"ds-form-field",29),ml(),Is(30,"div",30)(31,"label",31),hg(32,"input",32),BI(),HC(33," Enabled "),ml(),Is(34,"p",33),HC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),ml()(),Is(36,"ds-form-field",34),hg(37,"textarea",35),BI(),ml(),Yw(38,Fe,2,1,"ds-notice"),Is(39,"ds-form-actions")(40,"button",36),HC(41),ml(),Is(42,"button",37),Eg("click",function(){mf(e);let f=dC();return yf(f.cancel())}),HC(43,"Cancel"),ml()()();}if(n&2){let e=dC();pg("formGroup",e.form),QE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),QE(),pg("formControl",e.nameControl),HI(),QE(2),pg("formControl",e.descriptionControl),HI(),QE(),Qw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),QE(3),pg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),QE(),pg("formControl",e.promptContentControl),HI(),QE(3),pg("formControl",e.unitControl),HI(),QE(),eC(e.schedulerUnits),QE(2),Qw(e.showDayFilter()?15:-1),QE(),pg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),QE(2),pg("formControl",e.timeUtcControl),HI(),QE(4),pg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),QE(),pg("formControl",e.startDateControl),HI(),QE(2),pg("formControl",e.endTypeControl),HI(),QE(),eC(e.endTypes),QE(2),Qw(e.showEndDate()?28:-1),QE(),Qw(e.showOccurrenceCount()?29:-1),QE(3),pg("formControl",e.enabledControl),HI(),QE(4),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),QE(),pg("formControl",e.externalMetadataJsonControl),HI(),QE(),Qw(e.errorMessage()?38:-1),QE(2),pg("disabled",e.form.invalid||e.isSubmitting()),QE(),Il(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[bn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[bn.required]}),unit:new Te$1(Fe$1.WEEK,{nonNullable:true,validators:[bn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[bn.required,bn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[bn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[bn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);errorMessage=zi(null);SchedulerUnit=Fe$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Fe$1.WEEK,label:"Week(s)"},{value:Fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(Dd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(Dd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=zi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ny({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>_r([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return l.cancel()}),HC(3),ml()(),Yw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),ml()),e&2&&(QE(),pg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),QE(2),Il(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),QE(),Qw(l.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {O as O$1}from'./chunk-ARX7xO57.js';import {O}from'./chunk-BgfuCnTj.js';import {I}from'./chunk-D-F4_F5P.js';import {g,K as we$1,z as zi,j as mT,a9 as F,at as _y,ad as ne,U,N as Nw,I as Is,a as hg,Y as Yw,m as ml,Q as QE,b as Qw,H as HC,s as sC,R as Eg,p as dC,P as pg,S as BI,J as Jw,L as Lg,T as HI,k as eC,o as Il,ae as qw,q as mf,r as yf,aL as DC,O as x,M as w}from'./main-IUUK3O6C.js';import {y,J as k,L as R,X as a,p as pt,T as Te$1,$ as v,a0 as V,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,R as Rn,E as Ea,v as vn,d as yn,e as fn,a1 as gn,h as hn,i as at,u as un,m as mn,a2 as ji,F as Ni,a3 as m,a4 as S}from'./chunk-DNpsnpVA.js';import'./chunk-BSz21_Vu.js';var ye=(o,e)=>e.value,be=(o,e)=>e.title;function xe(o,e){o&1&&(Is(0,"p",4),HC(1,"Loading\u2026"),ml());}function Se(o,e){if(o&1&&(Is(0,"option",34),HC(1),ml()),o&2){let t=e.$implicit;pg("value",t.value),QE(),Lg(t.label);}}function Ee(o,e){if(o&1&&(Is(0,"option",34),HC(1),ml()),o&2){let t=e.$implicit;pg("value",t.value),QE(),Lg(t.label);}}function Te(o,e){if(o&1){let t=sC();Is(0,"form",22),Eg("ngSubmit",function(){mf(t);let s=dC(2);return yf(s.save())}),Is(1,"ds-group",23)(2,"dl",24)(3,"dt"),HC(4,"Email"),ml(),Is(5,"dd"),HC(6),ml(),Is(7,"dt"),HC(8,"External ID"),ml(),Is(9,"dd"),HC(10),ml()()(),Is(11,"ds-group",25)(12,"ds-form-field",26),hg(13,"input",27),BI(),ml(),Is(14,"ds-form-field",28),hg(15,"input",29),BI(),ml(),Is(16,"ds-form-field",30),hg(17,"textarea",31),BI(),ml(),Is(18,"ds-form-field",32)(19,"select",33),Jw(20,Se,2,2,"option",34,ye),ml(),BI(),ml(),Is(22,"ds-form-field",35)(23,"select",36),Jw(24,Ee,2,2,"option",34,ye),ml(),BI(),ml()(),Is(26,"ds-form-actions")(27,"button",37),HC(28),ml(),Is(29,"button",38),Eg("click",function(){mf(t);let s=dC(2);return yf(s.cancelEditing())}),HC(30,"Cancel"),ml()()();}if(o&2){let t=dC(),a=dC();pg("formGroup",a.form),QE(6),Lg(t.email),QE(4),Lg(t.externalId),QE(3),HI(),QE(2),HI(),QE(2),HI(),QE(2),HI(),QE(),eC(a.languageOptions),QE(3),HI(),QE(),eC(a.promptCacheTtlOptions),QE(3),pg("disabled",a.isSaving()),QE(),Il(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function Pe(o,e){o&1&&(Is(0,"p",4),HC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),ml());}function De(o,e){if(o&1){let t=sC();Is(0,"span",47),HC(1,"Delete?"),ml(),Is(2,"button",48),Eg("click",function(){mf(t);let s=dC().$implicit,m=dC(5);return yf(m.confirmDelete(s))}),HC(3,"Confirm"),ml(),Is(4,"button",49),Eg("click",function(){mf(t);let s=dC(6);return yf(s.cancelDelete())}),HC(5,"Cancel"),ml();}}function Ue(o,e){if(o&1){let t=sC();Is(0,"button",49),Eg("click",function(){mf(t);let s=dC().$implicit,m=dC(5);return yf(m.armDelete(s))}),HC(1,"Delete"),ml();}}function Ie(o,e){if(o&1&&(Is(0,"li",43)(1,"span",44),HC(2),ml(),Is(3,"span",45),HC(4),ml(),Yw(5,De,6,0)(6,Ue,2,0,"button",46),ml()),o&2){let t=e.$implicit,a=dC(5);QE(2),Lg(t.name),QE(2),Lg(t.subtitle),QE(),Qw(a.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Is(0,"span",41),HC(1),ml(),Is(2,"ul",42),Jw(3,Ie,7,3,"li",43,qw().trackEntry,true),ml()),o&2){let t=e.$implicit;QE(),Lg(t.title),QE(2),eC(t.entries);}}function Ve(o,e){if(o&1&&Jw(0,we,5,1,null,null,be),o&2){let t=dC(3);eC(t.recapSections());}}function Ne(o,e){if(o&1){let t=sC();Is(0,"ds-group",23)(1,"dl",24)(2,"dt"),HC(3,"Email"),ml(),Is(4,"dd"),HC(5),ml(),Is(6,"dt"),HC(7,"External ID"),ml(),Is(8,"dd"),HC(9),ml()()(),Is(10,"ds-group",25)(11,"dl",24)(12,"dt"),HC(13,"First name"),ml(),Is(14,"dd"),HC(15),ml(),Is(16,"dt"),HC(17,"Last name"),ml(),Is(18,"dd"),HC(19),ml(),Is(20,"dt"),HC(21,"Bio"),ml(),Is(22,"dd"),HC(23),ml(),Is(24,"dt"),HC(25,"Language"),ml(),Is(26,"dd"),HC(27),ml(),Is(28,"dt"),HC(29,"Prompt cache"),ml(),Is(30,"dd"),HC(31),ml()()(),Is(32,"ds-form-actions")(33,"button",39),Eg("click",function(){mf(t);let s=dC(2);return yf(s.startEditing())}),HC(34,"Edit profile"),ml()(),Is(35,"ds-disclosure",40),Eg("toggled",function(){mf(t);let s=dC(2);return yf(s.toggleOverrides())}),Yw(36,Pe,2,0,"p",4)(37,Ve,2,0),ml();}if(o&2){let t=dC(),a=dC();QE(5),Lg(t.email),QE(4),Lg(t.externalId),QE(6),Lg(t.firstname||"\u2014"),QE(4),Lg(t.lastname||"\u2014"),QE(4),Lg(t.bio||"\u2014"),QE(4),Lg(t.preferredLanguage||"\u2014"),QE(4),Lg(a.promptCacheTtlLabel()),QE(4),pg("heading","My global user configurations ("+a.recap().total+")")("open",a.isOverridesExpanded()),QE(),Qw(a.recap().total===0?36:37);}}function Me(o,e){if(o&1){let t=sC();Is(0,"ds-group",5)(1,"ds-form-field",6)(2,"ds-segmented",7),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setThemeVariant(s))}),ml()(),Is(3,"ds-form-field",8)(4,"ds-segmented",9),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setTheme(s))}),ml()()(),Is(5,"ds-group",10)(6,"ds-form-field",11)(7,"ds-segmented",12),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setEnterKeyBehavior(s))}),ml()()(),Is(8,"ds-group",13)(9,"ds-form-field",14)(10,"ds-segmented",15),Eg("valueChange",function(s){mf(t);let m=dC();return yf(m.setShowTechnical(s))}),ml()()(),Is(11,"ds-group",16)(12,"ds-form-field",17)(13,"input",18,0),Eg("change",function(){mf(t);let s=DC(14),m=dC();return yf(m.setIdeProjectRoot(s.value))}),ml()(),Is(15,"ds-form-field",19)(16,"input",20,1),Eg("change",function(){mf(t);let s=DC(17),m=dC();return yf(m.setIdeUrlTemplate(s.value))}),ml()()(),Yw(18,Te,31,5,"form",21)(19,Ne,38,10);}if(o&2){let t=dC();QE(),pg("hint",t.activeVariantDescription()),QE(),pg("options",t.themeVariantOptions)("value",t.themeVariant()),QE(),pg("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),QE(),pg("options",t.modeOptions())("value",t.shownMode()),QE(3),pg("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),QE(3),pg("options",t.showTechnicalOptions)("value",t.showTechnical()),QE(3),pg("value",t.ideProjectRoot()),QE(3),pg("value",t.ideUrlTemplate()),QE(2),Qw(t.isEditing()?18:19);}}function Fe(o,e){o&1&&(Is(0,"p",4),HC(1,"Unable to load profile."),ml());}var Ce=class o{userState=g(y);destroyRef=g(we$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(k);preferencesPort=g(R);isEditing=zi(false);isLoading=zi(false);isSaving=zi(false);isOverridesExpanded=zi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:a})=>({value:e,label:t,description:a}));modeOverridden=mT(()=>!V(this.themeVariant(),this.themeMode()));activeVariantLabel=mT(()=>m(this.themeVariant()).label);activeVariantDescription=mT(()=>m(this.themeVariant()).description);modeOptions=mT(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=mT(()=>this.modeOverridden()?S(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];ideProjectRoot=this.preferencesPort.ideProjectRoot;ideUrlTemplate=this.preferencesPort.ideUrlTemplate;languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];promptCacheTtlOptions=[{value:"STANDARD",label:"Standard"},{value:"EXTENDED",label:"Extended"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true}),promptCacheTtl:new Te$1("STANDARD",{nonNullable:true})});promptCacheTtlLabel=mT(()=>{let e=this.currentUser()?.promptCacheTtl??"STANDARD";return this.promptCacheTtlOptions.find(t=>t.value===e)?.label??e});recap=F(_y([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,a])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),M=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:M,total:s.length+m.length+M.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=mT(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){v(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !V(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}setIdeProjectRoot(e){this.preferencesPort.setIdeProjectRoot(e);}setIdeUrlTemplate(e){this.preferencesPort.setIdeUrlTemplate(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0,promptCacheTtl:this.form.controls.promptCacheTtl.value}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=zi(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,a);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??"",promptCacheTtl:e.promptCacheTtl??"STANDARD"});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Nw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["projectRootInput",""],["urlTemplateInput",""],["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],["heading","IDE links"],["label","IDE project root (absolute path)","controlId","ide-project-root","hint","Folder of the project on this machine. Relative file references in agent replies open from it."],["dsControl","","id","ide-project-root","type","text","placeholder","/Users/you/Workspace/project",3,"change","value"],["label","IDE URL template","controlId","ide-url-template","hint","Opens a file in IntelliJ IDEA. {file} is the URL-encoded absolute path, {line} and {column} the position."],["dsControl","","id","ide-url-template","type","text",3,"change","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["label","Prompt cache","controlId","up-promptCacheTtl","hintId","up-promptCacheTtl-hint","hint","Extended keeps the conversation cached through longer pauses (Claude models via Requesty: 1 hour instead of 5 minutes; each cache write costs more). Other models keep their provider's default."],["dsControl","","id","up-promptCacheTtl","aria-describedby","up-promptCacheTtl-hint","formControlName","promptCacheTtl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,a){if(t&1&&(Is(0,"ds-page",2),hg(1,"ds-section-header",3),Yw(2,xe,2,0,"p",4)(3,Me,20,13)(4,Fe,2,0,"p",4),ml()),t&2){let s;QE(2),Qw(a.isLoading()?2:(s=a.currentUser())?3:4,s);}},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Rn,Ea,vn,yn,fn,gn,hn,at,un,mn,ji,Ni],encapsulation:2})};export{Ce as UserProfileComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-BSz21_Vu.js';import {y}from'./chunk-DNpsnpVA.js';import {g,aD as X,$ as Sr,at as _y,a1 as ma,a2 as ga,aa as _r,ad as ne,aC as Jy,O as x,M as w$1,a5 as Ed,aE as an,aF as Ot,aG as cn,a6 as A}from'./main-IUUK3O6C.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Sr(void 0);namespaceId$=new Sr(null);vm$=_y([this.namespaceId$,this.refresh$]).pipe(ma(([t])=>{let e=this.loadPlatformSettings().pipe(ga(()=>_r([])));return t?_y([e,this.loadNamespaceSettings(t).pipe(ga(()=>_r([]))),this.loadUserSettings(t).pipe(ga(()=>_r([]))),this.loadUserSettings("global").pipe(ga(()=>_r([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):_y([e,this.loadNamespaceSettings("").pipe(ga(()=>_r([]))),this.loadUserSettings("global").pipe(ga(()=>_r([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),Jy({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):_r([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),Ed(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),Ed(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(Ed(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(ma(r=>this.controller.connectAuthSetting(t,e).pipe(Ed(h=>n(h.authorizationUrl)),ma(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ma(()=>this.getConnection(t,e).pipe(ga(()=>_r(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=A({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-5mGW4E0G.js';import {O}from'./chunk-DtO-loh9.js';import {g,W,F as F$1,K as we,ag as U,ay as N,z as zi,az as Q,a8 as _,j as mT,a9 as F$2,aA as Me,U as U$1,a2 as ga,aa as _r,ac as Ny,ad as ne,O as x,M as w,N as Nw,au as $t,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,s as sC,a as hg,S as BI,T as HI,i as fg,o as Il,J as Jw,k as eC,L as Lg,q as mf,r as yf,as as jg}from'./main-2W2EKPFF.js';import {H as A,p as pt$1,T as Te,b as bn,I as E,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,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at$1,u as un,n as cn,A as Ao}from'./chunk-CV72_wbg.js';import'./chunk-gOvITjLx.js';var F="*";function Be(n){return (n??[]).some(t=>t.trim()===F)}function $e(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function He(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>He(e)?.test(n)??false)}var Ge="AGENTOS_CONFIG",Je=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ue(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Je.has(t)))}var je=(n,t)=>t.value,Ye=(n,t)=>t.config.id,qe=(n,t)=>t.type,We=(n,t)=>t.selector;function ze(n,t){if(n&1&&(Is(0,"a",2),HC(1,"View resolved definition \u2192"),ml()),n&2){let e=dC();pg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Is(0,"ds-tag",3),HC(1,"Platform level"),ml());}function Qe(n,t){n&1&&(Is(0,"p",4),HC(1,"Loading\u2026"),ml());}function Ze(n,t){if(n&1&&(hg(0,"input",17),BI()),n&2){let e=dC(2);pg("formControl",e.modelNameControl),HI();}}function et(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t;pg("ngValue",e.value),QE(),Lg(e.label);}}function tt(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function nt(n,t){if(n&1&&(Is(0,"optgroup",42),Jw(1,tt,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function ot(n,t){if(n&1&&(Is(0,"optgroup",43),Jw(1,it,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Is(0,"select",18)(1,"option",40),HC(2,"Select a model"),ml(),Yw(3,et,2,2,"option",41),Yw(4,nt,3,0,"optgroup",42),Yw(5,ot,3,0,"optgroup",43),ml(),BI()),n&2){let e,i=dC(2);pg("formControl",i.modelNameControl),HI(),QE(),pg("ngValue",null),QE(2),Qw((e=i.modelOptions().current)?3:-1,e),QE(),Qw(i.modelOptions().aliases.length>0?4:-1),QE(),Qw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.config.integrationType);}}function rt(n,t){if(n&1&&(hg(0,"input",45),BI()),n&2){let e=dC().$implicit;pg("formControl",e.toolsControl),fg("aria-label","Tools of "+e.config.name),HI();}}function st(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",23),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleIntegration(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,lt,2,1,"span",44),ml(),Yw(6,rt,1,2,"input",45),ml();}if(n&2){let e=t.$implicit;QE(2),pg("checked",e.enabled()),QE(2),Lg(e.config.name),QE(),Qw(e.config.integrationType?5:-1),QE(),Qw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Il(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",24),HC(2),Is(3,"span",44),HC(4,"built-in"),ml()(),Is(5,"select",47),Eg("change",function(s){let c=mf(e).$implicit,C=dC(4);return yf(C.setBuiltInState(c,s.target.value))}),Is(6,"option",48),HC(7),ml(),Is(8,"option",49),HC(9,"Enabled"),ml(),Is(10,"option",50),HC(11,"Disabled"),ml()(),Yw(12,dt,2,1,"p",13),Is(13,"p",13),HC(14),ml()();}if(n&2){let e=t.$implicit,i=dC(4);QE(),fg("for","built-in-"+e.type),QE(),Il(" ",e.displayName," "),QE(3),pg("id","built-in-"+e.type)("value",e.state()),QE(2),Lg(i.builtInDefaultLabel(e)),QE(5),Qw(e.state()==="on"&&e.restrictedTools?12:-1),QE(2),Lg(e.description);}}function mt(n,t){if(n&1&&(Is(0,"span",46),HC(1,"Built-in integrations"),ml(),Jw(2,ct,15,7,"div",10,qe)),n&2){let e=dC(3);QE(2),eC(e.builtInRows());}}function ut(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),ml());}function gt(n,t){if(n&1&&(Is(0,"ds-fieldset",21),Jw(1,st,7,4,"div",10,Ye),Yw(3,mt,4,0),Yw(4,ut,2,0,"ds-notice",26),ml()),n&2){let e=dC(2);QE(),eC(e.integrationRows()),QE(2),Qw(e.builtInRows().length>0?3:-1),QE(),Qw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&HC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function ft(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),ml());}function Ct(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function _t(n,t){n&1&&(Is(0,"p",4),HC(1,"No skill available in this scope yet."),ml());}function bt(n,t){n&1&&(Is(0,"span",44),HC(1,"platform"),ml());}function ht(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.description);}}function vt(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSkill(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,bt,2,0,"span",44),Yw(6,ht,2,1,"span",44),ml(),Yw(7,yt,2,1,"p",13),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSkillsSelected()),QE(2),Lg(e.name),QE(),Qw(e.platform?5:-1),QE(),Qw(e.unresolved?6:-1),QE(),Qw(e.description?7:-1);}}function xt(n,t){if(n&1&&Jw(0,vt,8,6,"div",10,We),n&2){let e=dC(2);eC(e.skillRows());}}function St(n,t){if(n&1&&(Is(0,"ds-form-field",30),hg(1,"textarea",52),BI(),Is(2,"p",4),HC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Is(4,"code"),HC(5,"AgentLoopPayload"),ml(),HC(6,". Leave empty if you always provide the payload at launch. "),ml()()),n&2){let e=dC(2);pg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),QE(),pg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),HI();}}function At(n,t){n&1&&HC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function wt(n,t){if(n&1&&HC(0),n&2){let e=dC(3);jg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Et(n,t){if(n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),Yw(5,wt,1,2),ml()),n&2){let e=dC(2);QE(5),Qw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function kt(n,t){n&1&&(Is(0,"p",4),HC(1,"No other agent is available in this scope yet."),ml());}function It(n,t){n&1&&(Is(0,"span",44),HC(1,"pattern"),ml());}function Rt(n,t){n&1&&(Is(0,"span",44),HC(1,"via pattern"),ml());}function Mt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=sC();Is(0,"button",55),Eg("click",function(){mf(e);let s=dC().$implicit,c=dC(3);return yf(c.removeSubAgent(s))}),HC(1," \xD7 "),ml();}if(n&2){let e=dC().$implicit;fg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=sC();Is(0,"div",32)(1,"label",53)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSubAgent(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),ml(),Yw(8,Ft,2,1,"button",54),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSubAgentsSelected()),QE(2),Lg(e.name),QE(),Qw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),QE(3),Qw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&Jw(0,Nt,9,5,"div",32,We),n&2){let e=dC(2);eC(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=sC();Is(0,"div")(1,"button",56),Eg("click",function(){mf(e);let s=dC(2);return yf(s.useDefaultDelegationTimeout())}),HC(2," Use server default "),ml()();}}function Vt(n,t){n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2&&(QE(),Lg(t));}function Pt(n,t){if(n&1){let e=sC();Is(0,"button",57),Eg("click",function(){mf(e);let s=dC(2);return yf(s.exportYaml())}),HC(1),ml();}if(n&2){let e=dC(2);pg("disabled",e.isExporting()),QE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=sC();Is(0,"form",6),Eg("ngSubmit",function(){mf(e);let s=dC();return yf(s.submit())}),Is(1,"ds-fieldset",7)(2,"ds-form-field",8),hg(3,"input",9),BI(),ml(),Is(4,"div",10)(5,"label",11),hg(6,"input",12),BI(),HC(7," Enabled "),ml(),Is(8,"p",13),HC(9,"Disabled agents are excluded from namespace resolution."),ml()(),Is(10,"ds-form-field",14),hg(11,"input",15),BI(),ml(),Is(12,"ds-form-field",16),Yw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),ml(),Is(15,"ds-form-field",19),hg(16,"textarea",20),BI(),ml()(),Yw(17,gt,5,2,"ds-fieldset",21),Is(18,"ds-fieldset",22)(19,"p",4),HC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Is(21,"code"),HC(22,"readSkill"),ml(),HC(23," and "),Is(24,"code"),HC(25,"readSkillResource"),ml(),HC(26," tools; selecting none grants neither. "),Yw(27,pt,1,0),ml(),Is(28,"label",11)(29,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSkills())}),ml(),Is(30,"span",24),HC(31,"Every skill in the catalogue ("),Is(32,"code",25),HC(33,"*"),ml(),HC(34,")"),ml()(),Is(35,"p",13),HC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),ml(),Yw(37,ft,5,0,"ds-notice",26),Yw(38,Ct,2,0,"ds-notice"),Yw(39,_t,2,0,"p",4)(40,xt,2,0),ml(),Is(41,"ds-form-field",27)(42,"select",28)(43,"option",29),HC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),ml(),Is(45,"option",29),HC(46,"ADVANCED \u2014 Multi-step reasoning loop"),ml(),Is(47,"option",29),HC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),ml()(),BI(),ml(),Yw(49,St,7,3,"ds-form-field",30),Is(50,"ds-fieldset",31)(51,"p",4),HC(52," The agents this one may delegate to. Selecting at least one grants it the "),Is(53,"code"),HC(54,"DELEGATE__delegate"),ml(),HC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Yw(56,At,1,0),ml(),Is(57,"label",11)(58,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSubAgents())}),ml(),Is(59,"span",24),HC(60,"Every agent it can reach ("),Is(61,"code",25),HC(62,"*"),ml(),HC(63,")"),ml()(),Is(64,"p",13),HC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),ml(),Yw(66,Et,6,1,"ds-notice",26),Yw(67,Tt,2,0,"ds-notice"),Yw(68,kt,2,0,"p",4)(69,Dt,2,0),Is(70,"p",4),HC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Is(72,"code"),HC(73,"*Fixer"),ml(),HC(74," to cover BugFixer and StoryFixer. "),ml(),Is(75,"div",32)(76,"input",33),Eg("keydown.enter",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),ml(),BI(),Is(77,"button",34),Eg("click",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),HC(78," + "),ml()(),Is(79,"ds-form-field",35),hg(80,"input",36),BI(),Yw(81,Lt,3,0,"div"),ml()(),Yw(82,Vt,2,1,"ds-notice"),Is(83,"ds-form-actions")(84,"button",37),HC(85),ml(),Yw(86,Pt,2,2,"button",38),Is(87,"button",39),Eg("click",function(){mf(e);let s=dC();return yf(s.cancel())}),HC(88,"Cancel"),ml()()();}if(n&2){let e,i=dC();pg("formGroup",i.form),QE(3),pg("formControl",i.nameControl),HI(),QE(3),pg("formControl",i.enabledControl),HI(),QE(5),pg("formControl",i.descriptionControl),HI(),QE(2),Qw(i.modelAsFreeText()?13:14),QE(3),pg("formControl",i.instructionsControl),HI(),QE(),Qw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),QE(10),Qw(i.isPlatformMode?27:-1),QE(2),pg("checked",i.allSkillsSelected()),QE(8),Qw(i.namedSkillSelectionDropped()?37:-1),QE(),Qw(i.skillCatalogueUnavailable()?38:-1),QE(),Qw(i.skillRows().length===0?39:40),QE(3),pg("formControl",i.executionModeControl),HI(),QE(),pg("value",i.ExecutionMode.SIMPLE),QE(2),pg("value",i.ExecutionMode.ADVANCED),QE(2),pg("value",i.ExecutionMode.LOOP),QE(2),Qw(i.isLoopMode()?49:-1),QE(7),Qw(i.isPlatformMode?56:-1),QE(2),pg("checked",i.allSubAgentsSelected()),QE(8),Qw(i.namedSubAgentSelectionDropped()?66:-1),QE(),Qw(i.subAgentCandidatesUnavailable()?67:-1),QE(),Qw(i.subAgentRows().length===0?68:69),QE(8),pg("formControl",i.newSubAgentControl),HI(),QE(),pg("disabled",!i.newSubAgentControl.value.trim()),QE(2),pg("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),QE(),pg("formControl",i.delegationTimeoutControl),fg("aria-invalid",i.delegationTimeoutControl.invalid),HI(),QE(),Qw(i.delegationTimeoutControl.value!==null?81:-1),QE(),Qw((e=i.submitError())?82:-1,e),QE(2),pg("disabled",i.form.invalid||i.isSubmitting()),QE(),Il(" ",i.isEditMode()?"Save changes":"Create"," "),QE(),Qw(i.isEditMode()?86:-1);}}var Ke=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=zi(null);exportService=g(Q);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[bn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[bn.min(1),bn.max(2147483647),bn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=mT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=mT(()=>this.executionModeValue()==="LOOP");subAgentRows=zi([]);allSubAgentsSelected=zi(false);subAgentCandidatesUnavailable=zi(false);namedSubAgentSelectionDropped=mT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=mT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=mT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);submitError=zi(null);ExecutionMode=Me;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=zi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=mT(()=>Ue({configEnabled:this.builtInRows().some(t=>t.type===Ge&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=zi({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=zi(false);modelAsFreeText=mT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=zi([]);skillRows=zi([]);allSkillsSelected=zi(false);skillCatalogueUnavailable=zi(false);namedSkillSelectionDropped=mT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ga(()=>_r(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Ny({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:c,skillCatalogue:C,delegationCandidates:E,models:T})=>{this.existingConfig=e,this.applyModelCatalogue(T,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.allSubAgentsSelected.set(Be(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ny({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:c,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let T=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(T,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(c,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(ga(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),_r([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),c=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:zi(c.has(f.name.toLowerCase()))})),T=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||T.has(N)||(T.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:zi(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):_r([]);return Ny({platform:t,namespace:e}).pipe(ne(({platform:i,namespace:s})=>[...i,...s]),ne(i=>i.map(s=>s.name).filter(s=>s.length>0)),ne(i=>n.dedupeByKey(i)))}orNoCandidates(){return ga(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),_r([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=$e(e),c=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==c||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),T=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:zi(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),T.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:zi(true)}));}return T}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ga(t=>(console.error("[agent-config-form] failed to load integration types",t),_r([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",c=e?.[s],C=e!=null&&s in e,E=Array.isArray(c)?c.join(", "):"";return {config:i,enabled:zi(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,c=e?.[i.type],C=s?Array.isArray(c)&&c.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:zi(C),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:zi(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",c=i.toolsControl.value.trim();t[s]=c===""?null:c.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return i.cancel()}),HC(3," \u2190 Agent configs "),ml(),Yw(4,ze,2,1,"a",2),Yw(5,Xe,2,0,"ds-tag",3),ml(),Yw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),ml()),e&2&&(QE(),pg("title",i.isEditMode()?"Edit agent config":"New agent config"),QE(3),Qw(i.isEditMode()?4:-1),QE(),Qw(i.isPlatformMode?5:-1),QE(),Qw(i.isLoading()?6:7));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,$t,vn,yn,fn,pn,hn,_n,at$1,un,cn,Ao],encapsulation:2})};export{Ke as AgentConfigFormComponent};
|
|
1
|
+
import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-DLffGFin.js';import {O}from'./chunk-BgfuCnTj.js';import {g,W,F as F$1,K as we,ag as U,ay as N,z as zi,az as Q,a8 as _,j as mT,a9 as F$2,aA as Me,U as U$1,a2 as ga,aa as _r,ac as Ny,ad as ne,O as x,M as w,N as Nw,au as $t,I as Is,R as Eg,H as HC,m as ml,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,s as sC,a as hg,S as BI,T as HI,i as fg,o as Il,J as Jw,k as eC,L as Lg,q as mf,r as yf,as as jg}from'./main-IUUK3O6C.js';import {H as A,p as pt$1,T as Te,b as bn,I as E,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,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at$1,u as un,n as cn,A as Ao}from'./chunk-DNpsnpVA.js';import'./chunk-BSz21_Vu.js';var F="*";function Be(n){return (n??[]).some(t=>t.trim()===F)}function $e(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F).map(e=>e.toLowerCase());return new Set(t)}function j(n){return n.includes(F)}function He(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==F&&j(e)).some(e=>He(e)?.test(n)??false)}var Ge="AGENTOS_CONFIG",Je=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ue(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Je.has(t)))}var je=(n,t)=>t.value,Ye=(n,t)=>t.config.id,qe=(n,t)=>t.type,We=(n,t)=>t.selector;function ze(n,t){if(n&1&&(Is(0,"a",2),HC(1,"View resolved definition \u2192"),ml()),n&2){let e=dC();pg("routerLink",e.inspectRoute());}}function Xe(n,t){n&1&&(Is(0,"ds-tag",3),HC(1,"Platform level"),ml());}function Qe(n,t){n&1&&(Is(0,"p",4),HC(1,"Loading\u2026"),ml());}function Ze(n,t){if(n&1&&(hg(0,"input",17),BI()),n&2){let e=dC(2);pg("formControl",e.modelNameControl),HI();}}function et(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t;pg("ngValue",e.value),QE(),Lg(e.label);}}function tt(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function nt(n,t){if(n&1&&(Is(0,"optgroup",42),Jw(1,tt,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().aliases);}}function it(n,t){if(n&1&&(Is(0,"option",41),HC(1),ml()),n&2){let e=t.$implicit;pg("ngValue",e.value),QE(),Lg(e.label);}}function ot(n,t){if(n&1&&(Is(0,"optgroup",43),Jw(1,it,2,2,"option",41,je),ml()),n&2){let e=dC(3);QE(),eC(e.modelOptions().apiNames);}}function at(n,t){if(n&1&&(Is(0,"select",18)(1,"option",40),HC(2,"Select a model"),ml(),Yw(3,et,2,2,"option",41),Yw(4,nt,3,0,"optgroup",42),Yw(5,ot,3,0,"optgroup",43),ml(),BI()),n&2){let e,i=dC(2);pg("formControl",i.modelNameControl),HI(),QE(),pg("ngValue",null),QE(2),Qw((e=i.modelOptions().current)?3:-1,e),QE(),Qw(i.modelOptions().aliases.length>0?4:-1),QE(),Qw(i.modelOptions().apiNames.length>0?5:-1);}}function lt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.config.integrationType);}}function rt(n,t){if(n&1&&(hg(0,"input",45),BI()),n&2){let e=dC().$implicit;pg("formControl",e.toolsControl),fg("aria-label","Tools of "+e.config.name),HI();}}function st(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",23),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleIntegration(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,lt,2,1,"span",44),ml(),Yw(6,rt,1,2,"input",45),ml();}if(n&2){let e=t.$implicit;QE(2),pg("checked",e.enabled()),QE(2),Lg(e.config.name),QE(),Qw(e.config.integrationType?5:-1),QE(),Qw(e.enabled()?6:-1);}}function dt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Il(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function ct(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",24),HC(2),Is(3,"span",44),HC(4,"built-in"),ml()(),Is(5,"select",47),Eg("change",function(s){let c=mf(e).$implicit,C=dC(4);return yf(C.setBuiltInState(c,s.target.value))}),Is(6,"option",48),HC(7),ml(),Is(8,"option",49),HC(9,"Enabled"),ml(),Is(10,"option",50),HC(11,"Disabled"),ml()(),Yw(12,dt,2,1,"p",13),Is(13,"p",13),HC(14),ml()();}if(n&2){let e=t.$implicit,i=dC(4);QE(),fg("for","built-in-"+e.type),QE(),Il(" ",e.displayName," "),QE(3),pg("id","built-in-"+e.type)("value",e.state()),QE(2),Lg(i.builtInDefaultLabel(e)),QE(5),Qw(e.state()==="on"&&e.restrictedTools?12:-1),QE(2),Lg(e.description);}}function mt(n,t){if(n&1&&(Is(0,"span",46),HC(1,"Built-in integrations"),ml(),Jw(2,ct,15,7,"div",10,qe)),n&2){let e=dC(3);QE(2),eC(e.builtInRows());}}function ut(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),ml());}function gt(n,t){if(n&1&&(Is(0,"ds-fieldset",21),Jw(1,st,7,4,"div",10,Ye),Yw(3,mt,4,0),Yw(4,ut,2,0,"ds-notice",26),ml()),n&2){let e=dC(2);QE(),eC(e.integrationRows()),QE(2),Qw(e.builtInRows().length>0?3:-1),QE(),Qw(e.configAgentExposureWarning()?4:-1);}}function pt(n,t){n&1&&HC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function ft(n,t){n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),ml());}function Ct(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function _t(n,t){n&1&&(Is(0,"p",4),HC(1,"No skill available in this scope yet."),ml());}function bt(n,t){n&1&&(Is(0,"span",44),HC(1,"platform"),ml());}function ht(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function yt(n,t){if(n&1&&(Is(0,"p",13),HC(1),ml()),n&2){let e=dC().$implicit;QE(),Lg(e.description);}}function vt(n,t){if(n&1){let e=sC();Is(0,"div",10)(1,"label",11)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSkill(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,bt,2,0,"span",44),Yw(6,ht,2,1,"span",44),ml(),Yw(7,yt,2,1,"p",13),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSkillsSelected()),QE(2),Lg(e.name),QE(),Qw(e.platform?5:-1),QE(),Qw(e.unresolved?6:-1),QE(),Qw(e.description?7:-1);}}function xt(n,t){if(n&1&&Jw(0,vt,8,6,"div",10,We),n&2){let e=dC(2);eC(e.skillRows());}}function St(n,t){if(n&1&&(Is(0,"ds-form-field",30),hg(1,"textarea",52),BI(),Is(2,"p",4),HC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Is(4,"code"),HC(5,"AgentLoopPayload"),ml(),HC(6,". Leave empty if you always provide the payload at launch. "),ml()()),n&2){let e=dC(2);pg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),QE(),pg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),HI();}}function At(n,t){n&1&&HC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function wt(n,t){if(n&1&&HC(0),n&2){let e=dC(3);jg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Et(n,t){if(n&1&&(Is(0,"ds-notice",26),HC(1," Saving with this on replaces the selection below with "),Is(2,"code",25),HC(3,"*"),ml(),HC(4,". "),Yw(5,wt,1,2),ml()),n&2){let e=dC(2);QE(5),Qw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Tt(n,t){n&1&&(Is(0,"ds-notice"),HC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function kt(n,t){n&1&&(Is(0,"p",4),HC(1,"No other agent is available in this scope yet."),ml());}function It(n,t){n&1&&(Is(0,"span",44),HC(1,"pattern"),ml());}function Rt(n,t){n&1&&(Is(0,"span",44),HC(1,"via pattern"),ml());}function Mt(n,t){if(n&1&&(Is(0,"span",44),HC(1),ml()),n&2){let e=dC(4);QE(),Il(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ft(n,t){if(n&1){let e=sC();Is(0,"button",55),Eg("click",function(){mf(e);let s=dC().$implicit,c=dC(3);return yf(c.removeSubAgent(s))}),HC(1," \xD7 "),ml();}if(n&2){let e=dC().$implicit;fg("aria-label","Remove "+e.selector);}}function Nt(n,t){if(n&1){let e=sC();Is(0,"div",32)(1,"label",53)(2,"input",51),Eg("change",function(){let s=mf(e).$implicit,c=dC(3);return yf(c.toggleSubAgent(s))}),ml(),Is(3,"span",24),HC(4),ml(),Yw(5,It,2,0,"span",44)(6,Rt,2,0,"span",44)(7,Mt,2,1,"span",44),ml(),Yw(8,Ft,2,1,"button",54),ml();}if(n&2){let e=t.$implicit,i=dC(3);QE(2),pg("checked",e.selected())("disabled",i.allSubAgentsSelected()),QE(2),Lg(e.name),QE(),Qw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),QE(3),Qw(e.unresolved?8:-1);}}function Dt(n,t){if(n&1&&Jw(0,Nt,9,5,"div",32,We),n&2){let e=dC(2);eC(e.subAgentRows());}}function Lt(n,t){if(n&1){let e=sC();Is(0,"div")(1,"button",56),Eg("click",function(){mf(e);let s=dC(2);return yf(s.useDefaultDelegationTimeout())}),HC(2," Use server default "),ml()();}}function Vt(n,t){n&1&&(Is(0,"ds-notice"),HC(1),ml()),n&2&&(QE(),Lg(t));}function Pt(n,t){if(n&1){let e=sC();Is(0,"button",57),Eg("click",function(){mf(e);let s=dC(2);return yf(s.exportYaml())}),HC(1),ml();}if(n&2){let e=dC(2);pg("disabled",e.isExporting()),QE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ot(n,t){if(n&1){let e=sC();Is(0,"form",6),Eg("ngSubmit",function(){mf(e);let s=dC();return yf(s.submit())}),Is(1,"ds-fieldset",7)(2,"ds-form-field",8),hg(3,"input",9),BI(),ml(),Is(4,"div",10)(5,"label",11),hg(6,"input",12),BI(),HC(7," Enabled "),ml(),Is(8,"p",13),HC(9,"Disabled agents are excluded from namespace resolution."),ml()(),Is(10,"ds-form-field",14),hg(11,"input",15),BI(),ml(),Is(12,"ds-form-field",16),Yw(13,Ze,1,1,"input",17)(14,at,6,5,"select",18),ml(),Is(15,"ds-form-field",19),hg(16,"textarea",20),BI(),ml()(),Yw(17,gt,5,2,"ds-fieldset",21),Is(18,"ds-fieldset",22)(19,"p",4),HC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Is(21,"code"),HC(22,"readSkill"),ml(),HC(23," and "),Is(24,"code"),HC(25,"readSkillResource"),ml(),HC(26," tools; selecting none grants neither. "),Yw(27,pt,1,0),ml(),Is(28,"label",11)(29,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSkills())}),ml(),Is(30,"span",24),HC(31,"Every skill in the catalogue ("),Is(32,"code",25),HC(33,"*"),ml(),HC(34,")"),ml()(),Is(35,"p",13),HC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),ml(),Yw(37,ft,5,0,"ds-notice",26),Yw(38,Ct,2,0,"ds-notice"),Yw(39,_t,2,0,"p",4)(40,xt,2,0),ml(),Is(41,"ds-form-field",27)(42,"select",28)(43,"option",29),HC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),ml(),Is(45,"option",29),HC(46,"ADVANCED \u2014 Multi-step reasoning loop"),ml(),Is(47,"option",29),HC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),ml()(),BI(),ml(),Yw(49,St,7,3,"ds-form-field",30),Is(50,"ds-fieldset",31)(51,"p",4),HC(52," The agents this one may delegate to. Selecting at least one grants it the "),Is(53,"code"),HC(54,"DELEGATE__delegate"),ml(),HC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Yw(56,At,1,0),ml(),Is(57,"label",11)(58,"input",23),Eg("change",function(){mf(e);let s=dC();return yf(s.toggleAllSubAgents())}),ml(),Is(59,"span",24),HC(60,"Every agent it can reach ("),Is(61,"code",25),HC(62,"*"),ml(),HC(63,")"),ml()(),Is(64,"p",13),HC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),ml(),Yw(66,Et,6,1,"ds-notice",26),Yw(67,Tt,2,0,"ds-notice"),Yw(68,kt,2,0,"p",4)(69,Dt,2,0),Is(70,"p",4),HC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Is(72,"code"),HC(73,"*Fixer"),ml(),HC(74," to cover BugFixer and StoryFixer. "),ml(),Is(75,"div",32)(76,"input",33),Eg("keydown.enter",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),ml(),BI(),Is(77,"button",34),Eg("click",function(){mf(e);let s=dC();return yf(s.addSubAgent())}),HC(78," + "),ml()(),Is(79,"ds-form-field",35),hg(80,"input",36),BI(),Yw(81,Lt,3,0,"div"),ml()(),Yw(82,Vt,2,1,"ds-notice"),Is(83,"ds-form-actions")(84,"button",37),HC(85),ml(),Yw(86,Pt,2,2,"button",38),Is(87,"button",39),Eg("click",function(){mf(e);let s=dC();return yf(s.cancel())}),HC(88,"Cancel"),ml()()();}if(n&2){let e,i=dC();pg("formGroup",i.form),QE(3),pg("formControl",i.nameControl),HI(),QE(3),pg("formControl",i.enabledControl),HI(),QE(5),pg("formControl",i.descriptionControl),HI(),QE(2),Qw(i.modelAsFreeText()?13:14),QE(3),pg("formControl",i.instructionsControl),HI(),QE(),Qw(i.integrationRows().length>0||i.builtInRows().length>0?17:-1),QE(10),Qw(i.isPlatformMode?27:-1),QE(2),pg("checked",i.allSkillsSelected()),QE(8),Qw(i.namedSkillSelectionDropped()?37:-1),QE(),Qw(i.skillCatalogueUnavailable()?38:-1),QE(),Qw(i.skillRows().length===0?39:40),QE(3),pg("formControl",i.executionModeControl),HI(),QE(),pg("value",i.ExecutionMode.SIMPLE),QE(2),pg("value",i.ExecutionMode.ADVANCED),QE(2),pg("value",i.ExecutionMode.LOOP),QE(2),Qw(i.isLoopMode()?49:-1),QE(7),Qw(i.isPlatformMode?56:-1),QE(2),pg("checked",i.allSubAgentsSelected()),QE(8),Qw(i.namedSubAgentSelectionDropped()?66:-1),QE(),Qw(i.subAgentCandidatesUnavailable()?67:-1),QE(),Qw(i.subAgentRows().length===0?68:69),QE(8),pg("formControl",i.newSubAgentControl),HI(),QE(),pg("disabled",!i.newSubAgentControl.value.trim()),QE(2),pg("hint",i.delegationTimeoutHint())("error",i.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),QE(),pg("formControl",i.delegationTimeoutControl),fg("aria-invalid",i.delegationTimeoutControl.invalid),HI(),QE(),Qw(i.delegationTimeoutControl.value!==null?81:-1),QE(),Qw((e=i.submitError())?82:-1,e),QE(2),pg("disabled",i.form.invalid||i.isSubmitting()),QE(),Il(" ",i.isEditMode()?"Save changes":"Create"," "),QE(),Qw(i.isEditMode()?86:-1);}}var Ke=class n{route=g(W);router=g(F$1);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=zi(null);exportService=g(Q);integrationConfigState=g(O);integrationTypeController=g(_);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[bn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[bn.min(1),bn.max(2147483647),bn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(i){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=mT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$2(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=mT(()=>this.executionModeValue()==="LOOP");subAgentRows=zi([]);allSubAgentsSelected=zi(false);subAgentCandidatesUnavailable=zi(false);namedSubAgentSelectionDropped=mT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=mT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=mT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);submitError=zi(null);ExecutionMode=Me;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=zi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=mT(()=>Ue({configEnabled:this.builtInRows().some(t=>t.type===Ge&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=zi({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=zi(false);modelAsFreeText=mT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=zi([]);skillRows=zi([]);allSkillsSelected=zi(false);skillCatalogueUnavailable=zi(false);namedSkillSelectionDropped=mT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ga(()=>_r(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Ny({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:i,platformIntegrations:s,builtInTypes:c,skillCatalogue:C,delegationCandidates:E,models:T})=>{this.existingConfig=e,this.applyModelCatalogue(T,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let N=[...s,...i];this.integrationRows.set(this.buildIntegrationRows(N,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,e.integrations??void 0)),this.allSubAgentsSelected.set(Be(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(E,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ny({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:i,builtInTypes:s,skillCatalogue:c,delegationCandidates:C,models:E})=>{this.applyModelCatalogue(E,null);let T=[...i,...e];this.integrationRows.set(this.buildIntegrationRows(T,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(c,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(i=>({id:i.id??"",name:i.name,description:i.description,namespaceId:i.namespaceId??null,readOnly:i.readOnly===true}))))).pipe(ga(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),_r([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),c=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),E=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:zi(c.has(f.name.toLowerCase()))})),T=new Set;for(let f of s){let N=l(f).toLowerCase();C.has(N)||T.has(N)||(T.add(N),E.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:zi(true)}));}return E}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):_r([]);return Ny({platform:t,namespace:e}).pipe(ne(({platform:i,namespace:s})=>[...i,...s]),ne(i=>i.map(s=>s.name).filter(s=>s.length>0)),ne(i=>n.dedupeByKey(i)))}orNoCandidates(){return ga(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),_r([])))}static dedupeByKey(t){let e=new Set;return t.filter(i=>{let s=i.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,i){let s=$e(e),c=i?.toLowerCase()??null,C=t.filter(_=>{let O=_.toLowerCase();return O!==c||s.has(O)}),E=new Set(C.map(_=>_.toLowerCase())),T=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:zi(s.has(_.toLowerCase()))})),f=new Set,N=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==F);for(let _ of N){let O=_.toLowerCase();E.has(O)||f.has(O)||(f.add(O),T.push({selector:_,name:_,unresolved:true,pattern:j(_),grantedByPattern:false,selected:zi(true)}));}return T}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ga(t=>(console.error("[agent-config-form] failed to load integration types",t),_r([]))))}buildIntegrationRows(t,e){return t.map(i=>{let s=i.name??"",c=e?.[s],C=e!=null&&s in e,E=Array.isArray(c)?c.join(", "):"";return {config:i,enabled:zi(C),toolsControl:new Te(E,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(i=>{let s=e!=null&&i.type in e,c=e?.[i.type],C=s?Array.isArray(c)&&c.length===0?"off":"on":"default";return {type:i.type,displayName:i.displayName,description:i.description,enabledByDefault:i.enabledByDefault===true,state:zi(C),restrictedTools:Array.isArray(c)&&c.length>0?c:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(i=>i.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===F?this.allSubAgentsSelected.set(true):this.subAgentRows.update(i=>this.withPatternGrants([...i,{selector:t,name:t,unresolved:true,pattern:j(t),grantedByPattern:false,selected:zi(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(i=>this.withPatternGrants(i.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(i=>i.selected()).map(i=>i.selector);return t.map(i=>i.unresolved?i:x(w({},i),{grantedByPattern:Y(i.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [F];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let i of this.integrationRows().filter(s=>s.enabled())){let s=i.config.name??"",c=i.toolsControl.value.trim();t[s]=c===""?null:c.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let i of this.builtInRows()){let s=i.state();s==="on"?t[i.type]=i.restrictedTools??null:s==="off"&&(t[i.type]=[]);}let e=new Set([...this.integrationRows().map(i=>i.config.name??""),...this.builtInRows().map(i=>i.type)]);for(let[i,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(i)||(t[i]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(i));}});}static serverMessage(t){let i=t?.error?.message;if(typeof i=="string"&&i.trim().length>0)return i;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=`${this.existingConfig?.name??"agent"}.yaml`,c.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Nw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,i){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return i.cancel()}),HC(3," \u2190 Agent configs "),ml(),Yw(4,ze,2,1,"a",2),Yw(5,Xe,2,0,"ds-tag",3),ml(),Yw(6,Qe,2,0,"p",4)(7,Ot,89,33,"form",5),ml()),e&2&&(QE(),pg("title",i.isEditMode()?"Edit agent config":"New agent config"),QE(3),Qw(i.isEditMode()?4:-1),QE(),Qw(i.isPlatformMode?5:-1),QE(),Qw(i.isLoading()?6:7));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,$t,vn,yn,fn,pn,hn,_n,at$1,un,cn,Ao],encapsulation:2})};export{Ke as AgentConfigFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {q as k,O,a5 as w,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-CV72_wbg.js';import {I}from'./chunk-DEd4dYEy.js';import {v}from'./chunk-C-TFPDAn.js';import {g,W,F,K as we,z as zi,U,ad as ne$1,a1 as ma,aa as _r,aM as di,a2 as ga,ac as Ny,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,w as xC,i as fg,o as Il,J as Jw,k as eC,s as sC,q as mf,r as yf}from'./main-2W2EKPFF.js';import'./chunk-gOvITjLx.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let e=dC();QE(),Lg(e.deletion.error());}}function Z(i,t){if(i&1&&(Is(0,"p"),HC(1),ml()),i&2){let e=t;xC(e.kind==="error"?"settings-table__error":"settings-table__status"),fg("role",e.kind==="error"?"alert":"status"),QE(),Il(" ",e.text," ");}}function ee(i,t){i&1&&(Is(0,"p",5),HC(1,"Loading auth settings\u2026"),ml());}function te(i,t){i&1&&(Is(0,"p",6),HC(1,"No auth settings available."),ml());}function ne(i,t){i&1&&(Is(0,"p",5),HC(1,"No auth settings match the current filter."),ml());}function ie(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Read-only"),ml());}function oe(i,t){i&1&&(Is(0,"ds-tag",20),HC(1,"Connected"),ml());}function ae(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Not connected"),ml());}function se(i,t){i&1&&(Is(0,"span",21),HC(1,"\u2014"),ml());}function re(i,t){if(i&1){let e=sC();Is(0,"span",26),HC(1,"Waiting for authorization\u2026"),ml(),Is(2,"button",27),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelConnect())}),HC(3," Cancel "),ml();}if(i&2){let e=dC(2).$implicit;QE(2),fg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=sC();Is(0,"span",28),HC(1,"Disconnect?"),ml(),Is(2,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.confirmReset(r))}),HC(3),ml(),Is(4,"button",29),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelReset())}),HC(5," Cancel "),ml();}if(i&2){let e=dC(2).$implicit,n=dC(2);QE(2),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Confirm disconnecting "+e.config.name),QE(),Il(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),QE(),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(3).$implicit,d=dC(2);return yf(d.requestReset(r))}),HC(1," Disconnect "),ml();}if(i&2){let e=dC(3).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null),fg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.connect(r))}),HC(1),ml(),Yw(2,ce,2,2,"button",30);}if(i&2){let e=dC(2).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),fg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),QE(),Il(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),QE(),Qw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Yw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=dC().$implicit,n=dC(2);Qw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.duplicate(r))}),HC(1," Duplicate "),ml();}if(i&2){let e=dC().$implicit;fg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.edit(r))}),HC(1," Edit "),ml();}if(i&2){let e=dC(2).$implicit;fg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=sC();Yw(0,_e,2,1,"button",24),Is(1,"agentos-row-delete-action",31),Eg("deleteRequested",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.deletion.request(r.key))})("deleteConfirmed",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.confirmDelete(r))})("deleteCancelled",function(){mf(e);let r=dC(3);return yf(r.deletion.cancel())}),ml();}if(i&2){let e=dC().$implicit,n=dC(2);Qw(n.deletion.confirmingId()!==e.key?0:-1),QE(),pg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Is(0,"button",25),HC(1,"Inherited"),ml());}function he(i,t){if(i&1&&(Is(0,"tr",10)(1,"td",13),HC(2),ml(),Is(3,"td",14),HC(4),ml(),Is(5,"td",15)(6,"div",16)(7,"ds-tag",17),HC(8),ml(),Yw(9,ie,2,0,"ds-tag",18),ml()(),Is(10,"td",19),Yw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),ml(),Is(14,"td",22)(15,"div",23),Yw(16,pe,3,1),Yw(17,ue,2,1,"button",24),Yw(18,me,2,4)(19,ge,2,0,"button",25),ml()()()),i&2){let e=t.$implicit,n=dC(2);QE(2),Lg(e.config.name),QE(2),Il(" ",e.config.authType," "),QE(3),pg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),QE(),Lg(e.scopeLabel),QE(),Qw(e.canMutate?-1:9),QE(2),Qw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),QE(5),Qw(n.isOAuth(e)?16:-1),QE(),Qw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),QE(),Qw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Is(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),HC(5,"Name"),ml(),Is(6,"th",11),HC(7,"Authentication type"),ml(),Is(8,"th",11),HC(9,"Scope"),ml(),Is(10,"th",11),HC(11,"Connection"),ml(),Is(12,"th",11)(13,"span",12),HC(14,"Actions"),ml()()()(),Is(15,"tbody",9),Jw(16,he,20,9,"tr",10,Q),ml()()()),i&2){let e=dC();QE(16),eC(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=zi(false);isLoading=zi(true);rows=zi([]);deletion=k();connections=zi({});connectingKey=zi(null);resetConfirmingKey=zi(null);resettingKey=zi(null);actionMessage=zi(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ma(t=>t?this.namespaceRole.isAdminOfNamespace$(t):_r(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(di(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ga(()=>_r([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ny(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Nw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(d){return n.rowFilter.query.set(d)}),ml(),Is(2,"button",2),Eg("click",function(){return n.openCreateForm()}),HC(3,"New auth setting"),ml()(),Yw(4,X,2,1,"p",3),Yw(5,Z,2,4,"p",4),Yw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;QE(),pg("query",n.rowFilter.query()),QE(3),Qw(n.deletion.error()?4:-1),QE(),Qw((r=n.actionMessage())?5:-1,r),QE(),Qw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {q as k,O,a5 as w,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-DNpsnpVA.js';import {I}from'./chunk-D-F4_F5P.js';import {v}from'./chunk-Dkderx1H.js';import {g,W,F,K as we,z as zi,U,ad as ne$1,a1 as ma,aa as _r,aM as di,a2 as ga,ac as Ny,N as Nw,I as Is,R as Eg,m as ml,H as HC,Y as Yw,Q as QE,P as pg,b as Qw,p as dC,L as Lg,w as xC,i as fg,o as Il,J as Jw,k as eC,s as sC,q as mf,r as yf}from'./main-IUUK3O6C.js';import'./chunk-BSz21_Vu.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Is(0,"p",3),HC(1),ml()),i&2){let e=dC();QE(),Lg(e.deletion.error());}}function Z(i,t){if(i&1&&(Is(0,"p"),HC(1),ml()),i&2){let e=t;xC(e.kind==="error"?"settings-table__error":"settings-table__status"),fg("role",e.kind==="error"?"alert":"status"),QE(),Il(" ",e.text," ");}}function ee(i,t){i&1&&(Is(0,"p",5),HC(1,"Loading auth settings\u2026"),ml());}function te(i,t){i&1&&(Is(0,"p",6),HC(1,"No auth settings available."),ml());}function ne(i,t){i&1&&(Is(0,"p",5),HC(1,"No auth settings match the current filter."),ml());}function ie(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Read-only"),ml());}function oe(i,t){i&1&&(Is(0,"ds-tag",20),HC(1,"Connected"),ml());}function ae(i,t){i&1&&(Is(0,"ds-tag",18),HC(1,"Not connected"),ml());}function se(i,t){i&1&&(Is(0,"span",21),HC(1,"\u2014"),ml());}function re(i,t){if(i&1){let e=sC();Is(0,"span",26),HC(1,"Waiting for authorization\u2026"),ml(),Is(2,"button",27),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelConnect())}),HC(3," Cancel "),ml();}if(i&2){let e=dC(2).$implicit;QE(2),fg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=sC();Is(0,"span",28),HC(1,"Disconnect?"),ml(),Is(2,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.confirmReset(r))}),HC(3),ml(),Is(4,"button",29),Eg("click",function(){mf(e);let r=dC(4);return yf(r.cancelReset())}),HC(5," Cancel "),ml();}if(i&2){let e=dC(2).$implicit,n=dC(2);QE(2),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Confirm disconnecting "+e.config.name),QE(),Il(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),QE(),pg("disabled",n.resettingKey()===e.key),fg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(3).$implicit,d=dC(2);return yf(d.requestReset(r))}),HC(1," Disconnect "),ml();}if(i&2){let e=dC(3).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null),fg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=sC();Is(0,"button",29),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.connect(r))}),HC(1),ml(),Yw(2,ce,2,2,"button",30);}if(i&2){let e=dC(2).$implicit,n=dC(2);pg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),fg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),QE(),Il(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),QE(),Qw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Yw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=dC().$implicit,n=dC(2);Qw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.duplicate(r))}),HC(1," Duplicate "),ml();}if(i&2){let e=dC().$implicit;fg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=sC();Is(0,"button",27),Eg("click",function(){mf(e);let r=dC(2).$implicit,d=dC(2);return yf(d.edit(r))}),HC(1," Edit "),ml();}if(i&2){let e=dC(2).$implicit;fg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=sC();Yw(0,_e,2,1,"button",24),Is(1,"agentos-row-delete-action",31),Eg("deleteRequested",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.deletion.request(r.key))})("deleteConfirmed",function(){mf(e);let r=dC().$implicit,d=dC(2);return yf(d.confirmDelete(r))})("deleteCancelled",function(){mf(e);let r=dC(3);return yf(r.deletion.cancel())}),ml();}if(i&2){let e=dC().$implicit,n=dC(2);Qw(n.deletion.confirmingId()!==e.key?0:-1),QE(),pg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Is(0,"button",25),HC(1,"Inherited"),ml());}function he(i,t){if(i&1&&(Is(0,"tr",10)(1,"td",13),HC(2),ml(),Is(3,"td",14),HC(4),ml(),Is(5,"td",15)(6,"div",16)(7,"ds-tag",17),HC(8),ml(),Yw(9,ie,2,0,"ds-tag",18),ml()(),Is(10,"td",19),Yw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),ml(),Is(14,"td",22)(15,"div",23),Yw(16,pe,3,1),Yw(17,ue,2,1,"button",24),Yw(18,me,2,4)(19,ge,2,0,"button",25),ml()()()),i&2){let e=t.$implicit,n=dC(2);QE(2),Lg(e.config.name),QE(2),Il(" ",e.config.authType," "),QE(3),pg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),QE(),Lg(e.scopeLabel),QE(),Qw(e.canMutate?-1:9),QE(2),Qw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),QE(5),Qw(n.isOAuth(e)?16:-1),QE(),Qw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),QE(),Qw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Is(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),HC(5,"Name"),ml(),Is(6,"th",11),HC(7,"Authentication type"),ml(),Is(8,"th",11),HC(9,"Scope"),ml(),Is(10,"th",11),HC(11,"Connection"),ml(),Is(12,"th",11)(13,"span",12),HC(14,"Actions"),ml()()()(),Is(15,"tbody",9),Jw(16,he,20,9,"tr",10,Q),ml()()()),i&2){let e=dC();QE(16),eC(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=zi(false);isLoading=zi(true);rows=zi([]);deletion=k();connections=zi({});connectingKey=zi(null);resetConfirmingKey=zi(null);resettingKey=zi(null);actionMessage=zi(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ma(t=>t?this.namespaceRole.isAdminOfNamespace$(t):_r(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(di(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ga(()=>_r([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ny(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Nw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(d){return n.rowFilter.query.set(d)}),ml(),Is(2,"button",2),Eg("click",function(){return n.openCreateForm()}),HC(3,"New auth setting"),ml()(),Yw(4,X,2,1,"p",3),Yw(5,Z,2,4,"p",4),Yw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;QE(),pg("query",n.rowFilter.query()),QE(3),Qw(n.deletion.error()?4:-1),QE(),Qw((r=n.actionMessage())?5:-1,r),QE(),Qw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,aK as ue,a6 as A}from'./main-
|
|
1
|
+
import {g,aK as ue,a6 as A}from'./main-IUUK3O6C.js';var o=class r{skillController=g(ue);getById(l){return this.skillController.getByIdSkill(l)}listPlatform(){return this.skillController.listPlatformSkill()}listByNamespace(l){return this.skillController.listByParentSkill(l)}listEffective(l){return this.skillController.listEffectiveSkill(l)}create(l){return this.skillController.createSkill(l)}update(l,e){return this.skillController.updateSkill(l,e)}delete(l){return this.skillController.deleteSkill(l)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
|