@whoz-oss/coday-client 0.0.0-workstream-forge.238 → 0.0.0-workstream-forge.240
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-C_cUx8TW.js → chunk-1a6DcGem.js} +1 -1
- package/browser/{chunk-wfyLfMEx.js → chunk-8bthdK4h.js} +1 -1
- package/browser/{chunk-D1yRNu41.js → chunk-B0qfyg3W.js} +1 -1
- package/browser/{chunk-4Qu3PeXh.js → chunk-B3C0-w1H.js} +1 -1
- package/browser/{chunk-DI3lyKCO.js → chunk-BBqfFT3U.js} +1 -1
- package/browser/{chunk-C_1WQz37.js → chunk-BQP4WQr8.js} +1 -1
- package/browser/{chunk-DAzj31Q1.js → chunk-BR-v_Yw0.js} +1 -1
- package/browser/{chunk-DHRExHpH.js → chunk-BdMromko.js} +1 -1
- package/browser/{chunk-D6GAaaHQ.js → chunk-Bjh4fonr.js} +1 -1
- package/browser/{chunk-DQHXda6g.js → chunk-C0dETmrU.js} +1 -1
- package/browser/{chunk-CVVVa3NL.js → chunk-C3kKO2hv.js} +1 -1
- package/browser/{chunk-GlyHtVZI.js → chunk-C6iz6wiq.js} +1 -1
- package/browser/{chunk-B0TP-VcL.js → chunk-CBcl2plG.js} +1 -1
- package/browser/{chunk-BKu1hxzv.js → chunk-CFXn7UF0.js} +1 -1
- package/browser/{chunk-CS0402GI.js → chunk-CLmmZDuk.js} +1 -1
- package/browser/chunk-CSMJ7MDS.js +674 -0
- package/browser/{chunk-xNK5FyFm.js → chunk-CSpJmP5j.js} +1 -1
- package/browser/{chunk-BJQFMO9C.js → chunk-CWB_UsoN.js} +1 -1
- package/browser/{chunk-yjjjr8V4.js → chunk-CWOCuTwP.js} +1 -1
- package/browser/{chunk-zFiPZAOG.js → chunk-CZVszAsn.js} +1 -1
- package/browser/{chunk-tE_dMycD.js → chunk-CbreKU78.js} +1 -1
- package/browser/{chunk-C6f8vXFe.js → chunk-Cds8WZZ9.js} +1 -1
- package/browser/{chunk-Ds5mQ2wb.js → chunk-CeB7A5zv.js} +1 -1
- package/browser/{chunk-DoM0k8h_.js → chunk-Ci_kgYRU.js} +1 -1
- package/browser/{chunk-BtXpRuOX.js → chunk-CnPp-vmJ.js} +1 -1
- package/browser/{chunk-CGS23_n4.js → chunk-CouuZLIT.js} +1 -1
- package/browser/{chunk-LuLnPYyM.js → chunk-Cp88MsOx.js} +1 -1
- package/browser/{chunk-Duwy1SeF.js → chunk-CxVLCgR7.js} +1 -1
- package/browser/{chunk-DFbrlwVp.js → chunk-Cz8XShgD.js} +1 -1
- package/browser/{chunk-DrNFetgE.js → chunk-D4ZQkLdU.js} +1 -1
- package/browser/{chunk-DmahkUjc.js → chunk-D6UEHsUd.js} +1 -1
- package/browser/{chunk-DhIZi4oj.js → chunk-DD0B2hZ4.js} +1 -1
- package/browser/{chunk-UZMqdHVD.js → chunk-DPXe72IN.js} +1 -1
- package/browser/{chunk-D7noK7K1.js → chunk-DXVP5qGT.js} +1 -1
- package/browser/{chunk-LxdeFBP9.js → chunk-DaIiIyVs.js} +1 -1
- package/browser/{chunk-3Mu1CwGQ.js → chunk-DeDbkfoc.js} +1 -1
- package/browser/{chunk-CAFGZIDY.js → chunk-Dtel5s0Y.js} +1 -1
- package/browser/{chunk-D-5QxzwU.js → chunk-Duj3iN07.js} +1 -1
- package/browser/{chunk-DYWY5OhH.js → chunk-Dx2NFZKr.js} +1 -1
- package/browser/{chunk-DzdjH73a.js → chunk-U4DrnauI.js} +1 -1
- package/browser/{chunk-D3UsWSII.js → chunk-lj1CKuoo.js} +1 -1
- package/browser/{chunk-CP-wBH0B.js → chunk-ngHfhGm4.js} +1 -1
- package/browser/{chunk-B98jntj8.js → chunk-sh5yfJ5w.js} +1 -1
- package/browser/{chunk-DWnNoXF0.js → chunk-vrQUVrbj.js} +1 -1
- package/browser/{chunk-J5EbAnQd.js → chunk-x0ys64HX.js} +1 -1
- package/browser/chunk-yhFoWYCU.js +1 -0
- package/browser/index.html +1 -1
- package/browser/{main-OK5QY7NU.js → main-2G6YLE3Q.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-BcBIZEZM.js +0 -1
- package/browser/chunk-CFzCpWz-.js +0 -674
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-BBqfFT3U.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CSMJ7MDS.js';import {g,q as F,I as we,$ as $i,K as U$1,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-2G6YLE3Q.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),xC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Yw();Es(0,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.toggle(s))}),xC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.edit(s))}),xC(3,"Edit"),hl();}if(n&2){let e=eC().$implicit;BE(),Fg(e.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Yw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,H,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19),jw(12,O,4,2),jw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.name),BE(),Bw(e.description?4:-1),BE(2),Fg(i.scheduleLabel(e)),BE(2),dg("variant",e.enabled?"accent":"outline"),BE(),Fg(e.enabled?"Enabled":"Disabled"),BE(3),Bw(i.deletion.confirmingId()!==e.id?12:-1),BE(),Bw(e.id?13:-1);}}function G(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=eC();BE(14),$w(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===Ne.WEEK?"week":"month",s=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(c=>De[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["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(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,U,2,1,"p",3),jw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-DI3lyKCO.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-CFzCpWz-.js';import {g,W,q as F,I as we$1,ag as U,ah as ke$1,ai as Ne$1,$ as $i,aj as Fe$1,a9 as F$1,ak as yd,r as rT,ac as by,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,t as eC,S as xI,k as $w,F as Fg,u as pf,w as hf,y as sh}from'./main-OK5QY7NU.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=eC(2);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),xC(1,"Add an agent config"),hl(),xC(2," first. ")),n&2){let e=eC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),xC(2," No agent configs available in this scope yet. "),jw(3,Se,3,1),hl()()),n&2){let e=eC(2);BE(3),Bw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),BE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),xC(3,"Select an agent config\u2026"),hl(),Uw(4,Ee,2,2,"option",17,ve),hl(),MI(),hl()),n&2){let e=eC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(3),$w(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Yw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=eC(3);return hf(h.toggleDay(f.value))}),hl(),xC(2),hl();}if(n&2){let e=t.$implicit,l=eC(3);BE(),dg("checked",l.isDaySelected(e.value)),BE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),Uw(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=eC(2);BE(2),$w(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),dg("formControl",e.endDateControl),xI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),dg("formControl",e.occurrenceCountControl),xI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=eC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),MI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Uw(13,Te,2,2,"option",17,V),hl(),MI(),hl(),jw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),MI(),Es(19,"span",22),xC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),MI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),Uw(26,Me,2,2,"option",17,V),hl(),MI(),hl(),jw(28,Pe,2,2,"ds-form-field",28),jw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),MI(),xC(33," Enabled "),hl(),Es(34,"p",33),xC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),MI(),hl(),jw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),xC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=eC();return hf(f.cancel())}),xC(43,"Cancel"),hl()()();}if(n&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),dg("formControl",e.promptContentControl),xI(),BE(3),dg("formControl",e.unitControl),xI(),BE(),$w(e.schedulerUnits),BE(2),Bw(e.showDayFilter()?15:-1),BE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),dg("formControl",e.timeUtcControl),xI(),BE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),dg("formControl",e.startDateControl),xI(),BE(2),dg("formControl",e.endTypeControl),xI(),BE(),$w(e.endTypes),BE(2),Bw(e.showEndDate()?28:-1),BE(),Bw(e.showOccurrenceCount()?29:-1),BE(3),dg("formControl",e.enabledControl),xI(),BE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(),Bw(e.errorMessage()?38:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[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=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(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(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=rT(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=rT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=rT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=$i([]);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),by({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(ha(()=>br([])))}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=vw({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&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),xC(3),hl()(),jw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(BE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),Bw(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-BBqfFT3U.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-CSMJ7MDS.js';import {g,W,q as F,I as we$1,ag as U,ah as ke$1,ai as Ne$1,$ as $i,aj as Fe$1,a9 as F$1,ak as yd,r as rT,ac as by,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,t as eC,S as xI,k as $w,F as Fg,u as pf,w as hf,y as sh}from'./main-2G6YLE3Q.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=eC(2);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),xC(1,"Add an agent config"),hl(),xC(2," first. ")),n&2){let e=eC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),xC(2," No agent configs available in this scope yet. "),jw(3,Se,3,1),hl()()),n&2){let e=eC(2);BE(3),Bw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),BE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),xC(3,"Select an agent config\u2026"),hl(),Uw(4,Ee,2,2,"option",17,ve),hl(),MI(),hl()),n&2){let e=eC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(3),$w(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Yw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=eC(3);return hf(h.toggleDay(f.value))}),hl(),xC(2),hl();}if(n&2){let e=t.$implicit,l=eC(3);BE(),dg("checked",l.isDaySelected(e.value)),BE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),Uw(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=eC(2);BE(2),$w(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),dg("formControl",e.endDateControl),xI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),dg("formControl",e.occurrenceCountControl),xI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=eC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),MI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Uw(13,Te,2,2,"option",17,V),hl(),MI(),hl(),jw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),MI(),Es(19,"span",22),xC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),MI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),Uw(26,Me,2,2,"option",17,V),hl(),MI(),hl(),jw(28,Pe,2,2,"ds-form-field",28),jw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),MI(),xC(33," Enabled "),hl(),Es(34,"p",33),xC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),MI(),hl(),jw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),xC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=eC();return hf(f.cancel())}),xC(43,"Cancel"),hl()()();}if(n&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),dg("formControl",e.promptContentControl),xI(),BE(3),dg("formControl",e.unitControl),xI(),BE(),$w(e.schedulerUnits),BE(2),Bw(e.showDayFilter()?15:-1),BE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),dg("formControl",e.timeUtcControl),xI(),BE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),dg("formControl",e.startDateControl),xI(),BE(2),dg("formControl",e.endTypeControl),xI(),BE(),$w(e.endTypes),BE(2),Bw(e.showEndDate()?28:-1),BE(),Bw(e.showOccurrenceCount()?29:-1),BE(3),dg("formControl",e.enabledControl),xI(),BE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(),Bw(e.errorMessage()?38:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[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=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(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(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=rT(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=rT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=rT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=$i([]);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),by({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(ha(()=>br([])))}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=vw({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&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),xC(3),hl()(),jw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(BE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),Bw(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 {O as O$1}from'./chunk-B0TP-VcL.js';import {I}from'./chunk-BKu1hxzv.js';import {O}from'./chunk-DAzj31Q1.js';import {g,I as we$1,$ as $i,r as rT,a9 as F,at as Cy,ad as ne,K as U,v as vw,E as Es,f as fg,j as jw,a as hl,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,t as eC,P as dg,R as MI,U as Uw,F as Fg,S as xI,k as $w,s as Dl,ae as Pw,u as pf,w as hf,N as x,L as w}from'./main-OK5QY7NU.js';import {y,R as k,X as B,Y as a,p as pt,T as Te$1,Z as v,a0 as V,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,A as An,v as va,d as pn,h as hn,e as cn,a1 as un,g as dn,i as at,j as an,q as sn,a2 as Ti,K as Oi,a3 as m,a4 as S}from'./chunk-CFzCpWz-.js';import'./chunk-BcBIZEZM.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(o,e){if(o&1&&(Es(0,"option",27),xC(1),hl()),o&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Se(o,e){if(o&1){let t=Yw();Es(0,"form",15),vg("ngSubmit",function(){pf(t);let s=eC(2);return hf(s.save())}),Es(1,"ds-group",16)(2,"dl",17)(3,"dt"),xC(4,"Email"),hl(),Es(5,"dd"),xC(6),hl(),Es(7,"dt"),xC(8,"External ID"),hl(),Es(9,"dd"),xC(10),hl()()(),Es(11,"ds-group",18)(12,"ds-form-field",19),fg(13,"input",20),MI(),hl(),Es(14,"ds-form-field",21),fg(15,"input",22),MI(),hl(),Es(16,"ds-form-field",23),fg(17,"textarea",24),MI(),hl(),Es(18,"ds-form-field",25)(19,"select",26),Uw(20,xe,2,2,"option",27,ye),hl(),MI(),hl()(),Es(22,"ds-form-actions")(23,"button",28),xC(24),hl(),Es(25,"button",29),vg("click",function(){pf(t);let s=eC(2);return hf(s.cancelEditing())}),xC(26,"Cancel"),hl()()();}if(o&2){let t=eC(),l=eC();dg("formGroup",l.form),BE(6),Fg(t.email),BE(4),Fg(t.externalId),BE(3),xI(),BE(2),xI(),BE(2),xI(),BE(2),xI(),BE(),$w(l.languageOptions),BE(3),dg("disabled",l.isSaving()),BE(),Dl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Es(0,"p",2),xC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),hl());}function Pe(o,e){if(o&1){let t=Yw();Es(0,"span",38),xC(1,"Delete?"),hl(),Es(2,"button",39),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.confirmDelete(s))}),xC(3,"Confirm"),hl(),Es(4,"button",40),vg("click",function(){pf(t);let s=eC(6);return hf(s.cancelDelete())}),xC(5,"Cancel"),hl();}}function Te(o,e){if(o&1){let t=Yw();Es(0,"button",40),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.armDelete(s))}),xC(1,"Delete"),hl();}}function De(o,e){if(o&1&&(Es(0,"li",34)(1,"span",35),xC(2),hl(),Es(3,"span",36),xC(4),hl(),jw(5,Pe,6,0)(6,Te,2,0,"button",37),hl()),o&2){let t=e.$implicit,l=eC(5);BE(2),Fg(t.name),BE(2),Fg(t.subtitle),BE(),Bw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Es(0,"span",32),xC(1),hl(),Es(2,"ul",33),Uw(3,De,7,3,"li",34,Pw().trackEntry,true),hl()),o&2){let t=e.$implicit;BE(),Fg(t.title),BE(2),$w(t.entries);}}function Ve(o,e){if(o&1&&Uw(0,we,5,1,null,null,Ce),o&2){let t=eC(3);$w(t.recapSections());}}function Ue(o,e){if(o&1){let t=Yw();Es(0,"ds-group",16)(1,"dl",17)(2,"dt"),xC(3,"Email"),hl(),Es(4,"dd"),xC(5),hl(),Es(6,"dt"),xC(7,"External ID"),hl(),Es(8,"dd"),xC(9),hl()()(),Es(10,"ds-group",18)(11,"dl",17)(12,"dt"),xC(13,"First name"),hl(),Es(14,"dd"),xC(15),hl(),Es(16,"dt"),xC(17,"Last name"),hl(),Es(18,"dd"),xC(19),hl(),Es(20,"dt"),xC(21,"Bio"),hl(),Es(22,"dd"),xC(23),hl(),Es(24,"dt"),xC(25,"Language"),hl(),Es(26,"dd"),xC(27),hl()()(),Es(28,"ds-form-actions")(29,"button",30),vg("click",function(){pf(t);let s=eC(2);return hf(s.startEditing())}),xC(30,"Edit profile"),hl()(),Es(31,"ds-disclosure",31),vg("toggled",function(){pf(t);let s=eC(2);return hf(s.toggleOverrides())}),jw(32,Ee,2,0,"p",2)(33,Ve,2,0),hl();}if(o&2){let t=eC(),l=eC();BE(5),Fg(t.email),BE(4),Fg(t.externalId),BE(6),Fg(t.firstname||"\u2014"),BE(4),Fg(t.lastname||"\u2014"),BE(4),Fg(t.bio||"\u2014"),BE(4),Fg(t.preferredLanguage||"\u2014"),BE(4),dg("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),Bw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Yw();Es(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setThemeVariant(s))}),hl()(),Es(3,"ds-form-field",6)(4,"ds-segmented",7),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setTheme(s))}),hl()()(),Es(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setEnterKeyBehavior(s))}),hl()()(),Es(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setShowTechnical(s))}),hl()()(),jw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=eC();BE(),dg("hint",t.activeVariantDescription()),BE(),dg("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),dg("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),dg("options",t.modeOptions())("value",t.shownMode()),BE(3),dg("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),dg("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),Bw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Es(0,"p",2),xC(1,"Unable to load profile."),hl());}var ve=class o{userState=g(y);destroyRef=g(we$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(k);preferencesPort=g(B);isEditing=$i(false);isLoading=$i(false);isSaving=$i(false);isOverridesExpanded=$i(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=rT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=rT(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=rT(()=>!V(this.themeVariant(),this.themeMode()));activeVariantLabel=rT(()=>m(this.themeVariant()).label);activeVariantDescription=rT(()=>m(this.themeVariant()).description);modeOptions=rT(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=rT(()=>this.modeOverridden()?S(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];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(Cy([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=rT(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){v(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !V(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}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=$i(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=vw({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&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),hl()),t&2){let s;BE(2),Bw(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-CBcl2plG.js';import {I}from'./chunk-CFXn7UF0.js';import {O}from'./chunk-BR-v_Yw0.js';import {g,I as we$1,$ as $i,r as rT,a9 as F,at as Cy,ad as ne,K as U,v as vw,E as Es,f as fg,j as jw,a as hl,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,t as eC,P as dg,R as MI,U as Uw,F as Fg,S as xI,k as $w,s as Dl,ae as Pw,u as pf,w as hf,N as x,L as w}from'./main-2G6YLE3Q.js';import {y,R as k,X as B,Y as a,p as pt,T as Te$1,Z as v,a0 as V,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,A as An,v as va,d as pn,h as hn,e as cn,a1 as un,g as dn,i as at,j as an,q as sn,a2 as Ti,K as Oi,a3 as m,a4 as S}from'./chunk-CSMJ7MDS.js';import'./chunk-yhFoWYCU.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(o,e){if(o&1&&(Es(0,"option",27),xC(1),hl()),o&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Se(o,e){if(o&1){let t=Yw();Es(0,"form",15),vg("ngSubmit",function(){pf(t);let s=eC(2);return hf(s.save())}),Es(1,"ds-group",16)(2,"dl",17)(3,"dt"),xC(4,"Email"),hl(),Es(5,"dd"),xC(6),hl(),Es(7,"dt"),xC(8,"External ID"),hl(),Es(9,"dd"),xC(10),hl()()(),Es(11,"ds-group",18)(12,"ds-form-field",19),fg(13,"input",20),MI(),hl(),Es(14,"ds-form-field",21),fg(15,"input",22),MI(),hl(),Es(16,"ds-form-field",23),fg(17,"textarea",24),MI(),hl(),Es(18,"ds-form-field",25)(19,"select",26),Uw(20,xe,2,2,"option",27,ye),hl(),MI(),hl()(),Es(22,"ds-form-actions")(23,"button",28),xC(24),hl(),Es(25,"button",29),vg("click",function(){pf(t);let s=eC(2);return hf(s.cancelEditing())}),xC(26,"Cancel"),hl()()();}if(o&2){let t=eC(),l=eC();dg("formGroup",l.form),BE(6),Fg(t.email),BE(4),Fg(t.externalId),BE(3),xI(),BE(2),xI(),BE(2),xI(),BE(2),xI(),BE(),$w(l.languageOptions),BE(3),dg("disabled",l.isSaving()),BE(),Dl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Es(0,"p",2),xC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),hl());}function Pe(o,e){if(o&1){let t=Yw();Es(0,"span",38),xC(1,"Delete?"),hl(),Es(2,"button",39),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.confirmDelete(s))}),xC(3,"Confirm"),hl(),Es(4,"button",40),vg("click",function(){pf(t);let s=eC(6);return hf(s.cancelDelete())}),xC(5,"Cancel"),hl();}}function Te(o,e){if(o&1){let t=Yw();Es(0,"button",40),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.armDelete(s))}),xC(1,"Delete"),hl();}}function De(o,e){if(o&1&&(Es(0,"li",34)(1,"span",35),xC(2),hl(),Es(3,"span",36),xC(4),hl(),jw(5,Pe,6,0)(6,Te,2,0,"button",37),hl()),o&2){let t=e.$implicit,l=eC(5);BE(2),Fg(t.name),BE(2),Fg(t.subtitle),BE(),Bw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Es(0,"span",32),xC(1),hl(),Es(2,"ul",33),Uw(3,De,7,3,"li",34,Pw().trackEntry,true),hl()),o&2){let t=e.$implicit;BE(),Fg(t.title),BE(2),$w(t.entries);}}function Ve(o,e){if(o&1&&Uw(0,we,5,1,null,null,Ce),o&2){let t=eC(3);$w(t.recapSections());}}function Ue(o,e){if(o&1){let t=Yw();Es(0,"ds-group",16)(1,"dl",17)(2,"dt"),xC(3,"Email"),hl(),Es(4,"dd"),xC(5),hl(),Es(6,"dt"),xC(7,"External ID"),hl(),Es(8,"dd"),xC(9),hl()()(),Es(10,"ds-group",18)(11,"dl",17)(12,"dt"),xC(13,"First name"),hl(),Es(14,"dd"),xC(15),hl(),Es(16,"dt"),xC(17,"Last name"),hl(),Es(18,"dd"),xC(19),hl(),Es(20,"dt"),xC(21,"Bio"),hl(),Es(22,"dd"),xC(23),hl(),Es(24,"dt"),xC(25,"Language"),hl(),Es(26,"dd"),xC(27),hl()()(),Es(28,"ds-form-actions")(29,"button",30),vg("click",function(){pf(t);let s=eC(2);return hf(s.startEditing())}),xC(30,"Edit profile"),hl()(),Es(31,"ds-disclosure",31),vg("toggled",function(){pf(t);let s=eC(2);return hf(s.toggleOverrides())}),jw(32,Ee,2,0,"p",2)(33,Ve,2,0),hl();}if(o&2){let t=eC(),l=eC();BE(5),Fg(t.email),BE(4),Fg(t.externalId),BE(6),Fg(t.firstname||"\u2014"),BE(4),Fg(t.lastname||"\u2014"),BE(4),Fg(t.bio||"\u2014"),BE(4),Fg(t.preferredLanguage||"\u2014"),BE(4),dg("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),Bw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Yw();Es(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setThemeVariant(s))}),hl()(),Es(3,"ds-form-field",6)(4,"ds-segmented",7),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setTheme(s))}),hl()()(),Es(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setEnterKeyBehavior(s))}),hl()()(),Es(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setShowTechnical(s))}),hl()()(),jw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=eC();BE(),dg("hint",t.activeVariantDescription()),BE(),dg("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),dg("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),dg("options",t.modeOptions())("value",t.shownMode()),BE(3),dg("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),dg("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),Bw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Es(0,"p",2),xC(1,"Unable to load profile."),hl());}var ve=class o{userState=g(y);destroyRef=g(we$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(k);preferencesPort=g(B);isEditing=$i(false);isLoading=$i(false);isSaving=$i(false);isOverridesExpanded=$i(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=rT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=rT(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=rT(()=>!V(this.themeVariant(),this.themeMode()));activeVariantLabel=rT(()=>m(this.themeVariant()).label);activeVariantDescription=rT(()=>m(this.themeVariant()).description);modeOptions=rT(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=rT(()=>this.modeOverridden()?S(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];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(Cy([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=rT(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){v(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !V(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}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=$i(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=vw({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&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),hl()),t&2){let s;BE(2),Bw(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 +1 @@
|
|
|
1
|
-
import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-
|
|
1
|
+
import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-CSMJ7MDS.js';import {g,W,q as F,aU as D,ag as U,I as we,$ as $i,K as U$1,B,aV as gy,v as vw,E as Es,Q as vg,x as xC,a as hl,f as fg,j as jw,b as BE,P as dg,c as Bw,s as Dl,t as eC,F as Fg}from'./main-2G6YLE3Q.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),xC(1),hl()),l&2){let n=eC();BE(),Fg(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(D);caseState=g(N);agentConfigController=g(U);destroyRef=g(we);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=$i("");launchError=$i(null);isLaunching=$i(false);isLoading=$i(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.resolvedAgentConfig=t,t.loopConfig!=null&&this.payloadJson.set(JSON.stringify(t.loopConfig,null,2)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}launch(){return B(this,null,function*(){this.launchError.set(null),this.isLaunching.set(true);try{let t=this.resolvedAgentConfig??(yield gy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield gy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield gy(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(t){console.error("[AgentConfigLaunch] Failed to launch loop agent",t),this.launchError.set("Failed to launch the agent loop. Please check the console for details."),this.isLaunching.set(false);}})}back(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]);}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=vw({type:l,selectors:[["agentos-agent-config-launch"]],decls:17,vars:6,consts:[["title","Launch loop agent"],["dsButton","","variant","ghost","type","button","title","Back to agent config",3,"click"],[1,"ds-hint"],["label","Loop configuration (read-only)","controlId","agent-loop-payload"],["dsControl","","mono","","id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",3,"value","disabled"],["dsButton","","variant","primary","type","button",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(n,e){n&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return e.back()}),xC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),xC(5," The loop configuration below is read from "),Es(6,"code"),xC(7,"AgentConfig.loopConfig"),hl(),xC(8," and will be used by the backend when the agent loop starts. A new Case will be created and one child case will be launched per entity found. "),hl(),Es(9,"ds-form-field",3),fg(10,"textarea",4),hl(),jw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),xC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),xC(16,"Cancel"),hl()()()),n&2&&(BE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),BE(),Bw(e.launchError()?11:-1),BE(2),dg("disabled",e.isLaunching()),BE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),BE(),dg("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-
|
|
1
|
+
import {z as k,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CSMJ7MDS.js';import {g,W as W$1,q as F,I as we,ag as U$1,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,K as U$2,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-2G6YLE3Q.js';var J=(n,e)=>e.key;function U(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function z(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading agent configs\u2026"),hl());}function G(n,e){n&1&&(Es(0,"p",5),xC(1,"No agent configs available."),hl());}function Q(n,e){n&1&&(Es(0,"p",4),xC(1,"No agent configs match the current filter."),hl());}function W(n,e){n&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function X(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(2).$implicit,d=eC(2);return hf(d.launch(s))}),xC(1," Launch "),hl();}if(n&2){let t=eC(2).$implicit;lg("aria-label","Launch "+t.config.name);}}function Y(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC(2).$implicit,d=eC(2);return hf(d.edit(s))}),xC(1," Edit "),hl();}if(n&2){let t=eC(2).$implicit;lg("aria-label","Edit "+t.config.name);}}function Z(n,e){if(n&1){let t=Yw();Es(0,"button",22),vg("click",function(){pf(t);let s=eC().$implicit,d=eC(2);return hf(d.inspect(s))}),xC(1," Inspect "),hl(),jw(2,X,2,1,"button",23),jw(3,Y,2,1,"button",23);}if(n&2){let t=eC().$implicit,i=eC(2);lg("aria-label","Inspect "+t.config.name),BE(2),Bw(i.canLaunch(t)?2:-1),BE(),Bw(t.scope==="namespace"?3:-1);}}function ee(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",24),vg("deleteRequested",function(){pf(t);let s=eC().$implicit,d=eC(2);return hf(d.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC().$implicit,d=eC(2);return hf(d.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let t=eC().$implicit,i=eC(2);dg("rowKey",t.key)("rowLabel",t.config.name)("state",i.deletion);}}function te(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15)(8,"div",16)(9,"ds-tag",17),xC(10),hl(),jw(11,W,2,0,"ds-tag",18),hl()(),Es(12,"td",19)(13,"div",20),jw(14,Z,4,3),jw(15,ee,1,3,"agentos-row-delete-action",21),hl()()()),n&2){let t=e.$implicit,i=eC(2);BE(2),Fg(t.config.name),BE(2),Dl(" ",t.config.description||"\u2014"," "),BE(2),Fg(i.mode(t)),BE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),BE(),Fg(t.scope==="platform"?"Platform":"Namespace"),BE(),Bw(t.scope==="platform"?11:-1),BE(3),Bw(i.deletion.confirmingId()!==t.key?14:-1),BE(),Bw(t.scope==="namespace"?15:-1);}}function ne(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Execution mode"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,te,16,8,"tr",9,J),hl()()()),n&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var H=class n{route=g(W$1);router=g(F);destroyRef=g(we);controller=g(U$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();rows=$i([]);rowFilter=O(this.rows,e=>[e.config.name,e.config.description,this.mode(e),e.scope].filter(Boolean).join(" "));allConfigs$=this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(ha(()=>br([])))}))));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=vw({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&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return i.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New agent config"),hl()(),jw(4,U,2,1,"p",3),jw(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(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(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,2 +1,2 @@
|
|
|
1
|
-
import {I}from'./chunk-BKu1hxzv.js';import {g,W,aW as L,I as we,$ as $i,r as rT,aX as Be,ac as by,K as U,a2 as ha,aa as br,v as vw,E as Es,f as fg,j as jw,a as hl,Q as vg,b as BE,c as Bw,P as dg,x as xC,Y as Yw,R as MI,U as Uw,t as eC,S as xI,k as $w,s as Dl,as as Pg,u as pf,w as hf,F as Fg}from'./main-OK5QY7NU.js';import {a6 as id,b as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a8 as da,ac as Ni,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-CFzCpWz-.js';import'./chunk-BcBIZEZM.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Es(0,"p",1),xC(1,"Loading\u2026"),hl());}function se(i,t){if(i&1&&(Es(0,"ds-notice"),xC(1),hl()),i&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function re(i,t){if(i&1){let e=Yw();Es(0,"div")(1,"button",23),vg("click",function(){pf(e);let s=eC(2);return hf(s.retryLoad())}),xC(2,"Retry loading"),hl()();}}function ce(i,t){if(i&1&&(fg(0,"br"),xC(1)),i&2){let e=eC(3);BE(),Dl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Es(0,"ds-notice",3),xC(1),jw(2,ce,2,1),hl()),i&2){let e=eC(2);dg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),BE(),Dl(" Repository: ",e.checkoutStatus()," "),BE(),Bw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Es(0,"option",12),xC(1),hl()),i&2){let e=t.$implicit,c=eC(2);dg("value",e.id),BE(),Pg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Es(0,"p",13),xC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),hl());}function pe(i,t){if(i&1){let e=Yw();Es(0,"button",24),vg("click",function(){pf(e);let s=eC(2);return hf(s.remove())}),xC(1," Remove association "),hl();}if(i&2){let e=eC(2);dg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Yw();jw(0,se,2,1,"ds-notice"),jw(1,re,3,0,"div"),jw(2,de,3,3,"ds-notice",3),Es(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.repositoryUrl.set(s))}),hl(),MI(),hl(),Es(6,"ds-form-field",7)(7,"input",8),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.mainBranch.set(s))}),hl(),MI(),hl(),Es(8,"ds-form-field",9)(9,"select",10),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.serviceAuthSettingId.set(s))}),Es(10,"option",11),xC(11,"Select an auth setting\u2026"),hl(),Uw(12,le,2,3,"option",12,oe),hl(),MI(),jw(14,me,2,0,"p",13),hl()(),Es(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.autoWorktree.set(s))}),hl(),MI(),xC(19," Offer a worktree to every new top-level case "),hl(),Es(20,"p",18),xC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),hl()(),Es(22,"ds-form-field",19)(23,"input",20),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.setupCommand.set(s))}),hl(),MI(),Es(24,"p",13),xC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),hl()()(),Es(26,"ds-form-actions")(27,"button",21),vg("click",function(){pf(e);let s=eC();return hf(s.save())}),xC(28),hl(),jw(29,pe,2,1,"button",22),hl();}if(i&2){let e=eC();Bw(e.errorMessage()?0:-1),BE(),Bw(e.associationLoaded()?-1:1),BE(),Bw(e.isAssociated()&&e.checkoutStatus()?2:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(2),dg("ngModel",e.repositoryUrl()),xI(),BE(2),dg("ngModel",e.mainBranch()),xI(),BE(2),dg("ngModel",e.serviceAuthSettingId()),xI(),BE(3),$w(e.eligibleAuthSettings()),BE(2),Bw(e.eligibleAuthSettings().length===0?14:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(3),dg("ngModel",e.autoWorktree()),xI(),BE(5),dg("ngModel",e.setupCommand()),xI(),BE(4),dg("disabled",!e.canSave()),BE(),Dl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),BE(),Bw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(I);destroyRef=g(we);isLoading=$i(true);isSaving=$i(false);confirmingRemove=$i(false);associationLoaded=$i(false);errorMessage=$i(null);association=$i(null);authSettings=$i([]);repositoryUrl=$i("");mainBranch=$i("main");serviceAuthSettingId=$i("");autoWorktree=$i(false);setupCommand=$i("");namespaceId="";isAssociated=rT(()=>this.association()?.associated===true);eligibleAuthSettings=rT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=rT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=rT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Be;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),by({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ha(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ha(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),jw(2,ae,2,0,"p",1)(3,ue,30,14),hl(),Es(4,"ds-confirm-dialog",2),vg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),hl()),e&2&&(BE(2),Bw(c.isLoading()?2:3),BE(2),dg("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
|
|
1
|
+
import {I}from'./chunk-CFXn7UF0.js';import {g,W,aW as L,I as we,$ as $i,r as rT,aX as Be,ac as by,K as U,a2 as ha,aa as br,v as vw,E as Es,f as fg,j as jw,a as hl,Q as vg,b as BE,c as Bw,P as dg,x as xC,Y as Yw,R as MI,U as Uw,t as eC,S as xI,k as $w,s as Dl,as as Pg,u as pf,w as hf,F as Fg}from'./main-2G6YLE3Q.js';import {a6 as id,b as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a8 as da,ac as Ni,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-CSMJ7MDS.js';import'./chunk-yhFoWYCU.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Es(0,"p",1),xC(1,"Loading\u2026"),hl());}function se(i,t){if(i&1&&(Es(0,"ds-notice"),xC(1),hl()),i&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function re(i,t){if(i&1){let e=Yw();Es(0,"div")(1,"button",23),vg("click",function(){pf(e);let s=eC(2);return hf(s.retryLoad())}),xC(2,"Retry loading"),hl()();}}function ce(i,t){if(i&1&&(fg(0,"br"),xC(1)),i&2){let e=eC(3);BE(),Dl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Es(0,"ds-notice",3),xC(1),jw(2,ce,2,1),hl()),i&2){let e=eC(2);dg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),BE(),Dl(" Repository: ",e.checkoutStatus()," "),BE(),Bw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Es(0,"option",12),xC(1),hl()),i&2){let e=t.$implicit,c=eC(2);dg("value",e.id),BE(),Pg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Es(0,"p",13),xC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),hl());}function pe(i,t){if(i&1){let e=Yw();Es(0,"button",24),vg("click",function(){pf(e);let s=eC(2);return hf(s.remove())}),xC(1," Remove association "),hl();}if(i&2){let e=eC(2);dg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Yw();jw(0,se,2,1,"ds-notice"),jw(1,re,3,0,"div"),jw(2,de,3,3,"ds-notice",3),Es(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.repositoryUrl.set(s))}),hl(),MI(),hl(),Es(6,"ds-form-field",7)(7,"input",8),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.mainBranch.set(s))}),hl(),MI(),hl(),Es(8,"ds-form-field",9)(9,"select",10),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.serviceAuthSettingId.set(s))}),Es(10,"option",11),xC(11,"Select an auth setting\u2026"),hl(),Uw(12,le,2,3,"option",12,oe),hl(),MI(),jw(14,me,2,0,"p",13),hl()(),Es(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.autoWorktree.set(s))}),hl(),MI(),xC(19," Offer a worktree to every new top-level case "),hl(),Es(20,"p",18),xC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),hl()(),Es(22,"ds-form-field",19)(23,"input",20),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.setupCommand.set(s))}),hl(),MI(),Es(24,"p",13),xC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),hl()()(),Es(26,"ds-form-actions")(27,"button",21),vg("click",function(){pf(e);let s=eC();return hf(s.save())}),xC(28),hl(),jw(29,pe,2,1,"button",22),hl();}if(i&2){let e=eC();Bw(e.errorMessage()?0:-1),BE(),Bw(e.associationLoaded()?-1:1),BE(),Bw(e.isAssociated()&&e.checkoutStatus()?2:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(2),dg("ngModel",e.repositoryUrl()),xI(),BE(2),dg("ngModel",e.mainBranch()),xI(),BE(2),dg("ngModel",e.serviceAuthSettingId()),xI(),BE(3),$w(e.eligibleAuthSettings()),BE(2),Bw(e.eligibleAuthSettings().length===0?14:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(3),dg("ngModel",e.autoWorktree()),xI(),BE(5),dg("ngModel",e.setupCommand()),xI(),BE(4),dg("disabled",!e.canSave()),BE(),Dl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),BE(),Bw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(I);destroyRef=g(we);isLoading=$i(true);isSaving=$i(false);confirmingRemove=$i(false);associationLoaded=$i(false);errorMessage=$i(null);association=$i(null);authSettings=$i([]);repositoryUrl=$i("");mainBranch=$i("main");serviceAuthSettingId=$i("");autoWorktree=$i(false);setupCommand=$i("");namespaceId="";isAssociated=rT(()=>this.association()?.associated===true);eligibleAuthSettings=rT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=rT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=rT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Be;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),by({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ha(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ha(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),jw(2,ae,2,0,"p",1)(3,ue,30,14),hl(),Es(4,"ds-confirm-dialog",2),vg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),hl()),e&2&&(BE(2),Bw(c.isLoading()?2:3),BE(2),dg("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
|
|
2
2
|
export{ne as NamespaceGitComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,aK as fe,a6 as x}from'./main-
|
|
1
|
+
import {g,aK as fe,a6 as x}from'./main-2G6YLE3Q.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-CSMJ7MDS.js';import {v as vw,T as br,E as Es,x as xC,a as hl,f as fg,P as dg}from'./main-2G6YLE3Q.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=vw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Es(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),xC(3,"Platform"),hl(),Es(4,"span",2),xC(5,"/"),hl(),Es(6,"span"),xC(7,"Administration"),hl()(),fg(8,"router-outlet"),hl()),e&2&&dg("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f,a6 as id,n as nd,L as Lt,m as mo,c as po,a7 as so,a8 as da,a9 as ra,d as pn,h as hn,e as cn,C as mn,i as at,j as an,I as Io,aa as f$1}from'./chunk-
|
|
1
|
+
import {f,a6 as id,n as nd,L as Lt,m as mo,c as po,a7 as so,a8 as da,a9 as ra,d as pn,h as hn,e as cn,C as mn,i as at,j as an,I as Io,aa as f$1}from'./chunk-CSMJ7MDS.js';import {g,W,aM as Y,$ as $i,ab as le,O as Of,v as vw,aN as Db,E as Es,f as fg,j as jw,a as hl,b as BE,c as Bw,ak as yd,a1 as ga,a3 as rn,ac as by,a2 as ha,x as xC,Y as Yw,Q as vg,aO as Hg,R as MI,t as eC,aP as Vg,S as xI,U as Uw,k as $w,aQ as zC,aR as $C,F as Fg,l as lg,av as YC,aw as KC,as as Pg,s as Dl,aS as XC,u as pf,w as hf,aT as PC}from'./main-2G6YLE3Q.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Es(0,"p",2),xC(1,"Loading usage settings\u2026"),hl());}function fe(e,a){if(e&1){let t=Yw();Es(0,"ds-notice"),xC(1,"Could not load usage settings. Please try again."),hl(),Es(2,"div")(3,"button",3),vg("click",function(){pf(t);let s=eC();return hf(s.configuration.retry())}),xC(4,"Retry usage settings"),hl()();}}function ye(e,a){e&1&&(Es(0,"p",2),xC(1,"Usage tracking is disabled."),hl());}function be(e,a){e&1&&(Es(0,"ds-notice"),xC(1),hl()),e&2&&(BE(),Fg(a));}function xe(e,a){e&1&&(Es(0,"p",2),xC(1,"Loading usage\u2026"),hl());}function he(e,a){e&1&&(Es(0,"p",12),xC(1,"No recorded usage for this period."),hl());}function Se(e,a){if(e&1&&(Es(0,"p",10),xC(1),hl()),e&2){let t=eC().$implicit;BE(),Dl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Es(0,"tr",16)(1,"td",18),xC(2),hl(),Es(3,"td",19),xC(4),YC(5,"number"),hl(),Es(6,"td",20),xC(7),YC(8,"number"),YC(9,"number"),hl(),Es(10,"td",21),xC(11),YC(12,"number"),YC(13,"number"),hl(),Es(14,"td",22),xC(15),YC(16,"agentosCost"),jw(17,Se,2,1,"p",10),hl()()),e&2){let t=a.$implicit;BE(2),Fg(t.key),BE(2),Fg(KC(5,8,t.aggregate.totalTokens)),BE(3),Pg(" ",KC(8,10,t.aggregate.inputTokens)," / ",KC(9,12,t.aggregate.outputTokens)," "),BE(4),Pg(" ",KC(12,14,t.aggregate.cacheReadTokens)," / ",KC(13,16,t.aggregate.cacheWriteTokens)," "),BE(4),Dl(" ",XC(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),BE(2),Bw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Es(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),xC(5,"Name"),hl(),Es(6,"th",17),xC(7,"Tokens"),hl(),Es(8,"th",17),xC(9,"Input / output"),hl(),Es(10,"th",17),xC(11,"Cache read / write"),hl(),Es(12,"th",17),xC(13,"Estimated cost"),hl()()(),Es(14,"tbody",15),Uw(15,we,18,21,"tr",16,_e),hl()()()),e&2){let t=eC().$implicit;BE(),lg("aria-label","Usage "+t.title.toLowerCase()),BE(14),$w(t.rows);}}function Ne(e,a){if(e&1&&(Es(0,"h3",11),xC(1),hl(),jw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;BE(),Fg(t.title),BE(),Bw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(Uw(0,Ne,4,2,null,null,ue),Es(2,"p",10),xC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),hl()),e&2){let t=eC(2);$w(zC(4,ge,$C(0,ce,t.agents()),$C(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let s=eC();return hf(s.load())}),Es(1,"ds-form-field",5)(2,"input",6),Hg("ngModelChange",function(s){pf(t);let m=eC();return PC(m.from,s)||(m.from=s),hf(s)}),hl(),MI(),hl(),Es(3,"ds-form-field",7)(4,"input",8),Hg("ngModelChange",function(s){pf(t);let m=eC();return PC(m.to,s)||(m.to=s),hf(s)}),hl(),MI(),hl(),Es(5,"button",9),xC(6,"Refresh"),hl()(),jw(7,be,2,1,"ds-notice"),jw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=eC();BE(2),Vg("ngModel",r.from),xI(),BE(2),Vg("ngModel",r.to),xI(),BE(3),Bw((t=r.error())?7:-1,t),BE(),Bw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=$i([]);models=$i([]);error=$i(null);loading=$i(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Of(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(yd(void 0),ga(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),rn):(this.loading.set(true),by({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ha(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),rn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=vw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),hl()),t&2&&(BE(2),Bw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[id,nd,Lt,mo,po,so,da,ra,pn,hn,cn,mn,at,an,Io,Db,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-B0TP-VcL.js';import {v}from'./chunk-zFiPZAOG.js';import {g,W,q as F,I as we,$ as $i,a9 as F$1,an as Me,O as Of,K as U,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,Y as Yw,U as Uw,ao as Hw,R as MI,f as fg,am as Vw,t as eC,S as xI,k as $w,s as Dl,ae as Pw,F as Fg,u as pf,w as hf}from'./main-OK5QY7NU.js';import {p as pt,E as Bt,T as Te,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o}from'./chunk-CFzCpWz-.js';import'./chunk-BcBIZEZM.js';function ge(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function be(o,t){if(o&1&&(Es(0,"label",23),fg(1,"input",24),MI(),xC(2),hl()),o&2){let e=t.$implicit,r=eC(3);BE(),dg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),xI(),BE(),Dl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Es(0,"ds-fieldset",5),Uw(1,be,3,4,"label",23,Pw().trackByScope,true),hl()),o&2){let e=eC(2);dg("disabled",e.isEditMode()),BE(),$w(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Es(0,"option",8),xC(1),hl()),o&2){let e=t.$implicit;dg("value",e),BE(),Fg(e);}}function Se(o,t){if(o&1){let e=Yw();Es(0,"div",19),fg(1,"input",25),MI(),fg(2,"input",26),MI(),Es(3,"button",27),vg("click",function(){let l=pf(e).$index,f=eC(2);return hf(f.removeHeader(l))}),xC(4," \xD7 "),hl()();}if(o&2){let e=t.$index;dg("formGroupName",e),BE(),xI(),BE(),xI();}}function Pe(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let l=eC();return hf(l.submit())}),jw(1,_e,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),Uw(4,Ae,2,2,"option",8,Hw),hl(),MI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),MI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),MI(),hl(),Es(10,"ds-form-field",13),fg(11,"input",14),MI(),hl(),Es(12,"ds-form-field",15),fg(13,"input",16),MI(),hl(),Es(14,"ds-form-field",17)(15,"div",18),Uw(16,Se,5,1,"div",19,Vw),Es(18,"div")(19,"button",20),vg("click",function(){pf(e);let l=eC();return hf(l.addHeader())}),xC(20,"+ Add header"),hl()()()(),Es(21,"ds-form-actions")(22,"button",21),xC(23),hl(),Es(24,"button",22),vg("click",function(){pf(e);let l=eC();return hf(l.cancel())}),xC(25,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),Bw(e.isPlatformMode?-1:1),BE(2),dg("formControl",e.apiTypeControl),xI(),BE(),$w(e.apiTypeOptions),BE(3),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(2),dg("formControl",e.baseUrlControl),xI(),BE(2),dg("formControl",e.apiKeyControl),xI(),BE(2),dg("formArrayName","headers"),BE(),$w(e.headersArray.controls),BE(6),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Me);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[fn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Bt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[fn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[fn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3," \u2190 AI providers "),hl()(),jw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),BE(3),Bw(r.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An,va,go,_o],encapsulation:2})};export{ye as AiProviderFormComponent};
|
|
1
|
+
import {O}from'./chunk-CBcl2plG.js';import {v}from'./chunk-CZVszAsn.js';import {g,W,q as F,I as we,$ as $i,a9 as F$1,an as Me,O as Of,K as U,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,Y as Yw,U as Uw,ao as Hw,R as MI,f as fg,am as Vw,t as eC,S as xI,k as $w,s as Dl,ae as Pw,F as Fg,u as pf,w as hf}from'./main-2G6YLE3Q.js';import {p as pt,E as Bt,T as Te,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o}from'./chunk-CSMJ7MDS.js';import'./chunk-yhFoWYCU.js';function ge(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function be(o,t){if(o&1&&(Es(0,"label",23),fg(1,"input",24),MI(),xC(2),hl()),o&2){let e=t.$implicit,r=eC(3);BE(),dg("formControl",r.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!r.isAdmin()),xI(),BE(),Dl(" ",e.label," ");}}function _e(o,t){if(o&1&&(Es(0,"ds-fieldset",5),Uw(1,be,3,4,"label",23,Pw().trackByScope,true),hl()),o&2){let e=eC(2);dg("disabled",e.isEditMode()),BE(),$w(e.scopeOptions);}}function Ae(o,t){if(o&1&&(Es(0,"option",8),xC(1),hl()),o&2){let e=t.$implicit;dg("value",e),BE(),Fg(e);}}function Se(o,t){if(o&1){let e=Yw();Es(0,"div",19),fg(1,"input",25),MI(),fg(2,"input",26),MI(),Es(3,"button",27),vg("click",function(){let l=pf(e).$index,f=eC(2);return hf(f.removeHeader(l))}),xC(4," \xD7 "),hl()();}if(o&2){let e=t.$index;dg("formGroupName",e),BE(),xI(),BE(),xI();}}function Pe(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let l=eC();return hf(l.submit())}),jw(1,_e,3,1,"ds-fieldset",5),Es(2,"ds-form-field",6)(3,"select",7),Uw(4,Ae,2,2,"option",8,Hw),hl(),MI(),hl(),Es(6,"ds-form-field",9),fg(7,"input",10),MI(),hl(),Es(8,"ds-form-field",11),fg(9,"input",12),MI(),hl(),Es(10,"ds-form-field",13),fg(11,"input",14),MI(),hl(),Es(12,"ds-form-field",15),fg(13,"input",16),MI(),hl(),Es(14,"ds-form-field",17)(15,"div",18),Uw(16,Se,5,1,"div",19,Vw),Es(18,"div")(19,"button",20),vg("click",function(){pf(e);let l=eC();return hf(l.addHeader())}),xC(20,"+ Add header"),hl()()()(),Es(21,"ds-form-actions")(22,"button",21),xC(23),hl(),Es(24,"button",22),vg("click",function(){pf(e);let l=eC();return hf(l.cancel())}),xC(25,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),Bw(e.isPlatformMode?-1:1),BE(2),dg("formControl",e.apiTypeControl),xI(),BE(),$w(e.apiTypeOptions),BE(3),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(2),dg("formControl",e.baseUrlControl),xI(),BE(2),dg("formControl",e.apiKeyControl),xI(),BE(2),dg("formArrayName","headers"),BE(),$w(e.headersArray.controls),BE(6),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var xe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ye=class o{route=g(W);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?$i(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Me);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),apiType:new Te("OpenAI",{nonNullable:true,validators:[fn.required]}),baseUrl:new Te("",{nonNullable:true}),apiKey:new Te("",{nonNullable:true}),scope:new Te("namespace",{nonNullable:true}),headers:new Bt([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new pt({key:new Te("",{nonNullable:true,validators:[fn.required]}),value:new Te("",{nonNullable:true})}));}removeHeader(t){this.headersArray.removeAt(t);}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Of(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,r=t.get("aiProviderId"),l=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(r){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(r);return}this.scopeControl.setValue(l);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(t){return t&&xe.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId?"namespace":t.namespaceId?"userOnNs":"userGlobal"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.apiTypeControl.setValue(t.apiType),this.baseUrlControl.setValue(t.baseUrl??"");let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[r,l]of Object.entries(t.headers??{}))this.headersArray.push(new pt({key:new Te(r,{nonNullable:true,validators:[fn.required]}),value:new Te(l,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),r=this.apiKeyControl.value,l=this.isEditMode()&&r===this.initialApiKey?null:r,f=this.headersArray.controls.filter(A=>A.controls.key.value.trim()).map(A=>[A.controls.key.value.trim(),A.controls.value.value]),Ce=f.length>0?Object.fromEntries(f):null,V={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:t||null,baseUrl:e||null,apiKey:l,headers:Ce},w=this.form.getRawValue().scope,he=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,V,w,this.existingConfig):this.state.create(V,w,he)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-ai-provider-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI providers",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","API type","controlId","llm-api-type","required",""],["dsControl","","id","llm-api-type",3,"formControl"],[3,"value"],["label","Name","controlId","llm-name","required",""],["dsControl","","id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",3,"formControl"],["label","Description","controlId","llm-description"],["dsControl","","id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",3,"formControl"],["label","Base URL","controlId","llm-base-url"],["dsControl","","id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",3,"formControl"],["label","API key","controlId","llm-api-key"],["dsControl","","id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",3,"formControl"],["label","Custom headers"],[1,"ds-stack","ds-stack--sm",3,"formArrayName"],[1,"ds-inline",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],["dsControl","","type","text","placeholder","Header name","formControlName","key","autocomplete","off"],["dsControl","","type","text","placeholder","Value","formControlName","value","autocomplete","off"],["dsButton","","variant","icon-danger","type","button","title","Remove header","aria-label","Remove header",3,"click"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3," \u2190 AI providers "),hl()(),jw(4,ge,2,0,"p",2)(5,Pe,26,10,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit AI provider":"New AI provider"),BE(3),Bw(r.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An,va,go,_o],encapsulation:2})};export{ye as AiProviderFormComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {aY as A,aZ as z$1}from'./main-
|
|
1
|
+
import {aY as A,aZ as z$1}from'./main-2G6YLE3Q.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
|
|
2
2
|
`});J=!1,C=I.length;}function ne(A,k){var _="="+b,ie=A.indexOf(_,k),De=f(A.substring(A.indexOf("=",k)+1,ie)).split(" ");return L=De[0],b=De[De.length-1],ie+_.length-1}for(g&&(g=g.split(" "),L=g[0],b=g[1]),O=0;O<S;O++)E==U?v(L,h,O)?(--O,te(),E=R):h.charAt(O)==`
|
|
3
3
|
`?be(J):B+=h.charAt(O):E==R?(O+=L.length-1,ee=i.tags[h.charAt(O+1)],$=ee?h.charAt(O+1):"_v",$=="="?(O=ne(h,O),E=U):(ee&&O++,E=q),J=O):v(b,h,O)?(I.push({tag:$,n:f(B),otag:L,ctag:b,i:$=="/"?J-L.length:O+b.length}),B="",O+=b.length-1,E=U,$=="{"&&(b=="}}"?O++:d(I[I.length-1]))):B+=h.charAt(O);return be(J,!0),I};function d(l){l.n.substr(l.n.length-1)==="}"&&(l.n=l.n.substring(0,l.n.length-1));}function f(l){return l.trim?l.trim():l.replace(/^\s*|\s*$/g,"")}function v(l,h,g){if(h.charAt(g)!=l.charAt(0))return !1;for(var S=1,U=l.length;S<U;S++)if(h.charAt(g+S)!=l.charAt(S))return !1;return !0}var y={_t:!0,"\n":!0,$:!0,"/":!0};function o(l,h,g,S){var U=[],R=null,q=null,E=null;for(q=g[g.length-1];l.length>0;){if(E=l.shift(),q&&q.tag=="<"&&!(E.tag in y))throw new Error("Illegal content in < super tag.");if(i.tags[E.tag]<=i.tags.$||c(E,S))g.push(E),E.nodes=o(l,E.tag,g,S);else if(E.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+E.n);if(R=g.pop(),E.n!=R.n&&!m(E.n,R.n,S))throw new Error("Nesting error: "+R.n+" vs. "+E.n);return R.end=E.i,U}else E.tag==`
|
|
4
4
|
`&&(E.last=l.length==0||l[0].tag==`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z as k$1,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-
|
|
1
|
+
import {z as k$1,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CSMJ7MDS.js';import {g,W as W$1,q as F,I as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,K as U,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-2G6YLE3Q.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function W(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading AI models\u2026"),hl());}function X(i,e){i&1&&(Es(0,"p",5),xC(1,"No AI models configured."),hl());}function Y(i,e){i&1&&(Es(0,"p",4),xC(1,"No AI models match the current filter."),hl());}function Z(i,e){i&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function ee(i,e){if(i&1){let t=Yw();Es(0,"button",24),vg("click",function(){pf(t);let s=eC(2).$implicit,m=eC(2);return hf(m.edit(s))}),xC(1,"Edit"),hl();}if(i&2){let t=eC(2).$implicit,n=eC(2);lg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Yw();jw(0,ee,2,1,"button",22),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,n=eC(2);Bw(n.deletion.confirmingId()!==t.key?0:-1),BE(),dg("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Es(0,"button",21),xC(1,"Inherited"),hl());}function ne(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15)(8,"div",16)(9,"ds-tag",17),xC(10),hl(),jw(11,Z,2,0,"ds-tag",18),hl()(),Es(12,"td",19)(13,"div",20),jw(14,te,2,4)(15,ie,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,n=eC(2);BE(2),Fg(n.title(t)),BE(2),Fg(t.providerName),BE(2),Dl(" ",t.model.apiModelName," "),BE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),BE(),Fg(t.scope==="platform"?"Platform":"Namespace"),BE(),Bw(t.scope==="platform"?11:-1),BE(3),Bw(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Provider"),hl(),Es(8,"th",10),xC(9,"API model name"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,16,7,"tr",9,G),hl()()()),i&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ha(()=>br([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(ga(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return by({namespace:br(e),platform:br(t),providers:br(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(ha(()=>br([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return n.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),xC(3,"New AI model"),hl()(),jw(4,Q,2,1,"p",3),jw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(BE(),dg("query",n.rowFilter.query()),BE(3),Bw(n.deletion.error()?4:-1),BE(),Bw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {o}from'./chunk-
|
|
1
|
+
import {o}from'./chunk-DPXe72IN.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-CSMJ7MDS.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-2G6YLE3Q.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function A(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading skills\u2026"),hl());}function H(i,e){i&1&&(Es(0,"p",5),xC(1,"No platform skills defined yet."),hl());}function U(i,e){i&1&&(Es(0,"p",4),xC(1,"No skills match the current filter."),hl());}function z(i,e){i&1&&(Es(0,"ds-tag",15),xC(1,"SKILL.md"),hl());}function G(i,e){if(i&1){let t=Yw();Es(0,"button",21),vg("click",function(){pf(t);let d=eC(2).$implicit,m=eC(2);return hf(m.edit(d))}),xC(1,"Edit"),hl();}if(i&2){let t=eC(2).$implicit;lg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=Yw();Es(0,"button",21),vg("click",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.inspect(d))}),xC(1,"View"),hl(),jw(2,G,2,1,"button",22);}if(i&2){let t=eC().$implicit;lg("aria-label","View "+t.name),BE(2),Bw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=Yw();Es(0,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,m=eC(2);return hf(m.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,l=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),xC(4),hl(),jw(5,z,2,0,"ds-tag",15),hl()(),Es(6,"td",16),xC(7),hl(),Es(8,"td",17),xC(9),hl(),Es(10,"td",18)(11,"div",19),jw(12,J,3,2),jw(13,Q,1,3,"agentos-row-delete-action",20),hl()()()),i&2){let t=e.$implicit,l=eC(2);BE(4),Fg(t.name),BE(),Bw(t.readOnly?5:-1),BE(2),Dl(" ",t.description||"\u2014"," "),BE(2),Fg(l.resourceCount(t)),BE(3),Bw(l.deletion.confirmingId()!==t.id?12:-1),BE(),Bw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Resources"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,W,14,6,"tr",9,K),hl()()()),i&2){let t=eC();BE(14),$w(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(we);skillState=g(o);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();skills=$i([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\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 skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["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,l){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return l.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return l.openCreateForm()}),xC(3,"New skill"),hl()(),jw(4,O,2,1,"p",3),jw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(BE(),dg("query",l.rowFilter.query()),BE(3),Bw(l.deletion.error()?4:-1),BE(),Bw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
|