@whoz-oss/coday-client 0.0.0-workstream-forge.260 → 0.0.0-workstream-forge.263

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.
Files changed (51) hide show
  1. package/browser/{chunk-CjF3kh6X.js → chunk-B-RP7_Ff.js} +1 -1
  2. package/browser/{chunk-B4oSnH6q.js → chunk-B6SdySbZ.js} +1 -1
  3. package/browser/{chunk-C6mk1TXU.js → chunk-BKTNOJf3.js} +1 -1
  4. package/browser/{chunk-DLuLiHuX.js → chunk-BRE9pdVg.js} +1 -1
  5. package/browser/{chunk-Wkqwvdp3.js → chunk-BSCycf5m.js} +1 -1
  6. package/browser/{chunk-Bxl-W5rv.js → chunk-BWgH5ifY.js} +1 -1
  7. package/browser/{chunk-BEGeHvbU.js → chunk-B_FCzqTc.js} +1 -1
  8. package/browser/{chunk-DF7k_FKN.js → chunk-BjRO2Fvi.js} +1 -1
  9. package/browser/{chunk-CsMJN87z.js → chunk-BmZeMBqL.js} +1 -1
  10. package/browser/{chunk-BduQv2OD.js → chunk-Bu7f6Zft.js} +1 -1
  11. package/browser/{chunk-CBB_i9zm.js → chunk-BzSGYUfS.js} +1 -1
  12. package/browser/{chunk-CZ6YsQnn.js → chunk-C0EI__dc.js} +1 -1
  13. package/browser/{chunk-B0YWgYUz.js → chunk-C4K--O8X.js} +1 -1
  14. package/browser/chunk-C5-HyIli.js +670 -0
  15. package/browser/{chunk-FMElf1Kh.js → chunk-C8AVqeHV.js} +1 -1
  16. package/browser/{chunk-DglDAX_u.js → chunk-CBsGTNPw.js} +1 -1
  17. package/browser/{chunk-CmNMnl1X.js → chunk-CCQX_iC7.js} +1 -1
  18. package/browser/chunk-CErgoGuy.js +1 -0
  19. package/browser/{chunk-D61AUiEX.js → chunk-CGXEdB9v.js} +1 -1
  20. package/browser/{chunk-DGm40OPY.js → chunk-CLobvWQe.js} +1 -1
  21. package/browser/{chunk-BL3wnbf2.js → chunk-CPBC1Xfb.js} +1 -1
  22. package/browser/{chunk-DH3KwJPn.js → chunk-CT27ZBx1.js} +1 -1
  23. package/browser/{chunk-CaSrm-yj.js → chunk-CfVEsWYo.js} +1 -1
  24. package/browser/{chunk-DWro011L.js → chunk-CkfKd9le.js} +1 -1
  25. package/browser/{chunk-DI1Jsft5.js → chunk-DDLbv71E.js} +1 -1
  26. package/browser/{chunk-ClmH7wru.js → chunk-DKwH66R-.js} +1 -1
  27. package/browser/{chunk-C80imceV.js → chunk-DSBR7BB1.js} +1 -1
  28. package/browser/{chunk-CrljCfTT.js → chunk-DXP8WhWD.js} +1 -1
  29. package/browser/{chunk-DVnreUZp.js → chunk-DY5GaL9q.js} +1 -1
  30. package/browser/{chunk-Cw-HKK2W.js → chunk-DZqPrp4_.js} +1 -1
  31. package/browser/{chunk-C4XRMKqd.js → chunk-DhLMUMDO.js} +1 -1
  32. package/browser/{chunk-CWxtFbYp.js → chunk-DjAcquyS.js} +1 -1
  33. package/browser/{chunk-DyMrL6Ee.js → chunk-Dmvl2VVZ.js} +1 -1
  34. package/browser/{chunk-p_4THMZn.js → chunk-Dn4S3owf.js} +1 -1
  35. package/browser/{chunk-DARQ9uHM.js → chunk-Dr8n1idd.js} +1 -1
  36. package/browser/{chunk-7p42eTQE.js → chunk-Dx3T5h4S.js} +1 -1
  37. package/browser/{chunk-BJ-aqn_T.js → chunk-G0SGYgOy.js} +1 -1
  38. package/browser/{chunk-BByf0AaZ.js → chunk-JadGDAwQ.js} +1 -1
  39. package/browser/{chunk-DQ6_qIZF.js → chunk-KtIuYOCt.js} +1 -1
  40. package/browser/{chunk-3LrWBzrF.js → chunk-QFZmQcVZ.js} +1 -1
  41. package/browser/{chunk-BKhlmnMI.js → chunk-VhonxBgn.js} +1 -1
  42. package/browser/{chunk-CbELThsL.js → chunk-i90ntSnJ.js} +1 -1
  43. package/browser/{chunk-BXDGxrbm.js → chunk-jeBNbDmc.js} +1 -1
  44. package/browser/{chunk-C6WfP1id.js → chunk-smZ6Ucyg.js} +1 -1
  45. package/browser/{chunk-Cck7m2qM.js → chunk-szCUHbC4.js} +1 -1
  46. package/browser/{chunk-BiY5nHbl.js → chunk-xH5IhMJJ.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-DZHLOK7A.js → main-B5VGWTF5.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-BE-UpkfJ.js +0 -1
  51. package/browser/chunk-zs4CYUQt.js +0 -674
@@ -1 +1 @@
1
- import {c}from'./chunk-7p42eTQE.js';import {p as pt,T as Te$1,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,v as yn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn,t as an}from'./chunk-zs4CYUQt.js';import {g,W,t as F,K as we$1,ag as U,ah as Fe$1,ai as ke$1,$ as $i,aj as De$1,a9 as F$1,ak as yd,o as oT,ac as by,U as U$1,a2 as ha,aa as br,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,u as Dl,i as Vw,Q as Qw,f as fg,S as NI,q as $w,v as tC,T as AI,z as zw,F as Fg,w as pf,x as hf,y as sh}from'./main-DZHLOK7A.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=tC(2);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),AC(1,"Add an agent config"),hl(),AC(2," first. ")),n&2){let e=tC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),AC(2," No agent configs available in this scope yet. "),Bw(3,Se,3,1),hl()()),n&2){let e=tC(2);VE(3),Vw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),VE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),AC(3,"Select an agent config\u2026"),hl(),$w(4,Ee,2,2,"option",17,ve),hl(),NI(),hl()),n&2){let e=tC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(3),zw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Qw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=tC(3);return hf(h.toggleDay(f.value))}),hl(),AC(2),hl();}if(n&2){let e=t.$implicit,l=tC(3);VE(),dg("checked",l.isDaySelected(e.value)),VE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),$w(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=tC(2);VE(2),zw(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),VE(),dg("formControl",e.endDateControl),AI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),VE(),dg("formControl",e.occurrenceCountControl),AI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),AC(1),hl()),n&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=tC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),NI(),hl(),Bw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),NI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),$w(13,Te,2,2,"option",17,V),hl(),NI(),hl(),Bw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),NI(),Es(19,"span",22),AC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),NI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),$w(26,Me,2,2,"option",17,V),hl(),NI(),hl(),Bw(28,Pe,2,2,"ds-form-field",28),Bw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),NI(),AC(33," Enabled "),hl(),Es(34,"p",33),AC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),NI(),hl(),Bw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),AC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=tC();return hf(f.cancel())}),AC(43,"Cancel"),hl()()();}if(n&2){let e=tC();dg("formGroup",e.form),VE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),VE(),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),VE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),VE(),dg("formControl",e.promptContentControl),AI(),VE(3),dg("formControl",e.unitControl),AI(),VE(),zw(e.schedulerUnits),VE(2),Vw(e.showDayFilter()?15:-1),VE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),VE(2),dg("formControl",e.timeUtcControl),AI(),VE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),VE(),dg("formControl",e.startDateControl),AI(),VE(2),dg("formControl",e.endTypeControl),AI(),VE(),zw(e.endTypes),VE(2),Vw(e.showEndDate()?28:-1),VE(),Vw(e.showOccurrenceCount()?29:-1),VE(3),dg("formControl",e.enabledControl),AI(),VE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(),Vw(e.errorMessage()?38:-1),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[gn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[gn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[gn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[gn.required,gn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[gn.required]}),endType:new Te$1(Fe$1.NEVER,{nonNullable:true,validators:[gn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=ke$1;SchedulerEndType=Fe$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:Fe$1.NEVER,label:"Never"},{value:Fe$1.ON_DATE,label:"On date"},{value:Fe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=oT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=oT(()=>this.endTypeSignal()===Fe$1.ON_DATE);showOccurrenceCount=oT(()=>this.endTypeSignal()===Fe$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Fe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Fe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),AC(3),hl()(),Bw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(VE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),VE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),VE(),Vw(l.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,An,On,hn,fn,un,dn,cn,pn,at,sn,an],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Fe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Fe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
1
+ import {c}from'./chunk-Dx3T5h4S.js';import {p as pt,T as Te$1,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,v as yn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn,t as an}from'./chunk-C5-HyIli.js';import {g,W,t as F,K as we$1,ag as U,ah as Fe$1,ai as ke$1,$ as $i,aj as De$1,a9 as F$1,ak as yd,o as oT,ac as by,U as U$1,a2 as ha,aa as br,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,u as Dl,i as Vw,Q as Qw,f as fg,S as NI,q as $w,v as tC,T as AI,z as zw,F as Fg,w as pf,x as hf,y as sh}from'./main-B5VGWTF5.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=tC(2);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),AC(1,"Add an agent config"),hl(),AC(2," first. ")),n&2){let e=tC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),AC(2," No agent configs available in this scope yet. "),Bw(3,Se,3,1),hl()()),n&2){let e=tC(2);VE(3),Vw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),VE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),AC(3,"Select an agent config\u2026"),hl(),$w(4,Ee,2,2,"option",17,ve),hl(),NI(),hl()),n&2){let e=tC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(3),zw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Qw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=tC(3);return hf(h.toggleDay(f.value))}),hl(),AC(2),hl();}if(n&2){let e=t.$implicit,l=tC(3);VE(),dg("checked",l.isDaySelected(e.value)),VE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),$w(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=tC(2);VE(2),zw(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),VE(),dg("formControl",e.endDateControl),AI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),VE(),dg("formControl",e.occurrenceCountControl),AI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),AC(1),hl()),n&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=tC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),NI(),hl(),Bw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),NI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),$w(13,Te,2,2,"option",17,V),hl(),NI(),hl(),Bw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),NI(),Es(19,"span",22),AC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),NI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),$w(26,Me,2,2,"option",17,V),hl(),NI(),hl(),Bw(28,Pe,2,2,"ds-form-field",28),Bw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),NI(),AC(33," Enabled "),hl(),Es(34,"p",33),AC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),NI(),hl(),Bw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),AC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=tC();return hf(f.cancel())}),AC(43,"Cancel"),hl()()();}if(n&2){let e=tC();dg("formGroup",e.form),VE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),VE(),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),VE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),VE(),dg("formControl",e.promptContentControl),AI(),VE(3),dg("formControl",e.unitControl),AI(),VE(),zw(e.schedulerUnits),VE(2),Vw(e.showDayFilter()?15:-1),VE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),VE(2),dg("formControl",e.timeUtcControl),AI(),VE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),VE(),dg("formControl",e.startDateControl),AI(),VE(2),dg("formControl",e.endTypeControl),AI(),VE(),zw(e.endTypes),VE(2),Vw(e.showEndDate()?28:-1),VE(),Vw(e.showOccurrenceCount()?29:-1),VE(3),dg("formControl",e.enabledControl),AI(),VE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(),Vw(e.errorMessage()?38:-1),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[gn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[gn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[gn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[gn.required,gn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[gn.required]}),endType:new Te$1(Fe$1.NEVER,{nonNullable:true,validators:[gn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=ke$1;SchedulerEndType=Fe$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:Fe$1.NEVER,label:"Never"},{value:Fe$1.ON_DATE,label:"On date"},{value:Fe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=oT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=oT(()=>this.endTypeSignal()===Fe$1.ON_DATE);showOccurrenceCount=oT(()=>this.endTypeSignal()===Fe$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Fe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Fe$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),AC(3),hl()(),Bw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(VE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),VE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),VE(),Vw(l.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,An,On,hn,fn,un,dn,cn,pn,at,sn,an],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Fe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Fe$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
@@ -1 +1 @@
1
- import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CjF3kh6X.js';import {I as s,z as k,j as O,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-zs4CYUQt.js';import {g,W,t as F,K as we,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,ad as ne$1,U,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,u as Dl,as as Pg,Q as Qw,w as pf,x as hf,n as lg}from'./main-DZHLOK7A.js';var Y=(n,e)=>e.key;function Z(n,e){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let t=tC();VE(),Fg(t.deletion.error());}}function ee(n,e){n&1&&(Es(0,"p",4),AC(1,"Loading skills\u2026"),hl());}function te(n,e){n&1&&(Es(0,"p",5),AC(1," No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path. "),hl());}function ne(n,e){n&1&&(Es(0,"p",4),AC(1,"No skills match the current filter."),hl());}function ie(n,e){if(n&1&&(Es(0,"span",14),AC(1),hl()),n&2){let t=tC().$implicit;VE(),Pg(" named by ",t.namedByAgents," ",t.namedByAgents===1?"agent":"agents"," ");}}function ae(n,e){n&1&&(Es(0,"ds-tag",20),AC(1,"Read-only"),hl());}function oe(n,e){n&1&&(Es(0,"ds-tag",21),AC(1,"SKILL.md"),hl());}function le(n,e){if(n&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let d=tC(2).$implicit,c=tC(2);return hf(c.edit(d))}),AC(1,"Edit"),hl();}if(n&2){let t=tC(2).$implicit;lg("aria-label","Edit "+t.skill.name);}}function re(n,e){if(n&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.inspect(d))}),AC(1," View "),hl(),Bw(2,le,2,1,"button",26);}if(n&2){let t=tC().$implicit,a=tC(2);lg("aria-label","View "+t.skill.name),VE(2),Vw(a.isMutable(t)?2:-1);}}function se(n,e){if(n&1){let t=Qw();Es(0,"agentos-row-delete-action",27),vg("deleteRequested",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.requestDelete(d))})("deleteConfirmed",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=tC().$implicit,a=tC(2);dg("rowKey",t.key)("rowLabel",t.skill.name)("state",a.deletion);}}function ce(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),AC(3),hl(),Bw(4,ie,2,2,"span",14),hl(),Es(5,"td",15),AC(6),hl(),Es(7,"td",16),AC(8),hl(),Es(9,"td",17)(10,"div",18)(11,"ds-tag",19),AC(12),hl(),Bw(13,ae,2,0,"ds-tag",20),Bw(14,oe,2,0,"ds-tag",21),hl()(),Es(15,"td",22)(16,"div",23),Bw(17,re,3,2),Bw(18,se,1,3,"agentos-row-delete-action",24),hl()()()),n&2){let t=e.$implicit,a=tC(2);VE(3),Fg(t.skill.name),VE(),Vw(t.namedByAgents>0?4:-1),VE(2),Dl(" ",t.skill.description||"\u2014"," "),VE(2),Fg(a.resourceCount(t.skill)),VE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),VE(),Fg(t.scope==="platform"?"Platform":"Namespace"),VE(),Vw(t.scope==="platform"?13:-1),VE(),Vw(t.skill.readOnly?14:-1),VE(3),Vw(a.deletion.confirmingId()!==t.key?17:-1),VE(),Vw(a.isMutable(t)?18:-1);}}function de(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Description"),hl(),Es(8,"th",10),AC(9,"Resources"),hl(),Es(10,"th",10),AC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),AC(14,"Actions"),hl()()()(),Es(15,"tbody",8),$w(16,ce,19,10,"tr",9,Y),hl()()()),n&2){let t=tC();VE(16),zw(t.rowFilter.filteredRows());}}var Q=class n{route=g(W);router=g(F);destroyRef=g(we);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();rows=$i([]);rowFilter=O(this.rows,e=>[e.skill.name,e.skill.description,e.scope].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({platform:this.skillState.listPlatform().pipe(ha(()=>br([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:by({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ha(()=>br([])))}).pipe(ne$1(({namespace:e,platform:t})=>[...e,...t]),ha(()=>br([])))}))),U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:a$1})=>{let d=(c,_,W)=>({key:`${_}:${c.id??W}`,skill:c,scope:_,namedByAgents:a$1.filter(X=>a(X.skillSelectors,c.name)==="named").length});this.rows.set([...e.map((c,_)=>d(c,"platform",_)),...t.map((c,_)=>d(c,"namespace",_))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}isMutable(e){return e.scope==="namespace"&&e.skill.readOnly!==true&&!!e.skill.id}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}inspect(e){e.skill.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","skills",e.skill.id,"inspect"]:["/agentos",this.namespaceId,"skills",e.skill.id,"inspect"]);}edit(e){!this.isMutable(e)||!e.skill.id||this.router.navigate(["/agentos",this.namespaceId,"skills",e.skill.id,"edit"]);}requestDelete(e){this.deletion.request(e.key);}confirmDelete(e){if(!this.isMutable(e)||!e.skill.id)return;let t=e.namedByAgents;this.deletion.execute(e.key,{request$:this.skillState.delete(e.skill.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:a=>a.status===400?`"${e.skill.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.skill.name}" failed.${t>0?` ${t} agent(s) still name it.`:""}`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-namespace-skills"]],decls:9,vars:3,consts:[["title","Skills","description","Skills available in this namespace, including skills inherited from the platform."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["variant","neutral"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),AC(3,"New skill"),hl()(),Bw(4,Z,2,1,"p",3),Bw(5,ee,2,0,"p",4)(6,te,2,0,"p",5)(7,ne,2,0,"p",4)(8,de,18,0,"div",6)),t&2&&(VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{Q as NamespaceSkillsComponent};
1
+ import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-B-RP7_Ff.js';import {I as s,z as k,j as O,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-C5-HyIli.js';import {g,W,t as F,K as we,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,ad as ne$1,U,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,u as Dl,as as Pg,Q as Qw,w as pf,x as hf,n as lg}from'./main-B5VGWTF5.js';var Y=(n,e)=>e.key;function Z(n,e){if(n&1&&(Es(0,"p",3),AC(1),hl()),n&2){let t=tC();VE(),Fg(t.deletion.error());}}function ee(n,e){n&1&&(Es(0,"p",4),AC(1,"Loading skills\u2026"),hl());}function te(n,e){n&1&&(Es(0,"p",5),AC(1," No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path. "),hl());}function ne(n,e){n&1&&(Es(0,"p",4),AC(1,"No skills match the current filter."),hl());}function ie(n,e){if(n&1&&(Es(0,"span",14),AC(1),hl()),n&2){let t=tC().$implicit;VE(),Pg(" named by ",t.namedByAgents," ",t.namedByAgents===1?"agent":"agents"," ");}}function ae(n,e){n&1&&(Es(0,"ds-tag",20),AC(1,"Read-only"),hl());}function oe(n,e){n&1&&(Es(0,"ds-tag",21),AC(1,"SKILL.md"),hl());}function le(n,e){if(n&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let d=tC(2).$implicit,c=tC(2);return hf(c.edit(d))}),AC(1,"Edit"),hl();}if(n&2){let t=tC(2).$implicit;lg("aria-label","Edit "+t.skill.name);}}function re(n,e){if(n&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.inspect(d))}),AC(1," View "),hl(),Bw(2,le,2,1,"button",26);}if(n&2){let t=tC().$implicit,a=tC(2);lg("aria-label","View "+t.skill.name),VE(2),Vw(a.isMutable(t)?2:-1);}}function se(n,e){if(n&1){let t=Qw();Es(0,"agentos-row-delete-action",27),vg("deleteRequested",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.requestDelete(d))})("deleteConfirmed",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=tC().$implicit,a=tC(2);dg("rowKey",t.key)("rowLabel",t.skill.name)("state",a.deletion);}}function ce(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),AC(3),hl(),Bw(4,ie,2,2,"span",14),hl(),Es(5,"td",15),AC(6),hl(),Es(7,"td",16),AC(8),hl(),Es(9,"td",17)(10,"div",18)(11,"ds-tag",19),AC(12),hl(),Bw(13,ae,2,0,"ds-tag",20),Bw(14,oe,2,0,"ds-tag",21),hl()(),Es(15,"td",22)(16,"div",23),Bw(17,re,3,2),Bw(18,se,1,3,"agentos-row-delete-action",24),hl()()()),n&2){let t=e.$implicit,a=tC(2);VE(3),Fg(t.skill.name),VE(),Vw(t.namedByAgents>0?4:-1),VE(2),Dl(" ",t.skill.description||"\u2014"," "),VE(2),Fg(a.resourceCount(t.skill)),VE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),VE(),Fg(t.scope==="platform"?"Platform":"Namespace"),VE(),Vw(t.scope==="platform"?13:-1),VE(),Vw(t.skill.readOnly?14:-1),VE(3),Vw(a.deletion.confirmingId()!==t.key?17:-1),VE(),Vw(a.isMutable(t)?18:-1);}}function de(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Description"),hl(),Es(8,"th",10),AC(9,"Resources"),hl(),Es(10,"th",10),AC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),AC(14,"Actions"),hl()()()(),Es(15,"tbody",8),$w(16,ce,19,10,"tr",9,Y),hl()()()),n&2){let t=tC();VE(16),zw(t.rowFilter.filteredRows());}}var Q=class n{route=g(W);router=g(F);destroyRef=g(we);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();rows=$i([]);rowFilter=O(this.rows,e=>[e.skill.name,e.skill.description,e.scope].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({platform:this.skillState.listPlatform().pipe(ha(()=>br([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:by({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ha(()=>br([])))}).pipe(ne$1(({namespace:e,platform:t})=>[...e,...t]),ha(()=>br([])))}))),U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:a$1})=>{let d=(c,_,W)=>({key:`${_}:${c.id??W}`,skill:c,scope:_,namedByAgents:a$1.filter(X=>a(X.skillSelectors,c.name)==="named").length});this.rows.set([...e.map((c,_)=>d(c,"platform",_)),...t.map((c,_)=>d(c,"namespace",_))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}isMutable(e){return e.scope==="namespace"&&e.skill.readOnly!==true&&!!e.skill.id}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}inspect(e){e.skill.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","skills",e.skill.id,"inspect"]:["/agentos",this.namespaceId,"skills",e.skill.id,"inspect"]);}edit(e){!this.isMutable(e)||!e.skill.id||this.router.navigate(["/agentos",this.namespaceId,"skills",e.skill.id,"edit"]);}requestDelete(e){this.deletion.request(e.key);}confirmDelete(e){if(!this.isMutable(e)||!e.skill.id)return;let t=e.namedByAgents;this.deletion.execute(e.key,{request$:this.skillState.delete(e.skill.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:a=>a.status===400?`"${e.skill.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.skill.name}" failed.${t>0?` ${t} agent(s) still name it.`:""}`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Dw({type:n,selectors:[["agentos-namespace-skills"]],decls:9,vars:3,consts:[["title","Skills","description","Skills available in this namespace, including skills inherited from the platform."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["variant","neutral"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),AC(3,"New skill"),hl()(),Bw(4,Z,2,1,"p",3),Bw(5,ee,2,0,"p",4)(6,te,2,0,"p",5)(7,ne,2,0,"p",4)(8,de,18,0,"div",6)),t&2&&(VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{Q as NamespaceSkillsComponent};
@@ -1 +1 @@
1
- import {E as m,p as pt,L as Lt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,a as po,h as ho,A as An,O as On,w as wa,_ as _o,G as vo,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn}from'./chunk-zs4CYUQt.js';import {g,W,t as F,K as we,ag as U,$ as $i,U as U$1,a2 as ha,aa as br,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,u as Dl,i as Vw,Q as Qw,f as fg,S as NI,q as $w,am as Hw,v as tC,T as AI,F as Fg,z as zw,n as lg,w as pf,x as hf}from'./main-DZHLOK7A.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=tC(3);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),AC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),VE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),AC(3,"\u2014 None \u2014"),hl(),$w(4,ge,2,2,"option",24,ce),hl(),NI(),hl()),o&2){let e=tC(3);VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(),dg("ngValue",null),VE(2),zw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Bw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=tC(2);Vw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),AC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Qw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),NI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),NI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),NI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeParameter(d))}),AC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),VE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),VE(),dg("id","param-name-"+r),AI(),VE(),dg("controlId","param-desc-"+r),VE(),dg("id","param-desc-"+r),AI(),VE(),dg("controlId","param-default-"+r),VE(),dg("id","param-default-"+r),AI();}}function _e(o,t){if(o&1){let e=Qw();Es(0,"div",14)(1,"span",33),AC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),NI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeContentEntry(d))}),AC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=tC(2);VE(2),Fg(r+1),VE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),VE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),AI(),VE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),AC(1),hl()),o&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Qw();Es(0,"button",37),vg("click",function(){pf(e);let d=tC(2);return hf(d.exportYaml())}),AC(1),hl();}if(o&2){let e=tC(2);dg("disabled",e.isExporting()),VE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=tC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),NI(),hl(),Bw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),AC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),AC(10),hl(),AC(11," in content entries to reference them. "),hl(),Es(12,"div",10),Bw(13,ve,2,0,"p",2),$w(14,he,10,8,"div",11,Hw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addParameter())}),AC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),AC(21," Each content entry is a command. Use "),Es(22,"code"),AC(23,"@AgentName"),hl(),AC(24," to target an agent, "),Es(25,"code"),AC(26,"/promptName param1 param2"),hl(),AC(27," to call another prompt, and "),Es(28,"code"),AC(29),hl(),AC(30," for parameter placeholders. "),hl(),Es(31,"div",10),$w(32,_e,7,5,"div",14,Hw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addContentEntry())}),AC(36,"+ Add content entry"),hl()()()(),Bw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),NI(),hl(),Es(40,"ds-form-actions")(41,"button",17),AC(42),hl(),Bw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=tC();return hf(d.cancel())}),AC(45,"Cancel"),hl()()();}if(o&2){let e=tC();dg("formGroup",e.form),VE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),VE(),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.availableAgentConfigs().length>0?5:-1),VE(5),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","parameters"),VE(),Vw(e.parametersArray.length===0?13:-1),VE(),zw(e.parametersArray.controls),VE(15),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","content"),VE(),zw(e.contentArray.controls),VE(5),Vw(e.errorMessage()?37:-1),VE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),VE(),Vw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Lt([this.createContentControl()],{validators:[gn.required]}),parameters:new Lt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[gn.required,gn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[gn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3),hl()(),Bw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),VE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),VE(),Vw(r.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Ut,po,ho,An,On,wa,_o,vo,hn,fn,un,dn,cn,pn,at,sn],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
1
+ import {E as m,p as pt,L as Lt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,a as po,h as ho,A as An,O as On,w as wa,_ as _o,G as vo,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn}from'./chunk-C5-HyIli.js';import {g,W,t as F,K as we,ag as U,$ as $i,U as U$1,a2 as ha,aa as br,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,u as Dl,i as Vw,Q as Qw,f as fg,S as NI,q as $w,am as Hw,v as tC,T as AI,F as Fg,z as zw,n as lg,w as pf,x as hf}from'./main-B5VGWTF5.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=tC(3);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),AC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),VE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),AC(3,"\u2014 None \u2014"),hl(),$w(4,ge,2,2,"option",24,ce),hl(),NI(),hl()),o&2){let e=tC(3);VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(),dg("ngValue",null),VE(2),zw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Bw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=tC(2);Vw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),AC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Qw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),NI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),NI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),NI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeParameter(d))}),AC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),VE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),VE(),dg("id","param-name-"+r),AI(),VE(),dg("controlId","param-desc-"+r),VE(),dg("id","param-desc-"+r),AI(),VE(),dg("controlId","param-default-"+r),VE(),dg("id","param-default-"+r),AI();}}function _e(o,t){if(o&1){let e=Qw();Es(0,"div",14)(1,"span",33),AC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),NI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=tC(2);return hf(m.removeContentEntry(d))}),AC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=tC(2);VE(2),Fg(r+1),VE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),VE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),AI(),VE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),AC(1),hl()),o&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Qw();Es(0,"button",37),vg("click",function(){pf(e);let d=tC(2);return hf(d.exportYaml())}),AC(1),hl();}if(o&2){let e=tC(2);dg("disabled",e.isExporting()),VE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=tC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),NI(),hl(),Bw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),AC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),AC(10),hl(),AC(11," in content entries to reference them. "),hl(),Es(12,"div",10),Bw(13,ve,2,0,"p",2),$w(14,he,10,8,"div",11,Hw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addParameter())}),AC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),AC(21," Each content entry is a command. Use "),Es(22,"code"),AC(23,"@AgentName"),hl(),AC(24," to target an agent, "),Es(25,"code"),AC(26,"/promptName param1 param2"),hl(),AC(27," to call another prompt, and "),Es(28,"code"),AC(29),hl(),AC(30," for parameter placeholders. "),hl(),Es(31,"div",10),$w(32,_e,7,5,"div",14,Hw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=tC();return hf(d.addContentEntry())}),AC(36,"+ Add content entry"),hl()()()(),Bw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),NI(),hl(),Es(40,"ds-form-actions")(41,"button",17),AC(42),hl(),Bw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=tC();return hf(d.cancel())}),AC(45,"Cancel"),hl()()();}if(o&2){let e=tC();dg("formGroup",e.form),VE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),VE(),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.availableAgentConfigs().length>0?5:-1),VE(5),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","parameters"),VE(),Vw(e.parametersArray.length===0?13:-1),VE(),zw(e.parametersArray.controls),VE(15),Fg(e.paramPlaceholderSyntax),VE(2),dg("formArrayName","content"),VE(),zw(e.contentArray.controls),VE(5),Vw(e.errorMessage()?37:-1),VE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),VE(),Vw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Lt([this.createContentControl()],{validators:[gn.required]}),parameters:new Lt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[gn.required,gn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[gn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),AC(3),hl()(),Bw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(VE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),VE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),VE(),Vw(r.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Ut,po,ho,An,On,wa,_o,vo,hn,fn,un,dn,cn,pn,at,sn],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-BL3wnbf2.js';import {v}from'./chunk-C80imceV.js';import {g,W as W$1,t as F,K as we,$ as $i,U as U$1,ad as ne,a1 as ga,aa as br,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,n as lg,w as pf,x as hf}from'./main-DZHLOK7A.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-zs4CYUQt.js';import'./chunk-BE-UpkfJ.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let t=tC();VE(),Fg(t.deletion.error());}}function z(i,e){i&1&&(Es(0,"p",4),AC(1,"Loading AI providers\u2026"),hl());}function J(i,e){i&1&&(Es(0,"p",5),AC(1,"No AI providers available."),hl());}function Q(i,e){i&1&&(Es(0,"p",4),AC(1,"No AI providers match the current filter."),hl());}function W(i,e){i&1&&(Es(0,"ds-tag",17),AC(1,"Read-only"),hl());}function X(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.duplicate(d))}),AC(1," Duplicate "),hl();}if(i&2){let t=tC().$implicit;lg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC(2).$implicit,c=tC(2);return hf(c.edit(d))}),AC(1," Edit "),hl();}if(i&2){let t=tC(2).$implicit;lg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=Qw();Bw(0,Y,2,1,"button",20),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.deletion.request(d.key))})("deleteConfirmed",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(i&2){let t=tC().$implicit,r=tC(2);Vw(r.deletion.confirmingId()!==t.key?0:-1),VE(),dg("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Es(0,"button",21),AC(1,"Inherited"),hl());}function te(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),AC(8),hl(),Bw(9,W,2,0,"ds-tag",17),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,X,2,1,"button",20),Bw(13,Z,2,4)(14,ee,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,r=tC(2);VE(2),Fg(t.config.name),VE(2),Fg(t.config.apiType),VE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(t.scopeLabel),VE(),Vw(t.canMutate?-1:9),VE(3),Vw(r.deletion.confirmingId()!==t.key?12:-1),VE(),Vw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"API type"),hl(),Es(8,"th",10),AC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,te,15,7,"tr",9,H),hl()()()),i&2){let t=tC();VE(14),zw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return r.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),AC(3,"New AI provider"),hl()(),Bw(4,U,2,1,"p",3),Bw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(VE(),dg("query",r.rowFilter.query()),VE(3),Vw(r.deletion.error()?4:-1),VE(),Vw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-CPBC1Xfb.js';import {v}from'./chunk-DSBR7BB1.js';import {g,W as W$1,t as F,K as we,$ as $i,U as U$1,ad as ne,a1 as ga,aa as br,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,n as lg,w as pf,x as hf}from'./main-B5VGWTF5.js';import {z as k,j as O$1,e as at,c as fn,k as ko,l as Fo,P,B as P$1}from'./chunk-C5-HyIli.js';import'./chunk-CErgoGuy.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Es(0,"p",3),AC(1),hl()),i&2){let t=tC();VE(),Fg(t.deletion.error());}}function z(i,e){i&1&&(Es(0,"p",4),AC(1,"Loading AI providers\u2026"),hl());}function J(i,e){i&1&&(Es(0,"p",5),AC(1,"No AI providers available."),hl());}function Q(i,e){i&1&&(Es(0,"p",4),AC(1,"No AI providers match the current filter."),hl());}function W(i,e){i&1&&(Es(0,"ds-tag",17),AC(1,"Read-only"),hl());}function X(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.duplicate(d))}),AC(1," Duplicate "),hl();}if(i&2){let t=tC().$implicit;lg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=Qw();Es(0,"button",22),vg("click",function(){pf(t);let d=tC(2).$implicit,c=tC(2);return hf(c.edit(d))}),AC(1," Edit "),hl();}if(i&2){let t=tC(2).$implicit;lg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=Qw();Bw(0,Y,2,1,"button",20),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.deletion.request(d.key))})("deleteConfirmed",function(){pf(t);let d=tC().$implicit,c=tC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=tC(3);return hf(d.deletion.cancel())}),hl();}if(i&2){let t=tC().$implicit,r=tC(2);Vw(r.deletion.confirmingId()!==t.key?0:-1),VE(),dg("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Es(0,"button",21),AC(1,"Inherited"),hl());}function te(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14)(6,"div",15)(7,"ds-tag",16),AC(8),hl(),Bw(9,W,2,0,"ds-tag",17),hl()(),Es(10,"td",18)(11,"div",19),Bw(12,X,2,1,"button",20),Bw(13,Z,2,4)(14,ee,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,r=tC(2);VE(2),Fg(t.config.name),VE(2),Fg(t.config.apiType),VE(3),dg("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),VE(),Fg(t.scopeLabel),VE(),Vw(t.canMutate?-1:9),VE(3),Vw(r.deletion.confirmingId()!==t.key?12:-1),VE(),Vw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"API type"),hl(),Es(8,"th",10),AC(9,"Scope"),hl(),Es(10,"th",10)(11,"span",11),AC(12,"Actions"),hl()()()(),Es(13,"tbody",8),$w(14,te,15,7,"tr",9,H),hl()()()),i&2){let t=tC();VE(14),zw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),ga(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return r.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return r.openCreateForm()}),AC(3,"New AI provider"),hl()(),Bw(4,U,2,1,"p",3),Bw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(VE(),dg("query",r.rowFilter.query()),VE(3),Vw(r.deletion.error()?4:-1),VE(),Vw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
@@ -1 +1 @@
1
- import {b as hn,c as fn,r as rn,D as pn,e as at,n as ln,J as Pi,K as On}from'./chunk-zs4CYUQt.js';import {g,W as W$1,t as F,K as we,ag as U,$ as $i,o as oT,U as U$1,D as Dw,au as $t,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,M as Mg,u as Dl,q as $w,z as zw,Q as Qw,f as fg,av as QC,aw as XC,w as pf,x as hf,ax as YD}from'./main-DZHLOK7A.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),AC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),AC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),AC(1,"User context"),hl(),Es(2,"dd",6),AC(3),hl()),t&2){let e=tC();VE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.systemPromptCollapsed()),VE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.instructionsCollapsed()),VE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),AC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),AC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),AC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),AC(3),hl(),Bw(4,ee,2,0,"span",17),Bw(5,te,2,0,"span",17),hl(),Es(6,"p",3),AC(7),hl()()),t&2){let e=n.$implicit;VE(3),Fg(e.name),VE(),Vw(e.namespaceId?-1:4),VE(),Vw(e.readOnly?5:-1),VE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),$w(1,ne,8,4,"li",15,j),hl()),t&2){let e=tC(2);VE(),zw(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),AC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),QC(1,"agentosMarkdown")),t&2){let e=tC().$implicit;dg("innerHTML",XC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Qw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=tC(3);return hf(U.toggleTool(m))}),Bw(2,ae,2,3,"div",19),Es(3,"pre",20),AC(4),hl()()();}if(t&2){let e=n.$implicit,r=tC(3);VE(),dg("heading",e.name)("open",r.isToolExpanded(e)),VE(),Vw(e.description?2:-1),VE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),$w(1,de,5,4,"li",null,z),hl()),t&2){let e=tC();VE(),zw(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),AC(3,"Name"),hl(),Es(4,"dd"),AC(5),hl(),Es(6,"dt"),AC(7,"Resolved model"),hl(),Es(8,"dd",6),AC(9),hl(),Es(10,"dt"),AC(11,"Provider"),hl(),Es(12,"dd"),AC(13),hl(),Es(14,"dt",7),AC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),AC(18),hl()(),Bw(19,W,4,1),hl()(),Bw(20,X,4,2,"ds-card"),Bw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),Bw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),Bw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=tC();VE(5),Fg(e.name),VE(4),Fg(e.resolvedModelApiName),VE(4),Fg(e.resolvedProviderName),VE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),VE(),Dl(" ",e.executionMode," "),VE(),Vw(e.userId?19:-1),VE(),Vw(e.systemPrompt?20:-1),VE(),Vw(e.instructions?21:-1),VE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),VE(),Vw(r.resolvedSkills().length===0?23:24),VE(2),dg("heading","Tools ("+e.tools.length+")"),VE(),Vw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=oT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),AC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),AC(5,"Edit config \u2192"),hl()(),Bw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;VE(4),dg("routerLink",r.editRoute()),VE(2),Vw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,hn,fn,rn,pn,at,ln,Pi,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
1
+ import {b as hn,c as fn,r as rn,D as pn,e as at,n as ln,J as Pi,K as On}from'./chunk-C5-HyIli.js';import {g,W as W$1,t as F,K as we,ag as U,$ as $i,o as oT,U as U$1,D as Dw,au as $t,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,M as Mg,u as Dl,q as $w,z as zw,Q as Qw,f as fg,av as QC,aw as XC,w as pf,x as hf,ax as YD}from'./main-B5VGWTF5.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),AC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),AC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),AC(1,"User context"),hl(),Es(2,"dd",6),AC(3),hl()),t&2){let e=tC();VE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.systemPromptCollapsed()),VE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.instructionsCollapsed()),VE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),AC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),AC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),AC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),AC(3),hl(),Bw(4,ee,2,0,"span",17),Bw(5,te,2,0,"span",17),hl(),Es(6,"p",3),AC(7),hl()()),t&2){let e=n.$implicit;VE(3),Fg(e.name),VE(),Vw(e.namespaceId?-1:4),VE(),Vw(e.readOnly?5:-1),VE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),$w(1,ne,8,4,"li",15,j),hl()),t&2){let e=tC(2);VE(),zw(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),AC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),QC(1,"agentosMarkdown")),t&2){let e=tC().$implicit;dg("innerHTML",XC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Qw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=tC(3);return hf(U.toggleTool(m))}),Bw(2,ae,2,3,"div",19),Es(3,"pre",20),AC(4),hl()()();}if(t&2){let e=n.$implicit,r=tC(3);VE(),dg("heading",e.name)("open",r.isToolExpanded(e)),VE(),Vw(e.description?2:-1),VE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),$w(1,de,5,4,"li",null,z),hl()),t&2){let e=tC();VE(),zw(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),AC(3,"Name"),hl(),Es(4,"dd"),AC(5),hl(),Es(6,"dt"),AC(7,"Resolved model"),hl(),Es(8,"dd",6),AC(9),hl(),Es(10,"dt"),AC(11,"Provider"),hl(),Es(12,"dd"),AC(13),hl(),Es(14,"dt",7),AC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),AC(18),hl()(),Bw(19,W,4,1),hl()(),Bw(20,X,4,2,"ds-card"),Bw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),Bw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),Bw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=tC();VE(5),Fg(e.name),VE(4),Fg(e.resolvedModelApiName),VE(4),Fg(e.resolvedProviderName),VE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),VE(),Dl(" ",e.executionMode," "),VE(),Vw(e.userId?19:-1),VE(),Vw(e.systemPrompt?20:-1),VE(),Vw(e.instructions?21:-1),VE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),VE(),Vw(r.resolvedSkills().length===0?23:24),VE(2),dg("heading","Tools ("+e.tools.length+")"),VE(),Vw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=oT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),AC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),AC(5,"Edit config \u2192"),hl()(),Bw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;VE(4),dg("routerLink",r.editRoute()),VE(2),Vw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,hn,fn,rn,pn,at,ln,Pi,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-BE-UpkfJ.js';import {y}from'./chunk-zs4CYUQt.js';import {g,aE as X,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,N as x,L as w$1,a5 as vd,aF as an,aG as Ot,aH as cn,a6 as x$1}from'./main-DZHLOK7A.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([t])=>{let e=this.loadPlatformSettings().pipe(ha(()=>br([])));return t?Cy([e,this.loadNamespaceSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):Cy([e,this.loadNamespaceSettings("").pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):br([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),vd(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),vd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(vd(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(ga(r=>this.controller.connectAuthSetting(t,e).pipe(vd(h=>n(h.authorizationUrl)),ga(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ga(()=>this.getConnection(t,e).pipe(ha(()=>br(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=x$1({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
1
+ import {i}from'./chunk-CErgoGuy.js';import {y}from'./chunk-C5-HyIli.js';import {g,aE as X,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,N as x,L as w$1,a5 as vd,aF as an,aG as Ot,aH as cn,a6 as x$1}from'./main-B5VGWTF5.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([t])=>{let e=this.loadPlatformSettings().pipe(ha(()=>br([])));return t?Cy([e,this.loadNamespaceSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):Cy([e,this.loadNamespaceSettings("").pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):br([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),vd(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),vd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(vd(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(ga(r=>this.controller.connectAuthSetting(t,e).pipe(vd(h=>n(h.authorizationUrl)),ga(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ga(()=>this.getConnection(t,e).pipe(ha(()=>br(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=x$1({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
@@ -1 +1 @@
1
- import {v}from'./chunk-C80imceV.js';import {I}from'./chunk-Cck7m2qM.js';import {O}from'./chunk-Bxl-W5rv.js';import {g,W,t as F,K as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,o as oT,a1 as ga,U,O as Of,ac as by,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,a2 as ha,ad as ne,Q as Qw,q as $w,ae as Lw,S as NI,f as fg,v as tC,z as zw,T as AI,u as Dl,F as Fg,w as pf,x as hf}from'./main-DZHLOK7A.js';import {p as pt,T as Te$1,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,r as rn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,v as yn,U as Ut,x as ya,a as po,h as ho,A as An,O as On,W as Wt}from'./chunk-zs4CYUQt.js';import'./chunk-BE-UpkfJ.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),NI(),AC(2),hl()),i&2){let t=e.$implicit,n=tC(2);VE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),VE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),VE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),NI(),AC(3," Grant automatically "),hl(),Es(4,"p",2),AC(5),hl()()),i&2){let t=tC(2);VE(2),dg("formControl",t.autoGrantControl),AI(),VE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Qw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=tC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=tC(2);VE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let a=tC(2);return hf(a.exportYaml())}),AC(1),hl();}if(i&2){let t=tC(2);dg("disabled",t.isExporting()),VE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=tC();return hf(a.submit())}),Es(1,"ds-fieldset",5),$w(2,xe,3,4,"label",6,Lw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),AC(7,"Select type"),hl(),$w(8,Ie,2,2,"option",10,Lw().trackByType,true),hl(),NI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),NI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),NI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),AC(17,"None"),hl(),$w(18,Ne,2,2,"option",10,be),hl(),NI(),hl(),Bw(20,Ae,6,2,"div",18),Bw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),AC(24),hl(),Bw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=tC();return hf(a.cancel())}),AC(27,"Cancel"),hl()()();}if(i&2){let t,n=tC();dg("formGroup",n.form),VE(),dg("disabled",n.isEditMode()),VE(),zw(n.scopeOptions),VE(3),dg("formControl",n.typeControl),AI(),VE(3),zw(n.integrationTypes()),VE(3),dg("formControl",n.nameControl),AI(),VE(2),dg("formControl",n.descriptionControl),AI(),VE(2),dg("formControl",n.authSettingNameControl),AI(),VE(),dg("ngValue",null),VE(2),zw(n.authSettingOptions()),VE(2),Vw(n.isAutoGrantable()?20:-1),VE(),Vw((t=n.schema())?21:-1,t),VE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),VE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),VE(),Vw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[gn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=oT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=oT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Integrations "),hl()(),Bw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(VE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,rn,at,sn,an,qt,md,Co,Mo,Ht,yn,Ut,ya,po,ho,An,On,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
1
+ import {v}from'./chunk-DSBR7BB1.js';import {I}from'./chunk-szCUHbC4.js';import {O}from'./chunk-BWgH5ifY.js';import {g,W,t as F,K as we,a8 as _,a9 as F$1,aa as br,$ as $i,ab as le,o as oT,a1 as ga,U,O as Of,ac as by,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,a2 as ha,ad as ne,Q as Qw,q as $w,ae as Lw,S as NI,f as fg,v as tC,z as zw,T as AI,u as Dl,F as Fg,w as pf,x as hf}from'./main-B5VGWTF5.js';import {p as pt,T as Te$1,g as gn,b as hn,c as fn,u as un,o as dn,d as cn,r as rn,e as at,i as sn,t as an,q as qt,m as md,C as Co,M as Mo,H as Ht,v as yn,U as Ut,x as ya,a as po,h as ho,A as An,O as On,W as Wt}from'./chunk-C5-HyIli.js';import'./chunk-CErgoGuy.js';var be=(i,e)=>e.value;function _e(i,e){i&1&&(Es(0,"p",2),AC(1,"Loading\u2026"),hl());}function xe(i,e){if(i&1&&(Es(0,"label",6),fg(1,"input",22),NI(),AC(2),hl()),i&2){let t=e.$implicit,n=tC(2);VE(),dg("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),AI(),VE(),Dl(" ",t.label," ");}}function Ie(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.type),VE(),Fg(t.displayName);}}function Ne(i,e){if(i&1&&(Es(0,"option",10),AC(1),hl()),i&2){let t=e.$implicit;dg("value",t.value),VE(),Fg(t.label);}}function Ae(i,e){if(i&1&&(Es(0,"div",18)(1,"label",6),fg(2,"input",23),NI(),AC(3," Grant automatically "),hl(),Es(4,"p",2),AC(5),hl()()),i&2){let t=tC(2);VE(2),dg("formControl",t.autoGrantControl),AI(),VE(3),Dl(" Give this integration to ",t.autoGrantReach(),", without each agent having to declare it. An agent can still opt out by mapping this configuration to an empty tool list. ");}}function Ee(i,e){if(i&1){let t=Qw();Es(0,"ds-card")(1,"ds-json-schema-form",24),vg("valueChange",function(a){pf(t);let p=tC(2);return hf(p.onParamsChange(a))}),hl()();}if(i&2){let t=tC(2);VE(),dg("schema",e)("value",t.initialParams());}}function Fe(i,e){if(i&1){let t=Qw();Es(0,"button",25),vg("click",function(){pf(t);let a=tC(2);return hf(a.exportYaml())}),AC(1),hl();}if(i&2){let t=tC(2);dg("disabled",t.isExporting()),VE(),Dl(" ",t.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Te(i,e){if(i&1){let t=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(t);let a=tC();return hf(a.submit())}),Es(1,"ds-fieldset",5),$w(2,xe,3,4,"label",6,Lw().trackByScope,true),hl(),Es(4,"ds-form-field",7)(5,"select",8)(6,"option",9),AC(7,"Select type"),hl(),$w(8,Ie,2,2,"option",10,Lw().trackByType,true),hl(),NI(),hl(),Es(10,"ds-form-field",11),fg(11,"input",12),NI(),hl(),Es(12,"ds-form-field",13),fg(13,"textarea",14),NI(),hl(),Es(14,"ds-form-field",15)(15,"select",16)(16,"option",17),AC(17,"None"),hl(),$w(18,Ne,2,2,"option",10,be),hl(),NI(),hl(),Bw(20,Ae,6,2,"div",18),Bw(21,Ee,2,2,"ds-card"),Es(22,"ds-form-actions")(23,"button",19),AC(24),hl(),Bw(25,Fe,2,2,"button",20),Es(26,"button",21),vg("click",function(){pf(t);let a=tC();return hf(a.cancel())}),AC(27,"Cancel"),hl()()();}if(i&2){let t,n=tC();dg("formGroup",n.form),VE(),dg("disabled",n.isEditMode()),VE(),zw(n.scopeOptions),VE(3),dg("formControl",n.typeControl),AI(),VE(3),zw(n.integrationTypes()),VE(3),dg("formControl",n.nameControl),AI(),VE(2),dg("formControl",n.descriptionControl),AI(),VE(2),dg("formControl",n.authSettingNameControl),AI(),VE(),dg("ngValue",null),VE(2),zw(n.authSettingOptions()),VE(2),Vw(n.isAutoGrantable()?20:-1),VE(),Vw((t=n.schema())?21:-1,t),VE(2),dg("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),VE(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),VE(),Vw(n.isEditMode()?25:-1);}}var Ve=new Set(["platform","namespace","userOnNs","userGlobal"]),w=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ve=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(O);integrationTypeController=g(_);authSettingState=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F$1(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new pt({name:new Te$1("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te$1(null),type:new Te$1("",{nonNullable:true,validators:[gn.required]}),scope:new Te$1("namespace",{nonNullable:true}),autoGrant:new Te$1(false,{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}get autoGrantControl(){return this.form.controls.autoGrant}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);scopeOptions=[{value:"platform",label:w.platform},{value:"namespace",label:w.namespace},{value:"userOnNs",label:w.userOnNs},{value:"userGlobal",label:w.userGlobal}];authSettingNameControl=new Te$1(null);loadedAuthSettings=$i([]);authSettingsLoaded=$i(false);savedAuthSettingName=$i(null);authSettingsScope$=new le;authSettingOptions=oT(()=>{let e=this.loadedAuthSettings(),t=this.savedAuthSettingName();return !t||!this.authSettingsLoaded()||e.some(n=>n.value===t)?e:[...e,{value:t,label:`${t} (not found)`}]});paramsValue=$i(null);initialParams=$i(null);integrationTypes=F$1(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F$1(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});scopeValue=F$1(this.form.controls.scope.valueChanges,{initialValue:this.form.controls.scope.value});schema=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});isAutoGrantable=oT(()=>{let e=this.selectedType();return e?this.integrationTypes().find(t=>t.type===e)?.autoGrantable??false:false});autoGrantReach=oT(()=>{switch(this.scopeValue()){case "platform":return "every agent of this environment";case "namespace":return "every agent of this namespace";default:return "your own runs"}});existingConfig=null;constructor(){this.authSettingsScope$.pipe(ga(e=>this.loadAuthSettingLayers(e)),U(this.destroyRef)).subscribe(e=>{this.loadedAuthSettings.set(this.toAuthSettingOptions(e)),this.authSettingsLoaded.set(true);}),Of(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let a=this.parseScope(t.get("scope"));this.scopeControl.setValue(a),this.loadAuthSettingsForScope(a),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(D=>{this.loadAuthSettingsForScope(D);});let p=t.get("template");p&&this.hydrateFromTemplate(p);}parseScope(e){return e&&Ve.has(e)?e:"namespace"}deriveScopeFromConfig(e){return !e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t;let n=this.deriveScopeFromConfig(t);this.scopeControl.setValue(n),this.applyConfigToForm(t),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(e){this.isLoading.set(true),this.state.getById(e).pipe(U(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters),this.authSettingNameControl.setValue(e.authSettingName??null),this.savedAuthSettingName.set(e.authSettingName??null),this.autoGrantControl.setValue(e.autoGrant??false);}loadAuthSettingsForScope(e){this.authSettingsLoaded.set(false),this.authSettingsScope$.next(e);}loadAuthSettingLayers(e){let t=(p,D)=>D.pipe(ha(()=>br([])),ne(Se=>({label:p,settings:Se}))),n=t("platform",this.authSettingState.loadPlatformSettings()),a=t("mine",this.authSettingState.loadUserSettings("global"));return e==="platform"||e==="userGlobal"?by([a,n]):by([t("mine",this.authSettingState.loadUserSettings(this.namespaceId)),t("namespace",this.authSettingState.loadNamespaceSettings(this.namespaceId)),a,n])}toAuthSettingOptions(e){let t=new Map;for(let{label:n,settings:a}of e)for(let{name:p}of a)p&&t.set(p,(t.get(p)??new Set).add(n));return [...t.entries()].sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>({value:n,label:`${n} (${[...a].join(", ")})`}))}onParamsChange(e){this.paramsValue.set(e);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null,autoGrant:this.isAutoGrantable()&&this.autoGrantControl.value},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let e=this.existingConfig?.id;!e||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(e).pipe(U(this.destroyRef)).subscribe({next:t=>{let n=new Blob([t],{type:"application/yaml"}),a=URL.createObjectURL(n),p=document.createElement("a");p.href=a,p.download=`${this.existingConfig?.name??"integration"}.yaml`,p.click(),URL.revokeObjectURL(a),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Dw({type:i,selectors:[["agentos-integration-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to integrations",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Scope",3,"disabled"],["dsCheck",""],["label","Type","controlId","integration-type","required",""],["dsControl","","id","integration-type",3,"formControl"],["value","","disabled",""],[3,"value"],["label","Name","controlId","integration-name","required",""],["dsControl","","id","integration-name","type","text","placeholder","Integration name","autocomplete","off",3,"formControl"],["label","Description","controlId","integration-description"],["dsControl","","id","integration-description","placeholder","Optional description","rows","3",3,"formControl"],["label","Auth Setting","controlId","integration-auth-setting","hint","Only the name is saved. It is resolved at run time for the user running the case, the most specific layer winning (user on this namespace > namespace > user > platform), so a shared integration can rely on each user's own auth setting of that name."],["dsControl","","id","integration-auth-setting",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["type","radio",3,"value","formControl","disabled"],["type","checkbox",3,"formControl"],[3,"valueChange","schema","value"],["dsButton","","type","button",3,"click","disabled"]],template:function(t,n){t&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return n.cancel()}),AC(3," \u2190 Integrations "),hl()(),Bw(4,_e,2,0,"p",2)(5,Te,28,12,"form",3),hl()),t&2&&(VE(),dg("title",n.isEditMode()?"Edit integration":"New integration"),VE(3),Vw(n.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,rn,at,sn,an,qt,md,Co,Mo,Ht,yn,Ut,ya,po,ho,An,On,Wt],encapsulation:2})};export{ve as IntegrationFormComponent};
@@ -33,5 +33,5 @@
33
33
  <style>:root{--color-bg:#f5f6f8;--color-bg-solid:#f5f6f8;--color-bg-secondary:rgba(255, 255, 255, .7);--color-bg-secondary-rgb:255 255 255;--color-text:#1d1d1f;--color-text-secondary:#6e6e73;--color-text-inverse:#ffffff;--color-text-tertiary:#a1a1a6;--color-primary:#007aff;--color-primary-hover:#0051d5;--color-accent:#8b5cf6;--color-link:#007aff;--color-border:rgba(0, 0, 0, .1);--color-border-light:rgba(40, 40, 40, .08);--color-input-bg:rgba(255, 255, 255, .8);--color-bg-hover:rgba(0, 0, 0, .04);--color-success:#34c759;--color-success-bg:#e3f5e1;--color-error:#ff3b30;--color-warning:#ff9500;--color-info:#5ac8fa;--color-message-user:rgba(0, 122, 255, .1);--color-message-ai:rgba(255, 255, 255, .8);--color-code-bg:rgba(142, 142, 147, .12);--color-code-text:#ff375f;--glass-bg:rgba(255, 255, 255, .72);--glass-border:rgba(255, 255, 255, .18);--glass-shadow:0 8px 32px 0 rgba(31, 38, 135, .15);--glass-backdrop-blur:blur(20px);--color-modal-bg:#ffffff;--color-surface:#ffffff;--color-modal-border:rgba(0, 0, 0, .12);--color-modal-shadow:0 8px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .1);--color-shadow:rgba(0, 0, 0, .08);--color-overlay:rgba(0, 0, 0, .4);--color-surface-hover:var(--color-bg-hover);--color-surface-secondary:rgba(0, 0, 0, .03);--color-surface-muted:rgba(0, 0, 0, .05);--color-divider:rgba(0, 0, 0, .1)}*{box-sizing:border-box}html{color-scheme:light}html{--mat-sys-background:light-dark(#faf9fd, #121316);--mat-sys-error:light-dark(#ba1a1a, #ffb4ab);--mat-sys-error-container:light-dark(#ffdad6, #93000a);--mat-sys-inverse-on-surface:light-dark(#f2f0f4, #2f3033);--mat-sys-inverse-primary:light-dark(#abc7ff, #005cbb);--mat-sys-inverse-surface:light-dark(#2f3033, #e3e2e6);--mat-sys-on-background:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-error:light-dark(#ffffff, #690005);--mat-sys-on-error-container:light-dark(#93000a, #ffdad6);--mat-sys-on-primary:light-dark(#ffffff, #002f65);--mat-sys-on-primary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-primary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-primary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-on-secondary:light-dark(#ffffff, #283041);--mat-sys-on-secondary-container:light-dark(#3e4759, #dae2f9);--mat-sys-on-secondary-fixed:light-dark(#131c2b, #131c2b);--mat-sys-on-secondary-fixed-variant:light-dark(#3e4759, #3e4759);--mat-sys-on-surface:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-surface-variant:light-dark(#44474e, #e0e2ec);--mat-sys-on-tertiary:light-dark(#ffffff, #002f65);--mat-sys-on-tertiary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-tertiary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-tertiary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-outline:light-dark(#74777f, #8e9099);--mat-sys-outline-variant:light-dark(#c4c6d0, #44474e);--mat-sys-primary:light-dark(#005cbb, #abc7ff);--mat-sys-primary-container:light-dark(#d7e3ff, #00458f);--mat-sys-primary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-primary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-scrim:light-dark(#000000, #000000);--mat-sys-secondary:light-dark(#565e71, #bec6dc);--mat-sys-secondary-container:light-dark(#dae2f9, #3e4759);--mat-sys-secondary-fixed:light-dark(#dae2f9, #dae2f9);--mat-sys-secondary-fixed-dim:light-dark(#bec6dc, #bec6dc);--mat-sys-shadow:light-dark(#000000, #000000);--mat-sys-surface:light-dark(#faf9fd, #121316);--mat-sys-surface-bright:light-dark(#faf9fd, #38393c);--mat-sys-surface-container:light-dark(#efedf0, #1f2022);--mat-sys-surface-container-high:light-dark(#e9e7eb, #292a2c);--mat-sys-surface-container-highest:light-dark(#e3e2e6, #343537);--mat-sys-surface-container-low:light-dark(#f4f3f6, #1a1b1f);--mat-sys-surface-container-lowest:light-dark(#ffffff, #0d0e11);--mat-sys-surface-dim:light-dark(#dbd9dd, #121316);--mat-sys-surface-tint:light-dark(#005cbb, #abc7ff);--mat-sys-surface-variant:light-dark(#e0e2ec, #44474e);--mat-sys-tertiary:light-dark(#005cbb, #abc7ff);--mat-sys-tertiary-container:light-dark(#d7e3ff, #00458f);--mat-sys-tertiary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-tertiary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-neutral-variant20:#2d3038;--mat-sys-neutral10:#1a1b1f;--mat-sys-level0:0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12);--mat-sys-level1:0px 2px 1px -1px rgba(0, 0, 0, .2), 0px 1px 1px 0px rgba(0, 0, 0, .14), 0px 1px 3px 0px rgba(0, 0, 0, .12);--mat-sys-level2:0px 3px 3px -2px rgba(0, 0, 0, .2), 0px 3px 4px 0px rgba(0, 0, 0, .14), 0px 1px 8px 0px rgba(0, 0, 0, .12);--mat-sys-level3:0px 3px 5px -1px rgba(0, 0, 0, .2), 0px 6px 10px 0px rgba(0, 0, 0, .14), 0px 1px 18px 0px rgba(0, 0, 0, .12);--mat-sys-level4:0px 5px 5px -3px rgba(0, 0, 0, .2), 0px 8px 10px 1px rgba(0, 0, 0, .14), 0px 3px 14px 2px rgba(0, 0, 0, .12);--mat-sys-level5:0px 7px 8px -4px rgba(0, 0, 0, .2), 0px 12px 17px 2px rgba(0, 0, 0, .14), 0px 5px 22px 4px rgba(0, 0, 0, .12);--mat-sys-body-large:400 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-line-height:1.5rem;--mat-sys-body-large-size:1rem;--mat-sys-body-large-tracking:.031rem;--mat-sys-body-large-weight:400;--mat-sys-body-medium:400 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-line-height:1.25rem;--mat-sys-body-medium-size:.875rem;--mat-sys-body-medium-tracking:.016rem;--mat-sys-body-medium-weight:400;--mat-sys-body-small:400 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-line-height:1rem;--mat-sys-body-small-size:.75rem;--mat-sys-body-small-tracking:.025rem;--mat-sys-body-small-weight:400;--mat-sys-display-large:400 3.562rem / 4rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-line-height:4rem;--mat-sys-display-large-size:3.562rem;--mat-sys-display-large-tracking:-.016rem;--mat-sys-display-large-weight:400;--mat-sys-display-medium:400 2.812rem / 3.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-line-height:3.25rem;--mat-sys-display-medium-size:2.812rem;--mat-sys-display-medium-tracking:0;--mat-sys-display-medium-weight:400;--mat-sys-display-small:400 2.25rem / 2.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-line-height:2.75rem;--mat-sys-display-small-size:2.25rem;--mat-sys-display-small-tracking:0;--mat-sys-display-small-weight:400;--mat-sys-headline-large:400 2rem / 2.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-line-height:2.5rem;--mat-sys-headline-large-size:2rem;--mat-sys-headline-large-tracking:0;--mat-sys-headline-large-weight:400;--mat-sys-headline-medium:400 1.75rem / 2.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-line-height:2.25rem;--mat-sys-headline-medium-size:1.75rem;--mat-sys-headline-medium-tracking:0;--mat-sys-headline-medium-weight:400;--mat-sys-headline-small:400 1.5rem / 2rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-line-height:2rem;--mat-sys-headline-small-size:1.5rem;--mat-sys-headline-small-tracking:0;--mat-sys-headline-small-weight:400;--mat-sys-label-large:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-line-height:1.25rem;--mat-sys-label-large-size:.875rem;--mat-sys-label-large-tracking:.006rem;--mat-sys-label-large-weight:500;--mat-sys-label-large-weight-prominent:700;--mat-sys-label-medium:500 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-line-height:1rem;--mat-sys-label-medium-size:.75rem;--mat-sys-label-medium-tracking:.031rem;--mat-sys-label-medium-weight:500;--mat-sys-label-medium-weight-prominent:700;--mat-sys-label-small:500 .688rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-line-height:1rem;--mat-sys-label-small-size:.688rem;--mat-sys-label-small-tracking:.031rem;--mat-sys-label-small-weight:500;--mat-sys-title-large:400 1.375rem / 1.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-line-height:1.75rem;--mat-sys-title-large-size:1.375rem;--mat-sys-title-large-tracking:0;--mat-sys-title-large-weight:400;--mat-sys-title-medium:500 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-line-height:1.5rem;--mat-sys-title-medium-size:1rem;--mat-sys-title-medium-tracking:.009rem;--mat-sys-title-medium-weight:500;--mat-sys-title-small:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-line-height:1.25rem;--mat-sys-title-small-size:.875rem;--mat-sys-title-small-tracking:.006rem;--mat-sys-title-small-weight:500;--mat-sys-corner-extra-large:28px;--mat-sys-corner-extra-large-top:28px 28px 0 0;--mat-sys-corner-extra-small:4px;--mat-sys-corner-extra-small-top:4px 4px 0 0;--mat-sys-corner-full:9999px;--mat-sys-corner-large:16px;--mat-sys-corner-large-end:0 16px 16px 0;--mat-sys-corner-large-start:16px 0 0 16px;--mat-sys-corner-large-top:16px 16px 0 0;--mat-sys-corner-medium:12px;--mat-sys-corner-none:0;--mat-sys-corner-small:8px;--mat-sys-dragged-state-layer-opacity:.16;--mat-sys-focus-state-layer-opacity:.12;--mat-sys-hover-state-layer-opacity:.08;--mat-sys-pressed-state-layer-opacity:.12;--mat-snack-bar-container-shape:transparent;--mat-snack-bar-container-color:transparent;--mat-snack-bar-supporting-text-color:var(--color-text)}html,body{margin:0;padding:0;width:100%;height:100%}body{background:var(--color-bg);color:var(--color-text);font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,Segoe UI,Helvetica Neue,Arial,sans-serif;transition:background .3s ease,color .3s ease;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;padding:0!important}</style><link rel="stylesheet" href="styles-6KD2P5NP.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-6KD2P5NP.css"></noscript></head>
34
34
  <body>
35
35
  <app-root></app-root>
36
- <script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-DZHLOK7A.js" type="module"></script></body>
36
+ <script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-B5VGWTF5.js" type="module"></script></body>
37
37
  </html>