@whoz-oss/coday-client 0.0.0-workstream-forge.219 → 0.0.0-workstream-forge.220
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-ZSk328fF.js → chunk-6zEdcIps.js} +1 -1
- package/browser/chunk-B5eEl07l.js +1 -0
- package/browser/{chunk-BF0rgnCC.js → chunk-BBLPPk_o.js} +1 -1
- package/browser/{chunk-DHanERfq.js → chunk-BM05N8oL.js} +1 -1
- package/browser/{chunk-DhWAUkBX.js → chunk-BPuTg4JQ.js} +1 -1
- package/browser/{chunk-m0YjSCOw.js → chunk-BVGfpYn2.js} +1 -1
- package/browser/{chunk-DN8msylG.js → chunk-BYeNpjs5.js} +1 -1
- package/browser/{chunk-CBdxzSbt.js → chunk-B_50gI3y.js} +1 -1
- package/browser/{chunk-BFX1lFnE.js → chunk-BgWVTYYJ.js} +1 -1
- package/browser/{chunk-_YxNoFY7.js → chunk-BgupfmD4.js} +1 -1
- package/browser/{chunk-CCEk4l94.js → chunk-BiYZtMHe.js} +1 -1
- package/browser/{chunk-BuvMHpJY.js → chunk-BkOARKYi.js} +1 -1
- package/browser/{chunk-BoopuCIf.js → chunk-BlS8im7N.js} +1 -1
- package/browser/{chunk-CIpZHS_8.js → chunk-BldpQhN_.js} +1 -1
- package/browser/{chunk-QwmdeOUA.js → chunk-BsVctJ9r.js} +1 -1
- package/browser/{chunk-CpoFgI-S.js → chunk-C-guYrHg.js} +1 -1
- package/browser/{chunk-B_6ssAY5.js → chunk-CBmMdnwI.js} +1 -1
- package/browser/{chunk-CwMVpUi6.js → chunk-CElIbImY.js} +1 -1
- package/browser/{chunk-By6f_HEs.js → chunk-CJLkP_aL.js} +1 -1
- package/browser/{chunk-DXQ632Xp.js → chunk-CO7YlRKR.js} +1 -1
- package/browser/{chunk-CSSE5nqC.js → chunk-CP4by4ZM.js} +1 -1
- package/browser/{chunk-CGCKp92q.js → chunk-CUPkxKvr.js} +1 -1
- package/browser/{chunk-opQcK-7m.js → chunk-Cbch15h_.js} +1 -1
- package/browser/{chunk-CNsHqmKp.js → chunk-CfIy8NTK.js} +1 -1
- package/browser/{chunk-BHLww9JL.js → chunk-Cs6PVDKT.js} +1 -1
- package/browser/{chunk-DmbOQbMC.js → chunk-D-TW1kvT.js} +1 -1
- package/browser/chunk-D2BTEyR1.js +670 -0
- package/browser/{chunk-C_wAFmSl.js → chunk-D4wgkKOe.js} +1 -1
- package/browser/{chunk-DY9VMqVC.js → chunk-DAb9vQsg.js} +1 -1
- package/browser/{chunk-Dt3T67Y5.js → chunk-DNaBFrnl.js} +1 -1
- package/browser/{chunk-DYmnvP6h.js → chunk-DPJLJzou.js} +1 -1
- package/browser/{chunk-DKEPmfQ1.js → chunk-DPw6IK23.js} +1 -1
- package/browser/{chunk-B3QNuJq1.js → chunk-DSaLJP2p.js} +1 -1
- package/browser/{chunk-Btw49QAD.js → chunk-DYW4g2K_.js} +1 -1
- package/browser/{chunk-CPpEY-Wg.js → chunk-DouSBHR_.js} +1 -1
- package/browser/{chunk-BDdojIym.js → chunk-DrH55v4Y.js} +1 -1
- package/browser/{chunk-CBH9UdK-.js → chunk-DsH4tZb8.js} +1 -1
- package/browser/{chunk-iEurDA3z.js → chunk-DtA8tVTN.js} +1 -1
- package/browser/{chunk-DuUsgvnb.js → chunk-Dw13V5Y9.js} +1 -1
- package/browser/{chunk-Bup68EDE.js → chunk-G3yW7aHe.js} +1 -1
- package/browser/{chunk-mijzc4gr.js → chunk-Ki6OlrsT.js} +1 -1
- package/browser/{chunk-CRBr5Zr-.js → chunk-N087G3DJ.js} +1 -1
- package/browser/{chunk-CXlRgw8a.js → chunk-RMDi6DVr.js} +1 -1
- package/browser/{chunk-DT7C7-dr.js → chunk-YYuiKD5g.js} +1 -1
- package/browser/{chunk-YBMiTrwV.js → chunk-uUbEG3mJ.js} +1 -1
- package/browser/{chunk-DJ_aysdT.js → chunk-xxu5j6Nl.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-CHNQJIYM.js → main-FJXP2G5I.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-1X8ZDw_H.js +0 -1
- package/browser/chunk-C4WQ3FwO.js +0 -670
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-CIpZHS_8.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-C4WQ3FwO.js';import {g,W,F,I as Ie$1,ag as U,ah as ke$1,ai as Ne$1,U as Ui,aj as Fe$1,a9 as F$1,ak as md,X as XC,ac as Ty,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,J as Jw,R as NI,m as Uw,O as Og,r as df,s as ff,t as oh}from'./main-CHNQJIYM.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function _e(n,t){if(n&1&&(Ds(0,"ds-form-field",9),lg(1,"input",38),pl()),n&2){let e=Jw(2);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Ds(0,"a",39),NC(1,"Add an agent config"),pl(),NC(2," first. ")),n&2){let e=Jw(3);ug("href","/agentos/"+e.namespaceId+"/agent-configs/new",oh);}}function xe(n,t){if(n&1&&(Ds(0,"ds-form-field",10)(1,"p",2),NC(2," No agent configs available in this scope yet. "),Lw(3,Se,3,1),pl()()),n&2){let e=Jw(2);BE(3),jw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.id),BE(),Og(e.name);}}function De(n,t){if(n&1&&(Ds(0,"ds-form-field",11)(1,"select",40)(2,"option",41),NC(3,"Select an agent config\u2026"),pl(),Hw(4,Ee,2,2,"option",17,ve),pl(),_I(),pl()),n&2){let e=Jw(2);ug("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(3),Uw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Ne(n,t){if(n&1){let e=Zw();Ds(0,"label",31)(1,"input",43),mg("change",function(){let f=df(e).$implicit,h=Jw(3);return ff(h.toggleDay(f.value))}),pl(),NC(2),pl();}if(n&2){let e=t.$implicit,l=Jw(3);BE(),ug("checked",l.isDaySelected(e.value)),BE(),vl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Ds(0,"ds-form-field",18)(1,"div",42),Hw(2,Ne,3,2,"label",31,V),pl()()),n&2){let e=Jw(2);BE(2),Uw(e.dayOptions);}}function Me(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Pe(n,t){if(n&1&&(Ds(0,"ds-form-field",28),lg(1,"input",44),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),ug("formControl",e.endDateControl),NI();}}function we(n,t){if(n&1&&(Ds(0,"ds-form-field",29),lg(1,"input",45),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),ug("formControl",e.occurrenceCountControl),NI();}}function Fe(n,t){if(n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Jw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Ds(8,"ds-form-field",12),lg(9,"textarea",13),_I(),pl(),Ds(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Hw(13,Te,2,2,"option",17,V),pl(),_I(),pl(),Lw(15,Ie,4,0,"ds-form-field",18),Ds(16,"ds-form-field",19)(17,"div",20),lg(18,"input",21),_I(),Ds(19,"span",22),NC(20,"UTC"),pl()()()(),Ds(21,"ds-fieldset",23)(22,"ds-form-field",24),lg(23,"input",25),_I(),pl(),Ds(24,"ds-form-field",26)(25,"select",27),Hw(26,Me,2,2,"option",17,V),pl(),_I(),pl(),Lw(28,Pe,2,2,"ds-form-field",28),Lw(29,we,2,2,"ds-form-field",29),pl(),Ds(30,"div",30)(31,"label",31),lg(32,"input",32),_I(),NC(33," Enabled "),pl(),Ds(34,"p",33),NC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),pl()(),Ds(36,"ds-form-field",34),lg(37,"textarea",35),_I(),pl(),Lw(38,Fe,2,1,"ds-notice"),Ds(39,"ds-form-actions")(40,"button",36),NC(41),pl(),Ds(42,"button",37),mg("click",function(){df(e);let f=Jw();return ff(f.cancel())}),NC(43,"Cancel"),pl()()();}if(n&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),ug("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),ug("formControl",e.promptContentControl),NI(),BE(3),ug("formControl",e.unitControl),NI(),BE(),Uw(e.schedulerUnits),BE(2),jw(e.showDayFilter()?15:-1),BE(),ug("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),ug("formControl",e.timeUtcControl),NI(),BE(4),ug("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),ug("formControl",e.startDateControl),NI(),BE(2),ug("formControl",e.endTypeControl),NI(),BE(),Uw(e.endTypes),BE(2),jw(e.showEndDate()?28:-1),BE(),jw(e.showOccurrenceCount()?29:-1),BE(3),ug("formControl",e.enabledControl),NI(),BE(4),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(),jw(e.errorMessage()?38:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(Ie$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:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.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=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);errorMessage=Ui(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$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(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(md(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(md(this.endTypeControl.value)));showDayFilter=XC(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=XC(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=XC(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=Ui([]);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),Ty({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(da(()=>Tr([])))}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=yw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return l.cancel()}),NC(3),pl()(),Lw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),pl()),e&2&&(BE(),ug("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),vl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),jw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],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-BldpQhN_.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,l as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at,i as an,t as rn}from'./chunk-D2BTEyR1.js';import {g,W,F,I as Ie$1,ag as U,ah as ke$1,ai as Ne$1,U as Ui,aj as Fe$1,a9 as F$1,ak as md,X as XC,ac as Ty,G as U$1,a2 as da,aa as Tr,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,v as vl,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,J as Jw,R as NI,m as Uw,O as Og,r as df,s as ff,t as oh}from'./main-FJXP2G5I.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function _e(n,t){if(n&1&&(Ds(0,"ds-form-field",9),lg(1,"input",38),pl()),n&2){let e=Jw(2);BE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Ds(0,"a",39),NC(1,"Add an agent config"),pl(),NC(2," first. ")),n&2){let e=Jw(3);ug("href","/agentos/"+e.namespaceId+"/agent-configs/new",oh);}}function xe(n,t){if(n&1&&(Ds(0,"ds-form-field",10)(1,"p",2),NC(2," No agent configs available in this scope yet. "),Lw(3,Se,3,1),pl()()),n&2){let e=Jw(2);BE(3),jw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.id),BE(),Og(e.name);}}function De(n,t){if(n&1&&(Ds(0,"ds-form-field",11)(1,"select",40)(2,"option",41),NC(3,"Select an agent config\u2026"),pl(),Hw(4,Ee,2,2,"option",17,ve),pl(),_I(),pl()),n&2){let e=Jw(2);ug("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),ug("formControl",e.agentConfigIdControl),NI(),BE(3),Uw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Ne(n,t){if(n&1){let e=Zw();Ds(0,"label",31)(1,"input",43),mg("change",function(){let f=df(e).$implicit,h=Jw(3);return ff(h.toggleDay(f.value))}),pl(),NC(2),pl();}if(n&2){let e=t.$implicit,l=Jw(3);BE(),ug("checked",l.isDaySelected(e.value)),BE(),vl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Ds(0,"ds-form-field",18)(1,"div",42),Hw(2,Ne,3,2,"label",31,V),pl()()),n&2){let e=Jw(2);BE(2),Uw(e.dayOptions);}}function Me(n,t){if(n&1&&(Ds(0,"option",17),NC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),BE(),Og(e.label);}}function Pe(n,t){if(n&1&&(Ds(0,"ds-form-field",28),lg(1,"input",44),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),ug("formControl",e.endDateControl),NI();}}function we(n,t){if(n&1&&(Ds(0,"ds-form-field",29),lg(1,"input",45),_I(),pl()),n&2){let e=Jw(2);ug("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),ug("formControl",e.occurrenceCountControl),NI();}}function Fe(n,t){if(n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2){let e=Jw(2);BE(),Og(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Jw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),_I(),pl(),Lw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Ds(8,"ds-form-field",12),lg(9,"textarea",13),_I(),pl(),Ds(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Hw(13,Te,2,2,"option",17,V),pl(),_I(),pl(),Lw(15,Ie,4,0,"ds-form-field",18),Ds(16,"ds-form-field",19)(17,"div",20),lg(18,"input",21),_I(),Ds(19,"span",22),NC(20,"UTC"),pl()()()(),Ds(21,"ds-fieldset",23)(22,"ds-form-field",24),lg(23,"input",25),_I(),pl(),Ds(24,"ds-form-field",26)(25,"select",27),Hw(26,Me,2,2,"option",17,V),pl(),_I(),pl(),Lw(28,Pe,2,2,"ds-form-field",28),Lw(29,we,2,2,"ds-form-field",29),pl(),Ds(30,"div",30)(31,"label",31),lg(32,"input",32),_I(),NC(33," Enabled "),pl(),Ds(34,"p",33),NC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),pl()(),Ds(36,"ds-form-field",34),lg(37,"textarea",35),_I(),pl(),Lw(38,Fe,2,1,"ds-notice"),Ds(39,"ds-form-actions")(40,"button",36),NC(41),pl(),Ds(42,"button",37),mg("click",function(){df(e);let f=Jw();return ff(f.cancel())}),NC(43,"Cancel"),pl()()();}if(n&2){let e=Jw();ug("formGroup",e.form),BE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),ug("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),ug("formControl",e.promptContentControl),NI(),BE(3),ug("formControl",e.unitControl),NI(),BE(),Uw(e.schedulerUnits),BE(2),jw(e.showDayFilter()?15:-1),BE(),ug("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),ug("formControl",e.timeUtcControl),NI(),BE(4),ug("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),ug("formControl",e.startDateControl),NI(),BE(2),ug("formControl",e.endTypeControl),NI(),BE(),Uw(e.endTypes),BE(2),jw(e.showEndDate()?28:-1),BE(),jw(e.showOccurrenceCount()?29:-1),BE(3),ug("formControl",e.enabledControl),NI(),BE(4),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),ug("formControl",e.externalMetadataJsonControl),NI(),BE(),jw(e.errorMessage()?38:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(Ie$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:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.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=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);errorMessage=Ui(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$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(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(md(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(md(this.endTypeControl.value)));showDayFilter=XC(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=XC(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=XC(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=Ui([]);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),Ty({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(da(()=>Tr([])))}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=yw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return l.cancel()}),NC(3),pl()(),Lw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),pl()),e&2&&(BE(),ug("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),vl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),jw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],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 +1 @@
|
|
|
1
|
-
import {g,aJ as be,a6 as x}from'./main-
|
|
1
|
+
import {g,aJ as be,a6 as x}from'./main-FJXP2G5I.js';var c=class r{api=g(be);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {D as m,z as k,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-
|
|
1
|
+
import {D as m,z as k,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-D2BTEyR1.js';import {g,F,I as Ie,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-FJXP2G5I.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),NC(1),pl()),t&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),NC(1,"Loading prompts\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),NC(1,"No platform prompts defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),NC(1,"No prompts match the current filter."),pl());}function z(t,e){if(t&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let m=Jw().$implicit,p=Jw(2);return ff(p.edit(m))}),NC(1,"Edit"),pl();}if(t&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Zw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let m=Jw().$implicit,p=Jw(2);return ff(p.deletion.request(m.id))})("deleteConfirmed",function(){df(n);let m=Jw().$implicit,p=Jw(2);return ff(p.confirmDelete(m))})("deleteCancelled",function(){df(n);let m=Jw(3);return ff(m.deletion.cancel())}),pl();}if(t&2){let n=Jw().$implicit,r=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15),Lw(7,z,2,1,"button",16),Lw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Jw(2);BE(2),Og(n.name),BE(2),vl(" ",n.description||"\u2014"," "),BE(3),jw(r.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);promptState=g(m);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();prompts=Ui([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=yw({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return r.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),NC(3,"New prompt"),pl()(),Lw(4,A,2,1,"p",3),Lw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),ug("query",r.rowFilter.query()),BE(3),jw(r.deletion.error()?4:-1),BE(),jw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k,O,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-
|
|
1
|
+
import {z as k,O,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-D2BTEyR1.js';import {g,W as W$1,F,I as Ie,ag as U$1,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,G as U$2,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-FJXP2G5I.js';var J=(n,e)=>e.key;function U(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function z(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading agent configs\u2026"),pl());}function G(n,e){n&1&&(Ds(0,"p",5),NC(1,"No agent configs available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),NC(1,"No agent configs match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(2).$implicit,d=Jw(2);return ff(d.launch(s))}),NC(1," Launch "),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Launch "+t.config.name);}}function Y(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw(2).$implicit,d=Jw(2);return ff(d.edit(s))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function Z(n,e){if(n&1){let t=Zw();Ds(0,"button",22),mg("click",function(){df(t);let s=Jw().$implicit,d=Jw(2);return ff(d.inspect(s))}),NC(1," Inspect "),pl(),Lw(2,X,2,1,"button",23),Lw(3,Y,2,1,"button",23);}if(n&2){let t=Jw().$implicit,i=Jw(2);cg("aria-label","Inspect "+t.config.name),BE(2),jw(i.canLaunch(t)?2:-1),BE(),jw(t.scope==="namespace"?3:-1);}}function ee(n,e){if(n&1){let t=Zw();Ds(0,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(t);let s=Jw().$implicit,d=Jw(2);return ff(d.deletion.request(s.key))})("deleteConfirmed",function(){df(t);let s=Jw().$implicit,d=Jw(2);return ff(d.confirmDelete(s))})("deleteCancelled",function(){df(t);let s=Jw(3);return ff(s.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,i=Jw(2);ug("rowKey",t.key)("rowLabel",t.config.name)("state",i.deletion);}}function te(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14),NC(6),pl(),Ds(7,"td",15)(8,"div",16)(9,"ds-tag",17),NC(10),pl(),Lw(11,W,2,0,"ds-tag",18),pl()(),Ds(12,"td",19)(13,"div",20),Lw(14,Z,4,3),Lw(15,ee,1,3,"agentos-row-delete-action",21),pl()()()),n&2){let t=e.$implicit,i=Jw(2);BE(2),Og(t.config.name),BE(2),vl(" ",t.config.description||"\u2014"," "),BE(2),Og(i.mode(t)),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?11:-1),BE(3),jw(i.deletion.confirmingId()!==t.key?14:-1),BE(),jw(t.scope==="namespace"?15:-1);}}function ne(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Execution mode"),pl(),Ds(10,"th",10),NC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Hw(16,te,16,8,"tr",9,J),pl()()()),n&2){let t=Jw();BE(16),Uw(t.rowFilter.filteredRows());}}var H=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);controller=g(U$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O(this.rows,e=>[e.config.name,e.config.description,this.mode(e),e.scope].filter(Boolean).join(" "));allConfigs$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(da(()=>Tr([])))}))));constructor(){this.allConfigs$.pipe(U$2(this.destroyRef)).subscribe({next:({namespace:e,platform:t})=>{this.rows.set([...t.map((i,s)=>({key:`platform:${i.id??s}`,config:i,scope:"platform"})),...e.map((i,s)=>({key:`namespace:${i.id??s}`,config:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}inspect(e){e.config.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","agent-configs",e.config.id,"inspect"]:["/agentos",this.namespaceId,"agent-configs",e.config.id,"inspect"]);}launch(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"launch"]);}edit(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.config.id||this.deletion.execute(e.key,{request$:this.controller.deleteAgentConfig(e.config.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}canLaunch(e){return e.scope==="namespace"&&e.config.executionMode==="LOOP"}mode(e){return e.config.executionMode??(e.config.advancedExecution?"ADVANCED":"SIMPLE")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-agent-configs"]],decls:9,vars:3,consts:[["title","Agent configs","description","Agent configurations available in this namespace, including configurations inherited from the platform."],["label","Filter agent configs","placeholder","Filter agent configs\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","Agent configs"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Execution mode"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return i.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New agent config"),pl()(),Lw(4,U,2,1,"p",3),Lw(5,z,2,0,"p",4)(6,G,2,0,"p",5)(7,Q,2,0,"p",4)(8,ne,18,0,"div",6)),t&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as NamespaceAgentConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CCEk4l94.js';import {I}from'./chunk-By6f_HEs.js';import {g,W,F,I as Ie,U as Ui,G as U,ad as ne$1,a1 as fa,aa as Tr,aL as ci,a2 as da,ac as Ty,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,u as vC,k as cg,v as vl,H as Hw,m as Uw,Z as Zw,r as df,s as ff}from'./main-CHNQJIYM.js';import {z as k,O,a3 as w,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-C4WQ3FwO.js';import'./chunk-1X8ZDw_H.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let e=Jw();BE(),Og(e.deletion.error());}}function Z(i,t){if(i&1&&(Ds(0,"p"),NC(1),pl()),i&2){let e=t;vC(e.kind==="error"?"settings-table__error":"settings-table__status"),cg("role",e.kind==="error"?"alert":"status"),BE(),vl(" ",e.text," ");}}function ee(i,t){i&1&&(Ds(0,"p",5),NC(1,"Loading auth settings\u2026"),pl());}function te(i,t){i&1&&(Ds(0,"p",6),NC(1,"No auth settings available."),pl());}function ne(i,t){i&1&&(Ds(0,"p",5),NC(1,"No auth settings match the current filter."),pl());}function ie(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function oe(i,t){i&1&&(Ds(0,"ds-tag",20),NC(1,"Connected"),pl());}function ae(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Not connected"),pl());}function se(i,t){i&1&&(Ds(0,"span",21),NC(1,"\u2014"),pl());}function re(i,t){if(i&1){let e=Zw();Ds(0,"span",26),NC(1,"Waiting for authorization\u2026"),pl(),Ds(2,"button",27),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelConnect())}),NC(3," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit;BE(2),cg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Zw();Ds(0,"span",28),NC(1,"Disconnect?"),pl(),Ds(2,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.confirmReset(r))}),NC(3),pl(),Ds(4,"button",29),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelReset())}),NC(5," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit,n=Jw(2);BE(2),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Confirm disconnecting "+e.config.name),BE(),vl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(3).$implicit,d=Jw(2);return ff(d.requestReset(r))}),NC(1," Disconnect "),pl();}if(i&2){let e=Jw(3).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null),cg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.connect(r))}),NC(1),pl(),Lw(2,ce,2,2,"button",30);}if(i&2){let e=Jw(2).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null||n.resettingKey()!==null),cg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),vl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),jw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Lw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Jw().$implicit,n=Jw(2);jw(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=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.duplicate(r))}),NC(1," Duplicate "),pl();}if(i&2){let e=Jw().$implicit;cg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.edit(r))}),NC(1," Edit "),pl();}if(i&2){let e=Jw(2).$implicit;cg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Zw();Lw(0,_e,2,1,"button",24),Ds(1,"agentos-row-delete-action",31),mg("deleteRequested",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.deletion.request(r.key))})("deleteConfirmed",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(3);return ff(r.deletion.cancel())}),pl();}if(i&2){let e=Jw().$implicit,n=Jw(2);jw(n.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Ds(0,"button",25),NC(1,"Inherited"),pl());}function he(i,t){if(i&1&&(Ds(0,"tr",10)(1,"td",13),NC(2),pl(),Ds(3,"td",14),NC(4),pl(),Ds(5,"td",15)(6,"div",16)(7,"ds-tag",17),NC(8),pl(),Lw(9,ie,2,0,"ds-tag",18),pl()(),Ds(10,"td",19),Lw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),pl(),Ds(14,"td",22)(15,"div",23),Lw(16,pe,3,1),Lw(17,ue,2,1,"button",24),Lw(18,me,2,4)(19,ge,2,0,"button",25),pl()()()),i&2){let e=t.$implicit,n=Jw(2);BE(2),Og(e.config.name),BE(2),vl(" ",e.config.authType," "),BE(3),ug("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(e.scopeLabel),BE(),jw(e.canMutate?-1:9),BE(2),jw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),jw(n.isOAuth(e)?16:-1),BE(),jw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),jw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Ds(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),NC(5,"Name"),pl(),Ds(6,"th",11),NC(7,"Authentication type"),pl(),Ds(8,"th",11),NC(9,"Scope"),pl(),Ds(10,"th",11),NC(11,"Connection"),pl(),Ds(12,"th",11)(13,"span",12),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",9),Hw(16,he,20,9,"tr",10,Q),pl()()()),i&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();connections=Ui({});connectingKey=Ui(null);resetConfirmingKey=Ui(null);resettingKey=Ui(null);actionMessage=Ui(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")??""),fa(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Tr(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(ci(()=>{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"]),da(()=>Tr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ty(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=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return n.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,X,2,1,"p",3),Lw(5,Z,2,4,"p",4),Lw(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;BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw((r=n.actionMessage())?5:-1,r),BE(),jw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-BiYZtMHe.js';import {I}from'./chunk-CJLkP_aL.js';import {g,W,F,I as Ie,U as Ui,G as U,ad as ne$1,a1 as fa,aa as Tr,aL as ci,a2 as da,ac as Ty,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,u as vC,k as cg,v as vl,H as Hw,m as Uw,Z as Zw,r as df,s as ff}from'./main-FJXP2G5I.js';import {z as k,O,a3 as w,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-D2BTEyR1.js';import'./chunk-B5eEl07l.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Ds(0,"p",3),NC(1),pl()),i&2){let e=Jw();BE(),Og(e.deletion.error());}}function Z(i,t){if(i&1&&(Ds(0,"p"),NC(1),pl()),i&2){let e=t;vC(e.kind==="error"?"settings-table__error":"settings-table__status"),cg("role",e.kind==="error"?"alert":"status"),BE(),vl(" ",e.text," ");}}function ee(i,t){i&1&&(Ds(0,"p",5),NC(1,"Loading auth settings\u2026"),pl());}function te(i,t){i&1&&(Ds(0,"p",6),NC(1,"No auth settings available."),pl());}function ne(i,t){i&1&&(Ds(0,"p",5),NC(1,"No auth settings match the current filter."),pl());}function ie(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Read-only"),pl());}function oe(i,t){i&1&&(Ds(0,"ds-tag",20),NC(1,"Connected"),pl());}function ae(i,t){i&1&&(Ds(0,"ds-tag",18),NC(1,"Not connected"),pl());}function se(i,t){i&1&&(Ds(0,"span",21),NC(1,"\u2014"),pl());}function re(i,t){if(i&1){let e=Zw();Ds(0,"span",26),NC(1,"Waiting for authorization\u2026"),pl(),Ds(2,"button",27),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelConnect())}),NC(3," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit;BE(2),cg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Zw();Ds(0,"span",28),NC(1,"Disconnect?"),pl(),Ds(2,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.confirmReset(r))}),NC(3),pl(),Ds(4,"button",29),mg("click",function(){df(e);let r=Jw(4);return ff(r.cancelReset())}),NC(5," Cancel "),pl();}if(i&2){let e=Jw(2).$implicit,n=Jw(2);BE(2),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Confirm disconnecting "+e.config.name),BE(),vl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),ug("disabled",n.resettingKey()===e.key),cg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(3).$implicit,d=Jw(2);return ff(d.requestReset(r))}),NC(1," Disconnect "),pl();}if(i&2){let e=Jw(3).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null),cg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Zw();Ds(0,"button",29),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.connect(r))}),NC(1),pl(),Lw(2,ce,2,2,"button",30);}if(i&2){let e=Jw(2).$implicit,n=Jw(2);ug("disabled",n.connectingKey()!==null||n.resettingKey()!==null),cg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),vl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),jw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&Lw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=Jw().$implicit,n=Jw(2);jw(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=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.duplicate(r))}),NC(1," Duplicate "),pl();}if(i&2){let e=Jw().$implicit;cg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Zw();Ds(0,"button",27),mg("click",function(){df(e);let r=Jw(2).$implicit,d=Jw(2);return ff(d.edit(r))}),NC(1," Edit "),pl();}if(i&2){let e=Jw(2).$implicit;cg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Zw();Lw(0,_e,2,1,"button",24),Ds(1,"agentos-row-delete-action",31),mg("deleteRequested",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.deletion.request(r.key))})("deleteConfirmed",function(){df(e);let r=Jw().$implicit,d=Jw(2);return ff(d.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Jw(3);return ff(r.deletion.cancel())}),pl();}if(i&2){let e=Jw().$implicit,n=Jw(2);jw(n.deletion.confirmingId()!==e.key?0:-1),BE(),ug("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Ds(0,"button",25),NC(1,"Inherited"),pl());}function he(i,t){if(i&1&&(Ds(0,"tr",10)(1,"td",13),NC(2),pl(),Ds(3,"td",14),NC(4),pl(),Ds(5,"td",15)(6,"div",16)(7,"ds-tag",17),NC(8),pl(),Lw(9,ie,2,0,"ds-tag",18),pl()(),Ds(10,"td",19),Lw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),pl(),Ds(14,"td",22)(15,"div",23),Lw(16,pe,3,1),Lw(17,ue,2,1,"button",24),Lw(18,me,2,4)(19,ge,2,0,"button",25),pl()()()),i&2){let e=t.$implicit,n=Jw(2);BE(2),Og(e.config.name),BE(2),vl(" ",e.config.authType," "),BE(3),ug("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Og(e.scopeLabel),BE(),jw(e.canMutate?-1:9),BE(2),jw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),jw(n.isOAuth(e)?16:-1),BE(),jw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),jw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Ds(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),NC(5,"Name"),pl(),Ds(6,"th",11),NC(7,"Authentication type"),pl(),Ds(8,"th",11),NC(9,"Scope"),pl(),Ds(10,"th",11),NC(11,"Connection"),pl(),Ds(12,"th",11)(13,"span",12),NC(14,"Actions"),pl()()()(),Ds(15,"tbody",9),Hw(16,he,20,9,"tr",10,Q),pl()()()),i&2){let e=Jw();BE(16),Uw(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();connections=Ui({});connectingKey=Ui(null);resetConfirmingKey=Ui(null);resettingKey=Ui(null);actionMessage=Ui(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")??""),fa(t=>t?this.namespaceRole.isAdminOfNamespace$(t):Tr(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(ci(()=>{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"]),da(()=>Tr([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=Ty(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=yw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return n.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return n.openCreateForm()}),NC(3,"New auth setting"),pl()(),Lw(4,X,2,1,"p",3),Lw(5,Z,2,4,"p",4),Lw(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;BE(),ug("query",n.rowFilter.query()),BE(3),jw(n.deletion.error()?4:-1),BE(),jw((r=n.actionMessage())?5:-1,r),BE(),jw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,g as at,i as an}from'./chunk-C4WQ3FwO.js';import {g,W,F,E as J,I as Ie,X as XC,U as Ui,q as Af,G as U,K as w,M as x,y as yw,D as Ds,l as lg,L as Lw,p as pl,P as ug,a as BE,j as jw,N as NC,Z as Zw,Q as mg,_ as _I,J as Jw,R as NI,k as cg,v as vl,r as df,s as ff}from'./main-CHNQJIYM.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Jw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),_I(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),_I(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),_I(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),_I(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),_I(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Jw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),_I(),pl(),Ds(17,"ds-form-actions")(18,"button",21),NC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Jw();return ff(p.cancel())}),NC(21,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(2),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.externalIdControl),NI(),BE(2),ug("formControl",e.defaultAgentNameControl),NI(),BE(2),ug("formControl",e.configPathControl),NI(),BE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),BE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),NI(),BE(),ug("hint",e.runCostThresholdHint()),BE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),NI(),BE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),BE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=XC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=XC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=XC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=XC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),BE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),jw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
|
|
1
|
+
import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,b as po,$ as $r,V as Vn,A as An,c as pn,h as hn,d as cn,e as dn,g as at,i as an}from'./chunk-D2BTEyR1.js';import {g,W,F,E as J,I as Ie,X as XC,U as Ui,q as Af,G as U,K as w,M as x,y as yw,D as Ds,l as lg,L as Lw,p as pl,P as ug,a as BE,j as jw,N as NC,Z as Zw,Q as mg,_ as _I,J as Jw,R as NI,k as cg,v as vl,r as df,s as ff}from'./main-FJXP2G5I.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Jw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),_I(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),_I(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),_I(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),_I(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),_I(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Jw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),_I(),pl(),Ds(17,"ds-form-actions")(18,"button",21),NC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Jw();return ff(p.cancel())}),NC(21,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(2),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.externalIdControl),NI(),BE(2),ug("formControl",e.defaultAgentNameControl),NI(),BE(2),ug("formControl",e.configPathControl),NI(),BE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),BE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),NI(),BE(),ug("hint",e.runCostThresholdHint()),BE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),NI(),BE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),BE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=XC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=XC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=XC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=XC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),BE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),jw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-B5eEl07l.js';import {y}from'./chunk-D2BTEyR1.js';import {g,aE as X,$ as Cr,at as wy,a1 as fa,a2 as da,aa as Tr,ad as ne,aD as $y,M as x,K as w$1,a5 as yd,aF as sn,aG as Ot,aH as an,a6 as x$1}from'./main-FJXP2G5I.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 Cr(void 0);namespaceId$=new Cr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([t])=>{let e=this.loadPlatformSettings().pipe(da(()=>Tr([])));return t?wy([e,this.loadNamespaceSettings(t).pipe(da(()=>Tr([]))),this.loadUserSettings(t).pipe(da(()=>Tr([]))),this.loadUserSettings("global").pipe(da(()=>Tr([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):wy([e,this.loadNamespaceSettings("").pipe(da(()=>Tr([]))),this.loadUserSettings("global").pipe(da(()=>Tr([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),$y({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))):Tr([])}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)),yd(()=>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)),yd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(yd(()=>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(fa(r=>this.controller.connectAuthSetting(t,e).pipe(yd(h=>n(h.authorizationUrl)),fa(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return sn(b,b).pipe(fa(()=>this.getConnection(t,e).pipe(da(()=>Tr(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),an(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=x$1({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {v}from'./chunk-CCEk4l94.js';import {I}from'./chunk-By6f_HEs.js';import {O}from'./chunk-DN8msylG.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Tr,U as Ui,ab as le,X as XC,a1 as fa,G as U,q as Af,ac as Ty,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,a2 as da,ad as ne,Z as Zw,H as Hw,ae as Fw,_ as _I,l as lg,J as Jw,m as Uw,R as NI,v as vl,O as Og,r as df,s as ff}from'./main-CHNQJIYM.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-C4WQ3FwO.js';import'./chunk-1X8ZDw_H.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),_I(),NC(2),pl()),i&2){let t=e.$implicit,n=Jw(2);BE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),BE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),_I(),NC(3," Grant automatically "),pl(),Ds(4,"p",2),NC(5),pl()()),i&2){let t=Jw(2);BE(2),ug("formControl",t.autoGrantControl),NI(),BE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Zw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Jw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Jw(2);BE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let a=Jw(2);return ff(a.exportYaml())}),NC(1),pl();}if(i&2){let t=Jw(2);ug("disabled",t.isExporting()),BE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Jw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Hw(2,xe,3,4,"label",6,Fw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),NC(7,"Select type"),pl(),Hw(8,Ie,2,2,"option",10,Fw().trackByType,true),pl(),_I(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),_I(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),_I(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),NC(17,"None"),pl(),Hw(18,Ne,2,2,"option",10,be),pl(),_I(),pl(),Lw(20,Ae,6,2,"div",18),Lw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),NC(24),pl(),Lw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Jw();return ff(a.cancel())}),NC(27,"Cancel"),pl()()();}if(i&2){let t,n=Jw();ug("formGroup",n.form),BE(),ug("disabled",n.isEditMode()),BE(),Uw(n.scopeOptions),BE(3),ug("formControl",n.typeControl),NI(),BE(3),Uw(n.integrationTypes()),BE(3),ug("formControl",n.nameControl),NI(),BE(2),ug("formControl",n.descriptionControl),NI(),BE(2),ug("formControl",n.authSettingNameControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(n.authSettingOptions()),BE(2),jw(n.isAutoGrantable()?20:-1),BE(),jw((t=n.schema())?21:-1,t),BE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),jw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Tr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new le;authSettingOptions=XC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=XC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Tr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Integrations "),pl()(),Lw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(BE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
1
|
+
import {v}from'./chunk-BiYZtMHe.js';import {I}from'./chunk-CJLkP_aL.js';import {O}from'./chunk-BYeNpjs5.js';import {g,W,F,I as Ie$1,a8 as _,a9 as F$1,aa as Tr,U as Ui,ab as le,X as XC,a1 as fa,G as U,q as Af,ac as Ty,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,a2 as da,ad as ne,Z as Zw,H as Hw,ae as Fw,_ as _I,l as lg,J as Jw,m as Uw,R as NI,v as vl,O as Og,r as df,s as ff}from'./main-FJXP2G5I.js';import {p as pt,T as Te$1,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,o as on,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,u as vn,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An,W as Wt}from'./chunk-D2BTEyR1.js';import'./chunk-B5eEl07l.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(i,e){if(i&1&&(Ds(0,"label",6),lg(1,"input",22),_I(),NC(2),pl()),i&2){let t=e.$implicit,n=Jw(2);BE(),ug("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.type),BE(),Og(t.displayName);}}function Ne(i,e){if(i&1&&(Ds(0,"option",10),NC(1),pl()),i&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Ae(i,e){if(i&1&&(Ds(0,"div",18)(1,"label",6),lg(2,"input",23),_I(),NC(3," Grant automatically "),pl(),Ds(4,"p",2),NC(5),pl()()),i&2){let t=Jw(2);BE(2),ug("formControl",t.autoGrantControl),NI(),BE(3),vl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Zw();Ds(0,"ds-card")(1,"ds-json-schema-form",24),mg("valueChange",function(a){df(t);let p=Jw(2);return ff(p.onParamsChange(a))}),pl()();}if(i&2){let t=Jw(2);BE(),ug("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Zw();Ds(0,"button",25),mg("click",function(){df(t);let a=Jw(2);return ff(a.exportYaml())}),NC(1),pl();}if(i&2){let t=Jw(2);ug("disabled",t.isExporting()),BE(),vl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(t);let a=Jw();return ff(a.submit())}),Ds(1,"ds-fieldset",5),Hw(2,xe,3,4,"label",6,Fw().trackByScope,true),pl(),Ds(4,"ds-form-field",7)(5,"select",8)(6,"option",9),NC(7,"Select type"),pl(),Hw(8,Ie,2,2,"option",10,Fw().trackByType,true),pl(),_I(),pl(),Ds(10,"ds-form-field",11),lg(11,"input",12),_I(),pl(),Ds(12,"ds-form-field",13),lg(13,"textarea",14),_I(),pl(),Ds(14,"ds-form-field",15)(15,"select",16)(16,"option",17),NC(17,"None"),pl(),Hw(18,Ne,2,2,"option",10,be),pl(),_I(),pl(),Lw(20,Ae,6,2,"div",18),Lw(21,Ee,2,2,"ds-card"),Ds(22,"ds-form-actions")(23,"button",19),NC(24),pl(),Lw(25,Fe,2,2,"button",20),Ds(26,"button",21),mg("click",function(){df(t);let a=Jw();return ff(a.cancel())}),NC(27,"Cancel"),pl()()();}if(i&2){let t,n=Jw();ug("formGroup",n.form),BE(),ug("disabled",n.isEditMode()),BE(),Uw(n.scopeOptions),BE(3),ug("formControl",n.typeControl),NI(),BE(3),Uw(n.integrationTypes()),BE(3),ug("formControl",n.nameControl),NI(),BE(2),ug("formControl",n.descriptionControl),NI(),BE(2),ug("formControl",n.authSettingNameControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(n.authSettingOptions()),BE(2),jw(n.isAutoGrantable()?20:-1),BE(),jw((t=n.schema())?21:-1,t),BE(2),ug("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),BE(),vl(" ",n.isEditMode()?"Save changes":"Create"," "),BE(),jw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?Tr(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[fn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=Ui([]);authSettingsLoaded=Ui(false);savedAuthSettingName=Ui(null);authSettingsScope$=new le;authSettingOptions=XC(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=Ui(null);initialParams=Ui(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=XC(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=XC(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(fa(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Af(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(da(()=>Tr([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?Ty([a,n]):Ty([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Integrations "),pl()(),Lw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),pl()),t&2&&(BE(),ug("title",n.isEditMode()?"Edit integration":"New integration"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,on,at,an,rn,Ut,nd,bo,xo,Lt,vn,Gt,pa,mo,po,Vn,An,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,aK as fe,a6 as x}from'./main-
|
|
1
|
+
import {g,aK as fe,a6 as x}from'./main-FJXP2G5I.js';var o=class r{skillController=g(fe);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=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {s}from'./chunk-
|
|
1
|
+
import {s}from'./chunk-D2BTEyR1.js';import {g,W,z as Xm,C as y,y as yw,b as hl,N as NC,d as gl,a as BE,O as Og}from'./main-FJXP2G5I.js';var A=class r{route=g(W);http=g(Xm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=yw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(hl(0,"p",0),NC(1),gl()),t&2&&(BE(),Og(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O as O$1}from'./chunk-DKEPmfQ1.js';import {I}from'./chunk-By6f_HEs.js';import {O}from'./chunk-DN8msylG.js';import {g,I as Ie$1,U as Ui,X as XC,a9 as F,at as wy,ad as ne,G as U,y as yw,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,N as NC,Z as Zw,Q as mg,J as Jw,P as ug,_ as _I,H as Hw,O as Og,R as NI,m as Uw,v as vl,ae as Fw,r as df,s as ff,M as x,K as w}from'./main-CHNQJIYM.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,Z as un,e as dn,g as at,i as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-C4WQ3FwO.js';import'./chunk-1X8ZDw_H.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),NC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Se(o,e){if(o&1){let t=Zw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Jw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),NC(4,"Email"),pl(),Ds(5,"dd"),NC(6),pl(),Ds(7,"dt"),NC(8,"External ID"),pl(),Ds(9,"dd"),NC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),_I(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),_I(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),_I(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Hw(20,xe,2,2,"option",27,ye),pl(),_I(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),NC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Jw(2);return ff(s.cancelEditing())}),NC(26,"Cancel"),pl()()();}if(o&2){let t=Jw(),l=Jw();ug("formGroup",l.form),BE(6),Og(t.email),BE(4),Og(t.externalId),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),NI(),BE(),Uw(l.languageOptions),BE(3),ug("disabled",l.isSaving()),BE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),NC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=Zw();Ds(0,"span",38),NC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.confirmDelete(s))}),NC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Jw(6);return ff(s.cancelDelete())}),NC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=Zw();Ds(0,"button",40),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.armDelete(s))}),NC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),NC(2),pl(),Ds(3,"span",36),NC(4),pl(),Lw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Jw(5);BE(2),Og(t.name),BE(2),Og(t.subtitle),BE(),jw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),NC(1),pl(),Ds(2,"ul",33),Hw(3,De,7,3,"li",34,Fw().trackEntry,true),pl()),o&2){let t=e.$implicit;BE(),Og(t.title),BE(2),Uw(t.entries);}}function Ve(o,e){if(o&1&&Hw(0,we,5,1,null,null,Ce),o&2){let t=Jw(3);Uw(t.recapSections());}}function Ue(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),NC(3,"Email"),pl(),Ds(4,"dd"),NC(5),pl(),Ds(6,"dt"),NC(7,"External ID"),pl(),Ds(8,"dd"),NC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),NC(13,"First name"),pl(),Ds(14,"dd"),NC(15),pl(),Ds(16,"dt"),NC(17,"Last name"),pl(),Ds(18,"dd"),NC(19),pl(),Ds(20,"dt"),NC(21,"Bio"),pl(),Ds(22,"dd"),NC(23),pl(),Ds(24,"dt"),NC(25,"Language"),pl(),Ds(26,"dd"),NC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Jw(2);return ff(s.startEditing())}),NC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Jw(2);return ff(s.toggleOverrides())}),Lw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Jw(),l=Jw();BE(5),Og(t.email),BE(4),Og(t.externalId),BE(6),Og(t.firstname||"\u2014"),BE(4),Og(t.lastname||"\u2014"),BE(4),Og(t.bio||"\u2014"),BE(4),Og(t.preferredLanguage||"\u2014"),BE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),jw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setShowTechnical(s))}),pl()()(),Lw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Jw();BE(),ug("hint",t.activeVariantDescription()),BE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),ug("options",t.modeOptions())("value",t.shownMode()),BE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),jw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),NC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=XC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=XC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=XC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=XC(()=>d(this.themeVariant()).label);activeVariantDescription=XC(()=>d(this.themeVariant()).description);modeOptions=XC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=XC(()=>this.modeOverridden()?v(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"}];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"}];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})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{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})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=XC(()=>{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){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(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}).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=Ui(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:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}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??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["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"],[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"],["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,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;BE(2),jw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
|
|
1
|
+
import {O as O$1}from'./chunk-DPw6IK23.js';import {I}from'./chunk-CJLkP_aL.js';import {O}from'./chunk-BYeNpjs5.js';import {g,I as Ie$1,U as Ui,X as XC,a9 as F,at as wy,ad as ne,G as U,y as yw,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,N as NC,Z as Zw,Q as mg,J as Jw,P as ug,_ as _I,H as Hw,O as Og,R as NI,m as Uw,v as vl,ae as Fw,r as df,s as ff,M as x,K as w}from'./main-FJXP2G5I.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,Z as un,e as dn,g as at,i as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-D2BTEyR1.js';import'./chunk-B5eEl07l.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),NC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Se(o,e){if(o&1){let t=Zw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Jw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),NC(4,"Email"),pl(),Ds(5,"dd"),NC(6),pl(),Ds(7,"dt"),NC(8,"External ID"),pl(),Ds(9,"dd"),NC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),_I(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),_I(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),_I(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Hw(20,xe,2,2,"option",27,ye),pl(),_I(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),NC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Jw(2);return ff(s.cancelEditing())}),NC(26,"Cancel"),pl()()();}if(o&2){let t=Jw(),l=Jw();ug("formGroup",l.form),BE(6),Og(t.email),BE(4),Og(t.externalId),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),NI(),BE(),Uw(l.languageOptions),BE(3),ug("disabled",l.isSaving()),BE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),NC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=Zw();Ds(0,"span",38),NC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.confirmDelete(s))}),NC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Jw(6);return ff(s.cancelDelete())}),NC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=Zw();Ds(0,"button",40),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.armDelete(s))}),NC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),NC(2),pl(),Ds(3,"span",36),NC(4),pl(),Lw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Jw(5);BE(2),Og(t.name),BE(2),Og(t.subtitle),BE(),jw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),NC(1),pl(),Ds(2,"ul",33),Hw(3,De,7,3,"li",34,Fw().trackEntry,true),pl()),o&2){let t=e.$implicit;BE(),Og(t.title),BE(2),Uw(t.entries);}}function Ve(o,e){if(o&1&&Hw(0,we,5,1,null,null,Ce),o&2){let t=Jw(3);Uw(t.recapSections());}}function Ue(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),NC(3,"Email"),pl(),Ds(4,"dd"),NC(5),pl(),Ds(6,"dt"),NC(7,"External ID"),pl(),Ds(8,"dd"),NC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),NC(13,"First name"),pl(),Ds(14,"dd"),NC(15),pl(),Ds(16,"dt"),NC(17,"Last name"),pl(),Ds(18,"dd"),NC(19),pl(),Ds(20,"dt"),NC(21,"Bio"),pl(),Ds(22,"dd"),NC(23),pl(),Ds(24,"dt"),NC(25,"Language"),pl(),Ds(26,"dd"),NC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Jw(2);return ff(s.startEditing())}),NC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Jw(2);return ff(s.toggleOverrides())}),Lw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Jw(),l=Jw();BE(5),Og(t.email),BE(4),Og(t.externalId),BE(6),Og(t.firstname||"\u2014"),BE(4),Og(t.lastname||"\u2014"),BE(4),Og(t.bio||"\u2014"),BE(4),Og(t.preferredLanguage||"\u2014"),BE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),jw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setShowTechnical(s))}),pl()()(),Lw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Jw();BE(),ug("hint",t.activeVariantDescription()),BE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),ug("options",t.modeOptions())("value",t.shownMode()),BE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),jw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),NC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=XC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=XC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=XC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=XC(()=>d(this.themeVariant()).label);activeVariantDescription=XC(()=>d(this.themeVariant()).description);modeOptions=XC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=XC(()=>this.modeOverridden()?v(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"}];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"}];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})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{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})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=XC(()=>{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){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(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}).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=Ui(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:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}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??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["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"],[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"],["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,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;BE(2),jw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
|