@whoz-oss/coday-client 0.0.0-workstream-forge.111 → 0.0.0-workstream-forge.112
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-Dsr6qG6r.js → chunk-2a_tEMDB.js} +1 -1
- package/browser/{chunk-BKGnYAUR.js → chunk-2uHUmqnY.js} +1 -1
- package/browser/{chunk-ClPtCPiU.js → chunk-3Hiw8VE3.js} +1 -1
- package/browser/{chunk-U5qyTaf4.js → chunk-5kF7gjDB.js} +1 -1
- package/browser/{chunk-DZCghMTL.js → chunk-B6oXFAxt.js} +1 -1
- package/browser/{chunk-CDF2ahRh.js → chunk-BD6BSB21.js} +1 -1
- package/browser/{chunk-DLAfy6Py.js → chunk-BFHIAOTm.js} +1 -1
- package/browser/{chunk-CP75LAfM.js → chunk-BJZU1jzJ.js} +1 -1
- package/browser/{chunk-CmgjgUX8.js → chunk-BSj9M0qs.js} +1 -1
- package/browser/{chunk-C1zqP1Uj.js → chunk-BXLChVTK.js} +1 -1
- package/browser/{chunk-HheDGx6T.js → chunk-B_3cULZz.js} +1 -1
- package/browser/{chunk-B795cm8m.js → chunk-B_VSkQHi.js} +1 -1
- package/browser/{chunk-DeRTJ-9X.js → chunk-Bb0ksCWN.js} +1 -1
- package/browser/{chunk-YAQ8o8gd.js → chunk-BcTZsxV7.js} +1 -1
- package/browser/{chunk-CSHtn539.js → chunk-BdFVC1lo.js} +1 -1
- package/browser/{chunk-9KYYyWcX.js → chunk-BeP59zwk.js} +1 -1
- package/browser/{chunk-D17xD-6E.js → chunk-BiOF7nKe.js} +1 -1
- package/browser/{chunk-CzWPw7Kb.js → chunk-BiyMuDSE.js} +1 -1
- package/browser/{chunk-Br_9kXu2.js → chunk-Bk5-2fka.js} +1 -1
- package/browser/{chunk-SwIRUtfv.js → chunk-BoDWsYny.js} +1 -1
- package/browser/{chunk-DHJGYvts.js → chunk-BrYO384a.js} +1 -1
- package/browser/{chunk-BxXupFfW.js → chunk-Brn7qzj6.js} +1 -1
- package/browser/{chunk-BYHhP0yu.js → chunk-BvCTauXM.js} +1 -1
- package/browser/{chunk-BnG-axva.js → chunk-BvZAdnXo.js} +1 -1
- package/browser/{chunk-OBbxFJ82.js → chunk-C0mqgPpP.js} +1 -1
- package/browser/{chunk-DvQwbSrE.js → chunk-C14qfY5v.js} +1 -1
- package/browser/{chunk-B0ReGfih.js → chunk-C32fe9qE.js} +1 -1
- package/browser/{chunk-BBCKCbsh.js → chunk-C3R8N4-D.js} +1 -1
- package/browser/{chunk--Eu5GmLU.js → chunk-C7-hYrF8.js} +1 -1
- package/browser/{chunk-zoENz5pL.js → chunk-C9lPh04t.js} +1 -1
- package/browser/{chunk-DLpqoFoy.js → chunk-CA-aqKor.js} +1 -1
- package/browser/{chunk-yS_3qnfr.js → chunk-CInem4Y8.js} +1 -1
- package/browser/{chunk-CB_qwIx0.js → chunk-CTQSTRGD.js} +1 -1
- package/browser/{chunk-BcA63-_2.js → chunk-CW1b_pvj.js} +1 -1
- package/browser/{chunk-BdQKJNji.js → chunk-CWxUagiE.js} +1 -1
- package/browser/{chunk-C4ia1JEu.js → chunk-CXZnycAw.js} +1 -1
- package/browser/{chunk-cHrt7cAU.js → chunk-Ci6Vb99F.js} +1 -1
- package/browser/{chunk-_FxtcKKL.js → chunk-Cj4V5eFs.js} +1 -1
- package/browser/{chunk-DMmhpxI3.js → chunk-CoP_7cgo.js} +1 -1
- package/browser/{chunk-5PKS0_6W.js → chunk-CpjqPXBu.js} +1 -1
- package/browser/{chunk-CcdN6Tiq.js → chunk-CrNBJoK_.js} +1 -1
- package/browser/{chunk-DzdoNEBA.js → chunk-Csunplqi.js} +1 -1
- package/browser/{chunk-iH0_1Kk3.js → chunk-CyrH3KTN.js} +1 -1
- package/browser/{chunk-Blhg03I2.js → chunk-D2Kgsuhc.js} +1 -1
- package/browser/{chunk-3EpdNB3J.js → chunk-D3W3Jjpb.js} +1 -1
- package/browser/{chunk-Dvz7tu-b.js → chunk-D4EgaaUD.js} +1 -1
- package/browser/{chunk-CWmsDCbt.js → chunk-D5PhFOjy.js} +1 -1
- package/browser/{chunk-CJ6SoRyx.js → chunk-D6b4DbUr.js} +1 -1
- package/browser/{chunk-B7ljVpTq.js → chunk-D91rrS5P.js} +1 -1
- package/browser/{chunk-DKQJQhx7.js → chunk-DAA2CPJs.js} +1 -1
- package/browser/{chunk-CR7v_FrX.js → chunk-DCR_mnnc.js} +1 -1
- package/browser/{chunk-BXkjrXYC.js → chunk-DE5iOZ9_.js} +1 -1
- package/browser/{chunk-xhgNTdQH.js → chunk-DJ6-qiiH.js} +1 -1
- package/browser/chunk-DKqi2OiN.js +1 -0
- package/browser/{chunk-CLTDviw6.js → chunk-DOgRy8_6.js} +1 -1
- package/browser/{chunk-CwWxGIXx.js → chunk-DPdQ_sjv.js} +1 -1
- package/browser/{chunk-CBwHOIH1.js → chunk-DgRTzXf4.js} +1 -1
- package/browser/{chunk-C5W7lxy-.js → chunk-DiZVuYwU.js} +1 -1
- package/browser/{chunk-C3O2iLZp.js → chunk-DpqAGYsP.js} +1 -1
- package/browser/{chunk-BpWyUurX.js → chunk-DrfVqOmr.js} +1 -1
- package/browser/{chunk-K1tWWGkU.js → chunk-DudS24-k.js} +1 -1
- package/browser/{chunk-CD3vX-2T.js → chunk-DzT626bc.js} +1 -1
- package/browser/{chunk-oC3AJs9n.js → chunk-Kl-z0vIv.js} +1 -1
- package/browser/{chunk-CM-uNjXT.js → chunk-RuCL6jeC.js} +1 -1
- package/browser/{chunk-CIaHSdWa.js → chunk-T2_lMctk.js} +1 -1
- package/browser/{chunk-D6BS5d3G.js → chunk-VcksOoNe.js} +1 -1
- package/browser/{chunk-DKICVSt6.js → chunk-Y_zR5JpD.js} +1 -1
- package/browser/{chunk-DY7-eNON.js → chunk-kfD9gd5I.js} +1 -1
- package/browser/{chunk-CMwalRI_.js → chunk-nRe4omjL.js} +1 -1
- package/browser/{chunk-BVUL4WL8.js → chunk-q9vy7EP5.js} +1 -1
- package/browser/chunk-qYcN8ULw.js +10 -0
- package/browser/index.html +1 -1
- package/browser/{main-ZIS64A7B.js → main-HJHU5XWA.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-BmMgSm-g.js +0 -10
- package/browser/chunk-D-2ArFBU.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-DvQwbSrE.js';import {g,ao as W,F,C as Ce$1,da as $,db as Oe$1,dc as Ie$1,G as Gi,dd as Ve$1,a as F$1,bR as wd,m as mT,M as By,b as U,a7 as ya,Q as br,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a5 as vl,v as eC,a9 as lC,S as Sg,a3 as VI,s as rC,ac as gC,u as bg,z as Ug,a6 as UI,y as oC,a8 as Yg,aa as If,ab as wf,bk as yh}from'./main-ZIS64A7B.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-CWmsDCbt.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ue(n,t){n&1&&(ws(0,"span",12),GC(1," Name is required. "),pl());}function fe(n,t){if(n&1&&(ws(0,"p",42),GC(1),pl(),ws(2,"span",13),GC(3,"Agent Config cannot be changed after creation."),pl()),n&2){let e=gC(2);XE(),Yg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(ws(0,"a",43),GC(1,"Add an agent config"),pl(),GC(2," first. ")),n&2){let e=gC(3);bg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(ws(0,"p",13),GC(1," No agent configs available in this scope yet. "),Jw(2,_e,3,1),pl()),n&2){let e=gC(2);XE(2),eC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.id),XE(),Yg(e.name);}}function Ce(n,t){n&1&&(ws(0,"span",12),GC(1,"Agent Config is required."),pl());}function ve(n,t){if(n&1&&(ws(0,"select",44)(1,"option",45),GC(2,"Select an agent config\u2026"),pl(),rC(3,ge,2,2,"option",23,me),pl(),VI(),Jw(5,Ce,2,0,"span",12),ws(6,"span",13),GC(7,"Immutable after creation."),pl()),n&2){let e=gC(2);bg("formControl",e.agentConfigIdControl),UI(),XE(3),oC(e.availableAgentConfigs()),XE(2),eC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(ws(0,"span",12),GC(1,"Opening message is required."),pl());}function ye(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function be(n,t){if(n&1){let e=lC();ws(0,"label",48)(1,"input",49),Rg("change",function(){let g=If(e).$implicit,v=gC(3);return wf(v.toggleDay(g.value))}),pl(),ws(2,"span",50),GC(3),pl()();}if(n&2){let e=t.$implicit,d=gC(3);XE(),bg("checked",d.isDaySelected(e.value)),XE(2),Yg(e.label);}}function Se(n,t){if(n&1&&(ws(0,"div",8)(1,"span",46),GC(2,"Days of week"),pl(),ws(3,"div",47),rC(4,be,4,2,"label",48,A),pl(),ws(6,"span",13),GC(7,"Leave empty to run every day of the week."),pl()()),n&2){let e=gC(2);XE(4),oC(e.dayOptions);}}function Ee(n,t){n&1&&(ws(0,"span",12),GC(1,"Valid time is required (HH:mm)."),pl());}function Pe(n,t){n&1&&(ws(0,"span",12),GC(1,"Start date is required."),pl());}function Me(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function Oe(n,t){n&1&&(ws(0,"span",12),GC(1,"End date is required."),pl());}function De(n,t){if(n&1&&(ws(0,"div",8)(1,"label",51),GC(2," End date "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",52),VI(),Jw(6,Oe,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),bg("formControl",e.endDateControl),UI(),XE(),eC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(ws(0,"span",12),GC(1,"Must be at least 1."),pl());}function we(n,t){if(n&1&&(ws(0,"div",8)(1,"label",53),GC(2," Number of occurrences "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",54),VI(),Jw(6,Te,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),bg("formControl",e.occurrenceCountControl),UI(),XE(),eC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(ws(0,"span",12),GC(1,"Invalid JSON."),pl());}function Ne(n,t){if(n&1&&(ws(0,"p",38),GC(1),pl()),n&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let g=gC();return wf(g.submit())}),ws(1,"div",8)(2,"label",9),GC(3," Name "),ws(4,"span",10),GC(5,"*"),pl()(),Sg(6,"input",11),VI(),Jw(7,ue,2,0,"span",12),ws(8,"span",13),GC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),pl()(),ws(10,"div",8)(11,"label",14),GC(12,"Description"),pl(),Sg(13,"input",15),VI(),pl(),ws(14,"div",8)(15,"label",16),GC(16," Agent Config "),ws(17,"span",10),GC(18,"*"),pl()(),Jw(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),pl(),ws(22,"div",8)(23,"label",17),GC(24," Opening message "),ws(25,"span",10),GC(26,"*"),pl()(),Sg(27,"textarea",18),VI(),Jw(28,xe,2,0,"span",12),ws(29,"span",13),GC(30," The message sent to the agent when the scheduled prompt fires. "),pl()(),ws(31,"fieldset",19)(32,"legend",20),GC(33,"Recurrence"),pl(),ws(34,"div",8)(35,"label",21),GC(36," Unit "),ws(37,"span",10),GC(38,"*"),pl()(),ws(39,"select",22),rC(40,ye,2,2,"option",23,A),pl(),VI(),pl(),Jw(42,Se,8,0,"div",8),ws(43,"div",8)(44,"label",24),GC(45," Time (UTC) "),ws(46,"span",10),GC(47,"*"),pl()(),ws(48,"div",25),Sg(49,"input",26),VI(),ws(50,"span",27),GC(51,"UTC"),pl()(),Jw(52,Ee,2,0,"span",12),pl()(),ws(53,"fieldset",19)(54,"legend",20),GC(55,"Planning"),pl(),ws(56,"div",8)(57,"label",28),GC(58," Start date "),ws(59,"span",10),GC(60,"*"),pl()(),Sg(61,"input",29),VI(),Jw(62,Pe,2,0,"span",12),pl(),ws(63,"div",8)(64,"label",30),GC(65," Ends "),ws(66,"span",10),GC(67,"*"),pl()(),ws(68,"select",31),rC(69,Me,2,2,"option",23,A),pl(),VI(),pl(),Jw(71,De,7,4,"div",8),Jw(72,we,7,4,"div",8),pl(),ws(73,"div",8)(74,"label",32),Sg(75,"input",33),VI(),ws(76,"span",34),GC(77,"Enabled"),pl()(),ws(78,"p",35),GC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),pl()(),ws(80,"div",8)(81,"label",36),GC(82,"External Metadata"),pl(),Sg(83,"textarea",37),VI(),Jw(84,ke,2,0,"span",12),ws(85,"span",13),GC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),pl()(),Jw(87,Ne,2,1,"p",38),ws(88,"div",39)(89,"button",40),GC(90),pl(),ws(91,"button",41),Rg("click",function(){If(e);let g=gC();return wf(g.cancel())}),GC(92,"Cancel"),pl()()();}if(n&2){let e=gC();bg("formGroup",e.form),XE(6),Ug("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),bg("formControl",e.nameControl),UI(),XE(),eC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),bg("formControl",e.descriptionControl),UI(),XE(6),eC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Ug("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),bg("formControl",e.promptContentControl),UI(),XE(),eC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),bg("formControl",e.unitControl),UI(),XE(),oC(e.schedulerUnits),XE(2),eC(e.showDayFilter()?42:-1),XE(7),bg("formControl",e.timeUtcControl),UI(),XE(3),eC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Ug("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),bg("formControl",e.startDateControl),UI(),XE(),eC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),bg("formControl",e.endTypeControl),UI(),XE(),oC(e.endTypes),XE(2),eC(e.showEndDate()?71:-1),XE(),eC(e.showOccurrenceCount()?72:-1),XE(3),bg("formControl",e.enabledControl),UI(),XE(8),bg("formControl",e.externalMetadataJsonControl),UI(),XE(),eC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),XE(3),eC(e.errorMessage()?87:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(W);router=g(F);destroyRef=g(Ce$1);state=g(c);agentConfigController=g($);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(Ie$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(Oe$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,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=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);errorMessage=Gi(null);SchedulerUnit=Ie$1;SchedulerEndType=Oe$1;schedulerUnits=[{value:Ie$1.WEEK,label:"Week(s)"},{value:Ie$1.MONTH,label:"Month(s)"}];endTypes=[{value:Oe$1.NEVER,label:"Never"},{value:Oe$1.ON_DATE,label:"On date"},{value:Oe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Ve$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(wd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(wd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Ie$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===Oe$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===Oe$1.OCCURRENCES);agentConfigs=Gi([]);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(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ya(()=>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,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}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,d=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===Oe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Oe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.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=xw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return d.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),pl()),e&2&&(XE(5),vl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),vl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),eC(d.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Oe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Oe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(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"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
|
|
1
|
+
import {c}from'./chunk-C14qfY5v.js';import {g,ao as W,F,C as Ce$1,da as $,db as Oe$1,dc as Ie$1,G as Gi,dd as Ve$1,a as F$1,bR as wd,m as mT,M as By,b as U,a7 as ya,Q as br,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a5 as vl,v as eC,a9 as lC,S as Sg,a3 as VI,s as rC,ac as gC,u as bg,z as Ug,a6 as UI,y as oC,a8 as Yg,aa as If,ab as wf,bk as yh}from'./main-HJHU5XWA.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-D5PhFOjy.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ue(n,t){n&1&&(ws(0,"span",12),GC(1," Name is required. "),pl());}function fe(n,t){if(n&1&&(ws(0,"p",42),GC(1),pl(),ws(2,"span",13),GC(3,"Agent Config cannot be changed after creation."),pl()),n&2){let e=gC(2);XE(),Yg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(ws(0,"a",43),GC(1,"Add an agent config"),pl(),GC(2," first. ")),n&2){let e=gC(3);bg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(ws(0,"p",13),GC(1," No agent configs available in this scope yet. "),Jw(2,_e,3,1),pl()),n&2){let e=gC(2);XE(2),eC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.id),XE(),Yg(e.name);}}function Ce(n,t){n&1&&(ws(0,"span",12),GC(1,"Agent Config is required."),pl());}function ve(n,t){if(n&1&&(ws(0,"select",44)(1,"option",45),GC(2,"Select an agent config\u2026"),pl(),rC(3,ge,2,2,"option",23,me),pl(),VI(),Jw(5,Ce,2,0,"span",12),ws(6,"span",13),GC(7,"Immutable after creation."),pl()),n&2){let e=gC(2);bg("formControl",e.agentConfigIdControl),UI(),XE(3),oC(e.availableAgentConfigs()),XE(2),eC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(ws(0,"span",12),GC(1,"Opening message is required."),pl());}function ye(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function be(n,t){if(n&1){let e=lC();ws(0,"label",48)(1,"input",49),Rg("change",function(){let g=If(e).$implicit,v=gC(3);return wf(v.toggleDay(g.value))}),pl(),ws(2,"span",50),GC(3),pl()();}if(n&2){let e=t.$implicit,d=gC(3);XE(),bg("checked",d.isDaySelected(e.value)),XE(2),Yg(e.label);}}function Se(n,t){if(n&1&&(ws(0,"div",8)(1,"span",46),GC(2,"Days of week"),pl(),ws(3,"div",47),rC(4,be,4,2,"label",48,A),pl(),ws(6,"span",13),GC(7,"Leave empty to run every day of the week."),pl()()),n&2){let e=gC(2);XE(4),oC(e.dayOptions);}}function Ee(n,t){n&1&&(ws(0,"span",12),GC(1,"Valid time is required (HH:mm)."),pl());}function Pe(n,t){n&1&&(ws(0,"span",12),GC(1,"Start date is required."),pl());}function Me(n,t){if(n&1&&(ws(0,"option",23),GC(1),pl()),n&2){let e=t.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function Oe(n,t){n&1&&(ws(0,"span",12),GC(1,"End date is required."),pl());}function De(n,t){if(n&1&&(ws(0,"div",8)(1,"label",51),GC(2," End date "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",52),VI(),Jw(6,Oe,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),bg("formControl",e.endDateControl),UI(),XE(),eC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(ws(0,"span",12),GC(1,"Must be at least 1."),pl());}function we(n,t){if(n&1&&(ws(0,"div",8)(1,"label",53),GC(2," Number of occurrences "),ws(3,"span",10),GC(4,"*"),pl()(),Sg(5,"input",54),VI(),Jw(6,Te,2,0,"span",12),pl()),n&2){let e=gC(2);XE(5),Ug("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),bg("formControl",e.occurrenceCountControl),UI(),XE(),eC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(ws(0,"span",12),GC(1,"Invalid JSON."),pl());}function Ne(n,t){if(n&1&&(ws(0,"p",38),GC(1),pl()),n&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let g=gC();return wf(g.submit())}),ws(1,"div",8)(2,"label",9),GC(3," Name "),ws(4,"span",10),GC(5,"*"),pl()(),Sg(6,"input",11),VI(),Jw(7,ue,2,0,"span",12),ws(8,"span",13),GC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),pl()(),ws(10,"div",8)(11,"label",14),GC(12,"Description"),pl(),Sg(13,"input",15),VI(),pl(),ws(14,"div",8)(15,"label",16),GC(16," Agent Config "),ws(17,"span",10),GC(18,"*"),pl()(),Jw(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),pl(),ws(22,"div",8)(23,"label",17),GC(24," Opening message "),ws(25,"span",10),GC(26,"*"),pl()(),Sg(27,"textarea",18),VI(),Jw(28,xe,2,0,"span",12),ws(29,"span",13),GC(30," The message sent to the agent when the scheduled prompt fires. "),pl()(),ws(31,"fieldset",19)(32,"legend",20),GC(33,"Recurrence"),pl(),ws(34,"div",8)(35,"label",21),GC(36," Unit "),ws(37,"span",10),GC(38,"*"),pl()(),ws(39,"select",22),rC(40,ye,2,2,"option",23,A),pl(),VI(),pl(),Jw(42,Se,8,0,"div",8),ws(43,"div",8)(44,"label",24),GC(45," Time (UTC) "),ws(46,"span",10),GC(47,"*"),pl()(),ws(48,"div",25),Sg(49,"input",26),VI(),ws(50,"span",27),GC(51,"UTC"),pl()(),Jw(52,Ee,2,0,"span",12),pl()(),ws(53,"fieldset",19)(54,"legend",20),GC(55,"Planning"),pl(),ws(56,"div",8)(57,"label",28),GC(58," Start date "),ws(59,"span",10),GC(60,"*"),pl()(),Sg(61,"input",29),VI(),Jw(62,Pe,2,0,"span",12),pl(),ws(63,"div",8)(64,"label",30),GC(65," Ends "),ws(66,"span",10),GC(67,"*"),pl()(),ws(68,"select",31),rC(69,Me,2,2,"option",23,A),pl(),VI(),pl(),Jw(71,De,7,4,"div",8),Jw(72,we,7,4,"div",8),pl(),ws(73,"div",8)(74,"label",32),Sg(75,"input",33),VI(),ws(76,"span",34),GC(77,"Enabled"),pl()(),ws(78,"p",35),GC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),pl()(),ws(80,"div",8)(81,"label",36),GC(82,"External Metadata"),pl(),Sg(83,"textarea",37),VI(),Jw(84,ke,2,0,"span",12),ws(85,"span",13),GC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),pl()(),Jw(87,Ne,2,1,"p",38),ws(88,"div",39)(89,"button",40),GC(90),pl(),ws(91,"button",41),Rg("click",function(){If(e);let g=gC();return wf(g.cancel())}),GC(92,"Cancel"),pl()()();}if(n&2){let e=gC();bg("formGroup",e.form),XE(6),Ug("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),bg("formControl",e.nameControl),UI(),XE(),eC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),bg("formControl",e.descriptionControl),UI(),XE(6),eC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Ug("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),bg("formControl",e.promptContentControl),UI(),XE(),eC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),bg("formControl",e.unitControl),UI(),XE(),oC(e.schedulerUnits),XE(2),eC(e.showDayFilter()?42:-1),XE(7),bg("formControl",e.timeUtcControl),UI(),XE(3),eC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Ug("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),bg("formControl",e.startDateControl),UI(),XE(),eC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),bg("formControl",e.endTypeControl),UI(),XE(),oC(e.endTypes),XE(2),eC(e.showEndDate()?71:-1),XE(),eC(e.showOccurrenceCount()?72:-1),XE(3),bg("formControl",e.enabledControl),UI(),XE(8),bg("formControl",e.externalMetadataJsonControl),UI(),XE(),eC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),XE(3),eC(e.errorMessage()?87:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(W);router=g(F);destroyRef=g(Ce$1);state=g(c);agentConfigController=g($);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(Ie$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(Oe$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,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=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);errorMessage=Gi(null);SchedulerUnit=Ie$1;SchedulerEndType=Oe$1;schedulerUnits=[{value:Ie$1.WEEK,label:"Week(s)"},{value:Ie$1.MONTH,label:"Month(s)"}];endTypes=[{value:Oe$1.NEVER,label:"Never"},{value:Oe$1.ON_DATE,label:"On date"},{value:Oe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Ve$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(wd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(wd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===Ie$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===Oe$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===Oe$1.OCCURRENCES);agentConfigs=Gi([]);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(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ya(()=>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,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}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,d=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===Oe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Oe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.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=xw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return d.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),pl()),e&2&&(XE(5),vl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),vl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),eC(d.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Oe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Oe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(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"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f}from'./chunk-zoENz5pL.js';import {g,bm as Mm,R as Re,G as Gi,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,n as GC,o as pl,J as Jw,af as Eg,ag as fT,t as CC,X as XE,u as bg,v as eC,D as py,P,aF as R,W as x,Y as z,Z as Ue,_ as zt,a0 as jt,a1 as Vt,a2 as Nt,i as pr,bn as Xt,ai as tm,aj as KC,a3 as VI,s as rC,bo as tC,a8 as Yg,ak as em,a6 as UI,y as oC,a5 as vl,ac as gC,a9 as lC,aa as If,ab as wf,bp as ml,bq as yl,ah as rT,b4 as oT,z as Ug,b0 as Qg,a4 as nC,T as Tg,S as Sg}from'./main-ZIS64A7B.js';import {P as Pt}from'./chunk-DLAfy6Py.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-yS_3qnfr.js';import {$ as $n,o as ot$1,i as it$1,I as In,E as Ee,z as ze$1,a as Sa,D as Dn}from'./chunk-CwWxGIXx.js';import'./chunk-B0ReGfih.js';import {y as yt,w as wt,t as ti,Q as Qn,e as ei,Y as Ye$1,f as fn,m as mn,Z as Zn,g as gt,$ as $t,W as Wt,c as cn}from'./chunk-CWmsDCbt.js';var w=class s{http=g(py);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new R(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n);},a.onerror=()=>n.error(a.error),a.readAsDataURL(e);})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};function ze(s,t){s&1&&(ws(0,"p",15),GC(1,"No integrations defined \u2014 agent will have access to all tools."),pl());}function qe(s,t){if(s&1){let e=lC();ws(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),GC(3,"Integration"),pl(),ws(4,"input",23),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.integration,a)||(r.integration=a),wf(a)}),pl(),VI(),pl(),ws(5,"mat-form-field",24)(6,"mat-label"),GC(7,"Tools (comma-separated)"),pl(),ws(8,"input",25),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.tools,a)||(r.tools=a),wf(a)}),pl(),VI(),pl(),ws(9,"button",26),Rg("click",function(){let a=If(e).$index,r=gC();return wf(r.removeIntegrationRow(a))}),ws(10,"mat-icon"),GC(11,"delete"),pl()()();}if(s&2){let e=t.$implicit;XE(4),em("ngModel",e.integration),UI(),XE(4),em("ngModel",e.tools),UI();}}function He(s,t){if(s&1&&(ws(0,"p",30),GC(1),pl()),s&2){let e=gC(2);XE(),Yg(e.docUploadError);}}function Ge(s,t){s&1&&(ws(0,"p",15),GC(1,"No mandatory documents defined."),pl());}function Ze(s,t){if(s&1&&Sg(0,"option",35),s&2){let e=t.$implicit;bg("value","documents/"+e);}}function Ke(s,t){if(s&1){let e=lC();ws(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),GC(3,"Document path"),pl(),ws(4,"input",33),tm("ngModelChange",function(a){let r=If(e).$index,j=gC(2);return KC(j.mandatoryDocs[r],a)||(j.mandatoryDocs[r]=a),wf(a)}),pl(),VI(),ws(5,"datalist",34),rC(6,Ze,1,1,"option",35,nC),pl()(),ws(8,"button",26),Rg("click",function(){let a=If(e).$index,r=gC(2);return wf(r.removeDocRow(a))}),ws(9,"mat-icon"),GC(10,"delete"),pl()()();}if(s&2){let e=t.$index,n=gC(2);XE(4),em("ngModel",n.mandatoryDocs[e]),Tg("list","docs-list-"+e),UI(),XE(),bg("id","docs-list-"+e),XE(),oC(n.availableDocuments);}}function Je(s,t){if(s&1){let e=lC();ws(0,"div",6)(1,"span"),GC(2,"Mandatory Documents"),pl(),ws(3,"button",27),Rg("click",function(){If(e);let a=gC();return wf(a.addDocRow())}),ws(4,"mat-icon"),GC(5,"add"),pl()(),ws(6,"label",28)(7,"mat-icon"),GC(8,"upload_file"),pl(),ws(9,"input",29),Rg("change",function(a){If(e);let r=gC();return wf(r.onDocFileSelected(a))}),pl()()(),Jw(10,He,2,1,"p",30),Jw(11,Ge,2,0,"p",15),rC(12,Ke,11,3,"div",31,tC);}if(s&2){let e=gC();XE(6),Ug("uploading",e.isUploadingDoc),XE(3),bg("disabled",e.isUploadingDoc),XE(),eC(e.docUploadError?10:-1),XE(),eC(e.mandatoryDocs.length===0?11:-1),XE(),oC(e.mandatoryDocs);}}function Qe(s,t){s&1&&(ws(0,"p",15),GC(1,"\u{1F4A1} Documents can be added after the agent is created."),pl());}function Xe(s,t){if(s&1){let e=lC();ws(0,"div",6),GC(1,"Save to"),pl(),ws(2,"div",36)(3,"label",37)(4,"input",38),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(5,"div",39)(6,"div",40)(7,"span",41),GC(8,"\u{1F464}"),pl(),ws(9,"span",42),GC(10,"Project config"),pl()(),ws(11,"p",43),GC(12),pl()()(),ws(13,"label",37)(14,"input",44),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(15,"div",39)(16,"div",40)(17,"span",41),GC(18,"\u{1F4E6}"),pl(),ws(19,"span",42),GC(20,"Colocated"),pl()(),ws(21,"p",43),GC(22,"Next to coday.yaml in ./agents/ (committable)"),pl()()()(),ws(23,"p",15),GC(24,"Storage location is permanent and cannot be changed after creation."),pl();}if(s&2){let e=gC();XE(3),Ug("selected",e.location==="project"),XE(),em("ngModel",e.location),UI(),XE(8),Qg("~/.coday/projects/","{","name","}","/agents/ (not committed)"),XE(),Ug("selected",e.location==="colocated"),XE(),em("ngModel",e.location),UI();}}function Ye(s,t){if(s&1&&(ws(0,"div",17)(1,"span",6),GC(2,"Storage Location"),pl(),ws(3,"span",45),GC(4),pl(),ws(5,"p",15),GC(6,"Cannot be changed after creation."),pl()()),s&2){let e=gC();XE(3),Ug("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),XE(),vl(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ");}}function $e(s,t){if(s&1&&(ws(0,"div",18)(1,"mat-icon"),GC(2,"error"),pl(),ws(3,"span"),GC(4),pl()()),s&2){let e=gC();XE(4),Yg(e.errorMessage);}}var E=class s{agentCrudApi=g(w);agentApi=g(f);dialogRef=g(z);data=g(Ue);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=false;docUploadError="";location="project";isSaving=false;errorMessage="";isEditMode=false;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments();}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]});}addDocRow(){this.mandatoryDocs.push("");}removeDocRow(t){this.mandatoryDocs.splice(t,1);}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=true,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=false,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value="";},error:a=>{this.isUploadingDoc=false,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value="";}}));}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""});}removeIntegrationRow(t){this.integrationRows.splice(t,1);}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",false;if(!this.description.trim())return this.errorMessage="Description is required",false;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",false;return true}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return {name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=true,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=false,this.agentApi.clearAllCache(),this.dialogRef.close(true);},error:n=>{this.isSaving=false,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent";}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(ws(0,"h2",0),GC(1),pl(),ws(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),GC(6,"Name"),pl(),ws(7,"input",3),tm("ngModelChange",function(r){return KC(n.name,r)||(n.name=r),r}),pl(),VI(),ws(8,"mat-hint"),GC(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),pl()(),ws(10,"mat-form-field",2)(11,"mat-label"),GC(12,"Description"),pl(),ws(13,"textarea",4),tm("ngModelChange",function(r){return KC(n.description,r)||(n.description=r),r}),pl(),VI(),pl(),ws(14,"mat-form-field",2)(15,"mat-label"),GC(16,"Instructions"),pl(),ws(17,"textarea",5),tm("ngModelChange",function(r){return KC(n.instructions,r)||(n.instructions=r),r}),pl(),VI(),ws(18,"mat-hint"),GC(19,"System prompt / instructions sent to the AI model"),pl()(),ws(20,"div",6),GC(21,"AI Configuration"),pl(),ws(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),GC(25,"AI Provider"),pl(),ws(26,"input",9),tm("ngModelChange",function(r){return KC(n.aiProvider,r)||(n.aiProvider=r),r}),pl(),VI(),pl(),ws(27,"mat-form-field",8)(28,"mat-label"),GC(29,"Model Name"),pl(),ws(30,"input",10),tm("ngModelChange",function(r){return KC(n.modelName,r)||(n.modelName=r),r}),pl(),VI(),pl()(),ws(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),GC(34,"Temperature"),pl(),ws(35,"input",11),tm("ngModelChange",function(r){return KC(n.temperature,r)||(n.temperature=r),r}),pl(),VI(),ws(36,"mat-hint"),GC(37,"Leave empty for model default"),pl()(),ws(38,"mat-form-field",8)(39,"mat-label"),GC(40,"Max Output Tokens"),pl(),ws(41,"input",12),tm("ngModelChange",function(r){return KC(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),pl(),VI(),ws(42,"mat-hint"),GC(43,"Leave empty for model default"),pl()()(),ws(44,"mat-form-field",2)(45,"mat-label"),GC(46,"OpenAI Assistant ID"),pl(),ws(47,"input",13),tm("ngModelChange",function(r){return KC(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),pl(),VI(),ws(48,"mat-hint"),GC(49,"If set, forces aiProvider to openai"),pl()(),ws(50,"div",6)(51,"span"),GC(52,"Integrations"),pl(),ws(53,"button",14),Rg("click",function(){return n.addIntegrationRow()}),ws(54,"mat-icon"),GC(55,"add"),pl()()(),Jw(56,ze,2,0,"p",15),rC(57,qe,12,2,"div",16,tC),Jw(59,Je,14,5)(60,Qe,2,0,"p",15),Jw(61,Xe,25,8),Jw(62,Ye,7,5,"div",17),Jw(63,$e,5,1,"div",18),pl()(),ws(64,"mat-dialog-actions",19)(65,"button",20),Rg("click",function(){return n.cancel()}),GC(66,"Cancel"),pl(),ws(67,"button",21),Rg("click",function(){return n.save()}),GC(68),pl()()),e&2&&(XE(),Yg(n.isEditMode?"Edit Agent":"Create Agent"),XE(6),em("ngModel",n.name),bg("readonly",n.isEditMode),UI(),XE(6),em("ngModel",n.description),UI(),XE(4),em("ngModel",n.instructions),UI(),XE(9),em("ngModel",n.aiProvider),UI(),XE(4),em("ngModel",n.modelName),UI(),XE(5),em("ngModel",n.temperature),UI(),XE(6),em("ngModel",n.maxOutputTokens),UI(),XE(6),em("ngModel",n.openaiAssistantId),UI(),XE(9),eC(n.integrationRows.length===0?56:-1),XE(),oC(n.integrationRows),XE(2),eC(n.isEditMode?59:60),XE(2),eC(n.isEditMode?-1:61),XE(),eC(n.isEditMode?62:-1),XE(),eC(n.errorMessage?63:-1),XE(2),bg("disabled",n.isSaving),XE(2),bg("disabled",n.isSaving),XE(),vl(" ",n.isSaving?"Saving...":"Save"," "));},dependencies:[ti,Qn,ei,Ye$1,fn,mn,Zn,gt,$t,Wt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Pt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}"],changeDetection:1})};var et=()=>[],tt=s=>({id:s});function nt(s,t){if(s&1&&(ws(0,"div",5),GC(1),pl()),s&2){let e=gC();XE(),Yg(e.errorMessage());}}function it(s,t){if(s&1){let e=lC();ws(0,"ds-entity-card",7),Rg("selected",function(a){If(e);let r=gC();return wf(r.onEdit(a))}),ml(1,8),ws(2,"button",9),Rg("click",function(a){return a.stopPropagation()}),ws(3,"mat-icon"),GC(4,"more_vert"),pl()(),yl(),pl();}if(s&2){let e=t.$implicit;gC();let n=CC(9);bg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??rT(6,et)),XE(2),bg("matMenuTriggerFor",n)("matMenuTriggerData",oT(7,tt,e.id));}}function ot(s,t){if(s&1){let e=lC();ws(0,"button",10),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onEdit(a))}),ws(1,"mat-icon"),GC(2,"edit"),pl(),GC(3," Edit "),pl(),ws(4,"button",11),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onDelete(a))}),ws(5,"mat-icon"),GC(6,"delete"),pl(),GC(7," Delete "),pl();}}var Ve=class s{agentCrudApi=g(w);location=g(Mm);dialog=g(Re);agents=Gi([]);isLoading=Gi(false);errorMessage=Gi(null);agentItems=mT(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents();}loadAgents(){this.isLoading.set(true),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(false);},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents();});}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")});}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")});}buildBadges(t){return [t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-list"]],decls:11,vars:5,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(ws(0,"div",2)(1,"ds-entity-list",3),Rg("createRequested",function(){return n.onCreate()}),ws(2,"button",4),Rg("click",function(){return n.onBack()}),ws(3,"mat-icon"),GC(4,"chevron_left"),pl()()(),Jw(5,nt,2,1,"div",5),pl(),Eg(6,it,5,9,"ng-template",null,0,fT),ws(8,"mat-menu",null,1),Eg(10,ot,8,0,"ng-template",6),pl()),e&2){let a=CC(7);XE(),bg("items",n.agentItems())("loading",n.isLoading())("showCreate",true)("itemTemplate",a),XE(4),eC(n.errorMessage()?5:-1);}},dependencies:[$n,ot$1,it$1,hr,Gn,yt,wt,In,Ee,ze$1,Sa,Dn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ve as AgentListComponent};
|
|
1
|
+
import {f}from'./chunk-C9lPh04t.js';import {g,bm as Mm,R as Re,G as Gi,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,n as GC,o as pl,J as Jw,af as Eg,ag as fT,t as CC,X as XE,u as bg,v as eC,D as py,P,aF as R,W as x,Y as z,Z as Ue,_ as zt,a0 as jt,a1 as Vt,a2 as Nt,i as pr,bn as Xt,ai as tm,aj as KC,a3 as VI,s as rC,bo as tC,a8 as Yg,ak as em,a6 as UI,y as oC,a5 as vl,ac as gC,a9 as lC,aa as If,ab as wf,bp as ml,bq as yl,ah as rT,b4 as oT,z as Ug,b0 as Qg,a4 as nC,T as Tg,S as Sg}from'./main-HJHU5XWA.js';import {P as Pt}from'./chunk-BFHIAOTm.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-CInem4Y8.js';import {$ as $n,o as ot$1,i as it$1,I as In,E as Ee,z as ze$1,a as Sa,D as Dn}from'./chunk-DPdQ_sjv.js';import'./chunk-C32fe9qE.js';import {y as yt,w as wt,t as ti,Q as Qn,e as ei,Y as Ye$1,f as fn,m as mn,Z as Zn,g as gt,$ as $t,W as Wt,c as cn}from'./chunk-D5PhFOjy.js';var w=class s{http=g(py);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new R(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n);},a.onerror=()=>n.error(a.error),a.readAsDataURL(e);})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};function ze(s,t){s&1&&(ws(0,"p",15),GC(1,"No integrations defined \u2014 agent will have access to all tools."),pl());}function qe(s,t){if(s&1){let e=lC();ws(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),GC(3,"Integration"),pl(),ws(4,"input",23),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.integration,a)||(r.integration=a),wf(a)}),pl(),VI(),pl(),ws(5,"mat-form-field",24)(6,"mat-label"),GC(7,"Tools (comma-separated)"),pl(),ws(8,"input",25),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.tools,a)||(r.tools=a),wf(a)}),pl(),VI(),pl(),ws(9,"button",26),Rg("click",function(){let a=If(e).$index,r=gC();return wf(r.removeIntegrationRow(a))}),ws(10,"mat-icon"),GC(11,"delete"),pl()()();}if(s&2){let e=t.$implicit;XE(4),em("ngModel",e.integration),UI(),XE(4),em("ngModel",e.tools),UI();}}function He(s,t){if(s&1&&(ws(0,"p",30),GC(1),pl()),s&2){let e=gC(2);XE(),Yg(e.docUploadError);}}function Ge(s,t){s&1&&(ws(0,"p",15),GC(1,"No mandatory documents defined."),pl());}function Ze(s,t){if(s&1&&Sg(0,"option",35),s&2){let e=t.$implicit;bg("value","documents/"+e);}}function Ke(s,t){if(s&1){let e=lC();ws(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),GC(3,"Document path"),pl(),ws(4,"input",33),tm("ngModelChange",function(a){let r=If(e).$index,j=gC(2);return KC(j.mandatoryDocs[r],a)||(j.mandatoryDocs[r]=a),wf(a)}),pl(),VI(),ws(5,"datalist",34),rC(6,Ze,1,1,"option",35,nC),pl()(),ws(8,"button",26),Rg("click",function(){let a=If(e).$index,r=gC(2);return wf(r.removeDocRow(a))}),ws(9,"mat-icon"),GC(10,"delete"),pl()()();}if(s&2){let e=t.$index,n=gC(2);XE(4),em("ngModel",n.mandatoryDocs[e]),Tg("list","docs-list-"+e),UI(),XE(),bg("id","docs-list-"+e),XE(),oC(n.availableDocuments);}}function Je(s,t){if(s&1){let e=lC();ws(0,"div",6)(1,"span"),GC(2,"Mandatory Documents"),pl(),ws(3,"button",27),Rg("click",function(){If(e);let a=gC();return wf(a.addDocRow())}),ws(4,"mat-icon"),GC(5,"add"),pl()(),ws(6,"label",28)(7,"mat-icon"),GC(8,"upload_file"),pl(),ws(9,"input",29),Rg("change",function(a){If(e);let r=gC();return wf(r.onDocFileSelected(a))}),pl()()(),Jw(10,He,2,1,"p",30),Jw(11,Ge,2,0,"p",15),rC(12,Ke,11,3,"div",31,tC);}if(s&2){let e=gC();XE(6),Ug("uploading",e.isUploadingDoc),XE(3),bg("disabled",e.isUploadingDoc),XE(),eC(e.docUploadError?10:-1),XE(),eC(e.mandatoryDocs.length===0?11:-1),XE(),oC(e.mandatoryDocs);}}function Qe(s,t){s&1&&(ws(0,"p",15),GC(1,"\u{1F4A1} Documents can be added after the agent is created."),pl());}function Xe(s,t){if(s&1){let e=lC();ws(0,"div",6),GC(1,"Save to"),pl(),ws(2,"div",36)(3,"label",37)(4,"input",38),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(5,"div",39)(6,"div",40)(7,"span",41),GC(8,"\u{1F464}"),pl(),ws(9,"span",42),GC(10,"Project config"),pl()(),ws(11,"p",43),GC(12),pl()()(),ws(13,"label",37)(14,"input",44),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(15,"div",39)(16,"div",40)(17,"span",41),GC(18,"\u{1F4E6}"),pl(),ws(19,"span",42),GC(20,"Colocated"),pl()(),ws(21,"p",43),GC(22,"Next to coday.yaml in ./agents/ (committable)"),pl()()()(),ws(23,"p",15),GC(24,"Storage location is permanent and cannot be changed after creation."),pl();}if(s&2){let e=gC();XE(3),Ug("selected",e.location==="project"),XE(),em("ngModel",e.location),UI(),XE(8),Qg("~/.coday/projects/","{","name","}","/agents/ (not committed)"),XE(),Ug("selected",e.location==="colocated"),XE(),em("ngModel",e.location),UI();}}function Ye(s,t){if(s&1&&(ws(0,"div",17)(1,"span",6),GC(2,"Storage Location"),pl(),ws(3,"span",45),GC(4),pl(),ws(5,"p",15),GC(6,"Cannot be changed after creation."),pl()()),s&2){let e=gC();XE(3),Ug("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),XE(),vl(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ");}}function $e(s,t){if(s&1&&(ws(0,"div",18)(1,"mat-icon"),GC(2,"error"),pl(),ws(3,"span"),GC(4),pl()()),s&2){let e=gC();XE(4),Yg(e.errorMessage);}}var E=class s{agentCrudApi=g(w);agentApi=g(f);dialogRef=g(z);data=g(Ue);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=false;docUploadError="";location="project";isSaving=false;errorMessage="";isEditMode=false;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments();}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]});}addDocRow(){this.mandatoryDocs.push("");}removeDocRow(t){this.mandatoryDocs.splice(t,1);}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=true,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=false,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value="";},error:a=>{this.isUploadingDoc=false,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value="";}}));}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""});}removeIntegrationRow(t){this.integrationRows.splice(t,1);}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",false;if(!this.description.trim())return this.errorMessage="Description is required",false;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",false;return true}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return {name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=true,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=false,this.agentApi.clearAllCache(),this.dialogRef.close(true);},error:n=>{this.isSaving=false,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent";}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(ws(0,"h2",0),GC(1),pl(),ws(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),GC(6,"Name"),pl(),ws(7,"input",3),tm("ngModelChange",function(r){return KC(n.name,r)||(n.name=r),r}),pl(),VI(),ws(8,"mat-hint"),GC(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),pl()(),ws(10,"mat-form-field",2)(11,"mat-label"),GC(12,"Description"),pl(),ws(13,"textarea",4),tm("ngModelChange",function(r){return KC(n.description,r)||(n.description=r),r}),pl(),VI(),pl(),ws(14,"mat-form-field",2)(15,"mat-label"),GC(16,"Instructions"),pl(),ws(17,"textarea",5),tm("ngModelChange",function(r){return KC(n.instructions,r)||(n.instructions=r),r}),pl(),VI(),ws(18,"mat-hint"),GC(19,"System prompt / instructions sent to the AI model"),pl()(),ws(20,"div",6),GC(21,"AI Configuration"),pl(),ws(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),GC(25,"AI Provider"),pl(),ws(26,"input",9),tm("ngModelChange",function(r){return KC(n.aiProvider,r)||(n.aiProvider=r),r}),pl(),VI(),pl(),ws(27,"mat-form-field",8)(28,"mat-label"),GC(29,"Model Name"),pl(),ws(30,"input",10),tm("ngModelChange",function(r){return KC(n.modelName,r)||(n.modelName=r),r}),pl(),VI(),pl()(),ws(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),GC(34,"Temperature"),pl(),ws(35,"input",11),tm("ngModelChange",function(r){return KC(n.temperature,r)||(n.temperature=r),r}),pl(),VI(),ws(36,"mat-hint"),GC(37,"Leave empty for model default"),pl()(),ws(38,"mat-form-field",8)(39,"mat-label"),GC(40,"Max Output Tokens"),pl(),ws(41,"input",12),tm("ngModelChange",function(r){return KC(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),pl(),VI(),ws(42,"mat-hint"),GC(43,"Leave empty for model default"),pl()()(),ws(44,"mat-form-field",2)(45,"mat-label"),GC(46,"OpenAI Assistant ID"),pl(),ws(47,"input",13),tm("ngModelChange",function(r){return KC(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),pl(),VI(),ws(48,"mat-hint"),GC(49,"If set, forces aiProvider to openai"),pl()(),ws(50,"div",6)(51,"span"),GC(52,"Integrations"),pl(),ws(53,"button",14),Rg("click",function(){return n.addIntegrationRow()}),ws(54,"mat-icon"),GC(55,"add"),pl()()(),Jw(56,ze,2,0,"p",15),rC(57,qe,12,2,"div",16,tC),Jw(59,Je,14,5)(60,Qe,2,0,"p",15),Jw(61,Xe,25,8),Jw(62,Ye,7,5,"div",17),Jw(63,$e,5,1,"div",18),pl()(),ws(64,"mat-dialog-actions",19)(65,"button",20),Rg("click",function(){return n.cancel()}),GC(66,"Cancel"),pl(),ws(67,"button",21),Rg("click",function(){return n.save()}),GC(68),pl()()),e&2&&(XE(),Yg(n.isEditMode?"Edit Agent":"Create Agent"),XE(6),em("ngModel",n.name),bg("readonly",n.isEditMode),UI(),XE(6),em("ngModel",n.description),UI(),XE(4),em("ngModel",n.instructions),UI(),XE(9),em("ngModel",n.aiProvider),UI(),XE(4),em("ngModel",n.modelName),UI(),XE(5),em("ngModel",n.temperature),UI(),XE(6),em("ngModel",n.maxOutputTokens),UI(),XE(6),em("ngModel",n.openaiAssistantId),UI(),XE(9),eC(n.integrationRows.length===0?56:-1),XE(),oC(n.integrationRows),XE(2),eC(n.isEditMode?59:60),XE(2),eC(n.isEditMode?-1:61),XE(),eC(n.isEditMode?62:-1),XE(),eC(n.errorMessage?63:-1),XE(2),bg("disabled",n.isSaving),XE(2),bg("disabled",n.isSaving),XE(),vl(" ",n.isSaving?"Saving...":"Save"," "));},dependencies:[ti,Qn,ei,Ye$1,fn,mn,Zn,gt,$t,Wt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Pt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}"],changeDetection:1})};var et=()=>[],tt=s=>({id:s});function nt(s,t){if(s&1&&(ws(0,"div",5),GC(1),pl()),s&2){let e=gC();XE(),Yg(e.errorMessage());}}function it(s,t){if(s&1){let e=lC();ws(0,"ds-entity-card",7),Rg("selected",function(a){If(e);let r=gC();return wf(r.onEdit(a))}),ml(1,8),ws(2,"button",9),Rg("click",function(a){return a.stopPropagation()}),ws(3,"mat-icon"),GC(4,"more_vert"),pl()(),yl(),pl();}if(s&2){let e=t.$implicit;gC();let n=CC(9);bg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??rT(6,et)),XE(2),bg("matMenuTriggerFor",n)("matMenuTriggerData",oT(7,tt,e.id));}}function ot(s,t){if(s&1){let e=lC();ws(0,"button",10),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onEdit(a))}),ws(1,"mat-icon"),GC(2,"edit"),pl(),GC(3," Edit "),pl(),ws(4,"button",11),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onDelete(a))}),ws(5,"mat-icon"),GC(6,"delete"),pl(),GC(7," Delete "),pl();}}var Ve=class s{agentCrudApi=g(w);location=g(Mm);dialog=g(Re);agents=Gi([]);isLoading=Gi(false);errorMessage=Gi(null);agentItems=mT(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents();}loadAgents(){this.isLoading.set(true),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(false);},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents();});}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")});}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")});}buildBadges(t){return [t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-list"]],decls:11,vars:5,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(ws(0,"div",2)(1,"ds-entity-list",3),Rg("createRequested",function(){return n.onCreate()}),ws(2,"button",4),Rg("click",function(){return n.onBack()}),ws(3,"mat-icon"),GC(4,"chevron_left"),pl()()(),Jw(5,nt,2,1,"div",5),pl(),Eg(6,it,5,9,"ng-template",null,0,fT),ws(8,"mat-menu",null,1),Eg(10,ot,8,0,"ng-template",6),pl()),e&2){let a=CC(7);XE(),bg("items",n.agentItems())("loading",n.isLoading())("showCreate",true)("itemTemplate",a),XE(4),eC(n.errorMessage()?5:-1);}},dependencies:[$n,ot$1,it$1,hr,Gn,yt,wt,In,Ee,ze$1,Sa,Dn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ve as AgentListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CcdN6Tiq.js';import {s,d}from'./chunk-BmMgSm-g.js';import {g,ao as W$1,F,C as Ce,G as Gi,m as mT,b as U,M as By,a7 as ya,Q as br,e as xw,$ as $t,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,ac as gC,u as bg,a9 as lC,a8 as Yg,z as Ug,a5 as vl,T as Tg,s as rC,y as oC,S as Sg,bf as aT,bg as uT,a4 as nC,aa as If,ab as wf,bj as aE}from'./main-ZIS64A7B.js';import'./chunk-DeRTJ-9X.js';import'./chunk-CwWxGIXx.js';import'./chunk-B0ReGfih.js';import'./chunk-CWmsDCbt.js';var J=(e,n)=>n.name+n.grant;function K(e,n){if(e&1&&(ws(0,"a",5),GC(1,"Edit skill \u2192"),pl()),e&2){let i=gC();bg("routerLink",i.editRoute());}}function q(e,n){e&1&&(ws(0,"span",6),GC(1,"Platform level"),pl());}function Q(e,n){e&1&&(ws(0,"p",7),GC(1,"Loading\u2026"),pl());}function W(e,n){e&1&&(ws(0,"p",8),GC(1,"Failed to load skill."),pl());}function X(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Created by"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.createdBy);}}function Y(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Last updated"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.updatedOn);}}function Z(e,n){if(e&1&&(Jw(0,X,4,1),Jw(1,Y,4,1)),e&2){let i=gC();eC(i.createdBy?0:-1),XE(),eC(i.updatedOn?1:-1);}}function ee(e,n){if(e&1&&(ws(0,"span",17),GC(1),pl()),e&2){let i=gC(2);XE(),vl("(",i.consumers().length,")");}}function te(e,n){e&1&&(ws(0,"p",18),GC(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),pl());}function ne(e,n){e&1&&(ws(0,"p",18),GC(1,"Loading\u2026"),pl());}function ie(e,n){e&1&&(ws(0,"p",8),GC(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),pl());}function oe(e,n){e&1&&(ws(0,"p",18),GC(1,"No agent references this skill."),pl());}function le(e,n){e&1&&(ws(0,"span",16),GC(1,"platform agent"),pl());}function ae(e,n){e&1&&(ws(0,"span",16),GC(1,"via *"),pl());}function re(e,n){if(e&1&&(ws(0,"li",24)(1,"span",26),GC(2),pl(),Jw(3,le,2,0,"span",16),Jw(4,ae,2,0,"span",16),pl()),e&2){let i=n.$implicit;XE(2),Yg(i.name),XE(),eC(i.platform?3:-1),XE(),eC(i.grant==="all"?4:-1);}}function se(e,n){if(e&1&&(ws(0,"ul",23),rC(1,re,5,3,"li",24,J),pl(),ws(3,"p",25),GC(4," An agent listed "),ws(5,"code"),GC(6,"via *"),pl(),GC(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),pl()),e&2){let i=gC(2);XE(),oC(i.consumers());}}function ce(e,n){if(e&1&&(Sg(0,"div",21),aT(1,"agentosMarkdown")),e&2){let i=gC();bg("innerHTML",uT(1,1,i.body),aE);}}function de(e,n){e&1&&(ws(0,"p",18),GC(1,"No resources bundled with this skill."),pl());}function pe(e,n){if(e&1&&(ws(0,"pre",30),GC(1),pl()),e&2){let i=gC().$implicit,a=gC(3);XE(),Yg(a.resourceContent(i));}}function me(e,n){if(e&1){let i=lC();ws(0,"li",27)(1,"button",28),Rg("click",function(){let s=If(i).$implicit,g=gC(3);return wf(g.toggleResource(s))}),ws(2,"span",29),GC(3),pl(),ws(4,"span",20),GC(5,"\u25BC"),pl()(),Jw(6,pe,2,1,"pre",30),pl();}if(e&2){let i=n.$implicit,a=gC(3);XE(),Tg("aria-expanded",a.isResourceExpanded(i)),XE(2),Yg(i),XE(),Ug("skill-inspect__chevron--open",a.isResourceExpanded(i)),XE(2),eC(a.isResourceExpanded(i)?6:-1);}}function _e(e,n){if(e&1&&(ws(0,"ul",22),rC(1,me,7,5,"li",27,nC),pl()),e&2){let i=gC(2);XE(),oC(i.resourcePaths());}}function ge(e,n){if(e&1){let i=lC();ws(0,"div",9)(1,"section",10)(2,"h2",11),GC(3,"General"),pl(),ws(4,"dl",12)(5,"dt",13),GC(6,"Name"),pl(),ws(7,"dd",14),GC(8),pl(),ws(9,"dt",13),GC(10,"Description"),pl(),ws(11,"dd",15),GC(12),pl(),ws(13,"dt",13),GC(14,"Scope"),pl(),ws(15,"dd",15),GC(16),pl(),ws(17,"dt",13),GC(18,"Storage"),pl(),ws(19,"dd",15)(20,"span",16),GC(21),pl()(),Jw(22,Z,2,2),pl()(),ws(23,"section",10)(24,"h2",11),GC(25," Used by "),Jw(26,ee,2,1,"span",17),pl(),Jw(27,te,2,0,"p",18)(28,ne,2,0,"p",18)(29,ie,2,0,"p",8)(30,oe,2,0,"p",18)(31,se,8,0),pl(),ws(32,"section",10)(33,"button",19),Rg("click",function(){If(i);let s=gC();return wf(s.toggleBody())}),ws(34,"h2",11),GC(35,"Body"),pl(),ws(36,"span",20),GC(37,"\u25BC"),pl()(),Jw(38,ce,2,3,"div",21),pl(),ws(39,"section",10)(40,"h2",11),GC(41," Resources "),ws(42,"span",17),GC(43),pl()(),Jw(44,de,2,0,"p",18)(45,_e,3,0,"ul",22),pl()();}if(e&2){let i=n,a=gC();XE(8),Yg(i.name),XE(4),Yg(i.description),XE(4),Yg(i.namespaceId?"Namespace":"Platform"),XE(4),Ug("skill-inspect__badge--readonly",a.isFilesystemBacked()),XE(),vl(" ",a.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),XE(),eC(a.isFilesystemBacked()?-1:22),XE(4),eC(!a.isPlatformMode&&!a.consumersLoading()&&!a.consumersUnavailable()?26:-1),XE(),eC(a.isPlatformMode?27:a.consumersLoading()?28:a.consumersUnavailable()?29:a.consumers().length===0?30:31),XE(6),Tg("aria-expanded",!a.bodyCollapsed()),XE(3),Ug("skill-inspect__chevron--open",!a.bodyCollapsed()),XE(2),eC(a.bodyCollapsed()?-1:38),XE(5),vl("(",a.resourcePaths().length,")"),XE(),eC(a.resourcePaths().length===0?44:45);}}var G=class e{route=g(W$1);router=g(F);destroyRef=g(Ce);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=Gi(true);hasError=Gi(false);skill=Gi(null);bodyCollapsed=Gi(false);expandedResources=Gi(new Set);resourcePaths=mT(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=mT(()=>this.skill()?.readOnly===true);consumers=Gi([]);consumersUnavailable=Gi(false);consumersLoading=Gi(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:n=>{this.skill.set(n),this.isLoading.set(false),this.loadConsumers(n.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(n){this.namespaceId&&(this.consumersLoading.set(true),By({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ya(()=>br([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:i,platform:a})=>{let s=[...this.toConsumers(i,n,false),...this.toConsumers(a,n,true)];this.consumers.set([...s.filter(g=>g.grant==="named"),...s.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(n,i,a$1){return n.map(s=>({config:s,grant:a(s.skillSelectors,i)})).filter(s=>s.grant!=="none").map(({config:s,grant:g})=>({name:s.name,grant:g,platform:a$1}))}toggleBody(){this.bodyCollapsed.update(n=>!n);}toggleResource(n){this.expandedResources.update(i=>{let a=new Set(i);return a.has(n)?a.delete(n):a.add(n),a});}isResourceExpanded(n){return this.expandedResources().has(n)}resourceContent(n){return this.skill()?.resources?.[n]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-skill-inspect"]],decls:13,vars:3,consts:[[1,"skill-inspect"],[1,"skill-inspect__header"],["type","button","title","Back to skills",1,"skill-inspect__back",3,"click"],[1,"skill-inspect__back-icon"],[1,"skill-inspect__title"],[1,"skill-inspect__sibling-link",3,"routerLink"],[1,"skill-inspect__platform-badge"],[1,"skill-inspect__loading"],["role","alert",1,"skill-inspect__error"],[1,"skill-inspect__content"],[1,"skill-inspect__section"],[1,"skill-inspect__section-title"],[1,"skill-inspect__dl"],[1,"skill-inspect__dt"],[1,"skill-inspect__dd","skill-inspect__dd--mono"],[1,"skill-inspect__dd"],[1,"skill-inspect__badge"],[1,"skill-inspect__count"],[1,"skill-inspect__empty"],["type","button",1,"skill-inspect__collapsible",3,"click"],[1,"skill-inspect__chevron"],[1,"skill-inspect__body",3,"innerHTML"],[1,"skill-inspect__resources"],[1,"skill-inspect__consumers"],[1,"skill-inspect__consumer"],[1,"skill-inspect__consumers-hint"],[1,"skill-inspect__consumer-name"],[1,"skill-inspect__resource"],["type","button",1,"skill-inspect__resource-header",3,"click"],[1,"skill-inspect__resource-path"],[1,"skill-inspect__resource-content"]],template:function(i,a){if(i&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.back()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Skills "),pl(),ws(6,"h1",4),GC(7,"Skill"),pl(),Jw(8,K,2,1,"a",5),Jw(9,q,2,0,"span",6),pl(),Jw(10,Q,2,0,"p",7)(11,W,2,0,"p",8)(12,ge,46,15,"div",9),pl()),i&2){let s;XE(8),eC(a.skill()&&!a.isFilesystemBacked()?8:-1),XE(),eC(a.isPlatformMode?9:-1),XE(),eC(a.isLoading()?10:a.hasError()?11:(s=a.skill())?12:-1,s);}},dependencies:[$t,d],styles:[".skill-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.skill-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.skill-inspect__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.skill-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.skill-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.skill-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.skill-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__platform-badge[_ngcontent-%COMP%]{align-self:flex-start;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.15rem .5rem;border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73)}.skill-inspect__loading[_ngcontent-%COMP%], .skill-inspect__error[_ngcontent-%COMP%], .skill-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.skill-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.skill-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.skill-inspect__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:10px}.skill-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.skill-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.skill-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.skill-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.skill-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.skill-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.skill-inspect__consumers[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.375rem}.skill-inspect__consumer[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.skill-inspect__consumer-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500}.skill-inspect__consumers-hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.skill-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.skill-inspect__badge--readonly[_ngcontent-%COMP%]{background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text, #1d1d1f);border:1px solid var(--color-divider, rgba(0, 0, 0, .12))}.skill-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.skill-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.skill-inspect__body[_ngcontent-%COMP%]{font-size:.9375rem;line-height:1.6;color:var(--color-text, #1d1d1f);max-height:520px;overflow-y:auto;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));word-break:break-word}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%], .skill-inspect__body[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{padding:.75rem;border-radius:6px;background:var(--color-code-bg, rgba(0, 0, 0, .06));overflow-x:auto}.skill-inspect__resources[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.skill-inspect__resource[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.skill-inspect__resource-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;background:none;border:none;padding:.625rem .875rem;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__resource-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.skill-inspect__resource-path[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);word-break:break-all}.skill-inspect__resource-content[_ngcontent-%COMP%]{margin:0;padding:.875rem;font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);background:var(--color-surface-muted, rgba(0, 0, 0, .04));white-space:pre-wrap;word-break:break-word;max-height:320px;overflow-y:auto}"]})};export{G as SkillInspectComponent};
|
|
1
|
+
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CrNBJoK_.js';import {s,d}from'./chunk-qYcN8ULw.js';import {g,ao as W$1,F,C as Ce,G as Gi,m as mT,b as U,M as By,a7 as ya,Q as br,e as xw,$ as $t,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,ac as gC,u as bg,a9 as lC,a8 as Yg,z as Ug,a5 as vl,T as Tg,s as rC,y as oC,S as Sg,bf as aT,bg as uT,a4 as nC,aa as If,ab as wf,bj as aE}from'./main-HJHU5XWA.js';import'./chunk-Bb0ksCWN.js';import'./chunk-DPdQ_sjv.js';import'./chunk-C32fe9qE.js';import'./chunk-D5PhFOjy.js';var J=(e,n)=>n.name+n.grant;function K(e,n){if(e&1&&(ws(0,"a",5),GC(1,"Edit skill \u2192"),pl()),e&2){let i=gC();bg("routerLink",i.editRoute());}}function q(e,n){e&1&&(ws(0,"span",6),GC(1,"Platform level"),pl());}function Q(e,n){e&1&&(ws(0,"p",7),GC(1,"Loading\u2026"),pl());}function W(e,n){e&1&&(ws(0,"p",8),GC(1,"Failed to load skill."),pl());}function X(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Created by"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.createdBy);}}function Y(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Last updated"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.updatedOn);}}function Z(e,n){if(e&1&&(Jw(0,X,4,1),Jw(1,Y,4,1)),e&2){let i=gC();eC(i.createdBy?0:-1),XE(),eC(i.updatedOn?1:-1);}}function ee(e,n){if(e&1&&(ws(0,"span",17),GC(1),pl()),e&2){let i=gC(2);XE(),vl("(",i.consumers().length,")");}}function te(e,n){e&1&&(ws(0,"p",18),GC(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),pl());}function ne(e,n){e&1&&(ws(0,"p",18),GC(1,"Loading\u2026"),pl());}function ie(e,n){e&1&&(ws(0,"p",8),GC(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),pl());}function oe(e,n){e&1&&(ws(0,"p",18),GC(1,"No agent references this skill."),pl());}function le(e,n){e&1&&(ws(0,"span",16),GC(1,"platform agent"),pl());}function ae(e,n){e&1&&(ws(0,"span",16),GC(1,"via *"),pl());}function re(e,n){if(e&1&&(ws(0,"li",24)(1,"span",26),GC(2),pl(),Jw(3,le,2,0,"span",16),Jw(4,ae,2,0,"span",16),pl()),e&2){let i=n.$implicit;XE(2),Yg(i.name),XE(),eC(i.platform?3:-1),XE(),eC(i.grant==="all"?4:-1);}}function se(e,n){if(e&1&&(ws(0,"ul",23),rC(1,re,5,3,"li",24,J),pl(),ws(3,"p",25),GC(4," An agent listed "),ws(5,"code"),GC(6,"via *"),pl(),GC(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),pl()),e&2){let i=gC(2);XE(),oC(i.consumers());}}function ce(e,n){if(e&1&&(Sg(0,"div",21),aT(1,"agentosMarkdown")),e&2){let i=gC();bg("innerHTML",uT(1,1,i.body),aE);}}function de(e,n){e&1&&(ws(0,"p",18),GC(1,"No resources bundled with this skill."),pl());}function pe(e,n){if(e&1&&(ws(0,"pre",30),GC(1),pl()),e&2){let i=gC().$implicit,a=gC(3);XE(),Yg(a.resourceContent(i));}}function me(e,n){if(e&1){let i=lC();ws(0,"li",27)(1,"button",28),Rg("click",function(){let s=If(i).$implicit,g=gC(3);return wf(g.toggleResource(s))}),ws(2,"span",29),GC(3),pl(),ws(4,"span",20),GC(5,"\u25BC"),pl()(),Jw(6,pe,2,1,"pre",30),pl();}if(e&2){let i=n.$implicit,a=gC(3);XE(),Tg("aria-expanded",a.isResourceExpanded(i)),XE(2),Yg(i),XE(),Ug("skill-inspect__chevron--open",a.isResourceExpanded(i)),XE(2),eC(a.isResourceExpanded(i)?6:-1);}}function _e(e,n){if(e&1&&(ws(0,"ul",22),rC(1,me,7,5,"li",27,nC),pl()),e&2){let i=gC(2);XE(),oC(i.resourcePaths());}}function ge(e,n){if(e&1){let i=lC();ws(0,"div",9)(1,"section",10)(2,"h2",11),GC(3,"General"),pl(),ws(4,"dl",12)(5,"dt",13),GC(6,"Name"),pl(),ws(7,"dd",14),GC(8),pl(),ws(9,"dt",13),GC(10,"Description"),pl(),ws(11,"dd",15),GC(12),pl(),ws(13,"dt",13),GC(14,"Scope"),pl(),ws(15,"dd",15),GC(16),pl(),ws(17,"dt",13),GC(18,"Storage"),pl(),ws(19,"dd",15)(20,"span",16),GC(21),pl()(),Jw(22,Z,2,2),pl()(),ws(23,"section",10)(24,"h2",11),GC(25," Used by "),Jw(26,ee,2,1,"span",17),pl(),Jw(27,te,2,0,"p",18)(28,ne,2,0,"p",18)(29,ie,2,0,"p",8)(30,oe,2,0,"p",18)(31,se,8,0),pl(),ws(32,"section",10)(33,"button",19),Rg("click",function(){If(i);let s=gC();return wf(s.toggleBody())}),ws(34,"h2",11),GC(35,"Body"),pl(),ws(36,"span",20),GC(37,"\u25BC"),pl()(),Jw(38,ce,2,3,"div",21),pl(),ws(39,"section",10)(40,"h2",11),GC(41," Resources "),ws(42,"span",17),GC(43),pl()(),Jw(44,de,2,0,"p",18)(45,_e,3,0,"ul",22),pl()();}if(e&2){let i=n,a=gC();XE(8),Yg(i.name),XE(4),Yg(i.description),XE(4),Yg(i.namespaceId?"Namespace":"Platform"),XE(4),Ug("skill-inspect__badge--readonly",a.isFilesystemBacked()),XE(),vl(" ",a.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),XE(),eC(a.isFilesystemBacked()?-1:22),XE(4),eC(!a.isPlatformMode&&!a.consumersLoading()&&!a.consumersUnavailable()?26:-1),XE(),eC(a.isPlatformMode?27:a.consumersLoading()?28:a.consumersUnavailable()?29:a.consumers().length===0?30:31),XE(6),Tg("aria-expanded",!a.bodyCollapsed()),XE(3),Ug("skill-inspect__chevron--open",!a.bodyCollapsed()),XE(2),eC(a.bodyCollapsed()?-1:38),XE(5),vl("(",a.resourcePaths().length,")"),XE(),eC(a.resourcePaths().length===0?44:45);}}var G=class e{route=g(W$1);router=g(F);destroyRef=g(Ce);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=Gi(true);hasError=Gi(false);skill=Gi(null);bodyCollapsed=Gi(false);expandedResources=Gi(new Set);resourcePaths=mT(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=mT(()=>this.skill()?.readOnly===true);consumers=Gi([]);consumersUnavailable=Gi(false);consumersLoading=Gi(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:n=>{this.skill.set(n),this.isLoading.set(false),this.loadConsumers(n.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(n){this.namespaceId&&(this.consumersLoading.set(true),By({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ya(()=>br([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:i,platform:a})=>{let s=[...this.toConsumers(i,n,false),...this.toConsumers(a,n,true)];this.consumers.set([...s.filter(g=>g.grant==="named"),...s.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(n,i,a$1){return n.map(s=>({config:s,grant:a(s.skillSelectors,i)})).filter(s=>s.grant!=="none").map(({config:s,grant:g})=>({name:s.name,grant:g,platform:a$1}))}toggleBody(){this.bodyCollapsed.update(n=>!n);}toggleResource(n){this.expandedResources.update(i=>{let a=new Set(i);return a.has(n)?a.delete(n):a.add(n),a});}isResourceExpanded(n){return this.expandedResources().has(n)}resourceContent(n){return this.skill()?.resources?.[n]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-skill-inspect"]],decls:13,vars:3,consts:[[1,"skill-inspect"],[1,"skill-inspect__header"],["type","button","title","Back to skills",1,"skill-inspect__back",3,"click"],[1,"skill-inspect__back-icon"],[1,"skill-inspect__title"],[1,"skill-inspect__sibling-link",3,"routerLink"],[1,"skill-inspect__platform-badge"],[1,"skill-inspect__loading"],["role","alert",1,"skill-inspect__error"],[1,"skill-inspect__content"],[1,"skill-inspect__section"],[1,"skill-inspect__section-title"],[1,"skill-inspect__dl"],[1,"skill-inspect__dt"],[1,"skill-inspect__dd","skill-inspect__dd--mono"],[1,"skill-inspect__dd"],[1,"skill-inspect__badge"],[1,"skill-inspect__count"],[1,"skill-inspect__empty"],["type","button",1,"skill-inspect__collapsible",3,"click"],[1,"skill-inspect__chevron"],[1,"skill-inspect__body",3,"innerHTML"],[1,"skill-inspect__resources"],[1,"skill-inspect__consumers"],[1,"skill-inspect__consumer"],[1,"skill-inspect__consumers-hint"],[1,"skill-inspect__consumer-name"],[1,"skill-inspect__resource"],["type","button",1,"skill-inspect__resource-header",3,"click"],[1,"skill-inspect__resource-path"],[1,"skill-inspect__resource-content"]],template:function(i,a){if(i&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.back()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Skills "),pl(),ws(6,"h1",4),GC(7,"Skill"),pl(),Jw(8,K,2,1,"a",5),Jw(9,q,2,0,"span",6),pl(),Jw(10,Q,2,0,"p",7)(11,W,2,0,"p",8)(12,ge,46,15,"div",9),pl()),i&2){let s;XE(8),eC(a.skill()&&!a.isFilesystemBacked()?8:-1),XE(),eC(a.isPlatformMode?9:-1),XE(),eC(a.isLoading()?10:a.hasError()?11:(s=a.skill())?12:-1,s);}},dependencies:[$t,d],styles:[".skill-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.skill-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.skill-inspect__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.skill-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.skill-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.skill-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.skill-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__platform-badge[_ngcontent-%COMP%]{align-self:flex-start;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.15rem .5rem;border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73)}.skill-inspect__loading[_ngcontent-%COMP%], .skill-inspect__error[_ngcontent-%COMP%], .skill-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.skill-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.skill-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.skill-inspect__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:10px}.skill-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.skill-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.skill-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.skill-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.skill-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.skill-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.skill-inspect__consumers[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.375rem}.skill-inspect__consumer[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.skill-inspect__consumer-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500}.skill-inspect__consumers-hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.skill-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.skill-inspect__badge--readonly[_ngcontent-%COMP%]{background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text, #1d1d1f);border:1px solid var(--color-divider, rgba(0, 0, 0, .12))}.skill-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.skill-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.skill-inspect__body[_ngcontent-%COMP%]{font-size:.9375rem;line-height:1.6;color:var(--color-text, #1d1d1f);max-height:520px;overflow-y:auto;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));word-break:break-word}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%], .skill-inspect__body[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{padding:.75rem;border-radius:6px;background:var(--color-code-bg, rgba(0, 0, 0, .06));overflow-x:auto}.skill-inspect__resources[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.skill-inspect__resource[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.skill-inspect__resource-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;background:none;border:none;padding:.625rem .875rem;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__resource-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.skill-inspect__resource-path[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);word-break:break-all}.skill-inspect__resource-content[_ngcontent-%COMP%]{margin:0;padding:.875rem;font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);background:var(--color-surface-muted, rgba(0, 0, 0, .04));white-space:pre-wrap;word-break:break-word;max-height:320px;overflow-y:auto}"]})};export{G as SkillInspectComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {R}from'./chunk-
|
|
1
|
+
import {R}from'./chunk-3Hiw8VE3.js';import {g,F,C as Ce,aJ as Tr,G as Gi,bS as Ea,r as re,b as U,e as xw,aK as xb,k as ws,bf as aT,q as Rg,n as GC,o as pl,af as Eg,t as CC,u as bg,bg as uT,ah as rT,cb as ZB,cc as qB,m as mT,J as Jw,X as XE,a8 as Yg,v as eC,ac as gC,T as Tg,a5 as vl,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-HJHU5XWA.js';import'./chunk-qYcN8ULw.js';import {$ as $n,c as ni,S as Se}from'./chunk-DPdQ_sjv.js';import'./chunk-C32fe9qE.js';import'./chunk-D5PhFOjy.js';import'./chunk-DKqi2OiN.js';import'./chunk-Bb0ksCWN.js';function H(n,t){if(n&1&&(ws(0,"span",4),GC(1),pl()),n&2){let e=gC();Tg("data-variant",e.badge().variant)("aria-label",e.badge().ariaLabel),XE(),vl(" ",e.badge().label," ");}}function J(n,t){if(n&1){let e=lC();ws(0,"span",7),GC(1,"Delete?"),pl(),ws(2,"ds-icon-button",8),Rg("action",function(){If(e);let o=gC();return wf(o.onDeleteConfirmed())}),pl(),ws(3,"ds-icon-button",9),Rg("action",function(){If(e);let o=gC();return wf(o.onDeleteCancelled())}),pl();}}function Q(n,t){if(n&1){let e=lC();ws(0,"ds-kebab-menu",12),Rg("itemSelected",function(o){If(e);let h=gC(2);return wf(h.onMenuAction(o))}),pl();}if(n&2){let e=gC(2);bg("items",e.menuItems());}}function X(n,t){if(n&1){let e=lC();ws(0,"ds-icon-button",10),Rg("action",function(){If(e);let o=gC();return wf(o.onDuplicate())}),pl(),Jw(1,Q,1,1,"ds-kebab-menu",11);}if(n&2){let e=gC();XE(),eC(e.readOnly()?-1:1);}}var Y=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration plateforme (lecture seule)",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),x=class n{config=ZB.required();scope=ZB.required();readOnly=ZB(false);showBadge=ZB(true);editRequested=qB();deleteRequested=qB();duplicateRequested=qB();pendingDelete=Gi(false);badge=mT(()=>Y[this.scope()]);menuItems=mT(()=>[{key:"edit",label:"Edit auth setting",icon:"edit"},{key:"delete",label:"Delete auth setting",icon:"delete",variant:"danger"}]);onMenuAction(t){switch(t){case "edit":this.editRequested.emit(this.config());break;case "delete":this.pendingDelete.set(true);break}}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-auth-setting-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:11,vars:4,consts:[["role","listitem",1,"auth-setting-item"],[1,"auth-setting-item__body"],[1,"auth-setting-item__heading"],[1,"auth-setting-item__name"],[1,"auth-setting-item__badge"],[1,"auth-setting-item__type"],[1,"auth-setting-item__actions"],[1,"auth-setting-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this auth setting",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(ws(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),GC(4),pl(),Jw(5,H,2,3,"span",4),pl(),ws(6,"span",5),GC(7),pl()(),ws(8,"div",6),Jw(9,J,4,0)(10,X,2,1),pl()()),e&2&&(XE(4),Yg(i.config().name),XE(),eC(i.showBadge()?5:-1),XE(2),Yg(i.config().authType),XE(2),eC(i.pendingDelete()?9:10));},dependencies:[ni,Se],styles:[".auth-setting-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border);background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);transition:background .15s ease,border-color .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-primary)}.auth-setting-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.auth-setting-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.auth-setting-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.auth-setting-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.65rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:.1rem .4rem;border-radius:4px;line-height:1.2}.auth-setting-item__badge[data-variant=neutral][_ngcontent-%COMP%]{background:var(--color-bg-secondary);color:var(--color-text-secondary)}.auth-setting-item__badge[data-variant=info][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-info) 15%,transparent);color:var(--color-info)}.auth-setting-item__badge[data-variant=warning][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-warning) 15%,transparent);color:var(--color-warning)}.auth-setting-item__type[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.auth-setting-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover .auth-setting-item__actions[_ngcontent-%COMP%], .auth-setting-item[_ngcontent-%COMP%]:focus-within .auth-setting-item__actions[_ngcontent-%COMP%]{opacity:1}.auth-setting-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error);margin-right:.25rem;white-space:nowrap}"]})};var Z=()=>[];function ee(n,t){if(n&1){let e=lC();ws(0,"agentos-auth-setting-item",4),Rg("editRequested",function(o){If(e);let h=gC(2);return wf(h.onEdit(o))})("deleteRequested",function(o){If(e);let h=gC(2);return wf(h.onDelete(o))}),pl();}n&2&&bg("config",t)("showBadge",false);}function te(n,t){if(n&1&&Jw(0,ee,1,2,"agentos-auth-setting-item",3),n&2){let e,i=t.$implicit,o=gC();eC((e=o.resolveSetting(i.id))?0:-1,e);}}var K=class n{router=g(F);destroyRef=g(Ce);state=g(R);refresh$=new Tr(void 0);isLoading=Gi(true);settings$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())));settingItems$=this.settings$.pipe(re(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.authType}))));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.settingsById=new Map(t.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.state.delete(t.id,"platform").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveSetting(t){return this.settingsById.get(t)??null}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-platform-auth-settings"]],decls:6,vars:7,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"platform-auth-settings__back",3,"click"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(e,i){if(e&1&&(ws(0,"ds-entity-list",1),aT(1,"async"),Rg("createRequested",function(){return i.openCreateForm()}),ws(2,"button",2),Rg("click",function(){return i.goBack()}),GC(3,"\u2190 Admin"),pl()(),Eg(4,te,1,1,"ng-template",null,0,fT)),e&2){let o=CC(5);bg("items",uT(1,4,i.settingItems$)??rT(6,Z))("loading",i.isLoading())("showCreate",true)("itemTemplate",o);}},dependencies:[$n,x,xb],encapsulation:2})};export{K as PlatformAuthSettingsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O as O$1}from'./chunk-
|
|
1
|
+
import {O as O$1}from'./chunk-qYcN8ULw.js';import {g,ao as W,F,du as F$1,da as $,C as Ce,G as Gi,b as U,av as B,dv as Ny,e as xw,aw as hl,cJ as Og,n as GC,ax as gl,b6 as _g,J as Jw,X as XE,c0 as xg,v as eC,a5 as vl,ac as gC}from'./main-HJHU5XWA.js';import'./chunk-Bb0ksCWN.js';import'./chunk-DPdQ_sjv.js';import'./chunk-C32fe9qE.js';import'./chunk-D5PhFOjy.js';function w(l,o){if(l&1&&(hl(0,"p",10),GC(1),gl()),l&2){let i=gC();XE(),vl(" ",i.launchError()," ");}}var O=class l{route=g(W);router=g(F);caseController=g(F$1);caseState=g(O$1);agentConfigController=g($);destroyRef=g(Ce);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=Gi("");launchError=Gi(null);isLaunching=Gi(false);isLoading=Gi(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U(this.destroyRef)).subscribe({next:o=>{this.resolvedAgentConfig=o,o.loopConfig!=null&&this.payloadJson.set(JSON.stringify(o.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 o=this.resolvedAgentConfig??(yield Ny(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),i=yield Ny(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(i);let e=i.id??"",d={content:`@${o.name} start`};yield Ny(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(o){console.error("[AgentConfigLaunch] Failed to launch loop agent",o),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(i){return new(i||l)};static \u0275cmp=xw({type:l,selectors:[["agentos-agent-config-launch"]],decls:23,vars:6,consts:[[1,"agent-config-launch"],[1,"agent-config-launch__header"],["type","button","title","Back to agent config",1,"agent-config-launch__back",3,"click"],[1,"agent-config-launch__back-icon"],[1,"agent-config-launch__title"],[1,"agent-config-launch__intro"],[1,"agent-config-launch__code"],[1,"agent-config-launch__field"],["for","agent-loop-payload",1,"agent-config-launch__label"],["id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",1,"agent-config-launch__textarea",3,"value","disabled"],["role","alert",1,"agent-config-launch__error","agent-config-launch__error--banner"],[1,"agent-config-launch__actions"],["type","button",1,"agent-config-launch__btn","agent-config-launch__btn--primary",3,"click","disabled"],["type","button",1,"agent-config-launch__btn",3,"click","disabled"]],template:function(i,e){i&1&&(hl(0,"div",0)(1,"header",1)(2,"button",2),Og("click",function(){return e.back()}),hl(3,"span",3),GC(4,"\u2190"),gl(),GC(5," Edit agent config "),gl(),hl(6,"h1",4),GC(7,"Launch loop agent"),gl()(),hl(8,"p",5),GC(9," The loop configuration below is read from "),hl(10,"code",6),GC(11,"AgentConfig.loopConfig"),gl(),GC(12," 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. "),gl(),hl(13,"div",7)(14,"label",8),GC(15,"Loop configuration (read-only)"),gl(),_g(16,"textarea",9),gl(),Jw(17,w,2,1,"p",10),hl(18,"div",11)(19,"button",12),Og("click",function(){return e.launch()}),GC(20),gl(),hl(21,"button",13),Og("click",function(){return e.back()}),GC(22,"Cancel"),gl()()()),i&2&&(XE(16),xg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),XE(),eC(e.launchError()?17:-1),XE(2),xg("disabled",e.isLaunching()),XE(),vl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),XE(),xg("disabled",e.isLaunching()));},styles:[".agent-config-launch[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.75rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.agent-config-launch__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-launch__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;font-family:inherit;color:var(--color-accent, #2563eb)}.agent-config-launch__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-launch__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-launch__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-launch__intro[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary);line-height:1.5}.agent-config-launch__code[_ngcontent-%COMP%]{font-family:var(--font-heading, monospace);font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .35em}.agent-config-launch__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-launch__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-launch__textarea[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;border:1px solid var(--color-divider);background:var(--color-surface-muted, rgba(0, 0, 0, .03));color:var(--color-text-secondary);font-family:var(--font-heading, monospace);font-size:.8125rem;line-height:1.6;resize:vertical;outline:none;box-sizing:border-box;cursor:default}.agent-config-launch__textarea[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.agent-config-launch__error[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8125rem;color:var(--color-error, var(--red, #dc2626));line-height:1.4}.agent-config-launch__error--banner[_ngcontent-%COMP%]{padding:.75rem 1rem;background:color-mix(in srgb,var(--color-error, #dc2626) 8%,transparent);border:1px solid color-mix(in srgb,var(--color-error, #dc2626) 25%,transparent);border-left:3px solid var(--color-error, #dc2626)}.agent-config-launch__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem}.agent-config-launch__btn[_ngcontent-%COMP%]{padding:.6rem 1.5rem;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.agent-config-launch__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-launch__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-launch__btn--primary[_ngcontent-%COMP%]{background:var(--color-warning, #f59e0b);border-color:var(--color-warning, #f59e0b);color:#fff}.agent-config-launch__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:color-mix(in srgb,var(--color-warning, #f59e0b) 80%,black);border-color:color-mix(in srgb,var(--color-warning, #f59e0b) 80%,black)}"]})};export{O as AgentConfigLaunchComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {w,av as B$1,x as x$1}from'./main-
|
|
1
|
+
import {w,av as B$1,x as x$1}from'./main-HJHU5XWA.js';function ct(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var re=ct();function rn(n){re=n;}var xe={exec:()=>null};function k(n,e=""){let r=typeof n=="string"?n:n.source,s={replace:(t,a)=>{let l=typeof a=="string"?a:a.source;return l=l.replace(D.caret,"$1"),r=r.replace(t,l),s},getRegex:()=>new RegExp(r,e)};return s}var D={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},Hn=/^(?:[ \t]*(?:\n|$))+/,Gn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Te=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,qn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,pt=/(?:[*+-]|\d{1,9}[.)])/,sn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ln=k(sn).replace(/bull/g,pt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Zn=k(sn).replace(/bull/g,pt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ut=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yn=/^[^\n]+/,ht=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,jn=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ht).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xn=k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,pt).getRegex(),Fe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ft=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qn=k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ft).replace("tag",Fe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),an=k(ut).replace("hr",Te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fe).getRegex(),Vn=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",an).getRegex(),gt={blockquote:Vn,code:Gn,def:jn,fences:Wn,heading:qn,hr:Te,html:Qn,lheading:ln,list:Xn,newline:Hn,paragraph:an,table:xe,text:Yn},Vt=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fe).getRegex(),Kn=x$1(w({},gt),{lheading:Zn,table:Vt,paragraph:k(ut).replace("hr",Te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Fe).getRegex()}),Jn=x$1(w({},gt),{html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ft).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(ut).replace("hr",Te).replace("heading",` *#{1,6} *[^
|
|
2
2
|
]`).replace("lheading",ln).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),er=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,on=/^( {2,}|\\)\n(?!\s*$)/,nr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Be=/[\p{P}\p{S}]/u,dt=/[\s\p{P}\p{S}]/u,cn=/[^\s\p{P}\p{S}]/u,rr=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,dt).getRegex(),pn=/(?!~)[\p{P}\p{S}]/u,sr=/(?!~)[\s\p{P}\p{S}]/u,ir=/(?:[^\s\p{P}\p{S}]|~)/u,lr=/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,un=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ar=k(un,"u").replace(/punct/g,Be).getRegex(),or=k(un,"u").replace(/punct/g,pn).getRegex(),hn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",cr=k(hn,"gu").replace(/notPunctSpace/g,cn).replace(/punctSpace/g,dt).replace(/punct/g,Be).getRegex(),pr=k(hn,"gu").replace(/notPunctSpace/g,ir).replace(/punctSpace/g,sr).replace(/punct/g,pn).getRegex(),ur=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,cn).replace(/punctSpace/g,dt).replace(/punct/g,Be).getRegex(),hr=k(/\\(punct)/,"gu").replace(/punct/g,Be).getRegex(),fr=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),gr=k(ft).replace("(?:-->|$)","-->").getRegex(),dr=k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",gr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ze=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,mr=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ze).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fn=k(/^!?\[(label)\]\[(ref)\]/).replace("label",ze).replace("ref",ht).getRegex(),gn=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",ht).getRegex(),kr=k("reflink|nolink(?!\\()","g").replace("reflink",fn).replace("nolink",gn).getRegex(),Kt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,mt={_backpedal:xe,anyPunctuation:hr,autolink:fr,blockSkip:lr,br:on,code:tr,del:xe,emStrongLDelim:ar,emStrongRDelimAst:cr,emStrongRDelimUnd:ur,escape:er,link:mr,nolink:gn,punctuation:rr,reflink:fn,reflinkSearch:kr,tag:dr,text:nr,url:xe},br=x$1(w({},mt),{link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",ze).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ze).getRegex()}),lt=x$1(w({},mt),{emStrongRDelimAst:pr,emStrongLDelim:or,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Kt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Kt).getRegex()}),xr=x$1(w({},lt),{br:k(on).replace("{2,}","*").getRegex(),text:k(lt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),ve={normal:gt,gfm:Kn,pedantic:Jn},me={normal:mt,gfm:lt,breaks:xr,pedantic:br},Tr={"&":"&","<":"<",">":">",'"':""","'":"'"},Jt=n=>Tr[n];function q(n,e){if(e){if(D.escapeTest.test(n))return n.replace(D.escapeReplace,Jt)}else if(D.escapeTestNoEncode.test(n))return n.replace(D.escapeReplaceNoEncode,Jt);return n}function en(n){try{n=encodeURI(n).replace(D.percentDecode,"%");}catch(e){return null}return n}function tn(n,e){let r=n.replace(D.findPipe,(a,l,o)=>{let p=false,u=l;for(;--u>=0&&o[u]==="\\";)p=!p;return p?"|":" |"}),s=r.split(D.splitPipe),t=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;t<s.length;t++)s[t]=s[t].trim().replace(D.slashPipe,"|");return s}function ke(n,e,r){let s=n.length;if(s===0)return "";let t=0;for(;t<s;){let a=n.charAt(s-t-1);if(a===e&&true)t++;else break}return n.slice(0,s-t)}function wr(n,e){if(n.indexOf(e[1])===-1)return -1;let r=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])r++;else if(n[s]===e[1]&&(r--,r<0))return s;return r>0?-2:-1}function nn(n,e,r,s,t){let a=e.href,l=e.title||null,o=n[1].replace(t.other.outputLinkReplace,"$1");s.state.inLink=true;let p={type:n[0].charAt(0)==="!"?"image":"link",raw:r,href:a,title:l,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=false,p}function Ar(n,e,r){let s=n.match(r.other.indentCodeCompensation);if(s===null)return e;let t=s[1];return e.split(`
|
|
3
3
|
`).map(a=>{let l=a.match(r.other.beginningSpace);if(l===null)return a;let[o]=l;return o.length>=t.length?a.slice(t.length):a}).join(`
|
|
4
4
|
`)}var $e=class{options;rules;lexer;constructor(n){this.options=n||re;}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return {type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:ke(r,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {l}from'./chunk-
|
|
1
|
+
import {l}from'./chunk-qYcN8ULw.js';import {g,dh as re,di as T,Q as br,bS as Ea,r as re$1,a7 as ya,cE as Dd,W as x}from'./main-HJHU5XWA.js';var v=class i{userState=g(l);membership=g(re);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return br(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(Ea(a=>a?a.isAdmin?br(true):this.membership.getMembersNamespaceMembership(e).pipe(re$1(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),ya(()=>br(false))):br(false)),Dd({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
|